From 00b1496d81bbea2e6e8958bfca7a34635a02e60a Mon Sep 17 00:00:00 2001 From: jonathanzopes Date: Mon, 15 Aug 2022 11:16:43 +0200 Subject: [PATCH 1/2] Exclude mac files from codespell. --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index db1899f74..44ebf4900 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,6 +19,7 @@ repos: rev: v2.1.0 hooks: - id: codespell + exclude: .mac # For now we disable some of these checks, can be reenabled later # - repo: https://github.com/pycqa/pydocstyle From 635bf2122d1547fa4e345b608177e086a772044b Mon Sep 17 00:00:00 2001 From: jonathanzopes Date: Mon, 15 Aug 2022 12:04:16 +0200 Subject: [PATCH 2/2] Working on style. --- ansys/rep/client/auth/authenticate.py | 13 +++++--- ansys/rep/client/auth/client.py | 2 +- ansys/rep/client/exceptions.py | 10 ++++-- ansys/rep/client/jms/client.py | 27 ++++++++++----- ansys/rep/client/jms/resource/algorithm.py | 2 +- ansys/rep/client/jms/resource/base.py | 6 ++-- ansys/rep/client/jms/resource/file.py | 3 +- .../client/jms/resource/fitness_definition.py | 33 ++++++++++++++----- ansys/rep/client/jms/resource/job.py | 2 +- .../rep/client/jms/resource/job_definition.py | 10 ++++-- .../client/jms/resource/license_context.py | 4 ++- .../jms/resource/parameter_definition.py | 23 +++++++++---- .../client/jms/resource/parameter_mapping.py | 4 ++- ansys/rep/client/jms/resource/project.py | 3 +- ansys/rep/client/jms/resource/selection.py | 2 +- ansys/rep/client/jms/resource/task.py | 2 +- .../client/jms/resource/task_definition.py | 3 +- .../jms/resource/task_definition_template.py | 4 ++- ansys/rep/client/jms/schema/algorithm.py | 3 +- ansys/rep/client/jms/schema/base.py | 3 +- ansys/rep/client/jms/schema/evaluator.py | 12 ++++--- ansys/rep/client/jms/schema/file.py | 11 +++++-- ansys/rep/client/jms/schema/job.py | 13 +++++--- ansys/rep/client/jms/schema/job_definition.py | 3 +- .../client/jms/schema/parameter_definition.py | 4 ++- .../client/jms/schema/parameter_mapping.py | 3 +- ansys/rep/client/jms/schema/selection.py | 3 +- ansys/rep/client/jms/schema/task.py | 7 ++-- doc/source/conf.py | 6 ++-- examples/add_num_cores_to_wb_project.py | 5 +-- .../authorization_grant.py | 11 +++++-- .../python_linked_multi_process_step/eval.py | 4 --- examples/python_multi_process_step/eval.py | 14 ++++---- .../python_multi_process_step/task_files.py | 3 +- .../python_two_bar_truss_problem/evaluate.py | 1 - setup.py | 3 +- tests/auth/test_authenticate.py | 2 -- tests/auth/test_client.py | 4 --- tests/jms/test_algorithms.py | 3 -- tests/jms/test_client.py | 9 ++--- tests/jms/test_configurations.py | 7 +--- tests/jms/test_connection.py | 3 -- tests/jms/test_design_points.py | 1 - tests/jms/test_evaluators.py | 1 - tests/jms/test_fitness_definition.py | 2 -- tests/jms/test_parameter_definitions.py | 2 -- tests/jms/test_project_permissions.py | 2 -- tests/jms/test_projects.py | 1 - tests/jms/test_task_definition_templates.py | 6 ++-- tests/jms/test_task_files.py | 7 ++-- tests/jms/test_tasks.py | 10 +++--- tests/rep_test.py | 8 ++--- tests/test_exceptions.py | 5 +-- 53 files changed, 198 insertions(+), 137 deletions(-) diff --git a/ansys/rep/client/auth/authenticate.py b/ansys/rep/client/auth/authenticate.py index 276a2ee05..a1bbf4264 100644 --- a/ansys/rep/client/auth/authenticate.py +++ b/ansys/rep/client/auth/authenticate.py @@ -60,7 +60,8 @@ def get_oidc_response( if r.status_code != 200: raise RuntimeError( - f"Failed to retrieve access token for client {client_id} from {token_url} using {grant_type} grant, status code {r.status_code}: {r.content.decode()}" + f"""Failed to retrieve access token for client {client_id} from {token_url} + using {grant_type} grant, status code {r.status_code}: {r.content.decode()}""" ) return r.json() @@ -88,7 +89,8 @@ def authenticate( password (str): Password refresh_token (str, optional): Refresh token. timeout (float, optional): Timeout in seconds. Defaults to 10. - scope (str, optional): String containing one or more requested scopes. Defaults to 'dps dpdb ansft monitor'. + scope (str, optional): String containing one or more requested scopes. + Defaults to 'dps dpdb ansft monitor'. client_id (str, optional): The client type. Defaults to 'external'. Returns: @@ -129,7 +131,8 @@ def authenticate( raise_for_status(r) # if r.status_code != 200: - # # raise ClientError(f"Failed to retrieve access token for client {client_id} from {token_url} using {grant_type} grant, status code {r.status_code}: {r.content.decode()}", **d) + # raise ClientError(f"Failed to retrieve access token for client {client_id} from + # {token_url} using {grant_type} grant, status code {r.status_code}: {r.content.decode()}", **d) return r.json() @@ -151,7 +154,9 @@ def authenticate( # with requests.Session() as session: # # Disable SSL certificate verification and warnings about it # session.verify = False - # requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning) + # requests.packages.urllib3.disable_warnings( + # requests.packages.urllib3.exceptions.InsecureRequestWarning + # ) # # Set basic content type # session.headers.update({'content-type': 'application/x-www-form-urlencoded'}) diff --git a/ansys/rep/client/auth/client.py b/ansys/rep/client/auth/client.py index 33c3801f9..03cca9214 100644 --- a/ansys/rep/client/auth/client.py +++ b/ansys/rep/client/auth/client.py @@ -18,7 +18,7 @@ class Client(object): Users with admin rights (such as the default ``repadmin`` user) can create new users as well as modify or delete existing ones. Non-admin users are only allowed - to query the list of exisiting users. + to query the list of existing users. Args: rep_url (str): The base path for the server to call, e.g. "https://127.0.0.1/dcs". diff --git a/ansys/rep/client/exceptions.py b/ansys/rep/client/exceptions.py index 33a791703..332144d2c 100644 --- a/ansys/rep/client/exceptions.py +++ b/ansys/rep/client/exceptions.py @@ -11,13 +11,16 @@ class REPError(RequestException): def __init__(self, *args, **kwargs): - """Base class for all rep related errors. Derives from :class:`requests.exceptions.RequestException`. + """Base class for all rep related errors. + Derives from :class:`requests.exceptions.RequestException`. Example: >>> from ansys.rep.client import REPError >>> from ansys.rep.client.jms import Client >>> try: - >>> client = Client(rep_url="https://127.0.0.1/dcs/", username="repadmin", password="wrong_psw") + >>> client = Client(rep_url="https://127.0.0.1/dcs/", + username="repadmin", + password="wrong_psw") >>> except REPError as e: >>> print(e) 400 Client Error: invalid_grant for: POST https://127.0.0.1/dcs/auth/api/oauth/token @@ -41,7 +44,8 @@ def __init__(self, *args, **kwargs): def raise_for_status(response, *args, **kwargs): - """Hook function to automatically check HTTP errors. Mimics requests.Response.raise_for_status()""" + """Hook function to automatically check HTTP errors. + Mimics requests.Response.raise_for_status()""" if 400 <= response.status_code < 600: r_content = {} diff --git a/ansys/rep/client/jms/client.py b/ansys/rep/client/jms/client.py index 4fd8c85aa..8879f67f4 100644 --- a/ansys/rep/client/jms/client.py +++ b/ansys/rep/client/jms/client.py @@ -31,7 +31,8 @@ class Client(object): """A python interface to the Design Point Service API. - Uses the provided credentials to create and store an authorized :class:`requests.Session` object. + Uses the provided credentials to create and store + an authorized :class:`requests.Session` object. The following authentication workflows are supported: @@ -42,7 +43,8 @@ class Client(object): - Access token: no authentication needed. Args: - rep_url (str): The base path for the server to call, e.g. "https://127.0.0.1/dcs". + rep_url (str): The base path for the server to call, + e.g. "https://127.0.0.1/dcs". username (str): Username (Optional) password (str): Password (Optional) refresh_token (str): Refresh Token (Optional) @@ -105,7 +107,8 @@ def __init__( self._unauthorized_max_retry = 1 def _auto_refresh_token(self, response, *args, **kwargs): - """Hook function to automatically refresh the access token and re-send the request in case of unauthorized error""" + """Hook function to automatically refresh the access token and + re-send the request in case of unauthorized error""" if ( response.status_code == 401 and self.unauthorized_num_retry < self._unauthorized_max_retry @@ -160,9 +163,11 @@ def archive_project(self, project, path, include_job_files=True): """Archive an existing project and save it to disk Args: - project (:class:`ansys.rep.client.jms.Project`): A Project object (only the id field is needed). + project (:class:`ansys.rep.client.jms.Project`): A Project object + (only the id field is needed). path (str): Where to save the archive locally. - include_job_files (bool, optional): Whether to include design point files in the archive. True by default. + include_job_files (bool, optional): Whether to include design point files in the + archive. True by default. Returns: str: The path to the archive. @@ -190,14 +195,16 @@ def update_evaluators(self, evaluators, as_objects=True): return update_evaluators(self, evaluators, as_objects=as_objects) def get_task_definition_templates(self, as_objects=True, **query_params): - """Return a list of task definition templates, optionally filtered by given query parameters""" + """Return a list of task definition templates, + optionally filtered by given query parameters""" return get_task_definition_templates(self, as_objects=as_objects, **query_params) def create_task_definition_templates(self, templates): """Create new task definition templates Args: - templates (list of :class:`ansys.rep.client.jms.TaskDefinitionTemplate`): A list of task definition templates + templates (list of :class:`ansys.rep.client.jms.TaskDefinitionTemplate`): + A list of task definition templates """ return create_task_definition_templates(self, templates) @@ -205,7 +212,8 @@ def update_task_definition_templates(self, templates): """Update existing task definition templates Args: - templates (list of :class:`ansys.rep.client.jms.TaskDefinitionTemplate`): A list of task definition templates + templates (list of :class:`ansys.rep.client.jms.TaskDefinitionTemplate`): + A list of task definition templates """ return update_task_definition_templates(self, templates) @@ -213,6 +221,7 @@ def delete_task_definition_templates(self, templates): """Delete existing task definition templates Args: - templates (list of :class:`ansys.rep.client.jms.TaskDefinitionTemplate`): A list of task definition templates + templates (list of :class:`ansys.rep.client.jms.TaskDefinitionTemplate`): + A list of task definition templates """ return delete_task_definition_templates(self, templates) diff --git a/ansys/rep/client/jms/resource/algorithm.py b/ansys/rep/client/jms/resource/algorithm.py index b05f889d0..c551ab711 100644 --- a/ansys/rep/client/jms/resource/algorithm.py +++ b/ansys/rep/client/jms/resource/algorithm.py @@ -19,7 +19,7 @@ class Algorithm(Object): """Algorithm resource. Args: - project (:class:`ansys.rep.client.jms.Project`, optional): A Project object. Defaults to None. + project (:class:`ansys.rep.client.jms.Project`, optional): Project object. Defaults to None. **kwargs: Arbitrary keyword arguments, see the Algorithm schema below. Example: diff --git a/ansys/rep/client/jms/resource/base.py b/ansys/rep/client/jms/resource/base.py index c7d12f98e..06476aa58 100644 --- a/ansys/rep/client/jms/resource/base.py +++ b/ansys/rep/client/jms/resource/base.py @@ -45,7 +45,8 @@ def __init__(self, **kwargs): # If property k is provided as init parameter if k in kwargs.keys(): setattr(self, k, kwargs[k]) - # Else we set it this value as missing. That way marshmallow will ignore it on serialization + # Else we set it this value as missing. + # That way marshmallow will ignore it on serialization elif not hasattr(self, k): setattr(self, k, missing) @@ -54,7 +55,8 @@ def __repr__(self): self.__class__.__name__, ",".join(["%s=%r" % (k, getattr(self, k)) for k in self.declared_fields()]), ) - # return "%s(%s)" % (self.__class__.__name__, ",".join(["%s=%r" %(k,v) for k,v in self.__dict__.items()]) ) + # return "%s(%s)" % (self.__class__.__name__, + # ",".join(["%s=%r" %(k,v) for k,v in self.__dict__.items()]) ) def __str__(self): return "%s(\n%s\n)" % ( diff --git a/ansys/rep/client/jms/resource/file.py b/ansys/rep/client/jms/resource/file.py index e70c01e35..a61692250 100644 --- a/ansys/rep/client/jms/resource/file.py +++ b/ansys/rep/client/jms/resource/file.py @@ -21,7 +21,8 @@ class File(Object): """File resource. Args: - project (:class:`ansys.rep.client.jms.Project`, optional): A project resource. Defaults to None. + project (:class:`ansys.rep.client.jms.Project`, optional): Project resource. + Defaults to None. src (str, optional): Path to the local file. Defaults to None. **kwargs: Arbitrary keyword arguments, see the File schema below. diff --git a/ansys/rep/client/jms/resource/fitness_definition.py b/ansys/rep/client/jms/resource/fitness_definition.py index 3e348966c..b4faee72f 100644 --- a/ansys/rep/client/jms/resource/fitness_definition.py +++ b/ansys/rep/client/jms/resource/fitness_definition.py @@ -28,14 +28,25 @@ class FitnessTermDefinition(Object): Example: >>> # A fitness term of type objective - >>> ft1 = FitnessTermDefinition(name="weight", type="design_objective", weighting_factor=1.0, - expression="map_design_objective( values['weight'], 7.5, 5.5)") + >>> ft1 = FitnessTermDefinition(name="weight", + type="design_objective", + weighting_factor=1.0, + expression="map_design_objective(values['weight'],7.5,5.5)" + ) >>> # A fitness term of type target constraint - >>> ft2 = FitnessTermDefinition(name="torsional_stiffness", type="target_constraint", weighting_factor=0.8, - expression="map_target_constraint( values['torsion_stiffness'], 1313.0, 5.0, 30.0 )" ) + >>> ft2 = FitnessTermDefinition(name="torsional_stiffness", + type="target_constraint", + weighting_factor=0.8, + expression="map_target_constraint( + values['torsion_stiffness'], 1313.0, 5.0, 30.0)" + ) >>> # A fitness term of type limit constraint - >>> ft3 = FitnessTermDefinition(name="max_stress", type="limit_constraint", weighting_factor=0.6, - expression="map_limit_constraint( values['max_stress'], 451.0, 50.0 )") + >>> ft3 = FitnessTermDefinition(name="max_stress", + type="limit_constraint", + weighting_factor=0.6, + expression="map_limit_constraint( + values['max_stress'], 451.0, 50.0 )" + ) """ class Meta: @@ -59,8 +70,14 @@ class FitnessDefinition(Object): >>> fd = FitnessDefinition(error_fitness=10.0) >>> fd.add_fitness_term(name="weight", type="design_objective", weighting_factor=1.0, expression="map_design_objective( values['weight'], 7.5, 5.5)") - >>> fd.add_fitness_term(name="torsional_stiffness", type="target_constraint", weighting_factor=1.0, - expression="map_target_constraint( values['torsion_stiffness'], 1313.0, 5.0, 30.0 )" ) + >>> fd.add_fitness_term(name="torsional_stiffness", + type="target_constraint", + weighting_factor=1.0, + expression="map_target_constraint( + values['torsion_stiffness'], + 1313.0, + 5.0, + 30.0 )" ) The FitnessDefinition schema has the following fields: diff --git a/ansys/rep/client/jms/resource/job.py b/ansys/rep/client/jms/resource/job.py index fad047d9e..bf20657cf 100644 --- a/ansys/rep/client/jms/resource/job.py +++ b/ansys/rep/client/jms/resource/job.py @@ -19,7 +19,7 @@ class Job(Object): """Job resource. Args: - project (:class:`ansys.rep.client.jms.Project`, optional): A Project object. Defaults to None. + project (:class:`ansys.rep.client.jms.Project`, optional): Project object. Defaults to None. **kwargs: Arbitrary keyword arguments, see the Job schema below. Example: diff --git a/ansys/rep/client/jms/resource/job_definition.py b/ansys/rep/client/jms/resource/job_definition.py index dec0190e2..690c250f4 100644 --- a/ansys/rep/client/jms/resource/job_definition.py +++ b/ansys/rep/client/jms/resource/job_definition.py @@ -18,13 +18,17 @@ class JobDefinition(Object): """JobDefinition resource. Args: - project (:class:`ansys.rep.client.jms.Project`, optional): A Project object. Defaults to None. + project (:class:`ansys.rep.client.jms.Project`, optional): A Project object. + Defaults to None. **kwargs: Arbitrary keyword arguments, see the JobDefinition schema below. Example: >>> job_def = JobDefinition(name="JobDefinition.1", active=True) - >>> job_def.add_float_parameter_definition(name='tube_radius', lower_limit=4.0, upper_limit=20.0,default=12.0 ) + >>> job_def.add_float_parameter_definition(name='tube_radius', + lower_limit=4.0, + upper_limit=20.0, + default=12.0 ) The JobDefinition schema has the following fields: @@ -41,7 +45,7 @@ def __init__(self, project=None, **kwargs): super(JobDefinition, self).__init__(**kwargs) def get_jobs(self, **query_params): - """Return a list of desing points, optionally filtered by given query parameters""" + """Return a list of design points, optionally filtered by given query parameters""" return get_objects(self.project, Job, job_definition=self, **query_params) def create_jobs(self, jobs): diff --git a/ansys/rep/client/jms/resource/license_context.py b/ansys/rep/client/jms/resource/license_context.py index 46181ffcc..890bf6c58 100644 --- a/ansys/rep/client/jms/resource/license_context.py +++ b/ansys/rep/client/jms/resource/license_context.py @@ -20,7 +20,9 @@ class LicenseContext(Object): Example: >>> lc = LicenseContext( - environment={"ANSYS_HPC_PARAMETRIC_ID": "my_id", "ANSYS_HPC_PARAMETRIC_SERVER":"my_server" }) + environment={"ANSYS_HPC_PARAMETRIC_ID": "my_id", + "ANSYS_HPC_PARAMETRIC_SERVER":"my_server" } + ) ) The LicenseContext schema has the following fields: diff --git a/ansys/rep/client/jms/resource/parameter_definition.py b/ansys/rep/client/jms/resource/parameter_definition.py index ad3da9da0..46bedf2f8 100644 --- a/ansys/rep/client/jms/resource/parameter_definition.py +++ b/ansys/rep/client/jms/resource/parameter_definition.py @@ -39,10 +39,13 @@ class FloatParameterDefinition(ParameterDefinition): Example: - >>> # A continuos parameter - >>> pd1 = FloatParameterDefinition(name='param_1', lower_limit=4.0, upper_limit=20.0, default=12.0 ) + >>> # A continuous parameter + >>> pd1 = FloatParameterDefinition(name='param_1', lower_limit=4.0, + upper_limit=20.0, default=12.0) >>> # In case of e.g. a manifacturing variable which can only take some values - >>> pd2 = FloatParameterDefinition(name='param_2', value_list=[4.7, 12.0, 15.5, 20.0], default=12.0) + >>> pd2 = FloatParameterDefinition(name='param_2', + value_list=[4.7, 12.0, 15.5, 20.0], + default=12.0) The FloatParameterDefinition schema has the following fields: @@ -68,8 +71,14 @@ class IntParameterDefinition(ParameterDefinition): Example: - >>> pd1 = IntParameterDefinition(name='ply_angle', value_list=[-60, -45, 0, 45, 60], default=0) - >>> pd2 = IntParameterDefinition(name='number_of_layers', lower_limit=1, upper_limit=5, default=2, step=1) + >>> pd1 = IntParameterDefinition(name='ply_angle', + value_list=[-60, -45, 0, 45, 60], + default=0) + >>> pd2 = IntParameterDefinition(name='number_of_layers', + lower_limit=1, + upper_limit=5, + default=2, + step=1) The IntParameterDefinition schema has the following fields: @@ -117,7 +126,9 @@ class StringParameterDefinition(ParameterDefinition): Example: - >>> pd = StringParameterDefinition(name='DiameterDistribution', value_list=['Constant', 'Uniform', 'Log-Normal'], default='Constant') + >>> pd = StringParameterDefinition(name='DiameterDistribution', + value_list=['Constant', 'Uniform', 'Log-Normal'], + default='Constant') The StringParameterDefinition schema has the following fields: diff --git a/ansys/rep/client/jms/resource/parameter_mapping.py b/ansys/rep/client/jms/resource/parameter_mapping.py index 5752b875a..2b0d43eb0 100644 --- a/ansys/rep/client/jms/resource/parameter_mapping.py +++ b/ansys/rep/client/jms/resource/parameter_mapping.py @@ -21,7 +21,9 @@ class ParameterMapping(Object): Example: - >>> pl = ParameterMapping(key_string='radius(0)', tokenizer="=", parameter_definition_name="tube_radius") + >>> pl = ParameterMapping(key_string='radius(0)', + tokenizer="=", + parameter_definition_name="tube_radius") The ParameterMapping schema has the following fields: diff --git a/ansys/rep/client/jms/resource/project.py b/ansys/rep/client/jms/resource/project.py index dd1bd833d..727942060 100644 --- a/ansys/rep/client/jms/resource/project.py +++ b/ansys/rep/client/jms/resource/project.py @@ -479,7 +479,8 @@ def _monitor_operation(client, location, interval=1.0): op = r.json()["operations"][0] done = op["finished"] log.info( - f"Operation {op['name']} - progress={op['progress'] * 100.0}%, succeded={op['succeeded']}, finished={op['finished']}" + f"""Operation {op['name']} - progress={op['progress'] * 100.0}%, + succeeded={op['succeeded']}, finished={op['finished']}""" ) time.sleep(interval) diff --git a/ansys/rep/client/jms/resource/selection.py b/ansys/rep/client/jms/resource/selection.py index 9780bcd60..bfa2a70c6 100644 --- a/ansys/rep/client/jms/resource/selection.py +++ b/ansys/rep/client/jms/resource/selection.py @@ -19,7 +19,7 @@ class Selection(Object): """Selection resource. Args: - project (:class:`ansys.rep.client.jms.Project`, optional): A Project object. Defaults to None. + project (:class:`ansys.rep.client.jms.Project`, optional): Project object. Defaults to None. **kwargs: Arbitrary keyword arguments, see the Selection schema below. Example: diff --git a/ansys/rep/client/jms/resource/task.py b/ansys/rep/client/jms/resource/task.py index d6287ae83..78041e52a 100644 --- a/ansys/rep/client/jms/resource/task.py +++ b/ansys/rep/client/jms/resource/task.py @@ -17,7 +17,7 @@ class Task(Object): """Task resource. Args: - project (:class:`ansys.rep.client.jms.Project`, optional): A Project object. Defaults to None. + project (:class:`ansys.rep.client.jms.Project`, optional): Project object. Defaults to None. **kwargs: Arbitrary keyword arguments, see the Task schema below. The Task schema has the following fields: diff --git a/ansys/rep/client/jms/resource/task_definition.py b/ansys/rep/client/jms/resource/task_definition.py index 4e4e528c3..15a84f52d 100644 --- a/ansys/rep/client/jms/resource/task_definition.py +++ b/ansys/rep/client/jms/resource/task_definition.py @@ -112,7 +112,8 @@ class TaskDefinition(Object): name="MAPDL_run", application_name="ANSYS Mechanical APDL", application_version="20.1", - execution_command="%executable% -b -i %file:mac% -o file.out -np %resource:num_cores%", + execution_command="%executable% -b -i %file:mac% + -o file.out -np %resource:num_cores%", max_execution_time=20.0, cpu_core_usage=1, execution_level=0, diff --git a/ansys/rep/client/jms/resource/task_definition_template.py b/ansys/rep/client/jms/resource/task_definition_template.py index fac0b5b82..0f2c44a1b 100644 --- a/ansys/rep/client/jms/resource/task_definition_template.py +++ b/ansys/rep/client/jms/resource/task_definition_template.py @@ -25,7 +25,9 @@ class TaskDefinitionTemplate(Object): application_name="ANSYS Mechanical APDL", application_version="2022 R2", data = { - "execution_command": "%executable% -b -i %file:mac% -o file.out -np %resource:num_cores%", + "execution_command": "%executable% -b + -i %file:mac% -o file.out + -np %resource:num_cores%", "output_files": [ { "name": "out", diff --git a/ansys/rep/client/jms/schema/algorithm.py b/ansys/rep/client/jms/schema/algorithm.py index 98ae57565..0f6dd37df 100644 --- a/ansys/rep/client/jms/schema/algorithm.py +++ b/ansys/rep/client/jms/schema/algorithm.py @@ -30,6 +30,7 @@ class Meta(ObjectSchema.Meta): data = fields.String( allow_none=True, - description="Generic string field to hold arbitrary algorithm job_definition data, e.g. as JSON dict​ionary.", + description="""Generic string field to hold arbitrary algorithm job_definition data, + e.g. as JSON dict​ionary.""", ) job_ids = IdReferenceList("Job", attribute="jobs", description="List of design point IDs.") diff --git a/ansys/rep/client/jms/schema/base.py b/ansys/rep/client/jms/schema/base.py index a362eb37b..4c38cd9f1 100644 --- a/ansys/rep/client/jms/schema/base.py +++ b/ansys/rep/client/jms/schema/base.py @@ -25,5 +25,6 @@ class ObjectSchema(BaseSchema): id = fields.String( allow_none=True, attribute="id", - description="Unique ID to access the resource, generated internally by the server on creation.", + description="""Unique ID to access the resource, generated + internally by the server on creation.""", ) diff --git a/ansys/rep/client/jms/schema/evaluator.py b/ansys/rep/client/jms/schema/evaluator.py index d554b69ef..377de5d73 100644 --- a/ansys/rep/client/jms/schema/evaluator.py +++ b/ansys/rep/client/jms/schema/evaluator.py @@ -19,7 +19,8 @@ class Meta: ordered = True host_id = fields.String( - description="Unique identifier built from hardware information and selected job_definition details of an evaluator." + description="""Unique identifier built from hardware information and + selected job_definition details of an evaluator.""" ) name = fields.String(allow_none=True, description="Name of the evaluator.") hostname = fields.String( @@ -33,7 +34,8 @@ class Meta: ) project_server_select = fields.Bool( allow_none=True, - description="Whether the evaluator allows server-driven assignment of projects or uses it's own local settings.", + description="""Whether the evaluator allows server-driven assignment of projects or uses + it's own local settings.""", ) alive_update_interval = fields.Int( allow_none=True, @@ -42,7 +44,8 @@ class Meta: update_time = fields.DateTime( allow_none=True, load_only=True, - description="Last time the evaluator updated it's registration details. Used to check which evaluators are alive.", + description="""Last time the evaluator updated it's registration details. + Used to check which evaluators are alive.""", ) external_access_port = fields.Integer( allow_none=True, description="Port number for external access to the evaluator." @@ -57,5 +60,6 @@ class Meta: ) configuration = fields.Dict( allow_none=True, - description="Details of the evaluator configuration, including hardware info and available applications.", + description="""Details of the evaluator configuration, + including hardware info and available applications.""", ) diff --git a/ansys/rep/client/jms/schema/file.py b/ansys/rep/client/jms/schema/file.py index 1f91a7f4b..adc3edad5 100644 --- a/ansys/rep/client/jms/schema/file.py +++ b/ansys/rep/client/jms/schema/file.py @@ -19,7 +19,8 @@ class Meta(ObjectSchema.Meta): name = fields.String(description="Name of the file resource.") type = fields.String( allow_none=True, - description="Type of the file. This can be any string but using a correct media type for the given resource is advisable.", + description="""Type of the file. This can be any string but using a correct media + type for the given resource is advisable.""", ) storage_id = fields.String( allow_none=True, description="File's identifier in the (orthogonal) file storage system" @@ -42,7 +43,8 @@ class Meta(ObjectSchema.Meta): format = fields.String(allow_none=True) evaluation_path = fields.String( allow_none=True, - description="Relative path under which the file instance for a design point evaluation will be stored.", + description="""Relative path under which the file instance for a + design point evaluation will be stored.""", ) monitor = fields.Bool( @@ -53,7 +55,10 @@ class Meta(ObjectSchema.Meta): ) collect_interval = fields.Int( allow_none=True, - description="Collect frequency for a file with collect=True. Min value limited by the evaluator's settings. 0/None - let the evaluator decide, other value - interval in seconds", + description="""Collect frequency for a file with collect=True. + Min value limited by the evaluator's settings. + 0/None - let the evaluator decide, + other value - interval in seconds""", ) reference_id = IdReference( diff --git a/ansys/rep/client/jms/schema/job.py b/ansys/rep/client/jms/schema/job.py index e593fce63..b56ce0ce0 100644 --- a/ansys/rep/client/jms/schema/job.py +++ b/ansys/rep/client/jms/schema/job.py @@ -34,18 +34,22 @@ class Meta(ObjectSchema.Meta): allow_none=False, attribute="job_definition_id", referenced_class="JobDefinition", - description="ID of the linked job_definition, see :class:`ansys.rep.client.jms.JobDefinition`.", + description="""ID of the linked job_definition, + see :class:`ansys.rep.client.jms.JobDefinition`.""", ) priority = fields.Integer( allow_none=True, default=0, - description="Priority with which design points are evaluated. The default is 0, which is the highest priority. Assigning a higher value to a design point makes it a lower priority.", + description="""Priority with which design points are evaluated. The default is 0, + which is the highest priority. Assigning a higher value to a design + point makes it a lower priority.""", ) values = fields.Dict( keys=fields.String(), allow_none=True, - description="Dictionary with (name,value) pairs for all parameters defined in the linked job_definition.", + description="""Dictionary with (name,value) pairs for all parameters defined in the + linked job_definition.""", ) fitness = fields.Float(allow_none=True, description="Fitness value computed.") fitness_term_values = fields.Dict( @@ -60,7 +64,8 @@ class Meta(ObjectSchema.Meta): ) executed_task_definition_level = fields.Integer( allow_none=True, - description="Execution level of the last executed process step (-1 if none has been executed yet).", + description="""Execution level of the last executed + process step (-1 if none has been executed yet).""", ) creation_time = fields.DateTime( diff --git a/ansys/rep/client/jms/schema/job_definition.py b/ansys/rep/client/jms/schema/job_definition.py index d840c17b0..dacf67ac7 100644 --- a/ansys/rep/client/jms/schema/job_definition.py +++ b/ansys/rep/client/jms/schema/job_definition.py @@ -22,7 +22,8 @@ class Meta(ObjectSchema.Meta): name = fields.String(allow_none=True, description="Name of the job_definition") active = fields.Boolean( - description="Defines whether this is the active job_definition in the project where evaluators will evaluate pending design points" + description="""Defines whether this is the active job_definition in the + project where evaluators will evaluate pending design points""" ) creation_time = fields.DateTime( allow_none=True, diff --git a/ansys/rep/client/jms/schema/parameter_definition.py b/ansys/rep/client/jms/schema/parameter_definition.py index 3ef7241b8..5fc73964d 100644 --- a/ansys/rep/client/jms/schema/parameter_definition.py +++ b/ansys/rep/client/jms/schema/parameter_definition.py @@ -45,7 +45,9 @@ class Meta(ParameterDefinitionBaseSchema.Meta): upper_limit = fields.Float(allow_none=True, description="Upper bound for the parameter value.") step = fields.Float( allow_none=True, - description="If provided, allowable values are given by: AllowableValue = lower_limit + n * step, where n is an integer and AllowableValue <= upper_limit.", + description="""If provided, allowable values are given by: + AllowableValue = lower_limit + n * step, + where n is an integer and AllowableValue <= upper_limit.""", ) cyclic = fields.Bool(allow_none=True, description="Indicates if the parameter is cyclic.") value_list = fields.List( diff --git a/ansys/rep/client/jms/schema/parameter_mapping.py b/ansys/rep/client/jms/schema/parameter_mapping.py index ddc298ea5..8266891d5 100644 --- a/ansys/rep/client/jms/schema/parameter_mapping.py +++ b/ansys/rep/client/jms/schema/parameter_mapping.py @@ -35,7 +35,8 @@ class Meta(ObjectSchema.Meta): allow_none=True, attribute="parameter_definition_id", referenced_class="ParameterDefinition", - description="ID of the linked parameter definition, see :class:`ansys.rep.client.jms.ParameterDefinition`.", + description="""ID of the linked parameter definition, + see :class:`ansys.rep.client.jms.ParameterDefinition`.""", ) task_definition_property = fields.String(allow_none=True) file_id = IdReference( diff --git a/ansys/rep/client/jms/schema/selection.py b/ansys/rep/client/jms/schema/selection.py index e48324910..98242db0e 100644 --- a/ansys/rep/client/jms/schema/selection.py +++ b/ansys/rep/client/jms/schema/selection.py @@ -31,6 +31,7 @@ class Meta(ObjectSchema.Meta): allow_none=True, attribute="algorithm_id", referenced_class="DesignExplorationAlgorithm", - description="ID of the :class:`ansys.rep.client.jms.Algorithm` the selection belongs to (optional).", + description="""ID of the :class:`ansys.rep.client.jms.Algorithm` + the selection belongs to (optional).""", ) object_ids = IdReferenceList("Job", attribute="jobs", description="List of design point IDs.") diff --git a/ansys/rep/client/jms/schema/task.py b/ansys/rep/client/jms/schema/task.py index 66ccf729e..4a138a0a7 100644 --- a/ansys/rep/client/jms/schema/task.py +++ b/ansys/rep/client/jms/schema/task.py @@ -56,12 +56,15 @@ class Meta(ObjectSchema.Meta): allow_none=False, attribute="task_definition_id", referenced_class="TaskDefinition", - description="ID of the :class:`ansys.rep.client.jms.TaskDefinition` the task is linked to.", + description=( + "ID of the :class:`ansys.rep.client.jms.TaskDefinition` the task is linked to.", + ), ) task_definition_snapshot = fields.Nested( TaskDefinitionSchema, allow_none=True, - description="Snapshot of :class:`ansys.rep.client.jms.TaskDefinition` created when task status changes to prolog, before evaluation.", + description="""Snapshot of :class:`ansys.rep.client.jms.TaskDefinition` + created when task status changes to prolog, before evaluation.""", ) job_id = IdReference( diff --git a/doc/source/conf.py b/doc/source/conf.py index ad3b83243..697c9e1cd 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -338,11 +338,13 @@ extlinks = { "ansys_dcs_help": ( - "https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v231/en/dps_ug/%s.html", + """https://ansyshelp.ansys.com/account/ + secured?returnurl=/Views/Secured/corp/v231/en/dps_ug/%s.html""", "ANSYS Help - ", ), "ansys_dcs_tutorial": ( - "https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v231/en/dcs_tut/%s.html", + """https://ansyshelp.ansys.com/account/ + secured?returnurl=/Views/Secured/corp/v231/en/dcs_tut/%s.html""", "DCS Tutorial - ", ), } diff --git a/examples/add_num_cores_to_wb_project.py b/examples/add_num_cores_to_wb_project.py index f514a03ce..a0e864267 100644 --- a/examples/add_num_cores_to_wb_project.py +++ b/examples/add_num_cores_to_wb_project.py @@ -6,11 +6,12 @@ # Author(s): O.Koenig # ---------------------------------------------------------- # -# Exemplary utility script that connects to a WB project and then adds a number_of_cores parameter location to to propagate the number to the input script. +# Exemplary utility script that connects to a WB project and then +# adds a number_of_cores parameter location to to propagate the +# number to the input script. # import logging -import os from ansys.rep.client import REPError from ansys.rep.client.jms import Client diff --git a/examples/authorization_grant/authorization_grant.py b/examples/authorization_grant/authorization_grant.py index 60a4085e4..797293f45 100644 --- a/examples/authorization_grant/authorization_grant.py +++ b/examples/authorization_grant/authorization_grant.py @@ -8,9 +8,14 @@ from authlib.jose import jwt import httpx -# Links: -# - Setting up google auth: http://www.mastertheboss.com/keycloak/google-social-login-with-keycloak/ -# - Setting up MS auth: https://www.grebintegration.dk/2021/03/07/microsoft-azure-active-directory-as-keycloak-identity-provider/ +""" +Links: +- Setting up google auth: +http://www.mastertheboss.com/keycloak/google-social-login-with-keycloak/ +- Setting up MS auth: +https://www.grebintegration.dk/2021/03/07/ +microsoft-azure-active-directory-as-keycloak-identity-provider/ +""" client_id = "rep-cli" scope = "openid" diff --git a/examples/python_linked_multi_process_step/eval.py b/examples/python_linked_multi_process_step/eval.py index 13383f65c..f2af394aa 100644 --- a/examples/python_linked_multi_process_step/eval.py +++ b/examples/python_linked_multi_process_step/eval.py @@ -9,14 +9,10 @@ """ """ import argparse -import datetime import json import logging import os -import re -import subprocess import sys -import time logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) diff --git a/examples/python_multi_process_step/eval.py b/examples/python_multi_process_step/eval.py index 8accc5f50..5c153ac36 100644 --- a/examples/python_multi_process_step/eval.py +++ b/examples/python_multi_process_step/eval.py @@ -21,7 +21,7 @@ color: color of the image to be written period [s]: period to wait before sending next log message duration [s]: the duration of the eval script in seconds -The ouput of the script is the number of steps (log-calls) calculated with: +The output of the script is the number of steps (log-calls) calculated with: ``` steps = duration // period ``` @@ -39,7 +39,6 @@ import json import logging import os -import re import subprocess import sys import time @@ -58,7 +57,7 @@ def main(input_file, task_definition, images, in_subscript): log = logging.getLogger() log.info("== Start Evaluation Task Definition ==") - # Flag to mark files comming from subscript + # Flag to mark files coming from subscript subs = "sub_" if in_subscript else "" # Read parameters @@ -168,7 +167,8 @@ def text(i, txt): "--images", action="store_true", default=False, - help="Enable if you want images to be generated. Needs PIL installed ( `pip install pillow` ) ", + help="""Enable if you want images to be generated. + Needs PIL installed ( `pip install pillow` ) """, ) parser.add_argument( "--in-subscript", @@ -197,10 +197,12 @@ def text(i, txt): # job_def.parameter_definition_ids = [o.id for o in params] # param_mappings = [ - # ParameterMapping(key_string='"start"', tokenizer=":", parameter_definition_id=params[0].id, file_id=file_ids['input']) + # ParameterMapping(key_string='"start"', tokenizer=":", + # parameter_definition_id=params[0].id, file_id=file_ids['input']) # ] # param_mappings.extend([ - # ParameterMapping(key_string='"product"', tokenizer=":", parameter_definition_id=params[i+1].id, file_id=file_ids[f'td{i}_result']) + # ParameterMapping(key_string='"product"', tokenizer=":", + # parameter_definition_id=params[i+1].id, file_id=file_ids[f'td{i}_result']) # for i in range(num_task_definitions) # ]) # param_mappings = proj.create_parameter_mappings(param_mappings) diff --git a/examples/python_multi_process_step/task_files.py b/examples/python_multi_process_step/task_files.py index 527a83906..f1c40264e 100644 --- a/examples/python_multi_process_step/task_files.py +++ b/examples/python_multi_process_step/task_files.py @@ -8,7 +8,8 @@ """ Update some task files (1) Create a new input file with changed data -(2) change parameter `CALL_SUBSCRIPT` to true in `eval.py` that the script is run as subscript with new input file +(2) change parameter `CALL_SUBSCRIPT` to true in `eval.py` + that the script is run as subscript with new input file (3) make sure that newly generated files are added as output of the process step """ import json diff --git a/examples/python_two_bar_truss_problem/evaluate.py b/examples/python_two_bar_truss_problem/evaluate.py index 137c3fc55..3d50f06e1 100644 --- a/examples/python_two_bar_truss_problem/evaluate.py +++ b/examples/python_two_bar_truss_problem/evaluate.py @@ -10,7 +10,6 @@ import json import math import os -import re import sys diff --git a/setup.py b/setup.py index 821979494..92316f8ad 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,8 @@ from setuptools import find_namespace_packages, setup -# We follow option 3 suggested by PyPA https://packaging.python.org/guides/single-sourcing-package-version/ +# We follow option 3 suggested by PyPA +# https://packaging.python.org/guides/single-sourcing-package-version/ # to get the package version. root = os.path.abspath(os.path.dirname(__file__)) about = {} diff --git a/tests/auth/test_authenticate.py b/tests/auth/test_authenticate.py index 020583a45..53de00f0b 100644 --- a/tests/auth/test_authenticate.py +++ b/tests/auth/test_authenticate.py @@ -6,8 +6,6 @@ # Author(s): O.Koenig # ---------------------------------------------------------- import logging -import sys -import unittest from ansys.rep.client.auth import authenticate from tests.rep_test import REPTestCase diff --git a/tests/auth/test_client.py b/tests/auth/test_client.py index c58b23102..52aaccf73 100644 --- a/tests/auth/test_client.py +++ b/tests/auth/test_client.py @@ -6,10 +6,6 @@ # Author(s): O.Koenig # ---------------------------------------------------------- import logging -import sys -import unittest - -import pytest from ansys.rep.client.auth import Client, User from tests.rep_test import REPTestCase diff --git a/tests/jms/test_algorithms.py b/tests/jms/test_algorithms.py index 9460f9ac0..a00060d6e 100644 --- a/tests/jms/test_algorithms.py +++ b/tests/jms/test_algorithms.py @@ -6,13 +6,10 @@ # Author(s): F.Negri # ---------------------------------------------------------- import logging -import sys import unittest -import urllib.parse from marshmallow.utils import missing -from ansys.rep.client.jms import Client from ansys.rep.client.jms.resource import Algorithm, Job, JobDefinition, Project, Selection from tests.rep_test import REPTestCase diff --git a/tests/jms/test_client.py b/tests/jms/test_client.py index 9fa8a4486..93c82a794 100644 --- a/tests/jms/test_client.py +++ b/tests/jms/test_client.py @@ -6,15 +6,11 @@ # Author(s): O.Koenig # ---------------------------------------------------------- import logging -import sys import time import unittest -import urllib.parse - -from marshmallow.utils import missing from ansys.rep.client.jms import Client -from ansys.rep.client.jms.resource import Job, JobDefinition, Project +from ansys.rep.client.jms.resource import Job, Project from tests.rep_test import REPTestCase log = logging.getLogger(__name__) @@ -50,7 +46,8 @@ def test_authentication_workflows(self): def test_client(self): # This test assumes that the project mapdl_motorbike_frame already exists on the DCS server. - # In case, you can create such project running the script examples/mapdl_motorbike_frame/project_setup.py + # In case, you can create such project running the script + # examples/mapdl_motorbike_frame/project_setup.py log.debug("=== Client ===") client = self.jms_client() diff --git a/tests/jms/test_configurations.py b/tests/jms/test_configurations.py index 364cc1635..5b41bfea2 100644 --- a/tests/jms/test_configurations.py +++ b/tests/jms/test_configurations.py @@ -1,11 +1,6 @@ import logging -import unittest -from marshmallow.utils import missing - -from ansys.rep.client.jms import Client -from ansys.rep.client.jms.resource import Job, JobDefinition, Project -from ansys.rep.client.jms.schema.job import JobSchema +from ansys.rep.client.jms.resource import JobDefinition, Project from tests.rep_test import REPTestCase log = logging.getLogger(__name__) diff --git a/tests/jms/test_connection.py b/tests/jms/test_connection.py index f9b8a3956..c04f5cb10 100644 --- a/tests/jms/test_connection.py +++ b/tests/jms/test_connection.py @@ -6,9 +6,6 @@ # Author(s): O.Koenig # ---------------------------------------------------------- import logging -import sys -import unittest -import urllib.parse from ansys.rep.client.auth import authenticate from ansys.rep.client.connection import create_session, ping diff --git a/tests/jms/test_design_points.py b/tests/jms/test_design_points.py index b82d35e55..52c256cf1 100644 --- a/tests/jms/test_design_points.py +++ b/tests/jms/test_design_points.py @@ -13,7 +13,6 @@ from examples.mapdl_motorbike_frame.project_setup import create_project from marshmallow.utils import missing -from ansys.rep.client.jms import Client from ansys.rep.client.jms.resource import Job, JobDefinition, Project from ansys.rep.client.jms.schema.job import JobSchema from tests.rep_test import REPTestCase diff --git a/tests/jms/test_evaluators.py b/tests/jms/test_evaluators.py index a9864d4ef..fe5aa0c7a 100644 --- a/tests/jms/test_evaluators.py +++ b/tests/jms/test_evaluators.py @@ -6,7 +6,6 @@ # Author(s): F.Negri # ---------------------------------------------------------- -import json import logging import unittest diff --git a/tests/jms/test_fitness_definition.py b/tests/jms/test_fitness_definition.py index c3f6cdbcc..48fec8c1f 100644 --- a/tests/jms/test_fitness_definition.py +++ b/tests/jms/test_fitness_definition.py @@ -6,9 +6,7 @@ # Author(s): F.Negri # ---------------------------------------------------------- import logging -import sys import unittest -import urllib.parse from marshmallow.utils import missing diff --git a/tests/jms/test_parameter_definitions.py b/tests/jms/test_parameter_definitions.py index 176ceaac7..276140bd0 100644 --- a/tests/jms/test_parameter_definitions.py +++ b/tests/jms/test_parameter_definitions.py @@ -6,9 +6,7 @@ # Author(s): F.Negri # ---------------------------------------------------------- import logging -import sys import unittest -import urllib.parse from marshmallow.utils import missing diff --git a/tests/jms/test_project_permissions.py b/tests/jms/test_project_permissions.py index cbc68bae1..ce42c185a 100644 --- a/tests/jms/test_project_permissions.py +++ b/tests/jms/test_project_permissions.py @@ -10,8 +10,6 @@ import unittest import uuid -import pytest - from ansys.rep.client.auth import Client as AuthClient from ansys.rep.client.auth import User from ansys.rep.client.exceptions import ClientError diff --git a/tests/jms/test_projects.py b/tests/jms/test_projects.py index c08b327db..ca1a9ad74 100644 --- a/tests/jms/test_projects.py +++ b/tests/jms/test_projects.py @@ -14,7 +14,6 @@ from examples.mapdl_motorbike_frame.project_setup import create_project from marshmallow.utils import missing -from ansys.rep.client.jms import Client from ansys.rep.client.jms.resource import JobDefinition, LicenseContext, Project from ansys.rep.client.jms.schema.project import ProjectSchema from tests.rep_test import REPTestCase diff --git a/tests/jms/test_task_definition_templates.py b/tests/jms/test_task_definition_templates.py index 86e62804f..278281318 100644 --- a/tests/jms/test_task_definition_templates.py +++ b/tests/jms/test_task_definition_templates.py @@ -27,7 +27,9 @@ def test_template_deserialization(self): "creation_time": "2021-09-16T12:27:44.771067+00:00", "name": "ANSYS Mechanical APDL 2021 R1 Default", "data": { - "execution_command": "%executable% -b nolist -i %file:dat% -o %file:out% -np %resource:num_cores% -dis -s noread -p ansys", + "execution_command": """%executable% -b nolist -i %file:dat% + -o %file:out% -np %resource:num_cores% + -dis -s noread -p ansys""", "software_requirements": [ { "name": "ANSYS Mechanical APDL", @@ -108,7 +110,7 @@ def test_template_integration(self): template = templates[0] self.assertEqual(template.name, template_name) - # Modifiy copied template + # Modify copied template template.data["software_requirements"][0]["version"] = "2.0.1" templates = client.update_task_definition_templates([template]) self.assertEqual(len(templates), 1) diff --git a/tests/jms/test_task_files.py b/tests/jms/test_task_files.py index df7066828..aa3b86888 100644 --- a/tests/jms/test_task_files.py +++ b/tests/jms/test_task_files.py @@ -12,10 +12,8 @@ import unittest from examples.mapdl_motorbike_frame.project_setup import create_project -from marshmallow.utils import missing -from ansys.rep.client.jms import Client -from ansys.rep.client.jms.resource import File, Task +from ansys.rep.client.jms.resource import File from tests.rep_test import REPTestCase log = logging.getLogger(__name__) @@ -36,7 +34,8 @@ def test_task_files_in_single_task_definition_project(self): ex_dir = os.path.join(cwd, "..", "..", "examples", "mapdl_motorbike_frame") log.info(f"example_dir: {ex_dir}") - # Create a modified MAPDL input file that reads an extra task file and writes out an extra result file + # Create a modified MAPDL input file that reads an extra task file + # and writes out an extra result file mac_file = proj.get_files(limit=1, content=True)[0] content = mac_file.content.decode("utf-8") lines = content.splitlines() diff --git a/tests/jms/test_tasks.py b/tests/jms/test_tasks.py index bf5cb4bca..69254a36e 100644 --- a/tests/jms/test_tasks.py +++ b/tests/jms/test_tasks.py @@ -12,10 +12,8 @@ import uuid from examples.mapdl_motorbike_frame.project_setup import create_project -from marshmallow.utils import missing -from ansys.rep.client.jms import Client -from ansys.rep.client.jms.resource import Job, JobDefinition, Project, Task, TaskDefinition +from ansys.rep.client.jms.resource import Job, JobDefinition, Project, TaskDefinition from ansys.rep.client.jms.schema.task import TaskSchema from tests.rep_test import REPTestCase @@ -96,8 +94,10 @@ def test_task_deserialization(self): def test_task_integration(self): - # This test assumes that the project mapdl_motorbike_frame already exists on the DCS server. - # In case, you can create such project running the script examples/mapdl_motorbike_frame/project_setup.py + # This test assumes that the project mapdl_motorbike_frame + # already exists on the DCS server. + # In case, you can create such project running the script + # examples/mapdl_motorbike_frame/project_setup.py client = self.jms_client() proj_name = "mapdl_motorbike_frame" diff --git a/tests/rep_test.py b/tests/rep_test.py index e7055b3b8..0aebb09f5 100644 --- a/tests/rep_test.py +++ b/tests/rep_test.py @@ -6,10 +6,8 @@ # Author(s): F.Negri # ---------------------------------------------------------- -import datetime import logging import os -import sys import unittest from ansys.rep.client.jms import Client @@ -31,9 +29,11 @@ def setUp(self): self.username = os.environ.get("REP_TEST_USERNAME") or "repadmin" self.password = os.environ.get("REP_TEST_PASSWORD") or "repadmin" - # Create a unique run_id (to be used when creating new projects) to avoid conflicts in case of + # Create a unique run_id (to be used when creating new projects) + # to avoid conflicts in case of # multiple builds testing against the same REP server. - # If tests are run on TFS we create this run_id combining the Agent.Id and Build.BuildId env variables. + # If tests are run on TFS we create this run_id combining the Agent.Id + # and Build.BuildId env variables. agent_id = os.environ.get("Agent.Id") if agent_id is None: if os.name == "nt": diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 042a4c1e0..b0ded3d26 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -6,12 +6,9 @@ # Author(s): F.Negri # ---------------------------------------------------------- import logging -import sys import unittest -from marshmallow.utils import missing - -from ansys.rep.client import APIError, ClientError, REPError +from ansys.rep.client import APIError, ClientError from ansys.rep.client.jms import Client from tests.rep_test import REPTestCase