text stringlengths 6.04k 39.5k |
|---|
"""Metrics.
Author: <NAME> (<EMAIL>)
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import sklearn.metrics
def label_equal(pred, label, axis=-1):
return pred == label.astype(pred.dtype)
def top1_correct(pred, label, axis=-1):
... |
# Copyright 2017-2020 The Verible 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 ... |
"""
Copyright (c) 2019-2020 Cypress Semiconductor 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
Unless required by applicable law or ag... |
import json
import numpy as np
import torch
import pycocotools
import argparse
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
from terminaltables import AsciiTable
from collections import OrderedDict
import torch.backends.cudnn as cudnn
from data.coco import COCODetection
from modules.buil... |
from functools import partial
import six
from dagster import check
from dagster.core.storage.type_storage import TypeStoragePlugin
from .builtin_enum import BuiltinEnum
from .builtin_config_schemas import BuiltinSchemas
from .config import ConfigType
from .config import List as ConfigList
from .config import Nullab... |
# -*- mode: python; coding: utf-8 -*-
# Copyright 2019-2020 the .NET Foundation
# Licensed under the MIT License.
from __future__ import absolute_import, division, print_function
__all__ = """
indent_xml
LockedDownTraits
LockedXmlTraits
MetaLockedDownTraits
stringify_xml_doc
write_xml_doc
XmlSer
""".split()
from abc... |
import argparse
import textwrap
from bitarray import bitarray
from contextlib import contextmanager
from . import database
from .fuseconv import read_jed, write_jed
db = database.load()
macrocell_options = [
"pt_power",
"pt1_mux",
"pt2_mux",
"pt3_mux",
"gclr_mux",
"pt4_mux",
"pt4_func",... |
import json
import signal
import sys
import threading
import connexion
import re
import os
import subprocess
import time
import gc
import psutil
from IO.MQTTClient import InvalidMQTTHostException
from IO.redisDB import RedisDB
from config.configUpdater import ConfigUpdater
from optimization.ModelException import I... |
"""
Generate a HGVS description of the variant(s) leading from one sequence to an
other.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import math
from Bio.Seq import reverse_complement
from .variant import (ISeq, AISeq, ISeqList, AISeqList, DNAVar, ProteinVar,
Al... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# This s... |
from __future__ import absolute_import, unicode_literals
import os
import re
from collections import Counter
from datetime import datetime
from io import open
import yaml
from ansible.inventory.manager import InventoryManager
from ansible.parsing.dataloader import DataLoader
from ansible.parsing.utils.yaml import fro... |
#!/usr/bin/env python
"""
Decodes 32-Bit Windows Device I/O control codes.
This script based on "Windows Driver Plugin" IDA Pro plugin::
- https://github.com/mwrlabs/z3_and_angr_binary_analysis_workshop/ (<NAME>)
- https://github.com/mwrlabs/win_driver_plugin (<NAME>)
- https://github.com/tandasat/WinIoCtlDeco... |
class Preprocessing:
#Assumption 1 - Data Columns For Train & Test Will Be Same
#Assumption 2 - Ordinal & Bit Switches Will Not Be Pushed In Nominal Function
#Assumption 3 - Train Categorical Will Be SuperSet & Test Will Be SubSet, Else Model To Be ReCreated
def LoadData(self, FileName, HeaderMissing="... |
from copy import deepcopy
import itertools
import numpy as np
from torch.optim import Adam
import gym
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions.normal import Normal
import os
def combined_shape(length, shape=None):
if shape is None:
return (leng... |
# <NAME>
# August 5, 2020
# Implements discrete SEIR model as described in Eq. 1-7 in this reference:
# https://doi.org/10.1111/j.1541-0420.2006.00609.x
# This is the same as model.py but optimized for speed
import collections
import json
import multiprocessing
import os
import sys
from typing import Dict, List, Tuple... |
# Copyright 2011 <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.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... |
import pytest
import logging
import numpy as np
import pandas as pd
from pyam import check_aggregate, IamDataFrame, IAMC_IDX
from pyam.testing import assert_iamframe_equal
from conftest import TEST_YEARS, DTS_MAPPING
LONG_IDX = IAMC_IDX + ["year"]
PE_MAX_DF = pd.DataFrame(
[
["model_a", "scen_a", "World"... |
import hou
import viewerstate.utils as su
import stateutils
import toolutils
from os import path
EPSILON = 0.000001
AXIS_X = hou.Vector3(1, 0, 0)
AXIS_Y = hou.Vector3(0, 1, 0)
AXIS_Z = hou.Vector3(0, 0, 1)
def setClipboardText(text):
import PySide2.QtGui as qtg
qtg.QClipboard().setText(text)
def getClipboardText(... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 9 11:38:10 2019
Name: <NAME>
Roll No: 15EC10043
Assignment 2 Task b Experiment 3
"""
import argparse
from zipfile import ZipFile
import numpy as np
import mxnet as mx
from sklearn.model_selection import train_test_split
from mxnet import autograd, gluon,in... |
import argparse
import datetime
import os
from supervised_model.sup_model import Frontend
from utils import config as cfg
import time
import numpy as np
import torch
import wandb
from torch.utils.tensorboard import SummaryWriter
from tianshou.data import Collector, PrioritizedVectorReplayBuffer, VectorReplayBuffer
f... |
# Copyright 2022 The Brax 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 wri... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
"""
Module with invoice related entities
"""
from datetime import datetime
from typing import Type, List
import dateutil.parser
from pypaypal.entities.base import (
T,
Item,
Refund,
DateRange,
ActionLink,
AmountRange,
PayPalEntity,
ResponseType,
Money,
RecipientInfo ... |
""" This module contains the Main Window for pySUMO.
This module contains:
- MainWindow: pySUMO's main window.
- HelpDialog: The dialog that displays help in pySUMO GUI.
"""
from functools import partial
from signal import signal, SIGINT
from pickle import loads
from struct import unpack
import logging
import pysum... |
from tkinter import *
import traceback
from tkinter.scrolledtext import ScrolledText
CODEC = 'utf8'
# XXX This should import the "markov" module.
# XXX All changes made here should be copied.
################################################################################
class MarkovDemo:
def __init__(self, m... |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.9.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# + nbsphinx="hidden"
# %matplotlib inline
# + nbsphin... |
"""modified from <NAME>'s version"""
import numpy as np
import cv2
import copy
import tkinter.filedialog as filedialog
import os.path
import sys
import yaml
# step one: load fly video
# step two: choose area that contains fly arena
# step three: select arena width
# step four: align microphone 1
# step three: choose a... |
import sys
sys.path.append("../pipeline")
from utils import associated_annotations_with_documents
import ray
import mysql.connector
import json
import argparse
import pickle
import numpy as np
import os
import sys
import random
import time
from collections import Counter
from utils import DocumentVectorizer
from sk... |
"""
General utility functions for the pymodulon package
"""
import json
import logging
import re
from itertools import combinations
import numpy as np
import pandas as pd
from scipy import stats
from scipy.special import digamma
from sklearn.neighbors import BallTree, KDTree
from pymodulon.enrichment import FDR
###... |
import re
import os
import time
import logging
import pandas as pd
from tqdm import tqdm
import numpy as np
from glob import glob
from sklearn.metrics import f1_score, classification_report
import torch
from torch.utils.tensorboard import SummaryWriter
from torch.utils.data import TensorDataset, DataLoader
from transf... |
import random
import game.content
import gears
import pbge
from game.content import gharchitecture, plotutility, dungeonmaker, ghwaypoints
from game import teams
from game.content.ghplots import missionbuilder
from game.content.ghcutscene import SimpleMonologueDisplay
from game.ghdialogue import context
from pbge.dial... |
#!/usr/bin/env python
# coding: utf-8
import configparser
import glob
import re
import lmfit
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import rampy as rp
import scipy.signal
config = configparser.ConfigParser()
config.read("raman_config.ini")
lb = config.getfloat("DEF... |
import sys
from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.baseobjspace import W_Root, SpaceCache
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rtyper.extregistry import ExtRegistryEntry
from pypy.module.cpyext.api import (
cpython_api, bootstrap_function, PyObjec... |
import os
import logging
import asyncio
import tkinter as tk
import message_analyser.retriever.telegram as tlg
import message_analyser.storage as storage
from message_analyser import analyser
from tkinter import filedialog
async def start_gui(loop):
app = MessageAnalyserGUI(tk.Tk(), loop)
try:
while T... |
################################################################################
#
# MRC FGU Computational Genomics Group
#
# $Id$
#
# Copyright (C) 2009 <NAME>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by t... |
#!/usr/bin/env python3
# mc_chain_wl_sw.py
#------------------------------------------------------------------------------------------------#
# This software was written in 2016/17 #
# by <NAME> <<EMAIL>>/<<EMAIL>> #
# and <NAME> <<EMAIL>... |
# Adapted from https://github.com/SimingYan/HPNet/blob/main/utils/spec_utils.py
import torch
import numpy as np
from .approximation import fit_bezier_surface_fit_kronecker, BSpline, uniform_knot_bspline_
from .curve_util import DrawSurfs
from lapsolver import solve_dense
draw_surf = DrawSurfs()
EPS = np.finfo(np.floa... |
""" Cisco_IOS_XR_sysadmin_wdmon
"""
from collections import OrderedDict
from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64
from ydk.filters import YFilter
from ydk.errors import YError, YModelError
from ydk.errors.error_handler import handl... |
import os
import time
import pickle
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib
import datetime
from datetime import datetime
from contextlib import contextmanager, redirect_stdout
from functools import partial
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing... |
import xlsxwriter
import os
import pandas as pd
import numpy as np
import tensorflow as tf
from openpyxl import load_workbook
class GeneticAlgorithm:
"""
Class to run a genetic algorithm and create everything around it, e.g., an Excel-file with all results.
"""
def __init__(self, path_to_file, nb_epoc... |
"""
DASHit_filter: Filter candidate guides for offtarget and quality.
Given an offtarget file and quality parameters, remove candidate
guides from a sites-to-reads file that hit offtargets or are of low
quality.
=DASHit= performs offtarget and quality filtering on the
sites-to-reads file (output of =crispr_sites -r=)... |
import string
from copy import deepcopy
import os.path
from time import gmtime, strftime
import numpy as np
from refnx.reduce.platypusnexus import (PlatypusNexus, ReflectNexus,
number_datafile, basename_datafile)
from refnx.util import ErrorProp as EP
import refnx.util.general a... |
# "Genetic algorithms are often applied as an approach to solve global optimization problems." - wki
# Select DNA folder from database
# Clone DNA
# Mutate DNA
# Play tournament with DNA
# Save
# Repeat
import os
import random
import configparser
import string
import shutil
import roman
import time
import trainer
D... |
# Copyright Contributors to the Testing Farm project.
# SPDX-License-Identifier: Apache-2.0
import argparse
import gluetool
from gluetool import utils, GlueError, SoftGlueError
from gluetool.action import Action
from gluetool.log import log_dict
import gluetool_modules_framework.libs
import gluetool_modules_framewor... |
"""
This script finds if the fragment resulting from the benchmark schemes fall on the Pareto front
"""
import fragmenter
from openeye import oechem, oedepict, oegraphsim
import json
import matplotlib.pyplot as plt
import numpy as np
def rbg_to_int(rbg, alpha):
rbg[-1] = int(rbg[-1]*alpha)
colors = [int(rou... |
from __future__ import annotations
__all__ = [
"largest_remainder",
"Allele",
"Alleles",
"GenoDistribDict",
"GenoDistribSerialisable",
"GenoDistrib",
"GenoLifeStageDistrib",
"GenoTreatmentValue",
"GrossLiceDistrib",
"LicePopulation"
]
import math
from abc import ABC
import date... |
# -*- coding: utf-8 -*- vim: ts=8 sts=4 sw=4 si et tw=79
"""\
Kontext-Helferlein:
Funktionen, die im Rahmen eines Aufruf-Kontexts hilfreich sind
(also nicht über den aktuellen Request hinaus)
"""
# Python compatibility:
from __future__ import absolute_import, print_function
from six import string_types as six_string... |
#! /usr/bin/env/python 3.0
#
# Running this script will update the batch and make files that compile the test cases
# for each CWE into a separate .exe or executable file. This script also edits source code
# and header files needed for a successful compilation with these files.
#
#
import os, glob, shutil, time, sys
... |
"""Single-shot Multi-box Detector."""
import os
import logging
import warnings
import mxnet as mx
from mxnet import autograd
from mxnet.gluon import nn
from mxnet.gluon import HybridBlock
import numpy as np
from .feature import FeatureExpander
from .predictor import ConvPredictor
from .initializer import SegmentedXavie... |
# Code for "TDN: Temporal Difference Networks for Efficient Action Recognition"
# arXiv: 2012.10071
# <NAME>, <NAME>, <NAME>, <NAME>
# <EMAIL>
from __future__ import print_function, division, absolute_import
import torch.nn as nn
import torch.nn.functional as F
import math
import torch.utils.model_zoo as model_zoo
__... |
from pioneer.common import clouds, plane
from pioneer.common.logging_manager import LoggingManager
import ctypes
import numpy as np
import os
import pickle
import platform
import traceback
def get_bank_offsets(v, h):
'''
For the LCA3 MEMs, The vertical fov is divided in 3 (256 scan lines divided in 3 sections... |
"""show_vrrp.py
IOSXE parsers for the following show commands:
* 'show vrrp'
* 'show vrrp all'
* 'show vrrp interface {interface}'
* 'show vrrp interface {interface} all'
* 'show vrrp interface {interface} group {group}'
* 'show vrrp interface {interface} group {group} all'
* 'show vrrp bri... |
import datetime
import logging
import typing
from enum import Enum
from dateutil.tz import tzutc
from redshift_connector.auth.aws_credentials_provider import AWSCredentialsProvider
from redshift_connector.config import ClientProtocolVersion
from redshift_connector.credentials_holder import (
ABCAWSCredentialsHold... |
# STANDARD LIBRARIES
import json
import os
import smtplib
import ssl
from datetime import datetime, timedelta
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
# THIRD-PARTY LIBRARIES
from flask import (
Flask,
render_template,
request,
flash,
session,
... |
# ----------------------------------------------------------------------------------------------
#
# extractDeltas.py
# v1.4
#
# extract a modeled corrective shape from a deformed skinned mesh
#
# original c++ extract deltas plugin by <NAME>
#
# python conversion, improvements and maintenance by <NAME>
# www.braverabbi... |
"""
Copyright (c) 2020-present XXX XXX
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute... |
##
## © Copyright 2021- IBM Inc. All rights reserved
# SPDX-License-Identifier: MIT
##
import logging
import anytree
import lxml.etree as ET
import requests
import tqdm
from . import _app
from . import _project
from . import _typesystem
from . import oslcqueryapi
from . import rdfxml
from . import server
from . imp... |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Quantity helpers for the ERFA ufuncs."""
# Tests for these are in coordinates, not in units.
from erfa import ufunc as erfa_ufunc, dt_pv, dt_eraLDBODY, dt_eraASTROM
from astropy.units.core import UnitsError, UnitTypeError, dime... |
#!/usr/bin/env python
#
# OPTIMAL TRANSPORT NODE
# Implementation of differentiable optimal transport using implicit differentiation. Makes use of Sinkhorn normalization
# to solve the entropy regularized problem (Cuturi, NeurIPS 2013) in the forward pass. The problem can be written as
# Let us write the entropy regula... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# *****************************************************************************/
# * Authors: <NAME>, <NAME>
# *****************************************************************************/
"""
Brief:
A script that extracts uid-specific telemetry data from device or bin... |
#
from datetime import datetime
from itertools import count
from pytz import common_timezones, country_timezones, timezone
from pycountry import countries
from flask_restx import reqparse
import pycountry
import convertdate, os.path, pkgutil
#
def getDateTimeInParticularCalendar(wishedCalendarSystem, wishedDateTime =... |
import os
import logging
import json
import ijson
import shutil
import copy
import datetime
from tqdm import tqdm
import numpy as np
import re
import string
from nltk.tokenize import word_tokenize
from core.config import *
logger = logging.getLogger(__name__)
IGNORE_PUNCT = '"#$&()*,-/;<=>@[\\]^_`{|}~' # keep . ! ? ... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 <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... |
from math import ceil
from prettytable import PrettyTable
from src.utils import create, utils
from ev import Object
class Structure(Object):
"""
This class is what represents the structures that characters
can build in their lairs to give them bonuses and make them
gold.
"""
def at_object_crea... |
# win32.py - utility functions that use win32 API
#
# Copyright 2005-2009 <NAME> <<EMAIL>> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import ctypes
import errno
import msvcrt
import os
import random
import subpro... |
import tvm
import keras
import tvm.relay.frontend as relay_front
import numpy as np
import heterocl as hcl
import hlib
import re
from ..utils import *
from .relay_attr import _attrib, _convert_map
from tvm.relay.function import Function
from tvm.relay.expr import Var, Call, Let, If, Constant
from tvm.relay.expr import ... |
#!/router/bin/python
import pkt_bld_general_test
#HACK FIX ME START
import sys
import os
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CURRENT_PATH, '../../../trex_control_plane/interactive/trex/'))
#HACK FIX ME END
from trex.stl.trex_stl_packet_builder_scapy import *... |
# Copyright 2019 <NAME>. 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 agreed... |
import os
from typing import Union
from typing import Optional, List, Dict, Tuple
from abc import ABC, abstractmethod
import numpy as np
import pandas as pd
import torch
from torch.optim.lr_scheduler import ExponentialLR, StepLR
from torch.utils.data import DataLoader, Dataset
from torch.nn.utils import clip_grad_value... |
# 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
# d... |
import streamlit as st
import pandas as pd
import numpy as np
import plotly.express as px
import plotly as plt
import folium
from streamlit_folium import folium_static
from folium.plugins import MarkerCluster, marker_cluster
st.set_page_config(layout='wide')
@st.cache(allow_output_mutation=True)
def get_data(path):
... |
import copy
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.autograd import Variable
import logging
import time
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(mess... |
#!/usr/bin/env python3
####################################################################################
#TexliveAutoCompile LastVersion 0.9.5 new ver for shellscript refactored to python #
#Powered by orikiringi Belonging to KanagawaUniversity MoritaLab #
#Github:https://github.com/Kurehava ... |
"""
Gab data mapping
This file contains the mappings from the Gab JSON to the relational data structure
used in this tool. It should be viewed and edited alongside gab_schema.sql, which
contains the SQL statements to create the tables.
There is a function to map each Gab data entity from the relevant JSON object to t... |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# <NAME> <<EMAIL>>
# Wed Jun 4 21:22:35 CEST 2014
#
# Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
"""Tests Gabor wavelet functionality
"""
import numpy
import nose.tools
import math, cmath
import os
import bob.io.base
import bob.sp
im... |
#!/usr/bin/python3
import sys
import os
import re
#Use DecInt or the built-in BigInt?
UseDecInt = False
#Blacklist any low-frequency Workers (e.g., Signals)
OnlySingleTickWorkers = True
if UseDecInt:
import DecInt
#Declare our regexes
LL_Key = '\"([^"]+)\"'
LL_Value = '\"([^"]+)\"'
LL_Property = " *%s *: *%s,? ... |
import random
import pygame
from pygame import mixer
pygame.init()
# Set the Height and Width of Your Game Window and Playing Area
w_width = 800
w_height = 700
play_width = 300
play_height = 600
#Box Size is the size of each box in the playing grid
block_size = 30
score = 0
top_left_x = (w_width - play_width) // 2... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
'''
module for handling USB boxes connected via psyscopex install, which circumcents the
usual HID driver.
we provide a HID "emulation" layer, so the rest of the code interacts with this in
the same way as... |
# NOTE TO TA: DO NOT MIND THE LONG PROCCESSING TIMES. THIS PROGRAM MAY BE
# INEFFICIENT, BUT I ASSURE YOU THAT THIS PROGRAM WILL PROCESS THE REQUESTED
# QUERY... EVENTUALLY
# ==========================================================================
# Doctest examples for the following private helper function would... |
import logging
import os
import shutil
import tarfile
from pathlib import Path
from threading import Thread
from typing import Dict, List
import requests
import yaml
from bauh.api.abstract.download import FileDownloader
from bauh.api.abstract.handler import ProcessWatcher
from bauh.api.abstract.view import MessageTyp... |
from django.shortcuts import render,redirect
from django.http import JsonResponse
from django.db.models import Sum,Avg, Max, Min, Count
from django.http import HttpResponse
from .models import *
import datetime,time
from django.utils import timezone
from calendar import monthrange #获取月份的天数
import hashlib
# Create your... |
"""
Copyright (c) 2018 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
Unless required by applicable law or agreed to in writin... |
"""Provides wrappers around low-level XBDM commands."""
import binascii
from typing import Optional
import natsort
from xbdm import rdcp_command
def _parse_int_expression(addr_str: str) -> int:
"""Parses the given string as an expression that evaluates to an integer. NO INPUT SANITIZING IS PERFORMED."""
try... |
from collections import OrderedDict
import logging
from django.conf.urls import url
from django.contrib import messages
from django.http.response import HttpResponseBadRequest, HttpResponseServerError, \
HttpResponseForbidden
from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse
... |
# coding: utf-8
from __future__ import absolute_import
import re
from sentry.grouping.component import GroupingComponent
from sentry.grouping.strategies.base import strategy
from sentry.grouping.strategies.utils import remove_non_stacktrace_variants, has_url_origin
from sentry.grouping.strategies.message import trim_... |
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Driver for servo v4 specific controls through ec3po.
Provides the following console controlled function subtypes:
servo_v4_ccd_mode
"""
import re
im... |
from __future__ import annotations
import ast
import copyreg
import io
import linecache
import math
import pickle
import pickletools
import sys
import pytest
from otf import ast_utils, decorators, pack
from . import pack_utils, utils
LOREM_IPSUM = """
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do... |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
"""Read VS Code theme colors and output them in a terminal
"""
__version__ = '1.0.0'
__date__ = '2021-04-03'
__author__ = '<NAME>'
__credits__ = '''JSON cleanup by <NAME> <<EMAIL>>
source: <https://gist.github.com/liftoff/ee7b81659673eca23cd9fc0d8b8e68b7>'''
# VSCODE ... |
import torch
import torch.nn.functional as F
from torch import nn
from util.misc import (NestedTensor, nested_tensor_from_tensor_list)
from models.modeling.backbone import build_backbone, MLP
from transformers import RobertaModel, BertModel
from models.reftr import build_vl_transformer
from models.criterion import Cr... |
#!/usr/bin/env python
# coding=utf-8
from __future__ import print_function
import os
try:
from urllib import urlencode, quote_plus
except ImportError:
from urllib.parse import urlencode, quote_plus
try:
import urllib2 as wdf_urllib
from cookielib import CookieJar
except ImportError:
import urllib.... |
# SPDX-License-Identifier: MIT
from __future__ import annotations
import asyncio
import ctypes
import enum
import fcntl
import functools
import inspect
import logging
import os
import os.path
import select
import struct
import time
import typing
import uuid
from typing import Any, Awaitable, Callable, Dict, List, Op... |
from sklearn.metrics import f1_score, precision_score, recall_score, accuracy_score, confusion_matrix
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import train_test_split
from sklearn.decomposition import PCA
from sklearn.preprocessing import LabelEncoder
from MulticoreTSNE import Mu... |
"""Module with functions to load datasets and sets of words related to bias."""
import json
import urllib.request
from typing import Dict, List, Union
import numpy as np
import pandas as pd
import pkg_resources
def fetch_eds(
occupations_year: int = 2015, top_n_race_occupations: int = 10
) -> Dict[st... |
#!/usr/bin/env python3
'''
This script processes an xml file which has lines of verse tagged with meter and produces html output.
I use fixTragedy.py to process a Perseus xml file, the result of which I then hand-edit to
add meter tags (e.g. type="ia6") etc. For the format of the file, see the example, prometheusDC.xm... |
from SSINS import INS, SS
from SSINS.data import DATA_PATH
import numpy as np
import os
import pytest
from pyuvdata import UVData, UVFlag
from datetime import datetime
@pytest.mark.filterwarnings("ignore:Reordering", "ignore:invalid value",
"ignore:SS.read")
def test_init():
obs = '10... |
from __future__ import annotations
from typing import Optional, TYPE_CHECKING, Union
from leases.models import BerthLease, WinterStorageLease
if TYPE_CHECKING:
from uuid import UUID
from .models import Order, AbstractOffer, BerthProduct, WinterStorageProduct
from .notifications import NotificationType
i... |
"""
Analyzes the uses of the noscript tag.
"""
from util import get_paths, parse_csv_line, as_bool
from util import benchmark_columns as columns
from urllib.parse import urlparse
import os
import lxml.html
bm_file_path, _, noscript_dir_path, _ = get_paths()
# Category definitions.
cat_alt = "alternative_content"
cat... |
#!/usr/bin/env python
# encoding: utf-8
"""
@Author: yangwenhao
@Contact: <EMAIL>
@Software: PyCharm
@File: enroll_eval.py
@Time: 2020/10/31 13:47
@Overview:
"""
from __future__ import print_function
import argparse
import os
import numpy as np
import torch
import torch._utils
import torch.backends.cudnn as cudnn
i... |
""""""
import sys
import time
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import os
import pandas as pd
from calc_execwise_features import calc_simulation_metrics as load_and_calc_simulation_metrics # Borrowed function
from nodewise_features_metapop import calc_node_metric, load_and_p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.