text stringlengths 3.07k 22.1k |
|---|
import os
import re
from datadog_checks.base import AgentCheck, ConfigurationError, is_affirmative
from datadog_checks.utils.subprocess_output import get_subprocess_output
EVENT_TYPE = 'unbound'
class UnboundCheck(AgentCheck):
# Stats info https://unbound.net/documentation/unbound-control.html
SERVICE_CHEC... |
import os
import re
import sys
import base64
import Bcfg2.Server.Plugin
from Bcfg2.Bcfg2Py3k import HTTPError, HTTPBasicAuthHandler, \
HTTPPasswordMgrWithDefaultRealm, install_opener, build_opener, \
urlopen, file, cPickle
try:
from hashlib import md5
except ImportError:
from md5 import md5
def fetc... |
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2016-2017 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to d... |
# This file is a part of ninfs.
#
# Copyright (c) 2017-2021 <NAME>
# This file is licensed under The MIT License (MIT).
# You can find the full license text in LICENSE.md in the root of this project.
import os
import sys
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as mb
import webbrowser
fr... |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# -*- coding: utf-8 -*-
"""
:mod:`pymorphy2.opencorpora_dict.compile` is a
module for converting OpenCorpora dictionaries
to pymorphy2 representation.
"""
from __future__ import absolute_import, unicode_literals
import os
import logging
import collections
import itertools
import array
import operator
try:
izip = i... |
"""
Copyright 2013 <NAME>, 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, sof... |
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import math
import tkinter
import random
trajectories = [] # Creates the base list containing the trajectories
class Trajectory:
"""
The class used to create and represent a trajectory
"""
def __init__(s... |
'''Individual character handwriting data loading and preprocessing.
Based on https://archive.ics.uci.edu/ml/datasets/UJI+Pen+Characters+(Version+2)
'''
import re
import click
import itertools as it
import random
import json
import numpy as np
import h5py
import matplotlib.pyplot as plt
def parse_uji(lines):
'''... |
# -*- coding: utf-8 -*-
import subprocess
import fnmatch
import time
import weechat as wc
NAME = 'wsl_notify'
AUTHOR = 'janoosh'
VERSION = '1.1'
LICENSE = 'BSD-2c'
DESCRIPTION = 'send windows toast notifications on WSL systems'
cmd_help = """silent_mode - Toggles silent mode (notifications are sent but without sound... |
from jinja2 import Template
import cgen
from abc import abstractmethod, ABC
import numpy as np
import pycuda.gpuarray as gpuarray
class AbstractBC:
pass
# only rectangular domain BCs are implemented here.
class AbstractNoFlux(AbstractBC):
def __init__(self, displacement = False, displacement_var = "dx"):
... |
from tensornetwork import FiniteMPS
from tensornetwork.matrixproductstates.dmrg import FiniteDMRG, BaseDMRG
from tensornetwork.backends import backend_factory
from tensornetwork.matrixproductstates.mpo import FiniteXXZ
import pytest
import numpy as np
@pytest.fixture(
name="backend_dtype_values",
params=[('nu... |
import csv
import coinach
import json
import yaml
from pathlib import Path
import os
import re
import requests
import sys
import argparse
locales = ['de', 'en', 'fr', 'ja']
tackle_id = 30
base = 'https://xivapi.com/'
fishTrackerBase = 'https://raw.githubusercontent.com/icykoneko/ff14-fish-tracker-app/mas... |
import numpy as np
import gym
class MovingBlocksEnv(gym.Env):
metadata = {'render.modes': ['human']}
def __init__(self, shape, num_seq_targets, num_objects, total_numbers=5, add_observation_bits=False,
rmoves=4, target_reward=10, step_reward=-0.1, max_steps=1000):
"""
:param ... |
""" metric_tree.py
This file uses sklearn trees generally used for KNN calculation as an
approximate metric tree for wasserstein distance. Further extensions are
quadtree, and one based on hierarchical clustering. The idea is to use the
tree with edge lengths as the (L2) distance between means. The distance
between ... |
from __future__ import print_function
from cell_collection import CellCollection
from annoy import AnnoyIndex
import community # python-louvain package, imported as community
import networkx
import sys,string,os
sys.path.insert(1, os.path.join(sys.path[0], '..')) # import parent dir dependencies
import numpy as np
imp... |
# lfs - hash-preserving large file support using Git-LFS protocol
#
# Copyright 2017 Facebook, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""lfs - large file support (EXPERIMENTAL)
This extension allows large files to b... |
# -*- coding: utf-8 -*-
"""
Fiona is OGR's neat, nimble, no-nonsense API.
Fiona provides a minimal, uncomplicated Python interface to the open
source GIS community's most trusted geodata access library and
integrates readily with other Python GIS packages such as pyproj, Rtree
and Shapely.
How minimal? Fiona can rea... |
#!/usr/bin/env python
import os, sys, argparse, os.path, json, time, signal, atexit
from collections import defaultdict
from pixelterm.pixelterm import termify_pixels, reset_sequence
from pixelterm.unpixelterm import unpixelterm
from PIL import Image, PngImagePlugin, GifImagePlugin, ImageSequence
import re
def pixel... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2017 <NAME> <<EMAIL>>
# Distributed under terms of the MIT license.
"""
"""
import sys
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import LabelEncoder
from sklearn.metrics import roc... |
#!/usr/bin/python2
import argparse
import os
import sys
script_dir = os.path.normpath(sys.path[0])
sys.path.append(os.path.abspath(os.path.join(script_dir, "../../utils/")))
import dirutils
from ruleutils import create_layer_rules, create_color_rules
from basechart import generate_basechart_config
from geotif import ... |
from joblib import delayed, Parallel
import os
import sys
import glob
from tqdm import tqdm
import cv2
import matplotlib.pyplot as plt
plt.switch_backend('agg')
def extract_video_opencv(v_path, f_root, dim=240):
'''v_path: single video path;
f_root: root to store frames
where is the file with '''
... |
"""Generic configuration system using unrepr.
Configuration data may be supplied as a Python dictionary, as a filename,
or as an open file object. When you supply a filename or file, Python's
builtin ConfigParser is used (with some extensions).
Namespaces
----------
Configuration keys are separated into namespaces b... |
import os
import time
import json
import math
import random
import warnings
import cv2
import numpy as np
from sklearn.metrics import auc
import torch
import torch.nn.functional as F
import torch.distributed as dist
import torch.multiprocessing as mp
from models import ModelBuilder
from dataset.videodataset import Vi... |
# Copyright 2021 LINE Corporation
#
# LINE Corporation licenses this file to you 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 require... |
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2016, Camptocamp SA
# 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. Redistributions of source code must retain the above copyright notice, this
#... |
#! /usr/bin/python3.6
import logging
from autobridge.HLSParser.vivado_hls.TopRTLParser import TopRTLParser
from autobridge.Codegen.FIFOTemplate import fifo_template
from rapidstream.FE.GlobalRouting import GlobalRouting
import re
import collections
def _addClockBuffer(io_rtl):
"""
explicitly add a clock buffer so... |
#!/usr/bin/env python
## FUNCTIONS
def read_text(filename):
with open(filename, 'r') as infile:
rawText = infile.read()
return rawText
def sampleCodon(df, aminoAcid):
tmp = df[df['AA'] == aminoAcid]
return(tmp.sample(1, weights=tmp['freq']).iat[0,0])
def read_fasta(filename):
with open(f... |
"""
L1C Remove duplicates
Iterate over all the keys (one key for each archive)
Find the date for the product
S2B_MSIL1C_20180822T182909_N0206_R027_T11UPQ_20180822T225726.zip
date is 20180822T182909
find all keys with the same date
sort by the second date (processed date)
keep the most recent, delete the rest
... |
"""Tasks related to creating, updating, saving and moving translation dictionaries
in and out of Tamr"""
from typing import Dict, Set, List, Optional, Union
from dataclasses import dataclass, asdict, field
from tamr_unify_client.dataset.collection import DatasetCollection
from tamr_unify_client.dataset.resource import ... |
import numpy as np
import torch
from torch import Tensor
import torch.nn as nn
import torch.optim as optim
from redq.algos.core import TanhGaussianPolicy, Mlp, soft_update_model1_with_model2, ReplayBuffer,\
mbpo_target_entropy_dict
def get_probabilistic_num_min(num_mins):
# allows the number of min to be a flo... |
"""
This module for training the ACGAN model
"""
# system related
from __future__ import print_function
import csv
import os
import random
import numpy as np
# deep learning related
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch... |
#!/usr/bin/env python
# Script to be called by a parent at a constant rate
import matplotlib.pyplot as plt
import datetime as dt
import math
import numpy as np
import requests
from requests.exceptions import ConnectionError, RequestException
import pandas as pd
import sys
if sys.version_info[0] < 3:
from StringI... |
import struct
import os
import subprocess
# Memory leak trigger for the format string bug
leaktrigger = "%x\n"*6 + "ntdll%xntdll" + "%x\n"*60+"kernel32%xkernel32" + "%x\n"*21 + "%x\n"*6 + "ntdll%xntdll" + "%x\n"*60+"kernel32%xkernel32" + "%x\n"*21
# Creating a new process with the leak trigger as the argument for the... |
import numpy as np
import tensorflow as tf
import cde.utils.tf_utils.layers as L
from cde.utils.tf_utils.layers_powered import LayersPowered
from cde.utils.tf_utils.network import MLP
from cde.utils.tf_utils.adamW import AdamWOptimizer
from .BaseNNEstimator import BaseNNEstimator
from cde.utils.serializable import Ser... |
"""A module for computing exact solutions.
This module contains several known analytical solutions for the simple
physical processes that are useful to validate the developed codes and
numerical methods.
"""
# ***********************************************************************
#
# FILE benchmar... |
# ============================================================================
# Python 2/3 compatibility boilerplate
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from future import standard_library
from future.builtins import * # noqa: F401, F403
stand... |
import os
from pathlib import Path
from shutil import copytree, rmtree
from subprocess import check_call
from bs4 import BeautifulSoup
import pytest
from sphinx.errors import ThemeError
from sphinx.testing.util import SphinxTestApp
from sphinx.testing.path import path as sphinx_path
path_tests = Path(__file__).paren... |
import datetime
import re
import csv
import numpy as np
import pandas as pd
import sklearn
from sklearn.metrics import accuracy_score, classification_report
from sklearn.metrics import confusion_matrix
from challenge.agoda_cancellation_estimator import AgodaCancellationEstimator
from IMLearn.utils import split_train_t... |
# -*- coding: utf-8 -*-
################################################################################
# Copyright (c), AiiDA team and individual contributors. #
# All rights reserved. #
# This file is part of the AiiDA-wannier90 code. ... |
# 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 your option) any later version.
#
# Ansible is distributed in the hope that ... |
import pygame
from pygame import mixer
import random
from time import perf_counter
import mysql.connector as sqltor
mycon = sqltor.connect(host = "localhost", user = "root", passwd = "password", database = "test", charset = "utf8")
if mycon.is_connected() == False:
print("Error connecting to MySQL database... |
"""File path utilities"""
import os
import time
import re
import glob
import shutil
import tempfile
import datetime
import subprocess
from pathlib import Path
from typing import Callable, List, Union, Iterator, Tuple
from .system import get_username
# This is the base directory used for temporary files
# It includes... |
"""
Based on the work here:
https://gist.github.com/jn0/8b98652f9fb8f8d7afbf4915f63f6726
http://stackoverflow.com/questions/28022432/receiving-rtp-packets-after-rtsp-setup
A demo python code that ..
1) Connects to an IP cam with RTSP
2) Draws RTP/NAL/H264 packets from the camera
3) Writes the... |
# -*- coding: utf8 -*-
from cmd import Cmd
from funcsigs import signature
from functools import update_wrapper, wraps
from os import system
from os.path import dirname, exists, expanduser, join
from re import match
from time import gmtime, strftime
from core.common.helpers import make_crash_report, std_input
from core... |
# Copyright (c) Microsoft Corporation and contributors.
# Licensed under the MIT License.
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.utils import check_array
from sklearn.utils.validation import check_is_fitted
from anytree import NodeMixin
from .autogmm import AutoGMMCluster
from .kclust... |
import os
import contextlib
import tarfile
import json
import numpy as np
import PIL
import torch
from common_utils import get_tmp_dir
import pickle
@contextlib.contextmanager
def mnist_root(num_images, cls_name):
def _encode(v):
return torch.tensor(v, dtype=torch.int32).numpy().tobytes()[::-1]
def _... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
import datetime as dt
import json
import shutil
import argparse
try:
import colorlog
except ImportError:
pass
import sys
import re
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(CWD, '../src'))
if 'HR_C... |
#
# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
# coding: utf-8
from copy import copy
from django.conf import settings
from django.db import connections
from django.db.models import QuerySet
from django.db.models.expressions import RawSQL
from sphinxsearch import sql, compat
from sphinxsearch.fields import *
from sphinxsearch.utils import sphinx_escape
class Sph... |
from typing import NamedTuple
from datetime import date
import os
from pathlib import Path
from databaseManeger import databaseManeger
class transfer(NamedTuple):
SORT: str = "negative"
AMOUNT: float = 0.0
DAY: int = date.today().day
WEEK: int = date(date.today().year, date.today().month, d... |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import locale
import logging
import os
import re
import subprocess
import sys
import unittest
from contextlib import contextmanager
from functools import wraps
from logging.handlers import BufferingHandler
from os.path import abspath, dirn... |
# Library to contain some useful functions to reduce clutter in main SEED file
# Created 28/10/2020 by <NAME>
# Import packages
try:
import csv
import os
import sys
import tkinter as tk # tkinter is the GUI module used for this project
from math import ceil
from tkinter import filedi... |
import random
import time
from os import system, name
from pykakasi import kakasi
from vocabulary import Vocabulary
def clearCli():
# for windows
if name == 'nt':
_ = system('cls')
# for mac and linux(here, os.name is 'posix')
else:
_ = system('clear')
class CLI:
main_menu = ("Ob... |
#!/usr/bin/env python
'''CREMA structured chord model'''
import argparse
import os
import sys
from glob import glob
import pickle
import pandas as pd
import keras as K
from sklearn.model_selection import ShuffleSplit
import pescador
import pumpp
import librosa
import crema.utils
import crema.layers
from jams.util i... |
import collections
import edlib
from typing import Tuple
from transformers.data.metrics.squad_metrics import (
get_final_text,
_get_best_indexes,
_compute_softmax,
)
def _is_whitespace(c):
if c == " " or c == "\t" or c == "\r" or c == "\n" or ord(c) == 0x202F:
return True
return False
d... |
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from torchvision.utils import save_image
import im2mesh.common as common
import trimesh
import os
import torch
try:
import open3d as o3d
except ImportError:
pass
def visualize_data(data, data_type, out_file):
r'... |
#!/usr/bin/env python3
####################################################
# filename: optimize_interventions.py
# author: <NAME> <<EMAIL>>
#
# description: helper code for optimizing
# intervention parameters
####################################################
from scipy.optimize import minimize
from scipy.optimiz... |
import os
from posixpath import join as pjoin
import pytest
import ibis
import ibis.common.exceptions as com
import ibis.util as util
from ibis.tests.util import assert_equal
pytestmark = pytest.mark.spark
ps = pytest.importorskip('pyspark')
def test_create_exists_view(con, alltypes, temp_view):
tmp_name = tem... |
from typing import Dict
from django.contrib.auth.models import User
from django.db.models import query
from django.http.response import Http404, HttpResponse
from django.shortcuts import render, get_object_or_404
from rest_framework import viewsets
from rest_framework.authtoken.views import ObtainAuthToken
from rest_fr... |
#!/usr/bin/env python3
import queue
import time
import os
import atexit
import subprocess
import shutil
import threading
import errno
from typing import Any, Dict, List, TextIO, Optional
class Runner:
def __init__(self,
log_dir: str,
model: str,
case: str,
... |
import re
from django import forms
from django.conf import settings
from django.template.defaultfilters import slugify
from tower import ugettext_lazy as _lazy
from kitsune.products.models import Product, Topic
from kitsune.sumo.form_fields import MultiUsernameField, StrippedCharField
from kitsune.wiki.config import... |
import subprocess, asyncio, sys, getopt
from requests import get
from json import loads
from blaseball_mike.events import stream_events
from datetime import datetime, timedelta
pico_path = "C:\Program Files (x86)\PICO-8\pico8.exe"
#weather mappings
url = "https://raw.githubusercontent.com/xSke/blaseball-site... |
import ast
from typing import Optional
import gaphas
from gaphas.geometry import Rectangle, distance_rectangle_point
from gaphor.diagram.text import TextAlign, text_point_at_line
from gaphor.UML.presentation import Presentation, S
class Named:
"""
Marker for any NamedElement presentations.
"""
class C... |
# 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 numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.figure_factory as ff
import plotly.express as px
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
# x is a list of days in data set starting at 1
# y_baseline... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module is for generating the batch data for training and testing.
"""
import torch
import numpy as np
from multiprocessing import Process, Queue
from pykg2vec.common import TrainingStrategy
def raw_data_generator(command_queue, raw_queue, config):
"""Function ... |
#!/usr/bin/env python3
import django
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'devnet.settings')
django.setup()
from pysnmp.hlapi import *
from devnet2019.models import Devicedb, SNMPtype
from pysnmp.entity.rfc3413.oneliner import cmdgen
from modules.devnet_0_configfile import device_types
def snmpv... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import time
import numpy as np
import six
from six.moves import range
from . import SuperTask
class MockNIDAQ:
def __init__(self):
# self.data = mockdata.getMockData('cell')
# self.data = hstack([self.data, self.data])
# self... |
"""Read a Gene Product Association Data (GPAD) and store the data in a Python object.
Annotations available from the Gene Ontology Consortium:
GPAD format:
http://geneontology.org/page/gene-product-association-data-gpad-format
"""
import sys
import re
import collections as cx
from goatools.base impor... |
## Copyright 2019-2020 Smart Chain Arena LLC. ##
from browser import alert, window
import os
window.activeScenario = None
window.contracts = {}
window.pythonTests = []
import traceback
context = globals().copy()
context["alert"] = alert
context["window"] = window
reverseLines = {}
def formatErrorLine(line):
i... |
#!/usr/bin/env python
import optparse, sys
from twisted.internet import defer
from twisted.python.failure import Failure
__doc__ = """\
usage: %prog
A Deferred simulator. Use this to see how a particular
set of callbacks and errbacks will fire in a deferred.\
"""
class BadInput(Exception): pass
def parse_args():
... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Fixtures for QMT unit tests."""
import os
import sys
import pytest
import qmt
@pytest.fixture(scope='session')
def fix_testDir():
'''Return the test directory path.'''
rootPath = os.path.join(os.path.dirname(q... |
# -*- coding: utf-8 -*-
import numpy as np
from torch import nn
from torch.nn import functional as F
import torch
from torchvision import models
import torchvision
class VGGBlock(nn.Module):
def __init__(self, in_channels, middle_channels, out_channels, act_func=nn.ReLU(inplace=True)):
super(VGGBlock, se... |
# Copyright 2021, <NAME>, mailto:<EMAIL>
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
import os, sys, glob, collections, re
import json, csv
import dpath.util, rdflib
from rdflib import Graph
from pprint import pprint
import pandas as pd
import pickle, statistics
import re
NUMBERS = re.compile(r'\d+')
def numericalRate(col):
def numeric(cell):
return sum(1 for c in cell if c.isnumeric()) ... |
# Copyright 2017-2020 typed_python 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... |
# -*- coding: utf-8 -*-
"""Main plugin file - Handles the various routes"""
__author__ = "fraser"
import logging
import routing
import xbmc
import xbmcaddon
import xbmcplugin
from xbmcgui import ListItem
from resources.lib import kodilogging
from resources.lib import kodiutils as ku
from resources.lib import searc... |
import distro
import os
from .bash import exec_bash, BashError
from .out import wmid, deid, termid, shellid, cpumodel, cpuvendor, gpuvendor, sysosid
info = distro.linux_distribution(full_distribution_name=False)
ldistro = info[0]
ver = info[1]
print(ldistro)
print (ver)
#appid for discord app
appid = "none"
#number of ... |
# -*- coding: utf-8 -*-
"""
Created on Mar 15, 2012
@author: moloch
Copyright 2012 Root the Box
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/licen... |
# -------------------- OPTIONAL SETTINGS --------------------
# title
# defines the title of the whole set of queries
# OPTIONAL, if not set, timestamp will be used
title = "check_for_labels"
# description
# defines the textual and human-intended description of the purpose of these queries
# OPTIONAL, if not set, n... |
"""将一个长方形切分成三角形"""
import numpy
from basics import Triangle, Rectangle, Point
def single_rtangle_split(rtg: Rectangle):
'''将一个正方形切分,返回的顺序是逆时针,最上面的一个是第一个\n
每个直角三角形的边也是按照逆时针进行排序的
'''
rtver = rtg.center
top = Triangle([rtver, rtg.vertex[3], rtg.vertex[0]])
left = Triangle([rtver, rtg.vertex[0], r... |
import numpy as np
from sklearn import metrics
from sklearn.metrics import confusion_matrix, classification_report, log_loss, accuracy_score
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import learning_curve
import matplotlib.pyplot as plt
from tqdm import tqdm
import os
def warn(*args... |
from ..distance_sensor import DistanceSensor
# MIT License
#
# Copyright (c) 2017 <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 t... |
# \brief Calculates the symbolic expression of the muscle moment arm of an
# OpenSim .osim model. The moment arm is sampled and approximated by a
# multivariate polynomial, so that higher order derivatives can be
# computed. This implementation works with OpenSim v4.0 API.
#
# Dependencies: opensim, matplotlib, nump... |
import urllib.request
import argparse
import json
import hashlib
import pathlib
import os
import datetime
import re
import math
CACHE_DIR= os.getenv("HOME") + '/temp/cache'
ENCODING='utf-8'
parser = argparse.ArgumentParser()
parser.add_argument("comando",choices=['deputado','apelidos','situacao'])
parser.add_argumen... |
import random
import numpy as np
import torch
import torch.nn as nn
SEED = 1234
random.seed(SEED)
np.random.seed(SEED)
torch.manual_seed(SEED)
torch.cuda.manual_seed(SEED)
torch.backends.cudnn.deterministic = True
class PathEncoder(nn.Module):
def __init__(self,
input_dim,
no... |
# -*- coding: utf-8 -*-
"""
@file edge.py
@author <NAME>
@date 2011-03-17
@version $Id: edge.py 15358 2014-01-08 18:28:02Z namdre $
Python implementation of the TraCI interface.
SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
Copyright (C) 2011-2013 DLR (http://www.dlr.de/) and contributors
This ... |
#!/usr/bin/env python3
"""Test radar monitor."""
import argparse
import numpy as np
import csv
import os
from monitor.shsamonitor import SHSAMonitor
from monitor.fault import ItomFaultStatusType
from model.shsamodel import SHSAModel
from utils.logger import Logger
# parse optional config file
parser = argparse.Argu... |
import os
import time
import requests
import json
import click
from pf9.cluster.exceptions import ClusterAttachFailed, FailedActiveMasters, ClusterNotAvailable, NodeNotFound
from pf9.modules.util import Logger
from pf9.modules.express import Get
logger = Logger(os.path.join(os.path.expanduser("~"), 'pf9/log/pf9ctl.lo... |
#----------------------------------------------------------------------------------------------------
'''
kmm.py
This file contains the definition of related functions for kernal mean matching
Coded by <NAME>
Date: 2018-11-25
All Rights Reserved.
'''
#---------------------------------------------------... |
import json
import os
import boto3
import ssm_functions
import datetime
import time
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import wait
import logging
logger = logging.getLogger()
logger.setLevel(logging.WARNING)
def lambda_handler(event, context):
print(event)
insights ... |
import abc
import collections.abc
import copy
import operator
import re
from typing import NamedTuple, Optional, Sequence, Tuple, Type
from eth_utils import ValidationError, to_dict, to_set, to_tuple
from eth_utils.toolz import assoc, merge
from lru import LRU
from ssz.cache.cache import DEFAULT_CACHE_SIZE
from ssz.c... |
import rclpy
from rclpy.node import Node
import threading
from threading import Lock
import uuid
import camera.overlay_lib as overlay_lib
# import board
from std_msgs.msg import String
from std_msgs.msg import Int32MultiArray, Int16
from sensor_msgs.msg import Joy, Imu, FluidPressure, Temperature
import argparse
i... |
import MySQLdb
from src.settings import DATABASE
class MySQL:
def __init__(self,):
self.connection=MySQLdb.connect(user=DATABASE.get('USER'),passwd=DATABASE.get('PASSWORD'),
db=DATABASE.get('NAME'),host=DATABASE.get('HOST'),port=DATABASE.get('PORT')
... |
import sys
print ("Your Python version is: " + sys.version)
import cv2
print("Your OpenCV version is: "+ cv2.__version__)
import math
import numpy as np
######################
class person_detector:
######################
hog = None
def __init__(self):
print("A new person dete... |
# imporing required modules
import socket
import datetime
import time
import localization as lx
import math
import socket
import datetime
import time
import os
import select
import numpy as np
from filterpy.kalman import UnscentedKalmanFilter
from filterpy.kalman import (unscented_transform, MerweScaledS... |
from collections import defaultdict
import datetime
import os
import shutil
import tempfile
from typing import DefaultDict, Dict, FrozenSet, Optional, Set, Tuple
import weakref
from isoweek import Week
import networkx as nx
from .config import default_config, geo_config, empty_config, reroot_graph
from .gtfs import F... |
'''Tools for working with files in the samtools pileup -c format.'''
import collections
import pysam
PileupSubstitution = collections.namedtuple("PileupSubstitution",
" ".join((
"chromosome",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.