# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Discussion 04
#
# In this discussion you will look at thecode below and give the user advice on what they need to change to make this code more **generic** as a Python Toolbox.  The current snippet is the code the user uses by copying and pasting it into the `Python Window` in ArcGIS Pro.  
#
# Your goal is to provide feedback on how they can make it a Python Toolbox.
#
# Post your suggestions on what they need to add to make it a generic tool as a Python Toolbox.  Then post comment 1-2 meaningful posts on other's suggestions. 

# ```python
# import arcpy
# from arcpy import sharing
# from arcpy import mp
# import os
# import shutil
#
# # Use Inputs
# #
# #
# prj = r"CURRENT" # ArcGIS Pro Path
# wrksp = r"c:\staging" # Folder
# service_name = "airmonitor2" # String
# map_name = "Map1" # String - Finds the Map by the Name
# summary = "This is the Summary" # String - Summary of the Map
# tags = "Tag1,Tag2,Tag3" # String 
# description = "This is a description" # String
# credits = "data credits" # strings
# # End User Inputs 
# ###
#
# #   Local Variables
# #
# sddraft = r"%s\dataset.sddraft" % wrksp
# sdfile = r"%s\%s.sd" % (wrksp, service_name.replace(" ", "_"))
#
# ## Logic
# #
#
# if os.path.isdir(wrksp):
#     shutil.rmtree(wrksp)
# os.makedirs(wrksp)
#
# aprx = mp.ArcGISProject(prj)
# m = aprx.listMaps("Map")[0]
# print(m)
# sharing_draft = m.getWebLayerSharingDraft("HOSTING_SERVER", "FEATURE", service_name)
# sharing_draft.summary = summary
# sharing_draft.tags = tags
# sharing_draft.description = description
# sharing_draft.credits = credits
# sharing_draft.exportToSDDraft(sddraft)
# arcpy.StageService_server(sddraft, sdfile)
# print(sdfile)
# ```



StarcoderdataJupyterScriptsDedupFiltered