filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_22883 | #/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
# 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 requir... |
the-stack_106_22884 | import sys
import argparse
import logging
import getpass
import os
from . import samTobed
from . import pyWriter
from . import henipipe
POLL_TIME = 5
LOG_PREFIX = '[HENIPIPE]: '
# Set up a basic logger
LOGGER = logging.getLogger('something')
myFormatter = logging.Formatter('%(asctime)s: %(message)s')
handler = loggin... |
the-stack_106_22885 | # encoding: utf-8
"""
Created by Kaijun on 2020/9/13
"""
import struct
import serial
import Queue
import threading
import time
# CE FA 03 18 76 0E 5C 03 F0 FF 88 3C E0 FF A2 00 84 00 00 A2 FF E0 00 84 F4 01 20 03 CE FA 03 18 76 0E 34 03 4C FF 70 3C E5 FF 9C 00 88 00 00 9C FF E5 00 88 F4 01 20 03
def do_parse(ext_type... |
the-stack_106_22889 | # Copyright 2016-2020 Faculty Science Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
the-stack_106_22890 | import os
import math
import numpy as np
from common.realtime import sec_since_boot, DT_MDL
from common.numpy_fast import interp
from selfdrive.swaglog import cloudlog
from selfdrive.controls.lib.lateral_mpc import libmpc_py
from selfdrive.controls.lib.drive_helpers import CONTROL_N, MPC_COST_LAT, LAT_MPC_N, CAR_ROTATI... |
the-stack_106_22891 | # coding:utf-8
#
# 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
# distr... |
the-stack_106_22892 | # Copyright (c) 2008-2009 AG Projects
# Author: Denis Bilenko
#
# 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... |
the-stack_106_22894 | # Copyright 2019 Ross Wightman
# 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... |
the-stack_106_22895 | from tkinter import *
from tkinter import ttk
def calculate(*args):
try:
value = float(feet.get())
meters.set((0.3048 * value * 10000.0 + 0.5)/10000.0)
except ValueError:
pass
root = Tk()
root.title("Feet to Meters")
root.geometry("400x300+0+0")
mainframe = ttk.Frame(root, padding="3 ... |
the-stack_106_22896 | from Calc2D.CalculationClass import Calculation
import time
import numpy as np
from concurrent.futures import ThreadPoolExecutor
from tornado.ioloop import IOLoop
from tornado import gen
import tornado.web
import tornado.websocket
import os
import os.path
import json
import unicodedata
import logging
imp... |
the-stack_106_22897 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import standalone
"""
This test ensure `inherit_id` update is correctly replicated on cow views.
The view receiving the `inherit_id` update is either:
1. in a module loaded before `website`. In that case... |
the-stack_106_22898 | """A connector for Twitch."""
import asyncio
import os
import re
import logging
import aiohttp
import json
import secrets
import hashlib
import hmac
from voluptuous import Required
from opsdroid.connector import Connector, register_event
from opsdroid.events import Message, JoinRoom, DeleteMessage, LeaveRoom, BanUser... |
the-stack_106_22899 | import numpy as np
class HMMModel(object):
def __init__(self, state_size, observe_size):
self.state_size = state_size
self.observe_size = observe_size
#状态转移矩阵,state[i][j]表示从状态i转移到状态j的概率
self.state = np.zeros((state_size, state_size))
#观测概率矩阵,observe[i][j]表示状态i下生成观测... |
the-stack_106_22900 | #!/usr/bin/env python
import argparse
import sys
from es_backup.repository import *
from es_backup.snapshot import *
from es_backup.backup import *
from jinja2 import Environment, PackageLoader
def render_template(template, **variables):
env = Environment(loader=PackageLoader('es_backup', 'templates'))
templ... |
the-stack_106_22901 | # 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, ... |
the-stack_106_22904 | import datetime
import json
import jwt
import requests
from django.conf import settings
def request_file_list(job, path, recursive, user_id=None):
"""
Requests the file list for a job
:param job: The CwFollowupJob instance to get the status of
:param user_id: On optional user id to make the request ... |
the-stack_106_22908 |
# jsc 是一种基于json的文件格式,在json基础上拓展了一些新的特性支持
# 该模块会将jsc解析成json格式
import json
import sys
import os
import traceback
import platform
# 目前支持的platforms
support_platforms = [
"Windows",
"Linux"
]
#########################################################################################################
# utils
#######... |
the-stack_106_22910 | # Copyright The OpenTelemetry 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 ... |
the-stack_106_22911 | import logging
from .what_if_index_creation import WhatIfIndexCreation
class CostEvaluation:
def __init__(self, db_connector, cost_estimation="whatif"):
logging.debug("Init cost evaluation")
self.db_connector = db_connector
self.cost_estimation = cost_estimation
logging.info("Cost... |
the-stack_106_22912 | import os
import logging
import pathlib
# from importlib import resources
# for now using importlib_resources instead of importlib
# for compatibility with python 3.8
import importlib_resources as resources
import click
from . import config
DATEFMT = "%Y/%m/%d %H:%M:%S"
# https://stackoverflow.com/a/56944256/13333... |
the-stack_106_22913 | import tensorflow as tf
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
try:
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
except RuntimeError as e:
print(e)
import tensorflow.keras as keras
import numpy as np
import utils
import sys
import... |
the-stack_106_22914 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Marc Sensenich <hello@marc-sensenich.com>
# Copyright (c) 2017 Ansible Project
# 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__ = t... |
the-stack_106_22916 | #!/usr/bin/env python
import os
import sagemaker
import sys
import time
govuk_environment = os.environ["GOVUK_ENVIRONMENT"]
image = os.environ["IMAGE"]
role = os.environ["ROLE_ARN"]
training_data = os.environ["SCRIPT_INPUT_DATA"].strip()
image_tag = os.getenv("IMAGE_TAG", "latest")
s3_bucket = os.getenv("S3_BUCKET",... |
the-stack_106_22917 | # System libs
import os
import time
# import math
import random
import argparse
from distutils.version import LooseVersion
# Numerical libs
import torch
import torch.nn as nn
from torch.utils.tensorboard import SummaryWriter
# Our libs
from config import cfg
from dataset import TrainDataset
from models import ModelBuil... |
the-stack_106_22918 | # Simple script to calculate halo/subhalo mass functions from hdf5
#
# ... |
the-stack_106_22921 | #!/usr/bin/python
# -*- encoding: utf-8 -*-
from secretpy import alphabets as al
from .polybius_square import PolybiusSquare
from itertools import cycle
class Bazeries:
"""
The Bazeries Cipher
"""
def __crypt(self, alphabet, text, key, is_encrypt=True):
# prepare digit key
temp = key[... |
the-stack_106_22923 | # -*- coding: utf-8 -*-
import asyncio
import json
import logging
import os
import re
import warnings
from typing import Optional, List, Text, Any, Dict, TYPE_CHECKING, Iterable
import rasa.utils.io as io_utils
from rasa.constants import DOCS_BASE_URL
from rasa.core import utils
from rasa.core.constants import INTENT_... |
the-stack_106_22924 | class ListNode():
def __init__(self, x):
self.val = x
self.next = None
def make_list(A):
head = ListNode(A[0])
ptr = head
for i in A[1:]:
ptr.next = ListNode(i)
ptr = ptr.next
return head
class SubtractList():
# @param A : head node of linked list
# @return... |
the-stack_106_22925 | """
Parses OpenAPI spec files and other related classes
MIT License
(C) Copyright [2020] Hewlett Packard Enterprise Development LP
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 restric... |
the-stack_106_22930 | # 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 ... |
the-stack_106_22931 | # This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list o... |
the-stack_106_22932 | from LucidDynamodb import DynamoDb
from LucidDynamodb.exceptions import (
TableNotFound
)
import logging
logging.basicConfig(level=logging.INFO)
if __name__ == "__main__":
try:
db = DynamoDb()
db.delete_table(table_name='dev_jobs')
logging.info("Table deleted successfully")
tabl... |
the-stack_106_22934 | # @author Avtandil Kikabidze
# @copyright Copyright (c) 2008-2014, Avtandil Kikabidze aka LONGMAN (akalongman@gmail.com)
# @link http://long.ge
# @license GNU General Public License version 2 or later;
import os
import sys
import re
import sublime
import subprocess
import cssbeautifier
class CssFormatter:
... |
the-stack_106_22935 | # coding: UTF-8
import torch
import torch.nn as nn
import numpy as np
class Config(object):
"""配置参数"""
def __init__(self, dataset, embedding):
self.model_name = 'TextRNN'
self.train_path = dataset + '/data/train.csv' # 训练集
self.dev_path = dataset + '/dat... |
the-stack_106_22936 | ovr = [0.115, -0.2921, 0.9834]
hr = [0.1, 0.188, 2.33]
knobs = {
1: [-0.148, 0.22, 1.243], # botright
2: [-0.271, 0.22, 1.243], # botleft
3: [-0.148, 0.22, 1.357], # topright
4: [-0.271, 0.22, 1.357], # topleft
}
for n in range(1, 4 + 1):
p = [ovr[i] - hr[i] + knobs[n][i] for i in range(3)]
... |
the-stack_106_22944 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... |
the-stack_106_22947 | """
Univariate Kernel Density Estimators
References
----------
Racine, Jeff. (2008) "Nonparametric Econometrics: A Primer," Foundation and
Trends in Econometrics: Vol 3: No 1, pp1-88.
http://dx.doi.org/10.1561/0800000009
http://en.wikipedia.org/wiki/Kernel_%28statistics%29
Silverman, B.W. Density Estimation... |
the-stack_106_22948 | # Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from datadog_api_client.v1.model_utils import ( # noqa: F401
ApiTypeError,
Mo... |
the-stack_106_22951 | import sys
import os
import torch
import pandas as pd
import datetime
from argparse import ArgumentParser
from torch import nn, optim
import torch.nn.functional as F
from torch.utils.data import DataLoader, random_split
import pytorch_lightning as pl
from pytorch_lightning.metrics import functional as FM
from network... |
the-stack_106_22953 | import logging, multiprocessing, signal, time, timeit
from multiprocessing import Pool, Manager
from classes.game import Game
from classes.reader import Grabber
from classes.gui import Screen
from classes.environment import Environment
from classes.agent import Agent
from consts import EMULATOR_PATH, ROM_PATH, ROM_NA... |
the-stack_106_22955 | # -*- encoding: utf-8 -*-
import math
from ascii_table import ascii_table
class Data:
def __init__(self, *numbers):
self.numbers = list(numbers)
self.numbers.sort()
@property
def median(self):
length = len(self.numbers)
if length % 2 == 0:
return Data(*self.nu... |
the-stack_106_22956 | # coding: utf-8
"""
Pure Storage FlashBlade REST 1.7 Python SDK
Pure Storage FlashBlade REST 1.7 Python SDK, developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/).
OpenAPI spec version: 1.7
Contact: i... |
the-stack_106_22957 | import os
import re
import subprocess
import botocore
import boto3
import time
from packaging.version import Version
import pytest
import requests
from urllib3.util.retry import Retry
from invoke.context import Context
from botocore.exceptions import ClientError
from src.buildspec import Buildspec
from test.test_uti... |
the-stack_106_22958 | import matplotlib.pyplot as plt
import Variables as prep
import pandas as pd
import calendar
import shutil
import os
d = pd.read_csv('data.csv', encoding = "utf-8")
text_counts = d.groupby(['month', 'person'])['text'].count().reset_index(name='count')
days_count = d['dateTime'].dropna()
yearStart = (pd.t... |
the-stack_106_22959 | import os
import json
import numpy as np
import tensorflow as tf
from collections import OrderedDict
# these weights have been trained over thousands of images. They are designed to be multiplied by the loss
# of each layer to normalize the loss differential from layer to layer
layer_weights = {
"conv1_1": {
"c... |
the-stack_106_22963 | # 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 Dd4hep(CMakePackage):
"""DD4hep is a software framework for providing a complete solution ... |
the-stack_106_22966 | import numpy as np
import cv2
import timeit
import hdf5storage
import math
import TrainNetwork.TN_BaseFunctions as basefunctions
from copy import copy
from copy import deepcopy as deepcopy
from MovingObjectDetector.BackgroundModel import BackgroundModel
from MovingObjectDetector.DetectionRefinement import DetectionRefi... |
the-stack_106_22967 | import os
import numpy as np
import pandas as pd
from torchvision import transforms as tf
from utils.face_processing import RandomLowQuality, RandomHorizontalFlip
import config as cfg
from utils.io import makedirs
import cv2
from skimage import io
from utils import face_processing as fp, face_processing
# To avoid e... |
the-stack_106_22968 | import argparse
import os
import random
import shutil
import time
import warnings
import sys
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.optim
import torch.multiprocessing as mp
import torch.utils.data
import torch.utils... |
the-stack_106_22970 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 17 15:22:07 2017
@author: jkcm
"""
import matplotlib.pyplot as plt
from matplotlib.dates import date2num
import numpy as np
import os
import glob
import xarray as xr
from importlib import reload
import pickle
import netCDF4 as nc
from scipy.stats... |
the-stack_106_22971 | import os
import uuid
import dj_database_url
DEBUG = bool(os.environ.get('DEBUG', False))
TEST = bool(os.environ.get('TEST', False))
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
PROJECT_DIR = os.path.dirname(__file__)
DEFAULT_DATABASE_URL = "sqlite:///%s" % o... |
the-stack_106_22974 | from collections import Counter
import numpy as np
from scipy.signal import find_peaks, peak_widths
from sklearn.cluster import dbscan
from scipy.spatial.distance import euclidean
def find_anchors(pos, min_count=3, min_dis=20000, wlen=800000, res=10000):
min_dis = max(min_dis//res, 1)
wlen = min(wlen... |
the-stack_106_22976 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
15パズルを解く
"""
def main():
"""
動作確認
"""
pattern = [[1, 2, 6, 3], [4, 5, 0, 7], [8, 9, 10, 11], [12, 13, 14, 15]]
puzzle = Puzzle15(pattern)
print(puzzle.start)
print(puzzle.goal)
result = puzzle.solve()
if result == -2:
pri... |
the-stack_106_22978 | # coding: utf-8
from __future__ import unicode_literals
import itertools
import json
import os.path
import random
import re
import time
import traceback
from .common import InfoExtractor, SearchInfoExtractor
from ..jsinterp import JSInterpreter
from ..swfinterp import SWFInterpreter
from ..compat import (
compa... |
the-stack_106_22979 | from flask import session
from flask_login import current_user
from app.models import Answer, Sentence
def _get_user():
return current_user if current_user.is_authenticated else None
def correct_answers(id):
attempt = session.get('attempt')
# Collection of correct answers previously given, returning j... |
the-stack_106_22982 | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
the-stack_106_22983 | # -*- 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 ------------------------------------------------------------... |
the-stack_106_22984 | """A module for consuming the Penn Libraries API"""
import requests
BASE_URL = "http://dla.library.upenn.edu/2.0.0/search"
def search(query):
"""Search Penn Libraries Franklin for documents
The maximum pagesize currently is 50.
"""
params = {
's.cmd': 'setTextQuery(%s)setPageSize(50)setHoldin... |
the-stack_106_22985 | """
We use this validator to filter transparent ips, and give the ip resources an
initial score.
"""
import json
import requests
from json.decoder import JSONDecodeError
from scrapy.http import Request
from scrapy.spidermiddlewares.httperror import HttpError
from twisted.internet.error import (DNSLookupError, Connecti... |
the-stack_106_22986 | '''
Created on 17 nov. 2019
@author: Juan Carlos Ruiloba
'''
from odoo import models, fields, api
class taller(models.Model):
_name = 'upocar.taller'
_rec_name = "nombre"
cif = fields.Char("CIF del taller", size=9, required=True)
nombre = fields.Char("Nombre del taller", size=64, required=True)... |
the-stack_106_22987 | # Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accom... |
the-stack_106_22989 | import random
from . import signals
from django import forms
from .models import DeferredAction
from .main import LONG
class DeferredFormMixIn(object):
"""
This is a MixIn class, so that you can also build deferred forms
from already existing modified ModelForm classes.
If you build your form from sc... |
the-stack_106_22991 | #!/usr/bin/env python3
# Copyright 2019 Tetrate
#
# 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 ag... |
the-stack_106_22992 | #import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
# This program uses regression method of ML
# Using airfoil data from here : https://archive.ics.uci.edu/ml/datasets/Airfoil+Self-Noise
# load the data
df = pd.read_csv('https... |
the-stack_106_22994 |
# -*- coding: utf-8 -*
import os
import json
from datetime import datetime, timedelta
from django.core.urlresolvers import reverse
from django.forms import ValidationError
from django.test.utils import override_settings
from django.utils import translation
import mock
from rest_framework.response import Response
fr... |
the-stack_106_22995 | # -*- coding: utf-8 -*-
"""
@date: 2021/3/15 下午8:05
@file: test_cifar.py
@author: zj
@description:
"""
import numpy as np
from rotnet.data.datasets.cifar import CIFAR
def test_cifar10():
root_data = './data/cifar'
data_set = CIFAR(root_data, is_cifar100=False)
print(data_set.classes)
print(len(da... |
the-stack_106_22997 | import viewflow
from airflow.sensors.external_task_sensor import ExternalTaskSensor
from viewflow.create_dag import ParseContext
from unittest.mock import MagicMock, patch, ANY
def test_parse_external_dependencies():
parsed = viewflow.parse_dag_dir(
"./tests/projects/external_deps/dag_2", ParseContext(da... |
the-stack_106_22998 | # coding: utf-8
#
# Copyright 2018 The Oppia 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 requi... |
the-stack_106_23001 | # Definition for an interval.
class Interval:
def __init__(self, s=0, e=0):
self.start = s
self.end = e
class Solution:
def merge(self, intervals):
"""
:type intervals: List[Interval]
:rtype: List[Interval]
"""
intervals.sort(key=lambda x:x.start)
... |
the-stack_106_23002 | import sys
import argparse
import numpy as np
import tensorflow as tf
from load_mnist import MNIST
import data_utils
import model
tf.logging.set_verbosity(tf.logging.INFO)
MODELS = ['simpleNN']
def get_simple_nn_experiment(args):
"""
Function for creating an experiment using the SimpleNN model on MNIST
... |
the-stack_106_23003 | def bits(i):
I = 0
ret = []
while i:
if i & 1:
ret.append(I)
I += 1
i >>= 1
return ret
def all_keys(sol, inds, num_keys):
keys = [False for i in range(num_keys)]
for i in inds:
for j in sol[i]:
keys[j] |= True
return all(keys)
def next_combination(a, n):
k = len(a)
for i... |
the-stack_106_23004 | import numpy as np
import pandas as pd
from scipy.stats import mode
from sklearn.preprocessing import normalize
from sklearn.preprocessing import StandardScaler
def change_labels(sample, n_sleep_stages=1):
"""
Returns:
sample - contains only label 1(awake) and 0(sleep) for polisomnography if n_sleep_stages... |
the-stack_106_23005 | import torch
import numpy as np
class NME:
def __init__(self, nme_left_index, nme_right_index):
self.nme_left_index = nme_left_index
self.nme_right_index = nme_right_index
def __repr__(self):
return "NME()"
def test(self, label_pd, label_gt):
sum_nme = 0
... |
the-stack_106_23006 | import pendulum
from dagster_graphql.test.utils import (
execute_dagster_graphql,
infer_repository_selector,
infer_sensor_selector,
main_repo_location_name,
main_repo_name,
)
from dagster.core.definitions.run_request import InstigatorType
from dagster.core.scheduler.instigation import InstigatorSta... |
the-stack_106_23007 | import inspect
from trac.core import *
from trac.web import IRequestHandler
from trac.web.chrome import ITemplateProvider
from trac.ticket import TicketSystem
import json
import pkg_resources
def custom_json(obj):
return json.dumps(obj, cls=MagicEncoder)
class TracMobilePlugin(Component):
implements(ITempl... |
the-stack_106_23009 | import time
import warnings
from typing import Optional, Tuple
import numpy as np
from stable_baselines3.common.vec_env.base_vec_env import (
VecEnv,
VecEnvObs,
VecEnvStepReturn,
VecEnvWrapper,
)
class VecMonitor(VecEnvWrapper):
"""
A vectorized monitor wrapper for *vectorized* Gym environme... |
the-stack_106_23012 | # Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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... |
the-stack_106_23014 | # Copyright (c) 2007-2013 Cyrus Daboo. 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 req... |
the-stack_106_23016 | # Copyright [2019] [Christopher Syben, Markus Michen]
#
# 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 ... |
the-stack_106_23020 | # Licensed under the BSD 3-Clause License
# Copyright (C) 2021 GeospaceLab (geospacelab)
# Author: Lei Cai, Space Physics and Astronomy, University of Oulu
__author__ = "Lei Cai"
__copyright__ = "Copyright 2021, GeospaceLab"
__license__ = "BSD-3-Clause License"
__email__ = "lei.cai@oulu.fi"
__docformat__ = "reStructur... |
the-stack_106_23024 | # -*- coding: utf-8 -*-
"""
General description:
---------------------
This script shows how use the custom component `solph.custom.Link` to build
a simple transshipment model.
Installation requirements:
---------------------------
This example requires the latest version of oemof. Install by:
pip install oemof
... |
the-stack_106_23026 | # Copyright 2015 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... |
the-stack_106_23027 | #!/usr/bin/python
import os
import shutil
import subprocess
import pdb
############################################################
# Build script
# ------------
# This script will build our project into build/ directory.
#
#
# Prerequisite
# ------------
# - brew install cmake
#
#####################################... |
the-stack_106_23028 | import re
from biothings.utils.web.es_dsl import AsyncSearch
from biothings.web.handlers.exceptions import BadRequest
from biothings.web.pipeline import ESQueryBuilder
class MyGenesetQueryBuilder(ESQueryBuilder):
def default_string_query(self, q, options):
search = super().default_string_query(q, option... |
the-stack_106_23030 | from hashlib import sha256
from typing import Mapping, NamedTuple, Dict
from common.serializers.serialization import serialize_msg_for_signing
from plenum.common.constants import REQKEY, FORCE, TXN_TYPE, OPERATION_SCHEMA_IS_STRICT
from plenum.common.messages.client_request import ClientMessageValidator
from plenum.com... |
the-stack_106_23031 | from typing import List, Tuple
import sympy
import torch
import numpy as np
from sklearn.metrics import f1_score
from sympy import to_dnf, lambdify
def test_explanation(formula: str, x: torch.Tensor, y: torch.Tensor, target_class: int):
"""
Tests a logic formula.
:param formula: logic formula
:para... |
the-stack_106_23032 | import json
import os
from pathlib import Path
from typing import Callable, List, Optional
import numpy as np
import scipy.sparse as sp
import torch
from torch_geometric.data import Data, InMemoryDataset, download_url
class AmazonProducts(InMemoryDataset):
r"""The Amazon dataset from the `"GraphSAINT: Graph Sam... |
the-stack_106_23033 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
from setuptools import setup, find_packages
from docs import getVersion
# Variables ===================================================================
... |
the-stack_106_23034 | from pyramid.httpexceptions import HTTPForbidden
from pyramid.httpexceptions import HTTPUnauthorized
from pyramid.httpexceptions import HTTPUnprocessableEntity
from pyramid.response import Response
from pyramid.view import view_config
from libweasyl.text import markdown, slug_for
from libweasyl import ratings
from we... |
the-stack_106_23036 | from RedmineAPI.Utilities import FileExtension, create_time_log
import shutil
import os
from RedmineAPI.Access import RedmineAccess
from RedmineAPI.Configuration import Setup
from Utilities import CustomKeys, CustomValues
class Automate(object):
def __init__(self, force):
# create a log, can be written... |
the-stack_106_23037 | import logging
from dataclasses import dataclass
from itertools import islice
from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence
from lhotse.utils import JsonMixin, Seconds, YamlMixin, asdict_nonull, exactly_one_not_null, fastcopy, \
index_by_id_and_check, \
perturb_num_samples, split_s... |
the-stack_106_23038 | import traceback
import sys
from NewLifeUtils.FileModule import DataStorage
from NewLifeUtils.LoggerModule import cstm, smart_format
default_lang = {
"type": "Type",
"unknown": "Unknown Error",
"about": "More information",
"attention": "Attention",
"info": "Info",
"warning": "Warn",
"error... |
the-stack_106_23040 | import importlib
import sys
import logging
import os.path
import threading
import copy
import dexbot.errors as errors
from dexbot.strategies.base import StrategyBase
from bitshares.notify import Notify
from bitshares.instance import shared_bitshares_instance
log = logging.getLogger(__name__)
log_workers = logging.ge... |
the-stack_106_23043 | from __future__ import print_function
from typing import List
from gphotospy import authorize
from gphotospy.album import *
from gphotospy.media import *
"""
https://dev.to/davidedelpapa/manage-your-google-photo-account-with-python-p-1-9m2
"""
def main():
service = authorize.init('credentials.json')
new_a... |
the-stack_106_23044 | # Tai Sakuma <tai.sakuma@gmail.com>
##__________________________________________________________________||
def IsROOTNullPointer(tobject):
try:
tobject.GetName()
return False
except ReferenceError:
return True
##__________________________________________________________________||
def i... |
the-stack_106_23045 | # -*- coding: utf-8 -*-
# @Author: MaxST
# @Date: 2019-09-08 23:10:00
# @Last Modified by: MaxST
# @Last Modified time: 2019-09-15 20:17:33
import base64
from dynaconf import settings
from kivy.app import App
from kivy.core.image import Image as CoreImage
from kivy.lang import Builder
from kivy.logger import Logge... |
the-stack_106_23047 | # This file is part of the P3IV Simulator (https://github.com/fzi-forschungszentrum-informatik/P3IV),
# copyright by FZI Forschungszentrum Informatik, licensed under the BSD-3 license (see LICENSE file in main directory)
import os
import pickle
import time
from datetime import datetime
from pprint import pprint
import... |
the-stack_106_23048 | from pypy.translator.simplify import get_graph
from pypy.tool.compat import md5
def get_statistics(graph, translator, save_per_graph_details=None, ignore_stack_checks=False):
seen_graphs = {}
stack = [graph]
num_graphs = 0
num_blocks = 0
num_ops = 0
per_graph = {}
while stack:
graph... |
the-stack_106_23051 | # 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... |
the-stack_106_23052 | import sys
H, W, Q = map(int, input().split())
h = [[0] * W for _ in range(H)]
for i in range(H):
for j in range(W):
print('1 1 {} {}'.format(i+1, j+1))
sys.stdout.flush()
h[i][j] = int(input())
for _ in range(Q):
Si, Sj, Ti, Tj = map(lambda x: int(x)-1 ,input().split())
if ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.