Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery Starbot ⭐ refactored arindas/mac-on-linux-with-qemu #29

Merged
merged 1 commit into from
Jul 6, 2022

Conversation

SourceryAI
Copy link
Contributor

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch https://github.com/sourcery-ai-bot/mac-on-linux-with-qemu main
git merge --ff-only FETCH_HEAD
git reset HEAD^

plist_data = plist_raw.text.encode('UTF-8')
return plist_data
return plist_raw.text.encode('UTF-8')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Filesystem.fetch_plist refactored with the following changes:

Comment on lines -60 to +63
if sys.version_info > (3, 0):
root = plistlib.loads(catalog_data)
else:
root = plistlib.readPlistFromString(catalog_data)
return root
return (
plistlib.loads(catalog_data)
if sys.version_info > (3, 0)
else plistlib.readPlistFromString(catalog_data)
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Filesystem.parse_plist refactored with the following changes:

Comment on lines -96 to +112
# Iterate to find valid OSInstall packages
ospackages = []
products = root['Products']
for product in products:
if products.get(product, {}).get('ExtendedMetaInfo', {}).get('InstallAssistantPackageIdentifiers', {}).get('OSInstall', {}) == 'com.apple.mpkg.OSInstall':
ospackages.append(product)

ospackages = [
product
for product in products
if products.get(product, {})
.get('ExtendedMetaInfo', {})
.get('InstallAssistantPackageIdentifiers', {})
.get('OSInstall', {})
== 'com.apple.mpkg.OSInstall'
]

# Iterate for an specific version
candidates = []
for product in ospackages:
meta_url = products.get(product, {}).get('ServerMetadataURL', {})
if self.version in Filesystem.parse_plist(Filesystem.fetch_plist(meta_url)).get('CFBundleShortVersionString', {}):
candidates.append(product)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SoftwareService.getosinstall refactored with the following changes:

This removes the following comments ( why? ):

# Iterate to find valid OSInstall packages

Comment on lines -123 to +127
if keyword:
for item in packages:
if keyword in item.get("URL"):
Filesystem.download_file(item.get("URL"), item.get("Size"), path)
else:
for item in packages:
for item in packages:
if keyword and keyword in item.get("URL") or not keyword:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function MacOSProduct.fetchpackages refactored with the following changes:

@arindas arindas merged commit dadb6af into arindas:main Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants