text stringlengths 3.07k 22.1k |
|---|
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""
FILE:... |
# Copyright 2018 The CapsLayer Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
import sherpa.ui as ui
import numpy as np
import matplotlib.pyplot as plt
from mod_gasdensity import *
import plotting
'''
Functions for fitting the gas density profile
'''
def find_nemodeltype(ne_data, tspec_data, optplt=0):
'''
Fit all four gas density model options: beta model, cusped beta model,
t... |
import warnings
warnings.simplefilter("ignore",FutureWarning)
import os,datetime,math,sys,io,struct
import numpy as np
from PIL import Image
import tensorflow as tf
from tensorflow.python.keras.layers import Flatten,Dense,Dropout,InputLayer
from tensorflow.python.keras.layers import Conv2D,GaussianNoise,MaxPool2D
def... |
"""
---
title: Transformer Encoder and Decoder Models
summary: >
These are PyTorch implementations of Transformer based encoder and decoder models,
as well as other related modules.
---
# Transformer Encoder and Decoder Models
"""
import math
import torch
import torch.nn as nn
from labml_helpers.module import Mod... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class SaleOrder(models.Model):
_inherit = 'sale.order'
mrp_production_count = fields.Integer(
"Count of MO generated",
compute='_compute_mrp_production_c... |
# September 2020 <NAME> working on tennis bot. Program goal for now is to show off the basic functions like moving forawrd and turning.
from collections import deque
from imutils.video import VideoStream
import numpy as np
import argparse
import cv2
import imutils
import time
import RPi.GPIO as G
# define the lower ... |
from typing import Optional, List, Tuple, Union, Type
import copy
import torch
from torch.nn.functional import binary_cross_entropy, cross_entropy
from transformers import BertModel, BertTokenizer
from tree import IntentTree, Intent, Slot
def are_spans_overlapping(span1, span2):
return (
(span1[0] >= sp... |
# -*- coding:utf-8 -*-
from lxml import html
import requests,pymysql
import json
import re,time
#加载微博参数 uid,containerid
#评论请求需要参数 id,page
# uid:5044281310
# containerid:107603 + uid
#实例方法和类方法 self 是实例方法 cls 是类方法
#正则表达式的元字符 . * ?
class Tool:
#去除img标签
removeImg = re.compile('<img.*>| {1,7}| ')
#去除超链... |
import datetime
import numpy as np
import os
import pandas as pd
import re
import sys
# Count the number of entries in a DataFrame, then output as a string.
def count(dataframe):
return str(len(dataframe.index))
# Function to add a track to an output list.
def add(artist, title, output):
artist_list = artist.... |
"""
Provide hit highlighting to the search.
Highlighting requires amendation of the query as well as post-processing of
the returned results. :func:`.highlight` adds a highlighting part to the query
in the Elasticsearch DSL. :func:`.add_highlighting` performs post-processing
of the search results. :func:`.preview` gen... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import io
import json
import os
import sys
import crochet
import six
import zlib
from six.moves.urllib_parse import urlparse
from twisted.python.failure import Failure
from twisted.internet.defer import CancelledError
from twisted.internet.defer import Def... |
# perform gwas, use sub functions
import argparse
import torch
import numpy as np
from itertools import repeat
from perform_gwas import model, kin, perm
from preprocessing import load_files, prepare_data
import time
def gwas(arguments: argparse.Namespace, X: torch.tensor, y: torch.tensor, K: torch.tensor, covs: torch... |
# A simple notepad application
from tkinter import *
from tkinter import messagebox
import sqlite3
conn = sqlite3.connect('file.db')
c = conn.cursor()
'''
c.execute("""CREATE TABLE files (
name text,
body text
)""")
'''
root = Tk()
root.geometry('800x800')
root.title('Notepad')
... |
import json
import click
import PIL as pil
from pycocotools import cocoeval
import torch
from torchvision import datasets as dsets
from torchvision import models as tmodels
from torchvision import transforms as tforms
import torchvision.ops as tvops
import torchvision.transforms.functional as ttf
import matplotlib.pyp... |
# coding:utf-8
from flask_wtf import Form
from wtforms import StringField, TextAreaField, BooleanField, SelectField, FileField, IntegerField,\
SubmitField
from wtforms.fields.html5 import DateField, DateTimeField
from wtforms.validators import Required, Length, Email, Regexp
from wtforms import ValidationError
fro... |
from collections import namedtuple
import math
import struct
import util
PATTERN_COUNT = 98
ControlData = namedtuple('ControlData', [
'next_pattern_ptr1', # 2
'unknown1', # 2
'next_pattern_ptr2', # 2
'last_pattern_end_ptr', # 2
'unknown2', # 2
'la... |
#
# Copyright (c) 2019-2022, NVIDIA 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... |
# HiQ version 1.0.
#
# Copyright (c) 2022, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
#
import os
import hiq
import itree
from hiq import tree_func
from hiq.constants import FORMAT_DATETIME, FORMAT_TIMESTAMP
itree.uuid()
# ... |
#!/usr/bin/env python3
import argparse
import re
import time
import sys
import os
import math
import threading
import subprocess
import traceback
RE_CPU_LINE = re.compile(r'^cpu(\d+) (\d+) (\d+) (\d+) (\d+) (\d+) (\d+) (\d+)')
class CpuLoad(object):
def __init__(self, cpu_id):
self.cpu_id = cpu_id
... |
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
import cv2
from PIL import Image,ImageTk
import captureWin
import attendance
root = Tk()
root.title("Attendance System")
root.geometry("550x300") # width x height
root.minsize(550, 300)
root.maxsize(550, 300)
# ================= frame ====... |
'''
Implements the Single Base Mutator (SBC)
Runs a traditional MCTS which mutates single bases and calculates immediate reward
First process of the SAP
'''
import copy
import RNA
#from eterna_score import eternabot_score
from difflib import SequenceMatcher
#from eterna_score import eternabot_score
from random import ... |
#!/usr/bin/env python
import torch
from gpytorch.distributions import MultivariateNormal
from gpytorch.kernels import RBFKernel, MaternKernel
from sklearn.datasets import make_blobs
from .dataset import Dataset
class NearestNeighborClassifier(object):
def __init__(self, X, Y):
from sklearn.neighbors im... |
"""
Some of this is direct or modified from:
https://github.com/ShangtongZhang/DeepRL/tree/master/deep_rl/network
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal, OneHotCategorical
import numpy as np
def layer_init(layer, w_scale=1.0):
if hasattr(layer, ... |
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université
# "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. "
import time
import numpy as np
from mpi4py import MPI
from nest_elephant_tvb.translation.s... |
# This file is part of me-features-to-mol-ID-mapping.
#
#
# Copyright © 2021 Blue Brain Project/EPFL
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the APACHE-2 License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; wi... |
import os
import traceback
from tqdm import tqdm
from unidecode import unidecode
import pandas as pd
import requests
from requests.auth import HTTPBasicAuth
from ratelimit import limits, sleep_and_retry
from time import gmtime, strftime
import json
import logging
import csv
import base64
import hashlib
tqdm.monitor_int... |
#!/usr/bin/env python3
import pygame
import sys
import random
from tkinter import Tk, messagebox
from constants import Colours
from algorithms import Dijkstra, AStar
class MessageBox:
def __init__(self):
self.window = Tk()
self.window.wm_withdraw()
def show_error(self, msg):
messageb... |
from tenable.errors import *
from ..checker import check
import pytest
def test_audit_files_constructor_name_typeerror(sc):
with pytest.raises(TypeError):
sc.audit_files._constructor(name=1)
def test_audit_files_constructor_description_typeerror(sc):
with pytest.raises(TypeError):
sc.audit_fil... |
"""
Numeric operators.
Add support for using Dice numerically. For the most part all operations
should work as expected. But two methods have two different ways they
could be reasonably expected to work.
For the examples :code:`d6` is defined as :code:`Dice.from_dice(6)`.
- Most operations work as if you were apply... |
import re
from abc import abstractmethod
from pprint import pformat
from time import sleep
from typing import List, Dict, Tuple, Optional, Union, Generator
from datasets import (
Dataset,
DatasetDict,
DatasetInfo,
concatenate_datasets,
load_dataset,
)
# Defualt values for retrying dataset downloa... |
"""This contains all Bcfg2 Tool modules"""
import os
import sys
import stat
import time
import pkgutil
from subprocess import Popen, PIPE
import Bcfg2.Client.XML
from Bcfg2.Bcfg2Py3k import input
if hasattr(pkgutil, 'walk_packages'):
submodules = pkgutil.walk_packages(path=__path__)
else:
# python 2.4
imp... |
from time import time
import numpy as np
import tensorflow as tf
import torch
import torch.nn as nn
from autograd_minimize import minimize
from autograd_minimize.tf_wrapper import tf_function_factory
from autograd_minimize.torch_wrapper import torch_function_factory
from numpy.random import random
from numpy.testing i... |
"""
The following Events can be raised by Clients via API requests /notify/CLASSNAME.
This allows to inform the API about user activities that take only place on the client side.
"""
from fabrikApi.models.contenttree.content_peerreview import DBContentPeerReview, DBContentPeerReviewProgression
import logging
import js... |
"""
The MIT License (MIT)
Copyright (c) 2021-present tag-epic
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, me... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author: <NAME>
@Contact: <EMAIL>
@File: dataset.py
@Time: 2020/1/2 10:26 AM
"""
import os
import torch
import json
import h5py
from glob import glob
import numpy as np
import torch.utils.data as data
# import nyuName2ID as nyu
BASE_DIR = os.path.dirname(os.path.absp... |
#!/usr/bin/env python
# encoding:UTF-8
################################################################################################
#
# Community Detection via Local Spectral Clustering
#
################################################################################################
# (Our algorithm is also k... |
# --- Revised 3-Clause BSD License ---
# Copyright Semtech Corporation 2022. 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 ... |
import os
import time
import numpy as np
from random import randrange, random
from taps.paths import Paths
from taps.db import PathsDatabase
from taps.build import read_csv
from taps.utils.utils import ImageIndexing
from taps.distances import FrechetDistance
class OneDict(dict):
def __init__(self, **kwargs):
... |
import time
import sys
import pygame
import pygame_menu
from bomber_monkey.features.controller.controller_descriptor import ControllerDescriptor
from bomber_monkey.features.player.player_action import PlayerAction
from bomber_monkey.features.player.players_config import PlayersConfig, MAX_PLAYER_NUMBER
from bomber_mo... |
import wx
import wx.lib.mixins.listctrl as listmix
import os
import sys
import itertools
import Model
import Utils
from FixCategories import FixCategories
import HelpSearch
from Undo import undo
class AutoWidthListCtrl(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin):
def __init__(self, parent, ID = wx.ID_ANY, pos=wx.De... |
#! /usr/bin/env python3
import re
import time
import json
import logging
from datetime import datetime
from . import api_master_rest_caller
BASE_1m = (60*1000)
BASE_1h = BASE_1m*60
BASE_1d = BASE_1h*24
BASE_1w = BASE_1d*7
BASE_BINANCE_MINS = [1, 3, 5, 15, 30]
BASE_BINANCE_HOURS = [1, 2, 4, 6, 8, 12]
BASE_BINANAE... |
r"""
<NAME>
09-04-18
Tabulated green's functions for heterogenous chains which sample uniformly from linkers
31-51bp inclusive (corresponds to one period). So far, have calculated 5 chains of 100 nucs,
50 chains of 50 nucs, and 30 chains of 25ish nucs (at least 4675bp of DNA).
This script loads in the greens function... |
from SimulationSettings import *
from SimulationSettings import Omega_var_noise as Omega
from header import *
import pickle
try:
from ExtraSpecifications import *
except:
pass
def new_sig(t, delta_t, Omega):
T = np.pi / Omega
T_WIDTH = int(T / delta_t)
NUM_SINCS = int(len(t) / T_WIDTH)
# prin... |
'''
Data pipeline for three teams competition app
'''
# setup selenium
import selenium
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expect... |
import itertools
import json
import multiprocessing
import os.path
import pathlib
import shutil
import subprocess
import sys
from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Tuple, Union
import click
import pandas as pd
from loguru import logger
from hopsparser import conll2018_eval as evaluator
... |
# Copyright 2017 British Broadcasting 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 a... |
import py
from pycket import config
from pycket.util import add_copy_method
from rpython.rlib.unroll import unrolling_iterable
from rpython.rlib import jit, debug, objectmodel
add_clone_method = add_copy_method("_clone")
def _not_null(s_arg, bookkeeper):
return not s_arg.can_be_None
def inline_small_list... |
#!/usr/bin/python
# (c) 2018, NetApp, Inc
# 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',
'status': ['preview'],
... |
from skimage.feature import corner_harris, peak_local_max
import numpy as np
def dist2(x, c):
# Borrowed from https://inst.eecs.berkeley.edu/~cs194-26/fa18/
ndata, dimx = x.shape
ncenters, dimc = c.shape
assert dimx == dimc, 'Data dimension does not match dimension of centers'
return (np.ones((nc... |
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import math
import rosbag
import time
import rospy
import scipy.io as sio
from scipy.signal import filtfilt
################################################
# HELPER FUNCTIONS
################################################
def latlon_to_XY(lat0... |
# Copyright (C) 2016 Hewlett-Packard Development Company, L.P.
# 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/LICEN... |
import logging
import subprocess
import xml.etree.ElementTree as ET
import io
import random
import gzip
import re
import sys
import os
import argparse
from os import path
from nltk.tokenize import word_tokenize
from tqdm import tqdm
from bs4 import BeautifulSoup
from SEReader import SEDataReader, POST_TYPE_QUESTION, P... |
# This solution was build using python 2.7
# Author: <NAME> <EMAIL>
import random
import numpy as np
# This is a simple class that builds the Board that will be shown to the user.
class Board:
def __init__(self, height, width):
self.matrix = np.chararray((height, width))
self.matrix[:] = "."
... |
from antlr4 import CommonTokenStream, InputStream
from antlr4.error import Errors, ErrorListener
from antlr4.tree.Tree import TerminalNodeImpl
from pionic.antlr.IonTextLexer import IonTextLexer
from pionic.antlr.IonTextParser import IonTextParser
import arrow
from decimal import Decimal
from base64 import b64decode, b6... |
from pbge import Singleton
import color
import jobs
import tags
import random
import personality
FR_ENEMY = "ENEMY"
class Faction(Singleton):
name = "Faction"
factags = ()
mecha_colors = (color.AceScarlet, color.CometRed, color.HotPink, color.Black, color.LunarGrey)
CAREERS = {
tags.Trooper: (... |
import abc
import time
import logging
from functools import partial
from collections import defaultdict, OrderedDict
from marvinbot.errors import HandlerException
from marvinbot.defaults import DEFAULT_PRIORITY
from marvinbot.models import User
from marvinbot.cache import cache
from marvinbot.plugins import Plugin
imp... |
"""This pt setting up snake's visions in 8 directions"""
from Parameters import *
class Vector():
def __init__(self, snake, food):
"""
:param snake: set up for snake class
:param food: set up for food class
vector is a set of vector from snake head to wall in 8 directions
"... |
import os
import re
import sys
import shlex
import socket
import subprocess
import collections
if sys.version_info[0] == 3 or sys.version_info[:2] == (2, 7):
import argparse
else:
from .. import _argparse as argparse
# Relative imports needed!
from . import logger
from .setup_globals import gvars
from .utils ... |
'''
Created on March 26, 2018
@author: Natalie
'''
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
from scipy.integrate import quad
import random
from _overlapped import NULL
def plot_graph(Graph):
options = {
'node_color': 'yellow',
'font_weight': 'bold',
'node_size': 800,
... |
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.optim
import torch.nn.functional as F
import math
import logging
logger = logging.getLogger(__name__)
def get_optimizer(args, params):
"""
Get the optimizer class from PyTorch depending on the argument specified
"""
... |
import json
import logging
import re
from copy import deepcopy
from functools import wraps
from textwrap import indent
from threading import Lock
from BotpySE import Command
import tabulate
from regex import normalize
logger = logging.getLogger(__name__)
def _at_notification(username, _sub=re.compile(r"[^\w'.-]*"... |
# Copyright © 2022 <NAME>
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://www.wtfpl.net/ for... |
# -*- coding: utf-8 -*-
ROTATION = {0: 0,
BOTTOM: 0,
DOWN: 0,
1: HALF_PI,
LEFT: HALF_PI,
2: PI,
TOP: PI,
UP: PI,
3: PI + HALF_PI,
RIGHT: PI + HALF_PI,
BOTTOM + RIGHT: 0,
DOWN + RIGHT: 0,
... |
import argparse
import json
import os
import subprocess
import sys
import traceback
from pprint import pprint
import requests
from unidiff import PatchSet
COMMENT_TEXT = """The `black` formatter suggests these changes. To automatically format your code before committing, consider [enabling `black` autoformatting in ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 <NAME> (C) 2019-2021 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
"""Idea: Run or debug an experiment script using exactly the same code,
i.e., for both testing and ... |
# Copyright 2017 - Nokia
#
# 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... |
"""
Station handling and coordinate search
"""
# pylint: disable=invalid-name,too-many-arguments,too-many-instance-attributes
# stdlib
from contextlib import suppress
from copy import copy
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, Dict, List, Optional, Tuple, Type, Type... |
# Global Cache GC-100 plugin
#
# Author: Dnpwwo
#
# API Spec: http://www.globalcache.com/files/docs/API-GC-100.pdf
#
# Current version only supports Relay operations
#
"""
<plugin key="GC-100" name="Global Cache 100" author="dnpwwo" version="2.2.6" externallink="//http://www.globalcache.com/products/gc-100... |
from collections import defaultdict, deque
class Tree(object):
def __init__(self):
pass
class __Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def _addnode(self, data, node):
if node is None:
nod... |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 16 16:19:55 2021
Author: <NAME>
License: BSD-3
"""
import numpy as np
from scipy import stats
# import matplotlib.pyplot as plt
from numpy.testing import assert_allclose
from statsmodels.base.model import GenericLikelihoodModel
from statsmodels.distributions.copula.api i... |
import hashlib
import abc
from tools.person import Person
from tools import helper as h
from fpre.fpre import Fpre
from conf import conf
from exceptions.CheaterException import CheaterRecognized
class Gate:
TYPE_AND = 0
TYPE_XOR = 1
WIRE_A = 0
WIRE_B = 1
WIRE_Y = 2
def __init__(self, id: in... |
import numpy as np
import pytest
from numpy import testing as npt
import pyfar
from pyfar.dsp import filter
from pyfar import FilterSOS, Signal
def test_center_frequencies_iec():
nominal_octs = [31.5, 63, 125, 250, 500, 1000, 2000, 4000, 8000, 16000]
actual_octs = filter.fractional_octave_frequencies(num_fra... |
#!/usr/bin/env python
"""
VMat Class
@author: <NAME>, Greenleaf Lab, Stanford University
"""
#Import necessary python modules
from scipy import signal, ndimage
import numpy as np
from copy import copy
import matplotlib.pyplot as plt
class VMat_Error(Exception):
"""Class for errors in VMat function"""
def __i... |
#!/usr/bin/python
import pandas as pd
import sys, getopt
import matplotlib.pyplot as plt
import numpy as np
import re
import os
import glob
from matplotlib import cm
from scipy.optimize import minimize, brute
from scipy import interpolate, optimize
from mpl_toolkits.mplot3d import Axes3D, art3d
from matplotlib.patches... |
# coding=UTF-8
#
# Copyright 2017 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 ap... |
import inspect
import json as jsonlib
import re
from functools import partial
from typing import (
Any,
AsyncIterator,
Callable,
Dict,
Iterator,
List,
Optional,
Pattern,
Sequence,
Tuple,
TypeVar,
Union,
)
from unittest import mock
from urllib.parse import urljoin, urlpars... |
# 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... |
# ******************************************************************************
# Copyright 2017-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.apa... |
"""Module for the OdkPrompt class."""
from ppp.config import get_template_env
from ppp.definitions.constants import (
TRUNCATABLE_FIELDS,
LANGUAGE_DEPENDENT_FIELDS,
LANGUAGE_DEPENDENT_FIELDS_NONMEDIA_FIELDS,
TEMPLATES,
IGNORE_RELEVANT_TOKEN,
RELEVANCE_FIELD_TOKENS,
PPP_REPLACEMENTS_FIELDS,
)... |
#
# 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... |
"""
Code based on bag-of-tricks repo:
https://github.com/michuanhaohao/reid-strong-baseline
"""
import numpy as np
import torch
from tqdm import tqdm
def evaluate(distmat: torch.Tensor, q_pids: torch.Tensor, g_pids: torch.Tensor, q_camids: torch.Tensor,
g_camids: torch.Tensor, max_rank=50, device=None):
... |
#!/usr/bin/env python3
import json
import numpy as np
from map_processing import graph_utils, as_graph
import matplotlib.pyplot as plt
import firebase_admin
from firebase_admin import db
from firebase_admin import credentials
from firebase_admin import storage
from g2o import SE3Quat, Quaternion
import os
def locati... |
# encoding: utf-8
from __future__ import division
import itertools
from collections import OrderedDict
import warnings
import numpy as np
import pandas as pd
def _drop_zeros(df):
"""
Drop zeros from a DataFrame, returning an iterator over the columns
in the DataFrame.
Yields tuples of (column name... |
# Copyright (c) 2018 Cloudify Platform 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-2.0
#
# Unless required by ap... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is referred and derived from project NetworkX
#
# which has the following license:
#
# Copyright (C) 2004-2020, NetworkX Developers
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# All rights reserved.
#
# This file is part of NetworkX.
#
# NetworkX... |
from collections import defaultdict
from datetime import datetime
import os
import pandas as pd
from tqdm import tqdm
import time
import pickle
import argparse
import csv
import utils
import numpy as np
def read_demo(DATA_DIR, patient_list=None):
"""
df_demo['SEX'].value_counts():
F 33498
... |
from __future__ import generators
import os, random, math
import gamesrv
from bubbob import images
from bubbob.images import ActiveSprite
from bubbob import boards
from bubbob.boards import CELL
from bubbob.player import Dragon, BubPlayer, scoreboard
from bubbob.bubbles import Bubble
from bubbob.bonuses import Bonus
fr... |
import pandas as pd
########### Add State Info ################
def add_state_abbrev(df, left):
us_state_abbrev = {
'Alabama': 'AL', 'Alaska': 'AK', 'Arizona': 'AZ', 'Arkansas': 'AR', 'California': 'CA', 'Colorado': 'CO',
'Connecticut': 'CT', 'Delaware': 'DE', 'Florida': 'FL', 'Georgia': 'GA', 'Hawaii': 'HI', 'Id... |
"""
This module programmatically defines every ONNX operation as a python callable function. Executing ONNX graphs in this
way somewhat defeats the performance purposes of ONNX since the overhead for each operation will be high. However, this
allows us to test the MDF scheduler (which invokes Python functions) on any M... |
import pandas as pd
import numpy as np
import datetime
from dateutil import parser
from scipy import stats
def get_data(path, sep=',', header=0, txt=True) -> pd.DataFrame:
"""
Create the dataframe from the csv and print some information about it
:param str path: the path to the csv file
:param char sep: the separ... |
import sys
import optparse
import logging
import time
from matplotlib.backends.backend_pdf import PdfPages
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.projections import PolarAxes
from matplotlib.ticker import MultipleLocator,FormatStrFormatter
import katpoint
from katpoi... |
from __future__ import annotations
import copy
import pytest
from shapely.geometry import MultiPolygon
from shapely.geometry import Polygon
from CCAgT_utils.categories import CategoriesInfos
from CCAgT_utils.types import annotation
@pytest.fixture
def bbox_params():
x = {
'x_init': 100,
'y_init... |
import argparse
import gym
import numpy as np
import os
import sys
import tensorflow as tf
import tempfile
import time
from collections import deque
import baselines.common.tf_util as U
from baselines import logger
from baselines import EERL
from baselines.EERL.replay_buffer import ReplayBuffer
from baselines.common.... |
# SPDX-License-Identifier: BSD-3-Clause
'''The Atom Syndication Format is a feed format similar in purpose to RSS,
but much better defined.
Its specification is in RFC 4287: http://tools.ietf.org/html/rfc4287
'''
from time import gmtime, strftime
from typing import Any, ClassVar, Collection, Iterator, List
from typ... |
import stripe
from woocommerce import API
from datetime import date, datetime
import sys
import re
from decimal import *
import calendar
import json
from collections import OrderedDict, defaultdict
import math
import argparse
# I know, the rest of this suuuucks. but it works. So take that!
parser = argparse.ArgumentP... |
#!/usr/local/bin/python3
# Conduct segmentation on text data
# <NAME>
# 3/12/2017
import subprocess
import sys
import ast
import os
import pandas as pd
import numpy as np
import random
import math
##
# take a list of str as input, and output the sentence index of segment boundaries
def conduct_segment(inputlist, con... |
import os
import pickle
import numpy as np
import argparse
import matplotlib.pyplot as plt
import sys; sys.path[0] = '/export/home/tape/'
from tape.utils import *
def create_parser():
parser = argparse.ArgumentParser(description='plots relative accuracies')
parser.add_argument('--split', default='casp12',
... |
"""Validators"""
# pylint: disable=too-few-public-methods
from formencode import Schema, validators, ForEach
from ..utils.validation import ValidateISODate
class PublicKeyValidator(Schema):
"""Public Key entity Validator"""
id = validators.String()
active = validators.Bool()
date_created = ValidateI... |
from PIL import Image
import torch
import numpy as np
import os
import torchvision
from data import create_dataset
from segmentation.test_single_image import semseg
from models import create_model
from util import util
from util.visualizer import save_images
import torchvision.transforms as tfs
from options.test_option... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.