Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Clean orphan elements script #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

klesaulnier
Copy link
Collaborator

No description provided.

…for now

Signed-off-by: LE SAULNIER Kevin <kevin.lesaulnier@rte-france.com>
@klesaulnier klesaulnier requested a review from SlimaneAmar July 12, 2023 07:55
@klesaulnier klesaulnier changed the title Clean orphan elements script [WIP] Clean orphan elements script Jul 12, 2023
print("Getting existing networks from existing studies")
get_studies_response = requests.get(constant.GET_STUDIES)

get_studies_response_json = get_studies_response.json()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a form more concise and more readable ?
existing_networks_uuid = [study["networkUuid"] for study in get_studies_response.json()]

print("Getting networks from network store server")
get_networks_response = requests.get(constant.GET_NETWORKS)

get_networks_response_json = get_networks_response.json()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a form more concise and more readable ?
all_networks_uuid = [network["uuid"] for network in get_networks_response.json()]


get_studies_response_json = get_studies_response.json()
get_studies_response_json_network_uuid = map(get_network_uuid_from_study, get_studies_response_json)
existing_networks_uuid = list(get_studies_response_json_network_uuid)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

existing_networks_uuids ?


get_networks_response_json = get_networks_response.json()
get_networks_response_json_uuid = map(get_network_uuid_from_network, get_networks_response_json)
all_networks_uuid = list(get_networks_response_json_uuid)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all_networks_uuids ?

print("Done")
# GET NETWORKS SAVED IN NETWORK STORE SERVER
print("Getting networks from network store server")
get_networks_response = requests.get(constant.GET_NETWORKS)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this to deal with errors

    if not get_studies_response.ok:
        get_studies_response.raise_for_status()

@SlimaneAmar
Copy link

I think we need a logger to log infos in a file to analyze the logs and detect possible bugs
LOGGER = logging.getLogger()

@@ -0,0 +1,26 @@
import argparse

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add new package clean_computation_results

@celmhari
Copy link

Code duplication: the three functions are almost identical and differ only by the type of elements

@celmhari celmhari self-requested a review October 16, 2023 08:24
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants