text stringlengths 3.07k 12.6k |
|---|
import numpy
from numpy import linalg
import six
import cupy
from cupy.core import core
from cupy import cuda
from cupy.cuda import cublas
from cupy.cuda import device
from cupy.linalg import decomposition
from cupy.linalg import util
if cuda.cusolver_enabled:
from cupy.cuda import cusolver
def solve(a, b):
... |
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import math
import keras
import sklearn
from keras.models import Sequential, Model
from keras.layers import Lambda
from keras.optimizers import Adam
from keras.layers import Conv2D, Cropping2D, Dropout, Flatten, Dense
from skl... |
# -*- coding: utf-8 -*-
"""Provide class to manage a simulation."""
import smuthi.linear_system as lsys
import smuthi.coordinates as coord
import sys
import os
import matplotlib.pyplot as plt
import pkg_resources
import datetime
import shutil
import pickle
import numpy as np
class Simulation:
"""Central class to... |
"""
ARIA -- Ambiguous Restraints for Iterative Assignment
A software for automated NOE assignment
Version 2.3
Copyright (C) <NAME>, <NAME>, <NAME>,
<NAME>, and <NAME>
All rights reserved.
NO WARRANTY. This software package is provided 'as i... |
import discord
import asyncio
from enum import Enum
import time
class SlashOptions(Enum):
"""Stores the option values for slash commands."""
SUB_COMMAND = 1
SUB_COMMAND_GROUP = 2
STRING = 3
INTEGER = 4 # any integer between -2^53 and 2^53
BOOLEAN = 5
USER = 6
CHANNEL = 7 # any channel ... |
# Copyright (C) 2019 Intel Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
import collections
import board_cfg_lib
PCI_HEADER = r"""
#ifndef PCI_DEVICES_H_
#define PCI_DEVICES_H_
"""
PCI_END_HEADER = r"""
#endif /* PCI_DEVICES_H_ */"""
def get_value_after_str(line, key):
""" Get th... |
import json
import pickle
import numpy as np
import pandas as pd
import torch
from torch import nn
from torch.utils.data import Dataset, DataLoader
from torch.nn.utils.rnn import pad_sequence
from transformers.modeling_bert import (
BertPreTrainedModel,
BertLayer
)
from transformers import Ber... |
import numpy as np
from warnings import warn
import pandas as pd
#############################
# Generic Utilities #
#############################
def chol_mvn(Mu, Sigma):
"""
Sample from a Multivariate Normal given a mean & Covariance matrix, using
cholesky decomposition of the covariance. If th... |
"""Logged-in page routes."""
from typing import List, Any, Tuple
from flask import Blueprint, redirect, render_template, url_for, request, jsonify
from flask_login import current_user, login_required, logout_user
from .forms import *
from .models import Graph, ChunkData, Notebook, Chunk, History, db
from .utils import... |
"""
https://en.wikipedia.org/wiki/Doubly_linked_list
"""
class Node:
def __init__(self, data):
self.data = data
self.previous = None
self.next = None
def __str__(self):
return f"{self.data}"
class DoublyLinkedList:
def __init__(self):
self.head = None
sel... |
# Copyright 2014 <NAME> and <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... |
__version__ = "0.26.2" # Added by Sailboat
import os
import glob
import sys
import json
import blessed
class Plugin:
"""
The basic sailboat Plugin class
"""
name = ""
data = {}
description = "<no description provided>"
version = ""
options = []
setup = {}
_type = "build"
_show ... |
#!/usr/bin/env python3
import logging
import subprocess
import os
import csv
import sys
from github import Github
from env_helper import CACHES_PATH, TEMP_PATH
from pr_info import PRInfo
from s3_helper import S3Helper
from get_robot_token import get_best_robot_token
from upload_result_helper import upload_results
fr... |
# -*- coding:utf-8 -*-
import cv2
import time
import argparse
import numpy as np
from PIL import Image
from keras.models import model_from_json
from MaskDetection.utils.anchor_generator import generate_anchors
from MaskDetection.utils.anchor_decode import decode_bbox
from MaskDetection.utils.nms import single_class_no... |
from enum import IntEnum
from k_road.scan.pathfinder import *
class Pathfinder(object):
pass
class WaypointPathFollower:
class State(IntEnum):
searching_for_path_start = 0,
searching_for_nearest_path = 1,
heading_to_path = 2,
on_path = 3,
extending_path = 4,
def... |
#!/usr/bin/env python
# encoding: utf-8
import sys
import requests
from collections import namedtuple
from time import sleep, mktime, strptime
from datetime import datetime
from random import randrange
from bs4 import BeautifulSoup as BS
#from gi.repository import Notify
import notify2
from argparse import Argument... |
# -*- coding: utf-8 -*-
import pickle
import sys
# SETTINGS
from constants import CLASSIFIERS_FOLDER, SPACY_FOLDER
sys.path.append(SPACY_FOLDER)
from pos_tagger import pos_tag
import feature_extractors
def load_classifier(name):
# Loads the classifier pickle
f = open(CLASSIFIERS_FOLDER + name, 'rb')
clas... |
# Copyright 2018 Alibaba Cloud Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
import torch
from pytorch_pretrained_bert.tokenization import BertTokenizer
import os
import numpy as np
import spacy
import sys; sys.path.append('.')
from shared.data import get_dataloader_from_str
from shared.args import ARGS
from shared.constants import CUDA
import seq2seq.model as seq2seq_model
import seq2seq.u... |
from .basics import ListNode
from collections import UserList
class LinkedListIterator:
"""Iterator used to traverse the lists defined in this module,
can handle both null-terminated and dummy terminated lists"""
def __init__(self, parent_list, start: int = 0):
self.pending = None
if sta... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import anndata
import numpy as np
import pandas as pd
import wot.io
def compute(matrix, gene_sets, out, format, cell_filter=None, background_cell_set=None,
permutations=None, method=None, n_neighbors=None, drop_frequency=None,
... |
"""Mixins for reducing the amount of boilerplate in the main wrapper class."""
from typing import Any, Tuple, Union
import gtwrap.interface_parser as parser
import gtwrap.template_instantiator as instantiator
class CheckMixin:
"""Mixin to provide various checks."""
# Data types that are primitive types
... |
# 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 file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# Testing for a3c/script7
import sys_simulator.general as gen
import os
from sys_simulator.q_learning import rewards
from sys_simulator.parameters.parameters import EnvironmentParameters
from typing import List
import torch
import numpy as np
import pickle
import time
from sys_simulator.q_learning.environments.compl... |
import cv2
import numpy as np
from enum import Enum
import itertools
from .File import *
from .Math import *
class cv_colors(Enum):
RED = (0,0,255)
GREEN = (0,255,0)
BLUE = (255,0,0)
PURPLE = (247,44,200)
ORANGE = (44,162,247)
MINT = (239,255,66)
YELLOW = (2,255,250)
def constraint_to_col... |
# -*- coding: utf-8 -*-
import abc
import numpy as np
ESC = b'\x1b'
GS = b'\x1d'
def u8(x):
if x<0 or x>255:
raise RuntimeError('Number out of range')
return x.to_bytes(1, 'little')
def u8_seq(seq):
out = b''
for x in seq:
out += u8(x)
return out
def u16_to_bytes(num: int):
... |
# Copyright (C) 2019-Present the hostray authors and contributors
#
# This module is part of hostray and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php:
'''
Last Updated: Tuesday, 12th November 2019 by hsky77 (<EMAIL>)
'''
import unittest
import asyncio
from enum import Enum
... |
"""
Creates dataset of SEoEi
Author(s): <NAME> (<EMAIL>)
"""
import os
import numpy as np
from matplotlib import pyplot as plt
#plt.switch_backend('Qt5Agg')
import math
from scipy.interpolate import splev, splprep, interp1d
from scipy.integrate import cumtrapz
import sys
sys.path.append("../")
from utils import visu... |
import pytest
import networkx as nx
from floweaver.ordering import (flatten_bands, unflatten_bands, band_index,
new_node_indices, median_value,
neighbour_positions, fill_unknown, Ordering)
def test_ordering_normalisation():
o1 = Ordering([['a', 'b... |
# encoding: utf-8
import hashlib
from django import forms
from django.db import models
from django.db.models.fields import CharField
from django.utils.text import capfirst
class HashField(models.CharField):
description = ('HashField is related to some other field in a model and'
'stores its ... |
import asyncio
import logging
import random
import time
from datetime import datetime
from typing import Any, Dict, Optional, Tuple
import reddit_adapter
import subscriptions_manager
import telegram_adapter
async def send_subscription_update(subreddit: str, chat_id: int, per_month: int):
# Send top unsent post f... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
#
# 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 file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
from datetime import datetime
from user import User
from flask import Flask, jsonify, request, render_template, url_for
from flask_login import LoginManager
from flask_login.utils import login_required, login_user, logout_user
from werkzeug.utils import redirect
from concurrent.futures import ThreadPoolExecutor
from se... |
#
# Copyright (c), 2016-2020, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author <NAME> <<EMAIL>>
#
"""
A... |
#!/usr/bin/env python3
import os, sys
sys.path.append(os.path.abspath(__file__ + "/../../")) # just so we can use 'libs'
import time
import torch.optim
import torch.utils.data
import torch.optim as optim
import copy
import distiller
import cv2
import numpy as np
from libs.Transfer import Transfer3
from libs.models... |
import json
import logging
import yaml
from kubeflow.testing import ks_util, test_util, util
from kubeflow.tf_operator import test_runner, tf_job_client
from kubeflow.tf_operator import util as tf_operator_util
from kubernetes import client as k8s_client
COMPONENT_NAME = "estimator_runconfig"
def get_runconfig(mast... |
"""
Code that goes along with the Airflow located at:
http://airflow.readthedocs.org/en/latest/tutorial.html
"""
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.python_operator import PythonOperator, BranchPythonOperator
from airflow.operators.dummy_operator impor... |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2015, <NAME>
#
# This module is part of anima-tools and is released under the BSD 2
# License: http://www.opensource.org/licenses/BSD-2-Clause
import shutil
import subprocess
import os
from anima.utils import do_db_setup
import anima
from anima.ui import IS_PYSIDE, IS_PYSID... |
#!/usr/bin/env python
import sys
import string
import time
import socket
import getopt
import logging
from twisted.internet import reactor
from twisted.protocols.basic import LineReceiver
from twisted.internet.protocol import ReconnectingClientFactory
log = logging.getLogger('sequencer')
_device_add = [ 'LSTN', 'CON... |
import os
import time
import uuid
import xmltodict
import ssl
import requests as r
from lxml import etree
from pprint import pprint, pformat
from datetime import datetime, timedelta
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager
from requests.exceptions import SS... |
#!/usr/bin/python2.7
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
import argparse
from joblib import Parallel, delayed
import numpy as np
from skimage.color import rgb2gray
from skimage.transform import hough_line
from skimage import io
from sklearn.utils import shuffle
from sklearn.cluster import KMeans
from sklearn.preprocessing import MinMaxScaler
import matplotlib.pyplot as ... |
from bes import api
from bes.playlist import SpotifyPlaylist, SpotifySavedTracks, YouTubePlayList
from bes.track import SpotifyTrack
class Channel(object):
"""
Abstract Channel class defining the API of object wrapping the concept of a
"Channel" i.e. a YouTube Channel or a Spotify account. A channel has
... |
"""
Type Example
------------
``GreatExpectationsType`` when accompanied with data can be used for data validation.
It essentially is the type we attach to the data we want to validate.
In this example, we'll implement a simple task, followed by Great Expectations data validation on ``FlyteFile``, ``FlyteSchema``, an... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
---------------------------------------------... |
"""
setuptools must be installed first. If you do not have setuptools installed
please download and install it from http://pypi.python.org/pypi/setuptools
"""
import os
import sys
import subprocess
import re
import setuptools
from numpy.distutils.core import setup
import numpy
curdir = os.path.abspath(os.path.dirname... |
from django.db import models
from django.db import IntegrityError
from django.utils.text import slugify
from common.tools import fetch_from_web_api, fetch_from_entrez
from Bio import Entrez, Medline
from string import Template
import urllib.request,json
import logging
import re
class Citation(models.Model):
pub... |
"""
Copyright (c) 2021-2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... |
import logging
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.setup import setup_component
from homeassistant.const import CONF_HOST, CONF_PASSWORD
from homeassistant.helpers.discovery import load_platform
from homeassistant.helpers.entity_component imp... |
import csv
from os import path, unlink
from celery import group
from celery.utils.log import get_task_logger
from flask import current_app
from app import celery
from .utils import (get_s3_file_size, store_scrm_file_s3_content_in_local_file,
stream_s3_file, validate_scrm_file_headers_vi... |
""" Storage caches classes """
import pandas as pd
import conf
class XCacheServer(object):
def __init__(self, size=conf.TB, lwm=0.90, hwm=0.95):
self.size = size
self.lwm_bytes = size * lwm
self.hwm_bytes = size * hwm
self.lwm = lwm
self.hwm = hwm
self.cleanups = ... |
"""
Augmenter that apply operation to textual input based on word embeddings.
"""
from nlpaug.augmenter.word import WordAugmenter
from nlpaug.util import Action
import nlpaug.model.word_embs as nmw
from nlpaug.util.exception.warning import WarningMessage
WORD_EMBS_MODELS = {}
model_types = ['word2vec', 'glove', ... |
"""
Download files with DownloadData.
"""
import logging
from os import PathLike, makedirs, remove, stat
from os.path import isfile
from typing import Tuple, List
from pySmartDL import SmartDL, utils
from animethemes_dl.options import OPTIONS, setOptions
from .errors import BadThemesUrl
from .models import DownloadD... |
import unittest
from rope.base.oi import objectdb, memorydb
from ropetest import testutils
def _do_for_all_dbs(function):
def called(self):
for db in self.dbs:
function(self, db)
return called
class _MockValidation(object):
def is_value_valid(self, value):
return value != -... |
import torch.nn as nn
import torch
import torch.nn.functional as F
def conv(in_planes, out_planes, kernel_size=3, stride=1, padding=1, dilation=1):
return nn.Sequential(
nn.Conv2d(in_planes, out_planes, kernel_size=kernel_size, stride=stride,
padding=padding, dilation=dilation, b... |
import time, threading, sys
from coldtype.renderer.config import ColdtypeConfig
from coldtype.renderer.winman.passthrough import WinmanPassthrough
from coldtype.renderer.winman.glfwskia import glfw, skia, WinmanGLFWSkia, WinmanGLFWSkiaBackground
from coldtype.renderer.winman.midi import MIDIWatcher, rtmidi
from coldty... |
import numpy as np
import multiprocessing as mp
import pandas as pd
import astropy.io.fits as afits
from collections import OrderedDict
from astrorapid.process_light_curves import InputLightCurve
class GetData(object):
def __init__(self):
""" Get light curves. """
self.phot_fields = ['MJD', 'FLT... |
"""
Response functions and CFProjection response functions (see projfn.py) written
in C to optimize performance.
Requires the weave package; without it unoptimized versions are used.
"""
import param
from topo.base.functionfamily import ResponseFn,DotProduct
from topo.base.cf import CFPResponseFn, CFPRF_Plugin
from ... |
#!/usr/bin/env python2.7
""" This script runs a small number of unit tests. """
# Copyright 2015 Mayer Analytics Ltd.
#
# This file is part of pySX127x.
#
# pySX127x is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public
# License as published by the Free Software ... |
from . import config
import os
import nacl
from nacl.public import PrivateKey
from nacl.signing import SigningKey, VerifyKey
from nacl.encoding import Base64Encoder, HexEncoder
import nacl.bindings as sodium
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from cryptography.hazmat.primitives.asymmetri... |
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
# the next line can be removed after installation
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))))
from veriloggen import *
def mkLed():
... |
#!/usr/bin/env python
import wx
import wx.gizmos as gizmos
import wx.stc as stc
#----------------------------------------------------------------------
# This is an example of the complex view that manages its own scrollbars
# as described in the overview below.
class TestView(stc.StyledTextCtrl):
def __init__(... |
import settings
from collections import OrderedDict
from django.apps import apps
from django import forms
from search.views import get_param_info_by_slug, is_single_column_range
from paraminfo.models import ParamInfo
from tools.app_utils import (get_mult_name,
get_numeric_suffix,
... |
"""Audience trigger models"""
from datetime import datetime
from emma import exceptions as ex
from emma.model import BaseApiModel, str_fields_to_datetime
import emma.model.mailing
class Trigger(BaseApiModel):
"""
Encapsulates operations for a :class:`Trigger`
:param account: The Account which owns this ... |
#
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Appier Framework
# Copyright (c) 2008-2016 Hive Solutions Lda.
#
# This file is part of Hive Appier Framework.
#
# Hive Appier Framework is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apach... |
import sys
import argparse
import cv2
from libfaceid.detector import FaceDetectorModels, FaceDetector
from libfaceid.encoder import FaceEncoderModels, FaceEncoder
from libfaceid.pose import FacePoseEstimatorModels, FacePoseEstimator
from libfaceid.age import FaceAgeEstimatorModels, FaceAgeEstimator
from libfaceid.gend... |
import numpy as np
import gym
from gym import spaces
from random import random
from tensorforce.environments import Environment
from tensorforce.agents import Agent
from tensorforce.execution import Runner
from heapq import nlargest
def stdDeviaiton(array):
cleanedUp = np.array([])
for elem in array:
... |
# from collections import defaultdict
from django.shortcuts import redirect
from django.contrib.auth.decorators import (
permission_required,
user_passes_test,
login_required,
REDIRECT_FIELD_NAME
)
from django.core.context_processors import csrf
from django.forms import ModelChoiceField, IntegerField
f... |
# ----------------------------------------------------------------------------
# Copyright 2015-2016 Nervana Systems 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.apa... |
import os
import re
from shutil import (
rmtree,
)
from fabric.api import (
cd,
env,
lcd,
local,
run,
)
from shell_command import ShellCommand
from utils import TemporaryFile, check_env_attr, download, escape_string, replace_local_wp
def check_env():
"""
fabric.api.env 에 원하는 초기값이 다 들... |
# -*- coding: utf-8 -*-
'''
Manage DNS records and zones using libcloud
:codeauthor: :email:`<NAME> <<EMAIL>>`
.. versionadded:: Carbon
Create and delete DNS records or zones through Libcloud. Libcloud's DNS system supports over 20 DNS
providers including Amazon, Google, GoDaddy, Softlayer
This module uses ``li... |
from pathlib import Path
import os
import logging
import pickle
from .. import data
from .. import tools
from .. import events
from .. import generalized_matched_filter
from .commands import add_command
logger = logging.getLogger(__name__)
try:
from mpi4py import MPI
comm = MPI.COMM_WORLD
exc... |
import json
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any, Optional, Union
from functools import partial
from collections import defaultdict
from random import choice
import arrow
from .probability_tree import ProbabilityNode
from .utils import (get_banners_info, get_operators_in... |
from __future__ import print_function
import cgi
import inspect
import os
import textwrap
from StringIO import StringIO
import jinja2
from ..argparse14 import RawTextHelpFormatter
from gettext import gettext as _
from commcare_cloud.commands.command_base import CommandBase
from commcare_cloud.commcare_cloud import ... |
import re
import simplejson
import datetime
import urllib2
from BeautifulSoup import BeautifulSoup
from goscale import models as goscale_models
from goscale import utils
from goscale import conf
from django.db import models
from django.db.models import signals
from django.utils.translation import ugettext as _
RATIO... |
from utils import httpConnect,httpPost, filenameparser
from config import Config
from downloaders import downloaders
import re, random
class biliVideo():
name = "video"
pattern = r"av[0-9]+"
videoUrl = "https://www.bilibili.com/video/av%s"
pagesApi = "https://www.bilibili.com/widget/getPageList?aid=... |
import errno
import os
import io
import time
from unittest.mock import patch
import pytest
from ..remote import SleepingBandwidthLimiter, RepositoryCache, cache_if_remote
from ..repository import Repository
from ..crypto.key import PlaintextKey
from ..compress import CompressionSpec
from ..helpers import IntegrityErr... |
# pylint: disable=W0221
# pylint: disable=R0903
# pylint: disable=R1704
"""Module for converting PredPatt objects to networkx digraphs"""
from os.path import basename, splitext
from typing import Tuple, Hashable, TextIO, Optional, Union
from networkx import DiGraph
from predpatt import load_conllu, PredPatt, PredPattO... |
from django.db import models
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.dispatch import receiver
from django.db.models.signals import post_save
from accounts.models import CustomUser
from PIL import Image
from io import BytesIO
from channels.layers import get_channel_layer
from asgi... |
import numpy as np
from sklearn.base import BaseEstimator
from divik.core import build, configurable
from ._gmm_selector import GMMSelector
from ._outlier import OutlierSelector
from ._percentage_selector import PercentageSelector
from ._stat_selector_mixin import NoSelector, SelectorMixin
@configurable
class HighA... |
import datetime
import re
from typing import Any, List, Dict, Tuple, Union
# test data
test_data_s: str = """[1518-11-01 00:00] Guard #10 begins shift
[1518-11-01 00:05] falls asleep
[1518-11-01 00:25] wakes up
[1518-11-01 00:30] falls asleep
[1518-11-01 00:55] wakes up
[1518-11-01 23:58] Guard #99 begins shift
[1518... |
"""
REQUIREMENTS:
- pyserial
- tqdm
conda install -c anaconda pyserial
"""
# --- imports ---
import sys
from time import sleep
from datetime import datetime
from pathlib import Path
# from tqdm import tqdm # for progress bar
from tqdm import trange # for progress bar
import logging # library for advanced print
imp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
import setuptools
from distutils.errors import DistutilsError
from numpy.distutils.core import setup, Extension, build_ext, build_src
from distutils.sysconfig import get_config_var, get_config_vars
import versioneer
import os, sys
import subprocess... |
import os
import sys
import tensorflow as tf
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(BASE_DIR, 'models'))
sys.path.append(os.path.join(BASE_DIR, 'tf_utils'))
import tf_util
from pointSIFT_util import pointSIFT_module, pointSIFT_res_module, pointnet_s... |
# Copyright (c) maiot GmbH 2020. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
#
# pyzmail/utils.py
# (c) <NAME> <<EMAIL>>
# http://www.magiksys.net/pyzmail
# Released under LGPL
"""
Various functions used by other modules
@var invalid_chars_in_filename: a mix of characters not permitted in most used filesystems
@var invalid_windows_name: a list of unauthorized filenames under Windows
"""
impor... |
#!/usr/bin/env python3 -B
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
""" Usage: python make_opcode_doc.py
This script generates SpiderMonkey bytecode documen... |
import numpy as np
import random
import sys
import time
from TicTacToeView import TicTacToeView
from TicTacToeModel import TicTacToeModel
from stubView import stubView
BLUE = (0, 0, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
WHITE = (255, 255, 255)
needToWinGLOBAL = 0
class TicTacToe:
def __in... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import hashlib
import io
import logging
import os
import random
import json
from lxml import etree
import PIL.Image
import tensorflow.compat.v1 as tf
from object_detection.utils import dataset_util
from objec... |
#
# Copyright (c) 2015, <NAME>
# All rights reserved.
#
import numpy as np
from triangulum.utils import aabb
from triangulum.third_party import transformations
def norm2(a):
return (a * a).sum(-1)
def norm(a):
return np.sqrt(norm2(a))
def normalize(a):
return a / norm(a)
def homogenize(a, w=1.0):
... |
#!/usr/bin/env python
"""
Rate Limiting for RED, the Resource Expert Droid.
"""
from collections import defaultdict
from configparser import SectionProxy
from typing import Dict, Set, Union, Callable, TYPE_CHECKING
from urllib.parse import urlsplit
import thor.loop
if TYPE_CHECKING:
from redbot.webui import Red... |
from __future__ import absolute_import
import argparse
import os
from os.path import splitext
import subprocess
import errno
import logging
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions, SetupOptions
from sciencebeam.beam_utils.fileio import ReadFileNamesAndContent, Writ... |
"""Module for managing NetWatch data.
This module loads, saves, and allows thread-safe access
and manipulation of NetWatch updates and alerts.
Attributes:
PARENT_DIR (Path): File path for NetWatch parent directory.
UPDATES_FILENAME (Path): File path for NetWatch Updates.
ALERTS_FILENAME (Path): File path ... |
import random
import json
import keyboard
import threading
import time
import os
os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "1"
if True: # 防止代码格式化时被排到 environ 赋值前
import pygame
# data.json 的内容
saveKey = {"volume", "loadList",
"playing", "hotkey", "initialize", "finish"}
# 命令行重定向
cmdRedirects = {
"... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import logging
import os
from multiprocessing import Process, Queue, Event, Lock
from .task_functions import create_process_task, create_process_task_gpu, task_executor_fn, task_executor_gpu_fn
from ..core.con... |
import os.path
import numpy as np
import pandas
import pickle
import requests
import ast
import typing
from json import JSONDecoder
from typing import List
import sys
from punk.feature_selection import RFFeatures
from d3m.primitive_interfaces.transformer import TransformerPrimitiveBase
from d3m.primitive_interfaces.bas... |
####Isso eh importante para evitar confusoes sobre variaveis locais
import threading
import time
import sys
from Config import *
####Definida a classe que representa 1 processo.
##Ele compreende o cabecalho que o SO leh
##Tambem compreende o codigo do software que esta executando
class Processo(threading.Thread):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.