text stringlengths 3.07k 22.1k |
|---|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import numpy as np
import os
import re
import signal
import subprocess
import sys
def wait_for_output(proc):
"""This is a convenience method to parse a process's stdout and stderr.
Ar... |
from __future__ import absolute_import
import itertools
import operator
import os
from plumbum.lib import six
from abc import abstractmethod, abstractproperty
import warnings
from functools import reduce
class FSUser(int):
"""A special object that represents a file-system user. It derives from ``int``, so it be... |
"""
eureka_train.py
<NAME>, Dec 25 2019
train mask rcnn with eureka data
"""
import transforms as T
from engine import train_one_epoch, evaluate
import utils
import torch
from rock import Dataset
from model import get_rock_model_instance_segmentation
import numpy as np
torch.manual_seed(0)
class ToTensor(object):
... |
#!/usr/bin/python
###############################################################################
# Name : ObjectMarker.py
# Author : Python implementation: sqshemet
# Original ObjectMarker.cpp: http://www.cs.utah.edu/~turcsans/DUC_files/HaarTraining/
# Date : 7/24/12
# Description : Object marker utili... |
# -*- coding: utf-8 -*-
import numpy as np
import chainer
from chainer import cuda, Function, gradient_check, Variable
from chainer import optimizers, serializers, utils
from chainer import Link, Chain, ChainList
import chainer.functions as F
import chainer.links as L
import sys
sys.path.append("//tera/user/boku/study/... |
# Copyright (c) OpenMMLab. All rights reserved.
from re import L
import numpy as np
import torch
from logging import warning
def limit_period(val, offset=0.5, period=np.pi):
"""Limit the value into a period for periodic function.
Args:
val (torch.Tensor): The value to be converted.
offset (fl... |
import unittest
import torch
import torch.nn as nn
from torch.autograd import Variable
from wavenet.layers import *
from test.models import *
import numpy as np
class Test_dilation(unittest.TestCase):
def test_dilate(self):
input = Variable(torch.arange(0, 13).view(1, 1, 13))
dilated, _ = dilate(i... |
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import json
import os
import os.path as osp
import numpy as np
import itertools
DIV_LINE_WIDTH = 50
# Global vars for tracking and labeling data at load time.
exp_idx = 0
units = dict()
def smoothed(data, window):
"""
smooth data with... |
# encoding: utf-8
from lxml.etree import LIBXML_VERSION
import pytest
from libweasyl.text import markdown, markdown_excerpt, markdown_link
libxml_xfail = pytest.mark.xfail(LIBXML_VERSION < (2, 9), reason='libxml2 too old to preserve whitespace')
user_linking_markdown_tests = [
('<~spam>', '<a href="/~spam">spam... |
"""Multipart parallel s3 upload.
usage
pput bucket_name/filename
"""
from queue import Queue
from io import StringIO
from collections import namedtuple
from threading import Thread
import argparse
import base64
import binascii
import functools
import hashlib
import logging
import json
import os
import sys
import bot... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import warnings
from tensorflow.keras.layers import *
from tensorflow.keras.models import Model
from tensorflow.keras.utils import get_file
from tensorflow.keras.backend import image_data_format
from... |
from typing import List
import numpy as np
import pandas as pd
from category_encoders.backward_difference import BackwardDifferenceEncoder
from category_encoders.cat_boost import CatBoostEncoder
from category_encoders.helmert import HelmertEncoder
from category_encoders.james_stein import JamesSteinEncoder
from catego... |
"""Add more line highlighting options to Pygments.
The theme uses a custom pygments HTML formatter,
that adds the ability to highlight added/removed
lines in code.
To make use of this new function, this theme also
extends the default Sphinx ``code-block`` directive.
:copyright: Copyright <NAME>.
:license: MIT, see L... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
import numbers
import numpy as np
from six import text_type, integer_types, binary_type
import google.protobuf.message
from onnx import TensorProto, ... |
"""
pint.unit
~~~~~~~~~
Functions and classes related to unit definitions and conversions.
:copyright: 2016 by Pint Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import annotations
import copy
import locale
import operator
from numbers im... |
'''
Example of VRAE on text data
VRAE, like VAE, has a modular design. encoder, decoder, and VRAE are 3 models that share weights. After training the VRAE model,
the encoder can be used to generate latent vectors of text data(sentences/documents).
The decoder can be used to generate embedding vector of text by sampling... |
# -*- coding:utf-8 -*-
"""
Bitmex REST API & Trade 模块
https://www.bitmex.com/app/wsAPI
https://www.bitmex.com/api/explorer/swagger.json
Author: HuangTao
Date: 2018/08/09
"""
import copy
import asyncio
import json
import hmac
import hashlib
from urllib.parse import urljoin
from quant.utils import tools
from quant... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Author: <NAME> (<EMAIL>)
#
from __future__ import absolute_import, division, unicode_literals
... |
"""Parser for command line options.
This module helps scripts to parse the command line arguments in
sys.argv. It supports the same conventions as the Unix getopt()
function (including the special meanings of arguments of the form `-'
and `--'). Long options similar to those supported by GNU software
may be used as ... |
"""Sub-classes for vtk.vtkRectilinearGrid and vtk.vtkImageData."""
import pathlib
import logging
import numpy as np
import pyvista
from pyvista import _vtk
from pyvista.utilities import abstract_class
from .dataset import DataSet
from .filters import _get_output, UniformGridFilters
log = logging.getLogger(__name__)... |
import os
import time
import calendar
from glideinwms.lib import x509Support
from glideinwms.lib import condorExe
import logging
logger = logging.getLogger()
class Credential:
def __init__(self, proxy_id, proxy_fname, group_descript):
self.req_idle = 0
self.req_max_run = 0
self.adverti... |
import re
import time
from collections import namedtuple
from fabric import Connection
from hashlib import sha256
from invoke.exceptions import UnexpectedExit
from io import StringIO
from jinja2 import Environment
from jinja2 import FileSystemLoader
from pathlib import Path
from typing import Optional
template_path =... |
# Copyright 2020 IBM Corp. 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 agre... |
#! /usr/bin/env python3
## import modules
from Bio import SeqIO
from tqdm import tqdm
import collections
import subprocess as sp
import os
## functions: taxonomy assignment
def tax2dict(acc2tax, taxid, name, accession_dict):
acc_taxid_info = {}
print(f'reading {acc2tax} into memory')
with tqdm(total = os.... |
"""
Module for analysis of spiking-related results
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import round
from builtins ... |
# coding: utf-8
#
# Copyright 2015 Palantir Technologies, 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 applic... |
# -*- coding: utf-8 -*-
__author__ = 'alpaloma'
import logging
import time
from json import dumps
from flask import request, Blueprint, current_app
from flask_cors import CORS
from flask_restful import Resource, Api
from DetailedHTTPException import DetailedHTTPException, error_handler
from Templates import sink_cr_s... |
import asyncio
import itertools
import time
from .chatgetter import ChatGetter
from ... import helpers, utils, errors
from ...events.common import EventCommon
# Sometimes the edits arrive very fast (within the same second).
# In that case we add a small delta so that the age is older, for
# comparision purposes. This... |
import tensorflow as tf
from baconian.core.core import Basic, EnvSpec
import numpy as np
import abc
from baconian.core.parameters import Parameters
from typeguard import typechecked
from tensorflow.python.ops.parallel_for.gradients import batch_jacobian as tf_batch_jacobian
from baconian.common.logging import Recorder
... |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: <NAME>, <NAME>, <NAME>
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
from itertools import chain
import numpy as np
import pytest
from... |
"""
Combinators and related utilities for operating on CCG syntactic types and
semantic forms.
"""
from abc import ABCMeta, abstractmethod
from copy import deepcopy
import itertools
from nltk.ccg.api import FunctionalCategory, PrimitiveCategory
from six import add_metaclass
from pyccg import logic as l
@add_metacl... |
import numpy as np
from copy import deepcopy
from scipy.spatial import distance_matrix
from scipy.spatial.distance import cdist
import networkx as nx
from molfunc.atoms import NNAtom, Atom
from molfunc.atoms import smiles_to_atoms, xyz_file_to_atoms
from molfunc.bonds import get_avg_bond_length
from molfunc.exceptions ... |
# The MIT License (MIT)
#
# Copyright (c) 2018 <NAME> for Adafruit Industries
#
# 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
# ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import numpy as np
import pytest
from zarr.util import (normalize_shape, normalize_chunks, is_total_slice,
normalize_resize_args, human_readable_size, normalize_order,
guess_chunks,... |
"""Unit tests for the Python Client."""
import base64
import io
from pathlib import Path
from typing import Any, Dict, Generator, List, Optional
import pytest
from citric.client import Client
from citric.enums import ImportSurveyType
from citric.session import Session
class MockSession(Session):
"""Mock RPC ses... |
import torch
import numpy as np
import math
from scipy.stats import norm
import matplotlib.pyplot as plt
def plot_gaussian_mixture_1d(var, weights, mu=None):
"""
Visualize 1D Gaussian mixture
"""
if mu is None:
mu = np.zeros_like(var)
x = np.linspace(start = -10, stop = 10, num = 2000)
y_cum = np.zeros... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import bs4 as bs
import requests
import yfinance as yf
#import fix_yahoo_finance as yf
import datetime
import io
import cv2
import skimage
import datetime
from PIL import Image
from pandas_datareader import data as pdr
from skimage import measure
fr... |
# Copyright (c) 2015-2019 The Switch Authors. All rights reserved.
# Licensed under the Apache License, Version 2.0, which is in the LICENSE file.
"""
Defines load zone parameters for the Switch model.
INPUT FILE INFORMATION
Import load zone data. The following tab-separated files are
expected in the input di... |
'''mllib.py:
Python module implementing some machine learning algorithms learned in
Stanford's Machine Learning course on Coursera (October 2015):
https://www.coursera.org/learn/machine-learning/
'''
import matlib
import math
import sys
from datetime import datetime
# System epsilon value
epsilon = sys.float_info.eps... |
"""nushellx_lpt/parser.py
Functions for parsing *.lpt files and generating maps from the data
"""
from __future__ import division
from __future__ import print_function
from os import sep, path, walk
from constants import FN_PARSE_LPT_RGX_FNAME_INT as _RGX_FNAME_INT
from constants import F_PARSE_INT_CMNT_STR as _INT_C... |
# Copyright The PyTorch Lightning team.
#
# 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 i... |
# Copyright 2014 OpenStack Foundation
#
# 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... |
# USAGE
# python anpr_char_det_train.py --modelPath models --imagePath ./../datasets/lplates/train
# You can either pass the annFile (xml annotations file), or if you don't then annotations are loaded from the file name
# labelbinarizer
# Fit to full set of 10 numeric and 26 alphas
# lb.fit(['0','1', ... ,'9','a','b'... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'AacAudioProfile',
'AnalysisResolution',
'AssetContainerPermission',
'ContentKeyPolicyFairPlayRental... |
import tensorflow as tf
from tensorflow.python.framework import constant_op
from tensorflow.python.ops import gradient_checker
import numpy as np
import pytest
import os
import imageio
import matplotlib as mpl
import dps
from dps.datasets.load import load_backgrounds
from dps.datasets.base import EmnistDataset
from dp... |
import requests
import urllib3
import subprocess
import shlex
import math
import logging
import getopt
import sys
from collections import Counter
urllib3.disable_warnings()
LOG_FORMAT = "%(asctime)s - %(levelname)s - %(message)s"
DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
logging.basicConfig(filename="dig.log", level=logging.... |
import math
import numpy as np
import gym
from gym import spaces
from gym.utils import seeding
import sys
sys.path.extend(['../../../gym-guidance-collision-avoidance-single'])
from gym_guidance_collision_avoidance_single.envs.config import Config
__author__ = "<NAME> <<EMAIL>>"
class SingleAircraftEnv(gym.Env):
... |
from __future__ import absolute_import
import pkg_resources
from semantic_version import (
Spec,
)
import rlp
from eth_utils import (
is_integer,
to_dict,
to_tuple,
to_wei,
)
from eth_tester.constants import (
FORK_HOMESTEAD,
FORK_DAO,
FORK_ANTI_DOS,
FORK_STATE_CLEANUP,
)
from e... |
# borgbackup - main setup code (see also other setup_*.py files)
import os
import sys
from collections import defaultdict
from glob import glob
try:
import multiprocessing
except ImportError:
multiprocessing = None
from distutils.command.clean import clean
from setuptools.command.build_ext import build_ext
f... |
# Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
"""Views for the ``online_docs`` app."""
from datetime import datetime
import os
from django.contrib.auth.decorators import login_required
from django.urls import reverse
from django.db.models import Q, Sum
from django.http import Http404, HttpResponse
from django.utils.decorators import method_decorator
from django.v... |
from urllib.parse import urlparse, urlunparse, urlencode, parse_qs
import pprint
import os
from .excs import HTTPError, AuthError, ValidationError
DEFAULT_DOWNLOAD_CHUNK_SIZE = 1024 * 1024
DEFAULT_UPLOAD_CHUNK_SIZE = 1024 * 1024
class ResumableUpload:
"""
Resumable Upload Object. Works in conjuction with me... |
#!/usr/bin/env python
#
#===- rename_check.py - clang-tidy check renamer ------------*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------... |
# global
from typing import Union, Optional, Tuple, Literal
from ivy.framework_handler import current_framework as _cur_framework
# local
import ivy
from ivy.framework_handler import current_framework as _cur_framework
inf = float('inf')
# noinspection PyShadowingBuiltins
def vector_norm(x: Union[ivy.Array, ivy.Nati... |
#!/usr/bin/env python
# coding=utf-8
import os
import re
import time
import datetime
import hashlib
import logging
import string
import random
import base64
from google.appengine.ext import webapp
from google.appengine.api import memcache
from google.appengine.api import urlfetch
from google.appengine.ext import db
f... |
from __future__ import division, print_function, absolute_import
from warnings import warn
import numpy as np
from numpy import (atleast_2d, ComplexWarning, arange, zeros_like, imag, diag,
iscomplexobj, tril, triu, argsort, empty_like)
from .decomp import _asarray_validated
from .lapack import get_... |
# -*- coding: utf-8 -*-
"""
test_markup
~~~~~~~~~~~
Test various Sphinx-specific markup extensions.
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import pickle
from docutils import frontend, utils, nodes
from docutils.parse... |
# Copyright (c) 2020, <NAME>. All rights reserved.
#
# This work is made available under the CC BY-NC-SA 4.0.
# To view a copy of this license, see LICENSE
import numpy as np
import scipy.ndimage
import PIL.Image
def create_perspective_transform_matrix(src, dst):
""" Creates a perspective transformation matrix wh... |
# Copyright 2019-2022 The University of Manchester, UK
# Copyright 2020-2022 Vlaams Instituut voor Biotechnologie (VIB), BE
# Copyright 2020-2022 Barcelona Supercomputing Center (BSC), ES
# Copyright 2020-2022 Center for Advanced Studies, Research and Development in Sardinia (CRS4), IT
# Copyright 2022 École Polytechni... |
""" Module containing classes and routines for the GUI interface
"""
import tempfile
import signal
import subprocess
import os
import argparse
import logging
from typing import TYPE_CHECKING
import ipywidgets as widgets
import jupytext
from ipywidgets import (
HBox,
Label,
VBox,
Text,
Output,
C... |
import os
import logging
from torch.utils import data
import numpy as np
import yaml
from src.common import decide_total_volume_range, update_reso
import ipdb
st = ipdb.set_trace
logger = logging.getLogger(__name__)
# Fields
class Field(object):
''' Data fields class.
'''
def load(self, data_path, idx,... |
#!/usr/bin/env python
"""
Keras implementation of simplified DeepSpeech model.
Forked and adjusted from: https://github.com/robmsmt/KerasDeepSpeech
"""
import argparse
import os
import sys
from datetime import datetime
from os import makedirs
from os.path import join, isdir, exists
from shutil import rmtree
from ker... |
from argparse import ArgumentParser
import h5py
import multiprocessing
import numpy as np
from pathlib import Path
import pickle
import re
import tempfile
import time
import torch
import torch.utils.tensorboard
from types import SimpleNamespace
from utils.data import central_shift, EventCrop, ImageCrop
from utils.data... |
"""Test distributed save and load."""
import subprocess
import tempfile
import unittest
import jax
import jax.numpy as jnp
import numpy as np
import optax
from alpa import (init, shutdown, DistributedArray, PipeshardParallel,
save_checkpoint, restore_checkpoint)
from alpa.device_mesh import get_glo... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility functions (file reading, simple IDL parsing by regexes) for IDL build.
Design doc: http://www.chromium.org/developers/design-documents/idl-build
... |
# -*- coding: utf-8 -*-
"""
Recriação do Jogo da Velha
@author: Prof. <NAME>
"""
import pygame
import sys
import os
import traceback
import random
import numpy as np
import copy
# Import - Inicialização da arvore e busca em profundidade
import tree_dfs
class GameConstants:
# ... |
from datetime import datetime
from functools import wraps
from sqlalchemy.sql.expression import func, and_
from app.flask_app import celery
from app.db import with_session
from const.schedule import TaskRunStatus
from lib.sqlalchemy import update_model_fields
from models.schedule import (
TaskSchedule,
TaskRun... |
"""Async I/O backend support utilities."""
from __future__ import absolute_import, unicode_literals
import socket
import threading
from collections import deque
from time import sleep
from weakref import WeakKeyDictionary
from kombu.utils.compat import detect_environment
from celery import states
from celery.excepti... |
"""passlib.utils.compat - python 2/3 compatibility helpers"""
#=============================================================================
# figure out what we're running
#=============================================================================
#------------------------------------------------------------------... |
'''LED visual effects'''
from led_event_manager import LEDEvent, Color, ColorVal, ColorPattern
import gevent
nodeToColorArray = [ColorVal.BLUE, ColorVal.DARK_ORANGE, ColorVal.LIGHT_GREEN, ColorVal.YELLOW, \
ColorVal.PURPLE, ColorVal.PINK, ColorVal.MINT, ColorVal.SKY]
class Timing:
VTX_EXP... |
#/ Type: DRS
#/ Name: Hf Isotopes Example
#/ Authors: <NAME> and <NAME>
#/ Description: A Hf isotopes example
#/ References: None
#/ Version: 1.0
#/ Contact: <EMAIL>
from iolite import QtGui
import numpy as np
def runDRS():
drs.message("Starting Hf isotopes DRS...")
drs.progress(0)
# Get settings
settings = drs... |
from dataclasses import dataclass
from matplotlib import dates as mdates
from sauronlab.core.core_imports import *
from sauronlab.model.metrics import *
from sauronlab.viz._internal_viz import *
from sauronlab.viz.figures import *
class TimelineLabelType(SmartEnum):
""""""
NONE = enum.auto()
TIMES = en... |
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# coding=utf-8
"""Network-related monitors for SimpleMonitor."""
import re
import sys
import socket
import datetime
import subprocess
import requests
from requests.auth import HTTPBasicAuth
from .monitor import Monitor, register
@register
class MonitorHTTP(Monitor):
"""Check an HTTP server is working right.
... |
# -*- coding: utf-8 -*-
import os
import logging
from typing import Optional
from dotenv import load_dotenv
from httpx import Client
load_dotenv(dotenv_path='.env.test')
def upload_mets_file(client: Client, file_path: str) -> Optional[dict]:
files = {'file': open(file_path, 'rb')}
resp = client.post('/metad... |
#
# 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
# ... |
from ..typecheck import *
from ..import core
from .debugger_interface import DebuggerInterface
from .debugger import DebuggerStateful
import sublime
import sublime_plugin
import json
# commands look like...
"""
"command": "debugger_command",
"args": {
action": "..."
}
"""
# window.run_command("debugger_run", {"act... |
import json
import zipfile
import mock
from nose.tools import eq_
from pyquery import PyQuery as pq
import amo
import amo.tests
from addons.models import Addon, AddonUser
from devhub.models import ActivityLog, AppLog
from editors.models import EscalationQueue
from files.models import File
from users.models import Use... |
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
#!/usr/bin/python
'''
The MIT License (MIT)
Copyright (c) 2018 <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, ... |
# SPDX-License-Identifier: Apache-2.0
#
# http://nexb.com and https://github.com/nexB/scancode.io
# The ScanCode.io software is licensed under the Apache License version 2.0.
# Data generated with ScanCode.io is provided as-is without warranties.
# ScanCode is a trademark of nexB Inc.
#
# You may not use this software ... |
# Copyright 1996-2018 Cyberbotics Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
from __future__ import absolute_import
import sys
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn import init
from IPython import embed
class AttentionRecognitionHead(nn.Module):
"""
input: [b x 16 x 64 x in_planes]
output: probability sequence: [b x T x num_classes]
"""
... |
# import the necessary packages(we used only numpy and matplotlib :D )
import numpy as np
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import time
def rectangle(img,x,y,w,h,t):
img[y-t:y,x-t:x+w+t,:]=255
img[y-t:y+h+t,x+w:x+w+t,:]=255
img[y+h:y+h+t,x-t:x+w+t,:]=255
img[y-t... |
"""
:py:class:`QWUtils` - Popup GUIs
================================
Usage::
# Test: python lcls2/psana/psana/graphqt/QWUtils.py 0
# Import
from psana.graphqt.QWUtils import *
# Methods - see test
See:
- :py:class:`QWUtils`
- `lcls2 on github <https://github.com/slac-lcls/lcls2>`_.
This s... |
# Valid package specifiers for pipx:
# PEP508-compliant
# git+<URL>
# <URL>
# <pypi_package_name>
# <pypi_package_name><version_specifier>
# <local_path>
import logging
import re
from pathlib import Path
from typing import List, NamedTuple, Optional, Set, Tuple
from packaging.requirements import InvalidRe... |
import logging
from datetime import datetime, timezone
from typing import Optional
from dateutil.relativedelta import relativedelta
from app.data_models.answer import AnswerValueTypes
from app.questionnaire.rules.utils import parse_datetime
MAX_REPEATS = 25
logger = logging.getLogger(__name__)
def evaluate_compar... |
# coding: utf-8
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# <NAME> <<EMAIL>>,
# <<EMAIL>>
#
# Distributed under the terms of the 3-clause BSD license.
# The full license is in the LICENSE file, distributed with this software.
#
# ... |
#!/usr/bin/python3
from ctypes import *
import cv2
import numpy as np
import sys
import os
import time
from ipdb import set_trace as dbg
from enum import IntEnum
import imutils
tracking=False
lib_dir='/home/atsg/PycharmProjects/face_recognition/FaceKit/PCN/'
class CPoint(Structure):
_fields_ = [("x", c_int),
... |
# Natural Language Toolkit: Classifier Utility Functions
#
# Copyright (C) 2001-2020 NLTK Project
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>> (minor additions)
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Utility functions and classes for classifiers.
"""
import math
# from nltk... |
# emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# -*- coding: utf-8 -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and... |
from tensorboardX import SummaryWriter
import os, glob, csv, random, time
import datetime, time, json, shutil
from tqdm import tqdm
import numpy as np
import PIL, cv2
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import transforms
from PIL import Image
import matp... |
#!/usr/bin/python
import argparse
import copy
import json
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import re
import scipy as sp
import tensorflow as tf
from functools import reduce
from sklearn.metrics import auc
from sklearn.metrics import roc_curve
from sklearn.preprocessing i... |
# Lint as: python2, python3
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
import os, sys, struct
sys.path.append('../test')
import bcd, functools, itertools
from objects import knownguids
store = bcd.BCD('BCDTest')
guids = [
'{150e57bb-8333-11e3-a0d2-000c2994873a}',
'{33238d8c-8333-11e3-a0d2-000c2994873a}',
'{c66dfa6e-8332-11e3-a0d2-000c2994873a}',
'{d99dfa6e-8442-22f3-b2... |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... |
from typing import Dict, List, Tuple
from itertools import product
import re
import yaml
from pathlib import Path
import numpy as np
import os
import shutil
from abc import ABCMeta, abstractmethod
import nncase
import struct
from compare_util import compare_with_ground_truth, VerboseType
class Edict:
def __init__... |
import functools
import logging
from datetime import datetime
import django
from django.contrib import admin
from django.contrib import messages
from django.db.models import F
from django.http import HttpResponse
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.utils.translatio... |
# 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 to in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.