text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python
import rospy
from nav_msgs.msg import Odometry
from mav_msgs.msg import RollPitchYawrateThrust
from geometry_msgs.msg import PoseStamped
from sensor_msgs.msg import Imu
import numpy as np
import math
import tf
import message_filters
class PIDController:
def __init__(self, kp = 0.0, ki = 0.0... |
import tensorflow as tf
def get_model(config):
net = ResNet50(config)
return net
class ResNet50(tf.keras.Model):
def __init__(self,config):
super(ResNet50,self).__init__(name='')
self.conv2a = tf.keras.layers.Conv2D(64, (7, 7),strides=(2,2),padding='same',name='conv_input')
self.bn2a = tf... |
import os
import json
import unittest
from urllib import urlencode
from test_fixtures.test_models import Base, Master, Crime, BusinessLicense
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import csv
from cStringIO import StringIO
from subprocess import call
from sqlalchemy.exc import Oper... |
# Copyright 2021 The TensorFlow 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 applica... |
import unittest
import numpy
import six
from chainer.backends import cuda
import chainer.functions as F
from chainer.functions.rnn import lstm
from chainer import gradient_check
from chainer import testing
from chainer.testing import backend
def sigmoid(x):
return numpy.tanh(x * 0.5) * 0.5 + 0.5
def _shaped_r... |
'''
yeekit translate for free as in beer
'''
import sys
import logging
from typing import Callable, Any, Tuple
import json
from time import time
from random import randint
import pytest # type: ignore
# import mock
# import urllib3
from ratelimit import limits, sleep_and_retry # type: ignore
import requests
from fu... |
# Copyright (C) 2010-2018 <NAME> <<EMAIL>>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library ... |
# Checks methods for getting 3d world locations from depth map and from point
# cloud.
from absl import app
from absl import flags
import carla
import cv2
import pptk
import time
import pylot.utils
from pylot.drivers.sensor_setup import CameraSetup, LidarSetup
from pylot.perception.camera_frame import CameraFrame
fro... |
"""This module contains drivers for the following equipment from Pfeiffer
Vacuum:
* TPG 262 and TPG 261 Dual Gauge. Dual-Channel Measurement and Control
Unit for Compact Gauges
"""
import time
import serial
# Code translations constants
MEASUREMENT_STATUS = {
0: 'Measurement data okay',
1: 'Underrange',
... |
"""
Checks if all source and test files were analyzed by infer.
Run this script in the same directory with ./infer-out
and all src/test dirs.
"""
import re
import os
import sys
from os.path import join
def add_arr_and_dict_to_list(files_list, array, dictionary):
"""
Populates an empty list with an array a... |
import ply.lex as lex
import ply.yacc as yacc
tokens = ['NUM',
'STR',
'ID',
'DLABEL',
'ARIT',
'COMP',
'ASSIGN',
'COMMA',
'BEGIN',
'END',
'VAR',
'SEMICOLON',
'LPAREN',
'RPAR... |
from __future__ import division, print_function
import unittest
import numpy as np
import time
import discretize
from SimPEG import maps, SolverLU, tests
from SimPEG.electromagnetics import time_domain as tdem
from pymatsolver import Pardiso as Solver
plotIt = False
testDeriv = True
testAdjoint = True
TOL = 1e-4
n... |
from __future__ import absolute_import
from . import logger
import argparse
from numpy import ones, array
from astropy.coordinates import SkyCoord, get_constellation
from astroquery.mast import Catalogs
from astroquery.simbad import Simbad
from astroquery.mast import Observations
from astroquery.exceptions import Reso... |
# -*- coding: utf-8 -*-
from io import StringIO
import numpy as np
import pandas as pd
import scipy.stats as stats
from scipy.interpolate import interp1d
def gumbel_r_(mean: float, sd: float, **_):
# parameters Gumbel W&S
alpha = 1.282 / sd
u = mean - 0.5772 / alpha
# parameters Gumbel scipy
s... |
# coding=utf-8
"""
Tests global mission functionality
"""
import pytest
from elib_miz.mission import BaseUnit, Coalition, Country, Group, Static
from elib_miz.miz import Miz
def test_bullseye(mission):
assert (11557, 371700) == mission.red_coa.bullseye_position
assert (-291014, 617414) == mission.blue_coa.bu... |
import argparse
import statistics
from datetime import datetime, timedelta
import click
import pandas as pd
from notebooks.tables import Table
from notebooks.helpers import DATE_FMT
from notebooks.algo import Transaction
class ShiftTrader(object):
def __init__(self, verbose=True):
self.transactions = []... |
import rapidfuzz
import re
from googlesearch import search
from bs4 import BeautifulSoup
import requests
from rapidfuzz import fuzz
from rapidfuzz import process
def get_urls(tag, n, language):
urls = [url for url in search(tag, stop=n, lang=language)]
return urls
def link_checker(a,b):
#checks if the li... |
"""
diffbuff.wire
~~~~~~~~~~~~~
Wire format for diff buffers
Requires testing, examples
"""
def decode(data, offset):
val, offset = decode_leb128(data, offset)
tag = val >> 4
kind = val & 15
def decode_many(kind, data, offset):
count, offset = decode_leb128(data, offset)
top = off... |
#!usr/bin/env/python
#-*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import sklearn
from sklearn import datasets, cluster
digitos=datasets.load_digits()
datos_raw=digitos.data;
medias_datos_raw=np.average(datos_raw, axis=0);
datos_tot=datos_raw-medias_datos_raw;
z_Target=digitos.target;
def... |
import cv2
import numpy as np
import time
ELAPSED_TIME_OPT = False
"""
CIS Functions
"""
def salt_and_pepper(img, p):
org_shape = img.shape
wsize = img.shape[0] * img.shape[1]
img = img.reshape(wsize)
thres = 1 - p
rnd_array = np.random.random(size=wsize)
img[rnd_array < p] = 0
img[rnd_... |
"""This module contains the general information for DcxVIf ManagedObject."""
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class DcxVIfConsts():
ADMIN_STATE_DISABLED = "disabled"
ADMIN_STATE_ENABLED = "enabled"
IF_R... |
#!/usr/bin/env python
# coding: utf-8
import sys
import numpy as np
import scipy.sparse as sp
from scipy.io import loadmat, savemat
from scipy import cluster
import os
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
from matplotlib import rcParams
plt.switch_backend('agg')
def mutation_pr... |
#!/usr/bin/env python3
# Copyright (c) 2012 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.
"""This script is used to download prebuilt clang binaries. It runs as a
"gclient hook" in Chromium checkouts.
It can also be run... |
# Copyright 2020 The TensorFlow 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 applica... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use th... |
from cbrain.imports import *
from cbrain.data_generator import *
from cbrain.cam_constants import *
from cbrain.losses import *
from cbrain.utils import limit_mem
from cbrain.layers import *
from cbrain.data_generator import DataGenerator
import tensorflow as tf
from tensorflow import math as tfm
#import tensorflow_pro... |
from django.test import TestCase
from unittest.mock import Mock, patch
from requests import Response
from .ghibli import GhibliService
from .exceptions import ServiceRequestError, EmptyDataResponseError, JSONResponseError, UnreachableServiceError
from ghibliservice.settings import env
# Create your tests here.
class... |
import json
from datetime import datetime, timedelta
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.ext.mutable import MutableDict
from sqlalchemy.orm import relationship, deferred
from werkzeug.security import generate_password_hash, check_password_hash
import jwt
from sqlalchemy.dialects import sq... |
"""
File: utilities.py
Contains:
Pydirb --> main class
__init__ --> constructor for the Pydirb class
checkURL --> checks whether the target URL is reachable and has no wildcard matching
buildWords --> builds a queue of words from the supplied word path
br... |
import tensorflow as tf
import numpy as np
def genanchors(isize, ssize, asizes):
'''
Arguments
isize: image size (h, w)
ssize: feature map size (h, w)
asizes: list of anchor sizes, (h, w)
Return
abox4d: anchors in images, each anchor has shape (h, w, k, 4). 4 is lenngth of [y1, x1, y2, x2]
'''
# scale ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This package contains functions for reading and writing HDF5 tables that are
not meant to be used directly, but instead are available as readers/writers in
`astropy.table`. See :ref:`table_io` for more details.
"""
from __future__ import (absolute_imp... |
import json
import sublime
import sublime_plugin
import os
from string import Template
from .ansi import ANSIProcessor
target_view_name = "Build Output"
buildx_color_scheme = "Packages/User/BuildX/BuildX.sublime-color-scheme"
def generate_files(settings):
# create dir
dir = os.path.join(sublime.packages_path(), "... |
# Copyright 2010 New Relic, 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 writ... |
#!/usr/bin/env python3
# Python3 Command Line Utility to read from OptoNCDT sensor connected to
# Micro-Epsilon's IF1032 ETH Module. This Script reads from a Stream Socket
# from the Module at port 10001 (default), converts the raw value to metric values
# and stores the information in InfluxDB via either UDP or HTTP
#... |
import datetime
import os
import pprint
from django.conf import settings
from django.http import HttpResponse, HttpResponseForbidden, JsonResponse
from django.shortcuts import render
from django.views.decorators.http import require_POST
from django.urls import reverse
from pylti1p3.contrib.django import DjangoOIDCLogi... |
# Copyright (c) MONAI Consortium
# 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, so... |
import copy
from os import path
from typing import Optional
from sqlalchemy.orm import Session
from autoconf import conf
from autofit.mapper.prior_model.abstract import AbstractPriorModel
from autofit.non_linear.nest import abstract_nest
from autofit.non_linear.nest.abstract_nest import AbstractNest
from au... |
#!usr/bin/env python3
# -*- coding: UTF-8 -*-
import json
import numpy as np
import requests
from PIL import Image
import grpc
import base64
import tensorflow as tf
from tensorflow_serving.apis import predict_pb2
from tensorflow_serving.apis import prediction_service_pb2_grpc
from google.protobuf.json_format import M... |
# Copyright 2014 NetApp
# 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 applic... |
import sys
import os
from time import sleep
from PyQt5.uic import loadUi
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtWidgets import QDialog, QApplication, QMainWindow, QFileDialog
import cv2
from qcrop.ui import QCrop
import numpy as np
import pytesseract
from PIL import Image
os.environ['TESSDATA_PREFIX'] ... |
# coding=utf-8
# Copyright 2018 The Batfish Open Source Project
#
# 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 requi... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import itertools
import logging
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Tuple
from hydra.core.config_loader import ConfigLoader
from hydra.core.plugins import Plugins
from hydra.plugins.launcher import Launch... |
from abc import ABC, abstractmethod
import gc
import mimetypes
import pkgutil
import yaml
class FileHandlingException(Exception):
"""Exception raised during opening a dic file for Read/Write operations"""
class ParsingException(FileHandlingException):
"""Exception raised durin parsing"""
class NonAplhaWo... |
# -*- coding: utf-8 -*-
##
# 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, ... |
import requests
import base64
import logging
import datetime
import time
import re
import csv
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.triggers.cron import CronTrigger
from django_apscheduler.jobstores import DjangoJobStore
from django_apscheduler.models import DjangoJobExecution
... |
"""model with self-interactions and gates
Exact equivariance to :math:`E(3)`
version of february 2021
"""
import math
from typing import Dict, Union
import torch
from torch_geometric.data import Data
from torch_cluster import radius_graph
from torch_scatter import scatter
from e3nn import o3
from e3nn.math import s... |
import csv
import glob
import json
from collections import OrderedDict, defaultdict
from datetime import datetime, timedelta
from typing import Any, DefaultDict, Dict, List
import jsons
import pytz
import yaml
from miniconf.site_data import (
CommitteeMember,
Paper,
PaperContent,
Sessio... |
import torch
import math
import dgl.function as fn
from dgl.nn.pytorch import edge_softmax
from utlis import *
from torch import nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pack_padded_sequence,pad_packed_sequence
class MSA(nn.Module):
# multi-head self-attention, three modes
# the first ... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
# coding: utf-8
from handlers.BaseHandler import RequestBaseHandler
from constants import Res
from dbHandler.DBTools import DBTool
import json
class PublishPPYHandler(RequestBaseHandler):
"""发布数据接口"""
def post(self, *args, **kwargs):
user_id = self.json_args.get('user_id')
ppy_content_text = s... |
# -*- coding: utf-8 -*-
import itertools
import select
import sys
from collections import deque
from contextlib import contextmanager
from logging import getLogger
from threading import Event
from grpc import StatusCode
from h2.config import H2Configuration
from h2.connection import H2Connection
from h2.errors import ... |
import torch
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import os
import random
import numpy as np
from PIL import Image
class Cutout(object):
"""Randomly mask out one or more patches from an image.
Args:
n_holes (int): Numbe... |
import argparse
import copy
import glob
import http.server
import json
import os
import re
import shutil
import socketserver
import traceback
from jinja2 import Template
parser = argparse.ArgumentParser(description='Generate mod docs')
parser.add_argument('path', help='path to root of unpacked assets tree')
parser.ad... |
import binascii
from collections import defaultdict
from hashlib import sha256
from typing import Dict
from bitcoin import SelectParams
from bitcoin import base58, bech32
from bitcoin.core import COutPoint, CMutableTxOut, CMutableTxIn, CTransaction
from bitcoin.core.script import SignatureHash, SIGHASH_ALL, CScript
fr... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.optim as optim
import sys
def squared_l2_norm(x):
flattened = x.view(x.unsqueeze(0).shape[0], -1)
return (flattened ** 2).sum(1)
def l2_norm(x):
return squared_l2_norm(x).sqrt()
def model_... |
import numpy as np
import cv2
import tkinter as tk
import PIL
import os
from PIL import Image
from PIL import ImageTk
#import face_recognition
# 정보
info=[[0]*30 for i in range(4)]
index=0
find_index=-1;
temp_child_name = []
temp_par_name = []
temp_contact1 = []
temp_contact2 = []
# main window
window=tk.Tk()
window.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script to load word embeddings from different representations
and save them in the nlpnet format (numpy arrays and a text
vocabulary).
"""
import argparse
import re
import logging
import numpy as np
from six.moves import cPickle
from collections import defaultdict
im... |
import inspect
import json
from contextlib import ExitStack
from typing import Iterable
import base58
from indy.did import replace_keys_start, replace_keys_apply
from indy.ledger import build_attrib_request
from indy_common.config_helper import NodeConfigHelper
from plenum.common.constants import REQACK, TXN_ID, DATA... |
# Author: <NAME>
# Contact: <EMAIL>
"""Convert NumPy and MPI datatypes."""
# pylint: disable=too-many-locals
# pylint: disable=too-many-branches
# pylint: disable=too-many-statements
# pylint: disable=too-many-return-statements
from .. import MPI
try:
from numpy import dtype as _np_dtype
except ImportError: # p... |
"""
Author:
<NAME>,<EMAIL>
<NAME>,<EMAIL>
Reference:
<NAME>, <NAME>, <NAME>, et al. Multi-interest network with dynamic routing for recommendation at Tmall[C]//Proceedings of the 28th ACM International Conference on Information and Knowledge Management. 2019: 2615-2623.
"""
import tensorflow as tf
from deepctr... |
from nltk import pos_tag, word_tokenize, Tree
from nltk.parse.stanford import StanfordParser
from nltk.corpus import wordnet as wn
from nltk.wsd import lesk
import wnlu
from wnlu.translate.Utils import Utils
from random import randint
jar = 'apps/stanford-parser-full-2018-02-27/stanford-parser.jar'
model = 'apps/stanf... |
import torch
import torch.nn as nn
from torch import Tensor # noqa: F401
from torch._jit_internal import Optional, List # noqa: F401
from torch.nn.quantized.modules.utils import hide_packed_params_repr
from torch.nn.quantized.modules.utils import _quantize_weight
class EmbeddingPackedParams(torch.nn.Module):
_ve... |
#!/usr/bin:env python
import json
import requests
from lxml import html
from collections import OrderedDict
import argparse
from datetime import datetime
import certifi
import urllib3
def parse_inputs():
"""
Parses the command line input arguments.
Parameters
----------
None.
Returns
-... |
#!python
import csv
import time
import numpy as np
import tensorflow as tf
from tensorflow.python.ops import math_ops
BATCH_SIZE = 200
LOSS = 'loss'
### HOW THIS WORKS
#
# generate_graph generates an MNIST CNN model graph. The parts that do
# work are the same as in the Tensorflow documentation at
# https://www.ten... |
from typing import Type
from nonebot import logger, on_command
from nonebot.adapters._bot import Bot as AbstractBot
from nonebot.adapters._event import Event as AbstractEvent
from nonebot.adapters.cqhttp import Bot, Event, GroupMessageEvent
from nonebot.adapters.cqhttp.message import Message
from nonebot.adapters.cqht... |
from bottle import run, request, response, get, post, put, error, delete, abort
import os, json
bd = [] #Aqui se guardan todas las habitaciones
class Room: #Clase objeto
def __init__(self, id_h, plazas, list_equipo, ocup):
self.id = id_h
self.plazas = plazas
self.list_equipo = lis... |
#!/usr/bin/env python
# coding: utf-8
import sys
import os
import sqlite3
import logging
import json
from datetime import datetime
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(name)s:%(levelname)s:%(message)s')
log = logging.getLogger('SQLite_util')
def create_connection(database):
"""... |
'''
GAME OF WARS WITH CARD
'''
# generating value for rank of cards
#value = {'two':2, 'three':3, 'four':4, 'five':5, 'six':6, 'seven':7, 'eight':8, 'nine':9, 'ten':10, 'jack':11, 'queen':12, 'king':13 ,'ace':14}
#suit = ['hearts','diamonds','clubs','spades']
from colorama import init
init()
from colorama i... |
##################################################
# RFR is implemented based on RAFT optical flow #
##################################################
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.rfr_common.update import BasicUpdateBlock, SmallUpdateBlock
from mo... |
"""This module collects all gmpy2 functions used by MPyC.
Plus a function for factoring prime powers,
and a function for rational reconstruction.
Stubs of limited functionality and efficiency are provided
in case the gmpy2 package is not available.
"""
import os
import math
def factor_prime_power(x): # TODO: move... |
import networkx as nx
import graphityFunc
from graphityUtils import stringCharFrequency, stringCharVariance
### SCANNING ###
# searching nodes and nearby nodes a pattern defined by graphityFunc.py
def patternScan(graphity, pattern):
# search is performed by defining "anchor" node, where initial pattern i... |
import inspect
import ast
import re
def deindent_docstring(doc):
if doc:
# Find the indent to remove from the doctring. We consider the following possibilities:
# Option 1:
# """This is the first line
# This is the second line
# """
# Option 2:
# """
... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
# -*- coding: utf-8 -*-
# Androxus bot
# OnUpdateEvent.py
__author__ = 'Rafael'
from datetime import datetime
from io import BytesIO
import aiohttp
import discord
from PIL import Image
from discord.ext import commands
from database.Repositories.ServidorRepository import ServidorRepository
from utils.Utils import di... |
# Copyright 2020 QuantumBlack Visual Analytics Limited
#
# 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
#
# THE SOFTWARE IS PROVIDED "AS IS", WIT... |
import cv2
import numpy as np
import csv
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
from keras.models import Sequential
from keras.callbacks import EarlyStopping, ModelCheckpoint
from keras.layers import Flatten, Dense, Lambda, MaxPooling2D, D... |
import numpy as np
import torch
from .communication import MPI
from . import factories
from . import manipulations
from . import _operations
from . import dndarray
from . import stride_tricks
from . import types
__all__ = [
"all",
"allclose",
"any",
"isclose",
"logical_and",
"logical_not",
... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2019 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://trac.edgewall.org/wiki/TracLicense.
#
# This software cons... |
"""This module contains the general information for PkiCertReq ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class PkiCertReqConsts():
pass
class PkiCertReq(ManagedObject):
"""This is PkiC... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################################
# $Id: jpeg_in_tiff_extract.py e4fe7cc06270e5f38dfe78e6785a6bcca4e39e29 2021-04-01 21:02:04 +0300 Idan Miara $
#
# Project: GDAL/OGR samples
# Purpose: Extract a JPEG file from a JPEG-in-TIFF... |
"""
$Header: /nfs/slac/g/glast/ground/cvs/pointlike/python/uw/like2/from_healpix.py,v 1.17 2018/01/27 15:37:17 burnett Exp $
"""
import os, pickle, zipfile
import numpy as np
import skymaps
from pointlike import IntVector
from . import (roimodel, sources, diffuse, extended)
def neighbors(index, rings=1):
""" ret... |
# Events
CollationAdded: __log__({
shard_id: indexed(num),
expected_period_number: num,
period_start_prevhash: bytes32,
parent_hash: bytes32,
transaction_root: bytes32,
collation_coinbase: address,
state_root: bytes32,
receipt_root: bytes32,
collation_number: num,
is_new_head: bo... |
from PIL import Image
import numpy as np
import h5py, json, os, time
from nltk.tokenize import RegexpTokenizer
import torch
from torchvision import transforms
# You might have to uncomment these lines if you are running this code for the first time (to downlaod the required nltk tokenizer)
# import nltk
# nltk.downloa... |
"""Code generation utilities"""
import imp
import json
import os
import pkgutil
import pprint
import re
import sys
import textwrap
import jsonschema
from .utils import (SchemaInfo, is_valid_identifier, indent_docstring, indent_arglist,
load_metaschema)
class CodeSnippet(object):
"""Object wh... |
import torch
import matplotlib; matplotlib.use("agg")
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
from matplotlib.colors import LinearSegmentedColormap
import numpy as np
def color_pallet(n_classes, alpha=1.0, darker=0.3):
cdict = np.array([np.zeros(shape=(4,)) for _ in range(n_classes)])
... |
import numpy as np
import time
from openvino.inference_engine import IENetwork, IECore
import os
import cv2
import argparse
import sys
class Queue:
"""
Class for dealing with queues.
Performs basic operations for queues like adding to a queue, getting the queues
and checking the coordinates for... |
# License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2021 Intel Corporation. All Rights Reserved.
# we want this test to run first so that all tests run with updated FW versions, so we give it priority 0
#test:priority 0
#test:device each(L500*)
#test:device each(D400*)
import pyrealsense2 as rs,... |
import asynctest
from aiohttp import web
from registry.utils.db_pool import init_db_pool
from registry.utils.db_ops import db_check_service_id, db_store_service_key, db_update_service_key
from registry.utils.db_ops import db_delete_service_key, db_register_service, db_delete_api_key
from registry.utils.db_ops import ... |
import abc
import math
from typing import Any, Dict, Union
import numpy as np
import sklearn.metrics as metrics
from optuna.trial import Trial
from sklearn.model_selection import KFold
from tqdm import tqdm
import mutation_prediction.data.preprocessing as preprocessing
import mutation_prediction.utils as utils
from m... |
import glob
import os
import shutil
from pathlib import Path
from subprocess import check_output
from threading import Thread
from typing import Dict, Union, Optional, Set, List, Sequence, Mapping
from git import Git
from ruamel.yaml import YAML # type: ignore
from constants import ABS_PATH_OF_TOP_LEVEL_DIR
from uti... |
"""Tests for the classification."""
import os
import unittest
from typing import Any, Text
import warnings
import yaml
import axelrod as axl
from axelrod.classifier import (
Classifier,
Classifiers,
_Classifiers,
memory_depth,
rebuild_classifier_table,
)
from axelrod.player import Player
class T... |
import numpy as np
import scipy.integrate
####################################################################################################
def calc_lam0_cog( si, wave, lam0_nom ):
#
# Return an estimate of the central line-core wavelength of an input
# Stokes I absorption line spectrum
#
# @p... |
from threading import Lock
from awspice.helpers import extract_region_from_ip
instance_filters = {
'id': 'instance-id',
'dnsname': 'dns-name',
'publicip': 'network-interface.association.public-ip',
'privateip': 'private-ip-address',
'name': 'tag:Name',
'tagname': 'tag:Name',
'status': 'inst... |
# @Time : 2020/11/14
# @Author : <NAME>, <NAME>
# @Email : <EMAIL>
# UPDATE:
# @Time : 2021/1/29, 2020/12/04
# @Author : <NAME>, <NAME>
# @Email : <EMAIL>, <EMAIL>
"""
textbox.data.utils
########################
"""
import os
import nltk
import collections
import pickle
from textbox.data.dataloader import *
... |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... |
import os
import re
from datetime import datetime
from collections import defaultdict, Counter
from pathlib import Path
import pytest
import ray
from ray import ray_constants
from ray._private.test_utils import (get_log_batch, wait_for_condition,
init_log_pubsub, get_log_message,
... |
from . import select_one_only, select_one, select, count as pg_count, \
update, insert, delete, c, cs
import json
from time import time
import re
import asyncio
re_op = re.compile('_(gt|lt|gte|lte)$')
def merge_json(new, old):
if isinstance(new, dict) and isinstance(old, dict):
old.update(new)
... |
##############################################################################
#
# Copyright (c) 2008 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
import seaborn as sns
import numpy as np
import torch
import matplotlib.pyplot as plt
def cubehelix_cmap(scheme='dark'):
if scheme == 'dark':
cmap = sns.cubehelix_palette(as_cmap=True, dark=0.05, light=1.2, reverse=True);
else:
cmap = sns.cubehelix_palette(as_cmap=True, dark=0.05, light=1.2, ... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.