<commit_before>import os
import numpy as np
import timeit

from pybotics import Robot


def load_robot():
    model_path = os.path.abspath(__file__)
    model_path = os.path.dirname(model_path)
    model_path = os.path.dirname(model_path)
    model_path = os.path.join(model_path, 'robot-models')
    model_path = os.path.join(model_path, 'ur10-mdh.csv')
    return Robot(np.loadtxt(model_path, delimiter=','))


def profile(robot: Robot):
    robot.random_joints()
    robot.fk()


R = load_robot()

if __name__ == '__main__':
    num_calls = int(1e6)
    time = timeit.timeit(stmt='profile(R)',
                         setup="from __main__ import profile, load_robot, R",
                         number=num_calls)
    print('Total time: {} s'.format(time))
    mean_time = time / num_calls
    print('Mean time: {} s'.format(mean_time))
    print('Mean time: {} ms'.format(mean_time * 1e3))<commit_msg>refactored profiling to pass vulture lint<commit_after>import os
import numpy as np
import timeit
import logging

from pybotics import Robot


def load_robot():
    model_path = os.path.abspath(__file__)
    model_path = os.path.dirname(model_path)
    model_path = os.path.dirname(model_path)
    model_path = os.path.join(model_path, 'robot-models')
    model_path = os.path.join(model_path, 'ur10-mdh.csv')
    return Robot(np.loadtxt(model_path, delimiter=','))


robot = load_robot()


def profile():
    robot.random_joints()
    robot.fk()


if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)

    logging.info('Profiling pybotics forward kinematics')
    profile()   # use method to avoid vulture linting error

    num_calls = int(1e6)
    logging.info('Number of calls:\t{}'.format(num_calls))

    time = timeit.timeit(stmt='profile()',
                         setup="from __main__ import profile",
                         number=num_calls)
    mean_time = time / num_calls

    logging.info('Total time:\t{} s'.format(time))
    logging.info('Mean time:\t{} s'.format(mean_time))
    logging.info('Mean time:\t{} ms'.format(mean_time * 1e3))
{'fraction_non_alphanumeric': 0.12974531475252282, 'fraction_numerical': 0.005766458433445459, 'mean_word_length': 3.3556485355648538, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4518089', 'n_tokens_mistral': 726, 'n_tokens_neox': 709, 'n_words': 145}