I get some message from pylint rules :
from scrapy.spiders import Spider
class MySpider(Spider): #Undefined variable "Spider"
name = "get"
start_urls = [""]
def __init__(self,**kwargs):
self.page_num = 1 #Undefined variable "self"
super(MySpider, self).__init__()
def parse(self, response):
sel = Selector(response) #Undefined variable "response"
sites = sel.css("") #Undefined variable "sel"
category_projects_list = []
for site in sites: #Undefined variable "site"
project_count = site.css("")
category_name = site.css("").extract()
category_projects = {}
category_projects['project_count'] = project_count[0] #Undefined variable "category_projects" #Undefined variable "project_count"
I am a little confused how to edit the code
It is means I have declare it before I used??
Spider=None
self=None
response= None
sel=None
site=None
...
But the Spider is from from scrapy.spiders import Spider
How should I declare it??
And I think category_projects = {}
is declare the variable
But the next line said Undefined variable "category_projects"
I want to know how to edit the code to match the rules??
So that I can have a reference to modify other code
You do not have to declare variables in Python. And your class definition is wrong. In Python you dont need parameters and brackets for it. Class Definition Syntax
It seems that there is a bug in pytest I ran the following tests with tox:
on the following file
I obtain the following result:
With those errors:
Assuming this, the best way is to move to at least the version 1.4.5 of pylint.