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

weird pylint contextmanager-decorators setting #56654

Closed
raytroop opened this issue Aug 17, 2018 · 0 comments
Closed

weird pylint contextmanager-decorators setting #56654

raytroop opened this issue Aug 17, 2018 · 0 comments

Comments

@raytroop
Copy link

raytroop commented Aug 17, 2018

I'm using tensorflow eager import tensorflow.contrib.eager as tfe, but pylint raise E0611:No name 'eager' in module 'LazyLoader'.
Then I googling for solution and get one i.e. contextmanager-decorators=contextlib.contextmanager, tf_contextlib.contextmanager

weird thing come out, I have to insert "----contextmanager-decorators=contextlib.contextmanager, tf_contextlib.contextmanager, tensorflow.python.util" heading with 4 dash in "python.linting.pylintArgs"

eager_test.py

import tensorflow.contrib.eager as tfe
import tensorflow as tf
import numpy as np
tf.enable_eager_execution()

def square_f(W):
  # Return a tensor with elements squared
  return tf.square(W)

f_grad = tfe.gradients_function(square_f, params=['W'])
print(f_grad(tf.constant(0.3)))

setting.json

// Whether to lint Python files.
    "python.linting.enabled": true,
    "python.linting.pylintArgs":
    [
        // https://github.com/PyCQA/pylint/issues/1542#issuecomment-321901891
        // Dont work heading with 2 dash
        // "--contextmanager-decorators=contextlib.contextmanager, tf_contextlib.contextmanager, tensorflow.python.util",
        // workaround, weird `----`
        "----contextmanager-decorators=contextlib.contextmanager, tf_contextlib.contextmanager, tensorflow.python.util",

        // # List of members which are set dynamically and missed by pylint inference
        // # system, and so shouldn't trigger E1101 when accessed. Python regular
        // # expressions are accepted.
        "--generated-members=matplotlib.*, torch.*, pygame.*, tensorflow.*",

        // C0103:Constant name "rnd_clf" doesn't conform to UPPER_CASE naming style
        // C0111:Missing module docstring
        // R0913:Too many arguments (max=5)
        "--disable=C0103, C0111, R0913",

    ],

tensorflow-gpu == 1.10.0
pylint == 2.0.1
python == 3.5.5

@raytroop raytroop changed the title weird contextmanager-decorators setting weird pylint contextmanager-decorators setting Aug 17, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant