Browse Source

refactoring

Théo Ertzscheid 2 years ago
parent
commit
86824a1a97
3 changed files with 2 additions and 26 deletions
  1. 0 8
      challenge-heure.py
  2. 1 9
      histogramme-heure-minute.py
  3. 1 9
      histogramme-heure.py

+ 0 - 8
challenge-heure.py

@@ -3,14 +3,6 @@ import json
 import sys
 from datetime import datetime
 
-def import_array(filename):
-  # Load the JSON file
-  with open(filename, 'r') as f:
-    data = json.load(f)
-
-  # Access the "messages" array
-  array = data['messages']
-  return array
 
 def check_challenge_win(message, hour, minute):
   # Check that the message has text and that the text is "1337"

+ 1 - 9
histogramme-heure-minute.py

@@ -3,15 +3,7 @@ import json
 import sys
 from datetime import datetime
 import matplotlib.pyplot as plt
-
-def import_array(filename):
-  # Load the JSON file
-  with open(filename, 'r') as f:
-    data = json.load(f)
-
-  # Access the "messages" array
-  array = data['messages']
-  return array
+from outils import import_array
 
 def create_hist(messages):
     # Initialize the dict in which we'll store the 

+ 1 - 9
histogramme-heure.py

@@ -3,15 +3,7 @@ import json
 import sys
 from datetime import datetime
 import matplotlib.pyplot as plt
-
-def import_array(filename):
-  # Load the JSON file
-  with open(filename, 'r') as f:
-    data = json.load(f)
-
-  # Access the "messages" array
-  array = data['messages']
-  return array
+from outils import import_array
 
 def create_hist(messages):
     # Initialize the dict in which we'll store the