content
stringlengths
5
1.05M
#!/usr/bin/python3 import sys import os import subprocess import numpy as np import nibabel as nib import colormaps import time FIXED_OUT_N4 = 'n4out-fixed.nii.gz' FLOATING_OUT_N4 = 'n4out-floating.nii.gz' FIXED_OUT_BET = 'betout-fixed.nii.gz' FLOATING_OUT_BET = 'betout-floating.nii.gz' REG_OUT = 'warped.nii.gz' REG_...
# Python 3 # Polygonal spiral import turtle t = turtle.Pen() # gui integer input + default value sides = int(turtle.numinput("Number of sides", "How many sides your spiral have?", 4)) for m in range(5, 75): t.left(360/sides + 5) t.width(m//25+1) t.penup() t.forward(m*4) t.pendown() ...
import time from threading import Condition class TooManyErrorsOccured(Exception): pass class Counter: def __init__( self, total: int, progress_interval: int = 1, threshold_errors: "int | None" = None, ) -> None: self._processed = 0 self._success = 0 ...
import serial import struct import time import threading import warnings from .message import Message from enums.PTPMode import PTPMode from enums.CommunicationProtocolIDs import CommunicationProtocolIDs from enums.ControlValues import ControlValues class Dobot: def __init__(self, port, verbose=False): ...
from pyecharts.charts import Bar from pyecharts.render import make_snapshot from pyecharts import options as opts from pyecharts.globals import ThemeType from snapshot_selenium import snapshot # 在使用 Pandas&Numpy 时,确保将数值类型转换为 python 原生的 int/float。比如整数类型请确保为 int,而不是 numpy.int32 bar = ( Bar(init_opts=opts.InitOpts(...
# -*- coding: utf-8 -*- """ @project : WechatTogether @Time : 2020/9/9 14:21 @Auth : AJay13 @File :interface_article_list.py @IDE :PyCharm @Motto:ABC(Always Be Coding) """ # 文章管理的接口:文章列表、删除文章、修改文章、文章加如周报、文章前台隐藏、批量删除文章 # 公众号管理接口:社区提交公众号、公众号任务、公众号采集 ## 社区提交公众号展示:社区公众号展示、社区添加公众号、删除社区公众号、修改社区公众号、收录社区公众号 ## 公众号任务:公众号展示、添...
from datetime import datetime from random import randint class Pessoa: ano_atual = int(datetime.strftime(datetime.now(), '%Y')) def __init__(self, nome, idade, comendo=False, falando=False): self.nome = nome self.idade = idade self.comendo = comendo self.falando = falando d...
# Generated by Django 2.1.7 on 2019-03-25 18:56 from django.db import migrations def make_nodes(apps, schema_editor): from treebeard.mp_tree import MP_Node from froide.helper.tree_utils import _inc_path, add_children def get_children(node): return GeoRegion.objects.filter(part_of=node).order_by...
import sys import attr from redis import Redis def main(): redis_url = sys.argv[1] basename = sys.argv[2] friendly_name = sys.argv[3] redis = Redis.from_url(redis_url) redis.set("character:" + basename + ":name", friendly_name) if __name__ == "__main__": main()
import datetime import transaction from nthuion.models import Comment, Issue, Solution, Tag from .common import ManyUserTest from .base import WebTest class BaseCommentTest(ManyUserTest): def create_issue(self, user_id, is_anonymous=False): """ create an issue with the given user id and is_anonym...
#!/usr/bin/env python from __future__ import print_function, division import numpy as np # SAA, whcih includes the SouthWest Polar Horn region saacols = np.loadtxt('saa_lonlat.txt') # For .reg file need to convert lon to [0,360) lon = saacols[:,0] lon[lon<0]+= 360.0 saacols[:,0] = lon outfile = file('saa.reg','w') pr...
#!/usr/bin/python # script preparing tab file to plot in R for small RNA profiling # version 1 29-1-2012 # Usage plotter.py <bowtie input> <min size> <max size> <normalization factor> <tabular output> import sys def acquisition (file2parse, sizerange): F = open (file2parse) plus_table = {} minus_table = {} f...
import json from tests.base_test import BaseTestCase class UpdateQuestionTestCase(BaseTestCase): def setUp(self): super().setUp() self.url = '/questions/' def add_question(self): """ Create a dummy question """ user = self.create_user(self.user) quest...
from crhelper import CfnResource import json import boto3 helper = CfnResource() fwclient = boto3.client('network-firewall') ec2client = boto3.client('ec2') @helper.create @helper.update def addRouteTableToIGW(event, _): routes = event['ResourceProperties']['Routes'] print(routes) firewallName = event['R...
import time import pygame as pg import sys from game import Game from screens.settings_screen import SettingsScreen from screens.game_screen import GameScreen from settings import * OPTION_COLOR = (128, 135, 239) SELECTED_OPTION_COLOR = (255, 255, 255) INITIAL_V_GAP = 140 V_SPACING = 5 class Menu(GameScreen): ...
#objective: look for all 3-regular graphs of size 8. import numpy as np from collections import Counter from itertools import permutations import igraph # how does the loop works? # I have a list called Astack; each element is a list of two things: # 1st is a matrix; second a integer # integer: -1 means it's no use t...
from flask import Flask, flash, render_template, abort, session, redirect, request from flask_sqlalchemy import SQLAlchemy from flask_admin import Admin from flask_admin.contrib.sqla import ModelView from datetime import datetime import sqlalchemy from flask_mail import Mail, Message from config import mail_username, m...
# https://leetcode.com/problems/count-number-of-teams class Solution: def numTeams(self, rating: List[int]) -> int: N = len(rating) if N < 3: return 0 res = 0 for i in range(N): for j in range(i + 1, N): if rating[i] < rating[j]: ...
#!/usr/bin/python3 import sys, re, math, time #The main function, runs the program, takes inputFile as a parameter def main(inputFile): #Cities is a dictionary that contains all the information from the inputFile cities = inputFunction(inputFile) #Start time will begin the timer in order to track how l...
""" python-dirtt - Directory Tree Templater (c) 2012 Robert Moggach and contributors Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php dirtt is a standalone tool and library used to generate directory and file structures from xml templates that describe repeatedly used filesystem lay...
from faker import Factory from homes_to_let.models import LettingNote from homes_to_let.factories.letting_factory import LettingFactory import factory fake = Factory.create('en_GB') class LettingNoteFactory(factory.DjangoModelFactory): class Meta: model = LettingNote property = factory.SubFactory...
# -*- coding: utf-8 -*- """ test_djangocms_highlightjs ------------ Tests for `djangocms_highlightjs` modules module. """ from __future__ import absolute_import, print_function, unicode_literals from cms.views import details from django.contrib.auth.models import AnonymousUser from djangocms_highlightjs.models import...
import os import json from uuid import uuid4 import logging import shutil import threading from filelock import FileLock from apluslms_file_transfer.server.utils import (get_update_files, whether_allow_renew, tempdir_pat...
import numpy as np import torch class FAN(object): def __init__(self): import face_alignment self.model = face_alignment.FaceAlignment( face_alignment.LandmarksType._2D, flip_input=False,device='cpu') def run(self, image): ''' image: 0-255, uint8, rgb, [h, w, 3] ...
from flask import render_template, flash, Blueprint, url_for, redirect from flaskwebsite.sarcasm_classifier.forms import TextInputForm from flaskwebsite.sarcasm_classifier.function import load_model, predict sarcasm_classifier = Blueprint("sarcasm_classifier", __name__) @sarcasm_classifier.route("/sarcasm", methods...
import matplotlib.pyplot as plt import matplotlib as mpl from matplotlib.gridspec import GridSpec import numpy as np import torch def toy_plot(model, x, Y, weights, components): fig = plt.figure(tight_layout=True, figsize=(15, 10)) gs = GridSpec(2, 6) recon_axes = [fig.add_subplot(gs[0, i * 2 : (i + 1) * ...
from django import forms from .models import UserNotifications from .models import UserPhonenumber from registration.forms import RegistrationForm class NotificationForm(forms.ModelForm): datestart = forms.DateField(label = "Start Date") dateend = forms.DateField(label = "End Date") class Meta: m...
from django.db import models from swampdragon.models import SelfPublishModel from .serializers import CompanySerializer, StaffSerializer, DocumentSerializer, CompanyOwnerSerializer class Company(SelfPublishModel, models.Model): name = models.CharField(max_length=100) serializer_class = CompanySerializer ...
# -*- coding: utf-8 -*- SECRET_KEY = "secret key" #When False the files are served via a Nginx location clause SERVE_STATIC = False #Hard coded in clients #The subdomain "www" is the master domain. #The site root does 301 to www, which does not work here! FILE_SERVER_ROOT = 'https://www.XXXXX.dyndns.org/sfa/seafhttp'...
import urllib.request import json class CurrencyCoverter: def __init__(self, url): request = urllib.request.Request(url, headers={'User-Agent': 'Currency Converter'}) data = urllib.request.urlopen(request).read() data = json.loads(data.decode('utf-8')) self.conversion_rates = data['c...
from setuptools import setup, find_packages setup( name='social-auth-steemconnect', version='0.0.3', packages=find_packages(), author='Krzysztof @noisy Szumny', author_email='noisy.pl@gmail.com', description='SteemConnect backend for python-social-auth.', long_description=open('README.md')...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 4 15:24:52 2020 @author: frederik SSVEP Flicker Activity extractor Takes a 240fps recording, and extracts the activity of blinking red light """ import cv2 import numpy as np #Creating file for saving activity saveFile = open("activity.txt","w")...
import numpy as np import numpy.linalg as la from auxiliary import * A = np.array([ [64, 2, 3, 61, 60, 6], [ 9, 55, 54, 12, 13, 51], [17, 47, 46, 20, 21, 43], [40, 26, 27, 37, 36, 30], [32, 34, 35, 29, 28, 38], [41, 23, 22, 44, 45, 19], [49, 15, 14, 52, ...
import copy import ntpath import pathlib import posixpath import sys import unittest from test.support import verbose try: # If we are in a source tree, use the original source file for tests SOURCE = (pathlib.Path(__file__).absolute().parent.parent.parent / "Modules/getpath.py").read_bytes() except FileNotFo...
# -*- coding: utf-8 -*- """Views.""" from __future__ import unicode_literals import os import uuid from collections import defaultdict from django.template import Context, Template, TemplateSyntaxError from django.conf import settings from django.shortcuts import get_object_or_404, render from django.contrib.auth....
from github import Github from github_token import GITHUB_TOKEN, user, password from inky import InkyPHAT inky_display = InkyPHAT("red") # Set up the display if colour == "auto": from inky.auto import auto inky_display = auto() colour = inky_display.colour else: inky_display = InkyPHAT(colour) inky_...
# # Copyright (c) 2020 by Delphix. All rights reserved. # ####################################################################################################################### """ Main Exception Class: UserConvertibleException |-Two Types of exceptions: |-DatabaseException - Superclass for any DB related Except...
import sys from textwrap import dedent MINIMUM_VERSION = (2, 4) def check_version(): if sys.version_info < MINIMUM_VERSION: min_version_str = '.'.join(str(x) for x in MINIMUM_VERSION) print("Python >= %s required. You are using:\n%s" % (min_version_str, sys.version)) print(dedent(""" ...
#!/usr/bin/env python3 import argparse import re import pandas as pd def main(): args = parse_arguments() clades = pd.read_csv(args.clades) clade_assignments = {} for vcf in args.inputs: df = load_vcf(vcf) name = re.sub(r"^.*/|\..*$", "", vcf) clade_assignments[name] = get_c...
import sys # Clear module cache to force reloading all modules of this package. # See https://github.com/emmetio/sublime-text-plugin/issues/35 prefix = __package__ + "." # don't clear the base package for module_name in [ module_name for module_name in sys.modules if module_name.startswith(prefix) and mo...
#!/usr/bin/env python3 """ Yandex Transport/Masstransit Webdriver API. This module is to be used together with YandexTransportProxy project (https://github.com/OwlSoul/YandexTransportProxy). It provides some limited access to Yandex Masstransit API. While it's difficult to get all the masstransit data of one city usi...
from __future__ import absolute_import, division, print_function import numpy as np import numpy.testing as npt import isoensemble from sklearn.datasets import load_boston from sklearn.ensemble import RandomForestClassifier import time def get_leaf_counts(pmdtrf): numtrees=len(pmdtrf.estimators_) #np.int(self...
""" Cosmological tools """ import numpy as np from scipy.integrate import quad import matplotlib.pyplot as plt class CosmologicalTools: def __init__(self, OmegaM=0.2726, OmegaL=0, OmegaR=0, h=0.704): # initializing the cosmology self.OmegaM = OmegaM # matter density parameter self.Omega...
import pytest from cpc_fusion._utils.abi import ( filter_by_name, ) ABI_FUNC_1 = { "constant": False, "inputs": [], "name": "func_1", "outputs": [], "type": "function", } ABI_CONSTRUCTOR = { "constant": False, "inputs": [], "type": "constructor", } ABI_FALLBACK = { "constant": ...
import os from setuptools import setup, find_packages def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name="aiobooru", version="0.1.2", author="Yui Yukihira", author_email="yuiyukihira1@gmail.com", description="A danbooru API helper using aiohttp", ...
#!/usr/bin/python """ Task Monitor Class """ from __future__ import print_function import textwrap import time import sys from vctools import Logger class Tasks(Logger): """ Manage VMware Tasks """ def __init__(self): pass @classmethod def question_and_answer(cls, host, **answered): ""...
# ################################################################################################ # ------------------------------------------------------------------------------------------------ # File: vision_tool.py # Author: Luis Monteiro # # Created on nov 17, 2019, 22:00 PM # ---------------------------------...
# https://leetcode.com/problems/group-anagrams/ # Medium # Time Complexity: O(n * s log s) where n = len(list) and s = length of longest string in the list # We can reduce the time complexity by counting sort # Space Complexity: O(n) class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: ...
from clients import Client class Account: def __init__(self, clients, number, balance=0): self.balance = 0 self.clients = clients self.number = number self.operations = [] self.deposit(balance) def resume(self): print('-' * 34) print(f'CC Número: {self....
"""empty message Revision ID: 3dcef2e3c442 Revises: 1349a2c924f4 Create Date: 2019-03-29 07:23:12.851270 """ # revision identifiers, used by Alembic. revision = '3dcef2e3c442' down_revision = '1349a2c924f4' from alembic import op import sqlalchemy as sa def upgrade(): # ### commands auto generated by Alembic ...
from __future__ import absolute_import from django.db.models.query import QuerySet from .base import BaseAPITestCase from contentcuration.models import Channel from contentcuration.models import ContentNode from contentcuration.models import DEFAULT_CONTENT_DEFAULTS from contentcuration.viewsets.channel import Channe...
name = "MySpice" from . import MySpice
# -*- coding: utf-8 -*- """ Created on Tue Oct 13 09:47:17 2020 @author: cheritie """ from astropy.io import fits as pfits import numpy as np from AO_modules.calibration.CalibrationVault import calibrationVault from AO_modules.calibration.InteractionMatrix import interactionMatrix from AO_modules.tools.to...
import unittest import json from config.loader import neo_config from api import NeoAPI from config.database import db from models.User import User as UserModel from utils.testutils import authenticate_user from gevent import monkey monkey.patch_all() class AccountCreate(unittest.TestCase): def setUp(self): ...
from cave.morphers.base import Morph class DeviantArt(Morph): NAME = 'DeviantArt' URL = 'deviantart.com' IMAGE_PATTERN = '.thorpedo-thumb-link img'
# 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...
from django.contrib.auth.decorators import login_required from django.shortcuts import render from rest_framework.response import Response from .models import Chatroom,Message from rest_framework import status, permissions from .serializers import ChatroomSerializer from django.core import serializers import json from ...
import paddle from paddle import nn import math import numpy as np def _cfg(url='', **kwargs): return { 'url': url, 'num_classes': 2, 'input_size': (3, 600, 600), 'pool_size': None, 'crop_pct': .9, 'interpolation': 'bicubic', 'mean': (0.5, 0.5, 0.5), 'std': (0.5, 0.5, 0....
import py from py.__.test.conftesthandle import Conftest class TestConftestValueAccessGlobal: def setup_class(cls): # if we have "global" conftests (i.e. no __init__.py # and thus no further import scope) it should still all work # because "global" conftests are imported with a # m...
# Generated by Django 2.0.7 on 2018-08-04 05:19 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Allergen', fields=[ ...
from unittest.mock import patch, mock_open, MagicMock import pytest from cincoconfig.encryption import KeyFile, AesProvider, EncryptionError, XorProvider, SecureValue class StubProvider: def __init__(self): self.encrypt = MagicMock(return_value=b'ciphertext') self.decrypt = MagicMock(return_value...
from django.apps import AppConfig class UserProfileConfig(AppConfig): name = 'user_profile'
# -*- python -*- # -*- coding: utf-8 -*- # # (c) 2013-2021 parasim inc # (c) 2010-2021 california institute of technology # all rights reserved # # Author(s): Lijun Zhu # the package import altar # my protocol from .DataObs import DataObs as data # declaration class DataL2(altar.component, family="altar.data.datal2"...
import uvicorn from fastapi import FastAPI, status from fastapi.middleware.cors import CORSMiddleware from app.core.config import settings def get_application(): _app = FastAPI(title=settings.PROJECT_NAME) _app.add_middleware( CORSMiddleware, allow_origins=[str(origin) for origin in settings....
from graphing.special_graphs.neural_trigraph.marginal_matching.marginal_matching1 import get_schedule, get_schedule_rand from graphing.special_graphs.neural_trigraph.marginal_matching.scoring import score from graphing.special_graphs.neural_trigraph.toy_graphs import ToyGraph1 import numpy as np def evolve(n_iter=100...
#!/usr/bin/env python3 import io import optparse def read(fname): with open(fname, encoding='utf-8') as f: return f.read() # Get the version from yt_dlp/version.py without importing the package def read_version(fname): exec(compile(read(fname), fname, 'exec')) return locals()['__version__'] de...
# Generated by Django 2.0.8 on 2018-10-04 09:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("evaluation", "0008_config_submission_join_key")] operations = [ migrations.AddField( model_name="config", name="publication_url_c...
# -*- coding: UTF-8 -*- #!/usr/bin/python3 # Variables needed to initialize MyCobot Pi from pymycobot import PI_PORT, PI_BAUD from pymycobot.mycobot import MyCobot import time def gripper_test(mc): print("Start check IO part of api\n") # Check if the gripper is moving flag = mc.is_gripper_movin...
# -*- coding: utf-8 -*- """ TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) 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 compliance ...
"""This package implements a handler for the Python language.""" from mkdocstrings_handlers.python.handler import get_handler __all__ = ["get_handler"] # noqa: WPS410
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-BASE 蓝鲸基础平台 is licensed under the MIT License. License for BK-BASE 蓝鲸基础平台: ---------------------------------------------...
# # Copyright 2015 Quantopian, 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 law or agreed to in wr...
# -*- coding: utf-8 -*- # flake8: noqa: E501 from __future__ import unicode_literals from kinopoisk.person import Person from .base import BaseTest class PersonTest(BaseTest): def test_person_manager_with_one_result(self): persons = Person.objects.search('Гуальтиеро Якопетти') self.assertEqual(le...
from libs.db import db class User(db.Model): '''用户表''' __tablename__ = 'user' id = db.Column(db.Integer, primary_key=True) nickname = db.Column(db.String(20), unique=True, nullable=False, index=True) password = db.Column(db.String(128), nullable=True) gender = db.Column(db.String(10), default...
""" Copyright 2020 MPI-SWS 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 distri...
import pandas as pd from .dataframe_bytes_storage import df_from_bytes, df_to_bytes from .numpy_bytes_storage import np_from_bytes, np_to_bytes try: import rpy2.robjects as robjects from rpy2.robjects import pandas2ri from rpy2.robjects.conversion import localconverter def r_to_py(object_): i...
#!/usr/bin/env python # -*- coding: utf-8 -*- ########################################################### # WARNING: Generated code! # # ************************** # # Manual changes may get lost if file is generated again. # # Only code inside the [MANUAL] ta...
from dataclasses import dataclass, field from typing import Optional @dataclass class Test: class Meta: name = "test" foo: Optional[int] = field( default=None, metadata={ "type": "Attribute", } ) bar: Optional[str] = field( default=None, met...
TESTING = True BABEL_DEFAULT_LOCALE = 'en_US' CSRF_ENABLED = False WTF_CSRF_ENABLED = CSRF_ENABLED LOGIN_DISABLED = False SQLALCHEMY_DATABASE_URI = 'sqlite://'
import zhu zhu.startgame for i in range(10000): zhu.showit
class Executor: def __init__(self, expression, cursor): self.expression = expression self.cursor = cursor def execute(self, cursor): sql, args = self.expression.to_sql() cursor.execute(sql, args) for row in cursor: yield row
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np from numpy.testing import assert_allclose from astropy.tests.helper import pytest, assert_quantity_allclose from astropy.units import Quantity from ...uti...
# 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, overload from ... import _utilities fro...
from inspect import isclass, isfunction, ismodule from functools import partial is_func_or_partial = lambda f: isfunction(f) or isinstance(f, partial) def write_docs_for_module(module, path, modules_to_skip=None, generate_index=False): if modules_to_skip is None: modules_to_skip...
import numpy as np print('Cron Test') mean_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] print(np.mean(mean_list)) print('Imported numpy successfully')
from dataclasses import dataclass @dataclass class P91HasUnit: """ Scope note: This property shows the type of unit an instance of E54 Dimension was expressed in. Examples: - height of silver cup 232 (E54) has unit mm (E58) In First Order Logic: P91(x,y) &#8835; E54(x) P91(x,y) &#8835; E58(y) """ URI...
from django.shortcuts import get_object_or_404, get_list_or_404, render, redirect from reportlab.pdfgen import canvas from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseNotFound #from utils import render_to_pdf from datetime import date, datetime from django.core.exceptions import Permiss...
#!/bin/python3 import math import os import random import re import sys import bisect def median(x): lenx = len(x) if lenx % 2 == 0: return((x[lenx//2] + x[lenx//2 - 1])/2) if lenx % 2 != 0: return(x[lenx//2]) # Complete the activityNotifications function below. def activityNotificatio...
"""This is an experimental implementation of cc_shared_library. We may change the implementation at any moment or even delete this file. Do not rely on this. It requires bazel >1.2 and passing the flag --experimental_cc_shared_library """ # TODO(rostam): Delete this module after the release of Bazel built-in cc_shar...
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import torch import torch.nn as nn from mmcv.cnn import (build_conv_layer, build_norm_layer, constant_init, normal_init) from mmcv.utils import digit_version from torch.nn.modules.batchnorm import _BatchNorm from mmpose.models.utils.ops ...
# Copyright 2020 Daniel J. Tait # # 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 writin...
#!/usr/bin/python # Copyright (c) 2016 AIT, ETH Zurich. 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, this l...
from .vtk_backplot import VTKBackPlot
''' XlPy/Spectra/scan_parser ____________________ Quick tool to split scan-delimited file formats (such as MGF) to allow parsing on entire scans without loading the full file into memory. :copyright: (c) 2015 The Regents of the University of California. :license: GNU GPL, see licenses/GNU ...
def isFS(arr): if len(arr) == 1: return True for i in range(2, len(arr)): if (arr[i] - arr[i - 1] != arr[i - 2]): return False return True arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] arr[0] = 1 arr[1] = 1 for i in range(2, len(arr)): arr[i] = arr[i - 1] + arr[i - 2] arr.sort() i...
from battleship.grid import Grid, Outcome from battleship.ship import Ship def test_grid_creates_ok(): grid = Grid(10) assert grid.lost( ) def test_grid_places_ship_ok(): grid = Grid(10) assert grid.lost( ) ship = Ship((0,0), (0, 2)) grid.place(ship) assert grid.ships == 3 assert not ...
from InstagramCLI import InstagramCLI cli = InstagramCLI(username="", password="") data= cli.get_highlights(target_username="therock",save_urls=True,save_to_device=True,story_count=2,media_type="video") print(data) cli.close()
from attr import attrs, asdict from aioalice.utils import safe_kwargs @safe_kwargs @attrs class AliceObject(object): """AliceObject is base class for all Alice requests related objects""" def to_json(self): return asdict(self)
class Solution: """ @param L: Given n pieces of wood with length L[i] @param k: An integer @return: The maximum length of the small pieces """ def woodCut(self, L, k): # write your code here if L is None or len(L) == 0: return 0 ...
from datetime import datetime from apiclient.discovery import build import json from senpaibot.orderedset import OrderedSet class BaseReadingList: def get_reading_list(self): raise NotImplemented def get_undated_reading_set(self): raise NotImplemented @property def reading_list(self...