text stringlengths 3.07k 12.6k |
|---|
import datetime
import logging
import pynmea2
import salt.loader
from messaging import EventDrivenMessageProcessor, extract_error_from
from salt_more import SuperiorCommandExecutionError
from serial_conn import SerialConn
from threading_more import intercept_exit_signal
log = logging.getLogger(__name__)
context = {... |
from collections import defaultdict
from datetime import date, timedelta
from tqdm import tqdm, trange
from extract_gtfs.data import Data
from extract_gtfs.utils import LogAttribute, load_attr, read_csv
DAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
def str_to_date(date_strin... |
#!/usr/bin/env python3
# encoding: utf-8
#
# (C) 2012-2021 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: BSD-3-Clause
"""\
Functions to make things human readable.
"""
import stat
import sys
from math import log10
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EXPONENTS = ('', 'k', '... |
from enum import Enum
from os.path import join
import numpy as np
from nltk.tokenize import word_tokenize
# from src.data.models import Sentence
# from src.utils.config import get_config
# CONFIG = get_config()
FILE_EXT = "_ann.tsv"
# CB_FILE_EXT = '_cb.tsv'
SEP = "\t"
DATA_PATH = "/usr/users/oliverren/meng/check-wort... |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
IDE : PyCharm
File Name : my_bisect
Description : bisect 模块包含两个主要函数,bisect 和 insort,两个函数都利用二分查找算法来在有序
序列中查找或插入元素。
Author : <EMAIL>
date : 2022/4/29 8:06
-----------------------------------------... |
import numpy as np
import random
from scipy.spatial import distance
from typing import List, Tuple
def genetic_algorithm(cities: np.array,
population_size: int,
num_of_iter: int,
n: float,
mutation_probability: float,
... |
import paddle
import numpy as np
import random
import paddle.distributed as dist
import paddle.fluid as fluid
import paddle.distributed.fleet as fleet
def set_random_seed(seed, rank_id):
"""Set random seed for reproducability."""
random.seed(seed)
np.random.seed(seed)
paddle.seed(seed + rank_id)
voc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/3/9/009 21:38
# @Author : zengsm
# @File : linear_regression
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file as ptf
""" 线性回归模型训练、模型保存、模型使用和sum... |
"""Cache for client."""
from __future__ import annotations
import abc
import dataclasses
import enum
import json
import sys
import time
import typing
if typing.TYPE_CHECKING:
import aioredis
__all__ = ["BaseCache", "Cache", "RedisCache", "StaticCache"]
MINUTE = 60
HOUR = MINUTE * 60
DAY = HOUR * 24
WEEK = DAY *... |
import shutil
import tempfile
from django.contrib.auth import get_user_model
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import Client, TestCase, override_settings
from django.urls import reverse
from posts.forms import CommentForm, PostForm # isort:skip
from posts.models import Gr... |
from numpy.core.fromnumeric import shape
import taichi as ti
import numpy as np
lin_iters = 20
N = 64
dt = 0.1
diff = 0.0
visc = 0.0
force = 5e5
source = 100.0
dvel = False
v = ti.Vector.field(2, float, shape=(N + 2, N + 2), offset = (-1, -1))
v_prev = ti.Vector.field(2, float, shape=(N + 2, N + 2),... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask, request, jsonify
import database
app = Flask("Swamp")
db = database.MySqlDB()
@app.route("/")
def index():
return "Hello World, I am Swamp!"
# get "username", "password", "name", "surname", "email" as json
# return 1 if "username" is uniqu... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
#
# P A G E B O T
#
# Copyright (c) 2016+ <NAME> + <NAME>
# www.pagebot.io
# Licensed under MIT conditions
#
# Supporting DrawBot, www.drawbot.com
# Supporting Flat, xxy... |
# W tym pliku mieszcza sie wszystkie widoki poza index.html, ktory jest w
# app/main/views.py
from flask import render_template, request, url_for
from flask import flash # Dzieki temu mozna wyswietlac komunikaty
from flask import redirect # dzieki redirect mozna zrobic przekierowanie.
from . import menu
from .. impo... |
class Container:
def __init__(self, *args, **kwargs):
self._dict = {}
for mapping in args:
for key, value in mapping.items():
self[key] = value
for key, value in kwargs.items():
self[key] = value
for key, value in vars(type(self)).items():
... |
# -*- coding: utf-8 -*-
"""This module contains the WebCrawler and PageParser for identifying and downloading
new and updated CalFresh excel files
Attributes:
config (RawConfigParser): for reading the configuration file
temp_dir (str): the temporary directory to use for saving html files
data_dir (str)... |
import os
import sys
import time
import psutil
import threading
import platform
import fileinput
import zipfile
import io
import ssl
import pickle
import gzip
import cortecx as c
import tensorflow as tf
from multiprocessing.dummy import Pool as ThreadPool
class CortecxSessionError(UserWarning):
pass
universal_p... |
# Copyright 2021 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 acc... |
import random
import sys
import numpy as np
import pandas as pd
from scipy import sparse
from scipy.linalg import toeplitz
sys.path.insert(0, '../')
class TestChromMatrix(object):
def test_properties(self, get_chrom):
chrom = get_chrom(100000)
assert chrom._observed.dtype == np.flo... |
import FreeCAD, Part, math, Mesh
DOC = FreeCAD.activeDocument()
DOC_NAME = "part_bottom_support"
def clear_doc():
# Clear the active document deleting all the objects
for obj in DOC.Objects:
DOC.removeObject(obj.Name)
def setview():
# Rearrange View
FreeCAD.Gui.SendMsgToActiveView("ViewFit... |
from collections import OrderedDict
from numpy.random import randint
import torch
from loader.episode import Episode, Dataset
from loader import metadata
from torch.utils import data
from utils import utils
C = utils.getCudaManager('default')
class DataFromMetadata(data.Dataset):
"""Convert Metadata to torch.dat... |
""" Full assembly of the parts to form the complete network """
import torch
import torch.nn as nn
import torch.nn.functional as F
class DoubleConv(nn.Module):
"""(convolution => [BN] => ReLU) * 2"""
def __init__(self, in_channels, out_channels, mid_channels=None, bias=False):
super().__init__()
... |
# -*- coding: UTF-8 -*-
# Copyright (c) 2020 PaddlePaddle 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
#
... |
from urllib.parse import urlparse
from rake import Rake
from string_match import (
hamming,
levenshtein,
jaro_winkler,
jaccard,
sorensen_dice,
ratcliff_obershelp,
)
from youtube_transcript_api import YouTubeTranscriptApi
import pandas as pd
import requests
import operator
import json
def get_... |
import pickle
import re
import jieba
import numpy as np
import pandas as pd
import reader
def only_read_exls():
df = pd.read_excel('data/corpus/excel/1_full.xlsx')
text = df.iloc[:, [0, 1, 2]]
text = [[str(i[1]), str(i[2]), i[0]] for i in np.array(text).tolist()]
# print(np.shape(text))
return te... |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test REST interface
#
from test_framework import BitcoinTestFramework
from util import *
import auxpow
i... |
import iris
from iris.experimental.regrid_conservative import regrid_conservative_via_esmpy as rcve
import iris.coord_categorisation as icat
import cf_units
import iris.analysis as iana
def main():
indir = '/gws/nopw/j04/primavera3/cache/sberthou/FRANCE/'
outdir = '/gws/nopw/j04/primavera3/cache/sberthou/FRANCE_re... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# command.py
# SciML-Bench
# Copyright © 2021 Scientific Machine Learning Research Group
# Scientific Computing Department, Rutherford Appleton Laboratory
# Science and Technology Facilities Council, UK.
# All rights reserved.
"""
Main entry of the program
"""
import... |
import heapq
from collections.abc import Callable
from typing import Any, Union
from problems import Problem
Number = Union[int, float]
infinity = float("inf")
def null_heuristic(state) -> int:
"""Heuristic that only returns 0."""
return 0
def weighted_heuristic(heuristic: Callable[Any, Number],
... |
import io
import pprint
from typing import BinaryIO
import wx
from . import elements, errors
from .. import utils
from ..utils import quicklz
from .wfimage import WFImage
from .wfparameter import WFParameter
class WFHeader:
H_SIGN = b'HMDIAL\x00'
U_SIGN = b'UIHH'
SIGN_LEN = {
b'H': len(H_SIGN),... |
import datetime
from django.utils.translation import ugettext as _
from django.db.models import Sum, Count
from django import forms
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.contrib import messages
from django.contrib.auth.models import User
... |
"""
Create a SCP side-channel to transfer a file to remote network device.
SCP requires a separate SSH connection.
Currently only supports Cisco IOS and Cisco ASA.
"""
from __future__ import print_function
from __future__ import unicode_literals
import re
import os
import hashlib
import paramiko
import scp
class... |
import argparse
import matplotlib.pyplot as plt
import numpy as np
import datetime
import pandas as pd
import json
import os
from utils.uniquify import uniquify
def op_tie_breaking_evaluation(hash_lists, args):
'''This function evaluates our method, other-play with tie-breaking. It applies the tie-breaking func... |
import os
import requests
from datetime import datetime
import itsdangerous
import numpy as np
import flask
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
from itsdangerous.url_safe import URLSafeTimedSerializer
from intermediate_api import app
import intermediate_api.db as db
import inter... |
def intToBitString(a, bit = 256):
"""
Converts an integer to a binary string representation (without '0b')
:param a: The integer to convert (integer)
:param bit: The size of the representation in bit (integer)
:return: Binary string representation (String)
"""
str = bin(a)[2:]
return (bi... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. 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... |
# Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
# Complutense de Madrid (dsa-research.org)
#
# 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 ... |
from collections import OrderedDict
from copy import deepcopy
from os import listdir
from typing import List, Callable
import pandas as pd
from topics_and_summary.datasets.common import get_file_content, Document, Dataset
from topics_and_summary.utils import join_paths
class StructuredDataset(Dataset):
"""
... |
# Copyright (c) 2020-2022 The PyUnity Team
# This file is licensed under the MIT License.
# See https://docs.pyunity.x10.bz/en/latest/license.html
__all__ = ["Event", "EventLoopManager", "EventLoop", "WaitForSeconds", "WaitForEventLoop",
"WaitForUpdate", "WaitForFixedUpdate", "WaitForRender", "StartCoroutin... |
#
# This file is part of snmpfwd software.
#
# Copyright (c) 2014-2019, <NAME> <<EMAIL>>
# License: http://snmplabs.com/snmpfwd/license.html
#
# SNMP Proxy Forwarder plugin module
#
import logging
from logging import handlers
import time
import os
import socket
try:
from ConfigParser import RawConfigParser, Error
e... |
# solutions.py
"""Introductory Labs: Intro to Matplotlib. Solutions file."""
import numpy as np
from matplotlib import pyplot as plt
def var_of_means(n):
"""Construct a random matrix A with values drawn from the standard normal
distribution. Calculate the mean value of each row, then calculate the
varianc... |
# most of this is blatantly copied from:
# https://github.com/Fogapod/KiwiBot/blob/master/modules/images/module_fly.py
import time
import random
from math import pi, cos, sin
from typing import Dict, List, Tuple, Sequence
import PIL
from PIL import Image
from pink.cogs.utils.errorhandler import PINKError
DEG_TO_R... |
# -*- coding: utf-8 -*-
"""Resources related to QC configuration
"""
from collections import OrderedDict
import copy
import json
import os.path
import pkg_resources
from .utils import cotederc
def list_cfgs():
"""List the available QC procedures, builtin + local
Full QC procedures, defining which tests an... |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
'''
@Time : 2021/06/30 20:12:24
@Author : Camille
@Version : 1.0
'''
import os
import sys
sys.path.append(os.getcwd())
import json
from scripts.windows.windows import BaseWindowsControl
from scripts.windows.journalist import BasicLogs
from scripts.prettyCode.prett... |
from architecture_further_formulas import *
def WeightChangeCalculation(neuronIndex, spiketimes, time, negativeWeightReinforcement, positiveWeightReinforcement, M, dendObj):
for inputNeuronIndex in range(numberOfPixels):
## General STDP learning rule implementation ##
# Find SpikePreSyn if it exists
# Note: cou... |
class C:
def m1(self):
y = ug1
x = 1
return y
def m2(self, p):
return p
def m3(self, x1):
return u2
u2 = x1
def m4(self, x2):
if x2:
u3 = 1
return u3
def f():
y = ug1
x = 1
return y
def g(x3):
def h():
... |
# %%
import re
import string
import tagging
re_var = re.compile(r'((@[ns]?|#|\$)[0-9]+)(\D|$)')
re_number = re.compile(r'[-]?[0-9]+([.][0-9]+)?(/[0-9]+([.][0-9]+)?)?')
re_string = re.compile(r'\(\w\)')
re_equation = re.compile('[0-9A-Z][0-9A-Z\.\+\-\*\/\(\)=<> ]*[=<>][0-9A-Z\.\+\-\*\/\(\)=<> ]*[0-9A-Z]') # 등호(=)를 포함하... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, msgprint
from frappe.utils import flt
from frappe.utils import formatdate
import time
from erpnext.accounts.utils im... |
#!/usr/bin/env python3
import collections
from collections import namedtuple
from datetime import datetime
import os
import re
import sys
from pathlib import Path
import jinja2
VersionRange = namedtuple('VersionRange', 'min max')
class SupportPackage(object):
def __init__(self,
module_version,
... |
# 要直接在3维通道上操作
# 命名格式 IOXHXTX表示输入输出通道x,每个block的res_head_num为x,res_tail_num为x
import torch
import torch.nn as nn
from model import common
def make_model(args, parent=False):
return NEBRN(args)
class ResBlock(nn.Module):
def __init__(
self, conv, n_feats, kernel_size,
bias=True, bn=Fal... |
from collections import OrderedDict
from contextlib import contextmanager
from functools import partial
from logging import getLogger
from typing import Any, Iterable, Optional, Callable, NamedTuple, Union, List, Tuple
from plenum.common.event_bus import ExternalBus
from plenum.common.timer import TimerService
from pl... |
"""
Starts required services for Prestige and then runs the UI tests.
"""
from pathlib import Path
from typing import Any, Dict, List, Optional
import atexit
import logging
import os
import subprocess
import sys
import threading
import time
import requests
logging.basicConfig(level=logging.INFO, format="%(levelname)... |
# -----------------------------------------------------------------------------
#
# This file is the copyrighted property of Tableau Software and is protected
# by registered patents and other applicable U.S. and international laws and
# regulations.
#
# You may adapt this file and modify it to fit into your context an... |
# Copyright (c) 2011-2017 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 w... |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import os
import sys
import time
import unittest
import fiona
import networkx as nx
from shapely.geometry import shape, box, MultiLineString
# add local s2g repo
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import s2g
class ShapeGraphCase(un... |
import json
# 用于计算干员当前等级的属性
class LevelCalculate(object):
# 初始化参数
def __init__(self):
self.employee_param = {}
self.employee_max = {}
self.employee_min = {}
self.favor = {}
self.potential = {}
self.talent = {}
self.employee_max_level = 0
# 入口 main()... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Credits: <NAME>, <NAME>, <NAME>, <NAME>
import pathlib
import numpy as np
import pandas as pd
from loguru import logger
import constants
import helpers
import plot
from helpers import open_repo
from image_set import ImageSet
from path import global_root_dir
def compu... |
from simframe.integration.scheme import Scheme
import numpy as np
# Butcher coefficients
a10 = 1/5
a20, a21 = 3/40, 9/40
a30, a31, a32 = 3/10, -9/10, 6/5
a40, a41, a42, a43 = -11/54, 5/2, -70/27, 35/27
a50, a51, a52, a53, a54 = 1631/55296, 175 / \
512, 575/13824, 44275/110592, 253/4096
b0, b2, b3, b5 = 37/378, 25... |
import json
from pprint import pprint
import numpy as np
from detectron.datasets.nuclei.mask_encoding import rle_encode
from pycocotools import mask as mask_util
import unicodecsv as csv
from scipy import ndimage
import sys
import time
from datetime import datetime, timedelta
def join_results(seg_filename, annotatio... |
"""
This module tests dill based serialization and deserialization of all common
agent configurations. It tries to confirm that a deserialized agent will
exhibit equivalent behavior to its origin.
"""
import dill
import copy
import json
import logging
import pytest
from os.path import dirname
from os.path import join
... |
#!/usr/bin/env python
#
# extract_concepts.py
# <NAME> <<EMAIL>>
# 2020-06-12
import argparse
import csv
import os
import re
import sys
from collections import Counter
import nltk
from RAKE import Rake
from yake import KeywordExtractor
def get_continuous_chunks(sentence):
chunked = nltk.ne_chunk(nltk.pos_tag(nl... |
import os
import cPickle as pickle
#import pickle
import time
import csv
import random
import itertools
import nltk
import math
import numpy as np
import json
import copy
import multiprocessing as mp
from nltk.probability import FreqDist
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metric... |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
import torch as th
from torch.utils.data import Dataset
import pandas as pd
import os
import numpy as np
import json
import librosa
from everything_at_once.dataset.utils... |
import os
import logging
from copy import deepcopy
from datetime import datetime
from feedparser import parse as parse_rss_feeds
from time import sleep
from sgsuite.util import archiveNowProxy
from sgsuite.util import expandUrl
from sgsuite.util import genericErrorInfo
from sgsuite.util import getDedupKeyForURI
from ... |
import torch as tr
from torch import Tensor
from torch.nn import Module, functional as func
from .utils import enumerate_discrete
from .inference import ImportanceWeightedSampler
from .dgm import DeepGenerativeModel
from .svi_types import Loss, BaseSVI, RetSVI
δ = 1e-8
class BCELoss(Loss, Module): # type: ignore
... |
#!/usr/bin/env python3
#****************************************************************************************************************************************************
# Copyright 2018 NXP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted p... |
import os
import sys
import torch
from TorchProteinLibrary import FullAtomModel
import numpy as np
import unittest
import random
import math
from TorchProteinLibrary.FullAtomModel import Coords2TypedCoords, Angles2Coords
from TorchProteinLibrary.FullAtomModel.CoordsTransform import CoordsTranslate, CoordsRotate, getBBo... |
import torch
from utils.data import Data
from .model import BERTModel
from utils.utils import get_score_metric
from transformers import AdamW, get_linear_schedule_with_warmup as linear_schedule
from tensorboardX import SummaryWriter
try:
from apex import amp
except:
print("Skip loading apex library")
amp =... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
---------------------------------------------... |
import numpy as np
from dask.delayed import delayed
import cudf as gd
from dask_cudf import from_delayed
class Groupby(object):
"""The object returned by ``df.groupby()``.
"""
_magic_token = "__<PASSWORD>"
def __init__(self, df, by, method):
self._df = df
self._by = tuple([by]) if i... |
from collections import namedtuple
from games import (Game)
class GameState:
def __init__(self, to_move, board, label=None, depth=8):
self.to_move = to_move
self.board = board
self.label = label
self.maxDepth = depth
def __str__(self):
if self.label == None:
... |
"""
Minimize bc loss (MLE, MSE, RWR etc.) with pytorch optimizers
"""
# import logging
# logging.disable(logging.CRITICAL)
import numpy as np
import time as timer
import torch
from torch.autograd import Variable
from mjrl.utils.logger import DataLog
from tqdm import tqdm
class BC:
def __init__(self, expert_paths... |
"""
Globus Auth Helpers.
"""
# A lot of this code is copied from the Globus Auth Example repo:
# https://github.com/globus/native-app-examples
import json
import stat
import queue
import functools
import threading
import webbrowser
from pathlib import Path
from http.server import HTTPServer, BaseHTTPRequestHandler
fro... |
# python3
# pylint: disable=g-bad-file-header
# Copyright 2021 DeepMind Technologies 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... |
import sys
from src.models import Locusdbentity, Dnasequenceannotation, Taxonomy, Contig, So
from scripts.loading.database_session import get_session
from scripts.loading.util import get_strain_taxid_mapping
dataDir = "scripts/loading/variant/data/"
refFile = dataDir + "not_feature_fasta/not_feature_S288C.fsa"
mappin... |
#!/usr/bin/env python
# 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
#
# Authors:
# - <NAME>, <EMAIL>, 2017
import os
import re
import glob
from t... |
import pandas as pd
import numpy as np
import requests
import datetime
import os.path
import pprint
import shapefile
import simplejson
import statistics
import math, sys
from urllib.parse import urlparse
from collections import defaultdict
from libs.CovidDatasets import get_public_data_base_url
from libs.us_state_abb... |
# -*- coding: utf-8 -*-
"""Tests for binary data format and file."""
import io
import unittest
from dtfabric import errors as dtfabric_errors
from dtfabric.runtime import data_maps as dtfabric_data_maps
from dtfabric.runtime import fabric as dtfabric_fabric
from olecfrc import data_format
from olecfrc import errors
... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import json
import logging
import warnings
import threading
import functools
import websocket
from .exceptions import *
try:
import Queue as queue
except ImportError:
import queue
__all__ = ["Tab"]
logger =... |
from ctypes import (
c_char_p, c_wchar_p, c_int, c_ubyte, c_ushort, c_size_t, c_void_p, Structure
)
from ctypes import POINTER as _P
from .dll import _bind, SDLFunc, AttributeDict
from .stdinc import Uint32, SDL_bool
__all__ = [
# Structs
"SDL_hid_device", "SDL_hid_device_info",
]
# Structs & opaque typ... |
# Copyright (c) 2015 Advanced Micro Devices, 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: redistributions of source code must retain the above copyright
# notice, this list of conditions ... |
import paho.mqtt.client as mqtt
from drivers.sds011 import SDS011_MODEL, MOBILE_GPS
from stations import *
import nacl.signing
import threading
import time
import rospy
import json
import copy
import hashlib
thlock = threading.RLock()
sessions = dict()
def _generate_pubkey(id) -> str:
verify_key = hashlib.sha25... |
import logging
from functools import lru_cache
from ambulance.models import Ambulance
from hospital.models import Hospital
logger = logging.getLogger(__name__)
PERMISSION_CACHE_SIZE = 10
@lru_cache(maxsize=PERMISSION_CACHE_SIZE)
def get_permissions(user):
# hit the database for permissions
return Permissi... |
from django.conf import settings
from django.db import transaction
from django.core.mail import send_mail
from django.urls import reverse
from django.template.loader import render_to_string
from django.contrib.sites.models import Site
from django.contrib.sites.requests import RequestSite
from registration import signa... |
import arrow
import datetime
import logging
import time
import copy
"""
ideas:
Instead of reconnecting and querying for max row ID,
create a UDF on the server that does the query in a loop and sleeps, only returning data
when the MAX ID has changed, or a timeout occurs,
then we don't constantly create... |
__authors__ = ["<NAME>", "<NAME>", "<NAME>"]
__copyright__ = "Copyright 2021, <NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
import os
import sys
import shutil
from os.path import join
import tempfile
import hashlib
import urllib
import pytest
import glob
import subprocess
from snakemake import snakemake
from snak... |
#!/usr/bin/python
#
# tcp_delack Trace TCP delayed ack.
# For Linux, uses BCC, eBPF. Embedded C.
#
# USAGE: tcp_delack -h <HOST>
from __future__ import print_function
from bcc import BPF
from bcc.utils import printb
from datetime import datetime
import argparse
import os
import socket
# arguments
examples = ""... |
# Copyright 2019 Microsoft. 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 ag... |
from .case import Case
from .abstract import Point, Form
from . import colors
import numpy as np
import shelve
from pygame.locals import *
class Painter:
def __init__(self, *args, **kwargs):
"""Create a painter."""
self.paints = [Board(), Paint(*args, **kwargs)]
self.paint_brush = PaintB... |
import pickle
import numpy as np
import collections
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from scipy.ndimage.filters import gaussian_filter1d
dataset_to_metric = {"sst": "acc", "mrpc": "acc_and_f1", "cola": "mcc", "rte": "acc"}
print_debug = False
# budget_to_perf key:
# num_of_each... |
import sys
import os
import signal
import json
from distutils.spawn import find_executable
from textwrap import shorten
from psutil import process_iter
from subprocess import Popen, DEVNULL
from time import sleep
from pytg.sender import Sender
from pytg.receiver import Receiver
from pytg.utils import coroutine
from p... |
import numpy as np
import pytest
import os
from torchvision import transforms
from torch.utils.data import DataLoader
from continuum.datasets import MNIST, CIFAR10, CIFAR100, KMNIST, FashionMNIST, TinyImageNet200, AwA2, Core50
from continuum.scenarios import Rotations
from continuum.scenarios import Permutations
from ... |
'''
Do a homing with CANopen using the TMCM-1636 module
Created on 15.05.2020
@author: JM, ED
'''
if __name__ == '__main__':
pass
import PyTrinamic
from PyTrinamic.connections.ConnectionManager import ConnectionManager
from PyTrinamic.modules.TMCM1636.TMCM_1636 import TMCM_1636
import time
PyTrinamic.showInfo(... |
# Copyright (C) 2021 Intel Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
import logging
import lxml.etree
from cpuparser import parse_cpuid, get_online_cpu_ids
from cpuparser.msr import *
from extractors.helpers import add_child, get_node
level_types = {
1: "thread",
2: "core"... |
from contextlib import ExitStack
import grpc
import pytest
import yaml
from dagster import seven
from dagster.check import CheckError
from dagster.cli.workspace.load import location_origins_from_config
from dagster.core.host_representation import GrpcServerRepositoryLocationOrigin
from dagster.core.test_utils import e... |
# coding: utf-8
import numpy as np
np.random.seed(1)
import time
import torch
import torch.nn as nn
from torch.utils.data import DataLoader, TensorDataset
import torch.optim as optim
import torch.nn.functional as F
torch.manual_seed(1)
torch.set_default_dtype(torch.float64)
dtype = torch.float64
device = torch.device(... |
"""
The MIT License (MIT)
Copyright (c) 2013 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publi... |
# This is used for the CI side without any installation
# standard lib only
#
# nabbed from: https://github.com/altendky/romp/blob/602fe43fda8c491f7799f338eaa4ce28ed96cd74/src/romp/_matrix.py
import argparse
import collections
import itertools
import json
import sys
import uuid
vm_images = collections.OrderedDict((
... |
# Copyright 2018 Cisco and its affiliates
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.