text stringlengths 2 999k |
|---|
# Copyright (c) 2018 Uber Technologies, 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 ... |
from django.urls import path
from django.views.generic import TemplateView
from . import views
app_name = 'sim'
urlpatterns = [
path('', TemplateView.as_view(template_name='sim/index.html'), name='index'),
path('mania/', TemplateView.as_view(template_name='sim/mania.html'), name='mania'),
path('get/', vie... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
from conans import ConanFile, CMake, tools
import os
class AZMQConan(ConanFile):
name = 'azmq'
version = 'a8f54cc8c9672da7d6301fe1d2719b1436ab4816'
url = 'https://github.com/bincrafters/conan-azmq'
hom... |
from ..utils import Object
class AcceptTermsOfService(Object):
"""
Accepts Telegram terms of services
Attributes:
ID (:obj:`str`): ``AcceptTermsOfService``
Args:
terms_of_service_id (:obj:`str`):
Terms of service identifier
Returns:
Ok
Raises:
... |
""" common utilities """
import itertools
import numpy as np
from pandas import (
DataFrame,
Float64Index,
MultiIndex,
Series,
UInt64Index,
date_range,
)
import pandas._testing as tm
def _mklbl(prefix, n):
return [f"{prefix}{i}" for i in range(n)]
def _axify(obj, key, axis):
# crea... |
#!/usr/bin/python
#
# Copyright 2018-2022 Polyaxon, 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 ... |
"""
utils for testing
"""
import os
import random
import string
from functools import reduce
from operator import add
from py2store.key_mappers.tuples import (
dict_of_tuple,
str_of_tuple,
dsv_of_list,
)
from py2store.key_mappers.str_utils import (
n_format_params_in_str_format,
empty_arg_and_kwarg... |
# 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 pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 30, transform = "Difference", sigma = 0.0, exog_count = 20, ar_order = 0); |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 6.6 from Kane 1985."""
from __future__ import division
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import inertia, inertia_of_point_mass
from sympy.physics.mechanics import dot
from sympy import symbols
from sympy impo... |
# Generated by Django 3.0.5 on 2020-05-07 17:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('books', '0010_auto_20200507_1956'),
]
operations = [
migrations.AlterField(
model_name='orderitem',
name='author',
... |
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d, Axes3D
def draw_points(points):
fig = plt.figure()
ax = Axes3D(fig)
# 绘制虚拟的三维 bounding box,保证三轴成比例
minpt = np.min(points[:, :3], axis=0)
maxpt = np.max(points[:, :3], axis=0)
max_range = np.array([maxpt[0] - minpt[0], max... |
# 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
# d... |
"""use sequences
Revision ID: b7a3e293c207
Revises: 0bde60e6657f
Create Date: 2017-06-15 11:43:35.574932
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b7a3e293c207'
down_revision = '0bde60e6657f'
branch_labels = None
depends_on = None
# Create Postgresql ... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
#!/usr/bin/env python
"""
RandomWalker.py: use surrounding textual context (previous two words and next word) and the previous set
of states to predict a new set of states. At any time, the states are words considered "similar" to the
current word. If the "similar" words contain the current word, the score is increase... |
"""Implementation of ``idoit-cli search`` command.
Lists the constants.
"""
import argparse
import json
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import Terminal256Formatter
from .api import Client
def setup_argparse(parser: argparse.ArgumentParser) -> None:
... |
"""Functions to calculate classical transport coefficients.
.. topic:: Examples:
* :ref:`sphx_glr_auto_examples_plot_braginskii.py`
Introduction
============
Classical transport theory is derived by using kinetic theory to close the
plasma two-fluid (electron and ion fluid) equations in the collisional limit.
Th... |
# Задача №2:
# Сформировать массив вида:
# [1,0,1,0,0,1,0,0,0,1,0,0,0,0,1 ...]
# количество элементов должно быть таким, чтобы массив начинался и заканчивался
# единицей, а всего единиц было N.
#
# Вариант решения №1, через цикл for
#
# =!!= Запускать с помощью Python3 =!!=
# Указываем количество
N = 10
# Создаем н... |
#!/usr/bin/env python3
from gzip import GzipFile
import hashlib
import json
from os.path import (
dirname, join, isfile, realpath,
relpath, split, exists, basename
)
from os import environ, listdir, makedirs, remove
import os
import shlex
import shutil
import subprocess
import sys
import tarfile
import tempfil... |
"""
Provide a generic structure to support window functions,
similar to how we have a Groupby object.
"""
from __future__ import division
from collections import defaultdict
from datetime import timedelta
from textwrap import dedent
import warnings
import numpy as np
import pandas._libs.window as libwindow
import pa... |
# #########################################################################
# Copyright (c) 2020, UChicago Argonne, LLC. All rights reserved. #
# #
# Copyright 2020. UChicago Argonne, LLC. This software was produced #
# under U.S. Gov... |
# -*- coding: utf-8 -*-
import numpy as np
import plotille
from .spear_utils import index_time, index_amp
"""spear2sc.analysis A set of methods to perform basic analysis of the partials"""
def get_durations_thresh(partials):
"""Gets the 92th percentile of partial durations
The concrete percentile threshol... |
import gym
from pettingzoo.utils.to_parallel import to_parallel, ParallelEnv, from_parallel
from pettingzoo.utils.env import AECEnv
from . import aec_wrappers
from . import gym_wrappers
from . import parallel_wrappers
from . import vector_constructors
__version__ = "2.3.0"
class WrapperFactory:
def __init__(self... |
#!/usr/bin/env python
__author__ = "colson@korea.ac.kr"
__author_sub_ = "dud3722000@naver.com"
import rospy
from time import sleep
import multiprocessing
import imp
import threading
import StringIO
import errno
import signal
import socket
import struct
from Queue import Queue
from serial import Serial, SerialExce... |
from __future__ import print_function
import torch.utils.data as data
import os
import os.path
import numpy as np
from PIL import Image as pil_image
import pickle
import random
from . import parser
class Omniglot(data.Dataset):
def __init__(self, root, dataset='omniglot'):
self.root = root
self.se... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contacts', '0001_initial'),
('orgs', '0008_org_timezone'),
]
operations = [
migrations.CreateModel(
name... |
import copy
import numpy as np
from . import string_length, palide, center, Bool, Number, String, is_fmt
from . import _ext
from . import npfmt
from .lib import ansi
#-------------------------------------------------------------------------------
# FIXME: Elsewhere.
def update_cfg(old, updates):
new = co... |
import pprint
from typing import Literal
import discord
from discord.utils import escape_markdown as escape
from redbot.core import commands
from redbot.core.bot import Red
from redbot.core.utils.chat_formatting import box, pagify
RequestType = Literal["discord_deleted_user", "owner", "user", "user_strict"]
class E... |
# Copyright 2019 The Magenta 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 ... |
from abc import ABCMeta, abstractmethod
import math
import torch
from .misc import ParabolicPerceptron, HamiltonianPerceptron, HollowMLP, MLP, PreActConv2d
###############################################################################
###############################################################################... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011-2014, Nigel Small
#
# 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... |
# (c) 2018 Red Hat Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
---
author: Ansible Networking Team
httpapi: nxos
short_description: Use NX-API to run comman... |
from pydantic import BaseModel, validator
from .validators import gt0
class BaseRule(BaseModel):
bal: int = 0
_gt0_bal = validator("bal", allow_reuse=True)(gt0)
class NullRuleFields(BaseModel):
bal: int = 0
|
import sys
import os
import collections
from lib import agouti_gff as agGFF
def createNewGenes(geneModels, index, ctg, start, stop): # index is 0-based
geneModel = agGFF.AGOUTI_GFF()
geneModel.setGene("AGOUTI.%s.%d" %(ctg, len(geneModels)),
-1, -1, 0)
geneModel.lcds = [start+1, stop+1]
geneModel.setConti... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
import json
from matplotlib import pyplot as plt
import numpy as np
import os
# Configuration
anomaly_color = 'sandybrown'
prediction_color = 'yellowgreen'
training_color = 'yellowgreen'
validation_color = 'gold'
test_color = 'coral'
figsize=(12, 4)
d... |
def reverse(x: int) -> int:
"""
https://leetcode.com/problems/reverse-integer
:param x: a value to revert
:return: reverse of a 32-bit signed integer
"""
# Prepare value
unsigned_value = (x // 10) if (x % 10 == 0) else x
unsigned_value = -unsigned_value if x < 0 else unsigned_value
... |
# Copyright 2018 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.
from telemetry.page import shared_page_state
from page_sets.login_helpers import linkedin_login
from page_sets.rendering import rendering_story
from page_set... |
# Version: 6.1
# Architecture: amd64
# CompanyName: Microsoft Corporation
# FileDescription: NT Kernel & System
# FileVersion: 6.1.7601.17514 (win7sp1_rtm.101119-1850)
# InternalName: ntkrnlmp.exe
# LegalCopyright: Microsoft Corporation. All rights reserved.
# OriginalFilename: ntkrnlmp.exe
# ProductName: Microsoft Wi... |
import configparser
try:
with open("cfg.ini", "r") as f:
pass
except FileNotFoundError:
raise FileNotFoundError("Config file not found. Please make sure cfg.ini exists.")
cfg = configparser.ConfigParser()
cfg.read("cfg.ini")
|
from data import recent_confirmed as week
from matplotlib import pyplot as plt
from matplotlib import rc
import matplotlib.font_manager as fm
import platform
from datetime import datetime
now = datetime.now()
month = now.strftime("%m")
day = now.strftime("%d")
today = month + day
if platform.system() == 'Windows':
# ... |
import setuptools
with open("README.md", "r") as ld:
long_description = ld.read()
setuptools.setup(
name="asprilo-mapfconverter",
version="0.1.6",
author="Wassily Korth",
author_email="wkorth@uni-potsdam.de",
description="A converter from movingai's formats to asprilo's",
long_description=... |
# Copyright 2016 Andrich van Wyk
#
# 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, ... |
# Copyright 2020 Toyota Research Institute. All rights reserved.
import random
import torch.nn as nn
from packnet_sfm.geometry.pose import Pose
from packnet_sfm.utils.misc import make_list
from packnet_sfm.models.SfmModel import SfmModel
import torch.nn.functional as F
class UCMSfmModel(SfmModel):
"""
Model ... |
"""
========================
Random Number Generation
========================
Use ``default_rng()`` to create a `Generator` and call its methods.
=============== =========================================================
Generator
--------------- ---------------------------------------------------------
Generator ... |
# INTEL CONFIDENTIAL
#
# Copyright (C) 2021 Intel Corporation
#
# This software and the related documents are Intel copyrighted materials, and
# your use of them is governed by the express license under which they were provided to
# you ("License"). Unless the License provides otherwise, you may not use, modify, copy,
... |
#
# htmlStripper.py
#
# Sample code for stripping HTML markup tags and scripts from
# HTML source files.
#
# Copyright (c) 2006, Paul McGuire
#
from pyparsingOD import *
import urllib.request, urllib.parse, urllib.error
removeText = replaceWith("")
scriptOpen,scriptClose = makeHTMLTags("script")
script... |
# coding: utf-8
# flake8: noqa
"""
API Specification
# Introduction Welcome to gridscales API documentation. A REST API is a programming interface that allows you to access and send data directly to our systems using HTTPS requests, without the need to use a web GUI. All the functionality you are already fam... |
"""
This module provides data loaders and transformers for popular vision datasets.
"""
from .cityscapes import CitySegmentation
datasets = {
'citys': CitySegmentation
}
def get_segmentation_dataset(name, **kwargs):
"""Segmentation Datasets"""
return datasets[name.lower()](**kwargs)
|
import shutil
import datetime
def backup():
shutil.copy2('../.zzz/data.zzz','../.BackUps/'+str(datetime.datetime.now())+'.bak')
print('Backup Complete...')
if __name__ == '__main__':
inn = raw_input('Backup data.zzz now? (y/n)')
if inn == 'y':
backup()
else:
print('Cancelling Backu... |
# coding: utf-8
from __future__ import unicode_literals
import random
import re
import string
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
mimetype2ext,
parse_codecs,
update_url_query,
urljoin,
xpath_element,
xpath_text,
)
from ..compat import (
... |
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
import os
DB_HOST = os.environ["DB_HOST"]
DB_NAME = os.environ["DB_NAME"]
DB_USERNAME = os.environ["DB_USERNAME"]
DB_PASSWORD = os.environ["DB_PASSWORD"]
DB_PORT = os.environ["DB_POR... |
# -*- 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
#... |
from app import create_app,db
from flask_script import Manager,Server
from flask_migrate import Migrate, MigrateCommand
from app.models import User,Role
app = create_app('production')
manager = Manager(app)
manager.add_command('server',Server)
migrate = Migrate(app,db)
manager.add_command('db',MigrateCommand)
@ma... |
from binance_f import RequestClient
from binance_f.constant.test import *
from binance_f.base.printobject import *
request_client = RequestClient(api_key=g_api_key, secret_key=g_secret_key)
result = request_client.get_symbol_price_ticker()
# result = request_client.get_symbol_price_ticker(symbol="BTCUSDT")
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Jigar Tarpara and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class SlittingTable(Document):
pass
|
"""fotaro.
Usage:
fotaro.py <data-dir> <photo-dir>
"""
from multiprocessing import Process
from docopt import docopt
from server import run_server
from overseer import run_overseer
if __name__ == "__main__":
args = docopt(__doc__)
data_dir = args["<data-dir>"]
photo_dir = args["<photo-dir>"]
p_... |
"""Main module. If include_dataclasses_scaffolding is enabled, you will see Data Class scaffolding here"""
from dataclasses import dataclass
from datetime import datetime
from typing import List
import pandas as pd
from recordlinkage import Index, Compare
from notion.collection import Collection
from thought.client im... |
# Copyright 2013-2019 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 Atop(Package):
"""Atop is an ASCII full-screen performance monitor for Linux"""
homepa... |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... |
import datetime
date = datetime.date.today()
year = int(date.strftime("%Y"))
def voto(idade):
if idade >= 18 and idade <= 69:
return('OBRIGATÓRIO')
elif idade >= 16 or idade >= 70:
return('OPCIONAL')
else:
return('NEGADO')
#Programa principal
ano = int(input('Digite seu ano de nasc... |
import os
from glob import glob
import time
import json
from PIL import Image
import pandas as pd
import numpy as np
import torchvision as tv
from rsp.data import bilinear_upsample, BANDS
from tifffile import imread as tiffread
from d3m.container import DataFrame as d3m_DataFrame
from d3m.metadata import base as metad... |
# coding: utf-8
"""
cdn
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import ncloud_cdn
from ncloud_cdn.api.v2_api import V2Api # noqa: E501
from ncloud_cdn.rest import ApiException
class TestV2Api(unittest.TestCase):
... |
"""
Given n, how many structurally unique BSTs (binary search trees) that store values 1...n?
Have you met this question in a real interview? Yes
Example
Given n = 3, there are a total of 5 unique BST's.
1 3 3 2 1
\ / / / \ \
3 2 1 1 3 2
/ /... |
from DealData.FileOperation import FileOperation
import numpy as np
def test():
a=np.random.uniform(0,1,size=10)
b = np.random.uniform(0, 1, size=10)
print(a)
print(b)
print(np.corrcoef(a,b))
print(cal_corrcoef(a,b))
pass
def cal_corrcoef(X,Y):
# 均值
Xmean = np.mean(X)
Ymean = np... |
from django.urls import path
from . import views
from django.urls import path
from django.conf.urls import url
app_name = "local"
urlpatterns = [
path("", views.localmanagement, name="local"),
]
|
target_x_0 = [-1.0, 1.0]
target_x_1 = [-1.0, 1.0]
import numpy as np
import matplotlib.pyplot as plt
vertexes = np.array([[target_x_0[0], target_x_1[0]],
[target_x_0[0], target_x_1[1]],
[target_x_0[1], target_x_1[1]],
[target_x_0[1], target_x_1... |
"""
A convex polygon is a simple polygon in which no line segment between two points on the boundary ever goes outside the polygon. Equivalently, it is a simple polygon whose interior is a convex set. In a convex polygon, all interior angles are less than or equal to 180 degrees, while in a strictly convex polygon all... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.c (the "License");
# you may not use this file except in compliance with the License.
""" Userbot module for having some fun with people. """
from asyncio import sleep
from random import choice, getrandbits... |
"""
Alternate implementation of RobotParser (alternative to standard library urllib.robotparser)
Reference:
Robots Exclusion Protocol (REP) draft-koster-rep-01
https://tools.ietf.org/html/draft-koster-rep
"""
from typing import Dict, Iterator, List, NamedTuple, Tuple, Type, TypeVar
import enum
import fnmatch
import ... |
import string
import re
# before running this script , please run the datacleaning script and set the folder to read from to train_pos_full and train_neg_full to generate the vocabullary
# for the respective files
def loadText(fileName):
with open(fileName) as f:
content = f.readlines()
content = [x.strip() ... |
import tensorflow as tf
import data_utils
from qwk import quadratic_weighted_kappa
import time
import os
import sys
import pandas as pd
import numpy as np
graph = tf.get_default_graph()
essay_set_id = 1
num_tokens = 42
embedding_size = 300
num_samples = 1
is_regression = False
early_stop_count = 0
max_step_count = 1... |
# Copyright 2015 Google 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, ... |
from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
'''Allow user to edit their own profile '''
def has_object_permission(self, request, view, obj):
'''Check user is trying to edit their own profile '''
if request.method in permissions.SAFE_METHODS: # e.... |
# -*- coding: utf-8 -*-
"""Creating solph nodes from input data.
SPDX-FileCopyrightText: 2016-2021 Uwe Krien <krien@uni-bremen.de>
SPDX-License-Identifier: MIT
"""
import logging
from collections import namedtuple
from oemof import solph
class Label(namedtuple("solph_label", ["cat", "tag", "subtag", "region"])):... |
import Trainers.DatasetBC
__all__ = [
Trainers.DatasetBC,
]
|
# coding: utf-8
# Basic setup:
import psrchive as psr
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from os.path import splitext
from os.path import split
from os.path import basename
import argparse
parser = argparse.ArgumentParser(description="This code will estimate th... |
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present GlastHeim.pe
"""
from django.urls import path
from apps.reports.views import HomeIndex, AccreditationReports
urlpatterns = [
path('', HomeIndex.index, name='report.index'),
path('accreditation/<str:tp>', AccreditationReports.as_view(), name='report.a... |
# Renderer tests
import sphinx.environment
from breathe.node_factory import create_node_factory
from breathe.parser.compound import linkedTextTypeSub, memberdefTypeSub, paramTypeSub, MixedContainer
from breathe.renderer.sphinxrenderer import SphinxRenderer
from breathe.renderer.filter import OpenFilter
from docutils i... |
"""This file contains utility functions for performance tests.
"""
__author__ = "Jakub Kudzia"
__copyright__ = "Copyright (C) 2016 ACK CYFRONET AGH"
__license__ = "This software is released under the MIT license cited in " \
"LICENSE.txt"
import sys
import itertools
import time
import pytest
def perfor... |
# -*- coding: utf-8 -*-
"""
Learn more at:
https://gist.github.com/artscoop/0eba5033527f9e488ee17b346d16284d
"""
from __future__ import absolute_import
import tempfile
from django.conf import settings
from django.template import TemplateDoesNotExist, TemplateSyntaxError
from django.template.backends.base import BaseE... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Optional
import torch
import torch.nn.functional as F
from torch import Tensor
def _create_dense_warp_base_grid(
d... |
# Copyright 2017 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... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, caffe2_xavier_init
from torch.utils.checkpoint import checkpoint
from ..builder import NECKS
@NECKS.register_module()
class HRFPN(nn.Module):
"""HRFPN (High Resolution Feature Pyrmamids)
paper: `High-Resoluti... |
#
# 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... |
# Copyright 2016 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... |
import threading
from logging import getLogger
from time import sleep
from threading import Thread, currentThread
from jsdc.sensor import Sensor
lock = threading.Lock()
class Gatherer:
"""Sensor data gatherer"""
def __init__(self, sensor: Sensor):
self.sensor = sensor
self.gatherer = Thread(... |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... |
from logging import Logger
import injector
__all__ = [
# module
"DownloadsInfrastructure",
]
from sqlify import Sqlite3Sqlify
from downloads import (
GetTotalFiles,
GetFileStatus,
GetBulkFileStatus,
FilesRepository,
DownloadRepository,
)
from downloads_infrastructure.queries import (
... |
# -*- coding: utf-8 -*-
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default... |
# -*- 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 (t... |
from __future__ import unicode_literals
import json
import datetime
import pytz
import uuid
from ledger.settings_base import TIME_ZONE
from ledger.payments.pdf import create_invoice_pdf_bytes
from django.db import models, transaction
from django.dispatch import receiver
from django.db.models.signals import pre_delete
... |
import os
import ray
import ray.rllib.agents.ppo as ppo
from ray.tune.logger import pretty_print
# Based on https://github.com/ray-project/ray/blob/master/doc/source/rllib-training.rst#python-api
ray.init(log_to_driver=False, webui_host='127.0.0.1')
config = ppo.DEFAULT_CONFIG.copy()
config["num_gpus"] = int(os.envir... |
# coding: utf-8
# Copyright (c) 2016, 2020, 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... |
from django.conf import settings
from django.utils.text import slugify
from django.db.models import Q
from .models import Apps, AppInstance, AppCategories, AppPermission
from projects.models import Project, Flavor, Environment, S3
from models.models import Model
from projects.helpers import get_minio_keys
import module... |
import copy
import typing
from collections import OrderedDict
from zeep.xsd.printer import PrettyPrinter
if typing.TYPE_CHECKING:
from zeep.xsd.types import ComplexType
__all__ = ["AnyObject", "CompoundValue"]
class AnyObject:
"""Create an any object
:param xsd_object: the xsd type
:param value: T... |
n = int(input('\033[30;7mDigite um número:\033[m '))
print(f'\033[30mO dobro de\033[31m {n}\033[30m é \033[33m{n*2}\n\033[30mO triplo de \033[31m{n} \033[30mé\033[33m {n*3}\n'
f'\033[30mA raiz quadrada de \033[31m{n}\033[30m é \033[34m{n**(1/2):.3f}') |
from typing import Any, Callable, Dict, List, Optional
from ceres.consensus.block_record import BlockRecord
from ceres.consensus.pos_quality import UI_ACTUAL_SPACE_CONSTANT_FACTOR
from ceres.full_node.full_node import FullNode
from ceres.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin
from c... |
import typing
__all__ = ['remove_suffix', 'remove_prefix', 'row_pad_prefix']
def remove_suffix(string: str, suffix: str):
if string.endswith(suffix):
return string[:len(string) - len(suffix)]
return string
def remove_prefix(string: str, prefix: str):
if string.startswith(prefix):
return... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.