text stringlengths 3.07k 12.6k |
|---|
"""Database models for the groups app."""
from __future__ import annotations
from enum import Enum, EnumMeta
from pathlib import PurePath
from django.contrib.auth.models import User
from django.db import models
from django.shortcuts import reverse
from MangAdventure.fields import (
DiscordNameField, DiscordURLF... |
#!/usr/bin/env python3
# coding = utf-8
########################################################################################
## (c) https://github.com/Pet-Series
## https://github.com/Pet-Series/pet_ros2_lcd_pkg
##
## Maintainer: <EMAIL>
## The MIT License (MIT)
##
## Input: Subscribe ROS2-topics
## Output: To... |
from flask import Flask, render_template, request, redirect
import os
from core.dbdriver import get_db, init_tables
from core import arcusdriver
from lib.arcus import *
timeout = 20 #added
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC =... |
#!/usr/bin/env python3
import os
import argparse
from glob import glob
from pprint import pprint
import numpy as np
import tensorflow as tf
from tensorflow.contrib.training import HParams
tf.logging.set_verbosity(tf.logging.INFO)
import dataset
import components
from util import glove, newsgroups, tfrecords
parser ... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# bug-report: <EMAIL>
'''
Send Redis usage metrics to Amazon CloudWatch
'''
import requests
import redis
import boto3
_METADATA_URL = "http://169.254.169.254/latest/meta-data"
# Create CloudWatch client
cloudwatch = boto3.client('cloudwatch', region_name='eu-central-1')
... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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 _utilities
fro... |
# Lint as: Python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
"""
Distributed under the terms of the BSD 3-Clause License.
The full license is in the file LICENSE, distributed with this software.
Author: <NAME> <<EMAIL>>
Copyright (C) European X-Ray Free-Electron Laser Facility GmbH.
All rights reserved.
"""
import abc
import numpy as np
from PyQt5.QtCore import pyqtSignal, p... |
import rclpy
import time
import json
import sys
import os, signal
from ament_index_python.packages import get_package_share_directory
moma_share = get_package_share_directory('omron_moma')
pp_library = get_package_share_directory('pickplace') + '/pp_library'
from math import radians
from math import degrees
from pp_... |
# (c) Copyright IBM Corp. 2019. All Rights Reserved.
# -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use
"""Function implementation"""
import logging
import json
import time
from resilient_circuits import ResilientComponent, function, handler, StatusMessage, FunctionResult, FunctionError
from... |
# ##### BEGIN GPL LICENSE BLOCK #####
# KeenTools for blender is a blender addon for using KeenTools in Blender.
# Copyright (C) 2019 KeenTools
# 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, ... |
from django.shortcuts import render, redirect
from django.contrib import messages
from django.http import HttpResponse
from rest_framework import status
from .models import StudentInClassRoom
from django.contrib.auth.models import auth, User
from Teacher.models import TEACHER, TeacherClassRoom, StudentInClassRoom
from ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from glob import glob
from tqdm import tqdm
from collections import OrderedDict
from typing import List, Tuple, Optional, Dict, cast
from torch.nn import Embedding, Module
from .utils.parser_utils import ArgparseFormatter
from .utils.logging_utils import stdout_root_logge... |
#!/usr/bin/env python3
"""Yet another script to calculate some stats over a FASTA file
"""
import os, sys
from collections import namedtuple, OrderedDict
from itertools import islice
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from smrtino.yaml_ordered import yaml
fastaline = namedtuple('fasta... |
#! /usr/bin/env python3
# MIT License
#
# (C) Copyright [2020-2021] Hewlett Packard Enterprise Development LP
#
# 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 ... |
import markdown
from datetime import datetime, timedelta
from django.db import models
from django.utils.functional import cached_property
from django.contrib.auth.models import User
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
from django.template import Context
f... |
import argparse
import threading
import collections
from proton.handlers import MessagingHandler
from proton.reactor import Container, Selector
from proton import SSLDomain, Message
import json
import logging
from flask import Flask, request, abort, jsonify
import os
import socket
from os.path import dirname, join
impo... |
import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
from torch.optim import lr_scheduler
class Print(nn.Module):
"""
debug for Sequential
"""
def __init__(self):
super(Print, self).__init__()
def forward(self, x):
print(x... |
from functools import singledispatch
from typing import Union, Callable, Optional, Type
from types import GeneratorType
from functools import wraps, singledispatch
from django.utils.translation import ugettext as _
from graphene import String, List, ID, ObjectType, Field
from graphene.types.mountedtype import MountedT... |
"""
Tests for sentinelhub_masking.py module
"""
import os
import datetime as dt
import pytest
import numpy as np
from sentinelhub import SHConfig, BBox, CRS
from s2cloudless import S2PixelCloudDetector, CloudMaskRequest, NoDataAvailableException
BBOX1 = BBox([-90.9216499, 14.4190528, -90.8186531, 14.5520163], crs=C... |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
''' IMPORTS '''
from datetime import datetime
import dateparser
import requests
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' HELPER FUNCTIONS '''
class Client(BaseClient):
def __init__(... |
# Create your models here.
from __future__ import unicode_literals
from django.db import models
from django.contrib.postgres.fields import ArrayField
# Create your models here.
def return_list(x):
return list(x)
class NewPopSynthModel(models.Model):
# command line arguments
final_kstar1 = ArrayField(mod... |
# 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
# distributed under t... |
'''
Created on 21.02.2018
@author: <NAME>
'''
__version__ = "0.3"
__updated__ = "2018-02-24"
import gc
gc.collect()
memory = gc.mem_free()
def printMemory(info=""):
global memory
memory_new = gc.mem_free()
print("[RAM] [{!s}] {!s}".format(info, memory_new - memory))
memory = memory_new
def functi... |
# 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, ... |
#Packet sniffer in python for Linux, not working on Windows
#Run with sudo
#Sniffs only incoming TCP packet
#Struct CTypes: https://docs.python.org/3/library/struct.html
import socket, sys, time
from struct import *
from scapy.all import *
#Create a raw socket
try:
#TCP packets = socket.IPPROTO_TCP | U... |
# Copyright 2020 The dm_control Authors.
#
# 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 numpy as np
import pickle
import matplotlib.pyplot as plt
# Logging class files (A3C or TB Row Logs)
a3c_row_logs_pkl = "results/TRIAL1-MsPacman/A3C_ROW-LOG.pkl"
tb_row_logs_pkl = "results/TRIAL1-MsPacman/TB_ROW-LOG.pkl"
# "Raw" dumped output
# TB
tb_trans_returns_pkl = "/Users/nburley/A3C_TB_Research/results... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest.mock
import pytest
import numpy as np
import os
import tempfile
from graphdot.model.gaussian_process.base import GaussianProcessRegressorBase
np.random.seed(0)
@pytest.mark.parametrize('normalize_y', [False, True])
def test_gpr_store_X_y(normalize_y):
... |
from flask import session, make_response, Flask, request, render_template,redirect,jsonify
#数据库交互
import pymysql
import time,datetime
import random,string
from geetest import GeetestLib
import json
import os
import threading
geetest_id = "4a58e5052ce"
geetest_key = "76ebebb658"
os.system("")
app = Flask(__name__)
ap... |
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, <NAME> and <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistrib... |
from django.db import models #this import models as data type
from django.contrib.auth.models import User #use User to borrow BookInstance
from datetime import date #use to access date and time in django
'''
everytime we change in models.py we need to call
py -3 manage.py makemigrations
py -3 manage.py migrate
''... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Программа: binary filler
# Назначение: Заполнение бинарного файла
# Версия: 1.0
# Дата: 10.04.17
# Автор: Lenferd (<EMAIL>)
MIN_STR = 2
MAX_STR = 1024000
DEBUG = False
from Modules.BinaryParser import binary_checker as bcheck
from Modules.BinaryP... |
import logging, torch, numpy as np
import model
from tqdm import tqdm
from time import time
#from tensorboardX import SummaryWriter
#from torch.optim.lr_scheduler import LambdaLR
from torch.utils.data import DataLoader
from . import utils as U
from . import dataset
from .initializer import Initializer
from .dataset.d... |
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Dict, Tuple, TypeVar, Union, Generic, Optional
import gym
import numpy as np
import pybullet
from pybullet_utils import bullet_client
from pybullet_utils.bullet_client import BulletClient
from pioneer.envs.bullet.bullet_bindings ... |
# SPDX-FileCopyrightText: 2019 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
This is a Conference Badge type Name Tag that is intended to be displayed on
the PyBadge. Feel free to customize it to your heart's content.
"""
from math import sqrt, cos, sin, radians
import board
from micropython imp... |
import sys
from bs4 import BeautifulSoup
import urllib.request
from urllib.request import urlopen
from datetime import date
import gspread
from oauth2client.service_account import ServiceAccountCredentials
'''
Automation script that enters the job's title, company, location, and url
into Google Sheets given a URL
'''... |
import numpy as np
import numba
import math
@numba.jit(cache=True, nopython=True, nogil=True)
def discretize(inp_array, bins, noise_std = 0.000000001, new_seed = False):
if not new_seed:
np.random.seed(57)
length = len(inp_array)
to_discr = inp_array + np.random.normal(0, noise_std, length)
#... |
#passgen 0.4.6#
import sys, random, string, subprocess, time, hashlib, binascii
from random import choice
from os import urandom
print('''
.---..---..---..---..---..---..-..-.
| |-'| | | \ \ \ \ | |'_| |- | .` |
`-' `-^-'`---'`---'`-'-/`---'`-'`-'
0.4.6''')
def KeyGenerate():
while True:
try:
r... |
# Copyright (c) 2015. Mount Sinai School of Medicine
#
# 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 o... |
"""
Define some functions for AquaBot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from io import BytesIO
from pathlib import Path
import json
from typing import Literal,Union
import nonebot
from nonebot.log import logger
from PIL import Image
from nonebot.adapters.onebot.v11 import message
import oss2
import httpx
fr... |
import time
import logging
import numpy
import sys
import matplotlib
sys.path.insert(0, '../')
import commonSocket as sock
import socket
from multiprocessing.connection import Listener
from multiprocessing.connection import Client
import config
import playerInputReader as input
import Player_Arnaud_forRN as Player
lo... |
"""Create and inspect python packages built with pypackage."""
import os
import sys
import glob
import codecs
import pytest
import tarfile
import zipfile
from pypackage.commands import build
def verify_wheel(expected, zip_path):
"""Asserts the standard wheel files and `expected` are in the zip."""
wheel_z... |
from __future__ import print_function
from builtins import range
import MalmoPython
import time
import malmoutils
# -- set up two agent hosts --
agent_host1 = MalmoPython.AgentHost()
agent_host2 = MalmoPython.AgentHost()
# Use agent_host1 for parsing the command-line options.
# (This is why agent_host1 is passed in... |
import logging
import os
from ambianic import pipeline, config_manager
from ambianic.pipeline import interpreter
from ambianic.pipeline.avsource.av_element import AVSourceElement
log = logging.getLogger(__name__)
def setup_module(module):
""" setup any state specific to the execution of the given module."""
... |
import os
import torch
import random
from arguments import get_args
from utils import load_checkpoint, get_checkpoint_iteration
from pretrain_gpt2 import initialize_distributed, get_masks_and_position_ids, set_random_seed
import mpu
from data_utils import make_tokenizer
from utils import print_rank_0
from pypinyin impo... |
#!/usr/bin/python
DOCUMENTATION = """
---
module: arubaos_cppm_config
version_added: 0.1
short_description: Call Mobility Master API
options:
host:
description:
- Hostname or IP Address of the Mobility Master.
required: true
client_id:
description:
- Username used... |
import logging
import os
import gensim.downloader as api
from gensim import matutils
from nltk.tokenize import word_tokenize
import numpy as np
from quasimodo.assertion_output.closest_indexes import ClosestIndexes
from quasimodo.assertion_output.saliency_and_typicality_computation_submodule import get_raw_predicate
f... |
"""Extract malicious URLs found at https://ipsniper.info
and write them to a .txt blocklist
"""
import asyncio
import logging
import re
from datetime import datetime
import aiohttp
import cchardet # type: ignore
from bs4 import BeautifulSoup, SoupStrainer
logger = logging.getLogger()
logging.basicConfig(level=loggin... |
"""
Copyright (C) 2017 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-ND 4.0 license (https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode).
"""
from __future__ import print_function
import cPickle
#import _pickle as cPickle
import gzip
import cv2
import os
import numpy as np
import torch... |
#!/usr/bin/env python
# Copyright JS Foundation and other contributors, http://js.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.... |
import numpy as np
import torch
import torchvision
from torch import nn, optim
import torchvision.transforms as transforms
from torchvision import datasets
from torchvision.models import resnet50
import torchvision.utils as vutils
from torchvision.utils import save_image
import torch.nn.functional as F
import matplotli... |
"""
Calculate TAR for specific FAR values. Spit out table organized by subgroup.
"""
import numpy as np
import pandas as pd
from facebias.metrics import calculate_tar_and_far_values
from facebias.utils import find_best_threshold
from sklearn.metrics import confusion_matrix, roc_curve
from facebias.iotools import load_... |
import time, sys, math, multiprocessing
import numpy as np
from functools import partial
# ncpus = multiprocessing.cpu_count()
ncpus = 2
class kmeans(object):
def __init__(self, n_clusters=40, load_centroids=False, cutoff=1, max_iter=50, verbose=False):
self.clusters = []
self.cutoff = cutoff
se... |
# Copyright 2020-2022 <NAME> Multimedia GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
# Copyright 2017 <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 writing, software... |
#!usr/bin/env python3
#-*- coding=utf-8 -*-
#python=3.6 pytorch=1.2.0
import os
import random
import cv2
import numpy as np
import torch
import torch.nn.functional as F
from tensorboardX import SummaryWriter
from easydict import EasyDict as edict
from random import randint
import torchvision
import tor... |
from __future__ import absolute_import
from __future__ import unicode_literals
import json
from collections import defaultdict
import six
from itertools import chain
from dimagi.ext.couchdbkit import (
BooleanProperty,
DateTimeProperty,
DocumentSchema,
SchemaDictProperty,
SchemaProperty,
Strin... |
'''test_internal_session_edit.py -
<NAME> (<EMAIL>) - Sep 2018
License: MIT. See the LICENSE file for details.
This contains a test for actions.internal_session_edit().
'''
from .. import authdb, actions
import os.path
import os
from datetime import datetime, timedelta
import multiprocessing as mp
from .test_supp... |
import numpy as np
import os
import sys
from tensorflow.keras.models import model_from_json
import wfdb
from utils import qrs_detect, comp_cosEn, save_dict
import tensorflow as tf
from matplotlib import pyplot as plt
from sklearn import preprocessing
"""
Written by: <NAME>, <NAME>
School of I... |
from flask import Flask, render_template, request, send_from_directory
from flask.templating import render_template_string
import requests
from werkzeug.utils import redirect, secure_filename
import os
from flask import Blueprint
import src.functions as func
import src.sql as sql
listener = Blueprint("listener",__name... |
"""Extract text, and get suggestions, features, and flags from Classifier."""
from typing import Iterable, Optional, Callable, Tuple
from itertools import count
import time
from datetime import datetime
from pytz import UTC
from contextlib import contextmanager
from arxiv.taxonomy import CATEGORIES, Category
from arx... |
# code to load in the atmospheric file
from os import path # for relative path import
import csv # for atmo data reading
######### CONSTANTS ##########
ATMO_ALTITUDE_INDEX = 0
ATMO_GEOPOTENTIAL_ALTITUDE_INDEX = 1
ATMO_TEMPERATURE_INDEX = 2
ATMO_PRESSURE_INDEX = 3
ATMO_DENSITY_INDEX = 4
ATMO_SPEED_OF_SOUND_INDEX = 5
... |
import sensor
import image
import time
import math
import ustruct
from pyb import USB_VCP, CAN
import pyb
# Specify communication method: "print" "usb" "can"
COMMS_METHOD = "print"
TARGET_WIDTH = 39.25
TARGET_HEIGHT = 17.00
# TODO: Check FOV Values
HFOV = 62.3 # 70.8 # horizontal field of view
VFOV = ... |
#!/usr/bin/env python3
from __future__ import division
import shutil
import json
import os
import fnmatch
from argparse import ArgumentParser
import numpy as np
from assessment_chart import assessment_chart
DEFAULT_eventMark = '2018-04-05'
def main(args):
# input parameters
data_dir = args.benchmark_data
... |
from datetime import datetime
import logging
import os
import json
from bs4 import BeautifulSoup
import requests
from flask import Flask, request, g, abort
import redis
import rethinkdb as r
from rethinkdb.errors import RqlRuntimeError, RqlDriverError
from fb_api import send_quick_reply, send_text_msg
app = Flask(__... |
import sys
import string
import random
import secrets
import uuid
from typing import Any
from pathlib import Path
import requests
import tinder.v2 as v2
import tinder.v3.auth as auth
import tinder.v3.auth.authgateway as agw
from tinder.v3.user import V3User
class SMSAuthException(auth.AuthException):
pass
class... |
import xml.etree.ElementTree as ET
from datetime import date
from typing import Optional
from uuid import UUID
from app.domain.models.Arkivuttrekk import ArkivuttrekkStatus, ArkivuttrekkType
from app.domain.models.Metadata import Metadata
NOT_PRESENT_RETURN_VALUE = ''
def _recursive_ns(elem: ET.Element, ns: dict) -... |
#!/usr/bin/env python
__author__ = "<NAME>"
__copyright__ = "Copyright 2016, Stephens lab"
__email__ = "<EMAIL>"
__license__ = "MIT"
import os
import json
def get_home_doc(db, description):
return '''
This page displays contents of database `{0}.db` generated by [this DSC]({0}.html).
{1}
'''.format(
os.p... |
# -*- coding: UTF-8 -*-
# Copyright 2010-2018 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""
This package contains model mixins, some of which are heavily used
by applications and the :ref:`xl`. But none of them is mandatory.
.. autosummary::
:toctree:
duplicable
dupable
sequenced
... |
import gspread
import random
import matplotlib.pyplot as plt
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
credentials = ServiceAccountCredentials.from_json_keyfile_name('Laboratory work <KEY>', scop... |
import numpy as np
import random
import time
from qunetsim.components import Host
from qunetsim.components import Network
from qunetsim.objects import Qubit
from qunetsim.objects import Logger
from qunetsim.backends import EQSNBackend
Logger.DISABLED = True
wait_time = 10
# !! Warning: this Crypto algorithm is rea... |
import os
import subprocess
from ajenti.api import *
from ajenti.plugins.main.api import SectionPlugin
from ajenti.plugins.services.api import ServiceMultiplexor
from ajenti.ui import on
from ajenti.ui.binder import Binder
from ajenti.util import platform_select
from reconfigure.configs.base import Reconfig
from reco... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Train and eval functions used in main.py
Mostly copy-paste from DETR (https://github.com/facebookresearch/detr).
"""
import math
import os
import sys
from typing import Iterable
import torch
import util.misc as utils
from util.misc import Nest... |
# Copyright 2015 Mirantis, 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 ... |
import PySimpleGUI as sg
import PyPDF2
import dataclasses
from pathlib import Path
import subprocess
import webbrowser
from version import __version__
@dataclasses.dataclass
class S:
''' settings '''
init_margins = dict(t='11', b='8', l='12', r='12') # PhysRev
theme = 'Reddit'
sumatra_path = Path(r"C... |
####################################################################################################
# File: molt.py
# Purpose: Module for storing and dealing with the Modes of Limited Transposition [MOLT] (1944).
#
# Author: <NAME>
#
# Location: NYC, 2021
########################################################... |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... |
from __future__ import annotations
"""
S3 is a common protocol for storing data. Many cloud providers offer an S3-compatible remote storage service.
Compsyn can be configured to optionally store data in S3.
"""
import argparse
import os
from pathlib import Path
import boto3
from .logger import get_logger
from .ut... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, <NAME> <<EMAIL>>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at you... |
import hashlib
import hmac
import json
import re
from django.conf import settings
from django.contrib.auth import logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.urlresolvers import reverse
from django.db.models import Count
fr... |
# -*- coding: utf-8 -*-
__title__ = 'fews_utilities'
__description__ = 'to read a Deltares-FEWS config into Python'
__version__ = '0.1'
__author__ = '<NAME>'
__author_email__ = '<EMAIL>'
__license__ = 'MIT License'
from collections import defaultdict
import os
#import xml.etree.ElementTree as ET
from lxml import et... |
# -*- coding utf-8 -*-#
# ------------------------------------------------------------------
# Name: log
# Author: liangbaikai
# Date: 2020/12/29
# Desc: there is a log py for smart-framework
# ------------------------------------------------------------------
import logging
import os
import sys
from... |
def tags(*t):
"""
Indicate that the values should be matched to a tag field
### Parameters
- **t**: Tags to search for
"""
if not t:
raise ValueError("At least one tag must be specified")
return TagValue(*t)
def between(a, b, inclusive_min=True, inclusive_max=True):
"""
I... |
import numpy as np
from math import *
from scipy.spatial.transform import Rotation as R
quad_params = {
'mass': 0.030, # kg
'Ixx': 1.43e-5, # kg*m^2
'Iyy': 1.43e-5, # kg*m^2
'Izz': 2.89e-5, # kg*m^2
'arm_length': 0.046, # meters
'rotor_speed_min': 0, # rad/s
'rotor_speed_max': 250... |
import numpy as np
from PIL import Image, ImageDraw, ImageFont
from .general import IMG_SIZE, L_EYE_LEFT, L_EYE_RIGHT, L_MOUTH, L_EAR_LEFT, L_EAR_RIGHT
def load(path):
img = load_image(path)
landmarks = load_landmarks(path + '.cat')
return img, landmarks
def load_image(path):
return Image.open(path... |
import random
from typing import List, Dict
import pandas as pd
import itertools
def get_mode_full_seeds(project_info: dict) -> List[dict]:
"""
This function gets the smarts seeds needed to generate synthetic data
when the user has chosen mode "full" (generate a full synthetic dataset).
To get the nu... |
import base64
import binascii
import datetime
import hashlib
import io
import os.path
import tempfile
import threading
import zipfile
import flask
import google.cloud.storage as gcloud_storage
import google.cloud.exceptions as gcloud_exceptions
from werkzeug.contrib.cache import FileSystemCache
from .. import config... |
# Copyright 2013 by <NAME>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""
Module containing abstract representation of graph.
"""
from functools impo... |
"""
Takes a truvari directory and creates a data frame with annotations of TP/FP
"""
import os
import sys
import glob
import logging
import argparse
import pysam
import joblib
import truvari
import pandas as pd
from pandas.api.types import CategoricalDtype
SZBINTYPE = CategoricalDtype(categories=truvari.SZBINS, order... |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
from collections import defaultdict
from typing import Any, Dict, List, Literal, Tuple
import numpy as np
from scripts.utils import ENTITIES, RELATIONS
class FeatureBuilder:
def __call__(self, raw_features):
raise NotImplementedError()
class VotingFeatures(FeatureBuilder):
def __init__(self, voter... |
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import cv2
import numpy as np
import zmq
from System.Data.CONSTANTS import *
from System.CameraNode import CameraNode
import random
vidpath = ''
cities = ['Cairo', 'Alexandria', 'Gizah', 'Shubra El-Kheima', 'Port Said', 'Suez... |
from typing import Dict, Tuple, List, Sequence, Set
import logging
import pandas as pd
import numpy as np
LOGGER = logging.getLogger(__name__)
class Person:
"""
It defines one person with all direct family connections
"""
def __init__(self, database_row: pd.Series):
"""
Initialize per... |
from __future__ import print_function
import os
import sys
from skimage.transform import resize
from skimage.io import imsave
import numpy as np
from keras.models import Model
from keras.layers import Input, concatenate, Conv1D, MaxPooling1D, Conv2DTranspose,Lambda
from keras.optimizers import Adam
from keras.callback... |
import logging
import uuid
import inspect
from numerous.utils.dict_wrapper import _DictWrapper
from numerous.engine.variables import Variable, VariableDescription, _VariableFactory, OverloadAction, SetOfVariables
class VariableNamespaceBase:
"""
Represents a set of variables.
"""
def __init__(self, ... |
import os
import re
from pathlib import Path
# 3rd party
from slugify import slugify
import pygments
from pygments import highlight
from pygments.lexers.c_cpp import CppLexer
from pygments.lexers import guess_lexer_for_filename
import itertools
from collections import OrderedDict
from fs.osfs import OSFS
from .html i... |
import random
import json
AVAILABLE_CHARS = [chr(ord('a')+i) for i in range(26)
]
AVAILABLE_CHARS.extend([chr(ord('A')+i) for i in range(26)])
RANDOM_SEED = 50
N_SMALL_SAMPLE = 15
N_LARGE_SAMPLE = 9
L_SMALL = 100
L_LARGE = 1000
L_BOUDERY = 20000
class Solution:
def __init__(self):
sel... |
""" SQLite model definitions. """
from datetime import datetime
from collections import defaultdict
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
STREAM_LOG_SIZE = 1000000... |
"""
1041. Robot Bounded In Circle
Medium
On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions:
"G": go straight 1 unit;
"L": turn 90 degrees to the left;
"R": turn 90 degrees to the right.
The robot performs the instructions given in order, and rep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.