text
stringlengths
2
999k
import time from itertools import product import numpy as np import pandas as pd import pytest from kts.core.backend.address_manager import get_address_manager from kts.core.backend.progress import pbar from kts.core.backend.signal import get_signal_manager from kts.core.feature_constructor.user_defined import Featur...
# Copyright (c) 2019, NVIDIA CORPORATION. import pytest import cudf from cudf.tests.utils import assert_eq import numpy as np import cuspatial def test_camera_oob_0(): with pytest.raises(RuntimeError): result = cuspatial.lonlat_to_xy_km_coordinates(-200, 0, cudf.Series([0]), cudf.S...
def choose(n, i): """ >>> choose(4, 2) 6 """ a = 1 for k in range(n, n-i, -1): a = a * k for k in range(i, 0, -1): a = a / k return a
# TODO: allow the loading of instantiated component-entity templates # these templates should be stored in a json format
''' OnionPerf Authored by Rob Jansen, 2015 See LICENSE for licensing information ''' __all__ = [ 'analysis', 'measurement', 'model', 'monitor', 'util', 'visualization', ]
from sanguine import settings from django.shortcuts import redirect,render from django.contrib.auth.models import User from django.contrib import messages from .models import UserCompleteInfo,Report from django.contrib.auth import authenticate,login,logout from django.core.mail import send_mail,EmailMessage from django...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # The MIT License (MIT) # Copyright (C) 2018 Seeed Technology Co.,Ltd. # # This is the library for Grove Base Hat # which used to connect grove sensors for Raspberry Pi. ''' Display Base Class ''' # sphinx autoapi required __all__ = [ "Display", "TYPE_CHAR", ...
import functools import flask from . import exceptions def has_context(func): @functools.wraps(func) def assert_context(*args, **kwargs): if not flask.has_request_context(): raise exceptions.MissingCallbackContextException( ("dash.callback_context.{} is only available from...
# -*- coding: utf-8 -*- # Copyright (c) 2019 Linh Pham # wwdtm_uniquedates is relased under the terms of the Apache License 2.0 """Calculates all of the calendar days for each month in which there has been a Wait Wait Don't Tell Me! show""" from collections import OrderedDict import json import math import os import t...
#!/usr/bin/env python # coding: utf-8 ##### FEATURE SELECTION ##### print('Starting feature selection...') # import libraries from datetime import datetime,date start_time = datetime.now() print('Start time: ', start_time) import sys params = sys.argv import numpy as np import pandas as pd import pickle from help...
# python script for loading IResearch benchmark dump of Wikipedia into # ArangoDB database. Uses python-arango driver https://github.com/Joowani/python-arango # Data is loaded in form { title: 'XXXXX', body: 'XXXXXXXXXXXXX', 'count': XXXX, 'created':XXXX}. # DB server should be set up to run without authorization ##...
from virtualenvapi.manage import VirtualEnvironment from os import linesep, environ class EnvManager(): envs = [] def __init__(self, file_name=None, env_list=None): self.setEnvs(file_name, env_list) def freezeList(self, envs=False): env_list = self.envs if envs: env_l...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # author: bigfoolliu """ 请求 """ import sys import os sys.path.append(os.path.dirname(__file__)) import uuid from flask import Flask, request, jsonify, render_template from typing import Dict import settings from mq.order_produce import enter_order_queue from mq.overt...
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-06-27 07:56 from __future__ import unicode_literals from django.db import migrations, models import tinymce.models class Migration(migrations.Migration): dependencies = [ ('App', '0002_auto_20180627_1047'), ] operations = [ mi...
import urllib import urllib2 from django.contrib.auth.models import User from django.db import models from django.conf import settings def send_event(event_type, event_data): to_send = { 'event': event_type, 'data': event_data } urllib2.urlopen(settings.ASYNC_BACKEND_URL, urllib.urlencode(...
from ..util import minversion __all__ = ['NUMPY_LT_1_7'] NUMPY_LT_1_7 = not minversion('numpy', '1.7.0')
import torch import torch.nn as nn from torch.nn import init import functools from torch.optim import lr_scheduler ############################################################################### # Helper Functions ############################################################################### def get_norm_layer(norm_...
import os import sys import socket from django import forms from django.conf import settings from django.core.exceptions import ValidationError from django.utils.encoding import force_text from django.utils.translation import ugettext_lazy as _ from . import client from .constants import TEST_PUBLIC_KEY, TEST_PRIVATE...
try: age = int(input('enter age')) if age >= 18: print('you can vote') # prints out only people who can vote elif 0 <= age <= 17: print('too young to vote') elif age < 0: print('you are a time traveller') except: print('error, please enter a digit')
from sqlite_framework.sql.item.constants.type import Type from sqlite_framework.sql.item.expression.compound.base import CompoundExpression from sqlite_framework.sql.item.expression.parser import EXPRESSION_TYPE class Cast(CompoundExpression): def __init__(self, expr: EXPRESSION_TYPE, type: Type): super()...
from myhdl import * from myhdl import ToVerilogWarning, ToVHDLWarning import random import warnings from kea.test_utils.base_test import ( KeaTestCase, KeaVivadoVHDLTestCase, KeaVivadoVerilogTestCase) from kea.axi import AxiStreamInterface from .axis_transaction_count import ( axis_count_valid_transactions,...
# -*- coding: utf-8 -*- import logging import requests try: import urlparse except ImportError: import urllib.parse as urlparse import copy __version__ = '0.1a' class InvalidModifier(ValueError): def __init__(self, msg): self.msg = msg def __unicode__(self): return self.msg ...
from example.servers.models import Server from ..factories import ServerFactory from django.forms.models import model_to_dict from django.test import TestCase from django.conf import settings from example.servers.models import OperatingSystem from ..factories import OperatingSystemFactory from django.db import Integrit...
from dataclasses import dataclass @dataclass class EmailConfig: email_from: str email_account: str email_password: str smtp_server: str
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'settingdlg.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_settingdlg(object): def setupUi(self, settingdlg): settin...
# NACA 5305 Airfoil M=5.0% P=30.0% T=5.0% # From: http://airfoiltools.com/airfoil/naca4digit from airfoil import AirfoilSeq naca5305: AirfoilSeq = AirfoilSeq( [ (1.000074, 0.000520), (0.999825, 0.000570), (0.999076, 0.000722), (0.997829, 0.000974), (0.996084, 0.001325), ...
import argparse, os import pandas as pd def main(): parser = argparse.ArgumentParser( description="Get evaluation result for sentiment analysis task", ) parser.add_argument( "--data", type=str, required=True, default="manifest/slue-voxceleb", help="Root dire...
import os import numpy as np import pickle import sys sys.path.append('/home/arfeen/ZSDG_main/src/') from utils.utils import process_txt BASE_PATH = '/home/arfeen/ZSDG_main/src/data/PACS' DATA_PATH = 'PACS/kfold/' def create_trvalte_splits(args): with open(os.path.join(BASE_PATH, 'PACS_glove300.pkl'), 'rb') as f: ...
# 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! *** # Export this package's modules as members: from ._enums import * from .attestation_at_resource import * from .attestation_at_resource_group import * f...
import pytest import numpy as np import torch import time from htvlearn.delaunay import Delaunay from htvlearn.plots.plot_cpwl import Plot from htvlearn.data import ( BoxSpline, SimplicialSpline, CutPyramid, SimpleJunction, DistortedGrid, Data ) @pytest.fixture(autouse=True) def set_seed(requ...
from audinterface.core.utils import ( signal_index, read_audio, )
""" DIRBS DB schema migration script (v76 -> v77). Copyright (c) 2018 Qualcomm Technologies, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are me...
import datetime, time from base64 import b64decode import base64 import os def retrieveKey(KEY, mode): if mode == 'RSA': return KEY.split("%")[0] else: return KEY.split("%")[1] def retrieveCiphertext(cipher, n): return cipher.split(" ")[n] def createPEM(key): header = '-----BEGIN PUBL...
#!/usr/bin/env python """ Unit test for the bilinear recursive bisection function found in wagl.interpolation.bilinear """ from __future__ import absolute_import import unittest import numpy import math from wagl.interpolation import bilinear, subdivide, indices, interpolate_block class BLRBTest(unittest.TestCase):...
import os import re def is_python_filename(name): result = re.match(r'[a-zA-Z0-9_]+\.py', name) return bool(result) def extract_path_from_line(line): def dotsep(line): return line.replace('.', os.path.sep) def topy(path): return f'{path}.py' search = re.search(r'^import ([a-z0-...
# -*- coding: utf-8 -*- from django.contrib.auth import get_user_model from django.utils.translation import gettext_lazy from cradmin_legacy.crinstance import reverse_cradmin_url from cradmin_legacy.viewhelpers import listbuilderview from cradmin_legacy.viewhelpers.listbuilder.lists import RowList from cradmin_legac...
print('Olá, Mundo !')
from abc import ABC, abstractmethod from typing import List, Union from .text import Text class Highlighter(ABC): """Abstract base class for highlighters.""" def __call__(self, text: Union[str, Text]) -> Text: """Highlight a str or Text instance. Args: text (Union[str, ~Text]): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # rest_uploader documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 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...
from __future__ import absolute_import from __future__ import unicode_literals from collections import OrderedDict from datetime import datetime, timedelta import hashlib import json from django.conf import settings from django.template import loader_tags, NodeList, TemplateSyntaxError from django.template.base import...
import pandas as pd import numpy as np import random import math import calc_win_chances random.seed(0) def generate(N): dictForDf = {} dictForDf["str"]=[] dictForDf["con"]=[] dictForDf["dex"]=[] dictForDf["cha"]=[] dictForDf["int"]=[] dictForDf["wis"]=[] dictForDf["result"]=[] ...
# from django.db import models # # # from 臺灣言語資料庫.資料模型 import 來源表 # from 臺灣言語平臺.項目模型 import 平臺項目表 # from 臺灣言語資料庫.資料模型 import 資料類型表 # # class 評分狀況表(models.Model): # 使用者 = models.ForeignKey(來源表, related_name='+') # 項目 = models.ForeignKey(平臺項目表, related_name='+') # 分數 = models.IntegerField() # # class 評分總合表(mo...
# -*- coding: utf-8 -*- from __future__ import division, print_function __all__ = [ "Term", "TermSum", "TermProduct", "TermDiff", "RealTerm", "ComplexTerm", "SHOTerm", "Matern32Term", "RotationTerm", ] import numpy as np from itertools import chain import theano import theano.tensor as tt from theano.if...
# -*- coding:utf-8 -*- #!/usr/bin/env python """ Date: 2021/9/12 18:29 Desc: 巨潮资讯-数据中心-评级预测-投资评级 http://webapi.cninfo.com.cn/#/thematicStatistics?name=%E6%8A%95%E8%B5%84%E8%AF%84%E7%BA%A7 """ import time from py_mini_racer import py_mini_racer import requests import pandas as pd js_str = """ function mcode(input) ...
""" This is the people module and supports all the ReST actions for the PEOPLE collection """ # System modules from datetime import datetime # 3rd party modules from flask import make_response, abort def get_timestamp(): return datetime.now().strftime(("%Y-%m-%d %H:%M:%S")) # Data to serve with our API PEOPLE ...
class Solution: def XXX(self, a: str, b: str) -> str: # 以二进制数相加 num = int(a,2) + int(b,2) return str(bin(num))[2:]
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. import unittest import warnings import numpy as np from pymatgen.analysis.structure_matcher import StructureMatcher from pymatgen.core.composition import Composition from pymatgen.core.lattice import Lattice...
from django.urls import path from RSP import views urlpatterns = [ path('', views.main_page, name='index'), path('title/', views.title_page, name='title'), ]
first_portion = export[:directory.settings.INITIAL_RESULTS] second_portion = export[directory.settings.INITIAL_RESULTS:] return render_to_response(u'search_internal.html', { u'first_portion': first_portion, u'second_portion': second_portion, u'query': urllib.quote(query), ...
############################################################################### # Language Modeling on Penn Tree Bank # # This file generates new sentences sampled from the language model # ############################################################################### import argparse import torch from torc...
#!/usr/bin/env python import os from pprint import pprint as pp from nornir import InitNornir from nornir.core.filter import F from nornir.plugins.functions.text import print_result from nornir.plugins.tasks.networking import napalm_get from nornir.plugins.tasks.networking import netmiko_send_command nr = InitNornir(...
import csv import sys from os import walk pwd = sys.argv[1] f = [] for (dirpath, dirnames, filenames) in walk(pwd): f.extend(filenames) break temp = [item for item in f if item.split('.')[-1] == "mpiP"] f = temp #latest_report = max(f) for latest_report in f: MPI_Time = [] Aggregate_Time = [] Agg...
# Standard import logging import math import time from itertools import chain, groupby, product from operator import gt, itemgetter # Third Party from pygame import Rect, Surface, transform, SRCALPHA # Project from .quadtree import FastQuadTree from .lib import surface_clipping_context LOG = logging.getLogger(__name...
""" This script generate simplistic simulations of the actpol data it generates gaussian simulations of cmb, fg and noise the fg is based on fgspectra, and the noise is based on the 1d noise power spectra measured on the data """ from pspy import pspy_utils, so_dict, so_map, sph_tools, so_mcm, so_spectra, so_mpi, so_m...
# qubit number=4 # total number=15 import pyquil from pyquil.api import local_forest_runtime, QVMConnection from pyquil import Program, get_qc from pyquil.gates import * import numpy as np conn = QVMConnection() def make_circuit()-> Program: prog = Program() # circuit begin prog += H(0) # number=1 pr...
from .anchor_head import AnchorHead from .atss_head import ATSSHead from .fcos_head import FCOSHead from .fovea_head import FoveaHead from .free_anchor_retina_head import FreeAnchorRetinaHead from .fsaf_head import FSAFHead from .ga_retina_head import GARetinaHead from .ga_rpn_head import GARPNHead from .guided_anchor_...
import torch import torch.nn.functional as F from rl_algorithms.common.abstract.learner import TensorTuple import rl_algorithms.common.helper_functions as common_utils from rl_algorithms.registry import LEARNERS from rl_algorithms.sac.learner import SACLearner @LEARNERS.register_module class BCSACLearner(SACLearner)...
import csv from hashlib import new import matplotlib.pyplot as plt import numpy import os import pefile import shutil Normal_Correct = 0 Normal_Num = 0 Mal_Correct = 0 Mal_Num = 0 num = 26 #Compare label number / label with open('./pe_features.csv', 'r') as f: cr = csv.reader(f) next(cr) for line in cr: ...
## # This software was developed and / or modified by Raytheon Company, # pursuant to Contract DG133W-05-CQ-1067 with the US Government. # # U.S. EXPORT CONTROLLED TECHNICAL DATA # This software product contains export-restricted data whose # export/transfer/disclosure is restricted by U.S. law. Dissemination # to ...
#def nearest_xy(x1, y1, x2, y2, xmax=110): # tdiff = [] # for tx,ty in zip(x1, y1): # which = (np.abs(tx - x2) <= xmax) # if (np.sum(which) > 0): # tdiff.append(np.min(np.hypot(tx - x2[which], ty - y2[which]))) # return np.min(tdiff) # ### Closest separations: #def get_minseps(ridges)...
# # Copyright 2018 Analytics Zoo 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 law or agreed to...
import torch import torch.nn as nn import torch.nn.functional as F import dgl """ GCN: Graph Convolutional Networks Thomas N. Kipf, Max Welling, Semi-Supervised Classification with Graph Convolutional Networks (ICLR 2017) http://arxiv.org/abs/1609.02907 """ from layers.gcn_layer import GCNLayer...
#!/usr/bin/env python import os import sys sys.path.insert(0, os.pardir) sys.path.insert(0, os.path.join(os.pardir, 'openmoc')) from testing_harness import TestHarness from input_set import PwrAssemblyInput import openmoc class CmfdPwrAssemblyTestHarness(TestHarness): """An eigenvalue calculation for a 17x17 lat...
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class GpiSpace(CMakePackage): """ GPI-Space is a task-based workflow management system for p...
# (C) Copyright [2020] Hewlett Packard Enterprise Development LP # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy,...
from django.urls import reverse from django.core import mail from newzila.testcases import WebTestCase, EmailsMixin from newzila.newsletter.tests.factories import NewsletterFactory from newzila.newsletter.models import Subscription class TestNewsletterViewSet(EmailsMixin, WebTestCase): is_anonymous = True cs...
linux_only_targets="athostapp coapapp helloworld http2app linkkit_gateway linkkitapp meshapp modbus_demo mqttapp otaapp tls udataapp udevapp ulocationapp yts"
"""empty message Revision ID: e1b57010d53f Revises: 91a1129e95d5 Create Date: 2017-10-30 14:09:47.603223 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'e1b57010d53f' down_revision = '91a1129e95d5' branch_labels = None depends_on = None def upgrade(): # ...
########################################################################### # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/l...
import json import tempfile from pycocotools.cocoeval import COCOeval from torch.autograd import Variable from dataset.cocodataset import * from utils.utils import * class COCOAPIEvaluator(): """ COCO AP Evaluation class. All the data in the val2017 dataset are processed \ and evaluated by COCO API....
""" Uses a non-centered parameterization of the model. Fully factorized Gaussian + IGamma Variational distribution q = N(w_ijl | m_ijl, sigma^2_ijl) N(ln \tau_kl | params) IGamma(\lambda_kl| params) IGamma(\tau_l | params) IGamma(\lambda_l| params) """ import jax.numpy as jnp import jax.random as jr from jax.scip...
""" 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...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ Primitives for definition and manipulation of restler request sequences. """ from __future__ import print_function import time import types import random random.seed(12345) import itertools import collections import datetime from restler_set...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.Keyword import Keyword from alipay.aop.api.domain.Keyword import Keyword from alipay.aop.api.domain.Keyword import Keyword from alipay.aop.api.domain.Keyword import Keyword class ...
import ldap import ldif import pytest import os from mockldap import MockLdap from awx.api.versioning import reverse @pytest.fixture def ldap_generator(): def fn(fname, host='localhost'): fh = open(os.path.join(os.path.dirname(os.path.realpath(__file__)), fname), 'rb') ctrl = ldif.LDIFRecordLis...
""" Memcached Blueprint =================== **Fabric environment:** .. code-block:: yaml blueprints: - blues.memcached settings: memcached: # size: 256 # Cache size in mb (Default: 64) # bind: 127.0.0.1 # Set the bind address specifically (Default: listen to all) """ fro...
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
import logging import random from collections import deque import gym import matplotlib.legend as legend import matplotlib.lines as mlines import matplotlib.pyplot as plt import matplotlib.text as mtext import numpy as np from crowd_nav.policy.orca import ORCA from crowd_nav.policy.policy_factory import policy_factory...
#!/usr/bin/env python # coding: utf-8 # # # ORF recognition by CNN # # In 105, we used Conv1D layers with filter width=3 with dropout to reduce overfitting. The simulated RNA lengths were 1000. # # Here, try really short simulated RNA. # # # # RNA_LENS=15 and was cut in half with layers with filters 16. # In[1...
import os import pytest import tempfile from numpy.testing import assert_ from . import util def _path(*a): return os.path.join(*((os.path.dirname(__file__),) + a)) class TestAssumedShapeSumExample(util.F2PyTest): sources = [_path('src', 'assumed_shape', 'foo_free.f90'), _path('src', 'assume...
"""Números Faça um programa que imprima na tela os números de 1 a 20, um abaixo do outro. Depois modifique o programa para que ele mostre os números um ao lado do outro. Deve ser utilizado o ciclo do-while. """ i = 0 while True: if i > 20: break print(i, end=' ') i += 1 print()
class WrangleHelper: """A class to help wrangle data""" def split_data(X, y, test_size=0.2, val_size=len(X_test), random_state=42, shuffle=True, stratify=None): from sklearn.model_selection import train_test_split # Splite dataset into train and test set...
import temporal_distances as td import temporal_graph as tg import numpy as np class PivotIfubDiameter: def __init__(self, graph: tg.Graph, pivots, t_alpha=None, t_omega=None): """ :param graph: Temporal Graph (sorted in non-decreasing order with respect to the edge starting times) :param...
# Copyright 2018 Nikolas Hemion. 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 import sys import os import re # Relative path from this script to source directory SRC_PATH = [ '..', 'switchmng' ] def main(): # cd to script directory os.chdir(os.path.dirname(sys.argv[0])) # cd to source directory for d in SRC_PATH: os.chdir(d) # Get all pytho...
# idea: # sort all courses by deadline # iterate all sorted courses # if current course is able to be taken, then take it # if not, check if we can remove some courses from courses we already taken # if the one has the maximal duration is greater than current course's duration # then replace it by current course ...
# Combine assets/img/gallery/descriptions.txt with the images in thumb/large # with their sizes and create nanogallery items # Relies on the wand imagemagick library # cd assets/img/gallery # python3 items.py descriptions.txt import wand from wand.image import Image import fileinput import textwrap import re unputlin...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import division, print_function import vedo from vedo.colors import printc, getColor from vedo.assembly import Assembly from vedo.mesh import Mesh, merge from vedo.pointcloud import Points from vedo.utils import mag, isSequence, make_ticks from vedo.utils i...
import numpy as np import fcsparser import os import glob # Define the details fo the expriment. DATE = 20180202 atc_ngml = RUN_NO = savedir = '../../data/flow/csv/' pattern = f'RP{DATE[:4]}-{DATE[4:7]}{DATE[7:]}' # Define the order of rows and the cols. xan = (0XX) COLS = (0, 0.1, 5, 10, 25, 50, 75, 100, 250, 500,...
# Copyright (c) 2011 Jeff Garzik # # Previous copyright, from python-jsonrpc/jsonrpc/proxy.py: # # Copyright (c) 2007 Jan-Klaas Kollhof # # This file is part of jsonrpc. # # jsonrpc is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # th...
from __future__ import division import re import json import requests from urlparse import urljoin from html5lib import HTMLParser from html5lib.treebuilders import getTreeBuilder from lxml.cssselect import CSSSelector XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml' html_parser = HTMLParser( tree=getTreeBuilder...
""" weasyprint.fonts ---------------- Interface with external libraries managing fonts installed on the system. """ import os import pathlib import sys import tempfile import warnings from .logger import LOGGER from .text import ( cairo, dlopen, ffi, get_font_features, gobject, pango, pangocairo) fr...
import itertools from slurmpy import Slurm import os params_to_vary = { 'signal_strength': [100* (x) for x in range(4)] , 'seed': [0,], } ks = sorted(params_to_vary.keys()) vals = [params_to_vary[k] for k in ks] param_combinations = list(itertools.product(*vals)) # list of tuples functio...
import torch.nn as nn import math from . import quant_module as qm import torch.nn.functional as F from torch.autograd import Variable from torch import Tensor import torch __all__ = [ 'mixres18_w2346a2346', 'mixres50_w234a234','mixres18_w234a234' ] def conv3x3(conv_func, in_planes, out_planes, stride=1, **kwarg...
from rest_framework.decorators import action from rest_framework.response import Response from rest_framework import viewsets, mixins, status from rest_framework.authentication import TokenAuthentication from rest_framework.permissions import IsAuthenticated from core.models import Tag, Ingredient, Recipe from recipe...
"""Each ElkM1 area will be created as a separate alarm_control_panel.""" from __future__ import annotations from elkm1_lib.const import AlarmState, ArmedStatus, ArmLevel, ArmUpState from elkm1_lib.util import username import voluptuous as vol from homeassistant.components.alarm_control_panel import ( ATTR_CHANGED...
"""englishtopic URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.2/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-...
"""A module contains as set API for the puzzle grids.""" import string import random from abc import ABC, abstractmethod from types import TracebackType from typing import Any, List, Optional, Sequence, Type, Union from loguru import logger as _logger from puzzle.properties import Coordinate, GridSize, LetterCoordina...
import os import requests class AverageMeter(object): def __init__(self): self.reset() def reset(self): self.val = 0 self.avg = 0 self.sum = 0 self.count = 0 def update(self, val, n=1): self.val = val self.sum += val * n self.count += n ...
from __future__ import absolute_import, unicode_literals from datetime import timedelta import logging from kombu import Exchange, Queue from django import apps from django.conf import settings from django.conf.urls import include, url from django.contrib.auth.signals import user_logged_in from django.db.models.sign...