text stringlengths 3.07k 12.6k |
|---|
from transformers import BertTokenizer, TFBertForSequenceClassification
from transformers import InputExample, InputFeatures
import tensorflow as tf
import pandas as pd
model = TFBertForSequenceClassification.from_pretrained("bert-base-uncased")
tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
# The shu... |
"""simple pattern matching"""
from collections import defaultdict
import collections.abc as abc
def match(pattern, subject):
"""whether `subject` matches `pattern`"""
return Matcher()(pattern, subject)
class Matcher:
def __init__(self, num_variables=0):
self.vars = tuple(Variable() for _ in ra... |
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
from pathlib import Path
import pandas as pd
import csv
from collections import OrderedDict
import numpy as np
import sys
import argparse
import os
import re
import plotly.express as px
#import Levenshtein
class count_spacers:
def __init__(self,prefix,input_file, fastq_file, output_file, gRNA_len):
pr... |
# Copyright 2019 The TensorFlow Authors.
# Licensed under the Apache License, Version 2.0 (the "License");
#
#@title 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/lic... |
# This file is part of datacube-ows, part of the Open Data Cube project.
# See https://opendatacube.org for more information.
#
# Copyright (c) 2017-2021 OWS Contributors
# SPDX-License-Identifier: Apache-2.0
import os
from unittest.mock import MagicMock, patch
import flask
import pytest
def test_fake_creds(monkeyp... |
#
# Copyright 2018 the original author or 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... |
# pylint: disable=redefined-outer-name
import json
from pathlib import Path
from tempfile import NamedTemporaryFile, TemporaryDirectory
from typing import List, Union
from pytest import mark, raises
from jupyterblack.__main__ import run
from jupyterblack.util.files import read_file
class Spec:
def __init__(self... |
# Copyright 2018 The TensorFlow Probability 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 o... |
import discord
from discord.app import Option, OptionChoice
from discord.ext import commands
from extra import utils
import os
admin_role_id = int(os.getenv('ADMIN_ROLE_ID'))
owner_role_id = int(os.getenv('OWNER_ROLE_ID'))
mod_role_id = int(os.getenv('MOD_ROLE_ID'))
allowed_roles = [owner_role_id, admin_role_id, mod_r... |
import angr
import claripy
import logging
l = logging.getLogger("angr_tests")
import os
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
def _verify_results(pg, sargc, length=400):
argcs = pg.mp_found.solver.eval(sargc)
strs = pg.mp_found.solver.eval(... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(GraphAttentionLaye... |
import json
import sys
from collections import defaultdict, UserDict
from typing import Dict, List, Iterator, Iterable, Union, TypeVar, Optional, Callable
import attr
if sys.version_info < (3, 9):
raise RuntimeError("This module requires Python 3.9 or higher")
def clean_str_to_alphanum(word: str) -> str:
re... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This is a real time example how to implement DTLN tf light model with
sounddevice. The script is based on the "wire.py" example of the sounddevice
toolbox. If the command line shows "input underflow", restart the script.
If there are still a lot of dropouts, increase... |
import numpy as np
import logging
"""
These are the encoding methods for nasbench101.
The plan is to unify encodings across all search spaces.
"""
logger = logging.getLogger(__name__)
INPUT = 'input'
OUTPUT = 'output'
CONV3X3 = 'conv3x3-bn-relu'
CONV1X1 = 'conv1x1-bn-relu'
MAXPOOL3X3 = 'maxpool3x3'
OPS = [CONV3X3, C... |
# This file is part of MaixUI
# Copyright (c) sipeed.com
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
#
import sys, time
from fpioa_manager import fm
from Maix import FPIOA, GPIO
class button_io:
home_button = None
next_button = None
back_button = None
... |
"""Provides a light for Home Connect."""
import logging
from math import ceil
from homeconnect.api import HomeConnectError
from openpeerpower.components.light import (
ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
LightEntity,
)
from openpeerpower.const import CONF_ENTITIES
im... |
#!/usr/bin/env python
# coding: utf8
""" Spectrogram specific data augmentation """
# pylint: disable=import-error
import numpy as np
import tensorflow as tf
import math
import librosa
import pylab as plt
import librosa.display
import pickle
#from tensorflow.signal import stft, hann_window
from scipy.fftpack import d... |
"""
Driver module for `vara-pc`.
This module provides a command line interface for creating and managing paper
configs.
"""
import argparse
import logging
import typing as tp
from pathlib import Path
from varats.paper_mgmt.paper_config import get_paper_config
from varats.ts_utils.cli_util import cli_list_choice, init... |
# Copyright (c) 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 appli... |
# Copyright 2019 Zuru Tech HK Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
import contextlib
import glob
import os
import shutil
import subprocess
import sys
import tempfile
from distutils import log
from distutils.ccompiler import new_compiler
from distutils.sysconfig import customize_compiler
from distutils.errors import CompileError, LinkError
from pkg_resources import resource_filename
f... |
"""Test module for ConfigurationMap tests."""
import unittest
import unittest.mock as mock
from pathlib import Path
from tempfile import NamedTemporaryFile
from tests.test_utils import ConfigurationHelper
from varats.base.configuration import (
DummyConfiguration,
ConfigurationImpl,
ConfigurationOptionImp... |
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
# Copyright (c) 2017, MD2K Center of Excellence
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditio... |
from django.db.utils import DatabaseError
from que.tasks import get_task_logger
from api.exceptions import ObjectNotFound, InvalidInput, APIError
from api.vm.snapshot.utils import filter_snap_define
from vms.models import Backup
logger = get_task_logger(__name__)
# A backup task can wait for a free backup worker for... |
'''
This module contains a wrapper for Python's built-in json module to make it
easier to use.
'''
__author__ = "<NAME>"
__copyright__ = "Copyright 2014"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "GPL"
__version__ = "0.0.0.3" # file version
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__... |
from __future__ import division
import numpy as np
import cvxopt
cvxopt.solvers.options['show_progress'] = False
cvxopt.solvers.options['abstol'] = 1e-8
cvxopt.solvers.options['reltol'] = 1e-7
cvxopt.solvers.options['feastol'] = 1e-8
import cplex
class QPSolver(object):
def __init__(self, target, models, normal... |
# Copyright 2018 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 agreed to in writing, ... |
#!/usr/bin/env python
"""
Background:
--------
glider_functions.py
Purpose:
--------
History:
--------
"""
import datetime
from io import BytesIO
import pandas as pd
import numpy as np
import seawater as sw
def get_inst_data(filename, **kwargs):
r"""
Parameters
----------
filename : s... |
# Copyright 2017 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, s... |
import os
import logging
import threading
from time import sleep
from telegram import InlineKeyboardMarkup, InlineKeyboardButton
from telegram.ext import (Updater, CallbackQueryHandler, MessageHandler, Filters,
CommandHandler)
from term_utils import Terminal
logging.basicConfig(level=loggin... |
from torchtext.legacy import data
import torch
from tqdm import tqdm
import torch.optim as optim
import torch.nn as nn
import torch
import torch.nn.functional as F
import pandas as pd
import numpy as np
import time
import copy
def evaluate(loader, model, criterion, return_pred=False):
model.eval()
loader.so... |
from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.forms import inlineformset_factory
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth import authenticate, login, logout
# flash message
from django.contrib import messages
from django.contrib.a... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""URL endpoint for the main page which lists recent anomalies."""
import datetime
import logging
from google.appengine.ext import ndb
from dashboard impo... |
import queue
import threading
import time
import typing
import mitmproxy.types
from mitmproxy import command
from mitmproxy import connections
from mitmproxy import controller
from mitmproxy import ctx
from mitmproxy import exceptions
from mitmproxy import flow
from mitmproxy import http
from mitmproxy import io
from ... |
#!/usr/bin/env python3
from time import strptime
import datetime
import shutil
import sys
__author__ = 'jaredchu'
import os
from os.path import expanduser
import random
import help
old_date_format = '%d-%m-%Y'
date_format = '%Y-%m-%d'
def random_file(dir_path):
if (os.path.isdir(dir_path)):
for i in r... |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import base64
import json
import logging
from six.moves.urllib.error import HTTPError
from blinkpy.common.net.network_transaction import NetworkTimeout
from... |
import time
from collections import namedtuple
from enum import Enum
from model import util
from model.settlement_order_gid import settlement_order_gid
class Status(Enum):
INITIAL = 1
SETTLEMENT_PROCESSING = 2
SETTLEMENT_COMPLETE = 3
SETTLEMENT_CLOSED = 4
class TxnType(Enum):
UNKNOWN = 0
NO... |
"""Support for playing sounds."""
import os
import re
import subprocess
import uuid
from typing import Any, Dict, List, Optional, Type
from rhasspy.actor import RhasspyActor
from rhasspy.mqtt import MqttPublish
# -----------------------------------------------------------------------------
# Events
# ----------------... |
#!/usr/bin/env python
# ariadne_worker.py -- Defines a worker process for ariadne.
import os
import sys
import socket
import time
import multiprocessing
import ariadnetools
import ariadneplugin
import pipeline
import ariadne
import threading
def get_arg_dict(toks):
ret_dict={}
for t in toks:
ttoks=t... |
import os, csv, time, shutil, math
from ch import logger
class DeltaHedge():
_log = None
_config = None
_session = None
_instruments = None
_interestRate = None
_fileName = None
_filePath = None
_bckFilePath = None
_headers = None
#Headers
_timeH = None
_stockPriceH = No... |
import logging
import time
import os
class Led:
# create mockup to develop w/o need for an RasPi
mockup = True
try:
import RPi.GPIO as GPIO
mockup = False
except:
pass
def __init__(self, pin_red, pin_green):
# RPi.GPIO pin number for red and green led control
self.pins = [pin_red, pin_gr... |
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
import numpy as np
import pandas as pd
import time
from tqdm import tqdm
import os
import cv2
from models.model_warper import PANDA_Model_Attention_Concat_MultiTask_Headv2
from dataset.patch_extraction import PANDAPatchExtraction
from... |
"""Stores known package maps for different distributions.
"""
from __future__ import print_function
import logging
import shutit_pexpect
from shutit_sendspec import ShutItSendSpec
#The MIT License (MIT)
#
#Copyright (C) 2014 OpenBet Limited
#
#Permission is hereby granted, free of charge, to any person obtaining a c... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2020, <NAME> (<EMAIL>)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
# -*- coding: utf-8 -*-
import json
import falcon
from falcon.routing import BaseConverter, CompiledRouter
from rust.core.db import db as rust_db
from rust.core import api
from rust.core.exceptions import unicode_full_stack, ApiParameterError, ApiNotExistError, BusinessError
from rust.core.api import ApiLogger
from ... |
""" Ensure a Pythonista script can only be launched once from the iOS home screen.
This module provides a solution to the problem stated by shinyformica, which I
have also encountered (https://forum.omz-software.com/topic/5440/prevent-
duplicate-launch-from-shortcut):
"Is there a good, canonical way to prevent a s... |
""" Due Diligence Controller """
__docformat__ = "numpy"
import argparse
import os
from typing import List
from datetime import datetime
import pandas as pd
import matplotlib.pyplot as plt
from prompt_toolkit.completion import NestedCompleter
from gamestonk_terminal import feature_flags as gtff
from gamestonk_termina... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
from collections import OrderedDict
import re
import random
keywords = ["datasourcenameforserver",
"datasourcenameforclient",
"datasourcetype",
"datasourceusername",
"datasourcepassword",
"datasourcequery",
"datasourcecubeview",
"datas... |
# 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
from .. import _utilities, _tables
from ... |
import json
import tempfile
from distutils.file_util import copy_file
from pathlib import Path
from conan_app_launcher.ui.data.json_file import JsonUiConfig
from conans.model.ref import ConanFileReference
def test_new_filename_is_created(base_fixture):
"""
Tests, that on reading a nonexistant file an error w... |
# Copyright 2018 The Cirq Developers
#
# 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 agreed to in ... |
import sensor
import image
import time
import math
import ustruct
from pyb import USB_VCP, CAN
import pyb
# Specify communication method: "print" "usb" "can"
COMMS_METHOD = "usb"
TARGET_WIDTH = 39.25
TARGET_HEIGHT = 17.00
# TODO: Check FOV Values
HFOV = 62.3 # 70.8 # horizontal field of view
VFOV = 55.6 # vertical ... |
from queue import Empty, Queue
import threading
from flask import (
Flask, request, Response, send_file, render_template
)
import torch
torch.backends.cudnn.benchmark = True
from torchvision import transforms, utils
from util import *
import os
import glob
import copy
import time
from io import BytesIO
from distu... |
import tempfile
import numpy as np
import qpimage
import drymass
def setup_test_data(radius=30, pxsize=1e-6, size=200, cx=80, cy=120, num=1,
identifier=None, medium_index=1.335, wavelength=550e-9,
bg=None):
x = np.arange(size).reshape(-1, 1)
y = np.arange(size).reshap... |
"""Display the queue.
The user will be able to view, queue, dequeue.
"""
import os
import flask
import pickle
import redis
from flask import Flask, render_template, request, redirect, session
from customer_queue import CustomerQueueLL, Customer
from time import gmtime, time, strftime, localtime
from redis import Redis... |
"""
Filename: test_stochmatrix.py
Author: <NAME>
Tests for stochmatrix.py
"""
from __future__ import division
import sys
import numpy as np
import nose
from nose.tools import eq_, ok_
from stochmatrix import StochMatrix, stationary_dists, gth_solve
TOL = 1e-15
def KMR_Markov_matrix_sequential(N, p, epsilon):
... |
# 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... |
import glob
import os
import os.path
import subprocess
import sys
from typing import Tuple, Generator
import git
from pyfakeuse import fake_use
from pymultigit.configs import ConfigDebug, ConfigGrep
def projects(sort: bool) -> Generator[Tuple[str, str], None, None]:
"""
the method returns tuples of (project... |
from aiogram import types
from aiogram.dispatcher.filters.builtin import CommandHelp, CommandStart
from database.database import session, Customer, Product, Organization, savat
from loader import dp, bot
from aiogram.types import ReplyKeyboardMarkup, KeyboardButton, ReplyKeyboardRemove
from aiogram.dispatcher.filters i... |
import argparse
import glob
import json
import os
import shutil
# follow openMMDet path processing patterns
from pathlib import Path
import numpy as np
import PIL.ImageDraw
from sklearn.model_selection import train_test_split
from mtmc.config import settings
useQtBottomLeft = True # should be Qt TopLeft
class MyEnc... |
# Copyright (c) 2021, DjaoDjin inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
from typing import Any, Callable, Dict, List, Optional, Tuple
import numpy as np
import torch
from pytorch_lightning import seed_everything
from torch import nn, Tensor
import flash
from flash.core.data.data_source import DataSource, DefaultDataKeys, DefaultDataSources
from flash.core.data.process import Preprocess
f... |
"""Zip primitive used by the GEMM function.
Takes 1 to 3 rows of data and interleaves them in 8 byte chunks. Pads to
multiply of 8 length with zeros. Calculates row sums and appends those at the
end.
"""
class Error(Exception):
"""Module level error."""
class ConfigurationError(Error):
"""Unsupported configura... |
# Copyright (c) 2017-2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# fmt: off
# isort: skip_file
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
imp... |
#!/usr/bin/env python3
"""
This is an example template for a custom HTCondor file transfer plugin.
In this example, it transfers files described by an example://path/to/file URL
by copying them from the path indicated to a job's working directory.
To make this a functional plugin, change everything in this file that c... |
# GUI Application automation and testing library
# Copyright (C) 2006-2018 <NAME> and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modific... |
import os
import time
from lxml import etree
from constants import COORDINATES
CARD_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "cards"))
TEMPLATE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "resources", "templates"))
FONT_PATH = os.path.abspath(os.path.join(os.path.d... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django import forms
from django.contrib import admin
from photologue.models import Photo, Gallery, PhotoEffect, PhotoSize, Watermark
from photologue.admin import PhotoAdmin as PhotoAdminDefault
from photologue.admin import GalleryAdmin as GalleryAdminDefaul... |
import json
import os
import re
import dcos.util as util
import six
from dcos import mesos
from dcos.util import create_schema
from ..fixtures.node import slave_fixture
from .common import assert_command, assert_lines, exec_command, ssh_output
def test_help():
with open('tests/data/help/node.txt') as content:
... |
import argparse
import os
from collections import Counter
from datetime import datetime
import pandas as pd
from tadaqq.util import uri_to_fname
from pandas.api.types import is_numeric_dtype
from tadaqq.clus import Clusterer, PMap
from tadaqq.util import get_columns_data
try:
from clus import common
except:
im... |
# -*- coding: utf8 -*-
"""
test_factory.py
Copyright 2014 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed ... |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: <EMAIL>
##
## This file is part of VisTrails.
##
## "Redistributio... |
import requests
import json
import auth
__AUTHOR__ = "<NAME> @ CCNU"
__VERSION__ = "0.0.3"
__LOG__ = "0.0.3 更新分片获取数据功能,超时自动重连,增强系统稳定性"
def card_data(username:str, password:str, token: str, start:str, end:str, max_limit:int) -> (dict, str):
"""获取校园卡信息,首先获取页数,然后分页获取,当分页出错时,自动重新验证,然后重新获取,
最后返回所有结果:Python 和 Json ... |
import pandas as pd
import multiprocessing
import pydicom
import cv2
import os
import numpy as np
import matplotlib
matplotlib.use("Agg")
#Replace with your dicom_id_folder as described in readme file
original_folder_images='/gpfs/fs0/data/mimic_cxr/images/'
def calibrate(eye_gaze_table,screen_width=1920, screen_hei... |
"""Platform for LGE climate integration."""
import logging
from datetime import timedelta
from .wideq.ac import AirConditionerDevice, ACMode
from .wideq.device import UNIT_TEMP_FAHRENHEIT, DeviceType
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
DE... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 <NAME> <<EMAIL>>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# 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 withou... |
import datetime
import uuid
from Acquire.Service import login_to_service_account
from Acquire.Service import create_return_value
from Acquire.Identity import UserAccount, LoginSession
from Acquire.ObjectStore import ObjectStore
class LoginError(Exception):
pass
def run(args):
"""This function is called ... |
# niconico_dl - Templates
from copy import copy
HEADERS = [
{
"Host": "api.dmc.nico",
"Connection": "keep-alive",
"Accept": "*/*",
"Access-Control-Request-Method": "POST",
"Access-Control-Request-Headers": "content-type",
"Origin": "https://www.nicovide... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to get French streamers and viewers
"""
from requests_html import AsyncHTMLSession
import requests
import json
import os
import asyncio
import pause
from datetime import datetime, date
import argparse
import aiohttp
import asyncio
import time
async def get_s... |
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import pandas as pd
import numpy as np
import datetime
import os, sys
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.neighbors import Neare... |
import logging
import uuid
import django
from allauth.account.models import EmailAddress
from django.contrib.auth.models import AbstractUser as BaseUser
from django.contrib.auth.models import UserManager as BaseUserManager
from django.core.cache import cache
from django.core.exceptions import ValidationError
from djan... |
# Purpose: Overlay the observed trace data from gameplay on the ToMCAT Zombie Invasion map
# Example execution: python plot_observation_trace.py <input-observation-file-path> -o <output-filepath> --animation
import sys
import json
from datetime import datetime
import matplotlib.pyplot as plt
from matplotlib.path impo... |
#!/usr/bin/env python
"""
This performs a simple test of the HLSVDPROPY module to see that it's working
and producing sane results. It uses stored SVS FID data as input and pre-
calculated singular values, and frequencies, dampings, amplitudes and phases
data as comparisons.
"""
#
# (C) <NAME>, 2020
#
# Python modu... |
# Third Party
import pytest
# First Party
from smdebug.core.access_layer import check_dir_exists
from smdebug.core.collection_manager import CollectionManager
from smdebug.core.index_reader import ReadIndexFilesCache
from smdebug.core.json_config import (
DEFAULT_SAGEMAKER_OUTDIR,
add_collections_to_manager,
... |
r"""
Examples of finite enumerated sets
"""
# ****************************************************************************
# Copyright (C) 2009 <NAME> <<EMAIL>>
#
# Distributed under the terms of the GNU General Public License (GPL)
# https://www.gnu.org/licenses/
# **********************************... |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# -*- encoding: utf-8 -*-
import sys
import threading
import time
import typing
import attr
from ddtrace.internal import nogevent
from ddtrace.internal import service
class PeriodicThread(threading.Thread):
"""Periodic thread.
This class can be used to instantiate a worker thread that will run its `run_per... |
"""Map from manufacturer to standard clusters for electric heating thermostats."""
import logging
from zigpy.profiles import zha
import zigpy.types as t
from zigpy.zcl.clusters.general import Basic, Groups, Ota, Scenes, Time
from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_... |
# coding:utf-8
from pynput.keyboard import Key, Listener
import pynput
import logging
import sys
class KeyRecordC_:
_listener = None
_key_all_values = []
_abnormal_flag = False
def __init__(self):
logging.basicConfig(filename='./log.txt',
filemode='a',
... |
import pytest
from eth_account import Account
from eth_keys import KeyAPI
from eth_utils import is_same_address
@pytest.fixture
def c(w3, get_contract):
a0, a1, a2, a3, a4, a5, a6 = w3.eth.accounts[:7]
with open("examples/wallet/wallet.vy") as f:
code = f.read()
# Sends wei to the contract for fut... |
# Copyright 2018 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://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
"""存放场用的方法"""
import calendar
import datetime
import time
from mongobdhelper import get_mongodb_conn
from mysqlhelper import DealTable
from business_calendar import Calendar, MO, TU, WE, TH, FR
from sql_centence import get_sign_data
def caculate_add_time(checkType,workday_temp,userCheckTime_temp,scheduleName)... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from collections import defaultdict
from collections import deque
import os
import torch
from .misc import is_main_process
class SmoothedValue(object):
"""Track a series of values and provide access to smoothed values over a
window or t... |
# ------------------------------------------------------------------------------
# Copyright 2018 <NAME> and <NAME>
#
# 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.o... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
import os
import nltk
from PIL import Image
import numpy as np
import json as jsonmod
import pickle
import pdb
class FlickrDataset(data.Dataset):
"""
Dataset loader for Flickr30k and Flickr8k full datasets.
"""
d... |
import numpy as np
from numba import *
from numba import cuda
"""
CUDA Kernel implementations
"""
@cuda.jit((uint8[:, :, :], float32[:, :, :], float32[:, :, :], float32[:, :, :], uint8[:, :, :], float32[:, :, :, :],
uint32, float32, float32, float32, uint32))
def conv_step(S, I, V, C, s, w, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.