I agree, it depends on your local laws, bylaws, and those who enforce them.
On the bridges here where we have signs that say "Cyclists use sidewalk/Yield to Pedestrians" but once you're off the bridge it's back to the bike lanes. In the parks we have to cut the motor if we're cruising through them, even E-bikes have to be pedaled through. Not sure about the shared sidewalk/bike paths in a few places, but being nice to the pedal-powered and pedestrians by powering down, or staying at low power is the best bet. If they're not unhappy, we don't get bothered as much.