after_merge stringlengths 28 79.6k | before_merge stringlengths 20 79.6k | url stringlengths 38 71 | full_traceback stringlengths 43 922k | traceback_type stringclasses 555
values |
|---|---|---|---|---|
def __getitem__(self, key):
try:
return super(LocalWeakReferencedCache, self).__getitem__(key)
except (TypeError, KeyError):
return None # key is either not weak-referenceable or not cached
| def __getitem__(self, key):
try:
return super(LocalWeakReferencedCache, self).__getitem__(key)
except TypeError:
return None # key is not weak-referenceable, it's not cached
| https://github.com/scrapy/scrapy/issues/4597 | Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
File "/app/python/lib/python3.8/site-packages/scrapy/core/downloader/middleware.py", line 42, in process_request
defer.returnValue((yield download_func(reque... | KeyError |
def __init__(self, stats):
self.stats = stats
self.start_time = None
| def __init__(self, stats):
self.stats = stats
| https://github.com/scrapy/scrapy/issues/4007 | 2019-09-09 13:51:23 [scrapy.utils.signal] ERROR: Error caught on signal handler: <bound method CoreStats.spider_closed of <scrapy.extensions.corestats.CoreStats object at 0x7f86269cac18>>
Traceback (most recent call last):
File ".../lib/python3.6/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred
resu... | TypeError |
def spider_opened(self, spider):
self.start_time = datetime.utcnow()
self.stats.set_value("start_time", self.start_time, spider=spider)
| def spider_opened(self, spider):
self.stats.set_value("start_time", datetime.datetime.utcnow(), spider=spider)
| https://github.com/scrapy/scrapy/issues/4007 | 2019-09-09 13:51:23 [scrapy.utils.signal] ERROR: Error caught on signal handler: <bound method CoreStats.spider_closed of <scrapy.extensions.corestats.CoreStats object at 0x7f86269cac18>>
Traceback (most recent call last):
File ".../lib/python3.6/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred
resu... | TypeError |
def spider_closed(self, spider, reason):
finish_time = datetime.utcnow()
elapsed_time = finish_time - self.start_time
elapsed_time_seconds = elapsed_time.total_seconds()
self.stats.set_value("elapsed_time_seconds", elapsed_time_seconds, spider=spider)
self.stats.set_value("finish_time", finish_time,... | def spider_closed(self, spider, reason):
finish_time = datetime.datetime.utcnow()
elapsed_time = finish_time - self.stats.get_value("start_time")
elapsed_time_seconds = elapsed_time.total_seconds()
self.stats.set_value("elapsed_time_seconds", elapsed_time_seconds, spider=spider)
self.stats.set_value... | https://github.com/scrapy/scrapy/issues/4007 | 2019-09-09 13:51:23 [scrapy.utils.signal] ERROR: Error caught on signal handler: <bound method CoreStats.spider_closed of <scrapy.extensions.corestats.CoreStats object at 0x7f86269cac18>>
Traceback (most recent call last):
File ".../lib/python3.6/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred
resu... | TypeError |
def file_path(self, request, response=None, info=None):
media_guid = hashlib.sha1(to_bytes(request.url)).hexdigest()
media_ext = os.path.splitext(request.url)[1]
# Handles empty and wild extensions by trying to guess the
# mime type then extension or default to empty string otherwise
if media_ext no... | def file_path(self, request, response=None, info=None):
media_guid = hashlib.sha1(to_bytes(request.url)).hexdigest()
media_ext = os.path.splitext(request.url)[1]
return "full/%s%s" % (media_guid, media_ext)
| https://github.com/scrapy/scrapy/issues/3953 | Traceback (most recent call last):
File "c:\program files\python37\lib\site-packages\scrapy\pipelines\files.py", line 419, in media_downloaded
checksum = self.file_downloaded(response, request, info)
File "c:\program files\python37\lib\site-packages\scrapy\pipelines\files.py", line 452, in file_downloaded
self.store.pe... | OSError |
def _pickle_serialize(obj):
try:
return pickle.dumps(obj, protocol=2)
# Python <= 3.4 raises pickle.PicklingError here while
# 3.5 <= Python < 3.6 raises AttributeError and
# Python >= 3.6 raises TypeError
except (pickle.PicklingError, AttributeError, TypeError) as e:
raise ValueErro... | def _pickle_serialize(obj):
try:
return pickle.dumps(obj, protocol=2)
# Python>=3.5 raises AttributeError here while
# Python<=3.4 raises pickle.PicklingError
except (pickle.PicklingError, AttributeError) as e:
raise ValueError(str(e))
| https://github.com/scrapy/scrapy/issues/3054 | root@04bfc6cf84cd:/# scrapy version -v
Scrapy : 1.3.3
lxml : 3.7.2.0
libxml2 : 2.9.3
cssselect : 1.0.1
parsel : 1.1.0
w3lib : 1.17.0
Twisted : 16.6.0
Python : 2.7.14 (default, Dec 12 2017, 16:55:09) - [GCC 4.9.2]
pyOpenSSL : 16.2.0 (OpenSSL 1.0.1t 3 May 2016)
Platform : Linux-4.9.44-linuxkit-auf... | AssertionError |
def getHostByName(self, name, timeout=None):
if name in dnscache:
return defer.succeed(dnscache[name])
# in Twisted<=16.6, getHostByName() is always called with
# a default timeout of 60s (actually passed as (1, 3, 11, 45) tuple),
# so the input argument above is simply overridden
# to enfor... | def getHostByName(self, name, timeout=None):
if name in dnscache:
return defer.succeed(dnscache[name])
# in Twisted<=16.6, getHostByName() is always called with
# a default timeout of 60s (actually passed as (1, 3, 11, 45) tuple),
# so the input argument above is simply overridden
# to enfor... | https://github.com/scrapy/scrapy/issues/2811 | 2017-07-03 03:09:12 [twisted] CRITICAL: while looking up www.mydomain.com with <scrapy.resolver.CachingThreadedResolver object at 0x3fd0050>
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 653, in _runCallbacks
current.result = callback(current.result, *args,... | KeyError |
def process_response(self, request, response, spider):
if request.method == "HEAD":
return response
if isinstance(response, Response):
content_encoding = response.headers.getlist("Content-Encoding")
if content_encoding:
encoding = content_encoding.pop()
decoded_bo... | def process_response(self, request, response, spider):
if request.method == "HEAD":
return response
if isinstance(response, Response):
content_encoding = response.headers.getlist("Content-Encoding")
if content_encoding and not is_gzipped(response):
encoding = content_encoding... | https://github.com/scrapy/scrapy/issues/2389 | $ scrapy runspider spider.py
2016-11-09 15:53:10 [scrapy] INFO: Scrapy 1.2.1 started (bot: scrapybot)
(...)
2016-11-09 15:53:10 [scrapy] INFO: Spider opened
2016-11-09 15:53:10 [scrapy] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2016-11-09 15:53:10 [scrapy] DEBUG: Telnet console listening ... | AttributeError |
def _get_sitemap_body(self, response):
"""Return the sitemap body contained in the given response,
or None if the response is not a sitemap.
"""
if isinstance(response, XmlResponse):
return response.body
elif gzip_magic_number(response):
return gunzip(response.body)
# actual gzip... | def _get_sitemap_body(self, response):
"""Return the sitemap body contained in the given response,
or None if the response is not a sitemap.
"""
if isinstance(response, XmlResponse):
return response.body
elif is_gzipped(response):
return gunzip(response.body)
elif response.url.en... | https://github.com/scrapy/scrapy/issues/2389 | $ scrapy runspider spider.py
2016-11-09 15:53:10 [scrapy] INFO: Scrapy 1.2.1 started (bot: scrapybot)
(...)
2016-11-09 15:53:10 [scrapy] INFO: Spider opened
2016-11-09 15:53:10 [scrapy] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2016-11-09 15:53:10 [scrapy] DEBUG: Telnet console listening ... | AttributeError |
def process_response(self, request, response, spider):
if request.method == "HEAD":
return response
if isinstance(response, Response):
content_encoding = response.headers.getlist("Content-Encoding")
if content_encoding and not is_gzipped(response):
encoding = content_encoding... | def process_response(self, request, response, spider):
if request.method == "HEAD":
return response
if isinstance(response, Response):
content_encoding = response.headers.getlist("Content-Encoding")
if content_encoding and not is_gzipped(response):
encoding = content_encoding... | https://github.com/scrapy/scrapy/issues/2145 | Traceback (most recent call last):
File "twisted/internet/defer.py", line 1128, in _inlineCallbacks
result = g.send(result)
File "scrapy/core/downloader/middleware.py", line 53, in process_response
spider=spider)
File "scrapy/downloadermiddlewares/httpcompression.py", line 38, in process_response
response = response.re... | TypeError |
def __init__(self, settings):
self.default_user = settings["FTP_USER"]
self.default_password = settings["FTP_PASSWORD"]
self.passive_mode = settings["FTP_PASSIVE_MODE"]
| def __init__(self, setting):
pass
| https://github.com/scrapy/scrapy/issues/2342 | $ scrapy version -v
Scrapy : 1.2.0
lxml : 3.6.4.0
libxml2 : 2.9.4
Twisted : 16.4.1
Python : 2.7.12 (default, Jul 1 2016, 15:12:24) - [GCC 5.4.0 20160609]
pyOpenSSL : 16.1.0 (OpenSSL 1.0.2g 1 Mar 2016)
Platform : Linux-4.4.0-43-generic-x86_64-with-Ubuntu-16.04-xenial
$ scrapy shell ftp://ftp.eu.metab... | KeyError |
def download_request(self, request, spider):
parsed_url = urlparse_cached(request)
user = request.meta.get("ftp_user", self.default_user)
password = request.meta.get("ftp_password", self.default_password)
passive_mode = 1 if bool(request.meta.get("ftp_passive", self.passive_mode)) else 0
creator = C... | def download_request(self, request, spider):
parsed_url = urlparse(request.url)
creator = ClientCreator(
reactor,
FTPClient,
request.meta["ftp_user"],
request.meta["ftp_password"],
passive=request.meta.get("ftp_passive", 1),
)
return creator.connectTCP(parsed_url.... | https://github.com/scrapy/scrapy/issues/2342 | $ scrapy version -v
Scrapy : 1.2.0
lxml : 3.6.4.0
libxml2 : 2.9.4
Twisted : 16.4.1
Python : 2.7.12 (default, Jul 1 2016, 15:12:24) - [GCC 5.4.0 20160609]
pyOpenSSL : 16.1.0 (OpenSSL 1.0.2g 1 Mar 2016)
Platform : Linux-4.4.0-43-generic-x86_64-with-Ubuntu-16.04-xenial
$ scrapy shell ftp://ftp.eu.metab... | KeyError |
def add_options(self, parser):
super(Command, self).add_options(parser)
parser.remove_option("--headers")
| def add_options(self, parser):
ScrapyCommand.add_options(self, parser)
parser.add_option("--spider", dest="spider", help="use this spider")
| https://github.com/scrapy/scrapy/issues/2501 | (py35) wingyiu@mbp101:~$scrapy view http://www.scrapy.org
2017-01-19 22:13:54 [scrapy.utils.log] INFO: Scrapy 1.3.0 started (bot: scrapybot)
2017-01-19 22:13:54 [scrapy.utils.log] INFO: Overridden settings: {}
Traceback (most recent call last):
File "/Users/user/venv/py35/bin/scrapy", line 11, in <module>
sys.exit(exec... | AttributeError |
def getHostByName(self, name, timeout=None):
if name in dnscache:
return defer.succeed(dnscache[name])
# in Twisted<=16.6, getHostByName() is always called with
# a default timeout of 60s (actually passed as (1, 3, 11, 45) tuple),
# so the input argument above is simply overridden
# to enfor... | def getHostByName(self, name, timeout=None):
if name in dnscache:
return defer.succeed(dnscache[name])
if not timeout:
timeout = self.timeout
d = super(CachingThreadedResolver, self).getHostByName(name, timeout)
d.addCallback(self._cache_result, name)
return d
| https://github.com/scrapy/scrapy/issues/2461 | $ scrapy shell http://localhost:8081/
2016-12-22 12:52:01 [scrapy.utils.log] INFO: Scrapy 1.2.2 started (bot: scrapybot)
2016-12-22 12:52:01 [scrapy.utils.log] INFO: Overridden settings: {'LOGSTATS_INTERVAL': 0, 'DUPEFILTER_CLASS': 'scrapy.dupefilters.BaseDupeFilter'}
2016-12-22 12:52:01 [scrapy.middleware] INFO: Enabl... | TypeError |
def process_request_2(self, rp, request, spider):
if rp is not None and not rp.can_fetch(to_native_str(self._useragent), request.url):
logger.debug(
"Forbidden by robots.txt: %(request)s",
{"request": request},
extra={"spider": spider},
)
raise IgnoreReque... | def process_request_2(self, rp, request, spider):
if rp is not None and not rp.can_fetch(self._useragent, request.url):
logger.debug(
"Forbidden by robots.txt: %(request)s",
{"request": request},
extra={"spider": spider},
)
raise IgnoreRequest()
| https://github.com/scrapy/scrapy/issues/2373 | 2016-11-02 13:13:18 [scrapy] DEBUG: Crawled (200) <GET https://en.wikipedia.org/robots.txt> (referer: None)
2016-11-02 13:13:18 [py.warnings] WARNING: C:\Python27\lib\urllib.py:1303: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
return ''.join(... | KeyError |
def _parse_robots(self, response, netloc):
rp = robotparser.RobotFileParser(response.url)
body = ""
if hasattr(response, "text"):
body = response.text
else: # last effort try
try:
body = response.body.decode("utf-8")
except UnicodeDecodeError:
# If we fou... | def _parse_robots(self, response, netloc):
rp = robotparser.RobotFileParser(response.url)
body = ""
if hasattr(response, "text"):
body = response.text
else: # last effort try
try:
body = response.body.decode("utf-8")
except UnicodeDecodeError:
# If we fou... | https://github.com/scrapy/scrapy/issues/2373 | 2016-11-02 13:13:18 [scrapy] DEBUG: Crawled (200) <GET https://en.wikipedia.org/robots.txt> (referer: None)
2016-11-02 13:13:18 [py.warnings] WARNING: C:\Python27\lib\urllib.py:1303: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
return ''.join(... | KeyError |
def _parse_sitemap(self, response):
if response.url.endswith("/robots.txt"):
for url in sitemap_urls_from_robots(response.text, base_url=response.url):
yield Request(url, callback=self._parse_sitemap)
else:
body = self._get_sitemap_body(response)
if body is None:
... | def _parse_sitemap(self, response):
if response.url.endswith("/robots.txt"):
for url in sitemap_urls_from_robots(response.text):
yield Request(url, callback=self._parse_sitemap)
else:
body = self._get_sitemap_body(response)
if body is None:
logger.warning(
... | https://github.com/scrapy/scrapy/issues/2390 | $ scrapy runspider spider.py
Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.90 Safari/537.36'
2016-11-09 17:46:19 [scrapy] INFO: Scrapy 1.2.1 started (bot: scrapybot)
(...)
2016-11-09 17:46:19 [scrapy] DEBUG: Crawled (200) <GET http://www.asos.com/robots.txt> (referer: None)
2016-11-09 17:46:19 [... | ValueError |
def sitemap_urls_from_robots(robots_text, base_url=None):
"""Return an iterator over all sitemap urls contained in the given
robots.txt file
"""
for line in robots_text.splitlines():
if line.lstrip().lower().startswith("sitemap:"):
url = line.split(":", 1)[1].strip()
yiel... | def sitemap_urls_from_robots(robots_text):
"""Return an iterator over all sitemap urls contained in the given
robots.txt file
"""
for line in robots_text.splitlines():
if line.lstrip().lower().startswith("sitemap:"):
yield line.split(":", 1)[1].strip()
| https://github.com/scrapy/scrapy/issues/2390 | $ scrapy runspider spider.py
Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.90 Safari/537.36'
2016-11-09 17:46:19 [scrapy] INFO: Scrapy 1.2.1 started (bot: scrapybot)
(...)
2016-11-09 17:46:19 [scrapy] DEBUG: Crawled (200) <GET http://www.asos.com/robots.txt> (referer: None)
2016-11-09 17:46:19 [... | ValueError |
def _maybe_fire_closing(self):
if self.closing and not self.inprogress:
if self.nextcall:
self.nextcall.cancel()
if self.heartbeat.running:
self.heartbeat.stop()
self.closing.callback(None)
| def _maybe_fire_closing(self):
if self.closing and not self.inprogress:
if self.nextcall:
self.nextcall.cancel()
self.heartbeat.stop()
self.closing.callback(None)
| https://github.com/scrapy/scrapy/issues/2362 | 2016-10-26 16:34:15 [scrapy] INFO: Closing spider (shutdown)
Unhandled error in Deferred:
2016-10-26 16:34:15 [twisted] CRITICAL: Unhandled error in Deferred:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\scrapy\commands\crawl.py", line 57, in run
self.crawler_process.crawl(spname, **opts.spa... | exceptions.AssertionError |
def __init__(self, stats, interval=60.0):
self.stats = stats
self.interval = interval
self.multiplier = 60.0 / self.interval
self.task = None
| def __init__(self, stats, interval=60.0):
self.stats = stats
self.interval = interval
self.multiplier = 60.0 / self.interval
| https://github.com/scrapy/scrapy/issues/2362 | 2016-10-26 16:34:15 [scrapy] INFO: Closing spider (shutdown)
Unhandled error in Deferred:
2016-10-26 16:34:15 [twisted] CRITICAL: Unhandled error in Deferred:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\scrapy\commands\crawl.py", line 57, in run
self.crawler_process.crawl(spname, **opts.spa... | exceptions.AssertionError |
def spider_closed(self, spider, reason):
if self.task and self.task.running:
self.task.stop()
| def spider_closed(self, spider, reason):
if self.task.running:
self.task.stop()
| https://github.com/scrapy/scrapy/issues/2362 | 2016-10-26 16:34:15 [scrapy] INFO: Closing spider (shutdown)
Unhandled error in Deferred:
2016-10-26 16:34:15 [twisted] CRITICAL: Unhandled error in Deferred:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\scrapy\commands\crawl.py", line 57, in run
self.crawler_process.crawl(spname, **opts.spa... | exceptions.AssertionError |
def getCertificateOptions(self):
# setting verify=True will require you to provide CAs
# to verify against; in other words: it's not that simple
# backward-compatible SSL/TLS method:
#
# * this will respect `method` attribute in often recommended
# `ScrapyClientContextFactory` subclass
# ... | def getCertificateOptions(self):
# setting verify=True will require you to provide CAs
# to verify against; in other words: it's not that simple
# backward-compatible SSL/TLS method:
#
# * this will respect `method` attribute in often recommended
# `ScrapyClientContextFactory` subclass
# ... | https://github.com/scrapy/scrapy/issues/2311 | 2016-10-06 22:15:40 [scrapy] DEBUG: Telnet console listening on 127.0.0.1:6043
2016-10-06 22:15:40 [scrapy] INFO: Spider opened
2016-10-06 22:15:40 [scrapy] DEBUG: Retrying <GET https://subscribe.wsj.com/printpack/> (failed 1 times): [<twisted.python.failure.Failure OpenSSL.SSL.Error: [('SSL routines', 'SSL23_GET_SERVE... | OpenSSL.SSL.Error |
def _identityVerifyingInfoCallback(self, connection, where, ret):
if where & SSL_CB_HANDSHAKE_START:
_maybeSetHostNameIndication(connection, self._hostnameBytes)
elif where & SSL_CB_HANDSHAKE_DONE:
try:
verifyHostname(connection, self._hostnameASCII)
except VerificationError ... | def _identityVerifyingInfoCallback(self, connection, where, ret):
if where & SSL_CB_HANDSHAKE_START:
_maybeSetHostNameIndication(connection, self._hostnameBytes)
elif where & SSL_CB_HANDSHAKE_DONE:
try:
verifyHostname(connection, self._hostnameASCII)
except VerificationError ... | https://github.com/scrapy/scrapy/issues/2092 | 2016-07-05 15:50:17 [twisted] CRITICAL: Error during info_callback
Traceback (most recent call last):
File "c:\python27\lib\site-packages\twisted\protocols\tls.py", line 421, in dataReceived
self._write(bytes)
File "c:\python27\lib\site-packages\twisted\protocols\tls.py", line 569, in _write
sent = self._tlsConnection.... | exceptions.ValueError |
def _safe_ParseResult(parts, encoding="utf8", path_encoding="utf8"):
# IDNA encoding can fail for too long labels (>63 characters)
# or missing labels (e.g. http://.example.com)
try:
netloc = parts.netloc.encode("idna")
except UnicodeError:
netloc = parts.netloc
return (
to_... | def _safe_ParseResult(parts, encoding="utf8", path_encoding="utf8"):
return (
to_native_str(parts.scheme),
to_native_str(parts.netloc.encode("idna")),
# default encoding for path component SHOULD be UTF-8
quote(to_bytes(parts.path, path_encoding), _safe_chars),
quote(to_bytes... | https://github.com/scrapy/scrapy/issues/2010 | 2016-05-25 12:13:55,432 [root] [ERROR] Error on http://detroit.curbed.com/2016/5/5/11605132/tiny-house-designer-show, traceback: Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1203, in mainLoop
self.runUntilCurrent()
File "/usr/local/lib/python2.7/site-p... | exceptions.UnicodeError |
def from_content_disposition(self, content_disposition):
try:
filename = (
to_native_str(content_disposition, encoding="latin-1", errors="replace")
.split(";")[1]
.split("=")[1]
)
filename = filename.strip("\"'")
return self.from_filename(filename)... | def from_content_disposition(self, content_disposition):
try:
filename = to_native_str(content_disposition).split(";")[1].split("=")[1]
filename = filename.strip("\"'")
return self.from_filename(filename)
except IndexError:
return Response
| https://github.com/scrapy/scrapy/issues/1782 | Traceback (most recent call last):
File "/Users/kmike/envs/dl/bin/scrapy", line 9, in <module>
load_entry_point('Scrapy', 'console_scripts', 'scrapy')()
File "/Users/kmike/svn/scrapy/scrapy/cmdline.py", line 142, in execute
_run_print_help(parser, _run_command, cmd, args, opts)
File "/Users/kmike/svn/scrapy/scrapy/cmdl... | UnicodeDecodeError |
def get_func_args(func, stripself=False):
"""Return the argument name list of a callable"""
if inspect.isfunction(func):
func_args, _, _, _ = inspect.getargspec(func)
elif inspect.isclass(func):
return get_func_args(func.__init__, True)
elif inspect.ismethod(func):
return get_fun... | def get_func_args(func, stripself=False):
"""Return the argument name list of a callable"""
if inspect.isfunction(func):
func_args, _, _, _ = inspect.getargspec(func)
elif inspect.isclass(func):
return get_func_args(func.__init__, True)
elif inspect.ismethod(func):
return get_fun... | https://github.com/scrapy/scrapy/issues/728 | inspect.getmembers(itemgetter(2))
[('__call__',
<method-wrapper '__call__' of operator.itemgetter object at 0x7f79aeffb990>),
('__class__', <type 'operator.itemgetter'>),
('__delattr__',
<method-wrapper '__delattr__' of operator.itemgetter object at 0x7f79aeffb990>),
('__doc__',
'itemgetter(item, ...) --> itemgetter ob... | TypeError |
def __init__(self, tag="a", attr="href", process=None, unique=False):
self.scan_tag = tag if callable(tag) else lambda t: t == tag
self.scan_attr = attr if callable(attr) else lambda a: a == attr
self.process_attr = process if callable(process) else lambda v: v
self.unique = unique
| def __init__(self, tag="a", attr="href", process=None, unique=False):
self.scan_tag = tag if callable(tag) else lambda t: t == tag
self.scan_attr = attr if callable(attr) else lambda a: a == attr
self.process_attr = process if callable(process) else lambda v: v
self.unique = unique
self.links = []
| https://github.com/scrapy/scrapy/issues/763 | $ trial scrapy.tests.test_crawl.CrawlTestCase
scrapy.tests.test_crawl
CrawlTestCase
test_delay ... [OK]
test_engine_status ... [OK]
test_follow_all ... [FAIL]
test_ref... | test_retry_dns_error |
def _extract_links(self, selector, response_url, response_encoding, base_url):
links = []
# hacky way to get the underlying lxml parsed document
for el, attr, attr_val in self._iter_links(selector._root):
if self.scan_tag(el.tag) and self.scan_attr(attr):
# pseudo _root.make_links_absolu... | def _extract_links(self, selector, response_url, response_encoding, base_url):
# hacky way to get the underlying lxml parsed document
for el, attr, attr_val in self._iter_links(selector._root):
if self.scan_tag(el.tag) and self.scan_attr(attr):
# pseudo _root.make_links_absolute(base_url)
... | https://github.com/scrapy/scrapy/issues/763 | $ trial scrapy.tests.test_crawl.CrawlTestCase
scrapy.tests.test_crawl
CrawlTestCase
test_delay ... [OK]
test_engine_status ... [OK]
test_follow_all ... [FAIL]
test_ref... | test_retry_dns_error |
def outgoing_response(self, request_id: Any, params: Any) -> None:
if not self.settings.log_debug:
return
self.log(
self.format_response(">>>", request_id), params, self.settings.log_payloads
)
| def outgoing_response(self, request_id: Any, params: Any) -> None:
if not self.settings.log_debug:
return
self.log(
self.format_response(Direction.Outgoing, request_id),
params,
self.settings.log_payloads,
)
| https://github.com/sublimelsp/LSP/issues/905 | Error handling server payload
Traceback (most recent call last):
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packages\LSP.sublime-package\plugin/core/rpc.py", line 201, in receive_payload
self.request_or_notification_handler(payload)
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packag... | ValueError |
def outgoing_request(
self, request_id: int, method: str, params: Any, blocking: bool
) -> None:
if not self.settings.log_debug:
return
direction = "==>" if blocking else "-->"
self.log(
self.format_request(direction, method, request_id),
params,
self.settings.log_payload... | def outgoing_request(
self, request_id: int, method: str, params: Any, blocking: bool
) -> None:
if not self.settings.log_debug:
return
direction = Direction.OutgoingBlocking if blocking else Direction.Outgoing
self.log(
self.format_request(direction, method, request_id),
params,... | https://github.com/sublimelsp/LSP/issues/905 | Error handling server payload
Traceback (most recent call last):
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packages\LSP.sublime-package\plugin/core/rpc.py", line 201, in receive_payload
self.request_or_notification_handler(payload)
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packag... | ValueError |
def outgoing_notification(self, method: str, params: Any) -> None:
if not self.settings.log_debug:
return
# Do not log the payloads if any of these conditions occur because the payloads might contain the entire
# content of the view.
log_payload = (
self.settings.log_payloads
and... | def outgoing_notification(self, method: str, params: Any) -> None:
if not self.settings.log_debug:
return
# Do not log the payloads if any of these conditions occur because the payloads might contain the entire
# content of the view.
log_payload = (
self.settings.log_payloads
and... | https://github.com/sublimelsp/LSP/issues/905 | Error handling server payload
Traceback (most recent call last):
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packages\LSP.sublime-package\plugin/core/rpc.py", line 201, in receive_payload
self.request_or_notification_handler(payload)
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packag... | ValueError |
def incoming_response(self, request_id: int, params: Any) -> None:
if not self.settings.log_debug:
return
self.log(
self.format_response("<<<", request_id), params, self.settings.log_payloads
)
| def incoming_response(self, request_id: int, params: Any) -> None:
if not self.settings.log_debug:
return
self.log(
self.format_response(Direction.Incoming, request_id),
params,
self.settings.log_payloads,
)
| https://github.com/sublimelsp/LSP/issues/905 | Error handling server payload
Traceback (most recent call last):
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packages\LSP.sublime-package\plugin/core/rpc.py", line 201, in receive_payload
self.request_or_notification_handler(payload)
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packag... | ValueError |
def incoming_request(
self, request_id: Any, method: str, params: Any, unhandled: bool
) -> None:
if not self.settings.log_debug:
return
direction = "<??" if unhandled else "<--"
self.log(
self.format_request(direction, method, request_id),
params,
self.settings.log_paylo... | def incoming_request(
self, request_id: Any, method: str, params: Any, unhandled: bool
) -> None:
if not self.settings.log_debug:
return
direction = "unhandled" if unhandled else Direction.Incoming
self.log(
self.format_request(direction, method, request_id),
params,
self... | https://github.com/sublimelsp/LSP/issues/905 | Error handling server payload
Traceback (most recent call last):
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packages\LSP.sublime-package\plugin/core/rpc.py", line 201, in receive_payload
self.request_or_notification_handler(payload)
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packag... | ValueError |
def incoming_notification(self, method: str, params: Any, unhandled: bool) -> None:
if not self.settings.log_debug or method == "window/logMessage":
return
direction = "<? " if unhandled else "<- "
self.log(
self.format_notification(direction, method), params, self.settings.log_payloads
... | def incoming_notification(self, method: str, params: Any, unhandled: bool) -> None:
if not self.settings.log_debug or method == "window/logMessage":
return
direction = "unhandled" if unhandled else Direction.Incoming
self.log(
self.format_notification(direction, method), params, self.setting... | https://github.com/sublimelsp/LSP/issues/905 | Error handling server payload
Traceback (most recent call last):
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packages\LSP.sublime-package\plugin/core/rpc.py", line 201, in receive_payload
self.request_or_notification_handler(payload)
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packag... | ValueError |
def request_or_notification_handler(self, payload: Mapping[str, Any]) -> None:
method = payload["method"] # type: str
params = payload.get("params")
# Server request IDs can be either a string or an int.
request_id = payload.get("id")
if request_id is not None:
self.handle(
requ... | def request_or_notification_handler(self, payload: Mapping[str, Any]) -> None:
method = payload["method"] # type: str
params = payload.get("params")
# Server request IDs can be either a string or an int.
request_id = payload.get("id")
if request_id is not None:
self.handle(
requ... | https://github.com/sublimelsp/LSP/issues/905 | Error handling server payload
Traceback (most recent call last):
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packages\LSP.sublime-package\plugin/core/rpc.py", line 201, in receive_payload
self.request_or_notification_handler(payload)
File "C:\Users\Janos\AppData\Roaming\Sublime Text 3\Installed Packag... | ValueError |
def __init__(self, view: sublime.View) -> None:
super().__init__(view)
self.reflist = [] # type: List[List[str]]
self.word_region = None # type: Optional[sublime.Region]
self.word = ""
self.base_dir = None # type: Optional[str]
| def __init__(self, view: sublime.View) -> None:
super().__init__(view)
self.reflist = [] # type: List[List[str]]
| https://github.com/sublimelsp/LSP/issues/727 | LSP: --> textDocument/references
LSP: [{'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 25, 'character': 20}, 'start': {'line': 25, 'character': 9}}}, {'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 434, 'character': 25}, 'start': {'line': 434, 'c... | ValueError |
def run(self, edit: sublime.Edit, event: "Optional[dict]" = None) -> None:
client = self.client_with_capability("referencesProvider")
if client:
pos = get_position(self.view, event)
window = self.view.window()
self.word_region = self.view.word(pos)
self.word = self.view.substr(se... | def run(self, edit: sublime.Edit, event: "Optional[dict]" = None) -> None:
client = self.client_with_capability("referencesProvider")
if client:
pos = get_position(self.view, event)
document_position = get_document_position(self.view, pos)
if document_position:
document_posit... | https://github.com/sublimelsp/LSP/issues/727 | LSP: --> textDocument/references
LSP: [{'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 25, 'character': 20}, 'start': {'line': 25, 'character': 9}}}, {'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 434, 'character': 25}, 'start': {'line': 434, 'c... | ValueError |
def handle_response(self, response: "Optional[List[ReferenceDict]]", pos: int) -> None:
window = self.view.window()
if response is None:
response = []
references_count = len(response)
# return if there are no references
if references_count < 1:
window.run_command("hide_panel", {"pa... | def handle_response(self, response: "Optional[List[ReferenceDict]]", pos: int) -> None:
window = self.view.window()
if response is None:
response = []
references_count = len(response)
# return if there are no references
if references_count < 1:
window.run_command("hide_panel", {"pa... | https://github.com/sublimelsp/LSP/issues/727 | LSP: --> textDocument/references
LSP: [{'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 25, 'character': 20}, 'start': {'line': 25, 'character': 9}}}, {'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 434, 'character': 25}, 'start': {'line': 434, 'c... | ValueError |
def on_ref_choice(self, index: int) -> None:
self.open_ref_index(index)
| def on_ref_choice(self, base_dir: "Optional[str]", index: int) -> None:
window = self.view.window()
if index != -1:
window.open_file(
self.get_selected_file_path(base_dir, index), sublime.ENCODED_POSITION
)
| https://github.com/sublimelsp/LSP/issues/727 | LSP: --> textDocument/references
LSP: [{'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 25, 'character': 20}, 'start': {'line': 25, 'character': 9}}}, {'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 434, 'character': 25}, 'start': {'line': 434, 'c... | ValueError |
def on_ref_highlight(self, index: int) -> None:
self.open_ref_index(index, transient=True)
| def on_ref_highlight(self, base_dir: "Optional[str]", index: int) -> None:
window = self.view.window()
if index != -1:
window.open_file(
self.get_selected_file_path(base_dir, index),
sublime.ENCODED_POSITION | sublime.TRANSIENT,
)
| https://github.com/sublimelsp/LSP/issues/727 | LSP: --> textDocument/references
LSP: [{'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 25, 'character': 20}, 'start': {'line': 25, 'character': 9}}}, {'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 434, 'character': 25}, 'start': {'line': 434, 'c... | ValueError |
def get_selected_file_path(self, index: int) -> str:
return self.get_full_path(self.reflist[index][0])
| def get_selected_file_path(self, base_dir: "Optional[str]", index: int) -> str:
file_path = self.reflist[index][0]
if base_dir:
file_path = os.path.join(base_dir, file_path)
return file_path
| https://github.com/sublimelsp/LSP/issues/727 | LSP: --> textDocument/references
LSP: [{'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 25, 'character': 20}, 'start': {'line': 25, 'character': 9}}}, {'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 434, 'character': 25}, 'start': {'line': 434, 'c... | ValueError |
def _group_references_by_file(
self, references: "List[ReferenceDict]"
) -> "Dict[str, List[Tuple[Point, str]]]":
"""Return a dictionary that groups references by the file it belongs."""
grouped_references = {} # type: Dict[str, List[Tuple[Point, str]]]
for reference in references:
file_path = ... | def _group_references_by_file(
self, references: "List[ReferenceDict]", base_dir: "Optional[str]"
) -> "Dict[str, List[Tuple[Point, str]]]":
"""Return a dictionary that groups references by the file it belongs."""
grouped_references = {} # type: Dict[str, List[Tuple[Point, str]]]
for reference in refer... | https://github.com/sublimelsp/LSP/issues/727 | LSP: --> textDocument/references
LSP: [{'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 25, 'character': 20}, 'start': {'line': 25, 'character': 9}}}, {'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 434, 'character': 25}, 'start': {'line': 434, 'c... | ValueError |
def __init__(
self,
window: WindowLike,
configs: ConfigRegistry,
documents: DocumentHandler,
diagnostics: WindowDiagnostics,
session_starter: "Callable",
sublime: "Any",
handler_dispatcher,
on_closed: "Optional[Callable]" = None,
) -> None:
# to move here:
# configurations.py... | def __init__(
self,
window: WindowLike,
configs: ConfigRegistry,
documents: DocumentHandler,
diagnostics: WindowDiagnostics,
session_starter: "Callable",
sublime: "Any",
handler_dispatcher,
on_closed: "Optional[Callable]" = None,
) -> None:
# to move here:
# configurations.py... | https://github.com/sublimelsp/LSP/issues/668 | startup, version: 3207 osx x64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/perm/Library/Application Support/Sublime Text 3/Packages
state path: /Users/perm/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Tex... | BrokenPipeError |
def _start_client(self, config: ClientConfig):
project_path = self._ensure_project_path()
if project_path is None:
debug("Cannot start without a project folder")
return
if not self._can_start_config(config.name):
debug("Already starting on this window:", config.name)
return... | def _start_client(self, config: ClientConfig):
project_path = get_project_path(self._window)
if project_path is None:
debug("Cannot start without a project folder")
return
if not self._can_start_config(config.name):
debug("Already starting on this window:", config.name)
retu... | https://github.com/sublimelsp/LSP/issues/668 | startup, version: 3207 osx x64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/perm/Library/Application Support/Sublime Text 3/Packages
state path: /Users/perm/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Tex... | BrokenPipeError |
def get_project_path(window: "Any") -> "Optional[str]":
"""
Returns the first project folder
"""
if len(window.folders()):
folder_paths = window.folders()
return folder_paths[0]
return None
| def get_project_path(window: "Any") -> "Optional[str]":
"""
Returns the first project folder or the parent folder of the active view
"""
if len(window.folders()):
folder_paths = window.folders()
return folder_paths[0]
else:
view = window.active_view()
if view:
... | https://github.com/sublimelsp/LSP/issues/668 | startup, version: 3207 osx x64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/perm/Library/Application Support/Sublime Text 3/Packages
state path: /Users/perm/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Tex... | BrokenPipeError |
def update_diagnostics_panel(window: sublime.Window):
assert window, "missing window!"
if not window.is_valid():
debug("ignoring update to closed window")
return
base_dir = windows.lookup(window).get_project_path()
diagnostics_by_file = get_window_diagnostics(window)
if diagnostic... | def update_diagnostics_panel(window: sublime.Window):
assert window, "missing window!"
if not window.is_valid():
debug("ignoring update to closed window")
return
base_dir = get_project_path(window)
diagnostics_by_file = get_window_diagnostics(window)
if diagnostics_by_file is not ... | https://github.com/sublimelsp/LSP/issues/668 | startup, version: 3207 osx x64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/perm/Library/Application Support/Sublime Text 3/Packages
state path: /Users/perm/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Tex... | BrokenPipeError |
def handle_response(self, response: "Optional[List[Dict]]", pos) -> None:
window = self.view.window()
if response is None:
response = []
references_count = len(response)
# return if there are no references
if references_count < 1:
window.run_command("hide_panel", {"panel": "output.... | def handle_response(self, response: "Optional[List[Dict]]", pos) -> None:
window = self.view.window()
if response is None:
response = []
references_count = len(response)
# return if there are no references
if references_count < 1:
window.run_command("hide_panel", {"panel": "output.... | https://github.com/sublimelsp/LSP/issues/668 | startup, version: 3207 osx x64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/perm/Library/Application Support/Sublime Text 3/Packages
state path: /Users/perm/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Tex... | BrokenPipeError |
def open_and_apply_edits(self, path, file_changes):
view = self.window.open_file(path)
if view:
if view.is_loading():
# TODO: wait for event instead.
sublime.set_timeout_async(
lambda: view.run_command(
"lsp_apply_document_edit", {"changes": fi... | def open_and_apply_edits(self, path, file_changes):
view = self.window.open_file(path)
if view:
if view.is_loading():
# TODO: wait for event instead.
sublime.set_timeout_async(
lambda: view.run_command(
"lsp_apply_document_edit", {"changes": fi... | https://github.com/sublimelsp/LSP/issues/592 | Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 1082, in run_
return self.run(edit, **args)
TypeError: run() got an unexpected keyword argument 'show_status' | TypeError |
def is_applicable(cls, settings):
syntax = settings.get("syntax")
return is_supported_syntax(syntax) if syntax else False
| def is_applicable(cls, settings):
syntax = settings.get("syntax")
if syntax is not None:
return is_supported_syntax(syntax, client_configs.all)
else:
return False
| https://github.com/sublimelsp/LSP/issues/532 | Traceback (most recent call last):
File "F:\SublimeText\sublime_plugin.py", line 298, in on_api_ready
plc()
File "F:\SublimeText\Data\Packages\LSP\boot.py", line 30, in plugin_loaded
startup()
File "F:\SublimeText\Data\Packages\LSP\plugin\core\main.py", line 25, in startup
start_active_window()
File "F:\SublimeText\Dat... | TypeError |
def handle_response(self, response: "Optional[Dict]"):
global resolvable_completion_items
if self.state == CompletionState.REQUESTING:
items = [] # type: List[Dict]
if isinstance(response, dict):
items = response["items"] or []
elif isinstance(response, list):
i... | def handle_response(self, response: "Optional[Dict]"):
global resolvable_completion_items
if self.state == CompletionState.REQUESTING:
items = [] # type: List[Dict]
if isinstance(response, dict):
items = response["items"]
elif isinstance(response, list):
items =... | https://github.com/sublimelsp/LSP/issues/494 | LSP: --> textDocument/completion
LSP: {'isIncomplete': False, 'items': None}
Error handling server payload
Traceback (most recent call last):
File "/Users/margus/Library/Application Support/Sublime Text 3/Packages/LSP/plugin/core/rpc.py", line 141, in receive_payload
self.response_handler(payload)
File "/Users/ma... | TypeError |
def build(
path_source,
path_output,
config,
toc,
warningiserror,
nitpick,
keep_going,
freshenv,
builder,
custom_builder,
verbose,
quiet,
individualpages,
get_config_only=False,
):
"""Convert your book's or page's content to HTML or a PDF."""
from .. impo... | def build(
path_source,
path_output,
config,
toc,
warningiserror,
nitpick,
keep_going,
freshenv,
builder,
custom_builder,
verbose,
quiet,
individualpages,
get_config_only=False,
):
"""Convert your book's or page's content to HTML or a PDF."""
from .. impo... | https://github.com/executablebooks/jupyter-book/issues/1142 | (wintest) C:\Users\laaltenburg>jupyter-book build newbook
Running Jupyter-Book v0.8.3
Traceback (most recent call last):
File "c:\users\laaltenburg\.conda\envs\wintest\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\laaltenburg\.conda\envs\wintest\lib\runpy.py", line 85, in _run_cod... | ValueError |
def _gen_toctree(options, subsections, parent_suff):
options = "\n".join([f":{key}: {val}" for key, val in options.items()])
# Generate the TOC from our options/pages
toctree_text_md = """
```{{toctree}}
:hidden:
:titlesonly:
{options}
{sections}
```
"""
toctree_text_rst = ... | def _gen_toctree(options, subsections, parent_suff):
options = "\n".join([f":{key}: {val}" for key, val in options.items()])
# Generate the TOC from our options/pages
toctree_text_md = """
```{{toctree}}
:hidden:
:titlesonly:
{options}
{sections}
```
"""
toctree_text_rst = ... | https://github.com/executablebooks/jupyter-book/issues/1104 | Running Sphinx v3.3.0
making output directory... done
myst v0.12.10: MdParserConfig(renderer='sphinx', commonmark_only=False, dmath_enable=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, amsmath_enable=False, deflist_enable=False, update_mathjax=True, admonition_enable=False, figure_enab... | UnboundLocalError |
def _get_step(self, axis):
# TODO: need to check if this is working fine, particularly with
"""Use to determine the size of the widget with support for non
uniform axis.
"""
if axis.index >= axis.size - 1:
return axis.index2value(axis.index) - axis.index2value(axis.index - 1)
else:
... | def _get_step(self, axis):
# TODO: need to check if this is working fine, particularly with
"""Use to determine the size of the widget with support for non
uniform axis.
"""
return axis.index2value(axis.index + 1) - axis.index2value(axis.index)
| https://github.com/hyperspy/hyperspy/issues/2452 | mod.plot()
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-6-97bc6e2748ea> in <module>
----> 1 mod.plot()
c:\users\nicolastappy\documents\git\hyperspy\hyperspy\models\model1d.py in plot(self, plot_com... | IndexError |
def load_1D_EDS_SEM_spectrum():
"""
Load an EDS-SEM spectrum
Notes
-----
- Sample: EDS-TM002 provided by BAM (www.webshop.bam.de)
- SEM Microscope: Nvision40 Carl Zeiss
- EDS Detector: X-max 80 from Oxford Instrument
"""
from hyperspy.io import load
file_path = os.sep.join(
... | def load_1D_EDS_SEM_spectrum():
"""
Load an EDS-SEM spectrum
Notes
-----
- Sample: EDS-TM002 provided by BAM (www.webshop.bam.de)
- SEM Microscope: Nvision40 Carl Zeiss
- EDS Detector: X-max 80 from Oxford Instrument
"""
from hyperspy.io import load
file_path = os.sep.join(
... | https://github.com/hyperspy/hyperspy/issues/2429 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
c:\users\thomasaar\documents\github\hyperspy\hyperspy\io_plugins\hspy.py in overwrite_dataset(group, data, key, signal_axes, chunks, **kwds)
570 # contains ... | TypeError |
def load_1D_EDS_TEM_spectrum():
"""
Load an EDS-TEM spectrum
Notes
-----
- Sample: FePt bimetallic nanoparticles
- SEM Microscope: Tecnai Osiris 200 kV D658 AnalyticalTwin
- EDS Detector: Super-X 4 detectors Brucker
"""
from hyperspy.io import load
file_path = os.sep.join(
... | def load_1D_EDS_TEM_spectrum():
"""
Load an EDS-TEM spectrum
Notes
-----
- Sample: FePt bimetallic nanoparticles
- SEM Microscope: Tecnai Osiris 200 kV D658 AnalyticalTwin
- EDS Detector: Super-X 4 detectors Brucker
"""
from hyperspy.io import load
file_path = os.sep.join(
... | https://github.com/hyperspy/hyperspy/issues/2429 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
c:\users\thomasaar\documents\github\hyperspy\hyperspy\io_plugins\hspy.py in overwrite_dataset(group, data, key, signal_axes, chunks, **kwds)
570 # contains ... | TypeError |
def get_lines_intensity(
self,
xray_lines=None,
integration_windows=2.0,
background_windows=None,
plot_result=False,
only_one=True,
only_lines=("a",),
**kwargs,
):
"""Return the intensity map of selected Xray lines.
The intensities, the number of X-ray counts, are computed by
... | def get_lines_intensity(
self,
xray_lines=None,
integration_windows=2.0,
background_windows=None,
plot_result=False,
only_one=True,
only_lines=("a",),
**kwargs,
):
"""Return the intensity map of selected Xray lines.
The intensities, the number of X-ray counts, are computed by
... | https://github.com/hyperspy/hyperspy/issues/2448 | ---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-14-9a0d450cf112> in <module>
1 s = hs.signals.Signal1D(np.random.random((10,100)))
2 s.set_signal_type("EDS_SEM")
----> 3 s.get_lines_intensity("Ca_Kb") ... | ValueError |
def _unpack_data(self, file, encoding="latin-1"):
"""This needs to be special because it reads until the end of
file. This causes an error in the series of data"""
# Size of datapoints in bytes. Always int16 (==2) or 32 (==4)
Psize = int(self._get_work_dict_key_value("_15_Size_of_Points") / 8)
dtyp... | def _unpack_data(self, file, encoding="latin-1"):
"""This needs to be special because it reads until the end of
file. This causes an error in the series of data"""
# Size of datapoints in bytes. Always int16 (==2) or 32 (==4)
Psize = int(self._get_work_dict_key_value("_15_Size_of_Points") / 8)
dtyp... | https://github.com/hyperspy/hyperspy/issues/2448 | ---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-14-9a0d450cf112> in <module>
1 s = hs.signals.Signal1D(np.random.random((10,100)))
2 s.set_signal_type("EDS_SEM")
----> 3 s.get_lines_intensity("Ca_Kb") ... | ValueError |
def plot_decomposition_factors(
self,
comp_ids=None,
calibrate=True,
same_window=True,
comp_label=None,
cmap=plt.cm.gray,
per_row=3,
title=None,
):
"""Plot factors from a decomposition. In case of 1D signal axis, each
factors line can be toggled on and off by clicking on their
... | def plot_decomposition_factors(
self,
comp_ids=None,
calibrate=True,
same_window=True,
comp_label=None,
cmap=plt.cm.gray,
per_row=3,
title=None,
):
"""Plot factors from a decomposition. In case of 1D signal axis, each
factors line can be toggled on and off by clicking on their
... | https://github.com/hyperspy/hyperspy/issues/1672 | s = hs.load(signal)
s.plot_decomposition_results()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-19-7c3b0ba4e00e> in <module>()
----> 1 s.plot_decomposition_results()
c:\users\thomasaar\hyperspy\hyp... | AttributeError |
def plot_bss_factors(
self,
comp_ids=None,
calibrate=True,
same_window=True,
comp_label=None,
per_row=3,
title=None,
):
"""Plot factors from blind source separation results. In case of 1D
signal axis, each factors line can be toggled on and off by clicking
on their corresponding ... | def plot_bss_factors(
self,
comp_ids=None,
calibrate=True,
same_window=True,
comp_label=None,
per_row=3,
title=None,
):
"""Plot factors from blind source separation results. In case of 1D
signal axis, each factors line can be toggled on and off by clicking
on their corresponding ... | https://github.com/hyperspy/hyperspy/issues/1672 | s = hs.load(signal)
s.plot_decomposition_results()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-19-7c3b0ba4e00e> in <module>()
----> 1 s.plot_decomposition_results()
c:\users\thomasaar\hyperspy\hyp... | AttributeError |
def plot_decomposition_loadings(
self,
comp_ids=None,
calibrate=True,
same_window=True,
comp_label=None,
with_factors=False,
cmap=plt.cm.gray,
no_nans=False,
per_row=3,
axes_decor="all",
title=None,
):
"""Plot loadings from a decomposition. In case of 1D navigation axis,
... | def plot_decomposition_loadings(
self,
comp_ids=None,
calibrate=True,
same_window=True,
comp_label=None,
with_factors=False,
cmap=plt.cm.gray,
no_nans=False,
per_row=3,
axes_decor="all",
title=None,
):
"""Plot loadings from a decomposition. In case of 1D navigation axis,
... | https://github.com/hyperspy/hyperspy/issues/1672 | s = hs.load(signal)
s.plot_decomposition_results()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-19-7c3b0ba4e00e> in <module>()
----> 1 s.plot_decomposition_results()
c:\users\thomasaar\hyperspy\hyp... | AttributeError |
def plot_bss_loadings(
self,
comp_ids=None,
calibrate=True,
same_window=True,
comp_label=None,
with_factors=False,
cmap=plt.cm.gray,
no_nans=False,
per_row=3,
axes_decor="all",
title=None,
):
"""Plot loadings from blind source separation results. In case of 1D
navigat... | def plot_bss_loadings(
self,
comp_ids=None,
calibrate=True,
same_window=True,
comp_label=None,
with_factors=False,
cmap=plt.cm.gray,
no_nans=False,
per_row=3,
axes_decor="all",
title=None,
):
"""Plot loadings from blind source separation results. In case of 1D
navigat... | https://github.com/hyperspy/hyperspy/issues/1672 | s = hs.load(signal)
s.plot_decomposition_results()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-19-7c3b0ba4e00e> in <module>()
----> 1 s.plot_decomposition_results()
c:\users\thomasaar\hyperspy\hyp... | AttributeError |
def _get_loadings(self, loadings):
if loadings is None:
raise RuntimeError("No learning results found.")
from hyperspy.api import signals
data = loadings.T.reshape((-1,) + self.axes_manager.navigation_shape[::-1])
signal = signals.BaseSignal(
data,
axes=(
[{"size": d... | def _get_loadings(self, loadings):
from hyperspy.api import signals
data = loadings.T.reshape((-1,) + self.axes_manager.navigation_shape[::-1])
signal = signals.BaseSignal(
data,
axes=(
[{"size": data.shape[0], "navigate": True}]
+ self.axes_manager._get_navigation_a... | https://github.com/hyperspy/hyperspy/issues/1672 | s = hs.load(signal)
s.plot_decomposition_results()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-19-7c3b0ba4e00e> in <module>()
----> 1 s.plot_decomposition_results()
c:\users\thomasaar\hyperspy\hyp... | AttributeError |
def _get_factors(self, factors):
if factors is None:
raise RuntimeError("No learning results found.")
signal = self.__class__(
factors.T.reshape((-1,) + self.axes_manager.signal_shape[::-1]),
axes=[{"size": factors.shape[-1], "navigate": True}]
+ self.axes_manager._get_signal_axe... | def _get_factors(self, factors):
signal = self.__class__(
factors.T.reshape((-1,) + self.axes_manager.signal_shape[::-1]),
axes=[{"size": factors.shape[-1], "navigate": True}]
+ self.axes_manager._get_signal_axes_dicts(),
)
signal.set_signal_type(self.metadata.Signal.signal_type)
... | https://github.com/hyperspy/hyperspy/issues/1672 | s = hs.load(signal)
s.plot_decomposition_results()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-19-7c3b0ba4e00e> in <module>()
----> 1 s.plot_decomposition_results()
c:\users\thomasaar\hyperspy\hyp... | AttributeError |
def calc_real_time(self):
"""calculate and return real time for whole hypermap
in seconds
"""
line_cnt_sum = np.sum(self.line_counter, dtype=np.float64)
line_avg = self.dsp_metadata["LineAverage"]
pix_avg = self.dsp_metadata["PixelAverage"]
pix_time = self.dsp_metadata["PixelTime"]
width... | def calc_real_time(self):
"""calculate and return real time for whole hypermap
in seconds
"""
line_cnt_sum = np.sum(self.line_counter)
line_avg = self.dsp_metadata["LineAverage"]
pix_avg = self.dsp_metadata["PixelAverage"]
pix_time = self.dsp_metadata["PixelTime"]
width = self.image.widt... | https://github.com/hyperspy/hyperspy/issues/2244 | KeyError Traceback (most recent call last)
<ipython-input-6-ad1ad3391a64> in <module>
----> 1 b=hs.load('20190723_bon_accord_BCF_data/Mapping_(1,1).bcf')
~\AppData\Local\conda\conda\envs\hyperspy\lib\site-packages\hyperspy\io.py in
load(filenames, signal_type, stack, stack_axis, new_axi... | KeyError |
def _set_elements(self, root):
"""wrap objectified xml part with selection of elements to
self.elements list
"""
try:
elements = root.find(
"./ClassInstance[@Type='TRTContainerClass']"
"/ChildClassInstances"
"/ClassInstance[@Type='TRTElementInformationList']"
... | def _set_elements(self, root):
"""wrap objectified xml part with selection of elements to
self.elements list
"""
try:
elements = root.find(
"./ClassInstance[@Type='TRTContainerClass']"
"/ChildClassInstances"
"/ClassInstance[@Type='TRTElementInformationList']"
... | https://github.com/hyperspy/hyperspy/issues/2244 | KeyError Traceback (most recent call last)
<ipython-input-6-ad1ad3391a64> in <module>
----> 1 b=hs.load('20190723_bon_accord_BCF_data/Mapping_(1,1).bcf')
~\AppData\Local\conda\conda\envs\hyperspy\lib\site-packages\hyperspy\io.py in
load(filenames, signal_type, stack, stack_axis, new_axi... | KeyError |
def __init__(
self, A=1e-5, r=3.0, origin=0.0, shift=20.0, ratio=1.0, module="numexpr", **kwargs
):
super(DoublePowerLaw, self).__init__(
expression="A * (ratio * (x - origin - shift) ** -r + (x - origin) ** -r)",
name="DoublePowerLaw",
A=A,
r=r,
origin=origin,
sh... | def __init__(self, A=1e-5, r=3.0, origin=0.0, shift=20.0, ratio=1.0, **kwargs):
super(DoublePowerLaw, self).__init__(
expression="A * (ratio * (x - origin - shift) ** -r + (x - origin) ** -r)",
name="DoublePowerLaw",
A=A,
r=r,
origin=origin,
shift=shift,
ratio... | https://github.com/hyperspy/hyperspy/issues/2129 | Traceback (most recent call last):
File "ReproduceBug.py", line 17, in <module>
FeSub = FeL.remove_background(signal_range=(670., 695.), background_type='Polynomial', polynomial_order=1)
File "/Users/Zack/anaconda3/envs/conda37/lib/python3.7/site-packages/hyperspy/_signals/signal1d.py", line 1099, in remove_background
... | ValueError |
def function_nd(self, *args):
"""%s"""
if self._is2D:
x, y = args[0], args[1]
# navigation dimension is 0, f_nd same as f
if not self._is_navigation_multidimensional:
return self.function(x, y)
else:
return self._f(
x[np.newaxis, ...],
... | def function_nd(self, *args):
"""%s"""
if self._is2D:
x, y = args[0], args[1]
# navigation dimension is 0, f_nd same as f
if not self._is_navigation_multidimensional():
return self.function(x, y)
else:
return self._f(
x[np.newaxis, ...],
... | https://github.com/hyperspy/hyperspy/issues/2129 | Traceback (most recent call last):
File "ReproduceBug.py", line 17, in <module>
FeSub = FeL.remove_background(signal_range=(670., 695.), background_type='Polynomial', polynomial_order=1)
File "/Users/Zack/anaconda3/envs/conda37/lib/python3.7/site-packages/hyperspy/_signals/signal1d.py", line 1099, in remove_background
... | ValueError |
def function_nd(self, axis):
"""%s"""
if self._is_navigation_multidimensional:
x = axis[np.newaxis, :]
o = self.offset.map["values"][..., np.newaxis]
else:
x = axis
o = self.offset.value
return self._function(x, o)
| def function_nd(self, axis):
"""%s"""
x = axis[np.newaxis, :]
o = self.offset.map["values"][..., np.newaxis]
return self._function(x, o)
| https://github.com/hyperspy/hyperspy/issues/2129 | Traceback (most recent call last):
File "ReproduceBug.py", line 17, in <module>
FeSub = FeL.remove_background(signal_range=(670., 695.), background_type='Polynomial', polynomial_order=1)
File "/Users/Zack/anaconda3/envs/conda37/lib/python3.7/site-packages/hyperspy/_signals/signal1d.py", line 1099, in remove_background
... | ValueError |
def _remove_background_cli(
self,
signal_range,
background_estimator,
fast=True,
zero_fill=False,
show_progressbar=None,
):
signal_range = signal_range_from_roi(signal_range)
from hyperspy.models.model1d import Model1D
model = Model1D(self)
model.append(background_estimator)
... | def _remove_background_cli(
self,
signal_range,
background_estimator,
fast=True,
zero_fill=False,
show_progressbar=None,
):
signal_range = signal_range_from_roi(signal_range)
from hyperspy.models.model1d import Model1D
model = Model1D(self)
model.append(background_estimator)
... | https://github.com/hyperspy/hyperspy/issues/2129 | Traceback (most recent call last):
File "ReproduceBug.py", line 17, in <module>
FeSub = FeL.remove_background(signal_range=(670., 695.), background_type='Polynomial', polynomial_order=1)
File "/Users/Zack/anaconda3/envs/conda37/lib/python3.7/site-packages/hyperspy/_signals/signal1d.py", line 1099, in remove_background
... | ValueError |
def parse_header(self):
self.dm_version = iou.read_long(self.f, "big")
if self.dm_version not in (3, 4):
raise NotImplementedError(
"Currently we only support reading DM versions 3 and 4 but "
"this file "
"seems to be version %s " % self.dm_version
)
file... | def parse_header(self):
self.dm_version = iou.read_long(self.f, "big")
if self.dm_version not in (3, 4):
raise NotImplementedError(
"Currently we only support reading DM versions 3 and 4 but "
"this file "
"seems to be version %s " % self.dm_version
)
self... | https://github.com/hyperspy/hyperspy/issues/2031 | ss = hs.load('D:\\Vadim\\2018-08-02_STEM-d_C_fiber_Fengshan\\bin2\\02_0V.dm4')
---------------------------------------------------------------------------
DM3TagIDError Traceback (most recent call last)
<ipython-input-20-bfa902970b32> in <module>()
----> 1 ss = hs.load('D:\\Vadim\\2018-08-0... | DM3TagIDError |
def parse_tags(self, ntags, group_name="root", group_dict={}):
"""Parse the DM file into a dictionary."""
unnammed_data_tags = 0
unnammed_group_tags = 0
for tag in range(ntags):
_logger.debug("Reading tag name at address: %s", self.f.tell())
tag_header = self.parse_tag_header()
t... | def parse_tags(self, ntags, group_name="root", group_dict={}):
"""Parse the DM file into a dictionary."""
unnammed_data_tags = 0
unnammed_group_tags = 0
for tag in range(ntags):
_logger.debug("Reading tag name at address: %s", self.f.tell())
tag_header = self.parse_tag_header()
t... | https://github.com/hyperspy/hyperspy/issues/2031 | ss = hs.load('D:\\Vadim\\2018-08-02_STEM-d_C_fiber_Fengshan\\bin2\\02_0V.dm4')
---------------------------------------------------------------------------
DM3TagIDError Traceback (most recent call last)
<ipython-input-20-bfa902970b32> in <module>()
----> 1 ss = hs.load('D:\\Vadim\\2018-08-0... | DM3TagIDError |
def get_data_reader(self, enc_dtype):
# _data_type dictionary.
# The first element of the InfoArray in the TagType
# will always be one of _data_type keys.
# the tuple reads: ('read bytes function', 'number of bytes', 'type')
dtype_dict = {
2: (iou.read_short, 2, "h"),
3: (iou.read_... | def get_data_reader(self, enc_dtype):
# _data_type dictionary.
# The first element of the InfoArray in the TagType
# will always be one of _data_type keys.
# the tuple reads: ('read bytes function', 'number of bytes', 'type')
dtype_dict = {
2: (iou.read_short, 2, "h"),
3: (iou.read_... | https://github.com/hyperspy/hyperspy/issues/2031 | ss = hs.load('D:\\Vadim\\2018-08-02_STEM-d_C_fiber_Fengshan\\bin2\\02_0V.dm4')
---------------------------------------------------------------------------
DM3TagIDError Traceback (most recent call last)
<ipython-input-20-bfa902970b32> in <module>()
----> 1 ss = hs.load('D:\\Vadim\\2018-08-0... | DM3TagIDError |
def parse_array_definition(self):
"""Reads and returns the element type and length of the array.
The position in the file must be just after the
array encoded dtype.
"""
enc_eltype = self.read_l_or_q(self.f, "big")
length = self.read_l_or_q(self.f, "big")
return length, enc_eltype
| def parse_array_definition(self):
"""Reads and returns the element type and length of the array.
The position in the file must be just after the
array encoded dtype.
"""
self.skipif4()
enc_eltype = iou.read_long(self.f, "big")
self.skipif4()
length = iou.read_long(self.f, "big")
re... | https://github.com/hyperspy/hyperspy/issues/2031 | ss = hs.load('D:\\Vadim\\2018-08-02_STEM-d_C_fiber_Fengshan\\bin2\\02_0V.dm4')
---------------------------------------------------------------------------
DM3TagIDError Traceback (most recent call last)
<ipython-input-20-bfa902970b32> in <module>()
----> 1 ss = hs.load('D:\\Vadim\\2018-08-0... | DM3TagIDError |
def parse_string_definition(self):
"""Reads and returns the length of the string.
The position in the file must be just after the
string encoded dtype.
"""
return self.read_l_or_q(self.f, "big")
| def parse_string_definition(self):
"""Reads and returns the length of the string.
The position in the file must be just after the
string encoded dtype.
"""
self.skipif4()
return iou.read_long(self.f, "big")
| https://github.com/hyperspy/hyperspy/issues/2031 | ss = hs.load('D:\\Vadim\\2018-08-02_STEM-d_C_fiber_Fengshan\\bin2\\02_0V.dm4')
---------------------------------------------------------------------------
DM3TagIDError Traceback (most recent call last)
<ipython-input-20-bfa902970b32> in <module>()
----> 1 ss = hs.load('D:\\Vadim\\2018-08-0... | DM3TagIDError |
def parse_struct_definition(self):
"""Reads and returns the struct definition tuple.
The position in the file must be just after the
struct encoded dtype.
"""
length = self.read_l_or_q(self.f, "big")
nfields = self.read_l_or_q(self.f, "big")
definition = ()
for ifield in range(nfields)... | def parse_struct_definition(self):
"""Reads and returns the struct definition tuple.
The position in the file must be just after the
struct encoded dtype.
"""
self.f.seek(4, 1) # Skip the name length
self.skipif4(2)
nfields = iou.read_long(self.f, "big")
definition = ()
for ifield... | https://github.com/hyperspy/hyperspy/issues/2031 | ss = hs.load('D:\\Vadim\\2018-08-02_STEM-d_C_fiber_Fengshan\\bin2\\02_0V.dm4')
---------------------------------------------------------------------------
DM3TagIDError Traceback (most recent call last)
<ipython-input-20-bfa902970b32> in <module>()
----> 1 ss = hs.load('D:\\Vadim\\2018-08-0... | DM3TagIDError |
def parse_tag_group(self, size=False):
"""Parse the root TagGroup of the given DM3 file f.
Returns the tuple (is_sorted, is_open, n_tags).
endian can be either 'big' or 'little'.
"""
is_sorted = iou.read_byte(self.f, "big")
is_open = iou.read_byte(self.f, "big")
if self.dm_version == 4 and s... | def parse_tag_group(self, skip4=1):
"""Parse the root TagGroup of the given DM3 file f.
Returns the tuple (is_sorted, is_open, n_tags).
endian can be either 'big' or 'little'.
"""
is_sorted = iou.read_byte(self.f, "big")
is_open = iou.read_byte(self.f, "big")
self.skipif4(n=skip4)
n_tags... | https://github.com/hyperspy/hyperspy/issues/2031 | ss = hs.load('D:\\Vadim\\2018-08-02_STEM-d_C_fiber_Fengshan\\bin2\\02_0V.dm4')
---------------------------------------------------------------------------
DM3TagIDError Traceback (most recent call last)
<ipython-input-20-bfa902970b32> in <module>()
----> 1 ss = hs.load('D:\\Vadim\\2018-08-0... | DM3TagIDError |
def spd_reader(
filename,
endianess="<",
nav_units=None,
spc_fname=None,
ipr_fname=None,
load_all_spc=False,
**kwargs,
):
"""
Read data from an SPD spectral map specified by filename.
Parameters
----------
filename : str
Name of SPD file to read
endianess : c... | def spd_reader(
filename,
endianess="<",
nav_units=None,
spc_fname=None,
ipr_fname=None,
load_all_spc=False,
**kwargs,
):
"""
Read data from an SPD spectral map specified by filename.
Parameters
----------
filename : str
Name of SPD file to read
endianess : c... | https://github.com/hyperspy/hyperspy/issues/1916 | s = hs.load('pyrite.hspy')
crop = s.inav[:,:,::5].isig[:2.6]
crop.compute()
crop.save('pyrite_50frames_2_6keV.hspy')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
c:\users\jat\git_repos\hyperspy\hyperspy\io_plugins... | TypeError |
def _update_patch_size(self):
if self.is_on() and self.patch:
ro, ri = self.size
self.patch[0].radius = ro
if ri > 0:
# Add the inner circle
if len(self.patch) == 1:
# Need to remove the previous patch before using
# `_add_patch_to`
... | def _update_patch_size(self):
if self.is_on() and self.patch:
ro, ri = self.size
self.patch[0].radius = ro
if ri > 0:
self.patch[1].radius = ri
self._update_resizers()
self.draw_patch()
| https://github.com/hyperspy/hyperspy/issues/1954 | ---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-1-4e82cadb3c15> in <module>()
11 annular_roi = hs.roi.CircleROI(r=6,cy=64,cx=64,r_inner=3)
12
---> 13 Roi2D = annular_roi.interactive(color='red',signal=... | IndexError |
def __enter__(self):
self.release_version = Release.version
# Get the hash from the git repository if available
self.restore_version = False
if self.release_version.endswith(".dev"):
p = subprocess.Popen(
["git", "describe", "--tags", "--dirty", "--always"],
stdout=subpr... | def __enter__(self):
self.release_version = Release.version
# Get the hash from the git repository if available
self.restore_version = False
git_master_path = ".git/refs/heads/master"
if self.release_version.endswith(".dev"):
p = subprocess.Popen(
["git", "describe", "--tags", "... | https://github.com/hyperspy/hyperspy/issues/1704 | Obtaining file:///C:/Users/macark/Documents/GitHub/hyperspy
Complete output from command python setup.py egg_info:
C:\Users\macark\Documents\GitHub\hyperspy\setup.py:180: UserWarning: WARNING: C compiler can't be found.
Only slow pure python alternative functions will be available.
To use fast implementation of some fu... | FileNotFoundError |
def select(self):
"""
Cause this widget to be the selected widget in its MPL axes. This
assumes that the widget has its patch added to the MPL axes.
"""
if not self.patch or not self.is_on() or not self.ax:
return
canvas = self.ax.figure.canvas
# Simulate a pick event
x, y = sel... | def select(self):
"""
Cause this widget to be the selected widget in its MPL axes. This
assumes that the widget has its patch added to the MPL axes.
"""
if not self.patch or not self.is_on() or not self.ax:
return
canvas = self.ax.figure.canvas
# Simulate a pick event
x, y = sel... | https://github.com/hyperspy/hyperspy/issues/1693 | Traceback (most recent call last):
File "<ipython-input-1-83892adf2fe2>", line 12, in <module>
w = roi_nav.add_widget(s)
File "/home/eric/Python_dev/hyperspy/hyperspy/roi.py", line 447, in add_widget
widget.set_mpl_ax(ax)
File "/home/eric/Python_dev/hyperspy/hyperspy/drawing/widget.py", line 168, in set_mpl_ax
self.... | TypeError |
def __init__(self, signal1D, yscale=1.0, xscale=1.0, shift=0.0, interpolate=True):
Component.__init__(self, ["yscale", "xscale", "shift"])
self._position = self.shift
self._whitelist["signal1D"] = ("init,sig", signal1D)
self.signal = signal1D
self.yscale.free = True
self.yscale.value = yscale
... | def __init__(self, signal1D):
Component.__init__(self, ["yscale", "xscale", "shift"])
self._position = self.shift
self._whitelist["signal1D"] = ("init,sig", signal1D)
self.signal = signal1D
self.yscale.free = True
self.yscale.value = 1.0
self.xscale.value = 1.0
self.shift.value = 0.0
... | https://github.com/hyperspy/hyperspy/issues/1862 | s = hs.datasets.example_signals.EDS_SEM_Spectrum()
hs.model.components1D.ScalableFixedPattern(s,xscale=2)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-97-f7d2822487b5> in <module>()
----> 1 c = hs.m... | TypeError |
def _setup_vfs(self):
"""Setup the virtual file system tree represented as python dictionary
with values populated with SFSTreeItem instances
See also:
SFSTreeItem
"""
with open(self.filename, "rb") as fn:
# check if file tree do not exceed one chunk:
n_file_tree_chunks = ceil((... | def _setup_vfs(self):
"""Setup the virtual file system tree represented as python dictionary
with values populated with SFSTreeItem instances
See also:
SFSTreeItem
"""
with open(self.filename, "rb") as fn:
# file tree do not exceed one chunk in bcf:
fn.seek(self.chunksize * self... | https://github.com/hyperspy/hyperspy/issues/1801 | ---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-3-e233613e1d5d> in <module>()
----> 1 bk=hs.load('eds.bcf')
~/Documents/hyperspy/hyperspy/io.py in load(filenames, signal_type, stack, stack_axis, new_a... | ValueError |
def _parse_image(self, xml_node, overview=False):
"""parse image from bruker xml image node."""
if overview:
rect_node = xml_node.find(
"./ChildClassInstances"
"/ClassInstance["
# "@Type='TRTRectangleOverlayElement' and "
"@Name='Map']/TRTSolidOverlayEleme... | def _parse_image(self, xml_node, overview=False):
"""parse image from bruker xml image node."""
if overview:
rect_node = xml_node.find(
"./ChildClassInstances"
"/ClassInstance["
# "@Type='TRTRectangleOverlayElement' and "
"@Name='Map']/TRTSolidOverlayEleme... | https://github.com/hyperspy/hyperspy/issues/1801 | ---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-3-e233613e1d5d> in <module>()
----> 1 bk=hs.load('eds.bcf')
~/Documents/hyperspy/hyperspy/io.py in load(filenames, signal_type, stack, stack_axis, new_a... | ValueError |
def _parse_image(self, xml_node, overview=False):
"""parse image from bruker xml image node."""
if overview:
rect_node = xml_node.find(
"./ChildClassInstances"
"/ClassInstance["
# "@Type='TRTRectangleOverlayElement' and "
"@Name='Map']/TRTSolidOverlayEleme... | def _parse_image(self, xml_node, overview=False):
"""parse image from bruker xml image node."""
if overview:
rect_node = xml_node.find(
"./ChildClassInstances"
"/ClassInstance["
# "@Type='TRTRectangleOverlayElement' and "
"@Name='Map']/TRTSolidOverlayEleme... | https://github.com/hyperspy/hyperspy/issues/1801 | ---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-3-e233613e1d5d> in <module>()
----> 1 bk=hs.load('eds.bcf')
~/Documents/hyperspy/hyperspy/io.py in load(filenames, signal_type, stack, stack_axis, new_a... | ValueError |
def align_zero_loss_peak(
self,
calibrate=True,
also_align=[],
print_stats=True,
subpixel=True,
mask=None,
signal_range=None,
show_progressbar=None,
**kwargs,
):
"""Align the zero-loss peak.
This function first aligns the spectra using the result of
`estimate_zero_loss_p... | def align_zero_loss_peak(
self,
calibrate=True,
also_align=[],
print_stats=True,
subpixel=True,
mask=None,
signal_range=None,
show_progressbar=None,
**kwargs,
):
"""Align the zero-loss peak.
This function first aligns the spectra using the result of
`estimate_zero_loss_p... | https://github.com/hyperspy/hyperspy/issues/1592 | s
<LazyEELSSpectrum, title: EELS Spectrum Image 0eV, dimensions: (3, 3|2048)>
s.align_zero_loss_peak(True) # Or False
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-4-8925d1fde6ab> in <module>()
---->... | IndexError |
def kramers_kronig_analysis(
self, zlp=None, iterations=1, n=None, t=None, delta=0.5, full_output=False
):
"""Calculate the complex
dielectric function from a single scattering distribution (SSD) using
the Kramers-Kronig relations.
It uses the FFT method as in [Egerton2011]_. The SSD is an
EEL... | def kramers_kronig_analysis(
self, zlp=None, iterations=1, n=None, t=None, delta=0.5, full_output=False
):
"""Calculate the complex
dielectric function from a single scattering distribution (SSD) using
the Kramers-Kronig relations.
It uses the FFT method as in [Egerton2011]_. The SSD is an
EEL... | https://github.com/hyperspy/hyperspy/issues/1592 | s
<LazyEELSSpectrum, title: EELS Spectrum Image 0eV, dimensions: (3, 3|2048)>
s.align_zero_loss_peak(True) # Or False
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-4-8925d1fde6ab> in <module>()
---->... | IndexError |
def _estimate_shift1D(data, **kwargs):
mask = kwargs.get("mask", None)
ref = kwargs.get("ref", None)
interpolate = kwargs.get("interpolate", True)
ip = kwargs.get("ip", 5)
data_slice = kwargs.get("data_slice", slice(None))
if bool(mask):
return np.float32(np.nan)
data = data[data_sli... | def _estimate_shift1D(data, **kwargs):
mask = kwargs.get("mask", None)
ref = kwargs.get("ref", None)
interpolate = kwargs.get("interpolate", True)
ip = kwargs.get("ip", 5)
data_slice = kwargs.get("data_slice", slice(None))
if bool(mask):
return np.nan
data = data[data_slice]
if i... | https://github.com/hyperspy/hyperspy/issues/1592 | s
<LazyEELSSpectrum, title: EELS Spectrum Image 0eV, dimensions: (3, 3|2048)>
s.align_zero_loss_peak(True) # Or False
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-4-8925d1fde6ab> in <module>()
---->... | IndexError |
def _shift1D(data, **kwargs):
shift = kwargs.get("shift", 0.0)
original_axis = kwargs.get("original_axis", None)
fill_value = kwargs.get("fill_value", np.nan)
kind = kwargs.get("kind", "linear")
offset = kwargs.get("offset", 0.0)
scale = kwargs.get("scale", 1.0)
size = kwargs.get("size", 2)
... | def _shift1D(data, **kwargs):
shift = kwargs.get("shift", 0.0)
original_axis = kwargs.get("original_axis", None)
fill_value = kwargs.get("fill_value", np.nan)
kind = kwargs.get("kind", "linear")
offset = kwargs.get("offset", 0.0)
scale = kwargs.get("scale", 1.0)
size = kwargs.get("size", 2)
... | https://github.com/hyperspy/hyperspy/issues/1592 | s
<LazyEELSSpectrum, title: EELS Spectrum Image 0eV, dimensions: (3, 3|2048)>
s.align_zero_loss_peak(True) # Or False
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-4-8925d1fde6ab> in <module>()
---->... | IndexError |
def estimate_shift1D(
self,
start=None,
end=None,
reference_indices=None,
max_shift=None,
interpolate=True,
number_of_interpolation_points=5,
mask=None,
parallel=None,
show_progressbar=None,
):
"""Estimate the shifts in the current signal axis using
cross-correlation.
... | def estimate_shift1D(
self,
start=None,
end=None,
reference_indices=None,
max_shift=None,
interpolate=True,
number_of_interpolation_points=5,
mask=None,
parallel=None,
show_progressbar=None,
):
"""Estimate the shifts in the current signal axis using
cross-correlation.
... | https://github.com/hyperspy/hyperspy/issues/1592 | s
<LazyEELSSpectrum, title: EELS Spectrum Image 0eV, dimensions: (3, 3|2048)>
s.align_zero_loss_peak(True) # Or False
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-4-8925d1fde6ab> in <module>()
---->... | IndexError |
def fetch(self):
"""Fetch the stored value and std attributes.
See Also
--------
store_current_value_in_array, assign_current_value_to_all
"""
indices = self._axes_manager.indices[::-1]
# If it is a single spectrum indices is ()
if not indices:
indices = (0,)
if self.map["... | def fetch(self):
"""Fetch the stored value and std attributes.
See Also
--------
store_current_value_in_array, assign_current_value_to_all
"""
indices = self._axes_manager.indices[::-1]
# If it is a single spectrum indices is ()
if not indices:
indices = (0,)
if self.map["... | https://github.com/hyperspy/hyperspy/issues/1592 | s
<LazyEELSSpectrum, title: EELS Spectrum Image 0eV, dimensions: (3, 3|2048)>
s.align_zero_loss_peak(True) # Or False
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-4-8925d1fde6ab> in <module>()
---->... | IndexError |
def reconstruct_object(flags, value):
"""Reconstructs the value (if necessary) after having saved it in a
dictionary
"""
if not isinstance(flags, list):
flags = parse_flag_string(flags)
if "sig" in flags:
if isinstance(value, dict):
from hyperspy.signal import BaseSignal
... | def reconstruct_object(flags, value):
"""Reconstructs the value (if necessary) after having saved it in a
dictionary
"""
if not isinstance(flags, list):
flags = parse_flag_string(flags)
if "sig" in flags:
if isinstance(value, dict):
from hyperspy.signal import BaseSignal
... | https://github.com/hyperspy/hyperspy/issues/1592 | s
<LazyEELSSpectrum, title: EELS Spectrum Image 0eV, dimensions: (3, 3|2048)>
s.align_zero_loss_peak(True) # Or False
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-4-8925d1fde6ab> in <module>()
---->... | IndexError |
def _slice_target(target, dims, both_slices, slice_nav=None, issignal=False):
"""Slices the target if appropriate
Parameters
----------
target : object
Target object
dims : tuple
(navigation_dimensions, signal_dimensions) of the original object that
is sliced
both_slices... | def _slice_target(target, dims, both_slices, slice_nav=None, issignal=False):
"""Slices the target if appropriate
Parameters
----------
target : object
Target object
dims : tuple
(navigation_dimensions, signal_dimensions) of the original object that
is sliced
both_slices... | https://github.com/hyperspy/hyperspy/issues/1592 | s
<LazyEELSSpectrum, title: EELS Spectrum Image 0eV, dimensions: (3, 3|2048)>
s.align_zero_loss_peak(True) # Or False
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-4-8925d1fde6ab> in <module>()
---->... | IndexError |
def __init__(self, xml_str, indexes, instrument=None):
root = ET.fromstring(xml_str)
root = root.find("./ClassInstance[@Type='TRTSpectrumDatabase']")
try:
self.name = str(root.attrib["Name"])
except KeyError:
self.name = "Undefinded"
_logger.info("hypermap have no name. Giving it... | def __init__(self, xml_str, instrument=None):
root = ET.fromstring(xml_str)
root = root.find("./ClassInstance[@Type='TRTSpectrumDatabase']")
try:
self.name = str(root.attrib["Name"])
except KeyError:
self.name = "Undefinded"
_logger.info("hypermap have no name. Giving it 'Undefin... | https://github.com/hyperspy/hyperspy/issues/1751 | hs.load(filename)
Traceback (most recent call last):
File "<ipython-input-3-ada763a7934e>", line 1, in <module>
hs.load(filename)
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, in load
for filename in filenames]
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, ... | IndexError |
def _set_sum_edx(self, root, indexes):
for i in indexes:
spec_node = root.find("./SpectrumData{0}/ClassInstance".format(str(i)))
self.spectra_data[i] = EDXSpectrum(spec_node)
| def _set_sum_edx(self, root):
for i in range(self.mapping_count):
spec_node = root.find("./SpectrumData{0}/ClassInstance".format(str(i)))
self.spectra_data[i] = EDXSpectrum(spec_node)
| https://github.com/hyperspy/hyperspy/issues/1751 | hs.load(filename)
Traceback (most recent call last):
File "<ipython-input-3-ada763a7934e>", line 1, in <module>
hs.load(filename)
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, in load
for filename in filenames]
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, ... | IndexError |
def __init__(self, filename, instrument=None):
SFS_reader.__init__(self, filename)
header_file = self.get_file("EDSDatabase/HeaderData")
self.available_indexes = []
for i in self.vfs["EDSDatabase"].keys():
if "SpectrumData" in i:
self.available_indexes.append(int(i[-1]))
self.def... | def __init__(self, filename, instrument=None):
SFS_reader.__init__(self, filename)
header_file = self.get_file("EDSDatabase/HeaderData")
header_byte_str = header_file.get_as_BytesIO_string().getvalue()
self.header = HyperHeader(header_byte_str, instrument=instrument)
self.hypermap = {}
| https://github.com/hyperspy/hyperspy/issues/1751 | hs.load(filename)
Traceback (most recent call last):
File "<ipython-input-3-ada763a7934e>", line 1, in <module>
hs.load(filename)
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, in load
for filename in filenames]
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, ... | IndexError |
def persistent_parse_hypermap(
self, index=None, downsample=None, cutoff_at_kV=None, lazy=False
):
"""Parse and assign the hypermap to the HyperMap instance.
Arguments:
index -- index of hypermap in bcf if v2 (default 0)
downsample -- downsampling factor of hypermap (default None)
cutoff_at_kV ... | def persistent_parse_hypermap(
self, index=0, downsample=None, cutoff_at_kV=None, lazy=False
):
"""Parse and assign the hypermap to the HyperMap instance.
Arguments:
index -- index of hypermap in bcf if v2 (default 0)
downsample -- downsampling factor of hypermap (default None)
cutoff_at_kV -- ... | https://github.com/hyperspy/hyperspy/issues/1751 | hs.load(filename)
Traceback (most recent call last):
File "<ipython-input-3-ada763a7934e>", line 1, in <module>
hs.load(filename)
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, in load
for filename in filenames]
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, ... | IndexError |
def parse_hypermap(self, index=None, downsample=1, cutoff_at_kV=None, lazy=False):
"""Unpack the Delphi/Bruker binary spectral map and return
numpy array in memory efficient way.
Pure python/numpy implementation -- slow, or
cython/memoryview/numpy implimentation if compilied and present
(fast) is u... | def parse_hypermap(self, index=0, downsample=1, cutoff_at_kV=None, lazy=False):
"""Unpack the Delphi/Bruker binary spectral map and return
numpy array in memory efficient way.
Pure python/numpy implimentation -- slow, or
cython/memoryview/numpy implimentation if compilied and present
(fast) is used... | https://github.com/hyperspy/hyperspy/issues/1751 | hs.load(filename)
Traceback (most recent call last):
File "<ipython-input-3-ada763a7934e>", line 1, in <module>
hs.load(filename)
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, in load
for filename in filenames]
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, ... | IndexError |
def py_parse_hypermap(
self,
index=None,
downsample=1,
cutoff_at_channel=None, # noqa
description=False,
):
"""Unpack the Delphi/Bruker binary spectral map and return
numpy array in memory efficient way using pure python implementation.
(Slow!)
The function is long and complicated ... | def py_parse_hypermap(
self,
index=0,
downsample=1,
cutoff_at_channel=None, # noqa
description=False,
):
"""Unpack the Delphi/Bruker binary spectral map and return
numpy array in memory efficient way using pure python implementation.
(Slow!)
The function is long and complicated bec... | https://github.com/hyperspy/hyperspy/issues/1751 | hs.load(filename)
Traceback (most recent call last):
File "<ipython-input-3-ada763a7934e>", line 1, in <module>
hs.load(filename)
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, in load
for filename in filenames]
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, ... | IndexError |
def file_reader(
filename,
select_type=None,
index=None,
downsample=1, # noqa
cutoff_at_kV=None,
instrument=None,
lazy=False,
):
"""Reads a bruker bcf file and loads the data into the appropriate class,
then wraps it into appropriate hyperspy required list of dictionaries
used b... | def file_reader(
filename,
select_type=None,
index=0,
downsample=1, # noqa
cutoff_at_kV=None,
instrument=None,
lazy=False,
):
"""Reads a bruker bcf file and loads the data into the appropriate class,
then wraps it into appropriate hyperspy required list of dictionaries
used by h... | https://github.com/hyperspy/hyperspy/issues/1751 | hs.load(filename)
Traceback (most recent call last):
File "<ipython-input-3-ada763a7934e>", line 1, in <module>
hs.load(filename)
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, in load
for filename in filenames]
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, ... | IndexError |
def bcf_hyperspectra(
obj_bcf,
index=None,
downsample=None,
cutoff_at_kV=None, # noqa
lazy=False,
):
"""Return hyperspy required list of dict with eds
hyperspectra and metadata.
"""
global warn_once
if (fast_unbcf == False) and warn_once:
_logger.warning("""unbcf_fast li... | def bcf_hyperspectra(
obj_bcf,
index=0,
downsample=None,
cutoff_at_kV=None, # noqa
lazy=False,
):
"""Return hyperspy required list of dict with eds
hyperspectra and metadata.
"""
global warn_once
if (fast_unbcf == False) and warn_once:
_logger.warning("""unbcf_fast libra... | https://github.com/hyperspy/hyperspy/issues/1751 | hs.load(filename)
Traceback (most recent call last):
File "<ipython-input-3-ada763a7934e>", line 1, in <module>
hs.load(filename)
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, in load
for filename in filenames]
File "C:\ProgramData\Anaconda3\lib\site-packages\hyperspy\io.py", line 243, ... | IndexError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.