text stringlengths 2 999k |
|---|
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
ConnectionRefusedError = OSError
import logging
import random
import requests
import tornado
import ujson
def parse_body(req, **fields):
try:
data = tornado.escape.json_decode(req.body)
except ValueError... |
from collections.abc import MutableMapping
from typing import Dict, Iterator, List, Union
from pdm.formats import flit, poetry
from pdm.pep517.metadata import Metadata
class MutableMetadata(Metadata, MutableMapping):
"""
A subclass of Metadata that delegates some modifying methods
to the underlying toml ... |
from collections import deque
from datetime import datetime
from enum import Enum
from itertools import product
from typing import Dict, List, Optional, Tuple, Union
import pytest
from typing_extensions import Literal
from pydantic import BaseModel, ConfigError, Extra, Field, ValidationError, errors, validator
from p... |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'CapFront.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are... |
import logging
try:
from nose.tools import nottest
except ImportError:
def nottest(x):
return x
from galaxy.tool_util.verify.interactor import GalaxyInteractorApi, verify_tool
from galaxy.tools import DataManagerTool
from galaxy_test.base.env import setup_keep_outdir, target_url_parts
from galaxy_test... |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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/licens... |
""" Special stores that combine underlying Stores together """
from datetime import datetime
from itertools import groupby
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
from pydash import set_
from pymongo import MongoClient
from maggma.core import Sort, Store, StoreError
from maggma.stores.mon... |
from .action_scaler import ActionSpaceScaler
from .dict import DictEnv
from .torch import TorchEnv
def wrap_openai_gym(env):
return TorchEnv(ActionSpaceScaler(DictEnv(env))) |
from django.db import models
from datetime import datetime, timedelta
from Client.models import Client
class OffersHistory(models.Model):
date_time_generated = models.DateTimeField(auto_now_add=True)
date_time_expire = models.DateTimeField(null=False, blank=False)
is_expired = models.BooleanField(default=... |
"""
parse_address
Jan 2013
stdavis@utah.gov
"""
import os
from csv import reader
# reference data
dirs = {
'N': ['N', 'NORTH', 'NO'],
'S': ['S', 'SOUTH', 'SO'],
'E': ['E', 'EAST', 'EA'],
'W': ['W', 'WEST', 'WE']
}
# searching states
searchStates = {
'houseNumber': 1,
'prefixDirection': 2,
... |
from flask import Flask, render_template, request, get_template_attribute
from models.LogManager import LogManager
from models.XMLManager import XMLManager
from models.SPARQLEndpointManager import SPARQLEndpointManager
from models.VerbalizeManager import VerbalizeManager
import json
LogManager.init()
XMLManager.init()... |
from typing import Tuple
from celery import group
from abc import ABC, abstractmethod
from biophi.common.web.tasks import celery
import uuid
class TaskNotFoundError(Exception):
pass
class Scheduler(ABC):
@abstractmethod
def get_result(self, task_id, index=None, timeout=15):
pass
@abstractm... |
# @lc app=leetcode id=133 lang=python3
#
# [133] Clone Graph
#
# https://leetcode.com/problems/clone-graph/description/
#
# algorithms
# Medium (40.59%)
# Likes: 3134
# Dislikes: 1731
# Total Accepted: 477.8K
# Total Submissions: 1.2M
# Testcase Example: '[[2,4],[1,3],[2,4],[1,3]]'
#
# Given a reference of a nod... |
import os
__all__ = ['DEFAULT_PROTOCOL',
'DESIGNER_ONLINE',
'STYLESHEET',
'STYLESHEET_INCLUDE_DEFAULT',
'CONFIRM_QUIT'
]
DEFAULT_PROTOCOL = os.getenv("PYDM_DEFAULT_PROTOCOL")
if DEFAULT_PROTOCOL is not None:
# Get rid of the "://" part if it exists
DEFAU... |
"""
SWORDv2 API implementation for SSS
This provides an implenentation of sss.core.SwordServer and related support classes which implements the features that are used by this
module.
"""
from sss.core import SwordServer, ServiceDocument, SDCollection, SwordError, Authenticator, Auth, DepositResponse, EntryDocument, S... |
# sql/functions.py
# Copyright (C) 2005-2018 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""SQL function API, factories, and built-in functions.
"""
from . import sqltypes... |
# Copyright 2020 Lane Shaw
#
# 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, softwa... |
from typing import Optional, Any
from ray.rllib.utils.framework import try_import_tf
from ray.rllib.utils.typing import TensorType
tf1, tf, tfv = try_import_tf()
class RelativeMultiHeadAttention(tf.keras.layers.Layer if tf else object):
"""A RelativeMultiHeadAttention layer as described in [3].
Uses segmen... |
import pygame
import numpy as np
from collections import deque
import logging
import os
from . import (Particle, cfg, calculate_r_naught,
bounce_wall, build_walls, random_coord, draw_walls,
draw_line, display_text, euclidean_distance, bounce_particle,
uniform_probability, bar_chart, make_grid_a... |
#!flask/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_c... |
# coding=utf-8
# Copyright 2018 The TF-Agents 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... |
test = {
'name': 'parent',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
sqlite> SELECT * FROM by_parent_height;
herbert
fillmore
abraham
delano
grover
barack
clinton
""",
'hidden... |
import os
import re
import json
import requests
def find_file(name, path):
"""
Finds file with the specified name in the given path.
Args:
name (str): file name.
path (str): starting path for search.
Returns:
str: absolute file path (if found)
"""
for root, dirs, fil... |
# https://github.com/AlanChou/Truncated-Loss/blob/master/TruncatedLoss.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import numpy as np
__all__=['GCELoss', 'GCE_GTLoss']
class GCELoss(nn.Module):
def __init__(self, q=0.7, k=0.5, trainset_size=50000, truncated=False):
s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains implementation for presets widget
"""
from __future__ import print_function, division, absolute_import
__author__ = "Tomas Poveda"
__license__ = "MIT"
__maintainer__ = "Tomas Poveda"
__email__ = "tpovedatd@gmail.com"
import os
import glob
import... |
from copy import deepcopy
import tempfile
from typing import List
from icolos.core.containers.compound import Conformer, Enumeration
from icolos.core.workflow_steps.step import StepBase
from pydantic import BaseModel
try:
from espsim import EmbedAlignConstrainedScore
except ImportError:
print(
"WARNING... |
import multiprocessing
RUNTIME_NAME_DEFAULT = 'localhost'
RUNTIME_TIMEOUT_DEFAULT = 600 # 10 minutes
def load_config(config_data):
config_data['lithops']['runtime'] = RUNTIME_NAME_DEFAULT
config_data['lithops']['runtime_memory'] = None
if 'runtime_timeout' not in config_data['lithops']:
config_... |
import pytest
import pytoolkit as tk
K = tk.K
def test_logit(session):
x = K.constant([0.0, 0.5, 1.0])
y = [-16.118095, 0, +16.118095]
assert session.run(tk.backend.logit(x)) == pytest.approx(y, abs=1e-6)
|
import copy
from datetime import datetime
import threading
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple
import uuid
import optuna
from optuna import distributions # NOQA
from optuna.exceptions import DuplicatedStudyError
from optuna.storag... |
import jinja2
import os
import pickle
from tripleoci import config
from tripleoci.utils import get_circles
from tripleoci.utils import statistics
from tripleoci.utils import top
from tripleoci.watchcat import meow
DEBUG = False
def create_html():
"""Create HTML page
This function runs job analysis by ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 20 20:18:55 2016
@author: sakurai
"""
import os
import contextlib
import time
from six.moves.urllib import request
from progressbar import ProgressBar, Percentage, Bar, ETA, FileTransferSpeed
import fuel
fuel_root_path = fuel.config.config["data_path"]["yaml"]
base_url ... |
# 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 ... |
import json, hashlib, base64, urllib, abc, requests
from .api_settings import KDNIAO_GLOBAL_SETTINGS, DATA_TYPE, KDNIAO_URL
from .request_type import *
class KDBirdExpress(metaclass=abc.ABCMeta):
"""抽象基类,封装了快递鸟物流接口中的签名逻辑和发送HTTP请求逻辑"""
__key_value = KDNIAO_GLOBAL_SETTINGS.get('APIKey')
__ebusiness_id = K... |
"""
model the end-to-end Subaru-SCExAO optics system
Here, we will add the basic functionality of the Subaru+SCExAO Telescope, including the primary, secondary, and AO188.
The SCExAO system sits behind the AO188 instrument of Subaru, which is a 188-element AO system located at the
Nasmyth focus (IR) of the telescope.
... |
import connexion
import six
from swagger_server.models.pursued_degree import PursuedDegree # noqa: E501
from swagger_server import util
from swagger_server import encoder
from sqlalchemy import types
from sqlalchemy import exc
from flask import make_response
def add_pursued_degree(body): # noqa: E501
"""Add... |
# 151
# 리스트 = [3, -20, -3, 44]
#
# for i in 리스트:
# if i < 0:
# print(i)
# 152
# 리스트 = [3, 100, 23, 44]
#
# for i in 리스트:
# if i % 3 == 0:
# print(i)
# 153
# 리스트 = [13, 21, 12, 14, 30, 18]
#
# for i in 리스트:
# if i < 20 and i % 3 == 0:
# print(i)
# 154
# 리스트 = ["I", "study", "python... |
import json
from Name import NameDefinition, Gender, Region, NameSource
class TestNames:
def test_meaning_none(self):
name = NameDefinition(name="name1", gender=Gender.boy, meaning=None)
assert len(name.meanings) is 0
def test_meaning_merge_same_origin(self):
name = NameDefinition(na... |
# watchdog for playstation, uses playstation search and get API
# when fetch prices for american region, search game in other region and fetch price if exists
import gghf.parser.playstation.price
import requests
import json
import logging
import logging.handlers as handlers
import time
import logging.config
logging.... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 1 19:49:33 2019
@author: gaomingda
"""
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import symbol_resnetv2
import ... |
import numpy as np
import matplotlib.pyplot as plt
def sigmoid(val):
return 1/(1 + np.exp(-val))
def stable_coeff(rho, psi):
r = sigmoid(rho)
theta = np.pi * sigmoid(psi)
a_1 = -2*r*np.cos(theta)
a_2 = r**2
return a_1, a_2
def roots_polynomial(a_1, a_2):
delta = a_1**2 - 4 * a_2
del... |
import ast
import logging
import pytest
from tests.common.helpers.assertions import pytest_assert
from tests.common.helpers.platform_api import sfp
from tests.common.utilities import skip_release
from tests.common.utilities import skip_release_for_platform
from tests.common.platform.interface_utils import get_physical... |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import json
import os
from pants.base.exceptions import TaskError
from pants.base.workunit import WorkUnitLabel
from pants.subsystem.subsystem import Subsystem
from pants.util.contextutil... |
from distutils.version import StrictVersion
import random
import time
from unittest import mock
import uuid
import pytest
from hedwig.conf import settings
from hedwig import ValidationError, CallbackNotFound, MessageType
from hedwig.models import Message, Metadata
from hedwig.testing.factories import MetadataFactory
... |
from poetry.packages import dependency_from_pep_508
def test_dependency_from_pep_508():
name = "requests"
dep = dependency_from_pep_508(name)
assert dep.name == name
assert str(dep.constraint) == "*"
def test_dependency_from_pep_508_with_version():
name = "requests==2.18.0"
dep = dependency... |
# Copyright 2020 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... |
from unittest import TestCase
from tests import get_data
from pytezos.michelson.contract import ContractStorage
class BigMapCodingTestopBU9Y(TestCase):
def setUp(self):
self.maxDiff = None
def test_big_map_opBU9Y(self):
section = get_data(
path='big_map_diff/opBU9Yy4UJpXYSip... |
r"""
Base objects (:mod: `qiita_db.base`)
====================================
..currentmodule:: qiita_db.base
This module provides base objects for dealing with any qiita_db object that
needs to be stored on the database.
Classes
-------
..autosummary::
:toctree: generated/
QiitaObject
"""
# ------------... |
# 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... |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... |
#
# Copyright 2020 Spotify AB
# 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... |
# -*- coding: utf-8 -*-
import socket
class socketFlightServer():
## fonction qui se lance au demarrage du thread
def __init__(self):
## initialisation des variables et démarrage du thread
self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.server_socket.bind(('1... |
import os
import taichi as ti
def get_benchmark_dir():
return os.path.join(ti.core.get_repo_dir(), 'benchmarks')
class Case:
def __init__(self, name, func):
self.name = name
self.func = func
self.records = {}
def __lt__(self, other):
return self.name < other.name
d... |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
requires = [
'pyramid',
'pyramid_chameleon',
'pyramid_debugtoolbar',
'pyramid_tm',
'SQLAlchemy',
'transaction',
'zope.sqlalchemy',
'waitress',
]
setup(name='leap',
version='0... |
# The MIT License (MIT)
#
# Copyright (c) 2013 Victor Chinedu
#
# 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, mo... |
import os
import random
from pathlib import Path
import numpy as np
import requests
import torch
import torch.nn as nn
def seed_all(seed):
print(f"Setting seed: {seed}")
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
DATA_LOC_KEY = "DATASET_LOC"
... |
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import prin... |
'''
Problem 2
Each new term in the Fibonacci sequence is generated by adding the previous two
terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed
four million, find the sum of the even-valued... |
# 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
from .. import ... |
#
# Copyright (c) European Synchrotron Radiation Facility (ESRF)
#
# 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,... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... |
# coding=utf-8
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from setuptools impo... |
from __future__ import absolute_import, division, print_function
import json
import logging
import math
import os
import random
import warnings
from dataclasses import asdict
from multiprocessing import cpu_count
import numpy as np
import pandas as pd
import torch
from scipy.stats import pearsonr
from sklearn.metrics... |
import pyaf.tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['PolyTrend'] , ['Seasonal_Hour'] , ['AR'] ); |
# polygon_ex1.py
from xsect import polygon_points, plot_section
points = polygon_points(5, 1, 0.1)
plot_section(points, title='Polygon')
|
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2016 Rapptz
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 u... |
from ast import mod
from msilib.schema import ListView
from pyexpat import model
from django.shortcuts import render
from django.views import generic
from . import models
class Index(generic.TemplateView):
template_name = 'catalog/index.html'
def get_context_data(self, **kwargs):
context = super().get... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###########################################################################
import itertools
import numpy as np
import onnx
from onnx import helper, numpy_helper
... |
_base_ = '../faster_rcnn/faster_rcnn_r50_caffe_fpn_mstrain_1x_coco.py'
model = dict(
roi_head=dict(bbox_head=dict(num_classes=2))
)
# Dataset path
DDSM_TRAIN_DATASET = '/home/hqvo2/Projects/Breast_Cancer/data/processed_data/mass/train'
DDSM_TRAIN_ANNOTATION = DDSM_TRAIN_DATASET + '/annotation_coco_with_classes_ex... |
# Generated by Django 2.2.24 on 2021-12-13 11:34
from django.db import migrations
import phone_field.models
class Migration(migrations.Migration):
dependencies = [
('projawards', '0006_profile'),
]
operations = [
migrations.RemoveField(
model_name='profile',
name... |
from pendium import app
def load_config():
# Load default config
app.config.from_object("pendium.default_config")
# Load config.py in server root
try:
app.config.from_object("config")
except:
pass
# Load any other config passed via env
try:
app.config.from_envvar(... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
####################
# Preliminary
####################
#~~~~~~~~~~~~~~~~~~
# import packages
#~~~~~~~~~~~~~~~~~~
import argparse
import os
def main():
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Inputs
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
parser = argparse.ArgumentP... |
# 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 in writing, ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 OpenStack, LLC.
# 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
# ... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
@__Create Time__ = 2017/12/11 14:38
@__Description__ = " "
"""
from django.views.generic import ListView, DetailView, TemplateView
from ... import models
# 前端首页
class IndexView(ListView):
queryset = models.Article.objects.filter(status=True)
template_name = ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import math
import json
import cv2
import os
from collections import defaultdict
import pycocotools.coco as coco
import torch
import torch.utils.data as data
from utils.image import flip, c... |
'''
MIT License
Copyright (c) 2019 Fanjin Zeng
This work is licensed under the terms of the MIT license, see <https://opensource.org/licenses/MIT>.
'''
import numpy as np
from random import random
import matplotlib.pyplot as plt
from matplotlib import collections as mc
from collections import deque
class Line():
... |
"""Provides device triggers for sensors."""
import voluptuous as vol
from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA
from homeassistant.components.device_automation.exceptions import (
InvalidDeviceAutomationConfig,
)
from homeassistant.components.homeassistant.triggers import (
... |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import json
import unittest
from pants.testutil.subsystem.util import init_subsystem
from pants.contrib.python.checks.checker.common import CheckstylePlugin
from pants.contrib.python.che... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... |
import requests
from sample_applications.AgentlessSpSample.Configuration.ConfigurationManager import ConfigurationManager
from sample_applications.AgentlessSpSample.Utils import UrlUtil
from sample_applications.AgentlessSpSample.Utils.SpConstants import SpConstants
def pickup_attributes(reference_value):
# Picku... |
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PRO... |
import os
from setuptools import Command, find_packages, setup
requirements = [
"numpy",
"pandas",
"plotly",
"jupyter",
"jupytext",
"tqdm",
"matplotlib",
]
dev_requirements = [
"black",
"bumpversion",
"flake8",
"isort",
"pytest",
"coverage",
"pytest-cov",
"... |
# ----------------------------------------------------------
# --- Quick 'n' dirty CANIM file compiler
#
# File: compress_canim_vw
# Author: Jille
# Revision: 3
# Purpose: Compress canim startup images files. This version works for VW
# Comments: Usage: compress-canim.py <original-file> <ne... |
import argparse
import random
import numpy as np
import torch
from tsformer.exp_autoformer import Exp_Main
fix_seed = 2021
random.seed(fix_seed)
torch.manual_seed(fix_seed)
np.random.seed(fix_seed)
parser = argparse.ArgumentParser(
description='Autoformer & Transformer family for Time Series Forecasting')
# ba... |
# -*- coding: utf-8 -*-
"""
blockdiag.sphinx_ext
~~~~~~~~~~~~~~~~~~~~
Allow blockdiag-formatted diagrams to be included in Sphinx-generated
documents inline.
:copyright: Copyright 2010 by Takeshi Komiya.
:license: BSDL.
"""
import os
import re
import posixpath
import traceback
import pkg_reso... |
"""
If you select multiple lines in a Python file and type '#', then all selected
lines are commented out.
A different character is used in other programming languages. This can be
configured with comment_prefix in filetypes.toml.
"""
from __future__ import annotations
from typing import Optional
from porcupine impo... |
_base_ = [
'../../_base_/models/tsm_r50.py', '../../_base_/schedules/sgd_tsm_50e.py',
'../../_base_/default_runtime.py'
]
# model settings
model = dict(
backbone=dict(
non_local=((0, 0, 0), (1, 0, 1, 0), (1, 0, 1, 0, 1, 0), (0, 0, 0)),
non_local_cfg=dict(
sub_sample=True,
... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# Modified by: Zhipeng Han
"""
An awesome colormap for really neat visualizations.
Copied from Detectron, and removed gray colors.
"""
from __future__ import absolute_import, division, print_function
import numpy as np
__all__ = ["colormap", "r... |
from serial_port import Port
port = Port("com4",115200,1)
send_str="AT\r\n"
send_bytes = bytes(send_str, encoding="utf8")
port.Send_data(send_bytes)
# for each_char in send_bytes:
# port.Send_data(each_char)
print(str(port.Read_size(20),encoding="utf8"))
print("123\r\n123123")
#byte=bytes("123123", encoding="ut... |
import socket
import pytest
from eventlet import wsgi
from mock import patch
from werkzeug.contrib.fixers import ProxyFix
from nameko.exceptions import ConfigurationError
from nameko.web.handlers import HttpRequestHandler, http
from nameko.web.server import (
BaseHTTPServer, HttpOnlyProtocol, WebServer, parse_add... |
# from helper import sample_exp_two_sides, sample_rand_uniform
import random
import math
def sample_rand_uniform():
RAND_MAX = 2147483647
return (random.randint(0, RAND_MAX) + 1) * 1.0 / (RAND_MAX + 2)
def sample_exp_two_sides(lambda_):
RAND_MAX = 2147483647
pos_or_neg = random.randint(0, RAND_MAX)
... |
#!/usr/bin/python -W ignore::DeprecationWarning
# -*- coding: utf-8 -*-
###
#
# Query vCloud Director api for organization details
#
# Author: Sebastian Kirsch
# Date: 08.07.2018
#
###
#
import sys
import json
import requests
import base64
import xml.etree.ElementTree as ET
import argparse
from collections import de... |
import os
try:
import cPickle as pickle
except:
import pickle
import numpy as np
import mxnet as mx
from mxnet.test_utils import almost_equal, assert_almost_equal
from fold import Fold, rnn
from model import SimilarityTreeLSTM
def _indent(s_, numSpaces):
s = s_.split('\n')
s = [(numSpaces * ' ') + lin... |
import random
from utils.utils import get_random_string
categories_list = [
"Industrial & Scientific",
"Industrial Labeling Tape",
"Office Labeling Tapes",
"Books",
"Physics",
"Health & Personal Care",
]
bsr_list = [
[
"Industrial & Scientific",
"Industrial Labeling Tape",... |
#!/usr/bin/env python3
# author: Bartlomiej "furas" Burek (https://blog.furas.pl)
# date: 2020.12.16
import os
import telebot
TOKEN = os.getenv('TELEGRAM_TOKEN')
bot = telebot.TeleBot(TOKEN)
users_id = [1079414868]
@bot.message_handler(commands=['authorize'])
def start_command(message):
print(message.chat.id... |
# Copyright 2016-2017 Capital One Services, 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 ... |
# Copyright 2020 The PEGASUS 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... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, wayzon and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class CounterStock(Document):
pass
|
import ccllib as lib
from pyutils import _vectorize_fn, _vectorize_fn_simple, np, check
dNdz_types = {
'nc': lib.DNDZ_NC,
'wl_cons': lib.DNDZ_WL_CONS,
'wl_fid': lib.DNDZ_WL_FID,
'wl_opt': lib.DNDZ_WL_OPT
}
class PhotoZFunction(object):
"""A user-defined photo-z functi... |
'''
Created on 24 Jul 2019
@author: daim
'''
# django
from django.urls import reverse
from django.template.loader import render_to_string
# 3rd app
import django_tables2 as tables
# models
from etilog.ViewLogic.queries import get_tags
from .models import ImpactEvent
from etilog.forms.fields_filter import dom_icon_dic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.