-
Notifications
You must be signed in to change notification settings - Fork 291
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
Skip formatting of a block in a file #460
Comments
bump, is there an answer on this? |
Thanks for suggestion 👍
or
I will be able to use either. |
i'd love to have this feature too especially for large dictionaries |
As far as I know |
version 1.5.4 release now. Thanks |
@hhatto How to avoid autopepe8 removed a block of code at the bottom of imports?
I need block before import pyrender, but format always move it at bottom. |
My understanding is that you want to prevent It looks like you are doing this because you are doing something fun with the imports mid order. Therefore all of the code does not conform to pep8 and so the whole thing needs to be in a import platform
import os
import math
# autopep8: off
os_name = platform.platform().lower()
if 'centos' in os_name or 'windows' in os_name or 'tlinux' in os_name:
os.environ['PYOPENGL_PLATFORM'] = 'egl'
elif 'debian' in os_name or 'ubuntu' in os_name:
os.environ['PYOPENGL_PLATFORM'] = 'osmesa'
print(os.environ['PYOPENGL_PLATFORM'])
import trimesh
import pyrender
import numpy as np
from pyrender.constants import RenderFlags
from pyrender.constants import DEFAULT_Z_NEAR
import cv2
# autopep8: on Unless I am misunderstanding what you want? |
@shardros thanks, that'sexactly what i want. |
I have something like this:
It does not work. I have tried any tags to prevent the code block to be changed and to remain on top of the file, but without success. I also tried.
I am using VS Code with Any help? |
@hhatto autopep8 off/on doesn't work. Before formatting:
After:
However, if
|
I can confirm same problem |
Couldn't find if it was asked before. Some other python formatters offer a way to disable formatting of a part of a file by surrounding it with
or
As far as I understand
autopep8
does not have this capability. Am I right? If so, would you consider adding it?The text was updated successfully, but these errors were encountered: