text stringlengths 3.07k 22.1k |
|---|
import os
import re
import numpy as np
import cv2
import imageio
from pyquaternion import Quaternion
class PointList:
class Point:
def __init__(self, id, coord):
self.id = id
self.coord = coord
def __init__(self, line):
words = line.split()
self.points = []
for i in range(0, len(words) / 3):
id =... |
from __future__ import division, absolute_import, print_function
from struct import *
# This file defines much of the structure needed to carry out our communication protocol in Python.
# You can find more information about our communications protocol here:
# https://github.com/HumanDynamics/OpenBadge/wiki/Communica... |
"""Test Oklab library."""
import unittest
from . import util
from coloraide import Color as ColorOrig
from coloraide.spaces.oklab.css import Oklab
class Color(ColorOrig):
"""Utilize Oklab CSS (currently) experimental."""
Color.register(Oklab, overwrite=True)
class TestOklabInputOutput(util.ColorAsserts, unitt... |
#!/usr/bin/env python
"""
DataExplore pluin differential expression using R
Created June 2017
Copyright (C) <NAME>
This program 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 versi... |
# Builtin modules
from __future__ import annotations
from io import BytesIO
from math import ceil
from typing import Dict, Any, List, Tuple, IO
# Third party modules
# Local modules
# Program
VAR_ENDIANNESS = "little"
VAR_VERSION = b"\x01"
OP_NONE = b"\xED"
OP_BOOL_FALSE = b"\xEE"
OP_BOOL_TRUE = ... |
"""
arcgis2geojson is a derivative work of ESRI's arcgis-to-geojson-utils:
https://github.com/Esri/arcgis-to-geojson-utils/
Original code is Copyright 2015 by Esri and was licensed under
the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
Ported to Python in 2016 by <NAME>.
Updated in 2019 by Ev... |
import json
import os
import pickle
import sys
import keras
from keras.preprocessing.sequence import make_sampling_table
from keras.preprocessing.sequence import skipgrams
import numpy as np
import pandas as pd
import utils
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # for Tensorflow cpu usage
os.environ["CUDA... |
import argparse
import os
import sys
import time
from src import Constants as c
#is_error is either 0 or 1
def print_usage(is_error):
print(c.MAIN_USAGE, file=sys.stderr) if is_error else print(c.MAIN_USAGE)
exit(is_error)
def check_dir(direc, description=""):
errors = False
if direc == "":
... |
from __future__ import absolute_import, unicode_literals
__all__ = [
'DefaultExecutor',
'AsyncExecutor',
'BatchExecutor',
'TransactionExecutor'
]
from collections import OrderedDict
from uuid import uuid4
from six import moves
from .exceptions import (
AsyncExecuteError,
BatchStateError,
... |
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
import numpy as np
import tensorflow as tf
import scipy.ndimage
import yaml
import os
from dl_playground.networks.layers.cnn import ConvNet
from dl_playground.utils.superpixel import rgb_to_normalized_lab
from dl_playground.utils.common import local_mean_tf
class Palette:
"""Convieniet functions for painting tex... |
import hashlib
import json
from textwrap import dedent
from uuid import uuid4
import jsonpickle
from flask import Flask
from urllib.parse import urlparse
from Crypto.PublicKey import RSA
from Crypto.Signature import *
from time import time
from datetime import datetime
import requests
class Blockchain (object):
def... |
from .base import lib, _check
from textwrap import dedent
from operator import methodcaller, itemgetter
from functools import partial
import numba
from numba import cfunc, jit, carray
from numba.core.typing import cffi_utils as cffi_support
from pygraphblas import lib, ffi as core_ffi
from pygraphblas.base import lazy... |
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
"""Generic classes/functions for pyreverse core/extensions."""
import os
import re
import shutil
i... |
try:
import ConfigParser as configparser
except ImportError:
import configparser
from datetime import datetime
import dbus
import sys
import os
import time
import traceback
is_py2 = sys.version[0] == '2'
if is_py2:
import Queue as Queue
else:
import queue as Queue
PANEL_TYPES = {
0x14: "Concord",
... |
import attr
from glob import glob
import os
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import butter, filtfilt
from pathlib import Path
import seaborn as sns
from fit_submovements import *
sns.set()
@attr.s
class Subject(object):
id = attr.ib(init=False)
df_dict =... |
from cProfile import label
from numpy import cos, cosh, sin, sinh
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
'''
TASK 5
'''
r1 = 1.87527632324985
r2 = 4.69409122046058
r3 = 7.855
#r1 and r2 derived in previous task
'''
TASK 10
'''
#pass r1 or r2 along with number that you want... |
import asyncio
import inspect
from enum import EnumMeta
from typing import Any, Awaitable, Callable, Dict, List, Literal, Optional, Tuple, Union, get_origin
from ..interactions import Option, SlashCommand, SlashInteraction, Type
from ..interactions.application_command import OptionChoice, OptionParam, OptionType
from ... |
"""
This file contains some functions adapted from the following repositories:
https://github.com/ignacio-rocco/cnngeometric_pytorch
for the main architecture;
https://github.com/filipradenovic/cnnimageretrieval-pytorch
for the GeM layer;
https://github.com/lyakaap/NetVLAD-pytorch
for... |
"""
Utilities for data handling.
Reading datasets from tsv and jsonl files.
"""
import os
from pathlib import Path
# comment this out except for KGP servers.
os.environ['OPENBLAS_NUM_THREADS'] = "12"
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
print(CURRENT_DIR)
import torch
import shutil
import argparse
... |
import traceback
from glob import glob
import pvl
import json
import os
from os import path
from io import StringIO
import geopandas as gpd
import pandas as pd
from datetime import datetime
from geoalchemy2 import Geometry, WKTElement
from geoalchemy2.shape import from_shape
import shapely
from shapely.geometry import... |
# Copyright (c) 2020 SUSE LINUX GmbH
#
# 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 w... |
#!/usr/bin/env python
import os, sys, argparse, pickle, time
import pandas as pd
import numpy as np
from sklearn import tree
import sklearn
from sklearn.model_selection import GridSearchCV, train_test_split
from sklearn.metrics import classification_report
import graphviz
import multiprocessing as mp
from datetime im... |
from .data import *
from . import obj_utils as utils
from .coco_eval import CocoEvaluator
from .coco_utils import get_coco_api_from_dataset
def get_iou_types(model):
model_without_ddp = model
if isinstance(model, torch.nn.parallel.DistributedDataParallel):
model_without_ddp = model.module
iou_type... |
'''
Created on 6-feb-2017
Modified the 20170321, by EP
@author: roncolato
'''
import numpy as np
import scipy.interpolate as interpol
from scipy.optimize import minimize
from sherpa.training.step1 import from7to28 as f7
from sherpa.training.step1 import EquaPrec as ep
from sherpa.training import EquaIndic as ei
from... |
import h5py
import numpy as np
import matplotlib.pyplot as plt
import os
import argparse
# Class to read results from a h5py file.
class ReadResults:
def __init__(self, file_path, various_data=True):
self.file = h5py.File(os.path.join(file_path, 'results.h5'), 'r')
self.various_data = various_data # True... |
# Copyright (c) 2016, The Bifrost Authors. 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 list of conditions an... |
import base64
import datetime
import os
import pandas as pd
from bokeh.embed import file_html
from bokeh.io import save
from bokeh.layouts import gridplot
from bokeh.models import Div, NumeralTickFormatter, Panel, Tabs, Title
from bokeh.models import Range1d
from bokeh.palettes import d3
from bokeh.plotting import fig... |
# encoding=utf-8
# api
import os
import json
from enum import Enum
# alphabet enum(the value stands for a different writing of an alphabet)
class UyHarp(Enum):
BASH = 1
YALGHUZ = 2
OTTURA = 3
AHIR = 4
# la model (la is a two-set which Composed of "L" and "A")
class LA_Class():
base1 = None
ba... |
import utils
sched = utils.Scheduler()
import wws_lite
from IPython.display import Image
import pprint
pp = pprint.PrettyPrinter(indent=4)
import math
import time
import matplotlib.pyplot as plt
import urllib.request
import numpy as np
import orspy
import pickle
from contest import Run
def pose_from_info(x, y, angle=... |
import numpy as np
import nibabel as nib
import pandas as pd
import os
import tensorflow as tf
import math
from neuron.layers import SpatialTransformer
from multi_affine.datagenerators import indicator, give_index_atlas
from multi_affine.utils import load_multi_atlas
from pandas import ExcelWriter
def eval_affine(data... |
'''
kk src7
cd py
rsync8022 checkNc2.py $cmda4:/home/svc/new_github/CMDA/JPL_CMDA/services/svc/svc/src/py
rsyncec2 cmac.py $ec20:/home/ubuntu/cmac/cmac_docker1/user
'''
#== def_ferretViewAspect
#== def_ferretPlot used in universalPlotting6, the linear combination service
#== def_ferretAnomaly
#== def_find_bound(x... |
"""Convolution layers."""
import torch
from torch import nn as tnn
from ._base import nitorchmodule
from ._norm import BatchNorm
from ..activations import _map_activations
from ...core.pyutils import make_tuple, rep_sequence, getargs
from copy import copy
import math
import inspect
# NOTE:
# My version of Conv allows... |
__author__ = 'yanjiajia'
from django.core import urlresolvers
from django.template.defaultfilters import floatformat # noqa
from django.utils.translation import ugettext_lazy as _
from horizon import tables
from horizon.templatetags import sizeformat
from django.utils.translation import ungettext_lazy
from horizon imp... |
""" This is the MAIN file for Dungeons of Dork (Python Edition.)
Copyright 2021 (c) <EMAIL>urch<EMAIL>
"""
import random
from pandas import read_csv, isna
class Player:
""" The main protagonist in our game"""
def __init__(self, loc_list, obj_list, npc_list):
self.backpack = [0, 0, 0, 0, 0] # 5 s... |
import numpy
import logging
from numpy.core import dot, array
from scipy import stats
from .. import Exceptions
from ..misc import Math
from .. import Utilities
class Context(object):
def __init__(self): raise Exceptions.ReportableException("Tried to instantiate abstract Joint Analysis context")
def get_genes... |
#!/usr/bin/env python3
#
# Import all necessary libraries
#
import argparse
import json
import datetime
import geopy.distance
from teslarequest import TeslaRequest
#
# Define some global constants
#
VERSION= '0.1.1'
KEY_TOKEN= 'access_token'
KEY_TOKEN_CREATION= 'created_at'
KEY_TOKEN_EXPIRATION= 'expires_in'
KEY... |
from absl import logging
import numpy as np
import tensorflow as tf
import cv2
import random
import colorsys
YOLOV4_LAYER_LIST = [
'yolo_cspdarknet53',
'yolo_spp',
'yolo_pan',
'yolo_conv_0',
'yolo_output_0',
'yolo_conv_1',
'yolo_output_1',
'yolo_conv_2',
'yolo_output_2',
]
YOLOV3_L... |
import numpy as np
import scipy as sp
import scipy.stats as stats
import pandas as pd
import copy
import cv2
import matplotlib.animation as animation
import matplotlib.pyplot as plt
import pickle
#just identify water flow path for drawing graphs
def extract_boundary(original,hsv_image, lower, upper, flag):
# need ... |
# Copyright (c) 2020.
# MIT License
#
# Copyright (c) 2019 YumeNetwork
#
# 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
# ... |
import torch
from torch.autograd import Variable
from torch.utils.data import Dataset, DataLoader
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
import os
import numpy as np
num_epochs = 150
batch_size = 50
#input size of noise to the generator
noise_in_len = 100
#... |
from sklearn.model_selection import LeaveOneOut
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.svm import SVC
from sklearn.neighbors import KNeighborsClassifier
from sklearn.neighbors import RadiusN... |
"""Contains the classes responsible for an User.
User is the profile differs from yours.
"""
import itertools
import dateutil
import datetime
from application.sources.pytinder.exceptions import UserInitializationError
from application.sources.pytinder.globals import GENDER_MAP, VALID_PHOTO_SIZES
from application.sour... |
from random import randrange
from pathlib import Path
import torch
from torch import nn
from torch.utils.data import Dataset, DataLoader
from torch.nn.utils.rnn import pad_sequence
from einops import rearrange
from tqdm import tqdm
import numpy as np
from shutil import rmtree
from nuwa_pytorch.tokenizer import token... |
'''
Framework for gridding/ungridding geolocated data.
GridDef is an abstract class. It cannot be used
as a standalone because none of the functionality
has been implemented. It is simply a framework,
with some of the general functionality implemented.
All subclasses of GridDef provide forward and
inverse projecti... |
import itertools
import warnings
from collections import OrderedDict
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn import metrics
from sklearn.model_selection import cross_val_predict, KFold
from tabulate import tabulate
from src.visualization import plot_uti... |
#!/usr/bin/env python
import platform
if platform.python_implementation() == "PyPy":
import sys
sys.path.insert(0, '/usr/lib/python2.7/dist-packages')
import argparse
import csv
import fileinput
import itertools
import json
import logging
import logging.config
import networkx as nx
import sys
from distances ... |
''' Utils for io, language, connectivity graphs etc '''
import os
import sys
import re
import string
import json
import time
import math
from collections import Counter
import numpy as np
import networkx as nx
# padding, unknown word, end of sentence
base_vocab = ['<PAD>', '<UNK>', '<EOS>', '<NAV>', '<ORA>', '<TAR>'... |
import logging
from io import BytesIO
import pandas as pd
from openpyxl import Workbook
from openpyxl.utils import get_column_letter
from openpyxl.utils.dataframe import dataframe_to_rows
from openpyxl.worksheet.table import Table, TableStyleInfo
from validator903.config import configured_errors
logger = logging.get... |
"""
Artwork from https://kenney.nl
"""
import random
import arcade
SPRITE_SCALING = 0.5
GEM_SCALING = 0.5
NUMBER_OF_GEMS = 40
DEFAULT_SCREEN_WIDTH = 800
DEFAULT_SCREEN_HEIGHT = 600
SCREEN_TITLE = "Lab 9"
# How many pixels to keep as a minimum margin between the character
# and the edge of the screen.
VIEWPORT_MARG... |
import os
import threading
import time
import timeit
import pprint
from collections import deque
import numpy as np
import queue as mp
import tensorflow as tf
from .file_writer import FileWriter
from .models import Model
from .utils import get_batch, log, create_env, create_buffers, create_optimizers, act, act1
mea... |
import wx
from wx import grid
from book_manager.borrow import borrow
from book_manager.ser import Ser
class MyGrid(grid.Grid):
"""表格类,处理一个新建一个表格"""
def __init__(self, parent):
grid.Grid.__init__(self, parent, -1)
self.CreateGrid(200, 5)
self.SetPosition((20, 100))
self.SetSi... |
#------------------------------------------------------------------------------
'''Test for various DataFrame output. Uses external csv control files.'''
import os
import logging
import numpy as np
##import pandas as pd
##import nose.tools as nt
import lamana as la
import lamana.utils.tools as ut
##from lamana impo... |
"""
134. Gas Station
Medium
There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i].
You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from the ith station to its next (i + 1)th station. You begin the journey with an empty tank at one of the... |
#!/usr/bin/env python
#
# Copyright 2021 Espressif Systems (Shanghai) CO LTD
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
"""
Introducing the keywords of OOP
Logically group data and function
Easy to re-use and build upon
Data and function are known as attributes( characteristics )
and methods ( function associated with a class )
class is a blueprint for creating instances
Classes and Instances
Represent Employee in Python
Indivi... |
import os, csv
import time
import argparse
import torch
import torch.nn as nn
import torchvision
import sys
from collections import defaultdict
import torchvision.transforms as transforms
from sklearn.metrics import f1_score, precision_score, recall_score
import numpy as np
import random
import torch.optim as optim
de... |
# Copyright 2009-2012 <NAME>, 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... |
# Copyright (c) 2016 Universidade Federal Fluminense (UFF)
# Copyright (c) 2016 Polytechnic Institute of New York University.
# This file is part of noWorkflow.
# Please, consult the license terms in the LICENSE file.
"""'now diff' module"""
from __future__ import (absolute_import, print_function,
... |
"""
HTTP authentication support for web.py
"""
import base64
import functools
import hashlib
import math
import os
import re
import time
import web
__all__ = (
'make_hash', 'join_fields', 'parse_fields',
'Auth', 'DigestAuth',
'DUMMY', 'FORWARDED_USER', 'BASIC', 'DIGEST',
'AuthMediator',
)
class St... |
#!/usr/bin/env python
# coding: utf-8
# # Behaviour Cloning Project
# >In this project, I am describing the behaviour cloning of Self Driving Car in Udacity
# In[1]:
import cv2
from keras.models import Sequential
from keras import layers
from keras.callbacks import EarlyStopping, ModelCheckpoint
from keras.backend... |
# ###############################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this fi... |
import cv2
from more_itertools import unique_everseen
import numpy as np
##### Right ###########
# 큰 리벳 검출할 영역(관심영역)을 지정 (start point to end point of Rectangle Box).
ROI_list = [
[(5, 90), (500, 950)],
]
# 작은 리벳 검출할 영역(관심영역)을 지정 (start point to end point of Rectangle Box).
ROI_list_small = [
[(550, 90), (72... |
"""
Unit tests for crossover operators
"""
import itertools
import pytest
import numpy as np
from leap_ec.individual import Individual
import leap_ec.ops as ops
import leap_ec.statistical_helpers as stat
##############################
# Tests for uniform_crossover()
##############################
def test_unifo... |
from strategies import *
from report import report_to_spreadsheet, report_latex_table
from random import shuffle
from datetime import datetime
def play(a_move: bool, b_move: bool) -> (int, int):
if a_move:
if b_move:
return 3, 3
return 0, 5
else:
if b_move:
retu... |
#!/usr/bin/python
# Copyright (c) 2018, 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 detail... |
"""Coinbase Controller"""
__docformat__ = "numpy"
# pylint: disable=R0904, C0302, W0622
import argparse
from typing import List, Union
import difflib
from prompt_toolkit.completion import NestedCompleter
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.menu import session
from gamestonk_te... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# ./list-files.py course_id
#
# outputs a summary of the files in a course
# also outputs an xlsx file of the form: files-course_id.xlsx
#
#
#
# with the option "-v" or "--verbose" you get lots of output - showing in detail the operations of the program
#
# Can also be calle... |
import socket
import subprocess
import os
import shutil
filename = "inst/record.txt"
HOST_APD_CONF = """
interface=wlan0
driver=nl80211
ssid=PIMW-NET
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=<PASSWORD>
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=... |
#####################################################################
#
# This module handles all tracking activities for a device. It contains
# the following modules:
# TrackFromZones - iCloud3 creates an object for each device/zone
# with the tracking data fields.
#
# The primary methods are:
#... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
"""
Copyright (c) 2016 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import absolute_import, print_function, unicode_literals
import time
from requests.exceptions import ConnectionError
try:
... |
import time
import json
import re
from slackclient import SlackClient
from tabulate import tabulate
from peewee import *
from datetime import datetime
from dateutil import tz
from models import db, Player, Match
SIGNUP_REGEX = re.compile('signup', re.IGNORECASE)
WINNER_REGEX = re.compile('^I\s+(beat)\s+<@([A-z0-9]*)>... |
import numpy as np
from math import sqrt
#********************
#**** this function finds a point which is greater than the min distance
#********************
def find_closest_point_at_minimum_distance(path_array,starting_location,distance_required,pos_or_neg):
x1 = path_array[starting_location,0]
y1 = path_arr... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... |
import numpy as np
import tensorflow as tf
from keras import backend as K
psnr = tf.image.psnr
ssim = tf.image.ssim
ssim_multiscale = tf.image.ssim_multiscale
def accuracy(labels, probs):
return tf.reduce_mean(tf.cast(tf.equal(tf.argmax(labels, 1), tf.argmax(probs, 1)), tf.float32))
def intersection_of_union(lab... |
"""
Process Pool
Pools offer lower control over execution, as it is not possible to know the
state of individual workers
Common methods:
has_results(): returns whether there are any results available
results(): return an iterator yielding ( identifier, result ) tuples
submit(target, args = (), kwargs = {}): sub... |
#! /usr/bin/env python3
"""
Copyright 2021 <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
Unless required by applicable law or agreed to in wri... |
from random import randint,shuffle
import sys
from sys import stdin, stdout
from heapq import heappush,heappop
import time as timer
N = 1000 # population size, assumed even
maxiterations = 100
prob_crossover = 1.0
prob_mutation = 0.05
exec_time = 30
cmax = 0
maxheight=0
beststring=[]
n,m,p = map(int,stdin.readline().... |
import cupy as cp
import numpy as np
import pytest
from cupy import testing
from cupyx.scipy import ndimage as ndi
from skimage import data
from cucim.skimage import color
from cucim.skimage.morphology import binary, grey, selem
from cucim.skimage.util import img_as_bool
img = color.rgb2gray(cp.array(data.astronaut()... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_infoblox_netmri
----------------------------------
Tests for `infoblox_netmri` module.
"""
import unittest
import json
from requests import Session
from httmock import with_httmock, urlmatch
from mock import patch
from infoblox_netmri.client import InfobloxNet... |
from collections import namedtuple
from fileinput import filename
from operator import indexOf
from modeling.modeling_qagnn import LM_QAGNN
import streamlit as st
import numpy as np
import json
import torch
import pickle
from pyvis import network as net
from collections import defaultdict
import streamlit.components.v1... |
from ..nn import Embedding
from ..nn import utils
import torch
import torch.nn as nn
import torch.nn.functional as F
class Sequence_Tagger(nn.Module):
def __init__(self, word_dim, num_words, char_dim, num_chars, use_pos, use_char, pos_dim, num_pos,
num_filters, kernel_size, rnn_mode, hidden_size, ... |
from typing import Dict
from CommonServerPython import * # noqa: E402 lgtm [py/polluting-import]
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
# CONSTANTS
DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
class pXScoring:
"""
Class to handle all current and future scoring for PerimeterX object... |
import os
os.system('python3 get-pip.py')
os.system('pip install opencv-python')
os.system('pip install tk')
os.system('rm get-pip.py')
from tkinter.ttk import Progressbar
os.system('pip install opencv-python')
import cv2
import tkinter
import sys
import os.path
from tkinter import *
from tkinter import filedialog
impo... |
import warnings
import numpy as np
from ctapipe.io.eventsource import EventSource
from ctapipe.io.containers import DataContainer
from astropy import units as u
from astropy.coordinates import Angle
from astropy.time import Time
from ctapipe.instrument import (
TelescopeDescription,
SubarrayDescription,
Cam... |
# -*- coding: utf-8 -*-
"""
Poll aWATTar data from their public API.
"""
__author__ = "<NAME> <<EMAIL>>"
__copyright__ = "<NAME>"
__license__ = "mit"
import asyncio
from pathlib import Path
import arrow # type: ignore
import os
import uuid
from box import Box # type: ignore
from filelock import FileLock
from l... |
_PATH = '../../../datasets/'
import os, sys
if _PATH not in sys.path:
sys.path.insert(0, _PATH)
import tensorflow as tf
import tensorflow_datasets as tfds
from trainer.datasets.utils import normalize, random_jitter
import numpy as np
from skimage.transform import radon,iradon
import glob
def deeplesion(config_na... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2021-present Daniel [Mathtin] Shiko <<EMAIL>>
Project: Minecraft Discord Bot
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 S... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# coding=utf-8
from abc import abstractmethod
import pandas as pd
import numpy as np
from scipy.stats import pearsonr
from qlib.log import get_module_logger, TimeInspector
from qlib.contrib.estimator.handler import BaseDataHandler
from qlib.co... |
"""
USBMux client that handles iDevice descovery via USB.
:author: <NAME> (original: <NAME> "marcan" <<EMAIL>>)
"""
from .variables import LOG
from ..util import Log
import select
import socket
import struct
import sys
import plistlib
from typing import Dict, Union, Optional, Tuple, Any, Mapping, List
log = Log.getL... |
"""
Serializers from financial aid
"""
import logging
import copy
from django.db.models import Max, Min, Q
from django.core.exceptions import ImproperlyConfigured
from django.shortcuts import get_object_or_404
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from rest_framew... |
# Import modules and packages
import numpy as np
import pandas as pd
import datetime as dt
import matplotlib.pyplot as plt
from IPython.display import Image
# Import from Sklearn
from sklearn.metrics import r2_score
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing import StandardScaler
# Impo... |
# Copyright 2014 <NAME>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation
import os
import stat
import tempfile
import signal
import sys
from quodlibet.util.dprint import print_, print... |
# stdlib imports
import os
import numpy as np
import urllib
import json
from datetime import timedelta
import collections
# local imports
from mapio.shake import getHeaderData
from libcomcat.search import get_event_by_id, search
from libcomcat.classes import VersionOption
from mapio.basemapcity import BasemapCities
f... |
import json
import shutil
import tempfile
import logging
from binascii import unhexlify
from torba.testcase import IntegrationTestCase
import lbrynet.wallet
from lbrynet.conf import Config
from lbrynet.extras.daemon.Daemon import Daemon, jsonrpc_dumps_pretty
from lbrynet.wallet import LbryWalletManager
from lbrynet.... |
from pathlib import Path
import os
import shutil
import subprocess
import sys
import tempfile
import webbrowser
import ads
import requests
import rich
from rich import prompt
from rich import progress
def fuzzy_search_results(papers):
"""Launch fzf subprocess and prompt selection of article by user.
Paramet... |
from __future__ import division
import pytest
import logging
import os
from eigenproblems import *
from eigensolvers import *
from helpers import is_diagonal_matrix
def test_assert_eigenproblems_were_defined():
"""
Check that `available_eigenproblems` is not the empty set and that
a few known eigenproblem... |
import json
from typing import *
# noinspection Mypy
from grapl_analyzerlib.grapl_client import GraphClient
from pydgraph import DgraphClient, Txn
from grapl_analyzerlib.nodes.any_node import NodeQuery, NodeView
from grapl_analyzerlib.nodes.queryable import Queryable, NQ
from grapl_analyzerlib.nodes.types import Prop... |
import os
import json
import numpy as np
import pandas as pd
from tqdm import tqdm
from attrdict import AttrDict
import torch
from transformers import (
AdamW,
ElectraConfig,
ElectraTokenizer,
get_linear_schedule_with_warmup
)
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
from fastp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.