text stringlengths 3.07k 12.6k |
|---|
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
from __future__ import annotations
from dataclasses import dataclass
from enum import IntEnum
from typing import List, Union, TYPE_CHECKING
from ..utils.conversion import convert
from ..utils.extraction import... |
import requests
import json
from ibm_watson import NaturalLanguageUnderstandingV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_watson.natural_language_understanding_v1 import Features, SentimentOptions, KeywordsOptions
from .models import CarDealer, DealerReview
from requests.auth import HTTP... |
'''Data streams.
'''
import logging
import cv2
from fuel.datasets.hdf5 import H5PYDataset
from fuel.schemes import ShuffledScheme, SequentialScheme
from fuel.streams import DataStream
from fuel.transformers import Transformer
import h5py
import numpy as np
from PIL import Image
import theano
logger = logging.getLo... |
"""
Utilities for post-processing and spatial analysis of scarp template matching
results
"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.ndimage import zoom
from osgeo import gdal, osr
from copy import copy
def calculate_local_swath_orientation(data):
first = da... |
"""Astrokat utilities."""
import datetime
import katpoint
import numpy
import time
import yaml
class NotAllTargetsUpError(Exception):
"""Raise error when not all targets are at the desired horizon.
Not all targets are above the horizon at the start of the observation error
"""
class NoTargetsUpError(E... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division, print_function, absolute_import
from .compat import *
from .base import FuncDecorator
class classproperty(property):
"""
allow a readonly class property to exist on a class with a similar interface
to the built-in property decorat... |
"""Module containing class `DeleteClipsCommand`."""
import logging
import random
import time
from django.db import transaction
from vesper.command.clip_set_command import ClipSetCommand
from vesper.django.app.models import Clip
from vesper.singleton.clip_manager import clip_manager
import vesper.command.command_uti... |
# Copyright (c) Lawrence Livermore National Security, LLC and other Ascent
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and
# other details. No copyright assignment is required to contribute to Ascent.
"""
file: gen_relnotes_variants_from_changelog.py
description:
Release helper -- convert... |
"""A python program to test executionbackup scenarios."""
import time
import requests
from sanic import Sanic, response
import ujson
import asyncio
import subprocess
# we start two mock EE's (which will just be sanic servers)
# We need to fork off running the executionbackup (EB) binary that connect to the mock EEs
# ... |
import os
import random
import torch
import tqdm
def matrix_dist(matA, matB):
"""
Compute affinity between m vecs in mat1 and n vecs in mat2
matA: m x k
matB: n x k
return: m x n
"""
if matA.dim() == 1:
matA = matA[None, :]
if matB.dim() == 1:
matB = matB[None, :]
a... |
import py_thorlabs_ctrl.kinesis
import clr, time
POLLING_INTERVAL = 250
ENABLE_SLEEP_TIME = 0.1
py_thorlabs_ctrl.kinesis.check_import()
from System import String
from System import Decimal
from System import Enum
clr.AddReference('System.Collections')
clr.AddReference("Thorlabs.MotionControl.GenericMotorCLI")... |
import json
from pathlib import Path
from demo.viper.viper import VIPER_CHEF_ADDR, viper_chef_call, w3
address = YOUR_ADDRESS_AS_HEXSTR
block_number = w3.hmy.block_number
multiplier = viper_chef_call.getMultiplier(block_number, block_number+1)
reward_per_block = viper_chef_call.REWARD_PER_BLOCK()
rewards_per_week = ... |
# -*- coding: utf-8 -*-
r'''Based on kivy.uix.behaviors.drag.DragBehavior
DragBehaviorを元にして作ったClass。DragBehaviorとは違いWidgetの移動は行わず、ただ
Drag入力が行われた事を通知するだけである。またdrag_rectangleプロパティを持っておら
ず、Widget全域がDragを感知する領域になっている。
'''
__all__ = ('DragRecognizer', )
from functools import partial
from kivy.clock import Clock
from k... |
"""See: https://github.com/FabianFuchsML/se3-transformer-public"""
import torch
from equivariant_attention.fibers import Fiber
from equivariant_attention.modules import (GAvgPooling, GConvSE3, GMaxPooling,
GNormSE3, GSE3Res, get_basis_and_r)
from swan.dataset.features.f... |
"""models.py - This file contains the class definitions for the Datastore
entities used by the Game. Because these classes are also regular Python
classes they can include methods (such as 'to_form' and 'new_game')."""
import random
from datetime import date
from protorpc import messages
from google.appengine.ext impo... |
"""Module for creating illustrations.
To create an annotated image we need an instance of the
:class:`jicbioimage.illustrate.AnnotatedImage` class.
>>> from jicbioimage.illustrate import AnnotatedImage
Suppose that we have an existing image.
>>> from jicbioimage.core.image import Image
>>> im = Image((50,50))
We c... |
# -*- coding: UTF-8 -*-
from bs4 import BeautifulSoup
from datetime import datetime
from functools import wraps
import os
import re
from requests import get
import sys
from time import sleep
import traceback
"""
Disable warning.
"""
import requests.packages.urllib3
requests.packages.urllib3.disable_warnings()
fr... |
"""check params for request
"""
from enum import Enum
import utils.response as Response
from utils.checker import UserInfoType
def check_str_as_bool(value):
"""check `value` if it's boolean
"""
value = value.lower()
if value in ['true', 'false']:
return True
return False
def check_str_as... |
#!/usr/bin/env python
# coding: utf-8
import os
# if MTA database already exisits, delete to avoid duplicating data
if os.path.exists('mta_data.db'):
os.remove('mta_data.db')
# get MTA data from same year as satellite image
os.system('python get_mta.py "18"')
# import SQLAlchemy
from sqlalchemy import create... |
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright 2021-2022, <NAME> and <NAME>"
__license__ = "Apache-2.0"
from paks.utils.names import namer
from paks.logger import logger
import paks.utils
import paks.defaults
import paks.templates
import paks.commands
import paks.settings
import subprocess
import select
imp... |
"""
Script from <NAME>, used for the SHREC17 competion
"""
import os
import subprocess
from joblib import Parallel, delayed
from pathlib import Path
import numpy as np
from scipy.spatial.distance import pdist, squareform
from sklearn.metrics import precision_recall_curve, precision_score
from spherical_cnn impor... |
from itertools import chain
from contextlib import contextmanager
from plumbum.machines.local import CommandsProvider
from plumbum.commands.base import BaseCommand
from plumbum.commands.processes import run_proc, CommandNotFound, ProcessExecutionError
class EmptyCluster(Exception):
"""Raised by :class:`Cluster <... |
from enum import Enum
from typing import Optional
from .. import utils
from ..constants import *
import arcade
from pyglet.gl import GL_NEAREST
from ..entity.cabinet import Cabinet
from ..entity.enemy import EnemyList, Enemy
from ..entity.player import Player
from ..entity.exit import Exit
from ..ingame_ui import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Processors
"""
from collections import defaultdict
import copy
import six
from rebulk import Rebulk, Rule, CustomRule, POST_PROCESS, PRE_PROCESS, AppendMatch, RemoveMatch
from .common import seps_no_groups
from .common.formatters import cleanup
from .common.comparato... |
import argparse
import time
import os
import re
import bs4
import requests
import pandas as pd
from requests.auth import HTTPBasicAuth
POLL_INTERVAL = 18 # seconds
OSPC_API_KEY = os.environ['OSPC_API_KEY']
JENKINS_DOMAIN= os.environ["JENKINS_DOMAIN"]
BUILD_CAUSE = os.environ['BUILD_CAUSE']
HASHES = {}
def cli():
... |
import os
import numpy as np
from osgeo import gdal, osr, ogr
from geospace._const import CREATION, TYPE_MAP
from geospace.utils import block_write, rep_file, ds_name, context_file
def _map_no_data(in_data):
return in_data.filled()
def convert_uint8(ds, in_no_data=None, out_no_data=255):
ds, ras = ds_name(d... |
# -*- coding: utf-8 -*-
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2008,2009 <NAME> <<EMAIL>>
from lxml import etree
from coherence.backend import BackendStore, BackendRssMixin
from coherence.backend import BackendItem
from coherence.upnp.core import DIDLLite
from ... |
"""
Copyright (c) 2017, <NAME>.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on May 20, 2017
@author: jrm
"""
from atom.api import (
Typed, ForwardTyped, Coerced, Bool, Int, Tuple, Event, Float, Unicode,
Enum, observe
)
fro... |
import numpy as np
from typing import List, Union, Dict
from pathlib import Path
import os
import torch
import logging
import flair
import gensim
from flair.data import Sentence
from flair.embeddings.token import TokenEmbeddings
from flair.embeddings import StackedEmbeddings
from flair.embeddings import WordEmbeddin... |
# -*- coding: utf-8 -*-
"""
Input arguments (Parameters) for Asset_groups resources RESTful API
-----------------------------------------------------------
"""
import logging
import uuid
from app.modules.sightings.parameters import PatchSightingDetailsParameters
from app.modules.encounters.parameters import PatchEncou... |
# Try generating simplicial spheres that are approximately uniform
import torch
import logging
logging.basicConfig(format='%(asctime)s %(message)s',
level=logging.INFO,
handlers=[logging.FileHandler("polytope.log"),
logging.StreamHandler()])
d = 3... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: base.py
# Author: <NAME> <<EMAIL>>
from abc import abstractmethod, ABCMeta
import tensorflow as tf
import six
from ..utils import logger
from ..utils.develop import deprecated
from ..utils.argtools import memoized
from ..utils.naming import SUMMARY_BACKUP_KEYS
fro... |
# Copyright (c) 2016-2017, <NAME>
#
# All rights reserved.
#
# See the file "LICENCE" for information about the copyright
# and warranty status of this software.
'''IRC connectivity to discover peers.
Only calling start() requires the IRC Python module.
'''
import asyncio
import re
import socket
from collections im... |
import logging
import time, datetime
from thespian.test import *
from thespian.actors import *
import threading
ASK_WAIT = datetime.timedelta(seconds=5)
THREAD_WAIT_TIME=5 # seconds
finishes_lock = threading.Lock()
success_finishes = 0
failure_finishes = 0
def asker_main(asys, count, finished_address, ordered=Fals... |
import cv2
import sys
import numpy as np
import math
def ResizeWithAspectRatio(image, width=None, height=None, inter=cv2.INTER_AREA):
dim = None
(h, w) = image.shape[:2]
if width is None and height is None:
return image
if width is None:
r = height / float(h)
dim = (int(w * r... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 24 09:34:34 2018
@author: Corkidi
"""
import tkinter as tk
import matplotlib.pyplot as plt
import fix_yahoo_finance as yf
import arrow
#from matplotlib.figure import Figure
#from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolb... |
import Image
from math import sqrt
import struct
def intListBinWriter(filename,intList):
out = open(filename,"wb")
for byte in intList:
data=struct.pack('B', byte)
out.write(data)
out.close()
return
def charScreenBinWriter(filename,charScreen):
out = open(filename,"wb")
for cha... |
import logging
from timeit import default_timer as timer
import numpy as np
import cv2
from opensfm import exif
from opensfm import bow
from opensfm import dataset
from opensfm import features
from opensfm import io
from opensfm import log
from opensfm.context import parallel_map
from opensfm import transformations as... |
"""
The present module performs the optimization of the coefficients of the SOP-FBR
representation of a 2D PES of the shape (V(x, y) = x^2 + y^2 + lambda*xy)
It depends on the Numpy, Tensorly and NLopt packages
"""
import os
import time
import numpy as np
from numpy.polynomial import chebyshev as cheby
import tensorly ... |
# put replies under their main comments
# Get Comment, Reactions, Reaction Counts
# For each comment url, a browser will be opened and the reaction buttion will be clicked.
# After getting the data, the borwser will be closed.
from selenium import webdriver
import time
import re
import collections
import json
import u... |
from queue import Empty
import threading
import cv2
import time
import numpy
import multiprocessing
import os
from datetime import datetime
import logging
import sys
class StreamCamera(object):
def __init__(
self,
logger,
camera_name,
camera_url,
frame_sleep,
width,... |
import sys
from prettytable import PrettyTable
import pandas
import logging
import dbutils
# 定义变量
# USERINFO = ("admin", "123456")
USERINFO = ("a", "a")
FIELDS = ('id', 'username', 'age', 'tel', 'email')
FORMAT = """
====================================================================
2.1 增 add # add mo... |
#
# Copyright 2013-2015 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
import sys, os, pytest
sys.path.append(os.getcwd())
from do_grader_lib import PartQuality
from tsp import grader
with open('tsp/data/tsp_5_1', 'r') as input_data_file:
input_data = input_data_file.read()
quality = PartQuality('test', 5, 4)
greedy_submission = '4.8 0\n0 1 2 4 3\n123\n'
opt_submission = '4.0 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 17-9-22 下午1:39
# @Author : <NAME>
# @Site : http://github.com/TJCVRS
# @File : train_shadownet.py
# @IDE: PyCharm Community Edition
"""
Train shadow net script
"""
import os
import tensorflow as tf
import os.path as ops
import time
import numpy as np
imp... |
#!/usr/bin/env python
import os
import sys
import functools
import time
import btrwin.lib as lib
import btrwin.units as units
def load_config(*a,**k):
cfg=lib.conf.get_config(p=a[0], c=k['c'])
return cfg
def load_env_config(c):
dct={k:os.environ[k] for k in os.environ.keys()}
c.read_dict(dict(dct))
return {'env... |
# torch and visulization
from tqdm import tqdm
import torch.optim as optim
from torch.optim import lr_scheduler
from torchvision import transforms
from torch.utils.data import DataLoader
from model.parse_args_train import parse_args
# metric, loss .etc
from model.utils import *
from... |
from sqlalchemy import Column, Integer, REAL, String
from sqlalchemy.ext.declarative import declarative_base
from flask import json
from app import db, login_manager
from flask_login import UserMixin
from flask import Response
from sqlalchemy import Column, Integer, String, BLOB, REAL
from sqlalchemy.ext.decla... |
import numpy as np
import pandas as pd
import asyncio
from ..workbench.em_framework.ema_distributed import AsyncDistributedEvaluator
from ..workbench.util import get_module_logger
_logger = get_module_logger(__name__)
class AsyncExperimentalDesign:
def __init__(self, model, design, stagger_start=0):
self.model = ... |
# *****************************************************************************
#
# 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... |
from . import utils
import datetime
import glob
import matplotlib
import matplotlib.image
import numpy as np
import os
import requests
import subprocess
import time
import torch.utils.data
def _find_framerate(path):
with open(path, 'r') as f:
for line in f.readlines():
if line.startswith('Fra... |
# -*- coding: utf-8 -*-
"""
NotiHub
Copyright 2017 <NAME> <<EMAIL>>
The following code is licensed under the MIT License
"""
import threading
import NotiHub.services
from NotiHub import l
from NotiHub.services import __stub__
class serviceManger():
class serviceInstant(threading.Thread):
def __init__(s... |
# Copyright 2021 NREL
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distri... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__all__ = ['baidu_download']
from ..common import *
from .embed import *
from .universal import *
def baidu_get_song_data(sid):
data = json.loads(get_html('http://music.baidu.com/data/music/fmlink?songIds=%s' % sid, faker = True))['data']
if data['xcode'] != '':... |
from datetime import datetime
from decimal import Decimal
from aspen import Response
from psycopg2 import IntegrityError
def get_end_of_year_balance(db, participant, year, current_year):
if year == current_year:
return participant.balance
start = participant.claimed_time or participant.ctime
if y... |
import sys
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
# For launching in IDEA
# from task3.k_means import k_means
# prefix = 'task4/'
# For launching from terminal
sys.path.append('../task3/')
prefix = ""
# noinspection PyUnresolvedReferences
from k_means import k_means
image_name = f"{... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 4 18:23:35 2018
This script contains the core for the linear Kramer-Kronig analysis
@author: <NAME> (<EMAIL> / <EMAIL>)
"""
import numpy as np
from lmfit import Parameters
__all__ = ['KK_RC', 'residual_imag', 'residual_real', 'KK_Rnam_val', 'KK_ti... |
# Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
from typing import Type
import pytest
from torch.utils.data import DataLoader
from composer.core import Callback, Engine, Event, State
from composer.loggers import Logger, LoggerDestination
from composer.profiler import Profiler, Profil... |
import re
class DocumentTypeDeclaration(object):
"""Represents a http://en.wikipedia.org/wiki/Document_Type_Declaration
This is used to lookup DTDs details by its string, DTDs can
be registered in :attr:`.by_uri` and can then be looked up
using :meth:`.matching` method:
>>> from kajiki.doctype i... |
"""Command definitions for supported platforms."""
# Third Party
from pydantic import conint, root_validator
# Project
from hyperglass_agent.constants import AGENT_QUERY
from hyperglass_agent.models._utils import HyperglassModel
from hyperglass_agent.nos_utils.bird import get_bird_version
from hyperglass_agent.models... |
import urllib3
import urllib.request
from bs4 import BeautifulSoup
from post import Post
import os
from docx import Document
from docx.shared import Inches
#generates links across full range of dates
def make_links():
"""make full range of dates to use"""
extensions = []
for i in range(1, 9):
for ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from genotypes_rnn import CRBPRIMITIVES, PRIMITIVES, STEPS, CONCAT, Genotype_rnn
from model_rnn import DARTSCell, RNNModel
Genotype = Genotype_rnn
class DARTSCellSearch(DARTSCell):
def __init__(self, ninp, nhi... |
#
# This file is part of usb-protocol.
#
"""
Structures describing Microsoft OS specific functionality descriptors. Versions that support parsing
incomplete binary data are available as `DescriptorType`.Partial, e.g. `DeviceDescriptor.Partial`, and
are collectively available in the `usb_protocol.types.descriptors.parti... |
"""
2020 (c) piteren
some basic / useful decorators
"""
from functools import wraps
from inspect import getfullargspec
import time
from ptools.lipytools.little_methods import get_params, stamp
# decorator printing execution time report
def timing(f):
def new_f(*args, **kwargs):
stime = time.time(... |
#! /usr/bin/env python3
import sys
import os
import argparse
import time
from pynq import PL
from pynq import Overlay
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
from drivers.lightshow import Lightshow
NAME = os.path.basename(os.path.realpath(__file__))
DESCRIPTION = "\n" \
"\... |
import py
from collections import namedtuple
import capnpy
# ============================================================
# Instance storage
# ============================================================
class Instance(object):
class MyStruct(object):
def __init__(self, padding, bool, int8, int16, int32,... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import csv
import os.path
import re
import sys
from collections import defaultdict
from collections import namedtuple
from collections import OrderedDict
__author__ = "<NAME>"
def outerr(*args, **kwargs):
kwargs.setdefault('file', sys.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Dict, Iterator, List, Optional, Union, Literal, Tuple
from collections import defaultdict
from random import Random
from typing import Dict, List, Set, Tuple, Union
from rdkit import Chem
from rdkit.Chem.Scaffolds import MurckoScaffold
from tqdm import tq... |
#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivault import hashiwrapper
import json
ANSIBLE_METADATA = {'status': ['stable... |
##
#######################################################################################################################
#
# Copyright (c) 2017-2018 Advanced Micro Devices, Inc. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associ... |
# dwmPosGet
# Being written September 2019 by <NAME>
# This script is being written to test approach to
# reading TLV (type, length, value) data from an attached
# Decawave DWM 1001 module through the UART TLV interface.
# This script simply calls the dwm_pos_get TLV request
# repeatedly, parses the result, and prints... |
"""
Module that contains the index based hash map based on tuples.
A python tuple is immutable and hashable.
We can't use numpy arrays as index because they are mutable and not hashable.
"""
from typing import (
Any,
Dict,
Tuple,
Iterator,
Sequence,
Generic,
TypeVar,
Callable,
List... |
import logging
from threading import Event, Lock, Thread
from playback.recording import Recording
from playback.tape_cassette import TapeCassette
_logger = logging.getLogger(__name__)
class AsyncRecordOnlyTapeCassette(TapeCassette):
# pylint: disable=too-many-instance-attributes
"""
Wraps TapeCassette wi... |
#!/usr/bin/env python3
import sys
import os
import pythreejs as THREE
import streamlit as st
from streamlit import cli as stcli
import streamlit.components.v1 as components
from ipywidgets import embed
from mesh_factory import MeshFactory
from shapes import *
VISUALIZATION_VIEW_WIDTH = 700
VISUALIZATION_VIEW_HEIGHT ... |
import struct
import numpy as np
from .var_int import get_length_of_varint, parse_varint
def read_short(f):
''' Read a signed 2 byte integer from `f`'''
return struct.unpack('<h', f.read(2))[0]
def read_unsigned_short(f):
''' Read an unsigned 2 byte integer from `f`'''
return struct.unpack('<H', f.r... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
import tensorflow as tf
from functools import partial
from entity_networks.activations import prelu
from entity_networks.dynamic_memory_cell import DynamicMemoryCell
from entity_networks.mo... |
import re
from typing import IO, Iterator, Optional, List, Tuple, Set
from interfaces import ConnectionIDSink
from core import wl
from core.output import Output
from core.util import *
class WlPatterns:
instance = None
def __init__(self) -> None:
int_re = r'(?P<int>-?\d+)'
float_re = r'(?P<fl... |
import numpy as np
import torch
from dataclasses import dataclass
from typing import List
from jiant.tasks.core import (
BaseExample,
BaseTokenizedExample,
BaseDataRow,
BatchMixin,
Task,
TaskTypes,
)
from jiant.tasks.lib.templates.shared import (
labels_to_bimap,
add_cls_token,
crea... |
# Copyright (C) 2009 Google Inc. All rights reserved.
# Copyright (C) 2012 Intel Corporation. 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 th... |
from torch import optim
from .loss_functions import *
from .vision_cnn import *
from .fasttext import *
import torch
import torch.nn as nn
import functools
import numpy as np
from typing import Dict
def get_loss(loss_fn: str):
""" returns: per sample loss """
if loss_fn == 'mse':
return nn.MSELoss()
... |
"""Index analyzer plugin for sigma."""
from __future__ import unicode_literals
import logging
import os
import time
import codecs
import elasticsearch
from sigma.backends import elasticsearch as sigma_elasticsearch
import sigma.configuration as sigma_configuration
from sigma.parser import collection as sigma_collect... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class fullLossFunction(torch.nn.Module):
def __init__(self):
super(fullLossFunction, self).__init__()
def objectloss_func(self,d,label_dot,patch_size):
output_count = count_data(d,patch_size,1)
object_loss... |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function, unicode_literals
import sys
import os
import pcpp
import pyloco
import tempfile
import shutil
class TaskCmdPreprocessor(pcpp.cmd.CmdPreprocessor):
def write(self, oh):
"""work-around for flushing after write"""
... |
from neoload import *
import logging
import sys
import openapi_client
from .Profile import (getCurrentProfile,getProfileFilesUrl)
from openapi_client.rest import ApiException
from openapi_client.models import *
app = None
### to regenerate the API client
# brew install openapi-generator
# openapi-generator gener... |
#!/usr/bin/env python
#coding:utf-8
# Purpose: table objects
# Created: 03.01.2011
# Copyright (C) 2011, <NAME>
# License: MIT
from __future__ import unicode_literals, print_function, division
__author__ = "mozman <<EMAIL>>"
import copy
from .compatibility import is_string
from .xmlns import register_clas... |
import sys
from tensorflow import keras
from keras import backend
from keras import applications
from keras import datasets
from keras import wrappers
from keras_gcn import GraphConv
import numpy as np
from tqdm import tqdm, trange
from myParser import parameter_parser
from utilities import data2, convert_to_... |
"""Useful utilities.
Utility functions that offers general convenience to facilitate live
reloading and tracking of the necessary components. Primarily these
functions are used within xautic, but they can also be used for external
consumption.
"""
import fnmatch
import itertools
import logging
import os
i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Copyright © 2014 - 2021 German Neuroinformatics Node (G-Node)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted under the terms of the BSD License. See
LICENSE file in the root of the Project.
Au... |
from functools import lru_cache
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import ManyToOneRel
from django.utils import timezone
from django.utils.crypto import get_random_string
from django.utils.translation import ugettext_la... |
#!/usr/bin/python3
# coding=utf-8
# -------------------------------------------------------------------------------
# This file is part of Phobos, a Blender Add-On to edit robot models.
# Copyright (C) 2020 University of Bremen & DFKI GmbH Robotics Innovation Center
#
# You should have received a copy of the 3-Clause ... |
# Copyright 2022 Haolin, Chen
#
# 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 la... |
# Time: O(r * c)
# Space: O(r * c)
# We have a grid of 1s and 0s; the 1s in a cell represent bricks.
# A brick will not drop if and
# only if it is directly connected to the top of the grid,
# or at least one of its (4-way) adjacent bricks will not drop.
#
# We will do some erasures sequentially.
# Each time we want ... |
#!/usr/bin/env python3
import io
import json
import logging as log
import os
import sys
import tempfile
import typing
import requests
class FileReference(object):
""" FileReference is created to represent a file reference
inside of a resource parameter.
"@path/to/file" is a reference to a file ... |
#====================== BEGIN GPL LICENSE BLOCK ======================
#
# 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 version 2
# of the License, or (at your option) any later vers... |
import os
import typing as t
from configparser import ConfigParser
from dataclasses import dataclass
from fnmatch import fnmatch
from pathlib import Path
from warnings import warn
try:
import toml
except ImportError: # pragma: no cover
toml = None
# exclude/skip lists from isort+flake8
DEFAULT_EXCLUDE = fr... |
import cv2
import numpy as np
import win32gui, win32ui, win32con, win32api
import time
import pyautogui
import tensorflow as tf
import threading
from object_detection.utils import ops as utils_ops
from object_detection.utils import label_map_util
class ekranlar:
def __init__(self):
self.screen ... |
# encoding: utf-8
"""
Define the telescopes parameters used by Pypit.
"""
from pypeit.par.pypeitpar import TelescopePar
#TODO: Remove 'Par' from class name?
class GTCTelescopePar(TelescopePar):
def __init__(self):
super(GTCTelescopePar, self).__init__(name='GTC',
... |
import numpy as np
import pandas as pd
import csv
import igraph as ig
import plotly.graph_objs as go
import plotly.offline as pyo
def csv2graph(treecsv):
'''
creates igraph object from csv file
'''
G = ig.Graph(directed = True)
#read csv file
with open (treecsv, 'rt') as file:
csvreader... |
import json
import math
from typing import Any, Dict, List, Optional, Union
from ruamel.yaml import YAML
from ruamel.yaml.error import YAMLError
from ansibler.platforms.platform_map import (
parse_platform_map,
map_to_galaxy_supported_platforms,
)
from ansibler.utils.files import create_folder_if_not_exists
d... |
import numpy as np
import pandas as pd
def check_equal_index(X):
"""
Check if all time-series for a given column in a
nested pandas DataFrame have the same index.
Parameters
----------
X : nested pandas DataFrame
Input dataframe with time-series in cells.
Returns
-------
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.