repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
aldookware/auto-send-tweets
kinesis_read.py
<filename>kinesis_read.py import boto3 import json import uuid import time stream_name = 'twitter-stream' kinesis_client = boto3.client('kinesis', region_name='eu-west-2') # iterator # shard id # describe the stream stream_description = kinesis_client.describe_stream(StreamName=stream_name) print(f'\n{stream_descrip...
aldookware/auto-send-tweets
encrypt.py
import boto3 import base64 # Use this function in the python shell to encrypt the # values you will store in the config file def encrypt(b_plaintext, key_id): """Encrypt plaintext with KMS key""" kms = boto3.client('kms') kms_result = kms.encrypt( # Sample key_id format: 'alias/MyAliasName' ...
marpie/PythonForWindows
windows/winobject/network.py
import windows import ctypes import socket import struct from windows import winproxy import windows.generated_def as gdef from windows.com import interfaces as cominterfaces from windows.generated_def.winstructs import * from windows.generated_def.windef import * class TCP4Connection(MIB_TCPROW_OWNER_PID): """A...
marpie/PythonForWindows
windows/debug/debugger.py
import os.path from collections import defaultdict, namedtuple from contextlib import contextmanager import windows import windows.winobject.exception as winexception import windows.native_exec.simple_x86 as x86 import windows.native_exec.simple_x64 as x64 from windows.winobject.process import WinProcess, WinThread f...
marpie/PythonForWindows
windows/crypto/helper.py
from windows.generated_def import CRYPT_DATA_BLOB, BYTE class ECRYPT_DATA_BLOB(CRYPT_DATA_BLOB): @classmethod def from_string(cls, buf): self = cls() self.cbData = len(buf) self.pbData = (BYTE * self.cbData)(*bytearray(buf)) return self @property def data(self): ...
marpie/PythonForWindows
ctypes_generation/extended_structs/_GUID.py
INITIAL_GUID = _GUID class _GUID(INITIAL_GUID): def __init__(self, Data1=None, Data2=None, Data3=None, Data4=None, name=None, strid=None): data_tuple = (Data1, Data2, Data3, Data4) self.name = name self.strid = strid if all(data is None for data in data_tuple): return sup...
marpie/PythonForWindows
ctypes_generation/generate.py
import sys import os import os.path import re import glob import textwrap import StringIO import shutil import dummy_wintypes import struct_parser import func_parser import def_parser import com_parser from simpleparser import ParsingError pjoin = os.path.join pexists = os.path.exists dedent = textwrap.dedent SCRI...
marpie/PythonForWindows
windows/generated_def/winfuncs.py
from interfaces import * from winstructs import * #def ObjectFromLresult(lResult, riid, wParam, ppvObject): # return ObjectFromLresult.ctypes_function(lResult, riid, wParam, ppvObject) ObjectFromLresultPrototype = WINFUNCTYPE(HRESULT, LRESULT, REFIID, WPARAM, POINTER(PVOID)) ObjectFromLresultParams = ((1, 'lResult')...
marpie/PythonForWindows
windows/winobject/wmi.py
<reponame>marpie/PythonForWindows import windows import ctypes import struct import functools from ctypes.wintypes import * import windows.com from windows.generated_def.winstructs import * from windows.generated_def.interfaces import IWbemLocator, IWbemServices, IEnumWbemClassObject, IWbemClassObject # import window...
marpie/PythonForWindows
windows/utils/__init__.py
<filename>windows/utils/__init__.py from pythonutils import * from winutils import *
marpie/PythonForWindows
windows/winobject/service.py
<gh_stars>1-10 import ctypes import windows from collections import namedtuple from contextlib import contextmanager from windows import utils import windows.generated_def as gdef from windows.generated_def import * SERVICE_TYPE = gdef.FlagMapper(SERVICE_KERNEL_DRIVER, SERVICE_FILE_SYSTEM_DRIVER, SERVICE_WIN32_OWN_...
marpie/PythonForWindows
samples/com/icallinterceptor.py
import windows import windows.generated_def as gdef from windows import winproxy # POC of ICallInterceptor # Based on works by <NAME> # http://blogs.microsoft.co.il/pavely/2018/02/28/intercepting-com-objects-with-cogetinterceptor/ windows.com.init() # Create an interceptor for the firewall (INetFwPolicy2) intercepto...
marpie/PythonForWindows
tests/test_winproxy.py
<reponame>marpie/PythonForWindows<gh_stars>1-10 import pytest import windows import windows.generated_def as gdef from pfwtest import * pytestmark = pytest.mark.usefixtures('check_for_gc_garbage') def test_createfileA_fail(): with pytest.raises(WindowsError) as ar: windows.winproxy.CreateFileA("NONEXIS...
marpie/PythonForWindows
docs/generate_winproxy_list.py
import sys import os.path sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "\\..") print(sys.path[-1]) import pydoc import re import windows winprox = windows.winproxy all_in_module = [getattr(winprox, x) for x in dir(winprox)] transp = [f for f in all_in_module if isinstance(f, winprox.TransparentApiProx...
marpie/PythonForWindows
samples/rpc/lsass.py
<filename>samples/rpc/lsass.py import windows.rpc from windows.rpc import ndr # Ndr stuff class NdrContext(ndr.NdrStructure): MEMBERS = [ndr.NdrLong, ndr.NdrLong, ndr.NdrLong, ndr.NdrLong, ndr.NdrLong] class PLSAPR_OBJECT_ATTRIBUTES(ndr.NdrStructure): MEMBERS = [ndr.NdrLong, ndr.NdrUniquePTR...
marpie/PythonForWindows
tests/test_system.py
import pytest import windows from pfwtest import * @check_for_gc_garbage class TestSystemWithCheckGarbage(object): def test_version(self): return windows.system.version def test_version_name(self): return windows.system.version_name def test_computer_name(self): return windows.sy...
koaleksa/tk-config-alpha
tk-config-alpha/config/hooks/tk-hiero-export/hiero_customize_export_ui.py
# Copyright (c) 2018 Shotgun Software Inc. # # CONFIDENTIAL AND PROPRIETARY # # This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit # Source Code License included in this distribution package. See LICENSE. # By accessing, using, copying or modifying this work you indicate your # agreement to the S...
koaleksa/tk-config-alpha
tk-config-alpha/config/hooks/tk-multi-publish2/maya/basic/publish_session_geometry.py
# Copyright (c) 2017 Shotgun Software Inc. # # CONFIDENTIAL AND PROPRIETARY # # This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit # Source Code License included in this distribution package. See LICENSE. # By accessing, using, copying or modifying this work you indicate your # agreement to ...
koaleksa/tk-config-alpha
tk-config-alpha/config/hooks/tk-hiero-export/hiero_get_quicktime_settings.py
<reponame>koaleksa/tk-config-alpha<gh_stars>1-10 # Copyright (c) 2013 Shotgun Software Inc. # # CONFIDENTIAL AND PROPRIETARY # # This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit # Source Code License included in this distribution package. See LICENSE. # By accessing, using, copying or modifying...
koaleksa/tk-config-alpha
tk-config-alpha/config/hooks/tk-multi-launchapp/before_register_command.py
<reponame>koaleksa/tk-config-alpha # Copyright (c) 2017 Shotgun Software Inc. # # CONFIDENTIAL AND PROPRIETARY # # This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit # Source Code License included in this distribution package. See LICENSE. # By accessing, using, copying or modifying this work ...
koaleksa/tk-config-alpha
tk-config-alpha/config/hooks/tk-hiero-export/hiero_upload_thumbnail.py
<reponame>koaleksa/tk-config-alpha # Copyright (c) 2013 Shotgun Software Inc. # # CONFIDENTIAL AND PROPRIETARY # # This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit # Source Code License included in this distribution package. See LICENSE. # By accessing, using, copying or modifying this work you...
koaleksa/tk-config-alpha
tk-config-alpha/config/hooks/tk-multi-publish2/collector.py
# Copyright (c) 2017 Shotgun Software Inc. # # CONFIDENTIAL AND PROPRIETARY # # This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit # Source Code License included in this distribution package. See LICENSE. # By accessing, using, copying or modifying this work you indicate your # agreement to t...
koaleksa/tk-config-alpha
tk-config-alpha/config/hooks/tk-hiero-export/hiero_update_version_data.py
# Copyright (c) 2013 Shotgun Software Inc. # # CONFIDENTIAL AND PROPRIETARY # # This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit # Source Code License included in this distribution package. See LICENSE. # By accessing, using, copying or modifying this work you indicate your # agreement to the S...
koaleksa/tk-config-alpha
tk-config-alpha/config/hooks/tk-multi-publish2/publish_file.py
# Copyright (c) 2017 Shotgun Software Inc. # # CONFIDENTIAL AND PROPRIETARY # # This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit # Source Code License included in this distribution package. See LICENSE. # By accessing, using, copying or modifying this work you indicate your # agreement to t...
dotJobs/ghost-client
tests/test_posts.py
<gh_stars>10-100 import math try: from .unittest_helper import GhostTestCase, GhostException except: from unittest_helper import GhostTestCase, GhostException class PostTests(GhostTestCase): def _setup_client(self): return self.new_logged_in_client() def test_create_post(self): post ...
dotJobs/ghost-client
ghost_client/models.py
import json from .errors import GhostException class Model(dict): """ Wrapper around the response objects to allow accessing fields as properties. """ def __getattr__(self, item): return self.get(item) def __setattr__(self, key, value): self[key] = value class Post(Model):...
dotJobs/ghost-client
ghost_client/errors.py
class GhostException(Exception): """ Type of exceptions raised by the client. """ def __init__(self, code, errors): """ Constructor. :param code: The HTTP status code returned by the API :param errors: The `errors` field returned in the response JSON """ ...
dotJobs/ghost-client
ghost_client/__init__.py
from .api import Ghost, GhostException
dotJobs/ghost-client
tests/test_uploads.py
<gh_stars>10-100 import os try: from .unittest_helper import GhostTestCase, GhostException except: from unittest_helper import GhostTestCase, GhostException class UploadTests(GhostTestCase): def __init__(self, *args, **kwargs): super(UploadTests, self).__init__(*args, **kwargs) if not ha...
dotJobs/ghost-client
tests/test_tags.py
<gh_stars>10-100 import math try: from .unittest_helper import GhostTestCase, GhostException except: from unittest_helper import GhostTestCase, GhostException class TagTests(GhostTestCase): def _setup_client(self): return self.new_logged_in_client() def test_create_tag(self): tag = s...
dotJobs/ghost-client
tests/test_users.py
<reponame>dotJobs/ghost-client try: from .unittest_helper import GhostTestCase, GhostException except: from unittest_helper import GhostTestCase, GhostException class UserTests(GhostTestCase): def _setup_client(self): return self.new_logged_in_client() def test_create_post_with_user(self): ...
dotJobs/ghost-client
tests/unittest_helper.py
import os import unittest from ghost_client import Ghost, GhostException class GhostTestCase(unittest.TestCase): GHOST_BASE_URL = os.environ.get('GHOST_BASE_URL', 'http://localhost:12368') GHOST_VERSION = os.environ.get('GHOST_VERSION', 'auto') GHOST_USERNAME = os.environ.get('GHOST_USERNAME', '<EMAIL>')...
dotJobs/ghost-client
ghost_client/helpers.py
<gh_stars>10-100 import functools def refresh_session_if_necessary(f): """ Decorator to use on methods that are allowed to retry the request after reauthenticating the client. :param f: The original function :return: The decorated function """ @functools.wraps(f) def wrapped(self, *a...
dotJobs/ghost-client
tests/test_session.py
try: from .unittest_helper import GhostTestCase, Ghost, GhostException except: from unittest_helper import GhostTestCase, Ghost, GhostException class SessionTest(GhostTestCase): def _setup_client(self): return self.new_client() def test_login(self): self.assertNotEqual(len(self.login(...
teamo1996/Point-cloud-process-shenlan
09-Registration/code/Registration.py
<reponame>teamo1996/Point-cloud-process-shenlan import os import argparse import progressbar import numpy as np import open3d as o3d import pandas as pd import copy import Utils import Detector import Decriptor import RANSAC def get_args(): parase = argparse.ArgumentParser("Registration") parase.add_argument...
teamo1996/Point-cloud-process-shenlan
09-Registration/code/Utils.py
<filename>09-Registration/code/Utils.py from ast import Num from os import stat import pandas as pd import pandas import open3d as o3d import open3d import numpy as np import numpy import copy from scipy.spatial.transform import Rotation class pointcloud: def __init__(self): pass # 从文件中读取点云 @s...
teamo1996/Point-cloud-process-shenlan
02-Nearest Neighbor Problem/code/kdtree.py
<gh_stars>1-10 # kdtree的具体实现,包括构建和查找 import random import math import numpy as np from result_set import KNNResultSet, RadiusNNResultSet # Node类,Node是tree的基本组成元素 class Node: def __init__(self, axis, value, left, right, point_indices): self.axis = axis self.value = value self.left = left ...
teamo1996/Point-cloud-process-shenlan
07-Feature Detection/code/Utils.py
import pandas as pd import open3d as o3d import open3d class pointcloud: def __init__(self): pass # 从文件中读取点云 @staticmethod def read_pointcloud(file_name:str)-> open3d.geometry.PointCloud: df = pd.read_csv(file_name,header = None) df.columns = ["x","y","z", ...
teamo1996/Point-cloud-process-shenlan
03-Clustering/code/GMM.py
# 文件功能:实现 GMM 算法 import numpy as np from numpy import * import matplotlib.pyplot as plt from matplotlib.patches import Ellipse from scipy.stats import multivariate_normal plt.style.use('seaborn') class GMM(object): def __init__(self, n_clusters, max_iter=50): self.n_clusters = n_clusters # 聚类个数 ...
teamo1996/Point-cloud-process-shenlan
09-Registration/code/Detector.py
''' Author: teamo1998 Date: 2021-05-03 15:12:57 LastEditTime: 2021-05-03 21:10:05 LastEditors: Please set LastEditors Description: 本代码是为了完成ISS特征点检测 FilePath: /Point-cloud-process/第7章:3D Feature Detection/ISS.py ''' import pandas as pd import open3d as o3d import argparse import numpy as np import heapq import Utils i...
teamo1996/Point-cloud-process-shenlan
09-Registration/code/Registration_o3d.py
<gh_stars>1-10 import os import argparse import progressbar import numpy as np import open3d as o3d import pandas as pd import copy import Utils # 获取命令行参数 def get_args(): parase = argparse.ArgumentParser("Registration") parase.add_argument("--pointcloud_dir",type=str,default="/workspace/Data/registration_dat...
teamo1996/Point-cloud-process-shenlan
03-Clustering/code/KMeans.py
# 文件功能: 实现 K-Means 算法 import numpy as np import math class K_Means(object): # k是分组数;tolerance‘中心点误差’;max_iter是迭代次数 def __init__(self, n_clusters=2, tolerance=0.0001, max_iter=300): self.k_ = n_clusters self.tolerance_ = tolerance self.max_iter_ = max_iter self.centers = None ...
teamo1996/Point-cloud-process-shenlan
01-Introduction and Basic Algorithm/code/voxel_filter.py
# 实现voxel滤波,并加载数据集中的文件进行验证 import open3d as o3d import os import numpy as np import pandas as pd import math from pyntcloud import PyntCloud import random import argparse # 获取命令行参数 def get_args(): parase = argparse.ArgumentParser() parase.add_argument("--filename",type=str,default="../../Data/modelnet40_norm...
teamo1996/Point-cloud-process-shenlan
01-Introduction and Basic Algorithm/code/pca_normal.py
# 实现PCA分析和法向量计算,并加载数据集中的文件进行验证 import open3d as o3d import numpy as np import pandas as pd from pyntcloud import PyntCloud import argparse # 获取命令行参数 def get_args(): parase = argparse.ArgumentParser() parase.add_argument("--filename",type=str,default="../../Data/modelnet40_normal_resampled/airplane/airplane_0...
teamo1996/Point-cloud-process-shenlan
04-Model Fitting/code/clustering.py
<gh_stars>1-10 # 文件功能: # 1. 从数据集中加载点云数据 # 2. 从点云数据中滤除地面点云 # 3. 从剩余的点云中提取聚类 import numpy as np import os import struct from numpy.core.fromnumeric import argmin from sklearn import cluster, datasets, mixture from itertools import cycle, islice import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import...
teamo1996/Point-cloud-process-shenlan
03-Clustering/code/Spectral_Clustering.py
<reponame>teamo1996/Point-cloud-process-shenlan import numpy as np import matplotlib.pyplot as plt from sklearn import cluster, datasets, mixture from matplotlib.patches import Ellipse from scipy.stats import multivariate_normal import KMeans from sklearn import neighbors plt.style.use('seaborn') class spectral_clu...
teamo1996/Point-cloud-process-shenlan
08-Feature Description/code/Decriptor.py
<gh_stars>1-10 import argparse # 命令行参数获取 import numpy as np import pandas as pd import matplotlib.pyplot as plt import open3d as o3d import Utils import numpy import open3d class FPFH_decriptor: def __init__(self) -> None: self.__B = 11 self.__pointclouds = None self.__feature...
teamo1996/Point-cloud-process-shenlan
09-Registration/code/RANSAC.py
<reponame>teamo1996/Point-cloud-process-shenlan from cmath import inf import collections import copy import concurrent.futures import this import numpy as np from scipy.spatial.distance import pdist from scipy.spatial.transform import Rotation as R import open3d as o3d import open3d class RANSAC_ICP: def __init__...
teamo1996/Point-cloud-process-shenlan
02-Nearest Neighbor Problem/code/result_set.py
# 该文件定义了在树中查找数据所需要的数据结构,类似一个中间件 import copy # 数据结构:保存点的索引和距离 class DistIndex: def __init__(self, distance, index): self.distance = distance self.index = index def __lt__(self, other): return self.distance < other.distance # KNN搜索结果 # 输入: # capacity:需要搜索的点的个数 class KNNResultSet: ...
teamo1996/Point-cloud-process-shenlan
09-Registration/registration_dataset/evaluate_rt.py
<reponame>teamo1996/Point-cloud-process-shenlan import numpy as np import math import os import struct from scipy.spatial.transform import Rotation import open3d as o3d def get_P_from_Rt(R, t): P = np.identity(4) P[0:3, 0:3] = R P[0:3, 3] = t return P def is_registration_successful(P_pred_np, P_gt_n...
teamo1996/Point-cloud-process-shenlan
02-Nearest Neighbor Problem/code/benchmark.py
<gh_stars>1-10 # 对数据集中的点云,批量执行构建树和查找,包括kdtree和octree,并评测其运行时间 import random import math import numpy as np import time import os import struct import matplotlib.pyplot as plt from scipy import spatial import octree as octree import kdtree as kdtree from result_set import KNNResultSet, RadiusNNResultSet def read_vel...
gzock/tocaro-exporter
tocaro_exporter.py
#!/usr/bin/env python3 import os from argparse import ArgumentParser from configparser import ConfigParser from logging import getLogger, basicConfig, INFO, DEBUG import json from distutils.util import strtobool from tocaro_session import TocaroSession, CsrfTokenNotFoundError, SignInError class TocaroExporter(): l...
gzock/tocaro-exporter
tocaro_session.py
#!/usr/bin/env python3 import re import json from logging import getLogger from time import time, sleep from requests import session, Response from bs4 import BeautifulSoup class CsrfTokenNotFoundError(Exception): pass class AuthTokenNotFoundError(Exception): pass class SignInError(Exception): pass class To...
conversence/pyoembed
pyoembed/tests/providers/test_main.py
import re import unittest from pyoembed.providers import BaseProvider class MyProvider(BaseProvider): priority = 1 oembed_endpoint = 'http://google.com/?format={format}' oembed_schemas = [re.compile('http://bola\.com/guda/.*'), 'http://google.com/*/foo'] class BaseProviderTestCas...
bebleo/bebleo_smtpd_fixture
smtpdfix/event_handler.py
from __future__ import annotations import logging from typing import Any from .typing import CallableHandler log = logging.getLogger(__name__) class EventHandler(): def __init__(self) -> None: self._handlers: set[CallableHandler] = set() def __iadd__(self, handler: CallableHandler) -> EventHandler...
bebleo/bebleo_smtpd_fixture
smtpdfix/__init__.py
<filename>smtpdfix/__init__.py __all__ = ( "AuthController", "Authenticator", "AuthMessage", "Config", "smtpd", "SMTPDFix", ) __version__ = "0.4.0.dev" from .authenticator import Authenticator from .configuration import Config from .controller import AuthController from .fixture im...
bebleo/bebleo_smtpd_fixture
smtpdfix/handlers.py
<filename>smtpdfix/handlers.py import base64 import hmac import logging import secrets from datetime import datetime from email.message import Message as EmailMessage from typing import List from aiosmtpd.handlers import Message from aiosmtpd.smtp import MISSING, SMTP, AuthResult, auth_mechanism log = logg...
bebleo/bebleo_smtpd_fixture
tests/test_controller.py
import logging import os import ssl from pathlib import Path from smtplib import SMTP, SMTP_SSL, SMTPSenderRefused, SMTPServerDisconnected import pytest from smtpdfix.certs import _generate_certs from smtpdfix.configuration import Config from smtpdfix.controller import AuthController from smtpdfix.fixture import _Aut...
bebleo/bebleo_smtpd_fixture
smtpdfix/fixture.py
import logging import os from typing import Any, Generator, Optional import pytest from .authenticator import Authenticator from .certs import _generate_certs from .configuration import Config from .controller import AuthController from .typing import TempPathFactory log = logging.getLogger(__name__) class _Authen...
bebleo/bebleo_smtpd_fixture
smtpdfix/controller.py
<reponame>bebleo/bebleo_smtpd_fixture import asyncio import errno import logging from contextlib import ExitStack from os import strerror from pathlib import Path from socket import create_connection from ssl import CERT_OPTIONAL, Purpose, SSLContext, create_default_context from typing import Any, List, Optional from ...
bebleo/bebleo_smtpd_fixture
smtpdfix/configuration.py
import os from pathlib import Path from typing import Any, Optional, Tuple, Union from dotenv import load_dotenv from .event_handler import EventHandler from .typing import PathType _current_dir = Path(__file__).parent load_dotenv() def _strtobool(val: str) -> bool: """Convert a string representation of truth ...
bebleo/bebleo_smtpd_fixture
tests/test_fixture.py
from base64 import b64encode from smtplib import (SMTP, SMTP_SSL, SMTPAuthenticationError, SMTPResponseException) from unittest import mock import pytest from smtpdfix import Config from smtpdfix.fixture import _Authenticator def encode(message): message_bytes = message.encode()...
bebleo/bebleo_smtpd_fixture
smtpdfix/authenticator.py
from abc import ABCMeta, abstractmethod class Authenticator(metaclass=ABCMeta): @abstractmethod def validate(self, username: str, password: str) -> bool: """Validate that the passward authenticates the username.""" raise NotImplementedError() # pragma: no cover @abstractmethod ...
bebleo/bebleo_smtpd_fixture
tests/test_smtpdfix.py
<gh_stars>1-10 from smtplib import SMTP from smtpdfix import SMTPDFix def test_smtpdfix(msg): with SMTPDFix() as server, SMTP(server.hostname, server.port) as client: client.send_message(msg) assert len(server.messages) == 1
bebleo/bebleo_smtpd_fixture
smtpdfix/typing.py
<reponame>bebleo/bebleo_smtpd_fixture<gh_stars>0 import asyncio import os from typing import Any, Callable, Coroutine, Dict, Optional, Union from pytest import __version__ as pytest_version # Type aliases AsyncServer = asyncio.base_events.Server CallableHandler = Callable[..., Optional[Dict[Any, Any]]] PathType = Uni...
bebleo/bebleo_smtpd_fixture
smtpdfix/certs.py
<gh_stars>0 import logging import socket from datetime import datetime, timedelta from ipaddress import ip_address from pathlib import Path from typing import Union from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.x509 import (...
bebleo/bebleo_smtpd_fixture
tests/test_configuration.py
import functools import os from pathlib import Path import pytest from smtpdfix.configuration import Config, _strtobool values = [ ("host", "mail.localhost", "mail.localhost", str), ("port", 5025, 5025, int), ("port", "5025", 5025, int), ("ready_timeout", 2.5, 2.5, float), ("ready_timeout", "2.5"...
bebleo/bebleo_smtpd_fixture
tests/test_smtp.py
<filename>tests/test_smtp.py from smtplib import SMTP import pytest @pytest.mark.parametrize("cmd", ["DATA", "MAIL", "RCPT"]) def test_auth_first(cmd, smtpd): smtpd.config.enforce_auth = True with SMTP(smtpd.hostname, smtpd.port) as client: client.ehlo() code, repl = client.docmd(cmd, "") ...
bebleo/bebleo_smtpd_fixture
tests/conftest.py
<gh_stars>1-10 import os from collections import namedtuple from email.message import EmailMessage import pytest # Because we need to test the fixture we include the plugin here, but generally # this is not necessary and the fixture is loaded automatically. pytest_plugins = ["smtpdfix", "pytester"] def p...
cloudmesh/cloudmesh-flow
example/vm-flow.py
<reponame>cloudmesh/cloudmesh-flow from cloudmesh.compute.aws import Provider as AWSProvider from cloudmesh.compute.azure import AzProvider from cloudmesh.flow.Flow import Flow class MyFlow(Flow): def spawn_aws(self): pass def spawn_azure(self): pass def ping_aws(self): pass ...
cloudmesh/cloudmesh-flow
example/test/test_list_flow.py
from unittest import TestCase import webbrowser class Test_Visualize(TestCase): def test_list_flow(self): flow_name = "testflow2-flow" url = "http://127.0.0.1:8080/flow/monitor/" + flow_name webbrowser.open(url)
cloudmesh/cloudmesh-flow
example/test/test.py
from cloudmesh.flow.worflowdb import WorkFlowDB from cloudmesh.flow.Node import Node from cloudmesh.flow.visualize import manager import webbrowser def define_flow(): FLOWNAME = "testflow2" mydb = WorkFlowDB(FLOWNAME) node = Node("d") node.workflow = FLOWNAME mydb.add_node(node.toDict()) nod...
cloudmesh/cloudmesh-flow
example/cloudflow-flow.py
from cloudmesh.compute.vm.Provider import Provider from cloudmesh.flow.Flow import Flow # # we assume image is ubuntu 19.04 in cloudmesh.yaml # def start_vm(cloud, name=None): # # complete me # provider = Provider(cloud) vm = provider.boot(name=name) vm.wiat() return vm class MyF...
cloudmesh/cloudmesh-flow
example/workflow-flow.py
<filename>example/workflow-flow.py<gh_stars>1-10 import sys import time from cloudmesh.flow.Flow import Flow from cloudmesh.flow.Flow import Get, Put from pprint import pprint class MyFlow(Flow): edges = [["a","b"], ["b","c"]] def a(self): print("in a!") time.sleep(5) def b(self): ...
cloudmesh/cloudmesh-flow
example/flow-flow.py
import sys import time from cloudmesh.flow.Flow import Flow class MyFlow(Flow): def a(self): print("in a!") time.sleep(5) def b(self): print("in b!") time.sleep(10) def c(self): print("in c!") time.sleep(10) if __name__ == "__main__": Flow = MyFlow(sys....
cloudmesh/cloudmesh-flow
tests/test_baseclass.py
############################################################### # pip install .; pytest -v --capture=no -v --nocapture tests/test_baseclass..py::Test_baseclass.test_001 # pytest -v --capture=no tests/test_baseclass.py # pytest -v tests/test_baseclass.py ############################################################### i...
cloudmesh/cloudmesh-flow
tests/test_flownode.py
############################################################### # pip install .; pytest -v --capture=no -v --nocapture tests/test_flownode..py::Test_flownode.test_001 # pytest -v --capture=no tests/test_flownode.py # pytest -v tests/test_flownode.py ############################################################### impor...
cloudmesh/cloudmesh-flow
cloudmesh/flow/visualize/render.py
from flask import Flask, jsonify, render_template, render_template_string from flask import jsonify import oyaml as yaml from os import walk from cloudmesh.flow.worflowdb import WorkFlowDB class Node: @staticmethod def color(task): color = 'violet' if task.status == "pending": colo...
cloudmesh/cloudmesh-flow
cloudmesh/flow/command/flow.py
from cloudmesh.shell.command import command from cloudmesh.shell.command import PluginCommand from cloudmesh.flow.Flow import FlowDatabase, parse_yaml_to_workflow from cloudmesh.flow.FlowRunner import FlowRunner from cloudmesh.common.debug import VERBOSE from cloudmesh.flow.Node import Node from cloudmesh.common.Print...
cloudmesh/cloudmesh-flow
cloudmesh/flow/visualize/server.py
import connexion from flask import render_template, request app = connexion.App(__name__, specification_dir="./") # Read the yaml file to configure the endpoints app.add_api("server.yaml") def shutdown_server(): func = request.environ.get('werkzeug.server.shutdown') if func is None: raise RuntimeEr...
cloudmesh/cloudmesh-flow
tests/test_flowdb.py
############################################################### # pip install .; pytest -v --capture=no -v --nocapture tests/test_flowdb..py::Test_flowdb.test_001 # pytest -v --capture=no tests/test_flowdb.py # pytest -v tests/test_flowdb.py ############################################################### import os fr...
cloudmesh/cloudmesh-flow
cloudmesh/flow/Node.py
class Node(object): def __init__(self, name): self.name = name self.dependencies = [] self.workflow = "" self.result = {} def add_dependency(self, other_node): self.dependencies.append(other_node.name) def toDict(self): return {"name": self.name, ...
cloudmesh/cloudmesh-flow
cloudmesh/flow/Flow.py
<reponame>cloudmesh/cloudmesh-flow<filename>cloudmesh/flow/Flow.py #!/usr/bin/python import sys from cloudmesh.mongo.CmDatabase import CmDatabase from cloudmesh.flow.Node import Node from cloudmesh.mongo.DataBaseDecorator import DatabaseUpdate from lark import Lark, Visitor import oyaml as yaml from cloudmesh.common.de...
cloudmesh/cloudmesh-flow
tests/test_flowrunner.py
<filename>tests/test_flowrunner.py<gh_stars>1-10 ############################################################### # pip install .; pytest -v --capture=no -v --nocapture tests/test_flowrunner..py::Test_flowrunner.test_001 # pytest -v --capture=no tests/test_flowrunner.py # pytest -v tests/test_flowrunner.py ############...
cloudmesh/cloudmesh-flow
benchmark/benchmark_ingest.py
############################################################### # pytest -v --capture=no benchmark/benchmark_ingest.py # pytest -v benchmark/benchmark_ingest.py # pytest -v --capture=no benchmark/test_cms.py:Test_cms.<METHODNAME> ############################################################### import pytest from cloud...
cloudmesh/cloudmesh-flow
cloudmesh/flow/visualize/manager.py
<gh_stars>1-10 import requests import os def shutdown(): url = "http://127.0.0.1:8080/shutdown" response = requests.get(url) def start(): os.system('python server.py')
cloudmesh/cloudmesh-flow
deprecated/FlowDecorator.py
<gh_stars>1-10 import inspect from cloudmesh.flow.Flow import FlowDatabase class BaseWorkFlow(): def __init__(self, flowfile): self.flowname = flowfile[:flowfile.find("-")] def save_result_to_db(self, nodeName, result): print("saving result to", self.flowname, result) db = FlowDatabase...
cloudmesh/cloudmesh-flow
deprecated/worflowdb-deprecated.py
from cloudmesh.mongo.CmDatabase import CmDatabase from cloudmesh.flow.Node import Node from cloudmesh.mongo.DataBaseDecorator import DatabaseUpdate from cloudmesh.common.debug import VERBOSE class WorkFlowDB(object): def __init__(self, name="workflow", active=False): self.database = CmDatabase() ...
cloudmesh/cloudmesh-flow
cloudmesh/flow/FlowRunner.py
from cloudmesh.flow.Flow import FlowDatabase import subprocess import time import json import webbrowser from cloudmesh.common.console import Console import sys class FlowRunner(object): def __init__(self, flowname, filename=None): self.filename = filename or f"{flowname}-flow.py" self.flowname = ...
aTeK7/deep-stereo1.4
prio_queue_test.py
<reponame>aTeK7/deep-stereo1.4 import multiprocessing import os import time #processing queue input_queue = multiprocessing.Queue(maxsize=5) output_queue = multiprocessing.Queue(maxsize=5) def worker_main(in_queue, out_queue): #print os.getpid(),"working" while True: item = in_queue.get(True) ...
aTeK7/deep-stereo1.4
old/homography.py
import cv2 import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D img = cv2.imread('beach.jpg') rows, cols, ch = img.shape # CAM0 rotation R = np.array([[0.949462, 0.046934, 0.310324], [-0.042337, 0.998867, -0.021532], [-0.310985, 0.007308, 0.950373]]) ...
aTeK7/deep-stereo1.4
reprojection/process_video.py
from PIL import Image from yuv_reader import YUVReader from reprojection import Reprojection from optparse import OptionParser from six.moves import cPickle import matplotlib.pyplot as plt import numpy as np import os from dataset_preparation.ballet_camera import BalletCamera def main(): parser = OptionParser() ...
aTeK7/deep-stereo1.4
dataset_preparation/kitti_camera.py
from reprojection.camera import Camera import os import numpy as np class KittiCamera: def __init__(self, calibration_path, poses_path): self.calibration_path = calibration_path self.poses_path = poses_path self.rotations = {} self.translations = {} self.intrinsics = {} ...
aTeK7/deep-stereo1.4
reprojection/yuv_reader.py
import numpy as np class YUVReader(object): def __init__(self, file, size): self.width = size[0] self.height = size[1] self.fd = open(file, 'rb') self.plane_size = self.width * self.height bitsPerPixel = 12 self.frame_size = self.plane_size * bitsPerPixel / 8 ...
aTeK7/deep-stereo1.4
tf_deep_stereo/shared.py
import tensorflow as tf import numpy as np from sklearn import preprocessing import math def conv_relu(input, size, depth, in_depth=None): # Create variable named "weights". # http://stats.stackexchange.com/questions/47590/what-are-good-initial-weights-in-a-neural-network sqared = math.sqrt(size*size) ...
aTeK7/deep-stereo1.4
tf_deep_stereo/tf_samplegraph.py
import tensorflow as tf import os import socket from datetime import datetime import traceback from tf_deep_stereo.shared import conv_relu import matplotlib.image as mpimg import numpy as np def inference_graph(): with tf.name_scope("inputs"): input1 = tf.placeholder(tf.float32, name='inputpicture0', shap...
aTeK7/deep-stereo1.4
tf_deep_stereo/select_tower.py
import tensorflow as tf from shared import input_definition, conv_relu, input_structure def select_tower(input, num_planes=96): plane_concats = [] with tf.variable_scope("select_tower"): with tf.variable_scope("input") as scope: for plane in range(num_planes): if plane == 1...
aTeK7/deep-stereo1.4
dataset_preparation/test_posed.py
import numpy as np np.set_printoptions(suppress=True) import unittest from kitti_camera import KittiCamera class CameraParserTest(unittest.TestCase): sequences_path = "/Volumes/Bahia/kitti-dataset/sequences" calibration_path = "/Volumes/Bahia/kitti-dataset/calibration" def test_posed_camera(self): ...
aTeK7/deep-stereo1.4
dataset_preparation/ballet_camera.py
from reprojection.camera import Camera import numpy as np class BalletCamera(Camera): def __init__(self, filename): """ [Image size:] 1024 768 [Rotation matrix:] 0.949462 0.046934 0.310324 -0.042337 0.998867 -0.021532 -0.310985 0.007308 0.950373 ...
aTeK7/deep-stereo1.4
old/load_camera.py
import numpy as np from enum import Enum from glumpy import gloo, glm import math from glumpy.transforms.rotate import _rotation np.set_printoptions(suppress=True) class CameraRigType(Enum): Left = "1-Left" Virtual = "2-Virtual" Right = "3-Right" class Camera(object): def __init__(self, intrinsics, ...