text stringlengths 3.07k 22.1k |
|---|
# MIT License
#
# Copyright (c) [year] [fullname]
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
from __future__ import annotations
from abc import ABC, abstractmethod
from time import time
from typing import Callable, NamedTuple, Optional, Tuple
import numpy as np
import tensorflow as tf
import torch as pt
from .._logging import get_logger
from .._utils import get_num_splits, get_tf_device
from ..custom_types ... |
#!/usr/bin/python3
# Copyright (C) 2015-2016 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU Genera... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Callable, Dict, List, Type
import beanmachine.ppl.compiler.bmg_nodes as bn
from beanmachine.ppl.compiler.bm_graph_builde... |
#network of nodes
#<NAME>
#import statements
import numpy as np, math
import matplotlib.pyplot as plt
import pandas as pd
from pprint import pprint
import networkx as nx
import matplotlib.pyplot as plt
import community
import glob
import statistics
#function to examine the degree of nodes in the... |
from __future__ import print_function
from sklearn.model_selection import train_test_split
import numpy as np
from keras.models import Sequential, load_model
from keras.layers import Dense, Dropout, Activation, Flatten, Convolution2D, MaxPooling2D
from keras.optimizers import SGD
from keras.callbacks import EarlyStopp... |
from __future__ import absolute_import, unicode_literals
from datetime import datetime
from pickle import dumps, loads
import pytest
from case import Mock, patch, skip
from celery import states, uuid
from celery.exceptions import ImproperlyConfigured
try:
import sqlalchemy # noqa
except ImportError:
Databa... |
"""
The `arg_parsing` module exports the method `parse_args` which is a utility
function for parsing the arguments orginially parsed by :module:`docopt`.
This can be used in scripts to parse user input.
"""
import sys
import os
import joblib
from .io import load_classifier
from .file_paths import classifier_path
fro... |
# coding: utf-8
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import json
import numpy as np
import torch
import torch.nn.functional as F
from .base import BaseClassifierModel
from .base import BaseNeural... |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 03 14:52:09 2017
@author: medialab
"""
from scipy.spatial.distance import _validate_vector
from scipy.ndimage.filters import gaussian_filter1d as gf
from scipy.linalg import norm
from collections import defaultdict
from w_fastdtw import fastdtw
import numpy as np
def wt... |
# -*- coding: utf-8 -*-
# @Time : 2022/5/16 17:05
# @Author : hyx
# @File : interception.py
# @desc :web request interception related operations
import json
import os
import re
from urllib.parse import parse_qs
from deepdiff import DeepDiff
from jsonpath_ng import parse as parse_path
import flybirds.core.global_resou... |
import os
import tempfile
import matplotlib.pyplot as plt
import matplotlib.tri as tri
import numpy as np
import scipy.spatial as spa
import scipy.stats as sta
from matplotlib.animation import FFMpegWriter
from scipy.interpolate import interp1d
from scipy.special import expit, logit
from sklearn.utils.extmath import s... |
import numpy as np
from functools import partial
import math
def _polynomial(*args):
*coefficients, x = args
result = coefficients[-1]
for coef in coefficients[-2::-1]:
result = result * x + coef
return result
def percentage_point(p):
"""
The function approximates percentage point z... |
from functools import wraps
import json
import telegram
from telegram import (ReplyKeyboardMarkup, ReplyKeyboardRemove,
KeyboardButton, InlineKeyboardButton, InlineKeyboardMarkup, ChatAction)
from telegram.ext import (Updater, CommandHandler, MessageHandler, CallbackQueryHandler, Filters)
import l... |
# -*- coding: utf-8 -*-
"""M4A engine emulation functionality.
Attributes
----------
TEMP_FILE : str
Filename of temporary file used during sample loading.
LOGGER : logging.Logger
Module-level logger
"""
from logging import basicConfig, getLogger, DEBUG, WARNING
from os import remove
from time import perf_cou... |
from graphviz import Digraph
import inspect
import re
### Inspect functions
def extract_var_key(raw_line: str, var_id: str) -> str:
"""
Extract the key from an line in the form "dict['key']" or
"dict.get('key', *args)".
"""
line = raw_line.strip()[len(var_id) :]
state_var = ""
if line[0]... |
import supervisely_lib as sly
import sly_globals as g
import os
from sly_train_progress import get_progress_cb, reset_progress, init_progress
from supervisely_lib.io.fs import mkdir, get_file_name
from supervisely_lib.geometry.rectangle import Rectangle
import cv2
from glob import glob
progress_index = 1
object_... |
"""A script for generating robot home service datasets."""
import argparse
import json
import multiprocessing as mp
import os
import pickle
import queue
import random
import time
from collections import defaultdict
from typing import List, Sequence, Set, Dict, Optional, Any, cast
import compress_pickle
import numpy a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import re
import sys
import glob
import locale
import sublime
try:
from . import __version__, __title__
excep... |
# _*_coding:utf-8_*_
# @auther:FelixFu
# @Date: 2021.4.14
# @github:https://github.com/felixfu520
import os
import time
import numpy as np
import torch
import itertools
import matplotlib.pyplot as plt
import functools
from collections import defaultdict, deque
import torch
__all__ = ['MeterDetTrain', 'MeterDetEval', ... |
#!/usr/bin/env python
#
# 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 require... |
import argparse
import os
import shutil
import scipy.interpolate
os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
from upsampling.utils import Upsampler
import numpy as np
import torch
from face_detection import detect_face, convert_frames_to_video
import cv2
import ntpath
import os
import tqdm
import moviepy.editor as... |
import os
import random
import numpy as np
import matplotlib.pyplot as plt
NUM_TRAIN = 5000
NUM_TEST = 1000
CHAR_VAL = {
' ': 0,
'+': 1,
'#': 2
}
CHAR_VAL_BIN = {
' ': False,
'+': True,
'#': True
}
HI_ENRG = ' '
LO_ENRG = '%'
PIXEL_DTYPE = np.float32
DIGIT_LABEL_DTYPE = np.u... |
import os
from datetime import datetime, date
from collections import Iterable
from flask import current_app
from veripress import app
from veripress.model import storage
from veripress.model.models import Page, Post, Widget
from veripress.model.storages import FileStorage
from veripress.helpers import Pair
def tes... |
import os
import urllib
import click
from xml.dom import minidom
from skbio import io
from skbio.sequence import Sequence
"""
Notes:
This script has three functionalities:
1. Extract select protein(s) from a multi-sequence Fasta file:
python process_fasta.py -i input.faa -d 10 -o output.faa
python process_fas... |
import os
import time
import argparse
import numpy as np
import torch
from torch._C import device
import torch.nn as nn
import torch.optim as optim
from torch.cuda.amp import autocast, GradScaler
from torch.utils.data import DataLoader
from model import VideoModel
from lsr import LSR
def parallel_model(model):
... |
import sys, os
#import time
current_dir = os.getcwd()
sys.path.insert(1, current_dir)
from discodop_n.tree import writediscbrackettree, writebrackettree, DrawTree, Tree, ptbunescape
from discodop_n.treetransforms import removeemptynodes
from discodop_n.treebank import (NegraCorpusReader, BracketCorpusReader, brackettr... |
__author__ = "<NAME>"
import json
from collections import Counter
from scipy.sparse.construct import rand
import tensorflow as tf
from emotion.baseline.srl import get_srl_model
from emotion.config import Config
from emotion.baseline import get_embedding_model
from sklearn.model_selection import train_test_split
from e... |
import pandas as pd
from docx import Document
import re
import os
import jieba
def build_csv(excel_path, word_path, save_path):
"""建立dataframe
path_csv: excel文件夹路径
save_path: 需要存储的文件夹路径
"""
document = None
dfall = None
nums = len(os.listdir(excel_path))
print(nums)
num = 0
... |
# file_list_getter.py
# code in shift-jis
import glob2
import os, sys, platform
import time
# IMPORT module FROM LandmasterLibrary
import input_controller
import dir_editor
sep = dir_editor.decide_seperator() # String seperator of directory.
import text_editor
def extract_playlist_from_text(file_list : li... |
import matrix
import tensor
from misc import applyGradients, dropout
from math import ceil
def kernel(inMatrix, kernel_size_rows, kernel_size_cols, step_size_rows, step_size_cols):
size = inMatrix.size()
retMatrix = []
for rowNum in range(size[0]-kernel_size_rows+1):
for colNum in range(size[1... |
"""This python script processes 30 seconds of Basic Safety Message data, loads the pre-trained Random Forest classifier,
classifies queue counts for each link for those 30 seconds, derives queue lengths, and outputs the results.
Sample input and output files can be found in the Supporting_Files folder.
Test with: py... |
from django.conf import settings
config = settings.CSV2_CONFIG
from django.views.decorators.csrf import requires_csrf_token
from cloudscheduler.lib.select_ec2 import \
select_ec2_images, \
select_ec2_instance_types
from cloudscheduler.lib.view_utils import \
lno, \
qt, \
qt_filter_get, \
rend... |
# @license: %MIT License%:~ http://www.opensource.org/licenses/MIT
# @project: models
# @file: /qap_gradient_proj.py
# @created: Sunday, 27th September 2020
# @author: brentian (<EMAIL>)
# @modified: brentian (<EMAIL>>)
# Sunday, 27th September 2020 4:46:00 pm
# @description:
# The module for Rosen's projected grad... |
import random
import time
import threading
import pygame
import sys
# Default values of signal timers
defaultGreen = {0:10, 1:10, 2:10, 3:10}
defaultRed = 150
defaultYellow = 5
signals = []
numSignals = 4
currentGreen = 0 # Indicates which signal is green currently
nextGreen = (currentGreen + 1) % numSignals # I... |
from jinja2 import nodes
from jinja2.ext import Extension
from django.conf import settings
class StaticURLExtension(Extension):
tags = set(['static_url'])
def parse(self, parser):
token = parser.stream.next()
bits = []
while not parser.stream.current.type == 'block_end':
bi... |
import re
import sys
import os
from tokenizer import split_into_sentences
from . import number_help as nh
from . import abbr_patterns as ap
from . import abbr_functions as af
from . import cardinal_ones_tuples as cot
from . import cardinal_thousands_tuples as ctt
from . import cardinal_million_tuples as cmt
fro... |
#!/usr/bin/env python3
# Copyright (c) 2020 Xiaomi Corporation (authors: <NAME>, <NAME>)
# Apache 2.0
import k2
import logging
import numpy as np
import os
import torch
from k2 import Fsa, SymbolTable
from kaldialign import edit_distance
from pathlib import Path
from typing import List
from typing import Union
fro... |
# Copyright 2002-2018 MarkLogic Corporation. All Rights Reserved.
import boto3
import logging
import hashlib
import json
from botocore.exceptions import ClientError
import cfn_resource
import time
from utils import get_network_interface_by_id
from utils import cfn_success_response
from utils import cfn_failure_respon... |
#cloneId cloneCount cloneFraction clonalSequence bestVGene bestDGene bestJGene bestVFamily bestJFamily aaSeqCDR3 nSeqCDR3 refPoints
import pytest
import os
import numpy as np
import pandas as pd
from tcrdist.repertoire import TCRrep
from tcrdist import mixcr
time_sensitive = True
@pytest.mark.skipif(time_sensitive, r... |
from enum import Enum
from secpy.core.bulk_data import BulkDataEndpoint
from secpy.core.endpoint_enum import EndpointEnum
from secpy.core.mixins.base_endpoint_mixin import BaseEndpointMixin
from secpy.core.network_client import NetworkClient
from secpy.core.utils.cik_opts import CIKOpts
class SubmissionsEndpoint(Bas... |
import os
from uuid import uuid4
import csv
from bs4 import BeautifulSoup
import brickschema
from brickschema.inference import HaystackInferenceSession, BrickInferenceSession
from mapp.models import BrickTag, BrickVersion, HaystackVersion, InferenceVersion, BrickPointType, HaystackPointType, PointTypeMap, BrickEquipm... |
from onegov.directory.models.directory_entry import DirectoryEntry
from onegov.form import as_internal_id
from onegov.form import flatten_fieldsets
from onegov.form import parse_form
from onegov.form import parse_formcode
from sqlalchemy.orm import object_session, joinedload, undefer
from sqlalchemy.orm.attributes impo... |
"""Module is a grouping of Graph API authentication and helper classes."""
import os
import configparser
from typing import Union
import urllib.parse
import json
import logging
import msal
import requests
import saq
from saq.error import report_exception
from saq.extractors import RESULT_MESSAGE_NOT_FOUND, RESULT_MES... |
"""Models for the ``event_rsvp`` application."""
from django import forms
from django.core import exceptions
from django.core.urlresolvers import reverse
from django.db import models
from django.template.defaultfilters import date, slugify
from django.utils import timezone
from django.utils.text import capfirst
from dj... |
import warnings
warnings.filterwarnings('ignore')
import os
from astroquery.simbad import Simbad
from astropy.coordinates import SkyCoord as acoord
import numpy as np
import astropy.units as un
__all__ = ['Target', 'Fournax']
class Target:
'''
The TOI class represents an astronomical target of interest (T... |
import time
import math
from neopixel import *
import argparse
import os
from luma.core.virtual import terminal
from luma.core.interface.serial import i2c
from luma.oled.device import ssd1306
from PIL import ImageFont
import multiprocessing as mp
# LED strip configuration:
LED_COUNT = 2 # Number of LED pixel... |
"""
Googlenet code based on https://pytorch.org/vision/stable/_modules/torchvision/models/googlenet.html
"""
from collections import namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
from super_gradients.training.models.sg_module import SgModule
GoogLeNe... |
'''Builds arch
'''
import copy
import logging
import time
from . import data, exp, optimizer
from .parsing import parse_docstring, parse_inputs, parse_kwargs
from .handlers import (aliased, prefixed, NetworkHandler, LossHandler,
ResultsHandler)
from .utils import bad_values, update_dict_of_lis... |
# -*- coding: utf-8 -*-
#ユーザーのツイートを表示
#import config
import os,json
from requests_oauthlib import OAuth1Session
from urllib.parse import parse_qsl
import psycopg2
from datetime import datetime, timedelta, timezone
import databaseIO
"""TOKEN_PATH= 'token.json'
with open(TOKEN_PATH, mode='r') as f:
token=json.l... |
# Copyright (c) 2013 by California Institute of Technology
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this... |
# -*- coding: utf-8 -*-
import sys
import os
import collections
import unicodedata
import locale
import logging
from graphit import __version__, __module__
from graphit.graph_py2to3 import StringIO, urllib, urlparse, PY_STRING, to_unicode
__all__ = ['initial_node', 'resolve_root_node', 'coarse_type', 'check_graphit_... |
import json
import sublime
import subprocess
import os
import sys
from .helpers import fmtpos
main_protocol_version = 3
class MerlinExc(Exception):
""" Exception returned by merlin. """
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class Fai... |
from tools.dictwrapper import DictWrapper, DictWrapperVisitorDemostrator
import pytest
from collections import OrderedDict
def test_dictwrapper_01():
dw = DictWrapper({})
assert not dw
assert len(dw)==0
def test_dictwrapper_02():
dw = DictWrapper(dict(a=1))
assert dw
assert len(dw)==1
def t... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from nltk.tokenize import RegexpTokenizer
from collections import defaultdict
import torch
import torch.utils.data as data
from torch.autograd import Variable
import torc... |
import cv2
import numpy as np
# TODO: detect windows
# TODO: detect doors
# Calculate (actual) size of appartment
# TODO: text detection
"""
Detect
This file contains functions used when detecting and calculating shapes in images.
FloorplanToBlender3d
Copyright (C) 2019 <NAME>
"""
def wall_filter(gray):
"""
... |
import os
import shutil
import time
import json
from StringIO import StringIO
from wok.core.errors import MissingRequiredArgumentError
from wok.storage.storage import Storage, StorageContainer, StorageObject, StorageError, NotEmptyContainerDeletedError
def _normalize_container_name(name):
return name.replace("..", "... |
import random
enumerate_ranks = {'Deuce': 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}
enumerate_hand_categories = {'High Card': 1, 'One Pair': 2, 'Two Pair': 3, 'Three of a Kind': 4, 'Straight': 5,
... |
# coding: utf-8
"""
Module containing the core Store definition
"""
import logging
from abc import ABCMeta, abstractmethod, abstractproperty
from datetime import datetime
from enum import Enum
from typing import Callable, Dict, Iterator, List, Optional, Tuple, Union
from monty.dev import deprecated
from monty.json im... |
# Copyright (c) 2013 OpenStack Foundation
# 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 ... |
from __future__ import unicode_literals
from datetime import date
from django.contrib.auth import models, management
from django.contrib.auth.management import create_permissions
from django.contrib.auth.management.commands import changepassword
from django.contrib.auth.models import User
from django.contrib.auth.test... |
#!/usr/bin/python3.6
import os as os
import sys
import random
from settings import hparams
'''
The MIT License (MIT)
Copyright (c) 2016 YerevaNN
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... |
# Copyright 2015 Red Hat, 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... |
from django.db.models import Count
from django.template.defaultfilters import timeuntil
from django.utils.functional import cached_property
from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _
from django.utils.translation import ngettext_lazy
from django.views.generic import Tem... |
from math import isclose
import numpy as np
from pytest import fixture
from hoomd.box import Box
@fixture
def box_dict():
return dict(Lx=1, Ly=2, Lz=3, xy=1, xz=2, yz=3)
def test_base_constructor(box_dict):
box = Box(**box_dict)
for key in box_dict:
assert getattr(box, key) == box_dict[key]
@... |
# Import necessary libraries
from time import time
import rasterio
import numpy as np
import openeo
from openeo.rest.datacube import PGNode, THIS
from openeo.processes import *
import math
import xarray as xr
import rioxarray
from ipyleaflet import (
Map,
Marker,
TileLayer, ImageOverlay,
Polygon, Rectan... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from datetime import datetime
from warnings import warn
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils import timezone
from django.utils.html import format_html
from django.utils... |
# Copyright 2019 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... |
"""This class holds RaspiMote_https WSGI server implementation.
Simplest example on how to use this server::
from raspimote_https import wsgi
def my_crazy_app(environ, start_response):
status = '200 OK'
response_headers = [('Content-type','text/plain')]
start_response(status, response... |
# -*- coding: utf-8 -*-
"""
Custom luigi base task definitions.
"""
__all__ = ["Task", "WrapperTask", "ExternalTask"]
import sys
import socket
import logging
import warnings
from collections import OrderedDict
from contextlib import contextmanager
from abc import abstractmethod
import luigi
import luigi.util
impo... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import re
import pandas as pd
from pathlib import Path
from pprint import pprint
from ..contrib.evaluate import risk_analysis
from ..contrib.backtest import backtest as normal_backtest
from ..data.dataset import DatasetH
from ..data.dataset.ha... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2017, <NAME> <<EMAIL>>
# 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',
... |
"""
Arithmetic operations for PandasObjects
This is not a public API.
"""
from __future__ import annotations
import operator
from typing import (
TYPE_CHECKING,
Optional,
Set,
)
import warnings
import numpy as np
from pandas._libs.ops_dispatch import maybe_dispatch_ufunc_to_dunder_op # noqa:F401
from p... |
from sympy import KroneckerDelta, diff, Piecewise, And
from sympy import Sum
from sympy.core import S, symbols, Add, Mul
from sympy.functions import transpose, sin, cos, sqrt
from sympy.simplify import simplify
from sympy.matrices import (Identity, ImmutableMatrix, Inverse, MatAdd, MatMul,
MatPow, Matrix, Matr... |
# pygen.py
# Copyright (C) 2006, 2007, 2008, 2009 <NAME> <EMAIL>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""utilities for generating and formatting literal Python code."""
import re, string
from StringIO import StringIO
class PythonP... |
"""
A specific monopoly board.
"""
from typing import List
from .board import Space, Board
from .diceroller import DiceRoller
from .monopolyroller import MonopolyRollMover
import os, inspect
import numpy as np
#The property data are loaded in from a txt file
#note that the top line is a header
data_path = os.path.dirn... |
from collections import defaultdict
from ..core import OrderedDict
from ..core import Store
from ..core.util import basestring
class KeywordSettings(object):
"""
Base class for options settings used to specified collections of
keyword options.
"""
# Dictionary from keywords to allowed bounds/value... |
import asyncio
import logging
import os
import ujson as json
from functools import partial
from time import time
import aiohttp
from yarl import URL
from .definitions.types import AcceptDatetimeFormat
from .definitions.types import AccountID
from .definitions.types import ArrayTransaction
from .endpoints.annotations ... |
from __future__ import print_function
import os
import argparse
import torch
import torch.backends.cudnn as cudnn
import numpy as np
from retina_data import cfg_mnet, cfg_re50
from retina_layers.functions.prior_box import PriorBox
from retina_utils.nms.py_cpu_nms import py_cpu_nms
import cv2
from retina_models.retinafa... |
#!/usr/bin/env python
# Copyright 2021-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 appli... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation
# Copyright 2013 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
#... |
#!/usr/bin/env python3
# coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file excep... |
import datetime
import hashlib
import imageio
import io
import json
import os
import boto3
import numpy as np
import scipy
from skimage.transform import resize
import featurize
import near_duplicate_checker
import utils
import imagenet
def make_test_img(im_data, im_name, prefix, size, exact):
sha1 = hashlib.sha... |
""" Copyright (c) 2020, <NAME> and IBM Research
* Licensed under The MIT License [see LICENSE for details]
- Utility functions and classes.
References:
https://github.com/tensorflow/models/blob/r1.10.0/tutorials/image/cifar10_estimator/generate_cifar10_tfrecords.py
https://github.com/tensorflow/mo... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging as log
from re import match
import numpy as np
try:
import tensorflow.compat.v1 as tf_v1
# disable eager execution of TensorFlow 2 environment immediately
tf_v1.disable_eager_execution()
except ImportError:
... |
#!/usr/bin/python
'''
Copyright 2021, <EMAIL>
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 writi... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import torch
HAT_INV_SKEW_SYMMETRIC_TOL = 1e-5
def so3_relative_angle(R1, R2, cos_angle: bool = False):
"""
Calculates the relative angle (in radians) between pairs of
rotation matrices `R1` and `R2` with `an... |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Help Plugin.
"""
# Standard library imports
import os
# Third party imports
from qtpy.QtCore import Qt, Signal
# Local imports
from spyder imp... |
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from PySide2 import QtCore, QtWidgets, QtGui
import ui.main_window as main_window
import ui.fullscreen_window as fullscreen
import ui.wing_view as wing_view
import ui.drag as drag_pt
import deploy_network as wing_net
import sys, o... |
#
# javadoc.py: javadoc docstring parsing
# <NAME>
#
# Created [07/03/03 12:37 PM]
# $Id: javadoc.py 1574 2007-03-07 02:55:14Z dvarrazzo $
#
"""
Epydoc parser for U{Javadoc<http://java.sun.com/j2se/javadoc/>}
docstrings. Javadoc is an HTML-based markup language that was
developed for documenting Java APIs with inline... |
"""Test VarKey, Variable, VectorVariable, and ArrayVariable classes"""
import unittest
import numpy as np
from gpkit import (Monomial, NomialArray, Variable, VarKey,
VectorVariable, ArrayVariable)
import gpkit
from gpkit.nomials import Variable as PlainVariable
class TestVarKey(unittest.TestCase):
... |
# -*- coding: utf-8 -*-
"""Define the ReceptionNet for human pose estimation for Keras and TensorFlow.
The network is defined as:
------- ------
|Input|-->|Stem|--> [...],
------- ------
end every block:
-----------------------------------------------
| ----... |
#!/usr/bin/env python
"""Test for client comms."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import queue
import time
from unittest import mock
from absl import app
import requests
from grr_response_client import comms
from grr_response_core.lib im... |
"""The element editor is a utility window used for editing elements."""
import logging
from typing import Optional
from gi.repository import GLib, Gtk
from gaphor.abc import ActionProvider
from gaphor.core import Transaction, action, event_handler
from gaphor.core.modeling import Presentation, StyleSheet
from gaphor... |
# -------------------------------------------------------------------------------
# Copyright 2006-2021 UT-Battelle, LLC. See LICENSE for more information.
# -------------------------------------------------------------------------------
"""
Node structures for RM are implemented here for convenience.
"""
# local vers... |
from __future__ import annotations
import numpy as np
import pandas as pd
import sklearn.linear_model
from sklearn import datasets
from IMLearn.metrics import mean_square_error
from IMLearn.utils import split_train_test
from IMLearn.model_selection import cross_validate
from IMLearn.learners.regressors import Polynomia... |
# Copyright 2019 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 os
import dgl
import torch as th
import dgl.sampling
from torch.utils.data import IterableDataset
from dgl.sampling.neighbor import select_topk
from dgl.data.utils import load_graphs, save_graphs
class SkipGramBatchSampler(IterableDataset):
def __init__(self, hg, batch_size, window_size, rw_len=None):
... |
from python_twitch_irc import TwitchIrc
import requests
import configparser
import datetime
import time
import schedule
import math
from datetime import timedelta
import logging
import logging.handlers as handlers
import sqlite3
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(mess... |
# Copyright 2018 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.