text stringlengths 3.07k 12.6k |
|---|
import io
import os
import re
import time
from datetime import date, datetime
from typing import Any, Dict, List, Optional, Union
def pretty_size(size: Union[int, float]) -> str:
"""
Converts a size in bytes to its string representation (e.g. 1024 -> 1KiB)
:param size: Size in bytes
"""
size = flo... |
'''
Stacked denoising autoencoder model, built with Tensorflow and trained on
the MNIST dataset. Follows the same methodology as the Theano tutorial but
it does not perform greedy layer-wise pretraining. This is mainly due to
the graph architecture of Tensorflow that displays certain difficulties on
that end.
'''
from ... |
import math
import random
from sqlite3 import Error
import discord
from discord.ext import commands, tasks
from helper.sql import SQLFunctions
from discord.ext.commands.cooldowns import BucketType
def xpfier(n):
return round((n/0.0002725)**1.15)
def levefier(xp):
return math.floor(xp**(1/1.15) * 0.0002725)
... |
#
# 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
# ... |
from collections import defaultdict
from datetime import date
from dateutil.relativedelta import relativedelta
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import Sum
from django.shortcuts import redirect, render
from django.urls import reverse, reverse_lazy
from django.views import... |
import logging
from tool_shed.util import common_util, hg_util, shed_util_common as suc
log = logging.getLogger( __name__ )
def get_latest_changeset_revision( app, repository, repo ):
repository_tip = repository.tip( app )
repository_metadata = suc.get_repository_metadata_by_changeset_revision( app,
... |
#!/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
from hvac.exceptions import InvalidPath
ANSIBLE_... |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import logging
from collections import OrderedDict
import re
import six
from .ds2 import DS2Variable
from ..decorators import versionchanged
if six.PY2:
# ... |
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module that handles tee-ing output to a file."""
import errno
import fcntl
import os
import multiprocessing
import select
import signal
import sub... |
#! /usr/bin/env python2
#
# This file is part of khmer, http://github.com/ged-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2014. It is licensed under
# the three-clause BSD license; see doc/LICENSE.txt.
# Contact: <EMAIL>
# pylint: disable=missing-docstring,invalid-name
"""
Build a counting Bloom ... |
import os
from peewee import *
from NavigationDB.Marker.MarkerDB import Marker
def MarkerAdd():
'''
# Помощь для генерации маркеров
for id, val in enumerate([(490, 900), (700, 900), (450, 1158), (767, 1158), (790, 1573), (767, 1884), (975, 1900), (1100, 1792), (1100, 1594), (1100, 1490), (1050, 1370),
... |
"""Create your bulk_sched forms here."""
import datetime
from dateutil.relativedelta import relativedelta
from django import forms
from django.templatetags.static import static
class BulkSchedCreateForm(forms.Form):
"""Form for bulk_sched."""
error_css_class = "is-invalid"
required_css_class = "required... |
from PySide2.QtGui import QColor
from PySide2.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QListWidget, QListView, QStackedWidget, QWidget, \
QGroupBox, QLabel, QCheckBox, QPushButton, QLineEdit, QListWidgetItem, QScrollArea, QFrame, QComboBox, QSizePolicy
from PySide2.QtCore import QSize
from ..widgets.qco... |
# bot.py
import os
import asyncio
import logging
import logging.handlers
from dotenv import load_dotenv
import discord
from discord.ext import commands
import utils
# Establish Project Directories
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ASSETS_DIR = os.path.join(BASE_DIR, 'assets')
L... |
"""Compute pairwise distances between nodes in Neo4J database.
Neo4j cheatsheet:
* List all nodes:
MATCH (n) RETURN n, properties(n)
* Delete all nodes and relationships:
MATCH (n) DETACH DELETE n
* Delete only relationships:
MATCH ()-[r]->() DELETE r
"""
import sys
import numpy... |
# Copyright 2021 MosaicML. All Rights Reserved.
"""Utility and helper functions for datasets."""
import logging
import textwrap
from typing import Callable, List, Tuple, Union
import numpy as np
import torch
from PIL import Image
from torchvision import transforms
from torchvision.datasets import VisionDataset
from... |
from flask import Flask, render_template, request
import plotly
import plotly.graph_objs as go
import plotly.express as px
import json
import io
import base64
import sys
import os
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# sys.path.append('/Desktop/myproject')
from ma... |
from pettingzoo import AECEnv
from pettingzoo.utils.agent_selector import agent_selector
from gym import spaces
import rlcard
import random
import numpy as np
from pettingzoo.utils import wrappers
def env(**kwargs):
env = raw_env(**kwargs)
env = wrappers.CaptureStdoutWrapper(env)
env = wrappers.TerminateI... |
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2016 <NAME>
#
# 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, modif... |
import struct
import sys
from pathlib import Path
import zmq
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QLineEdit
from PyQt5.QtWidgets import QListWidget
from PyQt5.QtWidgets import QSlider
from PyQt5.QtWidgets import QSplitter
from PyQt5.QtWidgets import QStatusBar
from PyQt5.QtW... |
from tkinter import *
from PIL import ImageTk, Image
from src.scripts.resourceLoader import resource_path
from cv2 import *
from tkinter import messagebox
from src.scripts.Detector import face_detector
from src.scripts.Estimator import focal_length_calculator, distance_calculator
from src.screens.Eyetesting.EyePower.Ro... |
# MIT License
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
#
# 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, me... |
import copy
from aerosandbox import *
opti = cas.Opti() # Initialize an analysis/optimization environment
# Here's how you can make design variables:
def variable(init_val, lb=None, ub=None):
"""
Initialize a scalar design variable.
:param init_val: Initial guess
:param lb: Optional lower bound
... |
import mock
import pytest
import unittest
from svcm import exceptions
from svcm.nssm import WinSvcManagerNSSM
CONF_STUB = {
'service': {
'description': 'the_description',
'displayname': 'the_displayname',
'name': 'the_name',
'application': 'the_application',
'appdirectory':... |
from flask import Flask, current_app, jsonify
from json import JSONEncoder
from flask_login import current_user
from sqlalchemy.exc import IntegrityError
import json, sys, os, traceback, time, requests, datetime
#from datetime import timedelta, datetime
#from flask_bcrypt import generate_password_hash, check_password_h... |
import fire
import numpy as np
import pandas as pd
from data import DATASETS, get_dataset_names
TAGS = ["original", "numerical", "numerical-binsensitive", "categorical-binsensitive"]
TRAINING_PERCENT = 2.0 / 3.0
class ProcessedData():
def __init__(self, data_obj):
self.data = data_obj
self.dfs =... |
import os
import sys
import json
import collections
from datetime import datetime
from alfred.utils import eval_util
def compute_metrics(subgoal_success, subgoal_idx, reward, task, t_agent):
'''
compute metrics for subgoal evaluation
'''
pl = float(t_agent) + 1 # +1 for last action
expert_pl = l... |
import sys
import time
import logging
import multiprocessing
import grpc
import concurrent.futures as futures
import service.common
from service.time_series_forecast import Forecast
# Importing the generated codes from buildproto.sh
import service.service_spec.time_series_forecast_pb2_grpc as grpc_bt_grpc
from serv... |
# Copyright (c) 2011-2020 <NAME>
#
# 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, publish, distrib... |
# -*- coding: utf-8 -*-
"""Api lib for simple life."""
import os
import json
import requests
import time
import uuid
from urllib.request import urlopen
mac_address = uuid.UUID(int=uuid.getnode()).hex[-12:]
def nlu_tuling(question, loc="上海"):
"""图灵 API
"""
url = 'http://www.tuling123.com/openapi/api'
... |
import argparse
import logging
import pygame
import random
import config
import board
import player
class Text(object):
def __init__(self, text, position, **kwargs):
font_name = kwargs.get('font', 'freesansbold.ttf')
font_size = kwargs.get('size', 32)
self.font = pygame.font.Font(font_nam... |
"""Some pens that are needed during glyph math"""
from robofab.pens.pointPen import BasePointToSegmentPen, AbstractPointPen
class GetMathDataPointPen(AbstractPointPen):
"""
Point pen that converts all "line" segments into
curve segments containing two off curve points.
"""
def __init__(self):
self.contou... |
import atexit
import logging
from logging.config import dictConfig
import os
import sys
import time
import click
import docker
from .bitcoind import (BitcoindDockerController,
fetch_wallet_addresses_for_mining)
from .helpers import load_jsons, which
from .server import DATA_FOLDER, create_app,... |
import tempfile
import os
import coremltools
import tensorflow as tf
import PIL.Image
import skimage.transform
import skimage.filters
import numpy
from tensorflow.python.platform import gfile
from image_segmentation import data_generator
import image_segmentation
import requests
from io import BytesIO
class ModelPar... |
# Owner(s): ["module: nestedtensor"]
import torch
import unittest
from torch.testing._internal.common_utils import TestCase, IS_FBCODE
from torch import nested_tensor
# Tests are ported from pytorch/nestedtensor.
# This makes porting as_nested_tensor easier in the future.
def _iter_constructors():
# yield as_nest... |
#####################################################
# Content-Aware Detection of Timestamp Manipulation #
# IEEE Trans. on Information Forensics and Security #
# <NAME>, <NAME>, <NAME>, #
# <NAME>, <NAME>, <NAME> #
#####################################################
##### DESCRIPTIO... |
import torch
import torch.nn as nn
import sys
sys.path.append(r'../input/timmyy/pytorch-image-models-master')
import timm
import numpy as np
from torch.utils.data import Dataset, DataLoader
import torch.optim as optim
import pandas as pd
import matplotlib.pyplot as plt
import os
import cv2
from sklearn.model_selection ... |
"""EmailRepIO Integration for Cortex XSOAR"""
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import urllib3
import traceback
from typing import Any, Dict, List, Optional
# Disable insecure warnings
urllib3.disable_warnings()
''' CONSTANTS '''
ACCEPTED_TAGS = ['... |
from __future__ import division
import numpy as np
import pandas as pd
from glob import glob
from astropy.io import fits
import matplotlib.pyplot as plt
plt.rcParams['xtick.direction'] = 'in'
plt.rcParams['ytick.direction'] = 'in'
plt.rcParams['axes.spines.right'] = False
plt.rcParams['axes.spines.top'] = False
plt.rc... |
from datetime import datetime
import re
from typing import Any, Dict, List, Optional
from shapely.geometry import mapping, Polygon
import pystac
from pystac.utils import str_to_datetime
from stactools.core.io import ReadHrefModifier
from stactools.core.io.xml import XmlElement
from stactools.core.utils import map_opt... |
import pandas as pd
import torch
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import numpy as np
# extract data from csv files
def data_preprocessing(data_path, device='cpu'):
# train_dataset
train_validation_test = ['train', 'validation', 'test']
X, y = ... |
import os
import numpy as np
import nibabel as nib
import re
import gzip
import cv2
# Directory where the .nii files are located.
train_data_dir = r"data\Training_Batch2"
# Directory where the preprocessed data will be stored.
output_dir = r"data\Training_Batch2\preprocessed"
def preprocess_labels():
# Converts... |
import sys
import uuid
from xrt_binding import * # found in PYTHONPATH
from ert_binding import * # found in PYTHONPATH
sys.path.append('../') # utils_binding.py
from utils_binding import *
XHELLO_HELLO_CONTROL_ADDR_AP_CTRL = 0x00
XHELLO_HELLO_CONTROL_ADDR_GIE = 0x04
XHELLO_HELLO_CONTROL_ADDR_IER = 0x08
XHELLO_HELLO_CO... |
import math
from itertools import combinations
import numpy as np
from pykdtree.kdtree import KDTree
from src import districts
from src.novelty_utils import edges_histograms, centers_histograms, dist_centers
from src.constraints import fix_pop_equality
class NoveltyArchive(object):
def __init__(self, state, n_dist... |
import builtins
import datetime
from files_sdk.api import Api
from files_sdk.list_obj import ListObj
from files_sdk.exceptions import InvalidParameterError, MissingParameterError, NotImplementedError
class InboxRecipient:
default_attributes = {
'company': None, # string - The recipient's company.
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME>
# License: MIT
__all__ = ["colors", "pause", "plot", "plot_subdomains"]
import copy
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from dolfin.common.plotting import mesh2triang
from matplotlib.colors import LinearSegmentedColormap
... |
"""
LabJack UDP Broadcast Script - Object-Oriented V0.3.1
Code by <NAME> and <NAME>, referencing code from LabJack Corporation
Creates LabJack class to instantiate a LabJack object for broadcasting. This script can be imported to another for use
as a module. The class has a number of methods that can be called in thi... |
# Data Parallel Control (dpctl)
#
# Copyright 2020-2021 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.... |
from tensorflow.examples.tutorials.mnist import input_data
from rebar_tf import *
import tensorflow as tf
import numpy as np
import os
def encoder(x):
if len(gs(x)) > 2:
p = np.prod(gs(x)[1:])
x = tf.reshape(x, [-1, p])
h1 = tf.layers.dense(2. * x - 1., 200, tf.nn.relu, name="encoder_1")
h2 ... |
#!/usr/bin/env python
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# 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 limitat... |
import copy
import time
from abc import ABCMeta, abstractmethod
from enum import Enum
from logging import getLogger
from threading import Thread, Condition, Semaphore
from typing import *
__all__ = [
'merge_doc_fields', 'RemoteUpdateMode', 'RemoteDoc',
]
DocumentType = Dict[str, Any]
def merge_doc_fields(target... |
#! /usr/bin/env python
# standard library imports
import argparse
import textwrap
import sys # NOQA importing sys so I can mock sys.argv in tests
from pandashells.lib import module_checker_lib, arg_lib
module_checker_lib.check_for_modules(['pandas'])
from pandashells.lib import io_lib
import pandas as pd
import n... |
import collections
import itertools
from blaze.action import Action, ActionSpace, Policy
from blaze.config.environment import Resource
from tests.mocks.config import get_push_groups
def get_action_space():
action_space = ActionSpace(get_push_groups())
action_space.seed(4096)
return action_space
class ... |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright SAS Institute
#
# 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 b... |
from pokemon import *
class playerDataDAO(object):
__metaclass__ = Singleton
def getPlayerData(self, username): # read data from <username>.json file, returns dictionary of pokemon objects
playerPokeBag = json.loads(open(getPlayerDataJSON_path(username)).read())
pokeDict = {}
fo... |
# Copyright 2017-2022 RStudio, PBC
#
# 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... |
import os
import sys
import pandas as pd
from pyts.image import MarkovTransitionField, GramianAngularField
from multiprocessing import Pool, cpu_count
from image_concat import concat_images
def extract_period(df, column, index, period=10, reversed=True):
"""Extracts a period of data from the dataframe column at t... |
import ujson as json
import os
import threading
import numpy as np
from .hammingdb import HammingDb
from zounds.persistence import TimeSliceEncoder, TimeSliceDecoder
from zounds.timeseries import ConstantRateTimeSeries
from zounds.timeseries import TimeSlice
class SearchResults(object):
def __init__(self, query, ... |
import torch
import numpy as np
import torch.utils.data
from lib.add_window import Add_Window_Horizon
from lib.load_dataset import load_st_dataset
from lib.normalization import NScaler, MinMax01Scaler, MinMax11Scaler, StandardScaler, ColumnMinMaxScaler
def normalize_dataset(data, normalizer, column_wise=False):
if... |
import pandas as pd
from datetime import datetime
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from sqlalchemy import create_engine
import os
user=os.getenv('MYSQL_user')
pw=os.getenv('MYSQL')
str_sql = 'mysql+mysqlconnector://' + user + ':' + pw + '@localhost'
m_engine = create... |
import re
import os
from typing import TextIO, List, Tuple, Optional, Dict
# name, default value, description
Entity = Tuple[str, str, str]
# https://regex101.com/r/R6iogw/12
cmake_option_regex: str = r"^\s*option\s*\(([A-Z_0-9${}]+)\s*(?:\"((?:.|\n)*?)\")?\s*(.*)?\).*$"
ch_master_url: str = "https://github.com/clic... |
""" AVL 树实现
"""
from bintree import BinTNode # , print_BiTNodes
# from stack_list import *
from assoc import Assoc
from dict_bitree import DictBinTree
class AVLNode(BinTNode):
def __init__(self, data):
BinTNode.__init__(self, data)
self.bf = 0
class DictAVL(DictBinTree)... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 24 23:16:51 2016
@author: <NAME>
"""
import glob
import os
import socket
import time
from multiprocessing import Pool
# ==============================================================================
# IMPORTS
# ============================================================... |
import cv2
import numpy as np
#Callback functions to draw on image
drawing = False # true if mouse is pressed
mode = True # if True, draw rectangle. Press 'm' to toggle to curve
ix,iy = -1,-1
drawing = False # true if mouse is pressed
mode = True # if True, draw rectangle. Press 'm' to toggle to curve
ix,iy = -1,-1
... |
from numba import cuda
import numpy as np
from math import tan, sqrt
KB = None
PX_KB = None
SECTOR_LEN = None
NUM_SECTOR = None
FLT_EPSILON = 0.000001
# ppx, ppy, fx, fy, coeffs[0...3]
PPX = 0.0
PPY = 0.0
FX = 0.0
FY = 0.0
#COEFFS = [0.0, 0.0, 0.0, 0.0]
def configure(kb, num_sector, intrinsics=None):
global KB, PX... |
import os
import cv2
import numpy as np
from statistics import mean
BASE_DIR = os.path.dirname(__file__)
SYMBOL_DIR = os.path.join(BASE_DIR, "SymbolsNew")
CHALLENGE_DIR = os.path.join(BASE_DIR, "Challenge")
SYMBOL_PREFX = "Slide"
def show_result(img_t, img_c, name, kp_t, kp_c, matches, good_matches):
src_pts = np... |
# Copyright 2018 ICON Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
import json
import os
import threading
import unittest
from http.server import BaseHTTPRequestHandler, HTTPServer
from test.support import EnvironmentVarGuard
from urllib.parse import urlparse
from kaggle_web_client import (KaggleWebClient,
_KAGGLE_URL_BASE_ENV_VAR_NAME,
... |
from decimal import Decimal
from core import models
from core.serializers import SimpleUserSerializer
from django.core.exceptions import ValidationError
from django.db import transaction
from rest_framework import serializers
from rest_framework.fields import ReadOnlyField
from rest_framework.relations import Hyperlin... |
# -*- coding: ascii -*-
import os
from subprocess import Popen
from subprocess import PIPE
from subprocess import STDOUT
from funtoo.boot.extension import Extension
def getExtension(config):
return LILOExtension(config)
class LILOExtension(Extension):
def __init__(self,config):
Extension.__init__(self,config... |
"""Tools for displaying tool-tips.
This includes:
* an abstract base-class for different kinds of tooltips
* a simple text-only Tooltip class
"""
from tkinter import *
class TooltipBase(object):
"""abstract base class for tooltips"""
def __init__(self, anchor_widget):
"""Create a tool... |
# -*- coding: utf-8 -*-
"""
Created on Sat May 4 19:06:35 2019
@author: <NAME>
"""
import sys
import pickle
import re
from portfolio import build_index, check_for_real_ticker
from utils import yes_no_prompt, parse_tickers, parse_input
HELP_FUNC = {'build' : 'Build Index from input ticker symbols',
'ex... |
#!/usr/bin/env python
import sys
import os
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
from settings.unixSettings import UnixSettings
import rhgamestationFiles
import utils.slugify as slugify
libretroSettings = UnixSettings(rhgamestationFiles.retroarchCustom, separator=' '... |
from flask_security import current_user
from flask_socketio import emit
from sqlalchemy.sql.expression import func
from classes.shared import db, socketio
from classes import Channel
from classes import webhook
from classes import settings
from classes import topics
from classes import RecordedVideo
from functions im... |
from flask import Flask,render_template, url_for, flash, redirect, request, abort
from .forms import RegistrationForm, LoginForm, UpdateProfile, PitchForm, CommentsForm
from . import main
from ..models import User,db, Pitch, Category, Comment
from flask_login import login_required, login_user , current_user, logout_use... |
"""
<NAME>, Jan 20
"""
import argparse
import logging
import json
import requests
from io import TextIOWrapper
from csv import DictReader
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.io.gcp.gcsio import GcsIO
from apache_beam.io import WriteToBigQuery
... |
import ugfx, time, badge, machine, deepsleep, gc
import appglue, virtualtimers
import easydraw, easywifi, easyrtc
import tasks.powermanagement as pm
import tasks.otacheck as otac
import tasks.services as services
import term, term_menu
# Graphics
def disobeyLogo(x,y):
badge.eink_png(x,y,b'\x89PNG\r\n\x1a\n\x00\x00\... |
'''
MIT License
Copyright (c) [2020] [<NAME>]
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, publish, di... |
import math
import random
import secrets
import sys
from threading import Event, Timer
from numbers import Number
from fido2.ctap2 import ES256, AttestedCredentialData, PinProtocolV1
from fido2.utils import hmac_sha256, sha256
if 'trezor' in sys.argv:
from .vendor.trezor.utils import DeviceSelectCredential
else:
... |
""" Python module for doing feature extraction in parallel over segments """
from __future__ import absolute_import
import os.path
import csv
import multiprocessing
import random
from ..datasets import fileutils
from ..datasets import segment as sg
def extract(feature_folder,
extractor_function,
... |
#!/usr/bin/env python
# nwscan 0.3
# author: <NAME>
# email: <EMAIL>
# date: 20190109
import subprocess
import sys
import optparse
from multiprocessing.pool import ThreadPool
import ipaddr
from socket import inet_aton
version = '0.3'
# Parse and validate arguments
def get_parsed_args():
usage = 'usage: %prog ... |
from collections import defaultdict
from functools import wraps
import time
import pydot
from pywmi.engines.xsdd import FactorizedXsddEngine as FXSDD
from pywmi.engines.xsdd.engine_factorized import FactorizedIntegrator
from pywmi.engines.xsdd.draw import sdd_to_dot, SddToDot, walk
from _pywmi.vtree.int_tree import... |
import numpy as np
from falass import readwrite, dataformat
import os
class Job():
"""The catch all.
This class is used for setting up the falass job -- and is generally a catch all for inputs that do not fit into
other parts.
Parameters
----------
files: falass.readwrite.Files
A Fil... |
import shutil
import pandas as pd
import pytest
from ramp_utils import read_config
from ramp_utils.testing import database_config_template
from ramp_utils.testing import ramp_config_template
from ramp_database.utils import check_password
from ramp_database.utils import setup_db
from ramp_database.utils import sessio... |
#!/usr/bin/env python3
"""Produces plots of statistics of a run.
Figures are saved in a seperate directory within the run directory, and by
default they are shown.
"""
import argparse
from pathlib import Path
from sys import argv
import numpy as np
from matplotlib import pyplot as plt
import dns
def main():
p... |
#!/usr/bin/env python
# coding: utf-8
#Собрано все, что связано с построением графиков
from gz_import import *
from gz_mainlib import *
# In[8]:
plot_ver = '67'
def plotver():
print('Plot ver:', plot_ver)
#новые функции отрисовки
def plot_d(x, y,
title='', lgnd='y=f(x)',
... |
# coding: utf-8
# Copyright 2014 Globo.com Player authors. All rights reserved.
# Use of this source code is governed by a MIT License
# license that can be found in the LICENSE file.
import os
try:
import urlparse as url_parser
except ImportError:
import urllib.parse as url_parser
import m3u8
import pytest
im... |
import bpy
import os
import mathutils
import math
def write_rigid_bodies(f, rigid_bodies, worldQuat, worldScale):
f.write("rigid_bodies:\n")
for rigid_body in rigid_bodies:
is_foot = "foot" in rigid_body.keys() and rigid_body["foot"] > 0.0
location = worldScale * (worldQuat * rigid_body... |
import os
import pandas as pd
import threading
import time
import ujson
from tornado_sqlalchemy_login.utils import safe_get, safe_post_cookies, construct_path
from traitlets import HasTraits
from .samples_mixin import SamplesMixin
from ..types.competition import CompetitionSpec
from ..types.submission import Submission... |
from typing import Tuple, Union
import random
from collections import defaultdict
import numpy as np
from sklearn.tree import DecisionTreeRegressor, DecisionTreeClassifier
from sklearn.tree._tree import TREE_LEAF
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestRegressor, Rando... |
## evoware/py -- python modules for Evoware scripting
## Copyright 2014 - 2019 <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/L... |
'''
This example shows training of the POS tagger without the Language class,
showing the APIs of the atomic components.
This example was adapted from the gist here:
https://gist.github.com/kamac/a7bc139f62488839a8118214a4d932f2
Issue discussing the gist:
https://github.com/explosion/spaCy/issues/1179
The example ... |
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.max_open_warning': 0})
import numpy as np
from ai_economist.foundation.scenarios.utils import social_metrics
from tutorials.utils import plotting
from os import makedirs, listdir, remove
from os.path import isfile, join
import cv2
import re
import copy
def g... |
# Copyright 2013 Rackspace, 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 writing... |
'''
Created on Dec 22, 2016
@author: safdar
'''
import numpy as np
import matplotlib.pyplot as plt
#
# Plottable base class
#
class Plottable(object):
def __init__(self, title):
self.__title__ = title
def title(self):
return self.__title__
#
# Image object to be plotted
#
class Image(Plottabl... |
import asyncio
import ssl
import websockets
import os
import json
import time
import base64
import random
import string
import hashlib
from OpenSSL import crypto, SSL
from datetime import datetime
server_password = ""
with open("./config.txt", "r") as config:
data = config.read()
data = json.loads(data)
s... |
# -*- coding: utf-8 -*-
from datetime import datetime
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.translation import pgettext, ... |
#
# Copyright (c) 2018 <NAME> + <NAME> <<EMAIL>>
#
# See the file LICENSE for your rights.
#
"""
Generates json output for web graphing.
"""
from datetime import datetime, timedelta
import json
import os
import pandas as pd
import numpy as np
from collections import OrderedDict
from thetae.util import Daily, Forecast... |
# -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, <NAME> <<EMAIL>>
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.