text stringlengths 2 999k |
|---|
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from . import utilities, tables
class GetSshK... |
# -*- coding: utf-8 -*-
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://ete.cgenomics.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public ... |
# -*- coding: utf-8 -*-
# Authors: Robert Luke <mail@robertluke.net>
# Eric Larson <larson.eric.d@gmail.com>
# simplified BSD-3 license
import os.path as op
import shutil
import os
import datetime as dt
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
... |
# coding=utf-8
# Copyright 2019 Google LLC
# 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 ... |
from pytorch3d.structures import Meshes
from pytorch3d.renderer import rasterize_meshes, PointsRenderer
from pytorch3d.ops import interpolate_face_attributes
import torch
import torch.nn.functional as F
import torch.nn as nn
import cv2
import numpy as np
import math as m
from abc import ABC
from .light_position import ... |
import asyncio
import websockets
connected = set()
player_data = []
async def consumer_handler(websocket, path):
global connected
# Register Client
connected.add(websocket)
print("Client connected")
try:
async for msg in websocket:
await handle_msg(msg, websocket)
# except... |
#
# 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... |
from flask import Flask
# We create a new Flask app with a unique name (normally we use '__main__' since that's always unique across all files imported in the project).
app = Flask(__name__)
# This decorator registers the '/' route with our app.
# When a user visits the '/' route (which is the homepage), the home() ... |
from .wxlogger import WxLogger
__all__ = ["WxLogger"]
|
import datetime
from HABApp.openhab.definitions import HSBValue, OnOffValue, OpenClosedValue, PercentValue, QuantityValue, RawValue, \
UpDownValue
def map_openhab_values(openhab_type: str, openhab_value: str):
assert isinstance(openhab_type, str), type(openhab_type)
assert isinstance(openhab_value, str),... |
from ..query_runner.query_runner import QueryRunner
from .topological_lp_runner import TopologicalLPRunner
class TopologicalLPEndpoints:
def __init__(self, query_runner: QueryRunner, namespace: str):
self._query_runner = query_runner
self._namespace = namespace
@property
def linkpredictio... |
# -*- coding: utf-8 -*-
# The pam components have been modified to be salty and have been taken from
# the pam module under this licence:
# (c) 2007 Chris AtLee <chris@atlee.ca>
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
'''
Authenticate against PAM
Provides an authenticate ... |
# -*- coding: utf-8 -*-
#
# miditk/smf/sequence.py
#
"""A MIDI stream event handler class to convert an SMF file into a container
object for a sequence of MIDI time-stamped events."""
from __future__ import absolute_import, print_function, unicode_literals
# standard library imports
import logging
from inspect import... |
__all__ = (
'ProgramUtils',
)
import json
import logging
from typing import Any, Dict, List, Tuple, cast
from ..constant import *
from ..predef import *
from ..pure_utils import *
import re
logger = logging.getLogger(__name__)
class ProgramUtils:
"""关系到疫情上报网站的具体逻辑的工具函数。"""
def __init__(
se... |
#
# 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 us... |
def can_build(env, platform):
if platform == 'ps4':
return False
return env['ps4_tools']
def configure(env):
pass
|
import os
from dotenv import dotenv_values
dotenv = dotenv_values(os.path.join(os.path.dirname(__file__), "default.env"))
os.environ.update(dotenv)
#timers in seconds
MARKET_REFRESH_RATE=1
RETRY_RATE=5
API_TIMEOUT=2
BITFINEX_API_URL = os.environ.get("BITFINEX_API_URL")
BITMEX_API_URL = os.environ.get("BITMEX_API_URL"... |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 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
#
# Unles... |
from .htmlgeneral import *
from .HTMLRawText import HTMLRawText
class _HTMLRawTextProto(object):
def __init__(self, implClass=HTMLRawText):
self.implClass = implClass
#
def __call__(self, *args, **attrs):
return self.implClass(args)()
#
def __getitem__(self, children):
return self.implClass("".join(... |
from linebot import (LineBotApi, WebhookHandler)
from linebot.exceptions import (InvalidSignatureError)
from linebot.models import (MessageEvent, PostbackEvent,FlexSendMessage, TextMessage, TextSendMessage ,PostbackTemplateAction, CarouselColumn,CarouselTemplate, TemplateSendMessage,)
from datetime import datetime
imp... |
# Copyright 2018-2021 Xanadu Quantum 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... |
from django.contrib import admin
from .models import Tableau, Villa, Voiture, Peintre
# Register your models here.
admin.site.register(Tableau)
admin.site.register(Villa)
admin.site.register(Voiture)
admin.site.register(Peintre)
|
import asyncio
import base64
import enum
import logging
import os
import shlex
import subprocess
import sys
from typing import IO
from typing import List
import zmq.asyncio
from .protocol import Command
from .protocol import Message
log = logging.getLogger(__name__)
__all__ = ["Stream", "tox_command"]
class Strea... |
"""
An interface for types that do ``IO`` and can fail.
It is a base interface for both sync and async ``IO`` stacks.
"""
from abc import abstractmethod
from typing import TYPE_CHECKING, Callable, NoReturn, Type, TypeVar
from returns.interfaces.specific import io, result
from returns.primitives.hkt import KindN
if ... |
import json
import os
def is_windows() -> bool:
"""Check if OS is Windows. Otherwise, assume it is linux.
:return: (bool) True, if OS is Windows. False, otherwise.
"""
return os.name == 'nt'
def is_json(value: str) -> bool:
"""Check if string is a JSON parsable.
:param value: (str) Value t... |
# encoding: utf-8
# (c) 2017-2021 Open Risk, all rights reserved
#
# TransitionMatrix is licensed under the Apache 2.0 license a copy of which is included
# in the source distribution of TransitionMatrix. This is notwithstanding any licenses of
# third-party software included in this distribution. You may not use this... |
#!/usr/bin/env python3
# import matplotlib
# matplotlib.use("TkAgg") # use for OSX
import math, json, os, pickle, sys
import keras
# import matplotlib.pyplot as plt
from keras.callbacks import CSVLogger, EarlyStopping, ModelCheckpoint
from keras.layers import Dense
from keras.models import Model
from keras.optimiz... |
import torch
import torch.nn as nn
from torch.nn.init import kaiming_normal
import math
#import torch.autograd.Variable
#from models.slice_pool_layer.slice_pool_layer import *
#from models.slice_unpool_layer.slice_unpool_layer import *
__all__= ['ae_rsnet']
class AE_RSnet(nn.Module):
de... |
# Copyright (c) 2021 Nikhil Akki
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
from typing import Optional
from pydantic import BaseModel
class Token(BaseModel):
access_token: str
token_type: str
class TokenPayload(BaseModel):
sub: Optional[int] = None
|
from django.db import connections
from django.db.models.query import QuerySet, Q, ValuesQuerySet, ValuesListQuerySet
from django.contrib.gis.db.models import aggregates
from django.contrib.gis.db.models.fields import get_srid_info, GeometryField, PointField, LineStringField
from django.contrib.gis.db.models.sql import... |
import os
import pytest
import subprocess
from tempfile import TemporaryDirectory
from repo2docker.contentproviders import Git
def test_clone(repo_with_content):
"""Test simple git clone to a target dir"""
upstream, sha1 = repo_with_content
with TemporaryDirectory() as clone_dir:
spec = {'repo': ... |
#import pygame
#pygame.init()
#pygame.mixer.music.load('ex021.mp3')
#pygame.mixer.music.play()
#pygame.event.wait()
from pygame import mixer
mixer.init()
mixer.music.load('ex021.mp3')
mixer.music.play()
input('Agora você escuta?') |
import sys
import common
def check_unknown_status_iteration_callback(filename, system, quantification, problem_list, *callback_args):
ret_dict = callback_args[0]
szs_dict = common.create_szs_dict_of_configuration(problem_list)
szs_status_set = set(szs_dict.keys())
allowed_status_list = ["Theorem", "Cou... |
"""Test serialization."""
import json
from functools import partial
from uuid import UUID
import pendulum
import pytest
from pytest_cache_assert._check_assert.serializer import make_diffable
@pytest.mark.parametrize(
('value', 'expected'), [
('20211101', '20211101'),
(pendulum.parse('20211101')... |
#
# Copyright 2021 Mobvista
#
# 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, s... |
from rest_framework import permissions
class AnonymousUserOnlyPermission(permissions.BasePermission):
"""
Custom permission to ensure user is not authorized and is anonymous
"""
message = "Mustn't be authorized to perform this action"
def has_permission(self, request, *args, **kwargs):
if... |
# -*- coding: utf-8 -*-
class Solution:
def isMagicSquareCenteredHere(self, grid, i, j):
all_nine_numbers = sorted([
grid[i - 1][j - 1], grid[i - 1][j], grid[i - 1][j + 1],
grid[i][j - 1], grid[i][j], grid[i][j + 1],
grid[i + 1][j - 1], grid[i + 1][j], grid[i + 1][j + 1... |
# Appends .go when compiling go files
#
# Example:
# > go run foo
# error: go run: no go files listed
#
#
def match(command, settings):
return (command.script.startswith ('go run ')
and not command.script.endswith('.go'))
def get_new_command(command, settings):
return command.script + '.go'
|
from setuptools import setup
def parser(path: str):
with open(path) as f:
lines = f.read().splitlines()
return lines
README = open(r"README.md", "r").read()
REQ = parser(r"requirements.txt")
setup(
name='EcoFin',
version='1.3',
packages=['EcoFin', 'EcoFin.math', 'EcoFin.math.stochasticPr... |
from multiprocessing import cpu_count
from os import environ
def max_workers():
return (2 * cpu_count()) + 1
bind = '0.0.0.0:%s' % environ.get('PORT', '8000')
worker_class = 'eventlet'
workers = max_workers()
|
import torch
import random
import numpy as np
from functools import partial
from src.text import load_text_encoder
from src.audio import load_audio_transform
from torch.utils.data import DataLoader
from torch.nn.utils.rnn import pad_sequence
SPEC_PAD_VALUE = 0 # Spectrogram was in log-scale
def load_dataset(n_jobs, ... |
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import numpy as np
import operator
from collections import OrderedDict
from dictionary.tornado_dictionary import TornadoDic
from regression.regression import SuperRegression
from sklearn import svm
from sklearn.metrics import r2_score
class Expo(Su... |
from typing import List, Union, Optional
from merakicommons.cache import lazy_property, lazy
from merakicommons.container import searchable, SearchableList
from .. import configuration
from ..data import Region, Platform, Tier, Division, Queue
from .common import CoreData, CoreDataList, CassiopeiaObject, CassiopeiaGh... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. Yo... |
#!/usr/bin/env python
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017, doudoudzj
# Copyright (c) 2012, VPSMate development team
# All rights reserved.
#
# InPanel is distributed under the terms of The New BSD License.
# The full license can be found in 'LICENSE'.
import datetime
from hashlib import md5
import hmac
impo... |
#! /usr/bin/env python
class River(object):
def __init__(self, velocity=1., width=1., depth=1., angle=0., loc=(0., 0.)):
self._velocity = velocity
self._width = width
self._depth = depth
self._angle = angle
self._x0, self._y0 = loc
@property
def x0(self):
r... |
import ast
import functools
import inspect
import re
import sys
import textwrap
import numpy as np
import taichi.lang
from taichi._lib import core as _ti_core
from taichi.lang import impl, runtime_ops, util
from taichi.lang.ast import (ASTTransformerContext, KernelSimplicityASTChecker,
tra... |
# DRUNKWATER TEMPLATE(add description and prototypes)
# Question Title and Description on leetcode.com
# Function Declaration and Function Prototypes on leetcode.com
#802. Find Eventual Safe States
#In a directed graph, we start at some node and every turn, walk along a directed edge of the graph. If we reach a node t... |
import numpy as np
from warnings import warn
__all__ = ['img_as_float32', 'img_as_float64', 'img_as_float',
'img_as_int', 'img_as_uint', 'img_as_ubyte',
'img_as_bool', 'dtype_limits']
# For integers Numpy uses `_integer_types` basis internally, and builds a leaky
# `np.XintYY` abstraction on to... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, taher and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
# test_records = frappe.get_test_records('Packages')
class TestPackages(unittest.TestCase):
pass
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-11 19:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tracker', '0010_remove_paypal_sandbox'),
]
operations = [
migrations.AddField(
model_name='event',
... |
import numpy as np
import MDAnalysis as mda
def get_chunk_residue(original_pdb, chunk_pdb, target_residue_name, target_residue_number):
pdb_univ = mda.Universe(original_pdb, format='PDB')
chunk_univ = mda.Universe(chunk_pdb, format='PDB')
# Get the calpha atom of the pdb target residue:
target_res_cal... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.10.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
i... |
import multiprocessing as mp
from collections import OrderedDict
from typing import Any, Callable, List, Optional, Sequence, Tuple, Type, Union
import gym
import numpy as np
from stable_baselines3.common.vec_env.base_vec_env import (
CloudpickleWrapper,
VecEnv,
VecEnvIndices,
VecEnvObs,
VecEnvStep... |
# -*- coding: utf-8 -*-
# © 2017-2019, ETH Zurich, Institut für Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""
Define the result classes for the identification step.
"""
from ._containers import *
from ._shapes import *
__all__ = _containers.__all__ + _shapes.__all__ # pylint: disable=undefined-v... |
#!/usr/bin/env python
"""
update_dreqs_0208.py
This moves the files in two duplicate data submissions to replaced files.
"""
from __future__ import (unicode_literals, division, absolute_import,
print_function)
import argparse
from datetime import datetime
import logging.config
import sys
from ... |
import click
from ._builder import build
@click.command()
@click.option("--db_project", type=str)
@click.option("--config_dir", default="./db_projects", type=str)
@click.option("--config_file", default="config.yml", type=str)
def main(db_project, config_dir, config_file):
#render the SQL templates and build into... |
#!/usr/bin/python
from __future__ import absolute_import, division, print_function
# Copyright 2019-2020 Fortinet, Inc.
#
# This program 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 ... |
import unittest
from unittest import mock
import discord
from bot.cogs.sync.syncers import RoleSyncer, _Diff, _Role
from tests import helpers
def fake_role(**kwargs):
"""Fixture to return a dictionary representing a role with default values set."""
kwargs.setdefault("id", 9)
kwargs.setdefault("name", "f... |
import drawBot
drawBot.size(200, 200)
drawBot.stroke(0)
drawBot.strokeWidth(10)
drawBot.fill(None)
drawBot.line((40, 40), (40, 160))
drawBot.line((100, 40), (160, 160))
|
# -*- coding: utf-8 -*-
"""
pysteps.nowcasts.sseps
======================
Implementation of the Short-space ensemble prediction system (SSEPS) method.
Essentially, SSEPS is a localized version of STEPS.
For localization we intend the use of a subset of the observations
in order to estimate model paramet... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField, ValidationError
from wtforms.validators import DataRequired, Length, Email, Regexp, EqualTo
from ..models import User
class LoginForm(FlaskForm):
email = StringField('Email', validators=[DataRequired(), Leng... |
import os
import torch
import datasets
import translation_models.model as tmm
import translation_models.help_fun as transl_hf
import onmt
import model_manager
import quantization
import copy
import pickle
import functools
import quantization.help_functions as qhf
import helpers.functions as mhf
cuda_devices = os.envir... |
from decorator import decorator
from pylons import c, cache, config, g, request, response, session
@decorator
def with_user_info(fn, *args, **kwargs):
"""Inject information about the logged in user and global roles
into the context."""
# inject some stuff into the context
c.user = session.get('user',... |
from scripts.helpful_scripts import (
LOCAL_BLOCKCHAIN_ENVIRONMENTS,
get_account,
fund_with_link,
get_contract,
)
from brownie import Lottery, accounts, config, network, exceptions
from scripts.deploy_lottery import deploy_lottery
from web3 import Web3
import pytest
def test_get_entrance_fee():
if... |
import unittest
class HardTest(unittest.TestCase):
pass
if __name__ == "__main__":
unittest.main()
|
from enum import Enum
class GradeValue(Enum):
G1 = 1
G1PLUS = 1.25
G2MINUS = 1.75
G2 = 2
G2PLUS = 2.25
G3MINUS = 2.75
G3 = 3
G3PLUS = 3.25
G4MINUS = 3.75
G4 = 4
G4PLUS = 4.25
G5MINUS = 4.75
G5 = 5
G5PLUS = 5.25
G6MINUS = 5.75
G6 = 6
|
# KicadModTree 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.
#
# KicadModTree is distributed in the hope that it will be useful,
# bu... |
#!/usr/bin/env python3
"""Set up the Python API client for Netdata."""
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
here = os.path.abspath(os.path.dirname(__file__))
# Get the long description from the relevant file
with open(os.path.join(here, "README.rst"... |
from test.assert_json import assert_json
from topcoder.text_processor import solution
def test_text_processor ():
assert_json('text_processor', solution)
|
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
__version__ = "0.1.0"
from .dodger import Dodger |
#!/usr/bin/env python
#####################################
# Installation module for EvilOSX
#####################################
# AUTHOR OF MODULE NAME
AUTHOR="David Kennedy (ReL1K)"
# DESCRIPTION OF THE MODULE
DESCRIPTION="This module will install/update EvilOSX - a C2 infrastructure for OSX in Python"
# INSTAL... |
from connect_four.hashing.hasher import Hasher
from connect_four.hashing.tic_tac_toe_hasher import TicTacToeHasher
from connect_four.hashing.connect_four_hasher import ConnectFourHasher
|
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
from __future__ import print_function
from mysql import connector
import logging,argparse,sys
"""
作者:蒋乐兴
时间:2017年2月
目标:用于获取mysql状态信息、以此作为监控的基础
提需求+报bug:1721900707@qq.com
"""
#create user monitoruser@'127.0.0.1' identified by '123456';
#grant replication client on *.* to m... |
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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... |
from __future__ import unicode_literals
from frappe import _
def get_data():
return[
{
"label": _("Subscription"),
"icon": "fa fa-money",
"items": [
{
"type": "doctype",
"name": "mp Abo",
... |
# as due to their complexity multi-gpu tests could impact other tests, and to aid debug we have those in a separate module.
import logging
import os
import sys
from pathlib import Path
import pytest
import torch
from transformers.testing_utils import TestCasePlus, require_torch_multigpu
from .utils import load_json... |
# Generated by Django 3.2.10 on 2022-01-10 11:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0007_team_members'),
]
operations = [
migrations.AddField(
model_name='tier',
name='raid_gear_name',
... |
"""
An example of Hierarchical Probabilistic Principal Component Analysis (HPPCA),
proposed in [1].
[1] Aiga Suzuki, Hayaru Shouno, "Generative Model of Textures Using Hierarchical Probabilistic Principal Component Analysis",
Proc. of the 2017 Intl. Conference on Parallel and Distributed Processing Techniques and ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import signal
import time
import datetime
import ConfigParser
import json
import logging
import Mobigen.Common.Log as Log; Log.Init()
from apscheduler.schedulers.background import BackgroundScheduler
from RestAPI import RestAPI
import API.M6 as M6
SHUT... |
#
from flask import abort, flash, g
from flask import request, Response
from flask_appbuilder import AppBuilder, BaseView, expose, has_access
from flask_appbuilder.security.decorators import has_access_api
from superset import appbuilder
from flask_babel import gettext as __, lazy_gettext as _
import simplejson as json... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import ir_qweb
from . import ir_http
from . import models
from . import base_document_layout
|
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/poi/shared_tatooine_mineral_farmer_large2.iff"
result.attribute_tem... |
import sys
import os
import torch
import random
import math
import time
from sklearn.utils import shuffle
from sklearn.metrics import f1_score
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
def evaluate( nodes_layers_dic, dataCenter, ds, GraphSage, Outlayer, device, max_vali_f1, cur_epoc... |
import unittest
from frequencies_map import frequencies_map_with_comprehension_from, frequencies_map_with_for_from, frequencies_map_with_map_from, frequencies_map_with_counter_from
class FrequenciesMapWithForTest(unittest.TestCase):
def test_empty_list(self):
self.assertEqual(frequencies_map_with_for_fro... |
# flake8: noqa
from pint import UnitRegistry, Context
from .backend.pint_definition import pint_definitions
units = UnitRegistry(pint_definitions.split("\n"))
units.enable_contexts("dt")
import tensorflow as tf
physical_devices = tf.config.list_physical_devices("GPU")
try:
tf.config.experimental.set_memory_growt... |
import os
# model settings
arch = 'vgg'
attribute_num = 1000
category_num = 48
img_size = (224, 224)
model = dict(
type='GlobalPredictor',
backbone=dict(type='Vgg'),
global_pool=dict(
type='GlobalPooling',
inplanes=(7, 7),
pool_plane=(2, 2),
inter_channels=[512, 4096],
... |
# flake8: noqa
from flask import Flask
def create_app():
"""Initialize the core application."""
app = Flask(__name__, instance_relative_config=False)
with app.app_context():
from . import routes
return app
|
"""Interactive shells for isolated user program access."""
import abc
import argparse
import readline
from typing import List
from typing import Union
class ShellCompleter(list):
"""A command completion container which validates user input against the stored contents to find matches.
Attribute... |
from setuptools import setup
setup(name='feature-rich-pg',
version='1.0',
description='An extension for the pointer generator network for abstractive text summerization',
url='https://github.com/JZ95/feature-rich-pointer-generator',
author='JZhou, ShiHao Liu, Christos Drou',
author_email=... |
#!/usr/bin/env python
# coding: utf-8
# # Pipeline
# This notebook is from the official Quantopian Guide on Pipelines. Make sure to visit their documentation for many more great resources!
# Many trading algorithms have the following structure:
# 1. For each asset in a known (large) set, compute N scalar values for the... |
'''
Utility mesh function for LiDAR-Mesh association
Author: Hakam Shams
Date: Novemebr 2019
Input: LiDAR_file : LiDAR tile, first three column are XYZ, supported format [h5, txt]
obj_file : obj file
face_file : COG file of the labeled face, first three column are XYZ
data_pat... |
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
"""
Arquivo de definição da entidade matches do banco de dados.
"""
from sqlalchemy import Column, Integer, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from App.database_models.users import Users
from api_utils.json_helper import build_json_response
Base = declarative_base()
class Matches(Ba... |
#!/usr/bin/python
#
"""
Copyright (C) 2012 Legoktm
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... |
def sum_list(a_list):
if len(a_list) == 0: # empty
return 0
return a_list[0] + sum_list(a_list[1:])
def test_sum(a_list): # I built a testing function
expected = sum(a_list) # sum builtin to python
total = sum_list(a_list)
print("testing sum of ", a_list, " is ", expected)
assert expec... |
from os import listdir
from shutil import copyfile
srcpath = "./train_image/"
destpath = "./train_image_all/"
# find all images
root_dir = './train_image/'
for filename in listdir(root_dir):
# this is the folder name with the timestamp
img_dir = root_dir + filename
for image_file in listdir(img_dir):
# this is t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.