@@ -123,11 +123,40 @@ def get_user_info(owner_name=None, owner_email=None, owner_orcid=None):
123123
124124
125125def check_and_build_global_config (skip_config_creation = False ):
126+ """
127+ Checks for a global diffpu config file in user's home directory and creates one if it is missing
128+
129+ The file it looks for is called diffpyconfig.json. This can contain anything in json format, but
130+ minimally contains information about the computer owner. The information is used
131+ when diffpy objects are created and saved to files or databases to retain ownership information
132+ of datasets. For example, it is used by diffpy.utils.tools.get_user_info().
133+
134+ If the function finds no config file in the user's home directory it interrupts execution
135+ and prompts the user for name, email, and orcid information. It then creates the config file
136+ with this information inside it.
137+
138+ The function returns True if the file exists and False otherwise.
139+
140+ If you would like to check for a file but not run the file creation workflow you can set
141+ the optional argument skip_config_creation to True.
142+
143+ Parameters
144+ ----------
145+ skip_config_creation: bool, optional, Default is False
146+ The bool that will override the creation workflow even if no config file exists.
147+
148+ Returns
149+ -------
150+ bool: True if the file exists and False otherwise.
151+
152+ """
153+ config_exists = False
126154 config_path = Path ().home () / "diffpyconfig.json"
127- if skip_config_creation :
128- return
129155 if config_path .is_file ():
130- return
156+ config_exists = True
157+ return config_exists
158+ if skip_config_creation :
159+ return config_exists
131160 intro_text = (
132161 "No global configuration file was found containing information about the user to "
133162 "associate with the data.\n By following the prompts below you can add your name "
@@ -154,10 +183,11 @@ def check_and_build_global_config(skip_config_creation=False):
154183 f"delete the config file and this workflow will rerun next time you run this "
155184 f"program. Or you may open the config file in a text editor and manually edit the"
156185 f"entries. For more information, see: "
157- f"https://diffpy.githu .io/diffpy.utils/examples/tools_example.html"
186+ f"https://diffpy.github .io/diffpy.utils/examples/tools_example.html"
158187 )
159188 print (outro_text )
160- return
189+ config_exists = True
190+ return config_exists
161191
162192
163193def get_package_info (package_names , metadata = None ):
0 commit comments