Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/python/nimbusml.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -792,13 +792,13 @@
<Compile Include="tests_extended\test_docs_notebooks.py" />
<Compile Include="tests\test_pyproj.py" />
<Compile Include="tests_extended\test_docs_example.py" />
<Compile Include="tools\changeHttpURLsToHttps.py" />
<Compile Include="tools\change_to_https.py" />
<Compile Include="tools\codegen_checker.py" />
<Compile Include="tools\code_fixer.py" />
<Compile Include="tools\compiler_utils.py" />
<Compile Include="tools\doc_builder.py" />
<Compile Include="tools\entrypoint_compiler.py" />
<Compile Include="tools\findHttpURLs.py" />
<Compile Include="tools\find_http_urls.py" />
<Compile Include="tools\fix_line_widths.py" />
<Compile Include="tools\loss_processor.py" />
<Compile Include="tools\manifest_diff_parser.py" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
# -------------------------------------------------------------------------

# Converts all valid HTTP links to HTTPS, where the fed
# HTTP links are found in Report_AlterableUrls_FindHttpURLs.csv, which
# is generated by FindHttpURLs.py
# usage: python3 changeHttpURLsToHttps.py [PATH_TO_Report_FindHttpURLs.txt] [PATH_TO_ROOT_OF_NIMBUSML_DIRECTORY]
# output: Report_ReplaceHttpsURLs.txt
# HTTP links are found in alterable_urls.csv, which
# is generated by find_http_urls.py
# Usage: python3 change_to_https.py urls.csv path_to_repo

import sys
import os
Expand Down Expand Up @@ -36,7 +35,7 @@ def changeUrls(pathToReportCsv, pathToRootDirectory):

def main():
if len(sys.argv) < 3:
print("Usage: python3 changeHttpURLsToHttps.py [PATH_TO_Report_FindHttpURLs.txt] [PATH_TO_ORIGINAL_NIMBUSML_DIRECTORY]")
print("Usage: python3 change_to_https.py [PATH_TO_alterable_urls.csv] [PATH_TO_ORIGINAL_NIMBUSML_DIRECTORY]")
Comment thread
mstfbl marked this conversation as resolved.
Outdated
Comment thread
mstfbl marked this conversation as resolved.
Outdated
exit(1)
changeUrls(sys.argv[1], sys.argv[2])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

# Finds all HTTP URLs found in the NimbusML repository
# Converts all valid HTTP links to HTTPS
# Usage: python3 findHttpURLs.py [PATH_TO_NimbusML_REPOSITORY]
# Output: Report_AlterableUrls_FindHttpURLs.csv, [Report_NonAlterableUrls_FindHttpURLs.csv, Report_InvalidUrls_FindHttpURLs.csv]
# Usage: python3 find_http_urls.py path_to_repo
# Output: alterable_urls.csv, non_alterable_urls.csv, invalid_urls.csv

# Required non-standard pip library: urlextract

Expand Down Expand Up @@ -73,19 +73,19 @@ def findHttpUrls(searchRootDirectory):
makeReports(alterableUrlsStore, nonAlterableUrlsStore, invalidUrlsStore)

def makeReports(alterableUrlsStore, nonAlterableUrlsStore, invalidUrlsStore):
with open('Report_AlterableUrls_FindHttpURLs.csv', mode='w', newline='') as csv_file:
with open('alterable_urls.csv', mode='w', newline='') as csv_file:
writer1 = csv.writer(csv_file, delimiter='\t', quotechar='|', quoting=csv.QUOTE_MINIMAL)
writer1.writerow(["url", "relativeFilepath"])
for urlKey in alterableUrlsStore:
for fileValue in alterableUrlsStore[urlKey]:
writer1.writerow([urlKey, fileValue])
with open('Report_NonAlterableUrls_FindHttpURLs.csv', mode='w', newline='') as csv_file:
with open('non_alterable_urls.csv', mode='w', newline='') as csv_file:
writer2 = csv.writer(csv_file, delimiter='\t', quotechar='|', quoting=csv.QUOTE_MINIMAL)
writer2.writerow(["url", "relativeFilepath"])
for urlKey in nonAlterableUrlsStore:
for fileValue in nonAlterableUrlsStore[urlKey]:
writer2.writerow([urlKey, fileValue])
with open('Report_InvalidUrls_FindHttpURLs.csv', mode='w', newline='') as csv_file:
with open('invalid_urls.csv', mode='w', newline='') as csv_file:
writer3 = csv.writer(csv_file, delimiter='\t', quotechar='|', quoting=csv.QUOTE_MINIMAL)
writer3.writerow(["url", "relativeFilepath"])
for urlKey in invalidUrlsStore:
Expand All @@ -95,7 +95,7 @@ def makeReports(alterableUrlsStore, nonAlterableUrlsStore, invalidUrlsStore):

def main():
if len(sys.argv) < 2:
print("Usage: python3 findHttpURLs.py [PATH_TO_NimbusML_REPOSITORY]")
print("Usage: python3 find_http_urls.py [PATH_TO_NimbusML_REPOSITORY]")
Comment thread
mstfbl marked this conversation as resolved.
Outdated
exit(1)
findHttpUrls(sys.argv[1])

Expand Down