text stringlengths 6.04k 39.5k |
|---|
import sys
import json
from PyQt4 import QtGui, QtCore
from twisted.internet.defer import inlineCallbacks, returnValue
import numpy as np
import matplotlib
matplotlib.use('Qt4Agg')
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import Nav... |
#!/usr/bin/env python2
# Copyright (C) 2019 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
import os
import sys
import subprocess
import argparse
import shutil
from signal import signal, SIGINT
# all time in seconds
DEFAULT_MEASURE_TIME = 1000
DEFAULT_INTERVAL = 5
FNULL = open(os.devnull, 'w')
cur_dir = o... |
import os.path
import datetime
import numpy as np
import pandas
import pytest
import astropy.units as u
from astropy.time import TimeDelta
from sunpy import timeseries
from sunpy.data.test import rootdir
from sunpy.instr import lyra
from sunpy.time import is_time_equal, parse_time
# Define location for test LYTAF d... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
baseconvert
===========
Convert any rational number,
from any (positive integer) base,
to any (positive integer) base.
Output numbers as tuple or string.
- Any rational number
- Arbitrary precision
- Fractions
- Recurring/repeating fractional digits.
-... |
# Generated file, please do not change!!!
import datetime
import enum
import typing
from ._abstract import _BaseType
from .common import ProcessingState
if typing.TYPE_CHECKING:
from .common import ProcessingState
from .prices import PriceImport
from .productvariants import Attribute
__all__ = [
"Ac... |
"""
Created on Thu Oct 24 15:06:36 2019
+++++++.I+.@author: <NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
... |
import ipaddress
import netaddr
import numpy as np
import pandas as pd
from networkml.featurizers.features import Features
MAC_BCAST = netaddr.EUI('FF-FF-FF-FF-FF-FF')
ETH_TYPE_ARP = 0x806
ETH_TYPE_IP = 0x800
ETH_TYPE_IPV6 = 0x86DD
ETH_TYPE_IPX = 0x8137
ETH_IP_TYPES = frozenset((ETH_TYPE_ARP, ETH_TYPE_IP, ETH_TYPE_... |
# coding: utf-8
#
# Copyright 2021 The Oppia 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 requi... |
# (C) StackState 2021
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .cloudtrail import CloudtrailCollector
from .flowlogs import FlowLogCollector
import logging
import boto3
import time
import traceback
from botocore.exceptions import ClientError
from schematics import Model
fro... |
import sys
import os
import re
import time
import contextlib
import dataclasses
import traceback
import zipfile
import getpass
import shutil
import pkgutil
from pathlib import Path
import appdirs
from kaiko.utils import datanodes as dn
from kaiko.utils import config as cfg
from kaiko.utils import biparsers as bp
from k... |
"""
bloomberg.py
"""
try:
import pdblp
except ModuleNotFoundError:
print("No Bloomberg acces found (when importing 'pdblp')")
try:
from xbbg import blp
except ModuleNotFoundError:
print("No Bloomberg acces found (when importing 'xbbg')")
import pandas as pd
from datetime import datetime
import logging... |
import math
import tensorflow as tf
# TODO: use a more industry standard way to warn the user of invalid behavior (instead of just print....)
# TODO: Add better input validation
# TODO: Add Unit Tests
# TODO: make it work with multiple versions of TF
# Utilities
def calculate_groupwise_splits(filters, min_spl... |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
"""Command console for Cinch server.
Requires socketIO-client package, available here:
https://github.com/invisibleroads/socketIO-client
This package will also support the AI program.
"""
# Executive summary for help page.
DESC = 'Command-line console for the Cinch card ga... |
import os
import pickle
import time
import torchvision.utils as vutils
from torch import optim
from torch.utils.data import DataLoader
from zo.models import Discriminator, Generator, device
from zo.zo_opt import GradientEstimate_dicrs, GradientEstimate, zoVIA, zoESVIA, zoscESVIA
from zo.log_likelihood import log_like... |
import os.path as osp
import PIL.Image
import numpy as np
import tensorflow as tf
from keras import backend as K
import keras
import sys
import time
from patch.constants import *
from patch.image import load_image, StubImageLoader
from patch.transformations import transform_vector
image_loader = StubImageLoader(VALI... |
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.layers.bluetooth import *
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
ATT_OPCODE_NAME = {
0x01: "Error Response",
0x02: "Exchange MTU Request",
0x03: "Exchange MTU Response",
... |
import pygame as pg
from pygame import mixer
import random
from math import sqrt
# initialize the pygame
pg.init()
# clock = pg.time.Clock()
screen = pg.display.set_mode((800, 600))
# background jogo
background = pg.image.load('imagens/brasilia2.jpg')
# menu do jogo
menu_image = pg.image.load('imagens/menu.jpeg')
m... |
from typing import List, Tuple, Dict, Any, Optional, Union
from pathlib import Path
import logging
import boto3
import re
import os
import yaml
from colorama import Fore, Style
import copy
log = logging.getLogger('stack-deployer')
class ColorFormatter(logging.Formatter):
DIM_LEVELS_BELOW = logging.DEBUG
YELL... |
#! /usr/bin/env python
"""Command line tool for interacting with the JASMIN transfer cache (XFC) for users who are
logged into JASMIN and have full JASMIN accounts."""
# Author : <NAME>
# Date : 12/05/2017
import sys, os
import argparse
import requests
import json
import dateutil.parser
import calendar
from math i... |
"""
Line Plots
"""
#*****************************************************************************
# Copyright (C) 2006 <NAME> <<EMAIL>>,
# <NAME> <<EMAIL>>,
# 2008 <NAME> <<EMAIL>>,
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# This c... |
# ============LICENSE_START===============================================
# Copyright (C) 2020 Nordix Foundation. All rights reserved.
# ========================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in... |
# flake8:noqa F401 Ignore unused imports. Tests are a work in progress.
import pytest # type: ignore
from random import Random
from remerkleable.complex import Container, Vector, List
from remerkleable.basic import boolean, bit, uint, byte, uint8, uint16, uint32, uint64, uint128, uint256,\
OperationNotSupporte... |
# -*- coding: utf-8 -*-
# Copyright 2011 Fanficdownloader team, 2018 FanFicFare 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
#
# Un... |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
import time
import hashlib
import logging
import xml.etree.ElementTree as ET
__all__ = ["check_signature", "MessageHandler"]
from .models import Location, Message
logger = logging.getLogger(__name__)
def check_signature(token, timestamp... |
#
# Copyright (C) 2015 ycmd contributors.
#
# This file is part of ycmd.
#
# ycmd 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.
#
# y... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass, field
import torch
from fairseq import utils
from fairseq.dataclass import ChoiceEnum
from fairseq.tasks im... |
"""
Particle Fireworks
Use a fireworks display to demonstrate "real-world" uses of Emitters and Particles
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.sprite_list_particle_fireworks
"""
import arcade
from arcade import Point, Vector
from arcade.util... |
import json
import os
import subprocess
import urllib.request
from datetime import datetime
from pathlib import Path
from time import sleep
from tkinter import Tk, filedialog
import eel
from PyPDF2 import PdfFileMerger, PdfFileReader, PdfFileWriter
from reportlab.lib.colors import red
from reportlab.lib.pagesizes impo... |
# -*- coding: utf-8 -*-
# --------------------------
# Copyright © 2014 - Qentinel Group.
#
# 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/LIC... |
import arrow
from decimal import Decimal
from base64 import b64decode, b64encode
from collections.abc import Mapping
from collections import namedtuple
from datetime import datetime as Datetime, timezone as Timezone
import re
from itertools import chain
import binascii
QUOTE = '"'
UTC_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
... |
# Copyright 2021 ncdhz
# 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, s... |
# Copyright 2021 The Distla 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 applicable ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import astropy.units as u
import numpy as np
from numpy.testing import assert_allclose
from ...utils.testing import requires_data, requires_dependency
from ...utils.random i... |
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2008, <NAME> <<EMAIL>>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice, this... |
import argparse
import os
import h5py
from os import listdir
from os.path import join
from PIL import Image
from torch.utils.data.dataset import Dataset
import torch
from torchvision.transforms import Compose, CenterCrop, Scale
from tqdm import tqdm
import cv2
import numpy as np
import time
def... |
import matplotlib
matplotlib.use('TkAgg')
import numpy as np
from scipy.spatial import cKDTree
from models import BoundingBox, Frame
from os.path import join, isfile
from os import listdir
from oxt import load_oxts_lite_data, oxts2pose
from frame_handler import FrameHandler
from mpl_toolkits.mplot3d import Axes3D
impor... |
"""
Wiki: https://wiki.axiodl.com/w/MREA_(Metroid_Prime_2)
"""
import hashlib
import io
from enum import IntEnum
from typing import Iterator, Optional
from construct.core import (
Adapter,
Aligned,
AlignedStruct,
Array,
Computed,
Const,
Enum,
FixedSized,
GreedyBytes,
If,
Int... |
#!/usr/bin/python3
import argparse, glob, os, sys, shutil
import datetime, dateutil.parser, pytz, time
import pydoc
import requests, json
import sqlite_api
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.comm... |
import os
from alive_progress import alive_bar
import numpy as np
import torch
from common.camera import normalize_screen_coordinates, world_to_camera
from common.loss import mpjpe, p_mpjpe
from common.utils import deterministic_random
from model.VideoPose3D import TemporalModel, TemporalModelOptimized1f
def load_d... |
# 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... |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from .functional import capsule_linear
class StackedBRNN(nn.Module):
def __init__(self,**kwargs):
super(StackedBRNN,self).__init__()
self.dropout_output = kwargs.get("dropout_output",0.1)
self.dropout_rate = kwarg... |
#
# Common configuration functions.
#
import datetime
import logging
import os
import pathlib
import re
import shutil
import socket
import sqlite3
import time
import traceback
import yaml
from flask import Flask, jsonify, abort, request, flash, g
from stat import S_ISREG, ST_CTIME, ST_MTIME, ST_MODE, ST_SIZE
from sub... |
# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Continuous Integration Database Library."""
import datetime
import glob
import logging
import os
import re
import sqlalchemy
import sqlalchemy.exc
imp... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016, deepsense.io
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.path
import numexpr as ne
plt.ion()
import pybie2d
"""
Demonstrate how to use the pybie2d package to solve an exterior Laplace problem
On a complicated domain using a global quadrature
This example demonstrates how to do thi... |
import textwrap
import maya.cmds as cmds
import maya.api.OpenMaya as om2
import pymel.core as pm
import pymel.core.datatypes as dt
# mgear
import mgear
from mgear.shifter.component import MainComponent
import mgear.core.primitive as pri
import mgear.core.transform as tra
import mgear.core.attribute as att
import mg... |
# -*- coding: utf-8 -*-
"""The Chef object"""
import json
import logging
import os
import re
import sys
from collections.abc import Mapping
from copy import deepcopy
from time import time
from dask import delayed
import ruamel.yaml as yaml
from graphviz import Digraph
from typing import List
from . dag import DAG... |
### function decorators
import functools
import time
import numpy as np
import h5py
import os
from ..function_utils import filter_kwargs
class Metadata(object):
"""Read in metadata for a class and reference it
opaquely through the instance.metadata object without worrying
about datagroup prefi... |
# coding: UTF-8
from FreeCAD import Console, Placement, Rotation, Vector, activeDocument
from Legify.Body import *
from Legify.Holes import *
from Legify.Pins import *
from Legify.SideStuds import *
from Legify.TopStuds import *
class BrickContext:
def __init__(self):
self.width = None
self.dept... |
from keras import backend as K
from keras.models import Model
from keras.optimizers import SGD
from deephar.activations import channel_softmax_2d
from deephar.models.blocks import build_context_aggregation
from deephar.utils import *
from deephar.layers import *
from deephar.objectives import elasticnet_loss_on_vali... |
#!/usr/bin/env python
import sys
import os
import time
import guessit
import locale
import glob
import argparse
import struct
import logging
from subprocess import call
from extensions import valid_tagging_extensions
from readSettings import ReadSettings
from tvdb_mp4 import Tvdb_mp4
from tmdb_mp4 import tmdb_mp4
from... |
"""Python wrappers around TensorFlow ops.
This file is MACHINE GENERATED! Do not edit.
Original C++ source file: fused_conv2d_bias_activation_op.cc
"""
import collections as _collections
import six as _six
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
from tensorflow.python.eager import conte... |
""" Contains layers, that are used as separate letters in layout convention, as well as convenient combining block. """
import inspect
import logging
import tensorflow.compat.v1 as tf
import tensorflow.keras.layers as K # pylint: disable=import-error
from .core import Activation, Dense, Dropout, AlphaDropout, BatchNor... |
# --------------------------------------------------------
# Licensed under The MIT License [see LICENSE for details]
# --------------------------------------------------------
import argparse
import datetime
import numpy as np
import itertools
import torch
from core.bc import BC
from core.ddpg import DDPG
from tenso... |
"""An improved base task implementing easy (and explicit) saving of outputs."""
import os
import logging
from inspect import getfullargspec
import numpy as np
from caput import pipeline, config, memh5
class MPILogFilter(logging.Filter):
"""Filter log entries by MPI rank.
Also this will optionally add MPI ... |
import torch
import torch.nn as nn
'''
Example of Transformer Modal
'''
class Encoder(nn.Module):
def __init__(self, input_dim, hidden_dim, n_layers,
n_heads, pf_dim, dropout, device, max_length=100):
super().__init__()
self.device = device
self.tok_embedding = nn.Embedd... |
""" Lib to manage an ATM (Automatic Teller Machine).
Important classes: User, Persistence.
"""
from decimal import Decimal
import hashlib
import sqlite3
import os
from datetime import datetime
class User(object):
""" Bank user. Can log in and do some actions or just act as a passive object.
Another class mus... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import logging
from collections import defaultdict
from typing import DefaultDict, Dict, Iterable, List, NamedTuple, Optional, ... |
from math import dist
import vk_orbwalker
from valkyrie import *
from helpers.flags import EvadeFlags
from dMoveModule import CurrentTarget, MovePrediction
from helpers.targeting import *
from helpers.damages import calculate_raw_spell_dmg
from helpers.spells import Slot
from boku_no_orbwalker import target_selector, O... |
"""Undocumented Module"""
__all__ = ['TreeNode', 'TreeItem']
# ADAPTED FROM IDLE TreeWidget.py
# XXX TO DO:
# - popup menu
# - support partial or total redisplay
# - key bindings (instead of quick-n-dirty bindings on Canvas):
# - up/down arrow keys to move focus around
# - ditto for page up/down, home/end
# - l... |
################################################################################
# tabulation.py
#
# The Tabulation class represents a function by a sequence of linear
# interpolations between points defined by arrays of x and y coordinates.
#
# <NAME>, PDS Rings Node, December 2011
####################################... |
"""
mappings between filter characteristic wavelengths and designations,
along with a bunch of derived related values for "XCAM"
instruments (PCAM, MCAM, ZCAM...), affording consistent interpretation
of operations on individual spectra
"""
from collections.abc import Mapping, Sequence
from itertools import chain, com... |
# Copyright: 2005-2011 <NAME> <<EMAIL>>
# License: GPL2/BSD
"""
gentoo configuration domain
"""
__all__ = ("MissingFile", "Failure", "domain")
# XXX doc this up better...
from functools import partial
from itertools import chain, izip
import os.path
from snakeoil.bash import iter_read_bash
from snakeoil.compatibil... |
import argparse
import csv
import datetime as dt
import logging
import multiprocessing
import os
from typing import Dict, Tuple, List
import dateutil.parser
import intervaltree
import pandas as pd
import simplejson as json
import dataset.util as util
from dataset.data.extract import load_hek_data, load_goes_flux, goe... |
# -*- coding: utf-8 -*-
import numpy as np
from polyline.codec import PolylineCodec
from polyline import encode as polyline_encode
from pandas import DataFrame
from . import RequestConfig
import requests
try:
from urllib.request import urlopen
except:
from urllib2 import urlopen
try:
from osgeo.ogr import Geometr... |
import torch
import torchvision.models as models
import torch.optim as optim
import argparse
import matplotlib.pylab as plt
from network.deeplabv3.deeplabv3 import *
from build_data import *
from module_list import *
from tools.general.io_utils import *
from tools.general.time_utils import *
from tools.general.json_ut... |
# -*- coding: utf-8 -*-
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
# @author : yinwm <<EMAIL>>
import os
import ConfigParser
from mercurial import commands
from mercurial import hg
from mercurial.i18n import _
... |
import os, webbrowser, requests, time, sys, sqlite3, random, traceback
import pyinspect as pi
import datetime
import wikipedia
import pywhatkit as kit
import ClointFusion as cf
from pathlib import Path
import subprocess
from PIL import Image
from rich.text import Text
from rich import print
from rich.console import Con... |
try:
from io import BytesIO
except ImportError as e:
import StringIO as BytesIO
try:
import cPickle as pickle
except ImportError as e:
import pickle
from mango import mpi
haveMpi4py = mpi.haveMpi4py
import scipy as sp
import scipy.optimize
logger, rootLogger = mpi.getLoggers(__name__)
class Di... |
import matplotlib.image as mpimg
import numpy as np
import cv2
import pickle
from skimage.feature import hog
import matplotlib.pyplot as plt
import time
import glob
from functools import wraps
from sklearn.svm import LinearSVC
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_te... |
# Copyright (c) 2012, <NAME>
# 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
# list of conditions and the foll... |
# -*- coding: utf-8 -*-
import click
# import logging
from pathlib import Path
from dotenv import find_dotenv, load_dotenv, set_key
import urllib3
import shutil
import os
import csv
from datetime import date
import pandas as pd
import numpy as np
import random
from pyproj import Transformer
from typing import Union
... |
################################################################################
#
# MIT License
#
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to dea... |
import unittest
import numpy as np
import torch
from fastNLP import FieldArray
from fastNLP.core.field import _get_ele_type_and_dim
from fastNLP import AutoPadder
class TestFieldArrayTyepDimDetect(unittest.TestCase):
"""
检测FieldArray能否正确识别type与ndim
"""
def test_case1(self):
# 1.1 常规类型测试
... |
from numpy.core.shape_base import block
import torch
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import models
import os
import copy
if torch.cuda.is_available():
dev = torch.device("cuda:0")
else:
dev = torch.device("cpu")
#print(f"Using {dev}")
torch.set_default_... |
#
# routes.py
# <NAME>, 2016-02-25
# Copyright (c) 2016 mldb.ai inc. All rights reserved.
#
import json, os, datetime, math
from operator import itemgetter
import functools, urllib, time
import binascii
mldb2 = mldb_wrapper.wrap(mldb)
EMBEDDING_DATASET = "embedded_images"
def preProcessData():
rp = json.loads(... |
#!/usr/bin/env python
'''
This scripts uses python 3 and the following libraries need to be installed 'pandas', 'ete3' and 'argparse' installed.
The blastn file needs NO modification. As long as blastn format 6 output with options
"query.id", "query.length", "pident", "subject.id", "subject.GBid", "evalue", "bit.sc... |
import networkx as nx
from krrt.planning.strips.representation import Action, Fluent
from krrt.utils import read_file
def create_serial_pop(plan):
pop = POP()
for action in plan:
pop.add_action(action)
for i in range(len(plan) - 1):
pop.link_actions(plan[i], plan[i+1], 'serial')
ret... |
import librosa
import numpy as np
from typing import Tuple
from multiprocess.pool import ThreadPool
from datetime import datetime
from pathlib import Path
from tqdm import tqdm
from functools import partial
from itertools import chain
from breaker_audio.component.utils import logmmse
from breaker_audio.component.sy... |
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_protect
from django.contrib.auth import login, logout, authenticate
from django.contrib import messages
from django.contrib.auth.forms import UserCreationForm, Authenticati... |
# 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... |
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import torch.nn.functional as F
import math
import cv2
import numpy as np
import os
model_urls = {'vgg16': 'https://download.pytorch.org/models/vgg16-397923af.pth'}
class SELayer(nn.Module):
def __init__(self, channel, reduction=16, num... |
# -*- coding: utf-8 -*-
#
# Copyright 2017-2021 AVSystem <<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 ap... |
"""
A program that converts an image into ASCII art v2.0
Author: <NAME>
Email: <EMAIL>
GitHub: https://github.com/ArianOmidi
Date: 2021-06-01
"""
import os, sys, subprocess
from pathlib import Path
import argparse, time
import numpy as np
import cv2
from PIL import Image, ImageFont, ImageDraw, ImageEnhance
from skima... |
# coding: utf-8
"""
A compact text based alternative to pyui
layout_text
- specifies position and size of each ui elemement
- lines represent rows in grid and each character represents a grid cell
- '*' represenrs blank cell
- ui elements represented by a single character
'b': ('button', ui.Bu... |
# Copyright (c) 2022 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... |
import math
from math import log2
from ori_finder import get_hamming_mismatch, neighbors
import random
def exists(pattern, dna_list):
for dnaString in dna_list:
if pattern not in dnaString:
return False
return True
def variantExists(pattern, dna_list, d):
variants = list(neighbors(pat... |
# Copyright 2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
try:
from QGL import *
from QGL import config as QGLconfig
... |
import pandas as pd
# from pathlib import Path
# import tensorflow as tf
from tensorflow.keras.layers import Dense
from tensorflow.keras.models import Sequential
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler,OneHotEncoder
# import sqlalchemy
# import h5py
# import... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 1 13:45:28 2019
@author: ltetrel
"""
import math
import os
import argparse
import datetime
import shutil
import platform
import numpy as np
from scipy import stats
from pyquaternion import Quaternion
from preproc import create_ref_grid, DataPrepro... |
import logging
import os
import time
from functools import lru_cache
from http.client import HTTPConnection
from typing import Optional
from urllib.parse import urljoin
import requests
from pydantic import BaseModel
from requests.exceptions import RequestException
from upgini.errors import HttpError, UnauthorizedErro... |
from autodiffpy.forward import (
Forward,
fVector,
sin,
cos,
tan,
sec,
csc,
cot,
arcsin,
arccos,
arctan,
arcsec,
arccsc,
arccot,
exp,
sqrt,
sinh,
cosh,
tanh,
sech,
csch,
coth,
ln,
log2,
log10,
log,
logistic,
)
fr... |
import sys, os
from pathlib import Path
import random
import numpy as np
import torch
from torch.utils.data import Dataset as PytorchDataset, DataLoader, RandomSampler
import h5py as hf
from omnibelt import save_yaml, load_yaml, unspecified_argument
import omnifig as fig
from .. import util
from ..uti... |
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
import os
import platform
from ctypes.wintypes import *
from functools import wraps
import sys
if sys.version_info[0] == 3:
from functools import reduce
else:
import ctypes
dll = "AutoItX3.dll"
bit, _ = platform.architecture()
if bit == "64bit":
# if 64bit v... |
### preprocessing
"""
code is taken from
tunguz - Surprise Me 2!
https://www.kaggle.com/tunguz/surprise-me-2/code
"""
import glob, re
import numpy as np
import pandas as pd
from sklearn import *
from datetime import datetime
import matplotlib.pyplot as plt
data = {
'tra': pd.read_csv('../input/air_visit_data.csv'... |
# -*- tab-width:4;indent-tabs-mode:nil;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
# vi: set ts=2 noet:
import os
import io
import math
import PIL
import PIL.ImageDraw
import PIL.ImageOps
import boto3
import mysql.connector
import numpy as np
import pandas as pd
import matplotlib as mpl
import xlsxwriter
def... |
import math
import smbus
import serial
import time
from gps3 import gps3
import numpy as np
import RPi.GPIO as GPIO
import time
ser = serial.Serial(
port='/dev/serial0',
baudrate=38400,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
#********... |
"""Functions for generating random quantum objects and states.
"""
import os
import math
import random
from importlib.util import find_spec
from functools import wraps, lru_cache
from numbers import Integral
import numpy as np
import scipy.sparse as sp
from ..core import (qarray, dag, dot, rdmul, complex_array, get_t... |
import csv
import os
import sys
import cv2
import matplotlib.pyplot as plt
import numpy as np
sys.path.insert(0, '../')
from lib.config import initialize
sys.path.insert(0, '../yolomask/')
from yolomask.mask_inference import YoloMask
from yolomask.person_inference import YoloPerson
from distance.social_distance import ... |
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.