text
stringlengths
3.07k
12.6k
from datetime import datetime import backtrader as bt from backtrader import cerebro from django.conf import settings from django.contrib.auth.models import User from django.http import HttpResponse from rest_framework import permissions, viewsets from rest_framework.response import Response from rest_framework.views ...
import os from functools import partial import click from flask.cli import with_appcontext from sqlalchemy.exc import IntegrityError, InvalidRequestError from flask_alchemydumps.autoclean import BackupAutoClean from flask_alchemydumps.backup import Backup from flask_alchemydumps.confirm import Confirm from flask_alch...
"""Custom integration to integrate OpenEI with Home Assistant.""" from datetime import datetime, timedelta import logging from homeassistant.config_entries import ConfigEntry from homeassistant.core import Config, HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.event i...
# -*- coding: utf-8 -*- # # Copyright 2018 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 requir...
from awscrt.s3 import S3Client, S3RequestType from awscrt.io import ClientBootstrap, DefaultHostResolver, EventLoopGroup from awscrt.auth import AwsCredentialsProvider from awscrt.http import HttpHeaders, HttpRequest import time # import os import sys import threading GBPS = 1000 * 1000 * 1000 class CrtLazyReadStrea...
from __future__ import absolute_import, print_function import logging logger = logging.getLogger(__name__) import os import numpy as np import re import json import warnings with warnings.catch_warnings(): warnings.simplefilter("ignore") from tifffile import TiffFile, imsave, imread #from spimagine....
# -*- coding: utf-8 -*- ''' demo/matrixSAFT.py -------------------------------------------------- part of the fastmat demos Demonstration on how to use fastMat for SAFT. Author : wcw Introduced : ------------------------------------------------------------------------------ Copyright 2016 <NAME>,...
import logging import time from pycountry import languages as pylang from pygbif import registry from helpers import execute_sql_from_jinja_string, get_database_connection, setup_log_file, get_config, \ paginated_name_usage def _iso639_1_to_2_dict(lang): """ Takes some 2 letter-code languages (['fr', 'nl...
import tensorflow as tf from tensorflow.python.ops import control_flow_ops def flip_randomly_left_right_image_with_annotation(image_tensor, annotation_tensor): """Accepts image tensor and annotation tensor and returns randomly flipped tensors of both. The function performs random flip of image and annotation t...
from flax import linen as nn import logging import jax import jax.numpy as jnp import itertools import functools from typing import Tuple, Callable, List, Optional, Iterable, Any from flax.struct import dataclass from evojax.task.base import TaskState from evojax.policy.base import PolicyNetwork from evojax.policy....
import sys from enum import IntEnum, auto import tkinter as tk from tkinter import simpledialog, Label import cv2.cv2 as cv import numpy as np from PIL import Image, ImageTk from shapely import geometry from simulator import image_tools, win32_tools from notebook.common import set_clip, show, toyaml class Status(In...
# encoding=utf-8 from sys import version_info import os IS_PY3 = version_info.major >= 3 from ._dicomsdl import * # If you have `ImportError: DLL load failed in Microsoft Windows` on fresh installed Windows system, install Microsoft Visual C++ Redistributable. https://docs.microsoft.com/en-us/cpp/windows/latest-suppo...
#!/bin/env python3 # This file contains utilities/helper functions for general use within the Overlay module import itertools import os import sys from typing import Dict, Optional, Set, Tuple sys.path.append(os.path.dirname(os.path.abspath(__file__))+"/../../../UI/OpenAPI/python-flask-server/") from openapi_server.mo...
# ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
import typing as tp import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from flax_tools import utils FrozerVariables = FrozenDict[str, tp.Mapping[str, tp.Any]] Variables = tp.Mapping[str, tp.Mapping[str, tp.Any]] M = tp.TypeVar("M", bound="nn.module.Mod...
from datetime import datetime from dateutil.parser import parse import logging from lxml import html import mimetypes import re from urllib.parse import urljoin, urlparse from gssutils.metadata import GOV from gssutils.metadata.dcat import Distribution from gssutils.metadata.mimetype import * from gssutils.scrapers.h...
''' Utility to parse ifconfig, netstat etc. PF_ROUTE may be effectively used only to get notifications. To fetch info from the system we have to use ioctl or external utilities. Maybe some day it will be ioctl. For now it's ifconfig and netstat. ''' import re import socket import subprocess class CMD(object): ...
# coding=utf-8 # Copyright 2021 The Trax 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 a...
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "workspace_and_buildfile") def __make_output_name(name, url): """Construct a unique name from the rule name and the url""" combined = name + "/" + url combined = combined.replace(":", "/") combined = combined.replace(".", "/") return combined d...
""" Sightings business logic """ import sqlalchemy as db from sqlalchemy.exc import IntegrityError from ..model import Session, Sighting, Species def _check_for_existing_records(session, location_id, species_id, date): """ Return the IDs of existing records with the specified location, species and date ...
#!/usr/bin/env python3 # encoding: utf-8 # Copyright 2019 <NAME> # # This file is part of StDb. # # 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 limit...
from discord.ext import commands from dislash import slash_command, Option, OptionChoice from .rooms_file_loader import FileLoader gikopoipoigen = "https://gikopoipoi.net/?areaid=gen&roomid=" roomid = FileLoader.fileloader() class Slash_haishinCog(commands.Cog): def __init__(self, bot): self.bot = bot ...
# Listing_19-5.py # Copyright Warren & <NAME>, 2013 # Released under MIT license http://www.opensource.org/licenses/mit-license.php # Version $version ---------------------------- # PyPong z dźwiękami i muzyką import sys, pygame class KlasaMojaPilka(pygame.sprite.Sprite): def __init__(self, plik_obrazka, pred...
#!/usr/bin/env python3 import logging import copy from dataclasses import dataclass, field from .parsing import parse_input, parse_output from .simulation import Simulation LOGGER = logging.getLogger(__name__) class Markup: PURPLE = '\033[95m' CYAN = '\033[96m' DARKCYAN = '\033[36m' BLUE = '\033[94m...
import unittest from libdebug import Debugger from subprocess import TimeoutExpired from pwn import process import time class Debugger_read(unittest.TestCase): def setUp(self): self.d = Debugger() self.d.run("./read_test", sleep=0.1) self.mem_addr = 0x1aabbcc1000 def tearDown(self): ...
# -*- coding: utf-8 -*- # (C) Datadog, Inc. 2019-present # All rights reserved # Licensed under Simplified BSD License (see LICENSE) import re import pytest from mock import MagicMock from pyVmomi import vim from tests.mocked_api import MockedAPI from datadog_checks.base.errors import ConfigurationError from datadog_...
import ntpath import os import posixpath import re from typing import Tuple # Regex for finding separators UNKNOWN_SEP_CHARS_REGEX = re.compile(r"[/\\]+") class PathMap: """ Maps host paths to container paths. """ def __init__( self, host_paths: "list[str]", container_abs: st...
import numpy as np import pandas as pd import matplotlib.pyplot as plt plt.rcParams['font.size'] = 14 from tsfresh import extract_features from xgboost import XGBClassifier, plot_tree from sklearn.preprocessing import StandardScaler from sklearn.metrics import accuracy_score import seaborn as sns from sklearn import m...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Program: diffusionEq2D_ForwardEulerV Created: Aug 2020 @author: <NAME> (RRCC) <EMAIL> Purpose: Solve the partial differential equation (PDE) u_t = alpha * (u_xx + u_yy) in (0,Lx)x(0,Ly) with vanishing boundary conditions or u = 0 fo...
import struct as st import traceback import base64 import pdb class BadEncodingException(Exception): pass def base_decoding(readings:list, byte_array:bytes, pointer:int): """ Base decoding of data packets. It appends the values decoded to the given readings inside a tuple with the format (sensor_id, ...
""" Goes through all the interesting sources that the server knows about and downloads new articles saving them in the DB. """ from datetime import datetime import newspaper import re import zeeguu from zeeguu import model from zeeguu.content_retriever.content_cleaner import cleanup_non_content_bits fro...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import math from abc import ABC from enum import IntEnum from itertools import cycle from typing import List import torch try: from skimage.filters import threshold_otsu as otsu except ImportError: def otsu(*args,...
# 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 applic...
import random from os import fsync import imageio import numpy as np import tensorflow as tf # Generates a gif from an array of frames and saves it to the path given def generate_gif(episodes, reward, result, frames, path): for i, frame in enumerate(frames): frames[i] = frame pathname = path + "Episo...
import json import os import re import urllib.request import zipfile from elasticsearch import Elasticsearch from elasticsearch import helpers compiled_raw_json_file_patter = re.compile(r'^raw/.*\.json$') def download_trans_zip_from_paratranz(project_id, secret, ...
import pandas as pd import numpy as np ### import base parquet data ### df = pd.read_parquet('../Final Raw Data Files//final_joined_base_data.parquet') final_player_season_df = df.copy() ### define advanced metric calcs (taken directly from nba_joined_data.py) ### def calc_efg(dataset, fgm, fg3m, fga): dataset['EF...
import json import os import sqlite3 from collections import defaultdict import datasets from wikiextractor.extract import Extractor, ignoreTag, resetIgnoredTags _CITATION = """\ @article{aly2021feverous, title={FEVEROUS: Fact Extraction and VERification Over Unstructured and Structured information}, author={<NAM...
'''communicating with modular AWG via dll ''' from functools import wraps from ctypes import c_int, c_bool, c_char_p, byref, cdll, c_char, c_long, c_double from ctypes.util import find_library from pyqum.instrument.logger import address, get_status, set_status from colorama import init, Fore, Back init(autoreset=True)...
# Copyright 2019 Intel Corporation. import logging import six import plaidml2.edsl as edsl from plaidml2.ffi import ffi, ffi_call, lib logger = logging.getLogger(__name__) def __init(): ffi_call(lib.plaidml_op_init) ffi.init_once(__init, 'plaidml_op_init') def op(op_name, args): value = edsl.Value(arg...
############################################################################# # NOTICE # # # # This software (or technical data) was produced for the U.S. Government # # under ...
######################## # CUSTOM MODULE FOR GEC ######################## ''' ############ usage: import lm_scorer from lm_scorer import LMScorer from fairseq import options parser = lm_scorer.get_lm_scorer_parser() parsed_args = options.parse_args_and_arch(parser) lmscorer = LMScorer(parsed_args) score_dict = lms...
# coding:utf-8 import argparse import os import logging import enchant from util.cncf_util import have_no_letter, special_char_to_blank, camel_to_snake_case, is_code_file_code_line d = enchant.Dict("en_US") # print d.check("Hello") # print d.check("Helo") # 判断当前路径是否存在,没有则创建new文件夹 if not os.path.exists(r"../result/"...
import argparse from copy import deepcopy from datetime import datetime import gym import numpy as np import os import sys sys.path.insert(0, '../../../../') import torch import tqdm import yaml from mjmpc.control.softqmpc.algs.sac import SAC from mjmpc.control.softqmpc.models.policy_network import GaussianPolicy fro...
""" This file is uses slightly modified code from pyDRMetrics [1]_, see: - https://doi.org/10.1016/j.heliyon.2021.e06199 - the article. - https://data.mendeley.com/datasets/jbjd5fmggh/1 - the supplementary files. The following changes have been made: - :mod:`numba` JIT for performance reasons - use b...
# PyGame template. # Import standard modules. import boto3 import hashlib import json import itertools import random import numpy as np import os sqs_url = os.getenv("SIM_QUEUE") print(sqs_url) print(os.environ["SIM_QUEUE"]) sqs_region = sqs_url.split("sqs.")[1].split(".amazonaws.")[0] client = boto3.client("sqs", ...
# Written by <NAME> 2015 (<EMAIL>) # # # Copyright 2015 Ursa Analytics, 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 ...
from enum import IntEnum import PIL from .Texture2DConverter import get_image_from_texture2d # should be imported from Sprite, but not possible class SpritePackingRotation(IntEnum): kSPRNone = 0, kSPRFlipHorizontal = 1, kSPRFlipVertical = 2, kSPRRotate180 = 3, kSPRRotate90 = 4 def get_image(sprite, texture, ...
# -*- coding: utf-8 -*- import datetime, os, re, subprocess, math, json, base64 import requests, PIL.Image import secret def locate(meta, index, extension, usage): host_dir = '../' date = datetime.datetime.strptime(meta['post'], '%Y/%m/%d %H:%M').strftime('%Y%m%d') if usage == 'thumb': thumb_dir ...
import allure from hamcrest import * import pytest @allure.issue("SAN-13", "Reaction in peer to peer") @pytest.mark.incremental @pytest.mark.usefixtures("d_user", "update1", "update2") @pytest.mark.parametrize('d_user', ["2 users"], indirect=True) class TestReactionPrivate(object): """ Tests for setting reaction ...
# coding=utf-8 # Copyright 2019 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 ...
"""The Imperial Aramaic alphabet, plus simple script to transform a Hebrew transcription of an Imperial Aramaic text to its own Unicode block. TODO: Add Hebrew-to-Aramaic converter """ IMPERIAL_ARAMAIC_BLOCK = [ # Imperial Aramaic block as it is provided # by https://www.unicode.org/charts/PDF/U10840.pdf ...
''' Copyright (c) The Dojo Foundation 2011. All Rights Reserved. Copyright (c) IBM Corporation 2008, 2011. All Rights Reserved. ''' # tornado import tornado.ioloop import tornado.web # std lib import logging import json import os import pwd import shlex import functools import signal import subprocess import sys # cowe...
import requests import re from .DBQueries import * SOURCE = 'https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/' HOUR = SOURCE + 'all_hour.geojson' DAY = SOURCE + 'all_day.geojson' WEEK = SOURCE + 'all_week.geojson' MONTH = SOURCE + 'all_month.geojson' CREATE_USGS_QUERY = '''CREATE TABLE USGS (ID SERIAL PRIM...
#!/usr/bin/env python3 """ Exctract variant frequencies from VCF and map based on GFF file """ import argparse import bisect from pathlib import Path UNIPROT_IDS = { 'orf1ab': 'P0DTD1', 'orf1a': 'P0DTC1', 'nsp1': 'P0DTD1', 'nsp2': 'P0DTD1', 'nsp3': 'P0DTD1', 'nsp4': 'P0DTD1', 'nsp5': 'P0DTD1', 'nsp6': 'P0D...
import os import uuid from django.contrib.auth import get_user_model from django.contrib.auth.models import User from django.core.validators import MinValueValidator from django.db import models from django.db.models import F, IntegerField from django.db.models.expressions import Window, Case, When, Value from django....
# All error types described in DB API 2 are implemented the same way as in # Django (1.11 to 3.0)., otherwise some exceptions are not correctly reported in it. from importlib import import_module from typing import Any, Dict, Iterable, List, Mapping, Optional, Set, Type, Union import json import warnings import reques...
""" Keras model training example, copied from: https://keras.io/examples/structured_data/structured_data_classification_from_scratch/ https://github.com/keras-team/keras-io/blob/master/examples/structured_data/structured_data_classification_from_scratch.py Original code is under Apache-2.0 License (see LICENSE). """ ...
import pennylane as qml import numpy as np from pennylane.templates import RandomLayers import multiprocessing # from multiprocessing import Pool from multiprocessing import Pool #TODO: investigate in those hyperparameters n_layers = 1 n_w = 4 # numbers of wires def 4 dev = qml.device("default.qubit", wires= n_w) ...
import neural_network_lyapunov.examples.car.acceleration_car as\ acceleration_car import neural_network_lyapunov.utils as utils import neural_network_lyapunov.test.test_relu_system as test_relu_system import unittest import numpy as np import torch import scipy.integrate class TestAccelerationCar(unittest.TestCas...
import numpy.random as rnd import tensorflow as tf from aad.aad_globals import * from loda.loda import Loda from .afss import AFSS import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' def set_random_seeds(py_seed=42, np_seed=42, tf_seed=42): random.seed(py_seed) rnd.seed(np_seed) tf.set_random_seed(tf_seed)...
#!/usr/bin/env python # -*- coding:utf-8 -*- import numpy as np from ard_gsm.qchem import QChem, QChemError from ard_gsm.mol import MolGraph, SanitizationError from ard_gsm.reaction import Reaction, group_reactions_by_products, group_reactions_by_connection_changes from ard_gsm.util import write_xyz_file def parse_...
import subprocess import re import time policyScorePattern = re.compile("(?<=test policy score = )[0-9.e-]+") ROOT_PATH = '/data/doppa/users/ehoag/SCALE/' JAR_FILE = ROOT_PATH + 'executable/BatchTestPolicyTimeMultipleBeamNew.jar' GRAPH_DATA = ROOT_PATH + 'data/syago.txt' TEST_QUERY_DATA = ROOT_PATH + 'data/fixedSolve...
from transformers import AutoTokenizer, AutoModel, AutoConfig, get_linear_schedule_with_warmup from twitter_sentiment.model.Cnn import CNN2d1, CNN2d from twitter_sentiment.model.Gcnn import GCNN from twitter_sentiment.model.Sentiment import SentimentModel from twitter_sentiment.params import MAX_LEN, TRAIN_BATCH_SIZE,...
from django.contrib.auth import get_user_model from django.core.urlresolvers import reverse from django.test import TestCase from idea import models, views from idea.forms import IdeaForm, PrivateIdeaForm from idea.tests.utils import mock_req, random_user, login, create_superuser from datetime import date from mock imp...
import json from jsonschema import validate, ValidationError import boto3 from boto3.dynamodb.conditions import Key, Attr from botocore.exceptions import ClientError import os import logging from decimal import Decimal from datetime import datetime import ulid logging.basicConfig(level=logging.INFO) dynamodb = boto3....
from pathlib import Path import random import string import pytest from faker import Faker, providers from lansync.models import StoredNode, RemoteNode, Namespace from lansync.node import LocalNode from lansync.common import NodeChunk from lansync.sync_action import ( SyncAction, download, upload, de...
import os import sys import re #文件路径分隔符 if sys.platform=='win32': FSep = r'\\' else: FSep = r'\/' STATUS = { "no_change":' ', "add":'A', "conflicted":'C', "Deleted":'D', "Ignored":'I', "Modified ":'M', "noversion":'?', "miss":'!', } def sh(*args): #构建命令 if len(args) ...
from __future__ import print_function import time import os import re import sys from .evaluate import * try: from serial import Serial except: if sys.version_info < (2, 7): dir = "pyserial27" else: dir = "pyserial3" import inspect serialFolder = os.path.abspath(os.pa...
import pyglet import Block import BlockArray import random #magic numbers blockSize = 24 pointSize = 6 halfBorder = 1.0 height = 24 width = 36 #ugly global variables for visual effects hoverGroup = [] #initialize the most important data structure blocks = BlockArray.BlockArray(width, height) #initialize the graph...
import tensorflow as tf import numpy as np import cv2 import os from os.path import join as pjoin import sys import copy from facedetect import detect_face from facenet import nn4 as network from facenet import facenet import matplotlib.pyplot as plt import sklearn from sklearn.preprocessing import StandardScaler from ...
"""hxlm.core.hdp.hazmat.policy While is impossible to deal with all potential specific needs on how rules/ontologies (that per HDP conventions should themselves not be strict confidential, because HDP is focused on auditability and make as hard as possible to end users leak passwords or something on typical HDP file) ...
# -*- coding: utf-8 -*- # Author: XuMing(<EMAIL>) # Brief: Corpus for model import sys from codecs import open from collections import Counter import numpy as np # Define constants associated with the usual special tokens. SOS_TOKEN = '<sos>' EOS_TOKEN = '<eos>' UNK_TOKEN = '<unk>' PAD_TOKEN = '<pad>' def save_wor...
import os, sys, json, re from datetime import datetime as dt # from get_date_time import * from utilities.get_date_time import * # from speech_functions import * from utilities.speech_functions import * # todolist_dir = os.path.join(os.path.dirname(sys.path[0]),'todolists') todolist_dir = os.path.join(os.path.dirna...
# -*- coding: utf-8 -*- """ Created on Mon Dec 9 21:43:42 2019 @author: Paul """ import math def read_data(filename): """ Reads asteroid map and outputs a list of asteroid positions """ data = '' asteroid_list = [] i = 0 f = open(filename, 'r') for line i...
# Copyright (c) 2016-2017 <NAME> """ spark grammar differences over Python 3.1 for Python 3.0. """ from __future__ import print_function from uncompyle6.parser import PythonParserSingle from uncompyle6.parsers.parse31 import Python31Parser class Python30Parser(Python31Parser): def p_30(self, args): """ ...
import torch import numpy as np from collections import OrderedDict import seaborn as sns import os import matplotlib.pyplot as plt import scipy import matplotlib def cal_rnn_rf_sig_in_table(the_table, table_name='rnn', num_features=1): return cal_sig_in_table(the_table, table_name=table_name, compared='rf', num_...
#!/usr/bin/env python # Copyright 2017 <NAME> # import sys import os import logging import logging.handlers import subprocess import argparse import tempfile import os.path import json import glob import shutil import random import string from string import Template fmt_string = 'TESTRUNNER %(levelname)s:%(asctime)s...
# import classify_gender import detect_skintone from flask import Flask, request, jsonify import os from werkzeug.utils import secure_filename import time from keras.preprocessing.image import img_to_array from keras.models import load_model import numpy as np import mtcnn import tensorflow as tf # import argparse impo...
# Third-party import numpy as np # Project from .logging import logger def get_constant_term_design_matrix(data, ids=None): """ Construct the portion of the design matrix relevant for the linear parameters of The Joker beyond the amplitude, ``K``. """ if ids is None: ids = np.zeros(len(d...
import os from typing import Iterator, List, Optional, Tuple from comedian.command import ( Command, CommandContext, CommandGenerator, cp, crypttab_append, identify_device_path, ephemeral_keyfile, mkdir, quote_argument, quote_subcommand, ) from comedian.graph import ResolveLink ...
#!/usr/bin/env python3 import datetime import requests from hashlib import md5 import sys import argparse # Websites that return the Dow Jones index in plain text # The date can be appended to the URL in this format: %Y/%m/%d DOW_JONES_SOURCES = ["http://geo.crox.net/djia/", "http://www1.geo.crox.net/djia/", ...
import logging import torch.nn as nn from networks.ops import SpectralNorm def conv5x5(in_planes, out_planes, stride=1, groups=1, dilation=1): """5x5 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=5, stride=stride, padding=2, groups=groups, bias=...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 8 16:09:06 2021 @author: <NAME> """ import pandas as pd import streamlit as st import pickle as pkl df = pd.read_csv("data/clean_data.csv") st.title('Churn Prediction for Telecom Customers') st.write("This app is based on 18 inputs that predict ...
# -*- coding: utf-8; -*- from math import pi, sqrt, degrees, radians from calc import calc_angle #ДУГА class Arc: def __init__(self, par): self.par = par self.risArc() def risArc(self): self.par.kill() self.par.standart_unbind() self.par.old_func = 'self.risArc()...
"""an adaptation of h5py for reading and writing SE files SE files are just HDF5 files with particular conventions to support simple reading and writing of data from 1-D stellar evolution and nucleosynthesis codes. This module provides a Python wrapper for h5py that implements the conventions and restrictions express...
from scapy.all import * from ccsds_base import CCSDSPacket # https://github.com/nasa/FM/blob/b3ea3d11d972b5b9e52d85ee15589630a0d76761/fsw/src/fm_defs.h FILENAME_STATUS_ENUM = { 0: "FM_NAME_IS_INVALID", 1: "FM_NAME_IS_NOT_IN_USE", 2: "FM_NAME_IS_FILE_OPEN", 3: "FM_NAME_IS_FILE_CLOSED", 4: "FM_NAME_I...
import numpy as np import os import argparse import networkx as nx from networkx.readwrite import json_graph import json import pdb def parse_args(): parser = argparse.ArgumentParser(description="Merge two graphs into one.") parser.add_argument('--prefix1', default="example_data/ppi/graphsage/ppi") parser....
import sys sys.path.append('..') from booru_db import BooruDatabase from database import * import datetime import json import traceback import random import time import logging import redis import collections r = redis.Redis(db=12) bdb = BooruDatabase('danbooru') def parse_date(val): try: v = datetime.da...
# #https://github.com/suvoooo/Learn-TensorFlow/blob/master/resnet/Implement_Resnet_TensorFlow.ipynb # import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, ZeroPadding2D,\ Flatten, BatchNormalization,...
"""A module for querying datasources (e.g., the World Bank Indicators). They can optionally be stored locally to reduce internet queries. """ import contextlib import json import logging import os import requests import warnings import pandas as pd from salamanca.utils import backend WB_INDICATORS = { 'SP.POP....
import hashlib import json import logging import requests import uuid from django.contrib import messages from django.core import signing from django.http import Http404, HttpResponse, HttpResponseBadRequest from django.shortcuts import get_object_or_404, redirect, render from django.utils.decorators import method_deco...
import os import platform import subprocess import sys from pathlib import Path import traceback import adsk import adsk.core import adsk.fusion from .config import * app_path = os.path.dirname(__file__) sys.path.insert(0, app_path) sys.path.insert(0, os.path.join(app_path, 'apper')) my_addin = None def reportEr...
import matplotlib.pyplot as plt from collections import Counter def make_chart_simple_line_chart(): years = [1950, 1960, 1970, 1980, 1990, 2000, 2010] gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3] # create a line chart, years on x-axis, gdp on y-axis plt.plot(years, gdp, color='green...
import logging from collections import defaultdict from django.conf import settings from django.db.models import Q import redis from device_registry.models import DebPackage, Device, RecommendedAction, RecommendedActionStatus, Vulnerability, \ DEBIAN_SUITES, UBUNTU_SUITES from device_registry.recommended_actions...
""" "tcparse-stcmd" is a command line utility for generating ESS/ethercatmc-capable EPICS startup st.cmd files directly from TwinCAT3 .tsproj projects. Relies on the existence (and linking) of FB_MotionStage function blocks. """ import argparse import getpass import logging import pathlib import sys import jinja2 t...
from __future__ import print_function import time import zlib import errno import select import signal import logging import tempfile import threading import subprocess from agent_module import queue, noraise mod_name = "cli" __version__ = (1, 0) logger = logging.getLogger("agent.cli") class Proc(object): ...
# -*- coding: utf-8 -*- from datetime import datetime import pandas as pd import numpy as np def convert_gps_time(gpsweek, gpsweekseconds, format='unix'): """ Converts a GPS time format (weeks + seconds since 6 Jan 1980) to a UNIX timestamp (seconds since 1 Jan 1970) without correcting for UTC leap s...
import queue from botbowlcurriculum import make_academy import numpy as np from common.env_wrappers import BatchedEnvironment from r2d2_main import make_ffai_env, create_agent import gym import atari_py from seed_rl.common import utils import tensorflow as tf batch_size = 4 def get_envs_epsilon(env_ids, num_train...
from copy import deepcopy import tempfile import shutil import os.path from numpy import allclose from pebl import result from pebl import data, network from pebl.learner import greedy from pebl.test import testfile class TestScoredNetwork: def setUp(self): net1 = network.Network([data.Variable(x) for x ...
from flask import Flask, jsonify, render_template, request, url_for, redirect, flash from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine from resto.models import Restaurant, Base, MenuItem engine = create_engine('sqlite:///restaurantmenu.db') Base.metadata.bind = engine DBSession = sess...