diff --git a/ansys/rep/client/__init__.py b/ansys/rep/client/__init__.py index edba0d9eb..f83d952d2 100644 --- a/ansys/rep/client/__init__.py +++ b/ansys/rep/client/__init__.py @@ -18,3 +18,4 @@ from .client import Client from .exceptions import APIError, ClientError, REPError from .jms import JmsApi, ProjectApi +from .warnings import UnverifiedHTTPSRequestsWarning diff --git a/ansys/rep/client/auth/schema/user.py b/ansys/rep/client/auth/schema/user.py index aebb079df..f2a9f7839 100644 --- a/ansys/rep/client/auth/schema/user.py +++ b/ansys/rep/client/auth/schema/user.py @@ -17,10 +17,14 @@ class Meta(BaseSchema.Meta): id = fields.String( load_only=True, - description="Unique user ID, generated internally by the server on creation.", + metadata={"description": "Unique user ID, generated internally by the server on creation."}, ) - username = fields.Str(description="Username.") - password = fields.Str(dump_only=True, description="Password.") - firstName = fields.Str(allow_none=True, description="First name", attribute="first_name") - lastName = fields.Str(allow_none=True, description="Last name", attribute="last_name") - email = fields.Str(allow_none=True, description="E-mail address (optional).") + username = fields.Str(metadata={"description": "Username."}) + password = fields.Str(dump_only=True, metadata={"description": "Password."}) + firstName = fields.Str( + allow_none=True, metadata={"description": "First name"}, attribute="first_name" + ) + lastName = fields.Str( + allow_none=True, metadata={"description": "Last name"}, attribute="last_name" + ) + email = fields.Str(allow_none=True, metadata={"description": "E-mail address (optional)."}) diff --git a/ansys/rep/client/client.py b/ansys/rep/client/client.py index b0d00c8d3..23e76d8b9 100644 --- a/ansys/rep/client/client.py +++ b/ansys/rep/client/client.py @@ -15,6 +15,7 @@ from .auth.authenticate import authenticate from .connection import create_session from .exceptions import raise_for_status +from .warnings import UnverifiedHTTPSRequestsWarning log = logging.getLogger(__name__) @@ -122,7 +123,7 @@ def __init__( f"Certificate verification is disabled. " f"Unverified HTTPS requests will be made to {self.rep_url}." ) - warnings.warn(msg, Warning) + warnings.warn(msg, UnverifiedHTTPSRequestsWarning) log.warning(msg) if disable_security_warnings: diff --git a/ansys/rep/client/jms/schema/algorithm.py b/ansys/rep/client/jms/schema/algorithm.py index 726a996e1..b9ffceb3a 100644 --- a/ansys/rep/client/jms/schema/algorithm.py +++ b/ansys/rep/client/jms/schema/algorithm.py @@ -17,12 +17,16 @@ class AlgorithmSchema(ObjectSchemaWithModificationInfo): class Meta(ObjectSchemaWithModificationInfo.Meta): pass - name = fields.String(allow_none=True, description="Name of the algorithm.") - description = fields.String(allow_none=True, description="Description of the algorithm.") + name = fields.String(allow_none=True, metadata={"description": "Name of the algorithm."}) + description = fields.String( + allow_none=True, metadata={"description": "Description of the algorithm."} + ) data = fields.String( allow_none=True, - description="Generic string field to hold arbitrary algorithm configuration data," - " e.g. as JSON dictionary.", + metadata={ + "description": "Generic string field to hold arbitrary algorithm configuration data," + " e.g. as JSON dictionary.", + }, ) - job_ids = IdReferenceList("Job", attribute="jobs", description="List of job IDs.") + job_ids = IdReferenceList("Job", attribute="jobs", metadata={"description": "List of job IDs."}) diff --git a/ansys/rep/client/jms/schema/file.py b/ansys/rep/client/jms/schema/file.py index d1fce207b..98069692c 100644 --- a/ansys/rep/client/jms/schema/file.py +++ b/ansys/rep/client/jms/schema/file.py @@ -17,14 +17,17 @@ class FileSchema(ObjectSchemaWithModificationInfo): class Meta(ObjectSchemaWithModificationInfo.Meta): pass - name = fields.String(description="Name of the file resource.") + name = fields.String(metadata={"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.", + metadata={ + "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" + allow_none=True, + metadata={"description": "File's identifier in the (orthogonal) file storage system"}, ) size = fields.Int(allow_none=True) @@ -38,25 +41,31 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): format = fields.String(allow_none=True) evaluation_path = fields.String( allow_none=True, - description="Relative path under which the file instance for a " - "job evaluation will be stored.", + metadata={ + "description": "Relative path under which the file instance for a " + "job evaluation will be stored.", + }, ) monitor = fields.Bool( - allow_none=True, description="Whether to live monitor the file's content." + allow_none=True, metadata={"description": "Whether to live monitor the file's content."} + ) + collect = fields.Bool( + allow_none=True, metadata={"description": "Whether file should be collected per job"} ) - collect = fields.Bool(allow_none=True, description="Whether file should be collected per job") 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", + metadata={ + "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( attribute="reference_id", referenced_class="File", allow_none=True, - description="Reference file from which this one was created", + metadata={"description": "Reference file from which this one was created"}, ) diff --git a/ansys/rep/client/jms/schema/fitness_definition.py b/ansys/rep/client/jms/schema/fitness_definition.py index 24c1677b8..20a45f0ab 100644 --- a/ansys/rep/client/jms/schema/fitness_definition.py +++ b/ansys/rep/client/jms/schema/fitness_definition.py @@ -18,16 +18,22 @@ class FitnessTermDefinitionSchema(ObjectSchema): class Meta(ObjectSchema.Meta): pass - name = fields.String(allow_none=True, description="Name of the fitness term.") + name = fields.String(allow_none=True, metadata={"description": "Name of the fitness term."}) expression = fields.String( - allow_none=True, description="The Python expression that defines the fitness term." + allow_none=True, + metadata={"description": "The Python expression that defines the fitness term."}, ) type = fields.String( - allow_none=True, validate=OneOf(fitness_term_types), description="Fitness term type." + allow_none=True, + validate=OneOf(fitness_term_types), + metadata={"description": "Fitness term type."}, ) weighting_factor = fields.Float( allow_none=True, - description="Relative importance of the fitness term in comparison to other fitness terms.", + metadata={ + "description": "Relative importance of the fitness " + "term in comparison to other fitness terms." + }, ) @@ -38,6 +44,8 @@ class Meta(ObjectSchema.Meta): fitness_term_definitions = fields.Nested( FitnessTermDefinitionSchema, many=True, - description="List of :class:`FitnessTermDefinition`.", + metadata={"description": "List of :class:`FitnessTermDefinition`."}, + ) + error_fitness = fields.Float( + metadata={"description": "The default fitness value assigned to failed jobs."} ) - error_fitness = fields.Float(description="The default fitness value assigned to failed jobs.") diff --git a/ansys/rep/client/jms/schema/job.py b/ansys/rep/client/jms/schema/job.py index 49f8575b1..a69cf4eb2 100644 --- a/ansys/rep/client/jms/schema/job.py +++ b/ansys/rep/client/jms/schema/job.py @@ -29,59 +29,69 @@ class JobSchema(ObjectSchemaWithModificationInfo): class Meta(ObjectSchemaWithModificationInfo.Meta): pass - name = fields.String(allow_none=True, description="Name of the job.") - eval_status = fields.String(validate=OneOf(valid_eval_status), description="Evaluation status.") + name = fields.String(allow_none=True, metadata={"description": "Name of the job."}) + eval_status = fields.String( + validate=OneOf(valid_eval_status), metadata={"description": "Evaluation status."} + ) job_definition_id = IdReference( allow_none=False, attribute="job_definition_id", referenced_class="JobDefinition", - description="ID of the linked job definition, " "see :class:`JobDefinition`.", + metadata={"description": "ID of the linked job definition, " "see :class:`JobDefinition`."}, ) priority = fields.Integer( allow_none=True, default=0, - description="Priority with which jobs are evaluated. The default is 0, " - "which is the highest priority. Assigning a higher value to a design " - "point makes it a lower priority.", + metadata={ + "description": "Priority with which jobs 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.", + metadata={ + "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 = fields.Float(allow_none=True, metadata={"description": "Fitness value computed."}) fitness_term_values = fields.Dict( keys=fields.String(), values=fields.Float(allow_none=True), allow_none=True, - description="Dictionary with (name,value) pairs for all fitness terms computed.", + metadata={ + "description": "Dictionary with (name,value) pairs for all fitness terms computed." + }, ) - note = fields.String(allow_none=True, description="Optional note for this job.") + note = fields.String(allow_none=True, metadata={"description": "Optional note for this job."}) creator = fields.String( - allow_none=True, description="Optional name/ID of the creator of this job." + allow_none=True, metadata={"description": "Optional name/ID of the creator of this job."} ) executed_level = fields.Integer( allow_none=True, - description="Execution level of the last executed " - "task (-1 if none has been executed yet).", + metadata={ + "description": "Execution level of the last executed " + "task (-1 if none has been executed yet)." + }, ) elapsed_time = fields.Float( load_only=True, - description="Number of seconds it took the evaluator(s) to update the job.", + metadata={"description": "Number of seconds it took the evaluator(s) to update the job."}, ) host_ids = fields.List( fields.String(allow_none=True), allow_none=True, - description="List of Host IDs of the evaluators that updated the job.", + metadata={"description": "List of Host IDs of the evaluators that updated the job."}, ) file_ids = IdReferenceList( referenced_class="File", attribute="file_ids", load_only=True, - description="List of IDs of all files of this job.", + metadata={"description": "List of IDs of all files of this job."}, ) diff --git a/ansys/rep/client/jms/schema/job_definition.py b/ansys/rep/client/jms/schema/job_definition.py index 919eb474d..0180e130a 100644 --- a/ansys/rep/client/jms/schema/job_definition.py +++ b/ansys/rep/client/jms/schema/job_definition.py @@ -21,25 +21,33 @@ class JobDefinitionSchema(ObjectSchemaWithModificationInfo): class Meta(ObjectSchemaWithModificationInfo.Meta): pass - name = fields.String(allow_none=True, description="Name of the job definition") + name = fields.String(allow_none=True, metadata={"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 jobs" + metadata={ + "description": "Defines whether this is the active job definition in the " + "project where evaluators will evaluate pending jobs" + } ) client_hash = fields.String(allow_none=True) parameter_definition_ids = IdReferenceList( - referenced_class="ParameterDefinition", attribute="parameter_definition_ids", description="" + referenced_class="ParameterDefinition", + attribute="parameter_definition_ids", + metadata={"description": "List of parameter definition IDs."}, ) parameter_mapping_ids = IdReferenceList( - referenced_class="ParameterMapping", attribute="parameter_mapping_ids", description="" + referenced_class="ParameterMapping", + attribute="parameter_mapping_ids", + metadata={"description": "List of parameter mapping IDs."}, ) task_definition_ids = IdReferenceList( - referenced_class="TaskDefinition", attribute="task_definition_ids", description="" + referenced_class="TaskDefinition", + attribute="task_definition_ids", + metadata={"description": "List of task definition IDs."}, ) fitness_definition = fields.Nested( FitnessDefinitionSchema, allow_none=True, - description="A :class:`FitnessDefinition` object.", + metadata={"description": "A :class:`FitnessDefinition` object."}, ) diff --git a/ansys/rep/client/jms/schema/license_context.py b/ansys/rep/client/jms/schema/license_context.py index 418a9bbe6..149751ae2 100644 --- a/ansys/rep/client/jms/schema/license_context.py +++ b/ansys/rep/client/jms/schema/license_context.py @@ -15,5 +15,9 @@ class LicenseContextSchema(BaseSchema): class Meta(BaseSchema.Meta): pass - context_id = fields.String(allow_none=True, load_only=True, description="License context ID") - environment = fields.Dict(allow_none=True, description="License context environment dict") + context_id = fields.String( + allow_none=True, load_only=True, metadata={"description": "License context ID"} + ) + environment = fields.Dict( + allow_none=True, metadata={"description": "License context environment dict"} + ) diff --git a/ansys/rep/client/jms/schema/parameter_definition.py b/ansys/rep/client/jms/schema/parameter_definition.py index 989ec71fb..4842181a0 100644 --- a/ansys/rep/client/jms/schema/parameter_definition.py +++ b/ansys/rep/client/jms/schema/parameter_definition.py @@ -19,19 +19,23 @@ class ParameterDefinitionBaseSchema(ObjectSchemaWithModificationInfo): class Meta(ObjectSchemaWithModificationInfo.Meta): pass - name = fields.String(allow_none=True, description="Name (ID) of the parameter.") + name = fields.String(allow_none=True, metadata={"description": "Name (ID) of the parameter."}) quantity_name = fields.String( - allow_none=True, description="Name of the quantity the parameter represents, e.g. Length." + allow_none=True, + metadata={"description": "Name of the quantity the parameter represents, e.g. Length."}, ) - units = fields.String(allow_none=True, description="Units for the parameter.") + units = fields.String(allow_none=True, metadata={"description": "Units for the parameter."}) display_text = fields.String( - allow_none=True, description="Text to display as the parameter name." + allow_none=True, metadata={"description": "Text to display as the parameter name."} ) mode = fields.String( load_only=True, - description="Indicates whether it's an input or output parameter. Filled server side.", + metadata={ + "description": "Indicates whether it's an input " + "or output parameter. Filled server side." + }, ) @@ -40,20 +44,31 @@ class Meta(ParameterDefinitionBaseSchema.Meta): pass type = fields.Constant("float") - default = fields.Float(allow_none=True, description="Default parameter value.") - lower_limit = fields.Float(allow_none=True, description="Lower bound for the parameter value.") - upper_limit = fields.Float(allow_none=True, description="Upper bound for the parameter value.") + default = fields.Float(allow_none=True, metadata={"description": "Default parameter value."}) + lower_limit = fields.Float( + allow_none=True, metadata={"description": "Lower bound for the parameter value."} + ) + upper_limit = fields.Float( + allow_none=True, metadata={"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.", + metadata={ + "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, metadata={"description": "Indicates if the parameter is cyclic."} ) - cyclic = fields.Bool(allow_none=True, description="Indicates if the parameter is cyclic.") value_list = fields.List( fields.Float(), allow_none=True, - description="A list of allowed values, alternative to providing upper and lower limits.", + metadata={ + "description": "A list of allowed values, alternative " + "to providing upper and lower limits." + }, ) @@ -62,15 +77,17 @@ class Meta(ParameterDefinitionBaseSchema.Meta): pass type = fields.Constant("int") - default = fields.Integer(allow_none=True, description="Default parameter value.") + default = fields.Integer(allow_none=True, metadata={"description": "Default parameter value."}) lower_limit = fields.Integer( - allow_none=True, description="Lower bound for the parameter value." + allow_none=True, metadata={"description": "Lower bound for the parameter value."} ) upper_limit = fields.Integer( - allow_none=True, description="Upper bound for the parameter value." + allow_none=True, metadata={"description": "Upper bound for the parameter value."} + ) + step = fields.Integer(allow_none=True, metadata={"description": "Equal to 1 by default."}) + cyclic = fields.Bool( + allow_none=True, metadata={"description": "Indicates if the parameter is cyclic."} ) - step = fields.Integer(allow_none=True, description="Equal to 1 by default.") - cyclic = fields.Bool(allow_none=True, description="Indicates if the parameter is cyclic.") class BoolParameterDefinitionSchema(ParameterDefinitionBaseSchema): @@ -78,7 +95,7 @@ class Meta(ParameterDefinitionBaseSchema.Meta): pass type = fields.Constant("bool") - default = fields.Bool(allow_none=True, description="Default parameter value.") + default = fields.Bool(allow_none=True, metadata={"description": "Default parameter value."}) class StringParameterDefinitionSchema(ParameterDefinitionBaseSchema): @@ -86,9 +103,9 @@ class Meta(ParameterDefinitionBaseSchema.Meta): pass type = fields.Constant("string") - default = fields.String(allow_none=True, description="Default parameter value.") + default = fields.String(allow_none=True, metadata={"description": "Default parameter value."}) value_list = fields.List( - fields.String(), allow_none=True, description="A list of allowed values." + fields.String(), allow_none=True, metadata={"description": "A list of allowed values."} ) diff --git a/ansys/rep/client/jms/schema/parameter_mapping.py b/ansys/rep/client/jms/schema/parameter_mapping.py index db0ecbbbd..22f3ac39c 100644 --- a/ansys/rep/client/jms/schema/parameter_mapping.py +++ b/ansys/rep/client/jms/schema/parameter_mapping.py @@ -26,7 +26,7 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): float_field = fields.String(allow_none=True) width = fields.Int(allow_none=True) precision = fields.Int(allow_none=True) - tokenizer = fields.String(allow_none=True, description="") + tokenizer = fields.String(allow_none=True, metadata={"description": ""}) decimal_symbol = fields.String(allow_none=True) digit_grouping_symbol = fields.String(allow_none=True) string_quote = fields.String(allow_none=True) @@ -36,12 +36,15 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): allow_none=True, attribute="parameter_definition_id", referenced_class="ParameterDefinition", - description="ID of the linked parameter definition, " "see :class:`ParameterDefinition`.", + metadata={ + "description": "ID of the linked parameter definition, " + "see :class:`ParameterDefinition`." + }, ) task_definition_property = fields.String(allow_none=True) file_id = IdReference( allow_none=True, attribute="file_id", referenced_class="File", - description="ID of the file resource.", + metadata={"description": "ID of the file resource."}, ) diff --git a/ansys/rep/client/jms/schema/project.py b/ansys/rep/client/jms/schema/project.py index 2e781aee9..046fe3af4 100644 --- a/ansys/rep/client/jms/schema/project.py +++ b/ansys/rep/client/jms/schema/project.py @@ -16,21 +16,28 @@ class Meta(BaseSchema.Meta): pass id = fields.Str( - description="Unique ID to access the project, specified on creation of the project." + metadata={ + "description": "Unique ID to access the project, assigned server side on creation." + } ) - name = fields.Str(description="Name of the project.") - active = fields.Bool(description="Defines whether the project is active for evaluation.") - priority = fields.Int(description="Priority to pick the project for evaluation.") + name = fields.Str(metadata={"description": "Name of the project."}) + active = fields.Bool( + metadata={"description": "Defines whether the project is active for evaluation."} + ) + priority = fields.Int(metadata={"description": "Priority to pick the project for evaluation."}) creation_time = fields.DateTime( - allow_none=True, load_only=True, description="The date and time the project was created." + allow_none=True, + load_only=True, + metadata={"description": "The date and time the project was created."}, ) modification_time = fields.DateTime( allow_none=True, load_only=True, - description="The date and time the project was last modified.", + metadata={"description": "The date and time the project was last modified."}, ) statistics = fields.Dict( - load_only=True, description="Optional dictionary containing various project statistics." + load_only=True, + metadata={"description": "Optional dictionary containing various project statistics."}, ) diff --git a/ansys/rep/client/jms/schema/selection.py b/ansys/rep/client/jms/schema/selection.py index 054170f4d..9bc19c4b5 100644 --- a/ansys/rep/client/jms/schema/selection.py +++ b/ansys/rep/client/jms/schema/selection.py @@ -17,12 +17,16 @@ class JobSelectionSchema(ObjectSchemaWithModificationInfo): class Meta(ObjectSchemaWithModificationInfo.Meta): pass - name = fields.String(description="Name of the selection.") + name = fields.String(metadata={"description": "Name of the selection."}) algorithm_id = IdReference( allow_none=True, attribute="algorithm_id", referenced_class="DesignExplorationAlgorithm", - description="ID of the :class:`Algorithm` " "the selection belongs to (optional).", + metadata={ + "description": "ID of the :class:`Algorithm` " "the selection belongs to (optional)." + }, + ) + object_ids = IdReferenceList( + "Job", attribute="jobs", metadata={"description": "List of job IDs."} ) - object_ids = IdReferenceList("Job", attribute="jobs", description="List of job IDs.") diff --git a/ansys/rep/client/jms/schema/task.py b/ansys/rep/client/jms/schema/task.py index c9d324c8a..213960cb5 100644 --- a/ansys/rep/client/jms/schema/task.py +++ b/ansys/rep/client/jms/schema/task.py @@ -21,43 +21,49 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): pending_time = fields.DateTime( allow_none=True, load_only=True, - description="The date and time the task was set to pending.", + metadata={"description": "The date and time the task was set to pending."}, ) prolog_time = fields.DateTime( - allow_none=True, load_only=True, description="The date and time the task was set to prolog." + allow_none=True, + load_only=True, + metadata={"description": "The date and time the task was set to prolog."}, ) running_time = fields.DateTime( allow_none=True, load_only=True, - description="The date and time the task was set to running.", + metadata={"description": "The date and time the task was set to running."}, ) finished_time = fields.DateTime( - allow_none=True, load_only=True, description="The date and time the task was completed." + allow_none=True, + load_only=True, + metadata={"description": "The date and time the task was completed."}, ) - eval_status = fields.String(allow_none=True, description="Evaluation status.") + eval_status = fields.String(allow_none=True, metadata={"description": "Evaluation status."}) trial_number = fields.Integer( allow_none=True, load_only=True, - description="Which attempt to execute the process step this task represent.", + metadata={"description": "Which attempt to execute the process step this task represent."}, ) elapsed_time = fields.Float( allow_none=True, load_only=True, - description="Number of seconds it took the evaluator to execute the task.", + metadata={"description": "Number of seconds it took the evaluator to execute the task."}, ) task_definition_id = IdReference( allow_none=False, attribute="task_definition_id", referenced_class="TaskDefinition", - description="ID of the :class:`TaskDefinition` " "the task is linked to.", + metadata={"description": "ID of the :class:`TaskDefinition` " "the task is linked to."}, ) task_definition_snapshot = fields.Nested( TaskDefinitionSchema, allow_none=True, - description="Snapshot of :class:`TaskDefinition` " - "created when task status changes to prolog, before evaluation.", + metadata={ + "description": "Snapshot of :class:`TaskDefinition` " + "created when task status changes to prolog, before evaluation." + }, ) executed_command = fields.String(allow_none=True) @@ -66,39 +72,39 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): allow_none=False, attribute="job_id", referenced_class="Job", - description="ID of the :class:`Job` the task is linked to.", + metadata={"description": "ID of the :class:`Job` the task is linked to."}, ) host_id = fields.String( allow_none=True, - description="UUID of the :class:`Evaluator` that updated the task.", + metadata={"description": "UUID of the :class:`Evaluator` that updated the task."}, ) input_file_ids = IdReferenceList( referenced_class="File", attribute="input_file_ids", - description="List of IDs of input files of task.", + metadata={"description": "List of IDs of input files of task."}, ) output_file_ids = IdReferenceList( referenced_class="File", attribute="output_file_ids", - description="List of IDs of output files of task.", + metadata={"description": "List of IDs of output files of task."}, ) monitored_file_ids = IdReferenceList( referenced_class="File", attribute="monitored_file_ids", - description="List of IDs of monitored files of task.", + metadata={"description": "List of IDs of monitored files of task."}, ) inherited_file_ids = IdReferenceList( referenced_class="File", attribute="inherited_file_ids", - description="List of IDs of inherited files of task.", + metadata={"description": "List of IDs of inherited files of task."}, ) owned_file_ids = IdReferenceList( referenced_class="File", attribute="owned_file_ids", - description="List of IDs of owned files of task.", + metadata={"description": "List of IDs of owned files of task."}, ) license_context_id = fields.String( @@ -108,5 +114,5 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): custom_data = fields.Dict( allow_none=True, - description="Dictionary type field to store custom data.", + dmetadata={"description": "Dictionary type field to store custom data."}, ) diff --git a/ansys/rep/client/jms/schema/task_definition.py b/ansys/rep/client/jms/schema/task_definition.py index 3f10ae48b..d104ea11c 100644 --- a/ansys/rep/client/jms/schema/task_definition.py +++ b/ansys/rep/client/jms/schema/task_definition.py @@ -50,30 +50,34 @@ class Meta(BaseSchema.Meta): return_code = fields.Int( allow_none=True, - description="The process exit code that must be returned by the executed command.", + metadata={ + "description": "The process exit code that must be returned by the executed command." + }, ) expressions = fields.List( - fields.String(), allow_none=True, description="A list of expressions to be evaluated." + fields.String(), + allow_none=True, + metadata={"description": "A list of expressions to be evaluated."}, ) required_output_file_ids = IdReferenceList( "File", attribute="required_output_file_ids", allow_none=True, - description="List of IDs of required output files.", + metadata={"description": "List of IDs of required output files."}, ) require_all_output_files = fields.Bool( - allow_none=True, description="Flag to require all output files." + allow_none=True, metadata={"description": "Flag to require all output files."} ) required_output_parameter_ids = IdReferenceList( "ParameterDefinition", attribute="required_output_parameter_ids", allow_none=True, - description="List of names of required output parameters.", + metadata={"description": "List of names of required output parameters."}, ) require_all_output_parameters = fields.Bool( - allow_none=True, description="Flag to require all output parameters." + allow_none=True, metadata={"description": "Flag to require all output parameters."} ) @@ -83,7 +87,9 @@ class Meta(BaseSchema.Meta): enable_shared_licensing = fields.Bool( allow_none=True, - description="Whether to enable shared licensing contexts for Ansys simulations", + metadata={ + "description": "Whether to enable shared licensing contexts for Ansys simulations" + }, ) @@ -91,54 +97,57 @@ class TaskDefinitionSchema(ObjectSchemaWithModificationInfo): class Meta(ObjectSchemaWithModificationInfo.Meta): pass - name = fields.String(allow_none=True, description="Name.") + name = fields.String(allow_none=True, metadata={"description": "Name."}) execution_command = fields.String( - allow_none=True, description="Command to execute (command or execution script is required)." + allow_none=True, + metadata={"description": "Command to execute (command or execution script is required)."}, ) use_execution_script = fields.Bool( allow_none=True, - description="Whether to run task with the execution command or the execution script.", + metadata={ + "description": "Whether to run task with the execution command or the execution script." + }, ) execution_script_id = IdReference( referenced_class="File", allow_none=True, - description="Script to execute (command or execution script is required).", + metadata={"description": "Script to execute (command or execution script is required)."}, ) - execution_level = fields.Int(description="Define execution level for this task.") + execution_level = fields.Int(metadata={"description": "Define execution level for this task."}) execution_context = fields.Dict( allow_none=True, - description="Additional arguments to pass to the executing command", + metadata={"description": "Additional arguments to pass to the executing command"}, keys=fields.Str(), values=RestrictedValue(), ) environment = fields.Dict( allow_none=True, - description="Environment variables to set for the executed process", + metadata={"description": "Environment variables to set for the executed process"}, keys=fields.Str(), values=fields.Str(), ) max_execution_time = fields.Float( - allow_none=True, description="Maximum time in seconds for executing the task." + allow_none=True, metadata={"description": "Maximum time in seconds for executing the task."} ) num_trials = fields.Int( - allow_none=True, description="Maximum number of attempts to execute the task." + allow_none=True, metadata={"description": "Maximum number of attempts to execute the task."} ) store_output = fields.Bool( allow_none=True, - description="Specify whether to store the standard output of the task.", + metadata={"description": "Specify whether to store the standard output of the task."}, ) input_file_ids = IdReferenceList( referenced_class="File", attribute="input_file_ids", - description="List of IDs of input files.", + metadata={"description": "List of IDs of input files."}, ) output_file_ids = IdReferenceList( referenced_class="File", attribute="output_file_ids", - description="List of IDs of output files.", + metadata={"description": "List of IDs of output files."}, ) success_criteria = fields.Nested( @@ -148,7 +157,7 @@ class Meta(ObjectSchemaWithModificationInfo.Meta): licensing = fields.Nested( LicensingSchema, allow_none=True, - description="A :class:`Licensing` object.", + metadata={"description": "A :class:`Licensing` object."}, ) software_requirements = fields.Nested( diff --git a/ansys/rep/client/jms/schema/task_definition_template.py b/ansys/rep/client/jms/schema/task_definition_template.py index 9e2847864..227b58352 100644 --- a/ansys/rep/client/jms/schema/task_definition_template.py +++ b/ansys/rep/client/jms/schema/task_definition_template.py @@ -28,9 +28,9 @@ class Meta(BaseSchema.Meta): ) value_list = fields.Raw( allow_none=True, - many=True, - default=[], - metadata={"description": "List of possible values for this property."}, + dump_default=[], + load_default=[], + metadata={"many": True, "description": "List of possible values for this property."}, ) @@ -53,7 +53,7 @@ class TemplateFileSchema(BaseSchema): class Meta(BaseSchema.Meta): pass - name = fields.String(description="Name of the file.") + name = fields.String(metadata={"description": "Name of the file."}) type = fields.String( allow_none=True, metadata={"description": "MIME type of the file, ie. text/plain."} ) @@ -85,15 +85,21 @@ class Meta(ObjectSchema.Meta): pass modification_time = fields.DateTime( - allow_none=True, load_only=True, description="Last time the object was modified, in UTC." + allow_none=True, + load_only=True, + metadata={"description": "Last time the object was modified, in UTC."}, ) creation_time = fields.DateTime( - allow_none=True, load_only=True, description="Time when the object was created, in UTC." + allow_none=True, + load_only=True, + metadata={"description": "Time when the object was created, in UTC."}, ) - name = fields.String(description="Name of the template") - version = fields.String(description="Version of the template", allow_none=True) - description = fields.String(description="Description of the template", allow_none=True) + name = fields.String(metadata={"description": "Name of the template"}) + version = fields.String(metadata={"description": "Version of the template"}, allow_none=True) + description = fields.String( + metadata={"description": "Description of the template"}, allow_none=True + ) software_requirements = fields.Nested( SoftwareSchema, @@ -114,26 +120,33 @@ class Meta(ObjectSchema.Meta): keys=fields.String, values=fields.Nested(TemplatePropertySchema), allow_none=True, - description="Additional arguments to pass to the executing command.", + metadata={"description": "Additional arguments to pass to the executing command."}, ) environment = fields.Dict( keys=fields.String, values=fields.Nested(TemplatePropertySchema), allow_none=True, - description="Environment variables to set for the executed process.", + metadata={"description": "Environment variables to set for the executed process."}, ) execution_command = fields.String( - allow_none=True, description="Command to execute (command or execution script is required)." + allow_none=True, + metadata={"description": "Command to execute (command or execution script is required)."}, ) use_execution_script = fields.Bool( allow_none=True, - description="Whether to run task with the execution command or the execution script.", + metadata={ + "description": "Whether to run task with the execution command or the execution script." + }, ) execution_script_storage_id = fields.String( allow_none=True, - description="Storage ID of the script to execute " - "(command or execution script is required).", + metadata={ + "description": ( + "Storage ID of the script to execute ", + "(command or execution script is required).", + ) + }, ) execution_script_storage_bucket = fields.String( allow_none=True, diff --git a/ansys/rep/client/warnings.py b/ansys/rep/client/warnings.py new file mode 100644 index 000000000..22ac43c26 --- /dev/null +++ b/ansys/rep/client/warnings.py @@ -0,0 +1,2 @@ +class UnverifiedHTTPSRequestsWarning(Warning): + pass diff --git a/pyproject.toml b/pyproject.toml index 579214dc5..d9f106166 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,6 @@ markers = [ ] filterwarnings = [ "ignore::urllib3.exceptions.InsecureRequestWarning", - "ignore::marshmallow.warnings.RemovedInMarshmallow4Warning", "ignore::DeprecationWarning:pkg_resources.*", + "ignore::ansys.rep.client.UnverifiedHTTPSRequestsWarning", ] \ No newline at end of file diff --git a/tests/rep_test.py b/tests/rep_test.py index 5d0043e5a..dfb66270d 100644 --- a/tests/rep_test.py +++ b/tests/rep_test.py @@ -63,7 +63,7 @@ def tearDown(self): @property def client(self) -> Client: if self._client is None: - self._client = Client(self.rep_url, self.username, self.password) + self._client = Client(self.rep_url, self.username, self.password, verify=False) return self._client @property