Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Running lucasdemarchi/codespell to fix typos in code

Capi Etheriel4de45c942e93
diff --git a/scrapy/contracts/default.py b/scrapy/contracts/default.py
index 73a1447f0..1d8367f82 100644
--- a/scrapy/contracts/default.py
+++ b/scrapy/contracts/default.py
@@ -57,12 +57,12 @@ class ReturnsContract(Contract):
self.max_bound = float('inf')
def post_process(self, output):
- occurences = 0
+ occurrences = 0
for x in output:
if isinstance(x, self.obj_type):
- occurences += 1
+ occurrences += 1
- assertion = (self.min_bound <= occurences <= self.max_bound)
+ assertion = (self.min_bound <= occurrences <= self.max_bound)
if not assertion:
if self.min_bound == self.max_bound:
@@ -71,7 +71,7 @@ class ReturnsContract(Contract):
expected = '%s..%s' % (self.min_bound, self.max_bound)
raise ContractFail("Returned %s %s, expected %s" % \
- (occurences, self.obj_name, expected))
+ (occurrences, self.obj_name, expected))
class ScrapesContract(Contract):
diff --git a/scrapy/contrib/linkextractors/sgml.py b/scrapy/contrib/linkextractors/sgml.py
index 72ebc743a..446769324 100644
--- a/scrapy/contrib/linkextractors/sgml.py
+++ b/scrapy/contrib/linkextractors/sgml.py
@@ -45,7 +45,7 @@ class BaseSgmlLinkExtractor(FixedSGMLParser):
def _process_links(self, links):
""" Normalize and filter extracted links
- The subclass should override it if neccessary
+ The subclass should override it if necessary
"""
links = unique_list(links, key=lambda link: link.url) if self.unique else links
return links
diff --git a/scrapy/contrib/memusage.py b/scrapy/contrib/memusage.py
index 6608632f0..6bcba8e11 100644
--- a/scrapy/contrib/memusage.py
+++ b/scrapy/contrib/memusage.py
@@ -21,7 +21,7 @@ class MemoryUsage(object):
if not crawler.settings.getbool('MEMUSAGE_ENABLED'):
raise NotConfigured
try:
- # stdlib's resource module is only availabe on unix platforms.
+ # stdlib's resource module is only available on unix platforms.
self.resource = import_module('resource')
except ImportError:
raise NotConfigured
diff --git a/scrapy/core/scraper.py b/scrapy/core/scraper.py
index f0dcc7522..bc9979928 100644
--- a/scrapy/core/scraper.py
+++ b/scrapy/core/scraper.py
@@ -121,7 +121,7 @@ class Scraper(object):
return dfd
def _scrape2(self, request_result, request, spider):
- """Handle the diferent cases of request's result been a Response or a
+ """Handle the different cases of request's result been a Response or a
Failure"""
if not isinstance(request_result, Failure):
return self.spidermw.scrape_response(self.call_spider, \
diff --git a/scrapy/responsetypes.py b/scrapy/responsetypes.py
index efb11a267..53f0ae426 100644
--- a/scrapy/responsetypes.py
+++ b/scrapy/responsetypes.py
@@ -1,6 +1,6 @@
"""
-This module implements a class which returns the appropiate Response class
-based on different criterias.
+This module implements a class which returns the appropriate Response class
+based on different criteria.
"""
@@ -38,7 +38,7 @@ class ResponseTypes(object):
self.classes[mimetype] = load_object(cls)
def from_mimetype(self, mimetype):
- """Return the most appropiate Response class for the given mimetype"""
+ """Return the most appropriate Response class for the given mimetype"""
if mimetype is None:
return Response
elif mimetype in self.classes:
@@ -48,7 +48,7 @@ class ResponseTypes(object):
return self.classes.get(basetype, Response)
def from_content_type(self, content_type, content_encoding=None):
- """Return the most appropiate Response class from an HTTP Content-Type
+ """Return the most appropriate Response class from an HTTP Content-Type
header """
if content_encoding:
return Response
@@ -64,7 +64,7 @@ class ResponseTypes(object):
return Response
def from_headers(self, headers):
- """Return the most appropiate Response class by looking at the HTTP
+ """Return the most appropriate Response class by looking at the HTTP
headers"""
cls = Response
if 'Content-Type' in headers:
@@ -75,7 +75,7 @@ class ResponseTypes(object):
return cls
def from_filename(self, filename):
- """Return the most appropiate Response class from a file name"""
+ """Return the most appropriate Response class from a file name"""
mimetype, encoding = self.mimetypes.guess_type(filename)
if mimetype and not encoding:
return self.from_mimetype(mimetype)
@@ -83,7 +83,7 @@ class ResponseTypes(object):
return Response
def from_body(self, body):
- """Try to guess the appropiate response based on the body content.
+ """Try to guess the appropriate response based on the body content.
This method is a bit magic and could be improved in the future, but
it's not meant to be used except for special cases where response types
cannot be guess using more straightforward methods."""
@@ -98,7 +98,7 @@ class ResponseTypes(object):
return self.from_mimetype('text')
def from_args(self, headers=None, url=None, filename=None, body=None):
- """Guess the most appropiate Response class based on the given arguments"""
+ """Guess the most appropriate Response class based on the given arguments"""
cls = Response
if headers is not None:
cls = self.from_headers(headers)
diff --git a/scrapy/xlib/pydispatch/robustapply.py b/scrapy/xlib/pydispatch/robustapply.py
index 11d25d377..cfd41425c 100644
--- a/scrapy/xlib/pydispatch/robustapply.py
+++ b/scrapy/xlib/pydispatch/robustapply.py
@@ -27,7 +27,7 @@ def function(receiver):
# an instance-method...
return receiver, receiver.im_func.func_code, 1
elif not hasattr(receiver, 'func_code'):
- raise ValueError('unknown reciever type %s %s'%(receiver, type(receiver)))
+ raise ValueError('unknown receiver type %s %s'%(receiver, type(receiver)))
return receiver, receiver.func_code, 0
diff --git a/scrapy/xlib/tx/_newclient.py b/scrapy/xlib/tx/_newclient.py
index e088a12d1..16d0ca6b4 100644
--- a/scrapy/xlib/tx/_newclient.py
+++ b/scrapy/xlib/tx/_newclient.py
@@ -581,7 +581,7 @@ class Request:
# In the future, having the protocol version be a parameter to this
# method would probably be good. It would be nice if this method
- # weren't limited to issueing HTTP/1.1 requests.
+ # weren't limited to issuing HTTP/1.1 requests.
requestLines = []
requestLines.append(
'%s %s HTTP/1.1\r\n' % (self.method, self.uri))
diff --git a/scrapy/xlib/tx/interfaces.py b/scrapy/xlib/tx/interfaces.py
index 7e294c450..f3e4ed5d8 100644
--- a/scrapy/xlib/tx/interfaces.py
+++ b/scrapy/xlib/tx/interfaces.py
@@ -849,7 +849,7 @@ class IReactorMulticast(Interface):
UDP socket methods that support multicast.
IMPORTANT: This is an experimental new interface. It may change
- without backwards compatability. Suggestions are welcome.
+ without backwards compatibility. Suggestions are welcome.
"""
def listenMulticast(port, protocol, interface='', maxPacketSize=8192,