latest pushes
This commit is contained in:
2
Package/python/publish.sh
Executable file
2
Package/python/publish.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
python setup.py sdist
|
||||
twine upload dist/*
|
43
Package/python/setup.py
Normal file
43
Package/python/setup.py
Normal file
@@ -0,0 +1,43 @@
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
with open("../../README.md", "r", encoding="utf-8") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setup(
|
||||
name="bellande_probability",
|
||||
version="0.0.3",
|
||||
description="Robots Probability",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
author="RonaldsonBellande",
|
||||
author_email="ronaldsonbellande@gmail.com",
|
||||
packages=find_packages(where="src"),
|
||||
package_dir={"": "src"},
|
||||
include_package_data=True,
|
||||
install_requires=[
|
||||
"numpy",
|
||||
],
|
||||
classifiers=[
|
||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||
"Programming Language :: Python",
|
||||
],
|
||||
keywords=["package", "setuptools"],
|
||||
python_requires=">=3.0",
|
||||
extras_require={
|
||||
"dev": ["pytest", "pytest-cov[all]", "mypy", "black"],
|
||||
},
|
||||
package_data={
|
||||
'bellande_probability': ['Bellande_Probability'],
|
||||
},
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'bellande_probability_api = bellande_probability.bellande_probability_api:main',
|
||||
],
|
||||
},
|
||||
project_urls={
|
||||
"Home": "https://github.com/Robotics-Sensors/bellande_probability",
|
||||
"Homepage": "https://github.com/Robotics-Sensors/bellande_probability",
|
||||
"documentation": "https://github.com/Robotics-Sensors/bellande_probability",
|
||||
"repository": "https://github.com/Robotics-Sensors/bellande_probability",
|
||||
},
|
||||
)
|
1
Package/python/src/.gitignore
vendored
Normal file
1
Package/python/src/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
bellande_probability.egg-info
|
0
Package/python/src/__init__.py
Normal file
0
Package/python/src/__init__.py
Normal file
3
Package/python/src/bellande_probabilistic/__init__.py
Normal file
3
Package/python/src/bellande_probabilistic/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
"""
|
||||
ros_extension
|
||||
"""
|
@@ -0,0 +1,81 @@
|
||||
# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#!/usr/bin/env python3
|
||||
import requests
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
|
||||
def make_bellande_probability_distribution_request(mu_func, sigma_func, x, dimensions, full_auth=False):
|
||||
base_url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Probability"
|
||||
|
||||
endpoint = f"{base_url}/bellande_probability_full_auth" if full_auth else \
|
||||
f"{base_url}/bellande_probability"
|
||||
|
||||
# Convert string input to list if it's a string
|
||||
if isinstance(x, str):
|
||||
x = json.loads(x)
|
||||
|
||||
auth = {
|
||||
"full_authorization_key": "bellande_web_api_full_auth"
|
||||
} if full_auth else {
|
||||
"authorization_key": "bellande_web_api_opensource"
|
||||
}
|
||||
|
||||
payload = {
|
||||
"mu_func": mu_func,
|
||||
"sigma_func": sigma_func,
|
||||
"x": x,
|
||||
"dimensions": dimensions,
|
||||
"auth": auth
|
||||
}
|
||||
|
||||
headers = {
|
||||
'accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.post(endpoint, json=payload, headers=headers)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
except requests.RequestException as e:
|
||||
print(f"Error making request: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Run Bellande Distribution API")
|
||||
parser.add_argument("--mu-func", required=True, help="mu function as string")
|
||||
parser.add_argument("--sigma-func", required=True, help="sigma function as string")
|
||||
parser.add_argument("--x", required=True, help="Input vector as JSON-formatted list")
|
||||
parser.add_argument("--dimensions", type=int, required=True, help="Number of dimensions")
|
||||
parser.add_argument("--full-auth", action="store_true", help="Use full authentication")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
result = make_bellande_probability_distribution_request(
|
||||
args.mu_func,
|
||||
args.sigma_func,
|
||||
args.x,
|
||||
args.dimensions,
|
||||
args.full_auth
|
||||
)
|
||||
|
||||
print(json.dumps(result, indent=2))
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"Error: Invalid JSON format in input - {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user