content stringlengths 0 894k | type stringclasses 2
values |
|---|---|
""" Cisco_IOS_XR_ethernet_lldp_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR ethernet\-lldp package operational data.
This module contains definitions
for the following management objects\:
lldp\: Link Layer Discovery Protocol operational data
Copyright (c) 2013\-2016 by Cisco Syste... | python |
from flask import json
from tests.test_case import *
from app import constants
from app.events.dao import users_dao as ud
from app.events.dao import applications_dao as ad
class AppsTestCase(TestCase):
def setUp(self):
super(AppsTestCase, self).setUp()
Application.query.delete()
db_session_commit()
de... | python |
#!/usr/bin/env python
# -*-coding:utf-8-*-
from os.path import expanduser
home = expanduser("~")
orig_content = file(home + "/github/luiti/luiti/README.markdown").read()
layout_content = """
---
layout: default
title: Home
note: This file is auto generated by /tools/generate_document_guide_page.py, dont modify this f... | python |
#In this problem we have to state the count of rotations a sorted array has
#gone through.
# For Ex:
# 4 5 6 1 2 3 4
# The above array has gone through 3 rotations
n=int(input("Enter the length of the array:\n"))
arr=[]
#taking input
for i in range(0,n):
print("Element",i+1)
ele = int(input(... | python |
from .Common import *
from .chars import (
Header,
InitStrFormat,
InitStrFormatContainDummy,
GoalStrFormat,
InitActionStateUpdateFormat,
InitActionTimesUpdateFormat,
HandsPosition,
EndPose,
InitState,
SpecialDomainHeadStr,
SpecialFuncAndPreStr,
SpecialActionStr,
initA... | python |
import logging
import os
from faucetconfrpc.faucetconfrpc_client_lib import FaucetConfRpcClient
from poseidon_core.helpers.config import yaml_dump
class EmptyFaucetConf(Exception):
pass
class FaucetRemoteConfGetSetter:
DEFAULT_CONFIG_FILE = ''
def __init__(self, client_key=None, client_cert=None,
... | python |
import json
import logging
import re
import sys
from pathlib import Path
from typing import List, Optional
import requests
from slugify import slugify
from kadenze_dl.models import Session, Video
logger = logging.getLogger("utils")
logger.addHandler(logging.StreamHandler(sys.stdout))
logger.setLevel(logging.INFO)
f... | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-07-20 00:14
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | python |
# """Test Classification Manager Module."""
# import pytest
# from geniepy.errors import ClassifierError
# import geniepy.datamgmt.daos as daos
# import geniepy.datamgmt.repositories as dr
# from geniepy.datamgmt.tables import PUBMED_PROPTY, CTD_PROPTY, CLSFR_PROPTY
# from geniepy.datamgmt import DaoManager
# from geni... | python |
from flask import render_template
from app import app
from .request import get_sources,get_news
# from .models import Source,Article
# from .request import get_news
@app.route('/')
def index():
'''
View root page function that returns the index page and its data
'''
# Getting popular news
tit... | python |
"""Run a system command in its own working directory."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# phlsys_workingdircommand
#
# Public Classes:
# CommandWithWorkingDirectory
#
# ---------... | python |
"""Retrieve the path of the parent module to dynamically build the name of FastAPI app."""
import pathlib
parent_module = pathlib.Path(__file__).parent.name
| python |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import dials_data
import dials_data.datasets
import dials_data.download
import mock
def test_all_datasets_can_be_parsed():
assert dials_data.datasets.definition
def test_repository_location():
rl = dials_data.datasets... | python |
# Generated from IEC61131Parser.g4 by ANTLR 4.9.1
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\u0118")
buf.write("\u0a1a\b\1\4\2\t\2\4\3\t\3\4\4\t\4... | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_quickD3map
----------------------------------
Tests for `quickD3map` module.
"""
import nose.tools as nt
from nose.tools import raises
import pandas as pd
import numpy as np
from itertools import combinations
import geojson
from quickD3map import PointMap, LineM... | python |
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
from enum import Enum
from logging import getLogger
logger = getLogger(__name__)
class TaskName(str, Enum):
copr_build_start = "task.run_copr_build_start_handler"
copr_build_end = "task.run_copr_build_end_handler"
copr_build ... | python |
from collections import Mapping
from colorama import Fore, Style
def log(msg):
print("{}{}".format(Style.RESET_ALL, msg))
def log_highlight(msg):
print("{}{}".format(Fore.GREEN, msg))
def info(msg):
print("{}[INFO] {}".format(Fore.CYAN, msg))
def warn(msg):
print("{}[WARN] {}".format(Fore.YELLOW, msg))
de... | python |
# -*- coding: utf-8 -*-
from openelevationservice import SETTINGS
from openelevationservice.server.api import api_exceptions
from openelevationservice.server.utils import logger, convert, codec
from openelevationservice.server.api import querybuilder, validator
from openelevationservice.server.api.response import Resp... | python |
from bs4 import BeautifulSoup
import requests
#
def parse_a_website(url) -> BeautifulSoup:
response = requests.get(url)
data = response.text
soup = BeautifulSoup(data, 'html.parser')
return soup
| python |
from sqlalchemy.sql.functions import func
from model.db import db
import json
from controller.logicTopoBasin import LogicTopoBasin
from controller.logicTopoLivingArea import LogicTopoLivingArea
from controller.logicTopoAgricultureArea import LogicTopoAgricultureArea
from controller.logicTopoWaterwork import LogicTopoWa... | python |
# coding: utf-8
# In[3]:
import cv2
import numpy as np
import sys
sys.path.append('../')
from Mod.utils import *
from tqdm import tqdm
# In[4]:
def py_nms(dets,thresh):
'''剔除太相似的box'''
x1 = dets[:, 0]
y1 = dets[:, 1]
x2 = dets[:, 2]
y2 = dets[:, 3]
scores = dets[:, 4]
areas = (x2 -... | python |
from flask import render_template
from flask_login import login_required
from .blueprint import web
@web.route("/")
def index():
return render_template("index.html")
@web.route("/customer")
@login_required
def customer():
return render_template("customer.html")
| python |
from peewee import *
from cdm_souffleur.model.baseModel import BaseModel
class mapped_concept(BaseModel):
id = AutoField()
name = CharField()
codes_and_mapped_concepts = TextField()
username = CharField()
created_on = DateTimeField() | python |
#coding=utf-8
'''
Created on 2016年3月3日
'''
import zmq
from exception import UnimplementedException, Zmqf404
import logging
import json
__author__ = 'chenjian'
class ZmqfPattern(object):
'''
'''
MPBS = 'MPBS'# Multi Publisher -- Broker -- Multi Subscriber
class ZmqfApplication(object):
'''
cla... | python |
from django import forms
from . import models
from ..base.forms import SentryProjectInput
from ..checklists.forms import TagInput
from ..repos.forms import RepoInput
class ServiceForm(forms.ModelForm):
class Meta:
model = models.Service
fields = [
"owner",
"name",
... | python |
from functools import partial
from itertools import chain
from typing import (Optional,
Sequence)
from clipping.planar import (complete_intersect_multisegment_with_polygon,
complete_intersect_polygons,
complete_intersect_regions,
... | python |
# This package will contain the spiders of your Scrapy project
#
# Please refer to the documentation for information on how to create and manage
# your spiders.
import scrapy
import json
import sys
from scrapy.http import Request
from Links.items import DSItem
from __builtin__ import any as b_any
class DSSpider(scr... | python |
from typing import Callable, List
class Route:
def __init__(self, url_path: str, fn: Callable, methods: List[str]):
self.url_path = url_path
self.fn = fn
self.methods = methods
| python |
import unittest
from collections import MutableMapping, MutableSequence
from mock import MagicMock, Mock, patch, sentinel
from unittest_expander import expand, foreach, param
from rabbit_tools.delete import DelQueueTool
from rabbit_tools.purge import PurgeQueueTool
tested_tools = [
param(tool=DelQueueTool),
... | python |
'''
Created on 30.08.2015
@author: mEDI
'''
from PySide import QtCore, QtGui, QtSvg
from datetime import datetime
class guitools(object):
def __init__(self, parent):
self.parent = parent
def getPixmapFromSvg(self, svgfile, w=48, h=48):
svg_renderer = QtSvg.QSvgRenderer(svgf... | python |
from animal import *
from species import *
from habitat import *
from transport import *
bob = Betta('orange', 'Bob')
betty = Betta('blue', 'Betty')
| python |
# Generated by Django 3.1.5 on 2021-01-18 09:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('courses', '0004_delete_card'),
]
operations = [
migrations.CreateModel(
name='Card',
... | python |
"""Test suites for numerical compatibility with librosa"""
import os
import unittest
import torch
import torchaudio
import torchaudio.functional as F
from torchaudio._internal.module_utils import is_module_available
from parameterized import parameterized, param
LIBROSA_AVAILABLE = is_module_available('librosa')
if ... | python |
# Copyright 2016 Mirantis 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 writing, so... | python |
import augument as myaug
from loader.fb_image_gen_pre import *
from settings import *
from utils import getMinMax
import numpy as np
import time
from models.resnet50Reg import *
def plot_images(imlist):
imlen= len(imlist)
plt.figure(figsize=(6, 2))
for i in range(imlen):
plt.subpl... | python |
constants = {
"L": {
"short_name": "L",
"description": "Canopy background adjustment",
"default": 1.0,
},
"g": {
"short_name": "g",
"description": "Gain factor",
"default": 2.5
},
"C1": {
"short_name": "C1",
"description": "Coefficient ... | python |
##########################
# Test script to check if advisors have duplicated idea tokens
# By Pelmen, https://github.com/Pelmen323
##########################
import re
from ..test_classes.generic_test_class import ResultsReporter
from ..test_classes.characters_class import Characters
def test_check_advisors_duplicat... | python |
from setuptools import setup
from distutils.util import convert_path
# Additional keyword arguments for setup
kwargs = {}
d = {}
execfile(convert_path('cinspect/__init__.py'), d)
kwargs['version'] = d['__version__']
with open('README.md') as f:
kwargs['long_description'] = f.read()
packages = [
'cinspect',... | python |
# 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
# distributed under t... | python |
import typing as _t
from django.contrib.auth import get_user_model, update_session_auth_hash
from django.contrib.auth.password_validation import validate_password
from django.contrib.auth.models import AbstractUser
from django.db import transaction
from django_filters import BooleanFilter, CharFilter
from rest_framewo... | python |
from utils import *
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
train_X = get_attributes('train_binary.csv')
train_Y = get_classes('train_binary.csv')
test_X = get_attributes('test_binary.csv')
test_Y = get_classes('... | python |
"""This file contains functions to handle /delete_webhook command."""
from aiohttp import web
from jinja2 import Environment
from webhook_telegram_bot.database.backends.types import DatabaseWrapperImpl
from webhook_telegram_bot.database.exceptions import ChatNotFound
from webhook_telegram_bot.database.models import Ch... | python |
from ..estimators.estimator_base import H2OEstimator
from h2o.utils.typechecks import Enum
from h2o.utils.typechecks import assert_is_type
class H2OPCA(H2OEstimator):
"""
Principal Component Analysis
"""
algo = "pca"
def __init__(self, model_id=None, k=None, max_iterations=None, seed=None,
... | python |
#!/usr/bin/env python
import os
import sys
from django.conf import settings
import django
DIRNAME = os.path.dirname(__file__)
settings.configure(DEBUG=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
... | python |
# -*- coding: utf-8 -*-
N = int(input())
numbers = list(map(int, input().split()))
print("Menor valor: %d" % min(numbers))
print("Posicao: %d" % (numbers.index(min(numbers)))) | python |
#!/usr/bin/python
"""
* Copyright 2015 Alibaba Group Holding Limited
*
* 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 req... | python |
#! /usr/bin/env python3
import rospy
from sensor_msgs.msg import PointCloud2
import pcl
import pcl_helper
def do_euclidian_clustering(cloud):
# Euclidean Clustering
white_cloud = pcl_helper.XYZRGB_to_XYZ(cloud) # <type 'pcl._pcl.PointCloud'>
tree = white_cloud.make_kdtree() # <type 'pcl._pcl.KdTree'>
ec ... | python |
# -*- coding: utf-8 -*-
#/*
# * Copyright (c) 2022 Renwei
# *
# * This is a free software; you can redistribute it and/or modify
# * it under the terms of the MIT license. See LICENSE for details.
# */
import pickle
# =====================================================================
def t_class_save(file_path, ... | python |
# Copyright 2020 Xilinx 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 writing, ... | python |
# Copyright (c) 2022 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@opencyphal.org>
from __future__ import annotations
import asyncio
import time
from typing import Any
import json
import tempfile
from pathlib import Path
from pprint import pprint
import p... | python |
from .mesh_adv_dataset import MeshAdversarialDataset
from .mesh_h36m_dataset import MeshH36MDataset
from .mesh_mix_dataset import MeshMixDataset
from .mosh_dataset import MoshDataset
__all__ = [
'MeshH36MDataset', 'MoshDataset', 'MeshMixDataset',
'MeshAdversarialDataset'
]
| python |
import numpy as np
from matplotlib.testing.decorators import image_comparison
import matplotlib.pyplot as plt
import matplotlib.patheffects as path_effects
from matplotlib.path import Path
import matplotlib.patches as patches
@image_comparison(['patheffect1'], remove_text=True)
def test_patheffect1():
... | python |
import sys
import irefindex_parser
reload(irefindex_parser)
from irefindex_parser import *
import metrics_nx
reload(metrics_nx)
from metrics_nx import *
try:
import metrics_gt
reload(metrics_gt)
except ImportError:
sys.stderr.write("[warning] Cannot import graph_tool\n")
| python |
import asyncio
import logging
import re
import time
import traceback
from musicbot import _func_, _get_variable, exceptions, factory
from musicbot.bot import MusicBot
from musicbot.constructs import Response
from musicbot.opus_loader import load_opus_lib
from musicbot.utils import fixg, ftimedelta
load_opus_lib()
log... | python |
def const_ver():
return "v8.0"
def is_gpvdm_next():
return False
| python |
from setuptools import setup, find_packages
import codecs
import os
import re
import sys
here = os.path.abspath(os.path.dirname(__file__))
min_requires = [
"pycarol>=2.45.0" ,
"pandas"
]
extras_require = {
}
extras_require["complete"] = sorted(
{v for req in extras_require.values() for v in req}
)
d... | python |
from MeioDeTransporte import MeioDeTransporte
class Aereo(MeioDeTransporte):
def __init__(self, numAsa):
super()
self.__numAsa = numAsa
#Geters e Seters
#*******************************#
def get_numAsas(self):
return self.__numAsa
def set_numAsas(self, num:int):
self.__numAsa =... | python |
import os
from unittest import TestCase
from xml.etree import ElementTree as ET
from xam import Addon
try:
from collections import OrderedDict
except ImportError:
from collective.ordereddict import OrderedDict
class TestAddon(TestCase):
def assert_attrs(self, obj, attrs):
for attr_name, expected_... | python |
import modi
import time
"""
Example script for the usage of dial module
Make sure you connect 1 dial module and 1 speaker module to your network module
"""
if __name__ == "__main__":
bundle = modi.MODI()
dial = bundle.dials[0]
speak = bundle.speakers[0]
while True:
speak.tune = 800, dial.degr... | python |
# DS3231 library for micropython
# tested on ESP8266
#
# Author: Sebastian Maerker
# License: mit
#
# only 24h mode is supported
#
# features:
# - set time
# - read time
# - set alarms
import machine
from math import floor
i2cAddr = 0x68 # change I2C Address here if neccessary
class DS3231:
def _... | python |
# -*- coding: utf-8 -*-
"""
module.name
~~~~~~~~~~~~~~~
Preamble...
"""
from __future__ import absolute_import, print_function, unicode_literals
# TEST SETTINGS
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
# Django replaces this, but it still wants it. *shrugs*
DATABASES = {
'default': {
... | python |
"""
Copyright 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
Module to hold helper classes and functions to determine run-time test IP
information. Currently,
"""
import flogging
import ipaddress
import netifaces
import socket
import fit_common
logs = flogging.get_loggers()
class TestHostInterfacer(objec... | python |
import sqlite3 as lite
import datetime
import json
from time import *
class Database:
con = None
cur = None
def __init__(self, dbname):
self.con = lite.connect(dbname + ".db")
self.cur = self.con.cursor()
def createIfNotExists(self):
self.cur.execute("CREATE TABLE if not exi... | python |
import os
import uuid
import time
from aim.engine.aim_repo import AimRepo
def init(overwrite=False):
# Init repo if doesn't exist and return repo instance
repo = AimRepo.get_working_repo()
if not repo:
repo = AimRepo(os.getcwd())
repo.init()
# Check if repo index is empty or not
... | python |
from datetime import date
from django import forms
from django.core.exceptions import ValidationError
from petstagram.common.helps import BootstrapFormMixin, DisabledFieldsFormMixin
from petstagram.main.models import Pet
class CreatePetForm(BootstrapFormMixin, forms.ModelForm):
def __init__(self, user, *args, *... | python |
# grid relative
from .environment_manager import EnvironmentManager
from .group_manager import GroupManager
from .user_manager import UserManager
| python |
# Copyright 2017 BBVA
#
# 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, softwar... | python |
from yunorm.db import models
from yunorm.db import field
CE_DB = {
'host': '10.x.x.x',
'port': 3306,
'user': 'root',
'password': '123456',
'database': 'ce',
'charset': 'utf8mb4',
'pool_size': 10,
}
class Feed(models.Model):
url = field.CharField()
name = field.CharField()
desc... | python |
from .. import db
class Email(db.Model):
""" Email Model for storing contact emails """
__tablename__ = 'email'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
email = db.Column(db.String(100), unique=True)
contact_id = db.Column(db.Integer, db.ForeignKey('contact.id'))
... | python |
# Generated by Django 3.2.8 on 2021-11-09 18:34
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('blog', '0003_auto_202111... | python |
from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField, SubmitField, SelectField, HiddenField
from wtforms.validators import DataRequired, Length, Required, Email
class QuestionForm(FlaskForm):
"""Question form."""
products = [
('learn-ultra', 'Blackboard Learn Ultra'),
... | python |
"""Common constants used in Agtor."""
# volume
ML_to_mm = 100.0
mm_to_ML = 100.0
# distance
km_to_ha = 100.0
ha_to_km = 100.0
# time
SEC_IN_DAY = 86400.0
# amount
MILLION = 1e6
ML = 1e6 # Litres in a megaliter
| python |
import random
from pylons.i18n import set_lang
import sqlalchemy.exc
import ckan.logic
import ckan.lib.maintain as maintain
from ckan.lib.search import SearchError
from ckan.lib.base import *
from ckan.lib.helpers import url_for
CACHE_PARAMETER = '__cache'
class HomeController(BaseController):
repo = model.rep... | python |
##########################################################################
#
# Copyright 2012 Jose Fonseca
# 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 the Software without res... | python |
# -*- coding: utf-8 -*-
import json
import shutil
import sys
from copy import deepcopy
from pathlib import Path
import pytest
import requests
from micropy import config, main, project
@pytest.fixture
def mock_requests(mocker, requests_mock, test_archive):
mock_source = {
"name": "Micropy Stubs",
... | python |
import os
def get_records(base_url,
http_get,
data_record,
target,
from_ = '-1min',
until_ = None,
http_connect_timeout_s_ = 0.1,
http_read_timeout_s_ = 1.0):
url = ... | python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('entity', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='EntityActivationEvent',
fie... | python |
# -*- coding: utf-8 -*-
# @Time: 2020/7/2 11:50
# @Author: GraceKoo
# @File: interview_31.py
# @Desc: https://leetcode-cn.com/problems/1nzheng-shu-zhong-1chu-xian-de-ci-shu-lcof/
class Solution:
def countDigitOne(self, n: int) -> int:
s = ""
while n:
s += str(n)
n -= 1
... | python |
import time
from datetime import datetime, timedelta
import mysql.connector
from openpyxl import load_workbook
from decimal import Decimal
import config
################################################################################################################
# PROCEDURES:
# STEP 1: get all 'new' offline meter f... | python |
# -*- coding: utf-8 -*-
description = 'ZEA-2 counter card setup'
group = 'optional'
tango_base = 'tango://phys.dns.frm2:10000/dns/'
devices = dict(
timer = device('nicos_mlz.jcns.devices.fpga_new.FPGATimerChannel',
description = 'Acquisition time',
tangodevice = tango_base + 'count/timer',
),... | python |
import numpy as np
import coveval.core.losses as losses
def test_normal_scaled():
"""
Asserts that the normalised loss is the same for different `(y_true, y_pred)` where the ratio
`(y_true-y_pred)/y_pred` is constant.
"""
# using default values
ns = losses.normal_scaled()
v1 = ns.comp... | python |
import pygame
screen_x_max = 240
screen_y_max = 320
# colors
RED = pygame.Color(255, 0, 0)
GREEN = pygame.Color(0, 255, 0)
BLUE = pygame.Color(0, 0, 255)
WHITE = pygame.Color(255, 255, 255)
BLACK = pygame.Color(0, 0, 0)
GRAY = pygame.Color(39, 37, 37)
LIGHT_GRAY = pygame.Color(130, 100, 100)
# path to pifidelity
pif... | python |
from .base_public import *
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}
SITE_URL = "http://test.com"
| python |
from project.appliances.fridge import Fridge
from project.appliances.stove import Stove
from project.appliances.tv import TV
from project.rooms.room import Room
class OldCouple(Room):
def __init__(self, family_name: str, pension_one: float, pension_two: float):
super().__init__(family_name, (pension_one +... | python |
""" wxyz top-level automation
this should be executed from within an environment created from
the .github/locks/conda.*.lock appropriate for your platform. See CONTRIBUTING.md.
"""
import json
import os
# pylint: disable=expression-not-assigned,W0511,too-many-lines
import shutil
import subprocess
import time
... | python |
class Cell:
def __init__(self):
'''
Initializes all cells as 'Dead'.
Can set the state with accompanying functions.
'''
self.status = 'Dead'
def set_dead(self):
'''
Sets <i>this</i> cell as dead.
'''
self.status = 'Dead'
def set_alive... | python |
class NesteggException(Exception): pass
def first(it) :
try :
return next(it)
except StopIteration :
return None
| python |
from typing import List, Optional
import torch
from torch import Tensor
from tha2.nn.backbone.poser_encoder_decoder_00 import PoserEncoderDecoder00Args, PoserEncoderDecoder00
from tha2.nn.util import apply_color_change, apply_grid_change, apply_rgb_change
from tha2.nn.batch_module.batch_input_module import Bat... | python |
a = str(input('digite seu nome completo: ')).strip().lower()
print('seu nome tem silva ? {}'.format('silva' in a))
| python |
import math
from typing import List
class Solution:
def threeSumClosest(self, nums: List[int], target: int) -> int:
# sort the array first
nums.sort()
triplet, min_diff = 0, math.inf
for i in range(len(nums) - 3 + 1):
# skip the same elements to a... | python |
"""
================
DBus wire format
================
This module de/serialize objects from/to dbus wire format.
The spec for this code can be found here:
- https://dbus.freedesktop.org/doc/dbus-specification.html
- https://github.com/GNOME/glib/blob/master/gio/gdbusmessage.c
But if you are like me that prefer some... | python |
from collections import deque
working_bees = deque([int(el) for el in input().split()])
nectar_to_collect = [int(el) for el in input().split()]
honey_process = deque(input().split())
total_honey_collect = 0
def get_honey_value(bee, honey, symbol):
if symbol == "+":
result = bee + honey
elif symbol... | python |
"""Module contains http hmac request, supports HTTP persistent connection."""
import httphmac
import requests
class HttpRequest(httphmac.Request):
"""Class to represent HTTP keep-alive hmac Request."""
_session = None
def __init__(self):
"""Initialize HTTP Request object with requests.Session."... | python |
# @lc app=leetcode id=174 lang=python3
#
# [174] Dungeon Game
#
# https://leetcode.com/problems/dungeon-game/description/
#
# algorithms
# Hard (33.61%)
# Likes: 2439
# Dislikes: 50
# Total Accepted: 128.5K
# Total Submissions: 381.5K
# Testcase Example: '[[-2,-3,3],[-5,-10,1],[10,30,-5]]'
#
# The demons had cap... | python |
import csv
import numpy as np
import tensorflow as tf
import cv2
import os
#import keras
#print(keras.__version__)
#print(tf.__version__)
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Flatten, Dropout
from keras.layers import Conv2D
from keras.utils import to_categorical
from ... | python |
import pickle
import gzip
import threading
def dump(object, filename, protocol=0, compresslevel=1, async=False):
"""Saves a compressed object to disk
"""
def run():
file = gzip.GzipFile(filename, 'wb', compresslevel=compresslevel)
pickle_dump = pickle.dumps(object, protocol=protocol)
... | python |
# Lint as: python3
# 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 ... | python |
"""Controller for ingest and parsing of character files"""
import logging
import re
from configparser import ConfigParser
from pathlib import Path
class CharfileIngest:
HEADER_PATTERN = r"\bLocation\sName\sID\sCount\sSlots\b"
ROW_PATTERN = r"^.*?\s.*?\s[0-9]*?\s[0-9]*?\s[0-9]*?$"
def __init__(self, confi... | python |
#!/usr/bin/env python
# Copyright 2021 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... | python |
import glob
import os
import pytest
import motor.motor_asyncio as motor
# We can either be on the host or in the docker-compose network
def pytest_addoption(parser):
parser.addoption(
"--in-docker-compose",
action="store",
default="",
help="Assume inside a docker network",
)
... | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.