text
stringlengths
2
999k
# -*- coding: utf-8 -*- import os def test_relative_001(settings, finder): """ Mirror all compilable sources in relative mode """ result = finder.mirror_sources( os.path.join(settings.sample_path, 'components') ) assert result == [ ('twin_2.scss', 'twin_2.css'), ('twin...
import logging import copy import torch from torch import nn from .fednova import FedNova class Client: def __init__(self, client_idx, local_training_data, local_test_data, local_sample_number, args, device): self.client_idx = client_idx self.local_training_data = local_training_data...
import asyncio import base64 import json import inspect import os import re import sys import struct from io import BytesIO from typing import Dict, Union, IO, Optional, Any, Tuple import aioboto3 from cryptography.hazmat.primitives.ciphers.aead import AESGCM from cryptography.hazmat.backends import default_backend fr...
def clean_tibetan_input(s): s = s.replace(' ', '') s = s.replace(' ', '') s = s.rstrip() s = s.lstrip() if s.endswith('།'): s = s.replace('།', '་') elif s.endswith('༔'): s = s.replace('༔', '་') elif s.endswith('་'): pass else: s += '་'...
class ValidatorError(Exception): pass
import torch import torch.nn as nn import torch.nn.parallel from torch.autograd import Variable from torchvision import models import torch.utils.model_zoo as model_zoo import torch.nn.functional as F import copy from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from miscc.config import cfg f...
doneadd = "✅꒐ تم تفعيل المجموعة ([{}])" doneadd2 = "✅꒐ تم تفعيل المجموعة ([{}])" doneadded = "👤꒐ المجموعة ([{}]) مفعلة" disabled = "👤꒐ المجموعة ([{}]) معطلة" disabl = "☑️꒐ تم تعطيل المجموعة ([{}])" userNocc = "⚠️꒐ عذراً لايمكنني الوصول الى (الايدي|المعرف)" locked = """◀️꒐ بواسطه ⌁ {} ❎꒐ {} بالفعل مقفوله في ال...
# Copyright 2021 Collate # 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, software...
# coding=utf-8 from selenium import webdriver from util.find_element import my_get_element import unittest, time, os from business.brand_business import BrandBusiness class ListPageItem(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome(r'e:\webdrivers\chromedriver.exe') self.dri...
import torch from torch.optim import Optimizer class RMSpropTF(Optimizer): """Implements RMSprop algorithm (TensorFlow style epsilon) NOTE: This is a direct cut-and-paste of PyTorch RMSprop with eps applied before sqrt to closer match Tensorflow for matching hyper-params. Proposed by G. Hinton in hi...
from __future__ import division, print_function, absolute_import import numpy as np from scipy.sparse import csr_matrix, isspmatrix, isspmatrix_csc, isspmatrix_csr from ._tools import csgraph_to_dense, csgraph_from_dense,\ csgraph_masked_from_dense, csgraph_from_masked DTYPE = np.float64 def validate_graph(csgr...
import numpy as np import numbers import torch from scipy.ndimage.interpolation import rotate from scipy.ndimage.interpolation import zoom def normalize_float(x, min=-1): """ Function that performs min-max normalization on a `numpy.ndarray` matrix. """ if min == -1: norm = (2 * (x - np....
import os from webdriver_manager.driver_cache import DriverCache from webdriver_manager.logger import log from webdriver_manager.utils import download_file, session, new_session class DriverManager(object): def __init__(self, root_dir=None, log_level=None, print_first_line=None, cache_valid_range=1): self...
"""Clash of Clans war moniting for telegram channels.""" __version__ = '0.7.0' from ._clashogram import main, serverless __all__ = ['main', 'serverless']
import os import xml.etree.ElementTree as ET import gzip def load_annotations(input_file): """Main function to load data from individual xml files""" # keep track of tags, whereby these change to true the next item in the appropriate element # will be the relevant value try: PC_count = False ...
import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk as gtk from gi.repository import Gdk as gdk from gi.repository import GLib import chess, chess.pgn, chess.polyglot, sys, subprocess, time, os, os.path, random, re, signal, threading, unicodedata, cairo, threading import global_variables as G from ...
# -*- coding: utf-8 -*- # # giddy documentation build configuration file, created by # sphinx-quickstart on Wed Jun 6 15:54:22 2018. # # 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. # # All...
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : inspect-file.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 04/16/2019 # # This file is part of Jacinle. # Distributed under terms of the MIT license. import jacinle import jacinle.io as io parser = jacinle.JacArgumentParser() parser.add...
# coding: utf-8 # # Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the 'lice...
import hashlib import inspect import io import os import re from collections import defaultdict from functools import partial, wraps from itertools import chain from logging import getLogger as get_logger from typing import Any, BinaryIO, Callable, Dict, Iterator, List, Optional, Tuple, Union from urllib.parse import u...
def manage_codes(): if not check_login(): login_redirect() return if not user_is_agent(): return "You are not a Ship Spinning Inc. agent. Go away." charid = session.charid char = get_char_row_from_id(charid) respdict = {} response.menu = default_menu() form = SQLFOR...
import json import pytest from helpers import get_solution_filepaths, problem_name_id solution_files = get_solution_filepaths(language="c") # Don't test game_of_life.c for now. solution_files = list(filter(lambda s: "game_of_life" not in s, solution_files)) @pytest.mark.c def test_c_solutions_exist(): assert ...
# 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...
# built in libraries from functools import lru_cache from tamcolors.utils.immutable_cache import ImmutableCache from tamcolors.utils.object_packer import FastHandObjectPacker """ terminal colors supported on all platforms Color holds all color values for all supported modes RGBA holds the values for mode rgb """ cl...
# -*- coding: utf-8 -*- # Copyright 2020 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Duration calculator for ESPnet2.""" from typing import Tuple import torch class DurationCalculator(torch.nn.Module): """Duration calculator module.""" @torch.no_grad(...
import discord from discord.ext import commands class Ready(commands.Cog): def __init__(self, client): self.client = client @commands.Cog.listener() async def on_ready(self): await self.client.change_presence( # status=discord.Status.dnd, activity=disco...
""" Copyright (c) 2022 Huawei Technologies Co.,Ltd. openGauss is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W...
################################################################################# # Copyright (C) 2019 Advanced Micro Devices, Inc. All rights reserved. # # 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 t...
""" Action views """ from pyramid.exceptions import Forbidden from pyramid.httpexceptions import HTTPFound from pyramid.url import resource_url from pyramid.view import view_config from pyramid.view import view_defaults from kotti import DBSession from kotti import get_settings from kotti.fanstatic import contents_vie...
import re str = 'This is an advanced Python programming in Maktabkhooneh.' result = re.sub(r'maktabkhooneh','university',str) print(result)
from ptah.renderer.layer import ID_LAYER from ptah.testing import BaseTestCase class TestOrder(BaseTestCase): _includes = ['ptah.renderer'] _auto_commit = False _settings = {'layer.order.test': 'l1 l2 l3'} def test_custom_dir(self): self.config.add_layer( 'test', 'l1', path='pta...
""" WSGI config for ThetaTauMiami project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ThetaTauMiami.settings") from d...
# -*- 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 os import requests from bs4 import BeautifulSoup from itertools import filterfalse def create_folder(path): try: os.makedirs(path) except OSError: if not os.path.isdir(path): raise return path def set_name(name, ext, delim, number, digits): paddedNumber = format(nu...
import numpy as np from functions.global_settings import settings, us_in_1_second from tkinter import filedialog from datetime import date ideal_speed_as_const = 1296000.0 / 86164.0 def get_data_from_correction_file(filepath): print(f"Loaded correction data from {filepath}") with open(filepath) as f: ...
""" This file offers the methods to automatically retrieve the graph Enterococcus faecalis 13SDW01. The graph is automatically retrieved from the STRING repository. References --------------------- Please cite the following if you use the data: ```bib @article{szklarczyk2019string, title={STRING v11: protein--...
#!/usr/bin/env python import base64 import hashlib import uuid from collections import namedtuple from datetime import datetime, timedelta from django.contrib.postgres.fields import ArrayField from django.db import IntegrityError, connection, models, transaction from django.http import Http404 from django.utils.encodi...
# coding=utf-8 # Copyright 2022 The Google Research 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 applicab...
def is_fastapi_present(): # noinspection PyPep8,PyBroadException try: import fastapi import starlette return True except: return False if is_fastapi_present(): from .implementation import FastAPIAppRequestInstrumentationConfigurator, FastAPIRequestInfoExtractor, \ ...
import warnings import simplejson as json import numpy as np from scipy.spatial import distance from pycosmosac.utils import constants ''' References: 1. https://dx.doi.org/10.1021/acs.jctc.9b01016 ''' SIGMA_TEMPLATE = """# meta: {meta:s} # Rows are given as: sigma [e/A^2] followed by a space, then psigmaA [A^2] # I...
# -*- coding: utf-8 -*- import logging import time import functools import hashlib import inspect from django.conf import settings from django.http import HttpResponse from django.utils import simplejson from base.core import dateutils memcache_proxy_settings = settings.memcache_proxy_settings memcache_settings = sett...
from os.path import basename from os.path import join import smtplib import yaml import h5py import numpy import socket import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.application import MIMEA...
from typing import Tuple from planet.Direction import Direction from events.EventList import EventList from events.EventNames import EventNames import math # constants TRACK = 15.8 WHEEL_DIAMETER = 5.6 ECF = math.pi * WHEEL_DIAMETER / 360 class Odometry: def __init__(self): self.dx = 0 self.dy = ...
class CLASS: __init__(self, ATTR_A, ATTR_B): self.ATTR_A = ATTR_A self.ATTR_B = ATTR_B
from typing import FrozenSet, Tuple import pysmt.typing as types from pysmt.environment import Environment as PysmtEnv from pysmt.fnode import FNode from utils import symb_to_next from hint import Hint, Location def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode, ...
# # 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...
# coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
import sys import unittest, pytest from scipy import stats import numpy as np from pyapprox.approximate import * from pyapprox.benchmarks.benchmarks import setup_benchmark import pyapprox as pya class TestApproximate(unittest.TestCase): def setUp(self): np.random.seed(1) def test_approximate_sparse...
# coding: utf-8 """ Isilon SDK Isilon SDK - Language bindings for the OneFS API # noqa: E501 OpenAPI spec version: 5 Contact: sdk@isilon.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import isi_sdk_8_1_0 from i...
#!/usr/bin/env python3 import logging from github import Github from env_helper import GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_ID from pr_info import PRInfo from get_robot_token import get_best_robot_token from commit_status_helper import get_commit NAME = "Run Check (actions)" def filter_statuses(statuses...
import threading import shared import socket from class_sendDataThread import * from class_receiveDataThread import * import helper_bootstrap import errno import re # Only one singleListener thread will ever exist. It creates the # receiveDataThread and sendDataThread for each incoming connection. Note # that it canno...
import cherrypy from cherrypy._cpcompat import text_or_bytes, ntou, json_encode, json_decode def json_processor(entity): """Read application/json data into request.json.""" if not entity.headers.get(ntou("Content-Length"), ntou("")): raise cherrypy.HTTPError(411) body = entity.fp.read() try: ...
# Copyright 2015 Mirantis 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...
#HSV_INRANGEFINDER import cv2 import numpy as np def nothing(x): pass cv2.namedWindow('Image filtering') cv2.createTrackbar('I1','Image filtering',0,255,nothing) cv2.createTrackbar('I2','Image filtering',0,255,nothing) cv2.createTrackbar('I3','Image filtering',0,255,nothing) cv2.createTrackbar('I4','Image ...
import numpy as np from lib.tools.direction import R import lib.constants as const class Sensor: def __init__(self): pass @classmethod def get_sensor_data(cls, tile, rel_x, rel_y, direction): pt = np.array([rel_x, rel_y]) walls = [] neighbors = [tile.prev, tile, tile.next]...
# Copyright 2018 Iguazio # # 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, softwa...
import config import shape import util import dispatch_classes import pathways_model from .generated.new_database import _Metadata, EnergyPathwaysDatabase # # These methods form the API between a subclass of CsvDatabase and the validation subsystem. # def get_metadata(): return _Metadata def database_class(): ...
"""validate prosper.test_utils.schema_utils""" import datetime import json import jsonschema import pathlib from plumbum import local import pytest import helpers import prosper.test_utils.schema_utils as schema_utils import prosper.test_utils.exceptions as exceptions import prosper.test_utils._version as _version @...
## investigating how ffts work in numpy import numpy as np from numpy import fft import matplotlib.pyplot as plt eps_grid = np.ones((20,20)); eps_grid[5:15, 5:15] = 12; test1 = fft.fftshift(fft.fft2(eps_grid)); #this fortunately agrees with matlab... plt.figure(); plt.imshow(abs(test1)) plt.colorbar() plt.show() Nx ...
import time import types import calendar import datetime import functools import synapse.exc as s_exc import synapse.common as s_common import synapse.lib.cli as s_cli import synapse.lib.cmd as s_cmd import synapse.lib.time as s_time import synapse.lib.parser as s_parser StatHelp = ''' Gives detailed information abo...
import json from pyrogram import Client, filters from firebase import firebase from process import check, searches, truecaller_search, fb_search, logreturn, log, eyecon_search from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton from creds import cred firebase = firebase.FirebaseApplication(cred.DB_UR...
import logging base_logger = logging.getLogger("iris") class Adapter(logging.LoggerAdapter): def process(self, msg, kwargs): parts = [self.extra["component"].upper()] if uuid := self.extra.get("measurement_uuid"): parts.append(uuid) if uuid := self.extra.get("agent_uuid"): ...
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'targets': [ { 'target_name': 'ipclist', 'type': 'executable', 'dependencies': [ ...
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: analytics/context/Library.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf im...
class Pessoa: olhos = 2 def __init__(self, *filhos, nome=None, idade=35): self.nome = nome self.idade = idade self.filhos = list(filhos) def cumprimentar(self): return f'Olá, meu nome é {self.nome}' @staticmethod def metodo_estatico(): return 42 @class...
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: hashMap = {} for i in range(len(nums)): wanted = target - nums[i] if wanted in hashMap: return [i, hashMap[wanted]] else: hashMap[nums[i]] = i
from sympy.physics.continuum_mechanics.beam import Beam3D from sympy import symbols l, E, G, I, A, x = symbols('l, E, G, I, A, x') b = Beam3D(20, 40, 21, 100, 25, x) b.apply_load(15, start=0, order=0, dir="z") b.apply_load(12*x, start=0, order=0, dir="y") b.bc_deflection = [(0, [0, 0, 0]), (20, [0, 0, 0])] R1, R...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import argparse from tqdm import tqdm from nasbench import api # pylint: disable=import-error from nni.nas.benchmarks.utils import load_benchmark from .model import Nb101TrialConfig, Nb101TrialStats, Nb101IntermediateStats from .graph_util imp...
""" A simple notepad application with functionality for some formatting commands, font selection... """ import pathlib import datetime import tkinter as tk from tkinter import font as tkfont from tkinter.scrolledtext import ScrolledText from tkinter import filedialog, messagebox from widgets.texttools import Find, R...
from django.apps import AppConfig class UserQueriesConfig(AppConfig): name = "user_queries"
from __future__ import unicode_literals from moto.core.exceptions import RESTError class EC2ClientError(RESTError): code = 400 class DependencyViolationError(EC2ClientError): def __init__(self, message): super(DependencyViolationError, self).__init__( "DependencyViolation", message) cl...
print("Hello World") name = "Babul Nokrek" print("my name is", name) print("My name is "+ name) firstName = "Babul" lastName = "Nokrek" age = 47 print("My name is {} {} and I am {} year old.".format(firstName, lastName, age)) food_one = "Pizza" food_two = "Parata" print("My favorite food is {} and {}.".format(food_...
# coding=utf-8 # Copyright 2020 The TensorFlow Datasets 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 appl...
"""Models for mcsrvstats data objects.""" from .gommehd import BedWarsGomme from .gommehd import Cookies from .gommehd import Cores from .gommehd import EnderGames from .gommehd import GommeHD from .gommehd import GunGame from .gommehd import Hardcore from .gommehd import MasterBuilders from .gommehd import QuickSurviv...
# Library code for use in management commands import signal from argparse import ArgumentParser, RawTextHelpFormatter from typing import Any, Dict, List, Optional from django.conf import settings from django.core.exceptions import MultipleObjectsReturned from django.core.management.base import BaseCommand, CommandErro...
""" Models for representing top-level plot objects. """ from __future__ import absolute_import from six import string_types from ..enums import Location from ..mixins import LineProps, TextProps from ..plot_object import PlotObject from ..properties import Bool, Int, String, Color, Enum, Auto, Instance, Either, List...
from django.db import models class Task(models.Model): OPEN = 'Open' IN_PROGRESS = 'In progress' COMPLETE = 'Complete' STATUSES = [(x, x) for x in (OPEN, IN_PROGRESS, COMPLETE)] title = models.CharField( max_length=30, verbose_name='Task', ) description = models.CharFiel...
""" Copyright 2018-present Krzysztof Nazarewski. 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...
import inspect import compiler import astor import ast from astor.codegen import to_source import lfs def foo(disk): print 'test' disk.write() disk.flush() disk.write() disk.flush() disk.write() disk.flush() class RemoveFlush(ast.NodeTransformer): def __init__(self, root, *args, **kw...
# Copyright (c) 2014-present PlatformIO <contact@platformio.org> # # 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...
from __future__ import absolute_import from . import datasets from . import evaluation_metrics from . import models from . import utils from . import evaluators from . import trainers __version__ = '0.1.1'
from functools import reduce read = input n = int(read()) A = list(map(int, read().split())) if any(map(lambda x:x==0, A)): A = map(abs, A) print(sum(A)) else: cnt = reduce(lambda ac,x:ac + 1 if x < 0 else ac, A, 0) if cnt % 2 == 0: A = list(map(abs, A)) print(sum(A)) else : ...
from plotly.basedatatypes import BaseTraceType as _BaseTraceType import copy as _copy class Histogram2d(_BaseTraceType): # class properties # -------------------- _parent_path_str = "" _path_str = "histogram2d" _valid_props = { "autobinx", "autobiny", "autocolorscale", ...
# coding: utf-8 """Test function in module.""" import pytest from colorama import Fore from colorclass import Color from termcolor import colored from terminaltables.width_and_alignment import visible_width @pytest.mark.parametrize('string,expected', [ # str ('hello, world', 12), ('世界你好', 8), ('蓝色',...
#!/usr/bin/env python # # Copyright 2016 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 require...
# coding: utf-8 # # Chart Presentation (1) - Styling the legend # In this third section on chart presentation we'll mainly focus on how to style the legend. We'll see how to colour and position the legend, as well as how to change how the items within it are postioned. Finally, we'll also learn how to change the bac...
r""" Pore-scale models for calculating the electrical conductance of conduits. """ from openpnm.models.physics.utils import _poisson_conductance __all__ = ["generic_electrical", "series_resistors"] def generic_electrical(target, pore_conductivity='pore.electrical_conductivity', ...
# Copyright (c) Facebook, Inc. and its affiliates. from minihack.envs import register from minihack import MiniHackNavigation, RewardManager class MiniHackMemento(MiniHackNavigation): """Environment for a memento challenge.""" def __init__(self, *args, des_file, **kwargs): kwargs["max_episode_steps"]...
import os from itertools import chain import pytest from pygtrie import Trie from dvc.repo.index import Index from dvc.stage import PipelineStage, Stage from dvc.utils import relpath from tests.func.plots.utils import _write_json def test_index(tmp_dir, scm, dvc, run_copy): (stage1,) = tmp_dir.dvc_gen("foo", "f...
from django import template from reversion.models import Version register = template.Library() @register.filter def num_revisions(document): versions = Version.objects.get_for_object(document) return len(versions)
from lib.game.ui.general import UIElement, Rect, load_ui_image DM_LABEL = UIElement(name='DM_LABEL') DM_LABEL.description = "Dimension missions label in lobby." DM_LABEL.text_rect = Rect(0.053125, 0.01574074074074074, 0.23333333333333334, 0.07685185185185185) DM_LABEL.text = "DIMENSION MISSION" DM_LABEL.text_threshol...
#!/usr/bin/env python3 import argparse import subprocess parser = argparse.ArgumentParser() parser.add_argument("action", help="enter action desired [build | start | stop | restart]") args = parser.parse_args() if args.action == "build": command = "docker build -t devnet-create-2020 .".split() subprocess.run...
#!/usr/bin/env python2 # Copyright (c) 2017 The Zcash developers # Copyright (c) 2018-2019 Commercium Developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from decimal import Decimal from test_framework.test_framework import...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. import os import unittest from collections import Counter from pathlib import Path # This file groups together tests which look at the code without running it. # When running the tests inside conda's build, the code is not available. in_conda_bui...
# pylint: disable=E1101 from datetime import datetime import os import unittest import warnings import nose import numpy as np from pandas.core.frame import DataFrame from pandas.io.parsers import read_csv from pandas.io.stata import read_stata, StataReader, StataWriter import pandas.util.testing as tm def curpat...
# Generated by Django 2.2.16 on 2020-09-15 11:12 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("glimpse", "0001_initial"), ] operations = [ migrations.AlterField( model_name="glimpse", name="content", ...
from pydantic import BaseSettings from app.log import logger class Settings(BaseSettings): site_url: str email_domain: str dapanel_url: str dapanel_user: str dapanel_pass: str inbox: str inbox_url: str inbox_pass: str fetch_frequency: str = 300 class Config: env_file =...
""" This script compute best fit from theory and fg power spectra. In our particular case, we use best fit foregrounds from erminia. """ import sys import numpy as np import pylab as plt from pspy import pspy_utils, so_dict d = so_dict.so_dict() d.read_from_file(sys.argv[1]) surveys = d["surveys"] fg_array = np.load...
import torch import torch.nn as nn import torch.nn.functional as F class BaseNetwork(nn.Module): def __init__(self): super(BaseNetwork, self).__init__() def init_weights(self, init_type='normal', gain=0.02): ''' initialize network's weights init_type: normal | xavier | kaiming...
from pathlib import Path from pytest import raises from pytest_mock import MockerFixture from polybot.cli import main from polybot.version import __version__ _test_sample = str(Path(__file__).parent / 'files' / 'example-sample.json') def test_version(capsys): main(['version']) captured = capsys.readouterr(...