jborean93 / pypsrp

PowerShell Remoting Protocol for Python
MIT License
328 stars 49 forks source link

Extend the 'ToString' string fallback when unset to non-generic complex object #136

Closed malthe closed 2 years ago

malthe commented 2 years ago

E.g. pypsrp.powershell.Command – which should be safe to "serialize to a string" even if it makes no sense really.

codecov[bot] commented 2 years ago

Codecov Report

Merging #136 (b67677f) into master (c86765b) will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #136   +/-   ##
=======================================
  Coverage   99.66%   99.66%           
=======================================
  Files          13       13           
  Lines        3297     3299    +2     
=======================================
+ Hits         3286     3288    +2     
  Misses         11       11           
Flag Coverage Δ
py3.10 99.66% <100.00%> (+<0.01%) :arrow_up:
py3.6 99.66% <100.00%> (+<0.01%) :arrow_up:
py3.7 99.66% <100.00%> (+<0.01%) :arrow_up:
py3.8 99.63% <100.00%> (+<0.01%) :arrow_up:
py3.9 99.63% <100.00%> (+<0.01%) :arrow_up:
ubuntu 98.39% <100.00%> (+<0.01%) :arrow_up:
windows 99.66% <100.00%> (+<0.01%) :arrow_up:
x64 99.66% <100.00%> (+<0.01%) :arrow_up:
x86 99.66% <100.00%> (+<0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pypsrp/_utils.py 100.00% <100.00%> (ø)
pypsrp/complex_objects.py 100.00% <100.00%> (ø)
pypsrp/powershell.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c86765b...b67677f. Read the comment docs.

jborean93 commented 2 years ago

I'm curious what does this change. It seems like the end result is still the same in that None becomes "None" when stringifying a GenericComplexObject but instead the str() is being done in the util instead.

malthe commented 2 years ago

This was perhaps unclear but this then covers both of the places where it happens now.

man. 17. jan. 2022 kl. 21.04 skrev Jordan Borean @.***>:

I'm curious what does this change. It seems like the end result is still the same in that None becomes "None" when stringifying a GenericComplexObject but instead the str() is being done in the util instead.

— Reply to this email directly, view it on GitHub https://github.com/jborean93/pypsrp/pull/136#issuecomment-1014852355, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAGOJLEK5XCAPIISC5ISFLUWRY5VANCNFSM5LYZQWOQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

jborean93 commented 2 years ago

Ah ok I see, there was another call to to_string() but without the check for None. By moving the check in there you fix the .decode() issue not working on None. Thanks for the pickup, I've added a simple test to test this out as well.

jborean93 commented 2 years ago

Error is failing due to unrelated problem the changes look good.