text stringlengths 2 999k |
|---|
#!/usr/bin/env python3
# https://codeforces.com/problemset/problem/931/A
a = int(input())
b = int(input())
d = a-b if a>b else b-a
n = d//2
c = 0 if d%2==0 else n+1
for i in range(1,n+1):
c += (i<<1)
print(c)
|
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, modify, merge, publish,
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This module contains the class Grapher to graph ddos simulations"""
__Lisence__ = "BSD"
__maintainer__ = "Justin Furuness"
__email__ = "jfuruness@gmail.com, agorbenko97@gmail.com"
__status__ = "Development"
import os
import matplotlib.pyplot as plt
from ..base_grap... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core import models
from recipe import serializers
INGREDIENT_URL = reverse('recipe:ingredient-list')
class PublicIngredient... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: release-1.15
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class V1bet... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Exercise the createmultisig API
from test_framework.test_framework import BitcoinTestFramework
from te... |
"""
ASGI config for kentest project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault(... |
from dmp.msg import DMPData
from dmp_utils import RequestDMP, PlanDMP
from geometry_msgs.msg import PoseArray
from sensor_msgs.msg import JointState
from tf_conversions import posemath as pm
import numpy as np
import PyKDL as kdl
import yaml
try:
from yaml import CLoader as Loader, CDumper as Dumper
except Impor... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 Intel Corporation
#
# 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... |
# -*- coding: utf-8 -*-
#
# SPDX-License-Identifier: Apache-2.0
#
# hyperledger-fabricdocs documentation build configuration file, created by
# sphinx-quickstart on Mon Feb 20 16:11:53 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration... |
#!/user/bin/python
# -*- coding: utf-8 -*-
"""
dict
Python内置了字典:dict的支持,dict全称dictionary,在其他语言中也称为map,
使用键-值(key-value)存储,具有极快的查找速度
dict有以下几个特点:
1.查找和插入的速度极快,不会随着key的增加而变慢;
2.需要占用大量的内存,内存浪费多。
3.dict是用空间来换取时间的一种方法。
set
set和dict类似,也是一组key的集合,但不存... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import ast
import json
import sys
class Visitor(ast.NodeTransformer):
def __init__(self):
# Note: This doesnt have a missed call to super(). Neither superclass defines one!
self.symbols = {"classes": [],... |
import _init_paths
|
import gym
gym.logger.set_level(40) # hide warnings
import time
import numpy as np
import copy
import math
import os
import psutil
import signal
import sys
import transforms3d as tf3d
from gym import utils, spaces
from gym_gazebo2.utils import ut_generic, ut_launch, ut_mara, ut_math, ut_gazebo, tree_urdf, general_utils... |
#!/usr/bin/env python
#
# Copyright (c) 2016-2017 Nest Labs, 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/lice... |
'''
Clean-up deployed aws resources
'''
import os
import sys
import traceback
import cloudformation as cfn
import keypair
from cloudformation import load_yaml_file # pylint: disable=no-name-in-module
print('Loading teardown function ....')
def main(configs):
'''
clean-up deployed stacks
'''
setup_dat... |
# 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 MiopenOpencl(CMakePackage):
"""AMD's library for high performance machine learning primit... |
"""Pre-process hazard data
Purpose
-------
Convert GeoTiff raster hazard datasets to shapefiles based on masking and selecting values from
- Single-band raster files
Input data requirements
-----------------------
1. Correct paths to all hazard datasets
2. Single-band GeoTiff hazard raster files with:
- val... |
import sentimentAnalysis as sa
import tkinter as tk
from tkinter import scrolledtext
from tkinter.ttk import Frame, Label, Entry
from PIL import Image, ImageTk
count_pos = 0
count_neg = 0
total = 0
LARGE_FONT = ("Verdana", 12)
class MovieReview(tk.Tk):
def __init__(self, *args, **kwargs):
... |
import os
import requests
from datetime import datetime
import gspread
from oauth2client.service_account import ServiceAccountCredentials
# You can find more crypto assets here: https://messari.io/
CRYPTO = os.getenv('CRYPTO', 'BTC') # If not provided, let's collect Bitcoin by default
JSON_KEYFILE = os.getenv('JSON... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
import os
import lyricsgenius
from userbot.events import register
from userbot import (CMD_HELP, GENIUS, lastfm, LAST... |
class Solution:
def maxAreaOfIsland(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
cnt = 0
def traverse(i, j):
nonlocal grid
if grid[i][j] == 0:
return 0
# make it 0
grid[i][j] = 0
... |
from dbnd._core.current import get_databand_context
from dbnd.api.shared_schemas.airflow_monitor import AirflowServerInfoSchema
def list_synced_airflow_instances():
endpoint = "airflow_monitor"
schema = AirflowServerInfoSchema(strict=False)
client = get_databand_context().databand_api_client
response ... |
def fence(original, wrapper):
result = wrapper + original + wrapper
return result
|
import os
hosturl = os.environ.get('HOSTURL')
from lightserv import create_app
from lightserv.config import DevConfig,ProdConfig
import socket
flask_mode = os.environ['FLASK_MODE']
if flask_mode == 'PROD':
app = create_app(ProdConfig)
elif flask_mode == 'DEV':
app = create_app(DevConfig)
if __name__ == '__main__':
... |
import pytest
from invest import helpers
@pytest.mark.parametrize('path,expected_prefix', (
('es/industries/foo/', 'es'),
('zh-hans/industries/', 'zh-hans'),
('de/industries/aerospace/bar/', 'de'),
('fr/industries/free-foods/', 'fr'),
))
def test_get_language_from_prefix(path, expected_prefix):
p... |
import torch
from tonic import replays # noqa
from tonic.torch import agents, models, normalizers, updaters
def default_model():
return models.ActorCriticWithTargets(
actor=models.Actor(
encoder=models.ObservationEncoder(),
torso=models.MLP((256, 256), torch.nn.ReLU),
... |
#
# @lc app=leetcode id=795 lang=python3
#
# [795] Number of Subarrays with Bounded Maximum
#
# https://leetcode.com/problems/number-of-subarrays-with-bounded-maximum/description/
#
# algorithms
# Medium (48.43%)
# Likes: 1143
# Dislikes: 78
# Total Accepted: 40.2K
# Total Submissions: 77.7K
# Testcase Example: ... |
# Copyright (c) 2013 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 writi... |
NODE_ID_SIZE = 8
FROM_NODE_ID_OFFSET = 4
TO_NODE_ID_OFFSET = 12
MSG_ID_SIZE = 8
MSG_ID_OFFSET = 20
class Signal:
def __init__(self, name, offset, size, display_type="Hex", endianness="little"):
self.name = name
self.offset = offset
self.size = size
self.endianness = endianness
... |
""" Python character mapping codec test
This uses the test codec in testcodec.py and thus also tests the
encodings package lookup scheme.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright 2000 Guido van Rossum.
"""#"
import test.test_support, unittest
# test codec's full path name (see test/testcodec... |
#!/usr/bin/env python3
"""
Dynamic bicycle model from "The Science of Vehicle Dynamics (2014), M. Guiggiani"
The state is x = [v, r]^T
with v lateral speed [m/s], and r rotational speed [rad/s]
The input u is the steering angle [rad]
The system is defined by
x_dot = A*x + B*u
A depends on longitudinal speed, u [m/s... |
import unittest
from tabcmd.commands.extracts.reencrypt_extracts_command import ReencryptExtracts
from .common_setup import *
commandname = "reencryptextracts"
class ReencryptExtractsParserTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.parser_under_test = initialize_test_pieces(comma... |
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
import fnmatch
import glob
import os
import shutil
import zipfile
from no_drama.context import temp_directory
from no_drama.pip_automation import save_wheels
def inject_configuration(cli_args):
with temp_directory() as staging_dir:
build_zip_path = os.path.join(staging_dir, 'build.zip')
shutil.c... |
# import os
# import shutil
#
# import pytest
#
#
# @pytest.fixture
# def td_tmpdir(request, tmpdir, monkeypatch):
# """Copy test data into the temporary directory for tests.
#
# Note:
# 1) Test data is located by convention. Create a directory with the same name as
# the test file (test-file: t... |
from consts import *
class Time:
def __init__(self, date, time_in_day):
self.date = date
self.time_in_day = time_in_day
def __str__(self):
return f"{self.date} {self.time_in_day}"
class Traveler:
def __init__(self, name, is_child):
self.name = name
self.is_child =... |
import ctypes
import pyrect
from ctypes import wintypes # We can't use ctypes.wintypes, we must import wintypes this way.
import pygetwindow
NULL = 0 # Used to match the Win32 API value of "null".
# These FORMAT_MESSAGE_ constants are used for FormatMesage() and are
# documented at https://docs.microsoft.com/en-us/w... |
import numpy
def integer_to_edge_condition( k ):
"""Given a pattern id k, return left, middle, and right conditions
Args:
k (int): pattern id
Returns:
(Lcond, Mcond, Rcond) a tuple of three functions.
"""
assert k < 63, "Input k = {} must be < 63.".format(k)
bdigs = [ int(bit... |
"""
LineSegment stores one labeled segment of text.
a reference to the entire line and indices for slicing are stored.
Each LineSegment object has a flag 'hideFlag' that stores whether
the segment should appear in the output or not.
According to Python, the segment spans the text [fromPos,toPos) of line
"""
# LineSegm... |
# Copyright 2013-2020 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 RCommonmark(RPackage):
"""commonmark: CommonMark and Github Markdown Rendering in R"""
... |
"""
I Shrunk me Molecule!
A module to shrink a molecule/ligand during MD simulations in OpenMM
"""
# Add imports here
from .mol_shrink_ray import *
# Handle versioneer
from ._version import get_versions
versions = get_versions()
__version__ = versions['version']
__git_revision__ = versions['full-revisionid']
del get_... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.14.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... |
# Python wrapper for the rpi_ws281x library.
# Author: Tony DiCola (tony@tonydicola.com)
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages, Extension
setup(name = 'rpi_ws281x',
version = '1.0.0',
author = 'Jeremy Garff',
... |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, modify, merge, publish,
... |
# Copyright 2021 Tomoki Hayashi
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""HiFi-GAN Modules.
This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN.
"""
import copy
import logging
from typing import Any
from typing import Dict
from typing import List
from typing import Option... |
import random
quotes = [
("web2py was the life saver today for me, my blog post: Standalone Usage of web2py's", "caglartoklu", "http://twitter.com/#!/caglartoklu/status/84292131707031553"),
("Get Things Done - Faster, Better and More Easily with web2py",
"Bruno Rocha", "http://twitter.com/#!/r... |
"""Nrpe helpers module."""
import json
import logging
import glob
import os
from ops.model import RelationData, RelationNotFoundError
import socket
import subprocess
import yaml
logger = logging.getLogger(__name__)
class InvalidCustomCheckException(Exception):
"""Custom exception for Invalid nrpe check."""
... |
class Grafo(object):
__slots__ = ['__graph_dict']
def __init__(self):
""" initializes a graph object
If no dictionary or None is given,
an empty dictionary will be used
"""
self.__graph_dict = {}
def vertices(self):
""" returns the vertices of a g... |
from collections import namedtuple
from enum import Enum
from dagster import check
from dagster.core.definitions import ExpectationResult, Materialization, SolidHandle, TypeCheck
from dagster.core.log_manager import DagsterLogManager
from dagster.utils.error import SerializableErrorInfo
class DagsterEventType(Enum):... |
"""This module defines class Energy."""
import numpy as np
import brave.common as common
from brave.kpoint import Kpoint
class Energy(Kpoint):
"""Class for representing the energy bands.
Class Energy defines the electron or phonon energy bands. It is used for
plotting the energy band diagrams in class D... |
import os
from os.path import dirname
import tempfile
import pytest
import src.superannotate as sa
from src.superannotate.lib.app.exceptions import AppException
from tests.integration.base import BaseTestCase
class TestInterface(BaseTestCase):
PROJECT_NAME = "Interface test"
TEST_FOLDER_PATH = "sample_projec... |
# Copyright 2018 Red Hat
#
# 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, softw... |
import json
class BaseExchangeEmailService(object):
"""
The base service for emails
"""
def __init__(self, service, folder_id):
self.service = service
self.folder_id = folder_id
def get_email(self, email_id):
raise NotImplementedError
def list_emails(self):
rai... |
import os
import sys
import shutil
import numpy as np
import json
import pickle
import argparse
from cruw import CRUW
from cruw.annotation.init_json import init_meta_json
from cruw.mapping import ra2idx
from rodnet.core.confidence_map import generate_confmap, normalize_confmap, add_noise_channel
from rodnet.utils.loa... |
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt, cos, sin, pi, copysign
from time import clock
from copy import deepcopy
class Blob:
def __init__(self,x,y,r):
self.x = x
self.y = y
self.r = r
self.path = [(x,y)]
def addToPath(self,nx,ny):
... |
from typing import Any
from argparse import ArgumentParser
import os
import shutil
import subprocess
import tempfile
import ujson
from zerver.lib.export import do_export_user
from zerver.lib.management import ZulipBaseCommand
class Command(ZulipBaseCommand):
help = """Exports message data from a Zulip user
... |
import torch.nn as nn
class Actor(nn.Module):
"""Actor neural network.
Parameters
----------
nn : class
Torch neural network class
Returns
-------
array 1-D
An array containing the action for a given state
"""
def __init__(self, n_states, n_actions, config):
... |
#
# Copyright 2016 F5 Networks Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# An... |
from aiohttp import web
from aiohttp.web_response import ContentCoding
from functools import wraps
COMPRESS_FASTEST = 1
BASE_STRING_SIZE = 49
MTU_TCP_PACKET_SIZE = 1500
COMPRESS_THRESHOLD = MTU_TCP_PACKET_SIZE + BASE_STRING_SIZE
def json_response(func):
""" @json_response decorator adds header and dumps response objec... |
import locale
import platform
import re
import sys
import uuid
from datetime import datetime
from time import mktime
from .._compat import PY2, pjoin
from .base import SQLAdapter
from . import adapters
@adapters.register_for("sqlite", "sqlite:memory")
class SQLite(SQLAdapter):
dbengine = "sqlite"
drivers = ("... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
# swift_build_support/products/foundation.py ---------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.t... |
from ms_deisotope.utils import Base
from weakref import WeakValueDictionary
class ScanStub(object):
"""A stub for holding precursor information and
giving a Scan-like interface for accessing just that
information. Provides a serialized-like interface
which clients can use to load the real scan.
A... |
# ======================================================================
# Perfectly Spherical Houses in a Vacuum
# Advent of Code 2015 Day 03 -- Eric Wastl -- https://adventofcode.com
#
# Python implementation by Dr. Dean Earl Wright III
# ======================================================================
# ===... |
"""
WSGI config for django_gumroad project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICA... |
"""Vertices in Voronoi Diagram."""
# Standard Library
from typing import List, Any, Optional
from xml.etree import ElementTree as ET
# Models
from .points import Point
from .edges import Edge
class Vertex:
"""Vertex representation in the Voronoi diagram."""
point: Point
edges: List[Edge]
def __ini... |
# -*- coding: utf-8 -*-
"""
Exceptions classes for spines.
"""
#
# Imports
#
from .core.base import BaseObjectException
#
# Exceptions
#
class ModelException(BaseObjectException):
"""
Base class for Model exceptions.
"""
pass
|
from collections import defaultdict
from contextlib import contextmanager
import theano
from theano import tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from theano.tensor.signal import pool
from theano.printing import Print
try:
import theano.sparse as th_sparse_module
except Im... |
import pytest
from nx_work_log.minute_timer import MinuteTimer
@pytest.fixture()
def minute_timer(minute_timer_callback):
minute_timer = MinuteTimer(minute_timer_callback)
yield minute_timer
minute_timer.cancel()
|
from compressor.conf import settings
from compressor.base import Compressor, SOURCE_HUNK, SOURCE_FILE
class JsCompressor(Compressor):
output_mimetypes = {'text/javascript'}
def split_contents(self):
if self.split_content:
return self.split_content
self.extra_nodes = []
fo... |
#!/usr/bin/python
# Coding: UTF-8
import unittest
import numpy as np
from PyEMD import EMD
from PyEMD.splines import *
class IMFTest(unittest.TestCase):
"""
Since these tests depend heavily on NumPy & SciPy,
make sure you have NumPy >= 1.12 and SciPy >= 0.19.
"""
def test_unsu... |
# coding: utf-8
import os
import click
from corecli.cli.utils import error, info, get_commit_hash, get_remote_url
def _get_repo(repo):
ctx = click.get_current_context()
repo = repo or get_remote_url(remote=ctx.obj['remotename'])
return repo
def _get_sha(sha):
sha = sha or get_commit_hash()
if ... |
import os
from signal import default_int_handler
import hydra
import omegaconf
import pytest
import pytorch_lightning as pl
from opensentiment.data.make_dataset import get_datasets, inital_cache_dataset
from opensentiment.utils import get_project_root, return_omegaconf_modified
@pytest.mark.skip
def test_make_datas... |
# Copyright 2021 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.
import argparse
import sys
assert sys.version_info[0] == 3
from blinkpy.web_tests.stale_expectation_removal import builders
from blinkpy.web_tests.stale_ex... |
import random
nome = str('Mega sena')
lista = list()
print('-='*15)
print(f' \033[7;34m{nome}\033[m')
print('-='*15)
njogos = int(input('Deseja gerar quantos jogos?: '))
for i in range(0,njogos):
for j in range(0,7):
lista.append(random.randint(1,60))
print(f'{i+1}ª JOGO: {lista}')
lista.cle... |
import time
start = time.time()
def isPythagoreanTriplet(a, b, c):
if a ** 2 + b ** 2 == c ** 2:
return True
return False
def checkPythagoreanTriplet():
for a in range(1, 1000):
for b in range(a, 1000 - a):
for c in range(b, 1000 - b):
if a + b + c == 1000:
... |
"""
jinja2-cli
==========
License: BSD, see LICENSE for more details.
"""
import warnings
warnings.filterwarnings("ignore")
import os
import sys
from optparse import Option, OptionParser
sys.path.insert(0, os.getcwd())
PY3 = sys.version_info[0] == 3
if PY3:
text_type = str
bytes_type = bytes
else:
te... |
#!/usr/bin/env python
from preprocessor import process
from collector import capture
from PIL import Image
import numpy as np
import pickle
import random
from subprocess import check_output, call
import glob
import os
def main():
print "\nWelcome to the Neural Network Guessing Game!"
random_int = random.ran... |
import cv2
import numpy as np
class Yolo_opencv:
def __init__(self):
self.pathweight = "/home/duongnh/Documents/TPA/checkpoint/yolov3-tiny_3l_last.weights"
self.pathcfg = "/home/duongnh/Documents/TPA/checkpoint/yolov3-tiny_3l.cfg"
self.pathnames = "/home/duongnh/Documents/TPA/checkpoint/... |
# Copyright 2021 The Scenic 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 in w... |
import tkinter
#main frame
root = tkinter.Tk()
root.geometry('400x400+3200+100')
root.wm_title('meu primeiro programa')
#list box #frame
commentsframe = tkinter.LabelFrame('ro')
#start app
root.mainloop()
|
import os
# toolchains options
ARCH = 'arm'
CPU = 'cortex-m0'
CROSS_TOOL = 'keil'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('OS_CC'):
CROSS_TOOL = os.getenv('OS_CC')
if os.getenv('OS_ROOT'):
OS_ROOT = os.getenv('OS_ROOT')
# cross_tool provides the cross compiler
# COMPILER_PATH is t... |
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.15.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea_api.configuration import Configuration
clas... |
import sys
import numpy as np
from utils import read_json, dump_json
def join_bbox(bbox1, bbox2):
x1_t, y1_t, x2_t, y2_t = bbox1[0], bbox1[1], bbox1[2]+bbox1[0], bbox1[3]+bbox1[1]
x1_p, y1_p, x2_p, y2_p = bbox2[0], bbox2[1], bbox2[2]+bbox2[0], bbox2[3]+bbox2[1]
# x1_n = max(x1_t, x1_p)
# y1_n = max(y1_t... |
# author: github/zabir-nabil
# relevant imports
import os
import cv2
import pydicom
import pandas as pd
import numpy as np
# import tensorflow as tf
# import matplotlib.pyplot as plt
# torch dataset
import torch
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import ra... |
import os
from ravager.services.aria import aria2c
from ravager.helpers.humanize import humanize
from ravager.celery_tasks.tasks import app
from ravager.database.tasks import Tasks
from ravager.database.helpers.structs import OpsDataStruct
from ravager.config import TIMEZONE
from telegram import Bot
from datetime impo... |
from . import ctng
from . import scalarField
import numpy
from .surfaces import chunkify
_max_chunks = 10000000
def voxelize(
source,
dx=0.25,
xlo=None,
xhi=None,
ylo=None,
yhi=None,
zlo=None,
zhi=None,
n_soma_step=100,
):
"""
Generates a cartesian mesh of the volume of a ... |
"""
utils.py
Copyright 2006 Andres Riancho
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed in the hope that it wi... |
from netpyne import specs
#------------------------------------------------------------------------------
#
# SIMULATION CONFIGURATION
#
#------------------------------------------------------------------------------
# Run parameters
cfg = specs.SimConfig() # object of class cfg to store simulation configuratio... |
import pathlib
import typing
import jinja2
from loguru import logger
def set_up_template_env(path: typing.Union[str, pathlib.Path]) -> jinja2.Environment:
"""Set up a jinja2 template environment based on a path
Parameters
----------
path : typing.Union[str, pathlib.Path]
path
Returns
... |
"""
Implements the provider side Prometheus Manual relation for the
Operator Framework.
Submits a job request to prometheus with the following format:
{
"job_name": ...
"job_data": {
"static_configs":[{
"targets": # list of targets
labels: # dict of key: value for custom label... |
def test_image_ok_1_gif(style_checker):
"""Run checker against image-ok-1.gif
"""
p = style_checker.run_style_checker('gnat', 'image-ok-1.gif')
style_checker.assertEqual(p.status, 0, p.image)
style_checker.assertRunOutputEmpty(p)
def test_image_ok_2_jpg(style_checker):
"""Run checker against i... |
from __future__ import absolute_import
# Copyright (c) 2010-2019 openpyexcel
from openpyexcel.descriptors.serialisable import Serialisable
from openpyexcel.descriptors import (
Typed,
Alias,
)
from openpyexcel.descriptors.excel import(
ExtensionList,
_explicit_none,
)
from openpyexcel.descriptors.nes... |
from enum import Enum
class Severity(Enum):
debug = 'DEBUG'
info = 'INFO'
warning = 'WARNING'
error = 'ERROR' |
import argparse
import json
import multiprocessing
from functools import partial
import datasets
from datasets import load_dataset
from tqdm import tqdm
def get_size_per_example(texts):
size_values = [len(text.encode()) for text in texts]
examples = {"bytes_len": size_values}
return examples
def get_size... |
# for n in range(400,500):
# i = n // 100
# j = n // 10 % 10
# k = n % 10
# if n == i ** 3 + j ** 3 + k ** 3:
# print(n)
# 第一道题(16)
# input("请输入(第一次):")
# s1 = input("请输入(第二次):")
# l1 = s1.split(' ')
# l2 = []
# for i in l1:
# if i.isdigit():
# l2.append(int(i))
# for i in l2:
# ... |
from compare.comparer import OUTPUT_FILE_NAME, FileComparer
from compare.file import File
from compare.models import FileContent
TEST_DATA1 = "12345,description\n"
TEST_DATA2 = "67890,description\n"
TEST_DATA3 = "23451,description\n"
TEST_HASH1 = "a587b9ca9c40faade4d867e6a72109fc38312d45"
TEST_HASH2 = "65c26c9c3d3cf8... |
import inspect
from Queue import Queue
from threading import *
from task import task_logger
from timers import *
class AsyncTask(object):
"""
run <thread_function> in a new thread it until it ends or has run for longer than <timeout> seconds.
If <callback> is provided, it will be executed when the task ... |
# rewritten by @saravanakrish
from telethon import events
from datetime import datetime
from userbot import ALIVE_NAME
from userbot.utils import admin_cmd
from userbot.manager.utils import edit_or_reply
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "TamilBot🇮🇳"
@command(pattern="^.ping")
async def _(event):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.