Skip to content

Commit

Permalink
cleaned up unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucie Milan committed Jun 18, 2024
1 parent fcb4e0b commit 75cf3cb
Showing 1 changed file with 4 additions and 75 deletions.
79 changes: 4 additions & 75 deletions scripts/json/get_json_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,6 @@
except:
branch = ''

def getTags(repo):
# To be removed

major_versions = []
version_tags = []

tags_api = host + '/repos/singer-io/' + repo + '/tags'
tags = json.loads(requests.get(tags_api, headers=github_headers).content)

for tag in tags:
name = tag['name']
version = name.replace('v', '')
major_version = version[0]

if major_version not in major_versions:
if major_version == '0' and len(major_versions) > 0:
pass
else:
major_versions.append(major_version)
version_tags.append(name)

return version_tags

def getTapData(setup_file):
# Get the name of the tap and the current version from the setup file

Expand Down Expand Up @@ -186,7 +163,6 @@ def getFiles(repo, branch):
# Delete tap folder
shutil.rmtree(zip_output)


def getIntegrationVersions(integration):

# To remove before going to prod
Expand All @@ -205,56 +181,9 @@ def getIntegrationVersions(integration):
print('{} not found'.format(integration_path))
return len(integration_versions)

def getAllTaps(branch):
# To remove
issues = []

file = '../../_data/taps/integrations.yml'

with open(file, 'r') as f:
data = yaml.safe_load(f)

integrations = data['integrations']
for i in integrations:
tap = integrations[i]['tap']
id = integrations[i]['id']

version_count = getIntegrationVersions(id)

if tap != '':
try:
if branch == 'all' and version_count > 1:
tags = getTags(tap)
for tag in tags:
getFiles(tap, tag)
elif branch == 'all' and version_count <= 1:
getFiles(tap, '')
else:
getFiles(tap, branch)
except:
issues.append(tap)

print('Issues were found in the following repositories:')
print(*issues, sep='\n')

if repo == 'all':
if branch == '':
print('Fetching schemas from the main/master branch of all tap repositories listed in _data/taps/integrations.yml')
elif branch == 'all':
print('Fetching schemas from each major version of all tap repositories listed in _data/taps/integrations.yml')

getAllTaps(branch)

if branch == '':
print('Fetching schemas from the main/master branch of the {} repository'.format(repo))
else:
if branch == 'all':
print('Fetching schemas from each major version of the {} repository'.format(repo))
tags = getTags(repo)
for tag in tags:
getFiles(repo, tag)
else:
if branch == '':
print('Fetching schemas from the main/master branch of the {} repository'.format(repo))
else:
print('Fetching schemas from the {0} branch of the {1} repository'.format(branch, repo))
print('Fetching schemas from the {0} branch of the {1} repository'.format(branch, repo))

getFiles(repo, branch)
getFiles(repo, branch)

0 comments on commit 75cf3cb

Please sign in to comment.