text stringlengths 1 927k |
|---|
# coding: utf-8
"""
Control-M Services
Provides access to BMC Control-M Services # noqa: E501
OpenAPI spec version: 9.20.220
Contact: customer_support@bmc.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import con... |
__version__ = '0.7.1'
autoextract/__version__.py |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import collections
import itertools
import time
import torch
import torch.distributed as dist
import communication
import runtime_utilities
IMAGE_CLASSIFICATION = "image_classification"
TRANSLATION = "translation"
SPEECH_TO_TEXT = "speech_to_te... |
from propertyfrontend.server import app
import mock
import unittest
import requests
import responses
from stubresponses import title
from stubresponses import search_results, test_two_search_results
class ViewPropertyTestCase(unittest.TestCase):
def setUp(self):
self.search_api = app.config['SEARCH_API']... |
from openpyxl.formatting.rule import FormulaRule
from openpyxl.styles import Font
from openpyxl.utils import get_column_letter
from openpyxl.worksheet.worksheet import Worksheet
from lib.dynamodb import config_table
class NcrTabFormatting():
TITLE = 'Non Compliant Resources'
FREEZE = 'A2'
VALID_EXCLUSIO... |
from numpy import *
from numpy.linalg import *
def reverse(prev_t, prev_pop, next_pop):
length = len(prev_t)
top = prev_t*(multiply(prev_pop, eye(length)))
bot = multiply(next_pop, ones((length,length)))
return (top/bot).T
prev_t = matrix([[0.4, 0.2, 0.4],
[0.1, 0, 0.9],
... |
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free S... |
import h5py
import numpy as np
import matplotlib.image as mpimg
from tqdm import tqdm
import os
def clear_screen():
"""Clears the console screen irrespective of os used"""
import platform
if platform.system() == 'Windows':
os.system('cls')
return
os.system('clear')
def make_folder(ta... |
# -*- coding:utf-8 -*-
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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
#
# Unl... |
from lxml import etree
from netconf.client import NetconfSSHSession
# connexion parameters
host = 'localhost'
port = 830
username = "admin"
password = "admin"
# connexion to server
session = NetconfSSHSession(host, port, username, password)
# server capabilities
print("---GET C---")
c = session.capabilities
print(c)... |
import tkinter as tk
import tkinter.filedialog as fd
from functools import partial
def openFileFunction():
filepath = fd.askopenfilename(
filetypes=[("Text Files", "*.txt"), ("All Files", "*.*")]
)
if not filepath:
return
with open(filepath, "r") as inputFile:
buttonName = file... |
from .junitparser import (
JUnitXmlError,
Attr,
Element,
JUnitXml,
TestSuite,
Property,
Skipped,
Failure,
Error,
TestCase,
Properties,
IntAttr,
FloatAttr,
)
version = "2.4.1" |
import numpy as np
from _data import DataSets
from _math import ActivationFunctions
from _plot import PlotUtils
class Perceptron:
def __init__(self, n, g):
self.n = n # learning rate
self.g = g # activation function
self.plot_data_x = [] # epochs for plotting
self.plot_data_y = [] ... |
import unittest
from urllib3.filepost import encode_multipart_formdata, iter_fields
from urllib3.fields import RequestField
from urllib3.packages.six import b, u
BOUNDARY = '!! test boundary !!'
class TestIterfields(unittest.TestCase):
def test_dict(self):
for fieldname, value in iter_fields(dict(a='b... |
import pytest
import tempfile
import zipfile
import zipfile_deflate64
from pathlib import Path
from skultrafast.quickcontrol import QC1DSpec, QC2DSpec, parse_str, QCFile
from skultrafast.data_io import get_example_path, get_twodim_dataset
def test_parse():
assert (parse_str('-8000.000000') == -8000.0)
assert... |
# Copyright 2018 SciNet (https://github.com/eth-nn-physics/nn_physical_concepts)
#
# 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
#... |
# 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... |
from amuse.rfi.core import legacy_function, LegacyFunctionSpecification
from amuse.community import (
CodeInterface,
LiteratureReferencesMixIn,
StoppingConditionInterface,
StoppingConditions,
)
from amuse.community.interface.gd import (
GravitationalDynamics,
GravitationalDynamicsInterface,
... |
"""
A context object for caching a function's return value each time it
is called with the same input arguments.
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2009 Gael Varoquaux
# License: BSD Style, 3 clauses.
from __future__ import with_statement
import os
import time
im... |
from .psc_class import PscClass
from .juman_psc import JumanPsc
from .mrph_test import mrph_test_dir
from .mrph_match import MrphMatch, MRPH_MTCH_PTN
from .features import make_features, features_in_lines
from .model import get_dataset, make_model
__all__ = [
'PscClass',
'JumanPsc',
'mrph_test_dir',
'M... |
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
import datetime
import json
import os
import re
import requests
import time
from bs4 import BeautifulSoup
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = 'ALL:@SECLEVEL=1'
def try_write(path, text):
paths = path.split("/")
sub_path = ""
for i in paths[:-1]:
... |
# Copyright 2004-2021 Tom Rothamel <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, m... |
import datetime
from django.utils.html import avoid_wrapping
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy
TIMESINCE_CHUNKS = (
(60 * 60 * 24 * 365, gettext_lazy('%.1f years')),
(60 * 60 * 24 * 30, gettext_lazy('%.1f months')),
(60 * 60 * 24 * 7, gett... |
from apps.api.{{cookiecutter.api_for_name}}_v1 import blueprint as {{cookiecutter.api_for_name}}_api
from apps.api.{{cookiecutter.api_2_for_name}}_v1 import blueprint as {{cookiecutter.api_2_for_name}}_api
def register_routes(app):
"""
Register routes with blueprint and namespace
"""
app.register_blue... |
# -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
from .helpers import *
from .tfhelpers import Graph
import cv2
import math
# Preloading trained model with activation function
# Loading is slow -> prevent multiple loads
print("Loading Segmantation model:")
segCNNGraph = Graph('models/gap-clas/CNN-CG'... |
from __future__ import division
import numpy as np
# Non-monotonic Sobol G Function (8 parameters)
# First-order indices:
# x1: 0.7165
# x2: 0.1791
# x3: 0.0237
# x4: 0.0072
# x5-x8: 0.0001
def evaluate(values, a=None):
if type(values) != np.ndarray:
raise TypeError("The argument `values` must be a numpy... |
"""Tests file for Home Assistant CLI (hass-cli)."""
import json
import re
from click.testing import CliRunner
import homeassistant_cli.cli as cli
import requests_mock
VALID_INFO = """[{
"attributes": {
"auto": true,
"entity_id": [
"remote.tv"
],
"friendly_name": "all remotes",
... |
"""
Plugin for uploading output files to S3 "progressively," meaning to upload each task's output files
immediately upon task completion, instead of waiting for the whole workflow to finish. (The latter
technique, which doesn't need a plugin at all, is illustrated in ../upload_output_files.sh)
To enable, install this ... |
from future.backports.urllib.parse import urlencode
from future.moves.urllib.parse import parse_qs
from past.builtins import basestring
import copy
import json
import logging
from collections import MutableMapping
import six
from jwkest import as_unicode
from jwkest import b64d
from jwkest import jwe
from jwkest impo... |
from ..utils import (
update_url_query,
int_or_none
)
from ..utilsEX import url_result
from ..extractor.pluralsight import PluralsightCourseIE as Old
class PluralsightCourseIE(Old):
def _real_extract(self, url):
course_id = self._match_id(url)
# TODO: PSM cookie
course = self._d... |
"""Common test functions."""
from pathlib import Path
import re
from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch
from uuid import uuid4
from aiohttp import web
from aiohttp.test_utils import TestClient
from awesomeversion import AwesomeVersion
import pytest
from supervisor.api import RestAPI
from s... |
# Copyright (C) 2021, Mindee.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
from copy import deepcopy
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras.models import Sequ... |
import math
def large_prime_fact(num):
fact = 2
while(fact * fact <= num):
while num%fact == 0:
num /= fact
fact += 1
if num > 1:
return num
return fact
print(large_prime_fact(13195))
print(large_prime_fact(600851475143)) |
# MIT License
#
# Copyright (c) 2020 Jonathan Zernik
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... |
# coding: utf-8
from __future__ import unicode_literals
import pytest
PUNCT_OPEN = ["(", "[", "{", "*"]
PUNCT_CLOSE = [")", "]", "}", "*"]
PUNCT_PAIRED = [("(", ")"), ("[", "]"), ("{", "}"), ("*", "*")]
@pytest.mark.parametrize("text", ["(", "((", "<"])
def test_uk_tokenizer_handles_only_punct(uk_tokenizer, text):... |
import sys
import math
def main():
for i in range(100000):
pow(2, i)
if __name__ == '__main__':
main() |
"""
Copyright 2015 Hewlett-Packard
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, softwar... |
# -*- coding: utf-8 -*-
{
'name': 'VisaNet Payment Acquirer',
'category': 'Accounting/Payment',
'summary': 'Payment Acquirer: VisaNet Implementation',
'version': '1.0',
'description': """VisaNet Payment Acquirer""",
'author': 'José Rodrigo Fernández Menegazzo',
'website': 'http://aquih.com/... |
from __future__ import print_function, division
import time
import config as ttconf
from Bio import Phylo
from Bio import AlignIO
import numpy as np
from gtr import GTR
import seq_utils
from version import tt_version as __version__
try:
from itertools import izip
except ImportError: #python3.x
izip = zip
cla... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'LoFi',
'author': 'Desmond Morris',
'author_email': 'hi@desmondmorris.com',
'version': '0.0.1',
'install_requires': ['Flask', 'Flask-MongoEngine', 'nose'],
'packages': ['lofi... |
# Generated by Django 2.2.18 on 2021-03-22 16:31
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('preference', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='preference', options={'verbose_n... |
from July import settings
def static_git(request):
"""
Adds static-related context variables to the context.
"""
return {'staticgit': settings.STATIC_GIT_URL } |
from typing import Dict, NamedTuple, List, Any, Optional, Callable, Set, Tuple
import cloudpickle
import enum
from mlagents_envs.environment import UnityEnvironment
from mlagents_envs.exception import (
UnityCommunicationException,
UnityTimeOutException,
UnityEnvironmentException,
)
from multiprocessing im... |
import pandas as pd
from PySide2.QtWidgets import (
QWidget,
QHBoxLayout,
QVBoxLayout,
QFormLayout,
QTableView,
QPushButton,
QComboBox,
QHeaderView
)
from rboost.gui.utils.pandasmodel import PandasModel
class ListLabelsWindow(QWidget):
def __init__(self, rboost):
super().... |
from __future__ import annotations
import numpy as np
from numpy.linalg import inv, det, slogdet
class UnivariateGaussian:
"""
Class for univariate Gaussian Distribution Estimator
"""
def __init__(self, biased_var: bool = False) -> UnivariateGaussian:
"""
Estimator for univariate Gaus... |
from Arlo import Arlo
import config
USERNAME = config.key("ARLO_USERNAME")
PASSWORD = config.key("ARLO_PASSWORD")
try:
arlo = Arlo(USERNAME, PASSWORD)
basestations = arlo.GetDevices('basestation')
arlo.Arm(basestations[0])
except Exception as e:
print(e) |
from statespacetimeseries.random_variables import MVN
class State(MVN):
""" The State object required for Kalman Filter. """
def __init__(self, mean, cov, variance):
super().__init__(mean, cov, variance)
self.prediction = None |
# Generated by Django 3.2 on 2021-04-18 19:06
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('learning_logs', '0002_entr... |
# -*- coding: utf-8 -*-
"""Literal classes"""
class literal(str):
"""literal"""
class tcvar(str):
"""tcvar""" |
import json
from asgiref.sync import async_to_sync
from channels.generic.websocket import WebsocketConsumer
Rooms = {}
def AddToRoom(RoomName, UserID):
if RoomName in Rooms:
if UserID not in Rooms[RoomName]:
Rooms[RoomName].append(UserID)
else:
Rooms.update({f"{RoomName}": []})
... |
import socket, ssl
from binascii import hexlify, unhexlify
dump = open("everything.dump", "wb")
serverDump = open("fromserver.dump", "wb")
clientDump = open("fromclient.dump", "wb")
listensocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
listensocket.bind(("127.0.0.1", 5222))
listensocket.listen(1) # 1 for no... |
"""
Code originates from: https://machinelearningmastery.com/a-gentle-introduction-to-normality-tests-in-python/
"""
from scipy.stats import shapiro, normaltest, anderson
"""
Shapiro-Wilk Test of Normality
The Shapiro-Wilk Test is more appropriate for small sample sizes (< 50 samples), but can also handle sample siz... |
from numpy.linalg import norm
from numpy import dot
def cosine_sim(vec1, vec2):
"""Calculates the cosine similarity between two vectors
Args:
vec1 (list of float): A vector
vec2 (list of float): A vector
Returns:
The cosine similarity between the two input vectors
"""
ret... |
#!/usr/bin/env python3
# Copyright (c) 2009-2017 Hadi Asghari
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, m... |
# waifu2x
import os
from os import path
import torch
import argparse
import csv
from tqdm import tqdm
from concurrent.futures import ThreadPoolExecutor as PoolExecutor
from .. logger import logger
from .. utils import load_image, save_image, ImageLoader
from .. tasks.waifu2x import Waifu2x
if os.getenv("NUNIF_MODEL_DI... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs
from sklearn.tree import DecisionTreeClassifier
from sklearn.externals.six import StringIO # doctest: +SKIP
from sklearn.tree import export_graphviz
from scipy.misc import imread
from scipy import ndimage
import re
X, y = ma... |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 15 18:09:41 2020
@author: crtom
"""
import pygame
import sys
from pygame.locals import * # this is for shortcut pygame.QUIT -> QUIT
def drawPoint(x,y,color):
s = pygame.Surface((1,1)) # the object surface 1 x 1 pixel (a point!)
s.fill(color) #... |
#!python3
"""
Utilities for conducting simulations on random utility profiles.
Author: Erel Segai-Halevi
Date: 2019-07
"""
import pandas, numpy as np
from pandas import DataFrame
import matplotlib.pyplot as plt
from partitions import equalPartitions
import operator
from timeit import default_timer as timer
from P... |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from typing import Optional, Tuple, cast
from pants.backend.python.subsystems.python_tool_base import PythonToolBase
from pants.option.custom_types import file_option, shell_str
class B... |
from commplax import xop
import numpy as np
from jax import random, numpy as jnp
def conv_input_complex(n, m):
key1 = random.PRNGKey(0)
key2 = random.PRNGKey(1)
k1, k2 = random.split(key1)
k3, k4 = random.split(key2)
x = random.normal(k1, (n,)) + 1j * random.normal(k2, (n,))
h = random.normal(... |
from django.core.exceptions import ValidationError
from rest_framework.fields import CharField, ReadOnlyField
from rest_framework.relations import HyperlinkedRelatedField, SlugRelatedField
from rest_framework.serializers import (
HyperlinkedModelSerializer,
ModelSerializer,
SerializerMethodField,
)
from gr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ********************************************************************************
# Copyright © 2018 honmaple
# File Name: log.py
# Author: honmaple
# Email: xiyang0807@gmail.com
# Created: 2018-03-26 17:49:35 (CST)
# Last Update: Thursday 2018-04-12 10:31:23 (CST)
# ... |
# Code Taken from https://github.com/LYH-YF/MWPToolkit
# -*- encoding: utf-8 -*-
# @Author: Yihuai Lan
# @Time: 2021/08/29 21:49:49
# @File: gcn.py
import torch
from torch import nn
from torch.nn import functional as F
from module.Layer.graph_layers import GraphConvolution
class GCN(nn.Module):
def __init__(se... |
"""Cancel an existing iSCSI account."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
@click.command()
@click.argument('identifier')
@click... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Classes and functions related to HTML meta data.
"""
from applications.zcomx.modules.books import \
html_metadata as book_metadata
from applications.zcomx.modules.creators import \
html_metadata as creator_metadata
from applications.zcomx.modules.zco import \
... |
# -*- coding: utf-8 -*-
"""
Functions for model training and evaluation (single-partner and multi-partner cases)
"""
import operator
import os
from abc import ABC, abstractmethod
from copy import deepcopy
from timeit import default_timer as timer
import numpy as np
import random
import tensorflow as tf
from loguru im... |
# Generated by Django 2.2.10 on 2020-04-09 11:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('common', '0019_auto_20200401_0941'),
]
operations = [
migrations.AlterField(
model_name='company',
name='address',
... |
import argparse
import json
import logging
import os
import sys
import numpy as np
import pandas as pd
import torch
import torch.distributed as dist
import torch.utils.data
import torch.utils.data.distributed
from torch.utils.data import DataLoader, RandomSampler, TensorDataset
from transformers import AdamW, BertForS... |
""" Galaxy Process Management superclass and utilities
"""
import contextlib
import importlib
import inspect
import os
import subprocess
import sys
from abc import ABCMeta, abstractmethod
from gravity.config_manager import ConfigManager
from gravity.io import error
from gravity.util import which
# If at some point ... |
import numpy as np
from microsim.opencl.ramp.summary import Summary
from microsim.opencl.ramp.snapshot import Snapshot
def test_summary_update():
npeople = 50 + 34 + 101 + 551
summary = Summary(snapshot=Snapshot.random(nplaces=10, npeople=npeople, nslots=10), max_time=20)
time = 10
statuses = np.co... |
# !usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: Brian Cherinka
# @Date: 2018-10-11 17:51:43
# @Last modified by: Brian Cherinka
# @Last Modified time: 2018-11-29 17:23:15
from __future__ import print_function, division, absolute_import
from astropy.io import f... |
import re
import itertools
import datetime
import urllib2
import logging
import json
import bleach
from urlparse import urlparse
# from copy import copy, deepcopy
from django.conf import settings
from django.db import models
from django.db.models.signals import post_save, post_delete
from django.dispatch import receive... |
from Tkinter import *
import string
# This program shows how to use a simple type-in box
class App(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.entrythingy = Entry()
self.entrythingy.pack()
# and here we get a callback when the u... |
import camera
from machine import UART
import machine
led = machine.Pin(4, machine.Pin.OUT)
machine.sleep(5000)
led.on()
uart = UART(1, 9600) # init with given baudrate
uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters
camera.init()
buf = camera.capture()
camera.deinit()
... |
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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... |
#!/usr/bin/env python3
import glob
import re
import subprocess
import collections
import argparse
def gen(wildcard, outpath, urlbase):
dd = sorted(glob.glob(wildcard))
print("Found {:} files by '{}'".format(len(dd), wildcard))
res = []
for d in dd:
with open(d) as f:
text = f.re... |
import vcs
x=vcs.init()
x.drawlogooff()
x.open()
## test it is on by default
print x.getantialiasing()
assert(x.getantialiasing()==8)
## test we can set it
x.setantialiasing(3)
assert(x.getantialiasing()==3)
## test we can set it off
x.setantialiasing(0)
assert(x.getantialiasing()==0) |
# Thanks: https://machinelearningmastery.com/how-to-develop-a-cnn-from-scratch-for-fashion-mnist-clothing-classification/
# model with double the filters for the fashion mnist dataset
import cv2
import glob
import argparse
import numpy as np
from numpy import mean
from numpy import std
from numpy import argmax
from m... |
import os
import json
import time
import copy
import traceback
import requests
from functools import wraps
import chevron
from celery import Celery
from celery.utils.log import get_task_logger
from .celery_tasks import http as http_task
from .celery_tasks import socket_ping as socket_ping_task
from .celery_tasks imp... |
# coding: utf-8
"""
Lightly API
Lightly.ai enables you to do self-supervised learning in an easy and intuitive way. The lightly.ai OpenAPI spec defines how one can interact with our REST API to unleash the full potential of lightly.ai # noqa: E501
OpenAPI spec version: 1.0.0
Contact: support@lightly... |
import json
from urllib.parse import parse_qs, urlparse
from django.contrib.auth import get_user_model
from django.core.exceptions import ImproperlyConfigured
from django.test import RequestFactory, TestCase
from django.urls import reverse
from oauth2_provider.models import (
get_access_token_model, get_applicati... |
# Copyright 2019 Open Source Robotics Foundation, 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © 2021 Taylor C. Richberger
# This code is released under the license described in the LICENSE file
import unittest
from datetime import timedelta
from tempfile import TemporaryDirectory
import time
from pathlib import Path
from expiringsqlitedict import Sqlit... |
config_pattern_mining = {
'target_col':'components.cont.conditions.logic.errorCode',
'min_gap_since_last_error':1000,
'min_obs_since_last_error':10,
'window_len':1000,
'cross_component':True,
'support':0.5,
'confidence':0.5} |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import print_function
from distutils.version import LooseVersion
# first test occurs with astropy import locally
def test_monkeypatch_warning(recwarn):
import astropy
if LooseVersion(astropy.version.version) < LooseVersion('0.3.de... |
#!/usr/bin/env python
import rospy
from std_msgs.msg import String
from geometry_msgs.msg import PoseStamped, Pose, Point, Quaternion
import numpy as np
import math
def publish():
pub = rospy.Publisher('pose_truth', PoseStamped, queue_size=10)
rospy.init_node('talker', anonymous=True)
rate = rospy.Rate(10)... |
#!/usr/bin/env python3
# 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
# "L... |
# pylint: disable=redefined-outer-name
from unittest import mock
import pytest
from fastapi.testclient import TestClient
from app.common import cache
@pytest.fixture(autouse=True, scope="function")
def clear_cache():
# pylint: disable=protected-access
cache._redis_cli.flushall() # noqa
@pytest.fixture
d... |
#!/usr/bin/env python
# -*- coding: utf-8
import itertools
import subprocess
import yaml
from k8s import config
from k8s.models.namespace import Namespace
from tqdm import tqdm
from fiaas_deploy_daemon.tpr.types import PaasbetaStatus
"""Requires `tqdm`, which is not usually part of our requirements."""
def _config... |
"""Instagram URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-bas... |
"""
Auto-generated file. To edit, run `python build_python.py`.
This will need to be run whenever a new C++ version is made available.
"""
source_sampling_cpp = (
"""#include <iostream>
#include "openmc/random_lcg.h"
#include "openmc/source.h"
#include "openmc/particle.h"
#include "plasma_source.hpp"
// Spherical to... |
"""
The `Document` that implements all the text operations/querying.
"""
import bisect
import re
import string
import weakref
from typing import (
Callable,
Iterable,
List,
NoReturn,
Optional,
Pattern,
Tuple,
cast,
)
from quo.clipboard import Data
from quo.filters import vi_mode
from .s... |
from typing import Any, Dict, List
import networkx as nx
import numpy as np
import partridge as ptg
from .graph import (generate_empty_md_graph, generate_summary_graph_elements,
make_synthetic_system_network, populate_graph)
from .synthetic import SyntheticTransitNetwork
from .toolkit import gener... |
# Copyright 2015 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
## py2/py3 compat
from __future__ import print_function
import structs
print("s = structs.S()")
s = structs.S()
print("s = %s" % (s,))
print("s.Init()")
... |
import math
class EventRegistry(object):
Events = {}
MetaEvents = {}
def register_event(cls, event, bases):
#print 'registering', event.__name__, bases
if MetaEvent in bases or AbstractTextEvent in bases:
assert event.metacommand not in cls.MetaEvents, \
... |
def sum(x, y, z):
if x == y == z:
calc = 0
else:
calc = x + y + z
return calc
print(sum(1, 1, 1))
print(sum(1, 3, 3))
print(sum(3, 1, 3)) |
import cv2
import numpy as np
from elements.yolo import OBJ_DETECTION
Object_classes = ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light',
'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow',
... |
# Name: Define subareas
# Purpose: Set up raster study area for equal-area sample selection
# Author: cprice
# Created: 3/25/2013 10:47:10 AM
# Environment: ArcGIS 10.x, Python 2.6,2.7 arcpy
# -------------------------------------------------------------------
import os
import sys
import trace... |
#Author: Boris Bauermeister
#Email: Boris.Bauermeister@gmail.com
#Simple MongoDB access class specified to readout and manipluate a data field.
#HANDLE WITH CARE
import pymongo
import os
import json
class DBManager():
def __init__(self):
self.db_mongodb_user=None
self.db_mongodb_pw=None
se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.