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 getsource(obj, is_binary=False): """Wrapper around inspect.getsource. This can be modified by other projects to provide customized source extraction. Inputs: - obj: an object whose source code we will attempt to extract. Optional inputs: - is_binary: whether the object is known to come from a binary source. This implementation will skip returning any output for binary objects, but custom extractors may know how to meaningfully process them.""" if is_binary: return None else: # get source if obj was decorated with @decorator if hasattr(obj, "__wrapped__"): obj = obj.__wrapped__ try: src = inspect.getsource(obj) except TypeError: if hasattr(obj, "__class__"): src = inspect.getsource(obj.__class__) encoding = get_encoding(obj) return cast_unicode(src, encoding=encoding)
def getsource(obj, is_binary=False): """Wrapper around inspect.getsource. This can be modified by other projects to provide customized source extraction. Inputs: - obj: an object whose source code we will attempt to extract. Optional inputs: - is_binary: whether the object is known to come from a binary source. This implementation will skip returning any output for binary objects, but custom extractors may know how to meaningfully process them.""" if is_binary: return None else: # get source if obj was decorated with @decorator if hasattr(obj, "__wrapped__"): obj = obj.__wrapped__ try: src = inspect.getsource(obj) except TypeError: if hasattr(obj, "__class__"): src = inspect.getsource(obj.__class__) return src
https://github.com/ipython/ipython/issues/1688
In [1]: %run err.py --------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) C:\python\ipydevel\VENV\Py27\lib\site-packages\ipython-0.13.dev-py2.7.egg\IPython\utils\py3compat.pyc in execfile(fname, glob, loc) 166 else: 167 filename = fname --> 168 exec compile(scripttext, filename, 'exec') in glob, loc 169 else: 170 def execfile(fname, *where): C:\python\ipydevel\err.py in <module>() 5 b=2+4 6 ----> 7 a() C:\python\ipydevel\err.py in a() 2 def a(): 3 a=1+2 ----> 4 1/0 5 b=2+4 6 ZeroDivisionError: integer division or modulo by zero
ZeroDivisionError
def _getdef(self, obj, oname=""): """Return the definition header for any callable object. If any exception is generated, None is returned instead and the exception is suppressed.""" try: hdef = oname + inspect.formatargspec(*getargspec(obj)) return cast_unicode(hdef) except: return None
def _getdef(self, obj, oname=""): """Return the definition header for any callable object. If any exception is generated, None is returned instead and the exception is suppressed.""" try: # We need a plain string here, NOT unicode! hdef = oname + inspect.formatargspec(*getargspec(obj)) return py3compat.unicode_to_str(hdef, "ascii") except: return None
https://github.com/ipython/ipython/issues/1688
In [1]: %run err.py --------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) C:\python\ipydevel\VENV\Py27\lib\site-packages\ipython-0.13.dev-py2.7.egg\IPython\utils\py3compat.pyc in execfile(fname, glob, loc) 166 else: 167 filename = fname --> 168 exec compile(scripttext, filename, 'exec') in glob, loc 169 else: 170 def execfile(fname, *where): C:\python\ipydevel\err.py in <module>() 5 b=2+4 6 ----> 7 a() C:\python\ipydevel\err.py in a() 2 def a(): 3 a=1+2 ----> 4 1/0 5 b=2+4 6 ZeroDivisionError: integer division or modulo by zero
ZeroDivisionError
def psource(self, obj, oname=""): """Print the source code for an object.""" # Flush the source cache because inspect can return out-of-date source linecache.checkcache() try: src = getsource(obj) except: self.noinfo("source", oname) else: page.page(self.format(src))
def psource(self, obj, oname=""): """Print the source code for an object.""" # Flush the source cache because inspect can return out-of-date source linecache.checkcache() try: src = getsource(obj) except: self.noinfo("source", oname) else: page.page(self.format(py3compat.unicode_to_str(src)))
https://github.com/ipython/ipython/issues/1688
In [1]: %run err.py --------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) C:\python\ipydevel\VENV\Py27\lib\site-packages\ipython-0.13.dev-py2.7.egg\IPython\utils\py3compat.pyc in execfile(fname, glob, loc) 166 else: 167 filename = fname --> 168 exec compile(scripttext, filename, 'exec') in glob, loc 169 else: 170 def execfile(fname, *where): C:\python\ipydevel\err.py in <module>() 5 b=2+4 6 ----> 7 a() C:\python\ipydevel\err.py in a() 2 def a(): 3 a=1+2 ----> 4 1/0 5 b=2+4 6 ZeroDivisionError: integer division or modulo by zero
ZeroDivisionError
def pfile(self, obj, oname=""): """Show the whole file where an object was defined.""" lineno = find_source_lines(obj) if lineno is None: self.noinfo("file", oname) return ofile = find_file(obj) # run contents of file through pager starting at line where the object # is defined, as long as the file isn't binary and is actually on the # filesystem. if ofile.endswith((".so", ".dll", ".pyd")): print("File %r is binary, not printing." % ofile) elif not os.path.isfile(ofile): print("File %r does not exist, not printing." % ofile) else: # Print only text files, not extension binaries. Note that # getsourcelines returns lineno with 1-offset and page() uses # 0-offset, so we must adjust. page.page( self.format(openpy.read_py_file(ofile, skip_encoding_cookie=False)), lineno - 1, )
def pfile(self, obj, oname=""): """Show the whole file where an object was defined.""" lineno = find_source_lines(obj) if lineno is None: self.noinfo("file", oname) return ofile = find_file(obj) # run contents of file through pager starting at line where the object # is defined, as long as the file isn't binary and is actually on the # filesystem. if ofile.endswith((".so", ".dll", ".pyd")): print("File %r is binary, not printing." % ofile) elif not os.path.isfile(ofile): print("File %r does not exist, not printing." % ofile) else: # Print only text files, not extension binaries. Note that # getsourcelines returns lineno with 1-offset and page() uses # 0-offset, so we must adjust. page.page(self.format(open(ofile).read()), lineno - 1)
https://github.com/ipython/ipython/issues/1688
In [1]: %run err.py --------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) C:\python\ipydevel\VENV\Py27\lib\site-packages\ipython-0.13.dev-py2.7.egg\IPython\utils\py3compat.pyc in execfile(fname, glob, loc) 166 else: 167 filename = fname --> 168 exec compile(scripttext, filename, 'exec') in glob, loc 169 else: 170 def execfile(fname, *where): C:\python\ipydevel\err.py in <module>() 5 b=2+4 6 ----> 7 a() C:\python\ipydevel\err.py in a() 2 def a(): 3 a=1+2 ----> 4 1/0 5 b=2+4 6 ZeroDivisionError: integer division or modulo by zero
ZeroDivisionError
def _format_fields(self, fields, title_width=12): """Formats a list of fields for display. Parameters ---------- fields : list A list of 2-tuples: (field_title, field_content) title_width : int How many characters to pad titles to. Default 12. """ out = [] header = self.__head for title, content in fields: if len(content.splitlines()) > 1: title = header(title + ":") + "\n" else: title = header((title + ":").ljust(title_width)) out.append(cast_unicode(title) + cast_unicode(content)) return "\n".join(out)
def _format_fields(self, fields, title_width=12): """Formats a list of fields for display. Parameters ---------- fields : list A list of 2-tuples: (field_title, field_content) title_width : int How many characters to pad titles to. Default 12. """ out = [] header = self.__head for title, content in fields: if len(content.splitlines()) > 1: title = header(title + ":") + "\n" else: title = header((title + ":").ljust(title_width)) out.append(title + content) return "\n".join(out)
https://github.com/ipython/ipython/issues/1688
In [1]: %run err.py --------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) C:\python\ipydevel\VENV\Py27\lib\site-packages\ipython-0.13.dev-py2.7.egg\IPython\utils\py3compat.pyc in execfile(fname, glob, loc) 166 else: 167 filename = fname --> 168 exec compile(scripttext, filename, 'exec') in glob, loc 169 else: 170 def execfile(fname, *where): C:\python\ipydevel\err.py in <module>() 5 b=2+4 6 ----> 7 a() C:\python\ipydevel\err.py in a() 2 def a(): 3 a=1+2 ----> 4 1/0 5 b=2+4 6 ZeroDivisionError: integer division or modulo by zero
ZeroDivisionError
def pinfo(self, obj, oname="", formatter=None, info=None, detail_level=0): """Show detailed information about an object. Optional arguments: - oname: name of the variable pointing to the object. - formatter: special formatter for docstrings (see pdoc) - info: a structure with some information fields which may have been precomputed already. - detail_level: if set to 1, more information is given. """ info = self.info( obj, oname=oname, formatter=formatter, info=info, detail_level=detail_level ) displayfields = [] def add_fields(fields): for title, key in fields: field = info[key] if field is not None: displayfields.append((title, field.rstrip())) add_fields(self.pinfo_fields1) # Base class for old-style instances if ( (not py3compat.PY3) and isinstance(obj, types.InstanceType) and info["base_class"] ): displayfields.append(("Base Class", info["base_class"].rstrip())) add_fields(self.pinfo_fields2) # Namespace if info["namespace"] != "Interactive": displayfields.append(("Namespace", info["namespace"].rstrip())) add_fields(self.pinfo_fields3) # Source or docstring, depending on detail level and whether # source found. if detail_level > 0 and info["source"] is not None: displayfields.append(("Source", self.format(cast_unicode(info["source"])))) elif info["docstring"] is not None: displayfields.append(("Docstring", info["docstring"])) # Constructor info for classes if info["isclass"]: if info["init_definition"] or info["init_docstring"]: displayfields.append(("Constructor information", "")) if info["init_definition"] is not None: displayfields.append((" Definition", info["init_definition"].rstrip())) if info["init_docstring"] is not None: displayfields.append((" Docstring", indent(info["init_docstring"]))) # Info for objects: else: add_fields(self.pinfo_fields_obj) # Finally send to printer/pager: if displayfields: page.page(self._format_fields(displayfields))
def pinfo(self, obj, oname="", formatter=None, info=None, detail_level=0): """Show detailed information about an object. Optional arguments: - oname: name of the variable pointing to the object. - formatter: special formatter for docstrings (see pdoc) - info: a structure with some information fields which may have been precomputed already. - detail_level: if set to 1, more information is given. """ info = self.info( obj, oname=oname, formatter=formatter, info=info, detail_level=detail_level ) displayfields = [] def add_fields(fields): for title, key in fields: field = info[key] if field is not None: displayfields.append((title, field.rstrip())) add_fields(self.pinfo_fields1) # Base class for old-style instances if ( (not py3compat.PY3) and isinstance(obj, types.InstanceType) and info["base_class"] ): displayfields.append(("Base Class", info["base_class"].rstrip())) add_fields(self.pinfo_fields2) # Namespace if info["namespace"] != "Interactive": displayfields.append(("Namespace", info["namespace"].rstrip())) add_fields(self.pinfo_fields3) # Source or docstring, depending on detail level and whether # source found. if detail_level > 0 and info["source"] is not None: displayfields.append( ("Source", self.format(py3compat.cast_bytes_py2(info["source"]))) ) elif info["docstring"] is not None: displayfields.append(("Docstring", info["docstring"])) # Constructor info for classes if info["isclass"]: if info["init_definition"] or info["init_docstring"]: displayfields.append(("Constructor information", "")) if info["init_definition"] is not None: displayfields.append((" Definition", info["init_definition"].rstrip())) if info["init_docstring"] is not None: displayfields.append((" Docstring", indent(info["init_docstring"]))) # Info for objects: else: add_fields(self.pinfo_fields_obj) # Finally send to printer/pager: if displayfields: page.page(self._format_fields(displayfields))
https://github.com/ipython/ipython/issues/1688
In [1]: %run err.py --------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) C:\python\ipydevel\VENV\Py27\lib\site-packages\ipython-0.13.dev-py2.7.egg\IPython\utils\py3compat.pyc in execfile(fname, glob, loc) 166 else: 167 filename = fname --> 168 exec compile(scripttext, filename, 'exec') in glob, loc 169 else: 170 def execfile(fname, *where): C:\python\ipydevel\err.py in <module>() 5 b=2+4 6 ----> 7 a() C:\python\ipydevel\err.py in a() 2 def a(): 3 a=1+2 ----> 4 1/0 5 b=2+4 6 ZeroDivisionError: integer division or modulo by zero
ZeroDivisionError
def tkinter_clipboard_get(): """Get the clipboard's text using Tkinter. This is the default on systems that are not Windows or OS X. It may interfere with other UI toolkits and should be replaced with an implementation that uses that toolkit. """ try: import Tkinter except ImportError: raise TryNext( "Getting text from the clipboard on this platform requires Tkinter." ) root = Tkinter.Tk() root.withdraw() text = root.clipboard_get() root.destroy() text = py3compat.cast_unicode(text, py3compat.DEFAULT_ENCODING) return text
def tkinter_clipboard_get(): """Get the clipboard's text using Tkinter. This is the default on systems that are not Windows or OS X. It may interfere with other UI toolkits and should be replaced with an implementation that uses that toolkit. """ try: import Tkinter except ImportError: raise TryNext( "Getting text from the clipboard on this platform requires Tkinter." ) root = Tkinter.Tk() root.withdraw() text = root.clipboard_get() root.destroy() return text
https://github.com/ipython/ipython/issues/1688
In [1]: %run err.py --------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) C:\python\ipydevel\VENV\Py27\lib\site-packages\ipython-0.13.dev-py2.7.egg\IPython\utils\py3compat.pyc in execfile(fname, glob, loc) 166 else: 167 filename = fname --> 168 exec compile(scripttext, filename, 'exec') in glob, loc 169 else: 170 def execfile(fname, *where): C:\python\ipydevel\err.py in <module>() 5 b=2+4 6 ----> 7 a() C:\python\ipydevel\err.py in a() 2 def a(): 3 a=1+2 ----> 4 1/0 5 b=2+4 6 ZeroDivisionError: integer division or modulo by zero
ZeroDivisionError
def less(self, arg_s): """Show a file through the pager. Files ending in .py are syntax-highlighted.""" if not arg_s: raise UsageError("Missing filename.") cont = open(arg_s).read() if arg_s.endswith(".py"): cont = self.shell.pycolorize( openpy.read_py_file(arg_s, skip_encoding_cookie=False) ) else: cont = open(arg_s).read() page.page(cont)
def less(self, arg_s): """Show a file through the pager. Files ending in .py are syntax-highlighted.""" if not arg_s: raise UsageError("Missing filename.") cont = open(arg_s).read() if arg_s.endswith(".py"): cont = self.shell.pycolorize(cont) page.page(cont)
https://github.com/ipython/ipython/issues/1688
In [1]: %run err.py --------------------------------------------------------------------------- ZeroDivisionError Traceback (most recent call last) C:\python\ipydevel\VENV\Py27\lib\site-packages\ipython-0.13.dev-py2.7.egg\IPython\utils\py3compat.pyc in execfile(fname, glob, loc) 166 else: 167 filename = fname --> 168 exec compile(scripttext, filename, 'exec') in glob, loc 169 else: 170 def execfile(fname, *where): C:\python\ipydevel\err.py in <module>() 5 b=2+4 6 ----> 7 a() C:\python\ipydevel\err.py in a() 2 def a(): 3 a=1+2 ----> 4 1/0 5 b=2+4 6 ZeroDivisionError: integer division or modulo by zero
ZeroDivisionError
def merge_branch(repo, branch): """try to merge the givent branch into the current one If something does not goes smoothly, merge is aborted Returns True if merge sucessfull, False otherwise """ # Delete the branch first try: check_call(["git", "pull", repo, branch], stdin=io.open(os.devnull)) except CalledProcessError: check_call(["git", "merge", "--abort"]) return False return True
def merge_branch(repo, branch): """try to merge the givent branch into the current one If something does not goes smoothly, merge is aborted Returns True if merge sucessfull, False otherwise """ # Delete the branch first try: check_call(["git", "pull", "--no-edit", repo, branch]) except CalledProcessError: check_call(["git", "merge", "--abort"]) return False return True
https://github.com/ipython/ipython/issues/2195
(master)longs[ipython]> git mpr -m 2179 error: unknown option `no-edit' usage: git fetch [<options>] [<repository> [<refspec>...]] or: git fetch [<options>] <group> or: git fetch --multiple [<options>] [(<repository> | <group>)...] or: git fetch --all [<options>] -v, --verbose be more verbose -q, --quiet be more quiet --all fetch from all remotes -a, --append append to .git/FETCH_HEAD instead of overwriting --upload-pack <path> path to upload pack on remote end -f, --force force overwrite of local branch -m, --multiple fetch from multiple remotes -t, --tags fetch all tags and associated objects -n do not fetch all tags (--no-tags) -p, --prune prune remote-tracking branches no longer on remote --recurse-submodules[=<on-demand>] control recursive fetching of submodules --dry-run dry run -k, --keep keep downloaded pack -u, --update-head-ok allow updating of HEAD ref --progress force progress reporting --depth <depth> deepen history of shallow clone fatal: There is no merge to abort (MERGE_HEAD missing). Traceback (most recent call last): File "/home/fperez/usr/bin//git-mpr", line 117, in <module> main() File "/home/fperez/usr/bin//git-mpr", line 107, in main merge_pr(num) File "/home/fperez/usr/bin//git-mpr", line 46, in merge_pr branch=branch, File "/home/fperez/usr/bin//git-mpr", line 29, in merge_branch check_call(['git', 'merge', '--abort']) File "/usr/lib/python2.7/subprocess.py", line 511, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['git', 'merge', '--abort']' returned non-zero exit status 128
subprocess.CalledProcessError
def main(*args): parser = argparse.ArgumentParser( description=""" Merge one or more github pull requests by their number. If any one pull request can't be merged as is, its merge is ignored and the process continues with the next ones (if any). """ ) grp = parser.add_mutually_exclusive_group() grp.add_argument( "-l", "--list", action="store_const", const=True, help="list PR, their number and their mergeability", ) grp.add_argument( "-a", "--merge-all", action="store_const", const=True, help="try to merge as many PR as possible, one by one", ) parser.add_argument( "integers", type=int, help="The pull request numbers", nargs="*", metavar="pr-number", ) args = parser.parse_args() if args.list: pr_list = gh_api.get_pulls_list(gh_project) for pr in pr_list: mergeable = gh_api.get_pull_request(gh_project, pr["number"])["mergeable"] ismgb = "√" if mergeable else " " print( "* #{number} [{ismgb}]: {title}".format( number=pr["number"], title=pr["title"], ismgb=ismgb ) ) if args.merge_all: pr_list = gh_api.get_pulls_list(gh_project) for pr in pr_list: merge_pr(pr["number"]) elif args.merge: for num in args.merge: merge_pr(num) if not_merged: print( "*************************************************************************************" ) print( "the following branch have not been merged automatically, considere doing it by hand :" ) for num, cmd in not_merged.items(): print("PR {num}: {cmd}".format(num=num, cmd=cmd)) print( "*************************************************************************************" )
def main(*args): parser = argparse.ArgumentParser( description=""" Merge (one|many) github pull request by their number.\ If pull request can't be merge as is, cancel merge, and continue to the next if any. """ ) parser.add_argument("-v2", "--githubapiv2", action="store_const", const=2) grp = parser.add_mutually_exclusive_group() grp.add_argument( "-l", "--list", action="store_const", const=True, help="list PR, their number and their mergeability", ) grp.add_argument( "-a", "--merge-all", action="store_const", const=True, help="try to merge as many PR as possible, one by one", ) grp.add_argument( "-m", "--merge", type=int, help="The pull request numbers", nargs="*", metavar="pr-number", ) args = parser.parse_args() if args.list: pr_list = gh_api.get_pulls_list(gh_project) for pr in pr_list: mergeable = gh_api.get_pull_request(gh_project, pr["number"])["mergeable"] ismgb = "√" if mergeable else " " print( "* #{number} [{ismgb}]: {title}".format( number=pr["number"], title=pr["title"], ismgb=ismgb ) ) if args.merge_all: pr_list = gh_api.get_pulls_list(gh_project) for pr in pr_list: merge_pr(pr["number"]) elif args.merge: for num in args.merge: merge_pr(num) if not_merged: print( "*************************************************************************************" ) print( "the following branch have not been merged automatically, considere doing it by hand :" ) for num, cmd in not_merged.items(): print("PR {num}: {cmd}".format(num=num, cmd=cmd)) print( "*************************************************************************************" )
https://github.com/ipython/ipython/issues/2195
(master)longs[ipython]> git mpr -m 2179 error: unknown option `no-edit' usage: git fetch [<options>] [<repository> [<refspec>...]] or: git fetch [<options>] <group> or: git fetch --multiple [<options>] [(<repository> | <group>)...] or: git fetch --all [<options>] -v, --verbose be more verbose -q, --quiet be more quiet --all fetch from all remotes -a, --append append to .git/FETCH_HEAD instead of overwriting --upload-pack <path> path to upload pack on remote end -f, --force force overwrite of local branch -m, --multiple fetch from multiple remotes -t, --tags fetch all tags and associated objects -n do not fetch all tags (--no-tags) -p, --prune prune remote-tracking branches no longer on remote --recurse-submodules[=<on-demand>] control recursive fetching of submodules --dry-run dry run -k, --keep keep downloaded pack -u, --update-head-ok allow updating of HEAD ref --progress force progress reporting --depth <depth> deepen history of shallow clone fatal: There is no merge to abort (MERGE_HEAD missing). Traceback (most recent call last): File "/home/fperez/usr/bin//git-mpr", line 117, in <module> main() File "/home/fperez/usr/bin//git-mpr", line 107, in main merge_pr(num) File "/home/fperez/usr/bin//git-mpr", line 46, in merge_pr branch=branch, File "/home/fperez/usr/bin//git-mpr", line 29, in merge_branch check_call(['git', 'merge', '--abort']) File "/usr/lib/python2.7/subprocess.py", line 511, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['git', 'merge', '--abort']' returned non-zero exit status 128
subprocess.CalledProcessError
def init_magics(self): super(ZMQInteractiveShell, self).init_magics() self.register_magics(KernelMagics) self.run_line_magic("alias_magic", "ed edit")
def init_magics(self): super(ZMQInteractiveShell, self).init_magics() self.register_magics(KernelMagics)
https://github.com/ipython/ipython/issues/2085
%ed IPython will make a temporary file named: /var/folders/gw/ttdxvysn20sf7tspmk384q000000gn/T/ipython_edit_d2eA7c.py Editing...--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-1-649c77c2a5b5> in <module>() ----> 1 get_ipython().magic(u'ed') /Library/Python/2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s) 2159 magic_name, _, magic_arg_s = arg_s.partition(' ') 2160 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC) -> 2161 return self.run_line_magic(magic_name, magic_arg_s) 2162 2163 #------------------------------------------------------------------------- /Library/Python/2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line) 2085 args.append(sys._getframe(stack_depth).f_locals) 2086 with self.builtin_trap: -> 2087 result = fn(*args) 2088 return result 2089 /Library/Python/2.7/site-packages/IPython/core/magics/code.pyc in ed(self, parameter_s) /Library/Python/2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k) 189 # but it's overkill for just that one bit of state. 190 def magic_deco(arg): --> 191 call = lambda f, *a, **k: f(*a, **k) 192 193 if callable(arg): /Library/Python/2.7/site-packages/IPython/core/magics/code.pyc in ed(self, parameter_s) 327 def ed(self, parameter_s=''): 328 """Alias to %edit.""" --> 329 return self.edit(parameter_s) 330 331 @skip_doctest /Library/Python/2.7/site-packages/IPython/core/magics/code.pyc in edit(self, parameter_s, last_call) /Library/Python/2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k) 189 # but it's overkill for just that one bit of state. 190 def magic_deco(arg): --> 191 call = lambda f, *a, **k: f(*a, **k) 192 193 if callable(arg): /Library/Python/2.7/site-packages/IPython/core/magics/code.pyc in edit(self, parameter_s, last_call) 490 if ' ' in filename: 491 filename = "'%s'" % filename --> 492 self.shell.hooks.editor(filename,lineno) 493 except TryNext: 494 warn('Could not open editor') /Library/Python/2.7/site-packages/IPython/core/hooks.pyc in __call__(self, *args, **kw) 136 #print "prio",prio,"cmd",cmd #dbg 137 try: --> 138 return cmd(*args, **kw) 139 except TryNext as exc: 140 last_exc = exc /Library/Python/2.7/site-packages/IPython/core/hooks.pyc in editor(self, filename, linenum, wait) 65 # IPython configures a default editor at startup by reading $EDITOR from 66 # the environment, and falling back on vi (unix) or notepad (win32). ---> 67 editor = self.editor 68 69 # marker for at which line to open the file (for existing objects) AttributeError: 'ZMQInteractiveShell' object has no attribute 'editor'
AttributeError
def pycmd2argv(cmd): r"""Take the path of a python command and return a list (argv-style). This only works on Python based command line programs and will find the location of the ``python`` executable using ``sys.executable`` to make sure the right version is used. For a given path ``cmd``, this returns [cmd] if cmd's extension is .exe, .com or .bat, and [, cmd] otherwise. Parameters ---------- cmd : string The path of the command. Returns ------- argv-style list. """ ext = os.path.splitext(cmd)[1] if ext in [".exe", ".com", ".bat"]: return [cmd] else: if sys.platform == "win32": return [sys.executable, cmd] else: return [sys.executable, cmd]
def pycmd2argv(cmd): r"""Take the path of a python command and return a list (argv-style). This only works on Python based command line programs and will find the location of the ``python`` executable using ``sys.executable`` to make sure the right version is used. For a given path ``cmd``, this returns [cmd] if cmd's extension is .exe, .com or .bat, and [, cmd] otherwise. Parameters ---------- cmd : string The path of the command. Returns ------- argv-style list. """ ext = os.path.splitext(cmd)[1] if ext in [".exe", ".com", ".bat"]: return [cmd] else: if sys.platform == "win32": # The -u option here turns on unbuffered output, which is required # on Win32 to prevent wierd conflict and problems with Twisted. # Also, use sys.executable to make sure we are picking up the # right python exe. return [sys.executable, "-u", cmd] else: return [sys.executable, cmd]
https://github.com/ipython/ipython/issues/1428
FAIL: Test that prun does not clobber string escapes (GH #1302) ---------------------------------------------------------------------- Traceback (most recent call last): File "c:\python26\lib\site-packages\nose\case.py", line 197, in runTest self.test(*self.arg) File "c:\python\external\ipython\IPython\testing\decorators.py", line 228, in skipper_func return f(*args, **kwargs) File "c:\python\external\ipython\IPython\core\tests\test_magic.py", line 396, in test_prun_quotes nt.assert_equal(_ip.user_ns['x'], '\t') AssertionError: ' ' != '\t' raise self.failureException, \ (None or '%r != %r' % (' ', '\t'))
AssertionError
def system(cmd): """Win32 version of os.system() that works with network shares. Note that this implementation returns None, as meant for use in IPython. Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- None : we explicitly do NOT return the subprocess status code, as this utility is meant to be used extensively in IPython, where any return value would trigger :func:`sys.displayhook` calls. """ # The controller provides interactivity with both # stdin and stdout # import _process_win32_controller # _process_win32_controller.system(cmd) with AvoidUNCPath() as path: if path is not None: cmd = '"pushd %s &&"%s' % (path, cmd) return process_handler(cmd, _system_body)
def system(cmd): """Win32 version of os.system() that works with network shares. Note that this implementation returns None, as meant for use in IPython. Parameters ---------- cmd : str A command to be executed in the system shell. Returns ------- None : we explicitly do NOT return the subprocess status code, as this utility is meant to be used extensively in IPython, where any return value would trigger :func:`sys.displayhook` calls. """ # The controller provides interactivity with both # stdin and stdout import _process_win32_controller _process_win32_controller.system(cmd)
https://github.com/ipython/ipython/issues/1632
TypeError Traceback (most recent call last) c:\Users\jmarch\<ipython-input-2-56af63bcfcf6> in <module>() ----> 1 get_ipython().magic(u'cd ..') c:\users\jmarch\ipython\IPython\core\interactiveshell.pyc in magic(self, arg_s, next_input) 2034 self._magic_locals = sys._getframe(1).f_locals 2035 with self.builtin_trap: -> 2036 result = fn(magic_args) 2037 # Ensure we're not keeping object references around: 2038 self._magic_locals = {} c:\users\jmarch\ipython\IPython\core\magic.pyc in magic_cd(self, parameter_s) 2953 # for c:\windows\directory\names\ 2954 parameter_s = re.sub(r'\\(?! )','/', parameter_s) -> 2955 opts,ps = self.parse_options(parameter_s,'qb',mode='string') 2956 # jump to previous 2957 if ps == '-': c:\users\jmarch\ipython\IPython\core\magic.pyc in parse_options(self, arg_str, opt_str, *long_opts, **kw) 279 # If the list of inputs only has 0 or 1 thing in it, there's no 280 # need to look for options --> 281 argv = arg_split(arg_str, posix, strict) 282 # Do regular option processing 283 try: c:\users\jmarch\ipython\IPython\utils\_process_win32.pyc in arg_split(commandline, posix, strict) 178 result_pointer = CommandLineToArgvW(py3compat.cast_unicode(commandline.lstrip()), ctypes.byref(argvn)) 179 result_array_type = LPCWSTR * argvn.value --> 180 result = [arg for arg in result_array_type.from_address(result_pointer)] 181 retval = LocalFree(result_pointer) 182 return result TypeError: integer expected
TypeError
def _showtraceback(self, etype, evalue, stb): exc_content = { "traceback": stb, "ename": unicode(etype.__name__), "evalue": safe_unicode(evalue), } dh = self.displayhook # Send exception info over pub socket for other clients than the caller # to pick up topic = None if dh.topic: topic = dh.topic.replace(b"pyout", b"pyerr") exc_msg = dh.session.send( dh.pub_socket, "pyerr", json_clean(exc_content), dh.parent_header, ident=topic ) # FIXME - Hack: store exception info in shell object. Right now, the # caller is reading this info after the fact, we need to fix this logic # to remove this hack. Even uglier, we need to store the error status # here, because in the main loop, the logic that sets it is being # skipped because runlines swallows the exceptions. exc_content["status"] = "error" self._reply_content = exc_content # /FIXME return exc_content
def _showtraceback(self, etype, evalue, stb): exc_content = { "traceback": stb, "ename": unicode(etype.__name__), "evalue": unicode(evalue), } dh = self.displayhook # Send exception info over pub socket for other clients than the caller # to pick up topic = None if dh.topic: topic = dh.topic.replace(b"pyout", b"pyerr") exc_msg = dh.session.send( dh.pub_socket, "pyerr", json_clean(exc_content), dh.parent_header, ident=topic ) # FIXME - Hack: store exception info in shell object. Right now, the # caller is reading this info after the fact, we need to fix this logic # to remove this hack. Even uglier, we need to store the error status # here, because in the main loop, the logic that sets it is being # skipped because runlines swallows the exceptions. exc_content["status"] = "error" self._reply_content = exc_content # /FIXME return exc_content
https://github.com/ipython/ipython/issues/1827
UnicodeDecodeError Traceback (most recent call last) /Users/jonathantaylor/ipython/IPython/core/interactiveshell.pyc in run_code(self, code_obj) 2722 self.CustomTB(etype,value,tb) 2723 except: -> 2724 self.showtraceback() 2725 else: 2726 outflag = 0 /Users/jonathantaylor/ipython/IPython/core/interactiveshell.pyc in showtraceback(self, exc_tuple, filename, tb_offset, exception_only) 1713 value, tb, tb_offset=tb_offset) 1714 -> 1715 self._showtraceback(etype, value, stb) 1716 if self.call_pdb: 1717 # drop into debugger /Users/jonathantaylor/ipython/IPython/zmq/zmqshell.pyc in showtraceback(self, etype, evalue, stb) 505 u'traceback' : stb, 506 u'ename' : unicode(etype.name_), --> 507 u'evalue' : unicode(evalue) 508 } 509 UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 132: ordinal not in range(128)'
UnicodeDecodeError
def save_task_result(self, idents, msg): """save the result of a completed task.""" client_id = idents[0] try: msg = self.session.unserialize(msg) except Exception: self.log.error( "task::invalid task result message send to %r: %r", client_id, msg, exc_info=True, ) return parent = msg["parent_header"] if not parent: # print msg self.log.warn("Task %r had no parent!", msg) return msg_id = parent["msg_id"] if msg_id in self.unassigned: self.unassigned.remove(msg_id) header = msg["header"] engine_uuid = header.get("engine", None) eid = self.by_ident.get(engine_uuid, None) status = header.get("status", None) if msg_id in self.pending: self.log.info("task::task %r finished on %s", msg_id, eid) self.pending.remove(msg_id) self.all_completed.add(msg_id) if eid is not None: if status != "aborted": self.completed[eid].append(msg_id) if msg_id in self.tasks[eid]: self.tasks[eid].remove(msg_id) completed = header["date"] started = header.get("started", None) result = { "result_header": header, "result_content": msg["content"], "started": started, "completed": completed, "received": datetime.now(), "engine_uuid": engine_uuid, } result["result_buffers"] = msg["buffers"] try: self.db.update_record(msg_id, result) except Exception: self.log.error("DB Error saving task request %r", msg_id, exc_info=True) else: self.log.debug("task::unknown task %r finished", msg_id)
def save_task_result(self, idents, msg): """save the result of a completed task.""" client_id = idents[0] try: msg = self.session.unserialize(msg) except Exception: self.log.error( "task::invalid task result message send to %r: %r", client_id, msg, exc_info=True, ) return parent = msg["parent_header"] if not parent: # print msg self.log.warn("Task %r had no parent!", msg) return msg_id = parent["msg_id"] if msg_id in self.unassigned: self.unassigned.remove(msg_id) header = msg["header"] engine_uuid = header.get("engine", None) eid = self.by_ident.get(engine_uuid, None) if msg_id in self.pending: self.log.info("task::task %r finished on %s", msg_id, eid) self.pending.remove(msg_id) self.all_completed.add(msg_id) if eid is not None: self.completed[eid].append(msg_id) if msg_id in self.tasks[eid]: self.tasks[eid].remove(msg_id) completed = header["date"] started = header.get("started", None) result = { "result_header": header, "result_content": msg["content"], "started": started, "completed": completed, "received": datetime.now(), "engine_uuid": engine_uuid, } result["result_buffers"] = msg["buffers"] try: self.db.update_record(msg_id, result) except Exception: self.log.error("DB Error saving task request %r", msg_id, exc_info=True) else: self.log.debug("task::unknown task %r finished", msg_id)
https://github.com/ipython/ipython/issues/1647
In [14]: client.resubmit("2e8e2c96-1767-4c7e-b26c-498682fa4c85") --------------------------------------------------------------------------- RemoteError Traceback (most recent call last) /Users/kaazoo/<ipython-input-15-bd12698bd336> in <module>() ----> 1 client.resubmit("2e8e2c96-1767-4c7e-b26c-498682fa4c85") /Users/kaazoo/<string> in resubmit(self, indices_or_msg_ids, subheader, block) /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/parallel/client/client.pyc in spin_first(f, self, *args, **kwargs) 65 """Call spin() to sync state prior to calling the method.""" 66 self.spin() ---> 67 return f(self, *args, **kwargs) 68 69 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/parallel/client/client.pyc in resubmit(self, indices_or_msg_ids, subheader, block) 1238 content = msg['content'] 1239 if content['status'] != 'ok': -> 1240 raise self._unwrap_exception(content) 1241 1242 ar = AsyncHubResult(self, msg_ids=theids) RemoteError: ValueError(Task u'2e8e2c96-1767-4c7e-b26c-498682fa4c85' appears to be inflight) Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/parallel/controller/hub.py", line 1149, in resubmit_task raise ValueError("Task %r appears to be inflight" % msg_id) ValueError: Task u'2e8e2c96-1767-4c7e-b26c-498682fa4c85' appears to be inflight
RemoteError
def new_notebook(name=None, metadata=None, worksheets=None): """Create a notebook by name, id and a list of worksheets.""" nb = NotebookNode() nb.nbformat = nbformat if worksheets is None: nb.worksheets = [] else: nb.worksheets = list(worksheets) if metadata is None: nb.metadata = new_metadata() else: nb.metadata = NotebookNode(metadata) if name is not None: nb.metadata.name = unicode(name) return nb
def new_notebook(metadata=None, worksheets=None): """Create a notebook by name, id and a list of worksheets.""" nb = NotebookNode() nb.nbformat = nbformat if worksheets is None: nb.worksheets = [] else: nb.worksheets = list(worksheets) if metadata is None: nb.metadata = new_metadata() else: nb.metadata = NotebookNode(metadata) return nb
https://github.com/ipython/ipython/issues/1487
%notebook -e foo.py --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /opt/source/packaging/pandas/pandas_build_virtenv/<ipython-input-245-d2b2edf081ed> in <module>() ----> 1 get_ipython().magic(u'notebook -e foo.py') /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s, next_input) 1996 self._magic_locals = sys._getframe(1).f_locals 1997 with self.builtin_trap: -> 1998 result = fn(magic_args) 1999 # Ensure we're not keeping object references around: 2000 self._magic_locals = {} /usr/lib/python2.7/dist-packages/IPython/core/magic.pyc in magic_notebook(self, s) 3547 cells.append(current.new_code_cell(prompt_number=prompt_number, input=input)) 3548 worksheet = current.new_worksheet(cells=cells) -> 3549 nb = current.new_notebook(name=name,worksheets=[worksheet]) 3550 with open(fname, 'w') as f: 3551 current.write(nb, f, format); TypeError: new_notebook() got an unexpected keyword argument 'name'
TypeError
def writes(self, nb, **kwargs): kwargs["cls"] = BytesEncoder kwargs["indent"] = 1 kwargs["sort_keys"] = True kwargs["separators"] = (",", ": ") if kwargs.pop("split_lines", True): nb = split_lines(copy.deepcopy(nb)) return py3compat.str_to_unicode(json.dumps(nb, **kwargs), "utf-8")
def writes(self, nb, **kwargs): kwargs["cls"] = BytesEncoder kwargs["indent"] = 1 kwargs["sort_keys"] = True kwargs["separators"] = (",", ": ") if kwargs.pop("split_lines", True): nb = split_lines(copy.deepcopy(nb)) return json.dumps(nb, **kwargs)
https://github.com/ipython/ipython/issues/1487
%notebook -e foo.py --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /opt/source/packaging/pandas/pandas_build_virtenv/<ipython-input-245-d2b2edf081ed> in <module>() ----> 1 get_ipython().magic(u'notebook -e foo.py') /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s, next_input) 1996 self._magic_locals = sys._getframe(1).f_locals 1997 with self.builtin_trap: -> 1998 result = fn(magic_args) 1999 # Ensure we're not keeping object references around: 2000 self._magic_locals = {} /usr/lib/python2.7/dist-packages/IPython/core/magic.pyc in magic_notebook(self, s) 3547 cells.append(current.new_code_cell(prompt_number=prompt_number, input=input)) 3548 worksheet = current.new_worksheet(cells=cells) -> 3549 nb = current.new_notebook(name=name,worksheets=[worksheet]) 3550 with open(fname, 'w') as f: 3551 current.write(nb, f, format); TypeError: new_notebook() got an unexpected keyword argument 'name'
TypeError
def split_lines(nb): """split likely multiline text into lists of strings For file output more friendly to line-based VCS. ``rejoin_lines(nb)`` will reverse the effects of ``split_lines(nb)``. Used when writing JSON files. """ for ws in nb.worksheets: for cell in ws.cells: if cell.cell_type == "code": if "input" in cell and isinstance(cell.input, basestring): cell.input = (cell.input + "\n").splitlines() for output in cell.outputs: for key in _multiline_outputs: item = output.get(key, None) if isinstance(item, basestring): output[key] = (item + "\n").splitlines() else: # text, heading cell for key in ["source", "rendered"]: item = cell.get(key, None) if isinstance(item, basestring): cell[key] = (item + "\n").splitlines() return nb
def split_lines(nb): """split likely multiline text into lists of strings For file output more friendly to line-based VCS. ``rejoin_lines(nb)`` will reverse the effects of ``split_lines(nb)``. Used when writing JSON files. """ for ws in nb.worksheets: for cell in ws.cells: if cell.cell_type == "code": if "input" in cell and isinstance(cell.input, basestring): cell.input = cell.input.splitlines() for output in cell.outputs: for key in _multiline_outputs: item = output.get(key, None) if isinstance(item, basestring): output[key] = item.splitlines() else: # text, heading cell for key in ["source", "rendered"]: item = cell.get(key, None) if isinstance(item, basestring): cell[key] = item.splitlines() return nb
https://github.com/ipython/ipython/issues/1487
%notebook -e foo.py --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /opt/source/packaging/pandas/pandas_build_virtenv/<ipython-input-245-d2b2edf081ed> in <module>() ----> 1 get_ipython().magic(u'notebook -e foo.py') /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s, next_input) 1996 self._magic_locals = sys._getframe(1).f_locals 1997 with self.builtin_trap: -> 1998 result = fn(magic_args) 1999 # Ensure we're not keeping object references around: 2000 self._magic_locals = {} /usr/lib/python2.7/dist-packages/IPython/core/magic.pyc in magic_notebook(self, s) 3547 cells.append(current.new_code_cell(prompt_number=prompt_number, input=input)) 3548 worksheet = current.new_worksheet(cells=cells) -> 3549 nb = current.new_notebook(name=name,worksheets=[worksheet]) 3550 with open(fname, 'w') as f: 3551 current.write(nb, f, format); TypeError: new_notebook() got an unexpected keyword argument 'name'
TypeError
def read(self, fp, **kwargs): """Read a notebook from a file like object""" nbs = fp.read() if not py3compat.PY3 and not isinstance(nbs, unicode): nbs = py3compat.str_to_unicode(nbs) return self.reads(nbs, **kwargs)
def read(self, fp, **kwargs): """Read a notebook from a file like object""" return self.read(fp.read(), **kwargs)
https://github.com/ipython/ipython/issues/1487
%notebook -e foo.py --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /opt/source/packaging/pandas/pandas_build_virtenv/<ipython-input-245-d2b2edf081ed> in <module>() ----> 1 get_ipython().magic(u'notebook -e foo.py') /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s, next_input) 1996 self._magic_locals = sys._getframe(1).f_locals 1997 with self.builtin_trap: -> 1998 result = fn(magic_args) 1999 # Ensure we're not keeping object references around: 2000 self._magic_locals = {} /usr/lib/python2.7/dist-packages/IPython/core/magic.pyc in magic_notebook(self, s) 3547 cells.append(current.new_code_cell(prompt_number=prompt_number, input=input)) 3548 worksheet = current.new_worksheet(cells=cells) -> 3549 nb = current.new_notebook(name=name,worksheets=[worksheet]) 3550 with open(fname, 'w') as f: 3551 current.write(nb, f, format); TypeError: new_notebook() got an unexpected keyword argument 'name'
TypeError
def write(self, nb, fp, **kwargs): """Write a notebook to a file like object""" nbs = self.writes(nb, **kwargs) if not py3compat.PY3 and not isinstance(nbs, unicode): # this branch is likely only taken for JSON on Python 2 nbs = py3compat.str_to_unicode(nbs) return fp.write(nbs)
def write(self, nb, fp, **kwargs): """Write a notebook to a file like object""" return fp.write(self.writes(nb, **kwargs))
https://github.com/ipython/ipython/issues/1487
%notebook -e foo.py --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /opt/source/packaging/pandas/pandas_build_virtenv/<ipython-input-245-d2b2edf081ed> in <module>() ----> 1 get_ipython().magic(u'notebook -e foo.py') /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s, next_input) 1996 self._magic_locals = sys._getframe(1).f_locals 1997 with self.builtin_trap: -> 1998 result = fn(magic_args) 1999 # Ensure we're not keeping object references around: 2000 self._magic_locals = {} /usr/lib/python2.7/dist-packages/IPython/core/magic.pyc in magic_notebook(self, s) 3547 cells.append(current.new_code_cell(prompt_number=prompt_number, input=input)) 3548 worksheet = current.new_worksheet(cells=cells) -> 3549 nb = current.new_notebook(name=name,worksheets=[worksheet]) 3550 with open(fname, 'w') as f: 3551 current.write(nb, f, format); TypeError: new_notebook() got an unexpected keyword argument 'name'
TypeError
def list_profiles(self): self.update_profiles() result = [self.profile_info(p) for p in sorted(self.profiles.keys())] return result
def list_profiles(self): self.update_profiles() result = [self.profile_info(p) for p in self.profiles.keys()] result.sort() return result
https://github.com/ipython/ipython/issues/1507
Traceback (most recent call last): File "/usr/lib/python3/dist-packages/tornado/web.py", line 954, in _execute getattr(self, self.request.method.lower())(*args, **kwargs) File "/usr/lib/python3/dist-packages/tornado/web.py", line 1667, in wrapper return method(self, *args, **kwargs) File "/usr/lib/python3/dist-packages/IPython/frontend/html/notebook/handlers.py", line 676, in get self.finish(jsonapi.dumps(cm.list_profiles())) File "/usr/lib/python3/dist-packages/IPython/frontend/html/notebook/clustermanager.py", line 95, in list_profiles result.sort() TypeError: unorderable types: dict() < dict()
TypeError
def arg_split(commandline, posix=False, strict=True): """Split a command line's arguments in a shell-like manner. This is a special version for windows that use a ctypes call to CommandLineToArgvW to do the argv splitting. The posix paramter is ignored. If strict=False, process_common.arg_split(...strict=False) is used instead. """ # CommandLineToArgvW returns path to executable if called with empty string. if commandline.strip() == "": return [] if not strict: # not really a cl-arg, fallback on _process_common return py_arg_split(commandline, posix=posix, strict=strict) argvn = c_int() result_pointer = CommandLineToArgvW( py3compat.cast_unicode(commandline.lstrip()), ctypes.byref(argvn) ) result_array_type = LPCWSTR * argvn.value result = [arg for arg in result_array_type.from_address(result_pointer)] retval = LocalFree(result_pointer) return result
def arg_split(commandline, posix=False): """Split a command line's arguments in a shell-like manner. This is a special version for windows that use a ctypes call to CommandLineToArgvW to do the argv splitting. The posix paramter is ignored. """ # CommandLineToArgvW returns path to executable if called with empty string. if commandline.strip() == "": return [] argvn = c_int() result_pointer = CommandLineToArgvW( py3compat.cast_unicode(commandline.lstrip()), ctypes.byref(argvn) ) result_array_type = LPCWSTR * argvn.value result = [arg for arg in result_array_type.from_address(result_pointer)] retval = LocalFree(result_pointer) return result
https://github.com/ipython/ipython/issues/1148
ERROR: test shlex issues with timeit (#1109) ---------------------------------------------------------------------- Traceback (most recent call last): File "c:\python26\lib\site-packages\nose\case.py", line 197, in runTest self.test(*self.arg) File "c:\python\external\ipython\IPython\core\tests\test_magic.py", line 350, in test_timeit_shlex _ip.magic('timeit -n1 "this is a bug".count(" ")') File "c:\python\external\ipython\IPython\core\interactiveshell.py", line 1995, in magic result = fn(magic_args) File "c:\python\external\ipython\IPython\core\magic.py", line 1893, in magic_timeit code = compile(src, "<magic-timeit>", "exec") File "<magic-timeit>", line 6 this is a bug.count( ) ^ SyntaxError: invalid syntax
SyntaxError
def handle(self, line_info): """Handle lines which can be auto-executed, quoting if requested.""" line = line_info.line ifun = line_info.ifun the_rest = line_info.the_rest pre = line_info.pre esc = line_info.esc continue_prompt = line_info.continue_prompt obj = line_info.ofind(self)["obj"] # print 'pre <%s> ifun <%s> rest <%s>' % (pre,ifun,the_rest) # dbg # This should only be active for single-line input! if continue_prompt: return line force_auto = isinstance(obj, IPyAutocall) # User objects sometimes raise exceptions on attribute access other # than AttributeError (we've seen it in the past), so it's safest to be # ultra-conservative here and catch all. try: auto_rewrite = obj.rewrite except Exception: auto_rewrite = True if esc == ESC_QUOTE: # Auto-quote splitting on whitespace newcmd = '%s("%s")' % (ifun, '", "'.join(the_rest.split())) elif esc == ESC_QUOTE2: # Auto-quote whole string newcmd = '%s("%s")' % (ifun, the_rest) elif esc == ESC_PAREN: newcmd = "%s(%s)" % (ifun, ",".join(the_rest.split())) else: # Auto-paren. # We only apply it to argument-less calls if the autocall # parameter is set to 2. We only need to check that autocall is < # 2, since this function isn't called unless it's at least 1. if not the_rest and (self.shell.autocall < 2) and not force_auto: newcmd = "%s %s" % (ifun, the_rest) auto_rewrite = False else: if not force_auto and the_rest.startswith("["): if hasattr(obj, "__getitem__"): # Don't autocall in this case: item access for an object # which is BOTH callable and implements __getitem__. newcmd = "%s %s" % (ifun, the_rest) auto_rewrite = False else: # if the object doesn't support [] access, go ahead and # autocall newcmd = "%s(%s)" % (ifun.rstrip(), the_rest) elif the_rest.endswith(";"): newcmd = "%s(%s);" % (ifun.rstrip(), the_rest[:-1]) else: newcmd = "%s(%s)" % (ifun.rstrip(), the_rest) if auto_rewrite: self.shell.auto_rewrite_input(newcmd) return newcmd
def handle(self, line_info): """Handle lines which can be auto-executed, quoting if requested.""" line = line_info.line ifun = line_info.ifun the_rest = line_info.the_rest pre = line_info.pre esc = line_info.esc continue_prompt = line_info.continue_prompt obj = line_info.ofind(self)["obj"] # print 'pre <%s> ifun <%s> rest <%s>' % (pre,ifun,the_rest) # dbg # This should only be active for single-line input! if continue_prompt: return line force_auto = isinstance(obj, IPyAutocall) auto_rewrite = getattr(obj, "rewrite", True) if esc == ESC_QUOTE: # Auto-quote splitting on whitespace newcmd = '%s("%s")' % (ifun, '", "'.join(the_rest.split())) elif esc == ESC_QUOTE2: # Auto-quote whole string newcmd = '%s("%s")' % (ifun, the_rest) elif esc == ESC_PAREN: newcmd = "%s(%s)" % (ifun, ",".join(the_rest.split())) else: # Auto-paren. # We only apply it to argument-less calls if the autocall # parameter is set to 2. We only need to check that autocall is < # 2, since this function isn't called unless it's at least 1. if not the_rest and (self.shell.autocall < 2) and not force_auto: newcmd = "%s %s" % (ifun, the_rest) auto_rewrite = False else: if not force_auto and the_rest.startswith("["): if hasattr(obj, "__getitem__"): # Don't autocall in this case: item access for an object # which is BOTH callable and implements __getitem__. newcmd = "%s %s" % (ifun, the_rest) auto_rewrite = False else: # if the object doesn't support [] access, go ahead and # autocall newcmd = "%s(%s)" % (ifun.rstrip(), the_rest) elif the_rest.endswith(";"): newcmd = "%s(%s);" % (ifun.rstrip(), the_rest[:-1]) else: newcmd = "%s(%s)" % (ifun.rstrip(), the_rest) if auto_rewrite: self.shell.auto_rewrite_input(newcmd) return newcmd
https://github.com/ipython/ipython/issues/988
I1 from scipy import io I2 s1 = io.idl.readsav('test.sav') I3 s1? Type: AttrDict Base Class: <class 'scipy.io.idl.AttrDict'> String Form: {'dn': array([ 1.02282184e+07, 1.05383408e+07, 1.08758739e+07, 1.12449965e+07, 1. <...> (('r', 'R'), '>f8'), (('v', 'V'), '>f8')]), 'tfit': array([ 4.82394886e+02, 4.18176107e-01])} Namespace: Interactive Length: 11 File: /usr/lib64/python2.7/site-packages/scipy/io/idl.py Definition: s1(self, name) I4 s1['dn'] --------------------------------------------------------------------------- KeyError Traceback (most recent call last) /home/gsever/Desktop/python-repo/ipython/IPython/core/prefilter.pyc in prefilter_lines(self, lines, continue_prompt) 358 for lnum, line in enumerate(llines) ]) 359 else: --> 360 out = self.prefilter_line(llines[0], continue_prompt) 361 362 return out /home/gsever/Desktop/python-repo/ipython/IPython/core/prefilter.pyc in prefilter_line(self, line, continue_prompt) 333 return normal_handler.handle(line_info) 334 --> 335 prefiltered = self.prefilter_line_info(line_info) 336 # print "prefiltered line: %r" % prefiltered 337 return prefiltered /home/gsever/Desktop/python-repo/ipython/IPython/core/prefilter.pyc in prefilter_line_info(self, line_info) 273 # print "prefilter_line_info: ", line_info 274 handler = self.find_handler(line_info) --> 275 return handler.handle(line_info) 276 277 def find_handler(self, line_info): /home/gsever/Desktop/python-repo/ipython/IPython/core/prefilter.pyc in handle(self, line_info) 813 814 force_auto = isinstance(obj, IPyAutocall) --> 815 auto_rewrite = getattr(obj, 'rewrite', True) 816 817 if esc == ESC_QUOTE: /usr/lib64/python2.7/site-packages/scipy/io/idl.pyc in __getitem__(self, name) 657 658 def __getitem__(self, name): --> 659 return super(AttrDict, self).__getitem__(name.lower()) 660 661 def __setitem__(self, key, value): KeyError: 'rewrite'
KeyError
def __call__(self, *sequences): client = self.view.client # check that the length of sequences match len_0 = len(sequences[0]) for s in sequences: if len(s) != len_0: msg = "all sequences must have equal length, but %i!=%i" % (len_0, len(s)) raise ValueError(msg) balanced = "Balanced" in self.view.__class__.__name__ if balanced: if self.chunksize: nparts = len_0 // self.chunksize + int(len_0 % self.chunksize > 0) else: nparts = len_0 targets = [None] * nparts else: if self.chunksize: warnings.warn("`chunksize` is ignored unless load balancing", UserWarning) # multiplexed: targets = self.view.targets # 'all' is lazily evaluated at execution time, which is now: if targets == "all": targets = client._build_targets(targets)[1] nparts = len(targets) msg_ids = [] for index, t in enumerate(targets): args = [] for seq in sequences: part = self.mapObject.getPartition(seq, index, nparts) if len(part) == 0: continue else: args.append(part) if not args: continue # print (args) if hasattr(self, "_map"): if sys.version_info[0] >= 3: f = lambda f, *sequences: list(map(f, *sequences)) else: f = map args = [self.func] + args else: f = self.func view = self.view if balanced else client[t] with view.temp_flags(block=False, **self.flags): ar = view.apply(f, *args) msg_ids.append(ar.msg_ids[0]) r = AsyncMapResult( self.view.client, msg_ids, self.mapObject, fname=self.func.__name__, ordered=self.ordered, ) if self.block: try: return r.get() except KeyboardInterrupt: return r else: return r
def __call__(self, *sequences): # check that the length of sequences match len_0 = len(sequences[0]) for s in sequences: if len(s) != len_0: msg = "all sequences must have equal length, but %i!=%i" % (len_0, len(s)) raise ValueError(msg) balanced = "Balanced" in self.view.__class__.__name__ if balanced: if self.chunksize: nparts = len_0 // self.chunksize + int(len_0 % self.chunksize > 0) else: nparts = len_0 targets = [None] * nparts else: if self.chunksize: warnings.warn("`chunksize` is ignored unless load balancing", UserWarning) # multiplexed: targets = self.view.targets nparts = len(targets) msg_ids = [] # my_f = lambda *a: map(self.func, *a) client = self.view.client for index, t in enumerate(targets): args = [] for seq in sequences: part = self.mapObject.getPartition(seq, index, nparts) if len(part) == 0: continue else: args.append(part) if not args: continue # print (args) if hasattr(self, "_map"): if sys.version_info[0] >= 3: f = lambda f, *sequences: list(map(f, *sequences)) else: f = map args = [self.func] + args else: f = self.func view = self.view if balanced else client[t] with view.temp_flags(block=False, **self.flags): ar = view.apply(f, *args) msg_ids.append(ar.msg_ids[0]) r = AsyncMapResult( self.view.client, msg_ids, self.mapObject, fname=self.func.__name__, ordered=self.ordered, ) if self.block: try: return r.get() except KeyboardInterrupt: return r else: return r
https://github.com/ipython/ipython/issues/986
In [3]: v = c.direct_view() In [4]: v Out[4]: <DirectView all> In [5]: v.map_sync(lambda x: x**10, range(32)) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/thomas/Code/virtualenvs/ipy-trunk/<ipython-input-5-b937e0334e06> in <module>() ----> 1 v.map_sync(lambda x: x**10, range(32)) /home/thomas/Code/virtualenvs/ipy-trunk/local/lib/python2.7/site-packages/IPython/parallel/client/view.pyc in map_sync(self, f, *sequences, **kwargs) 340 raise TypeError("map_sync doesn't take a `block` keyword argument.") 341 kwargs['block'] = True --> 342 return self.map(f,*sequences,**kwargs) 343 344 def imap(self, f, *sequences, **kwargs): /home/thomas/Code/virtualenvs/ipy-trunk/<string> in map(self, f, *sequences, **kwargs) /home/thomas/Code/virtualenvs/ipy-trunk/local/lib/python2.7/site-packages/IPython/parallel/client/view.pyc in spin_after(f, self, *args, **kwargs) 66 def spin_after(f, self, *args, **kwargs): 67 """call spin after the method.""" ---> 68 ret = f(self, *args, **kwargs) 69 self.spin() 70 return ret /home/thomas/Code/virtualenvs/ipy-trunk/local/lib/python2.7/site-packages/IPython/parallel/client/view.pyc in map(self, f, *sequences, **kwargs) 575 assert len(sequences) > 0, "must have some sequences to map onto!" 576 pf = ParallelFunction(self, f, block=block, **kwargs) --> 577 return pf.map(*sequences) 578 579 def execute(self, code, targets=None, block=None): /home/thomas/Code/virtualenvs/ipy-trunk/local/lib/python2.7/site-packages/IPython/parallel/client/remotefunction.pyc in map(self, *sequences) 212 self._map = True 213 try: --> 214 ret = self.__call__(*sequences) 215 finally: 216 del self._map /home/thomas/Code/virtualenvs/ipy-trunk/local/lib/python2.7/site-packages/IPython/parallel/client/remotefunction.pyc in __call__(self, *sequences) 185 f=self.func 186 --> 187 view = self.view if balanced else client[t] 188 with view.temp_flags(block=False, **self.flags): 189 ar = view.apply(f, *args) /home/thomas/Code/virtualenvs/ipy-trunk/local/lib/python2.7/site-packages/IPython/parallel/client/client.pyc in __getitem__(self, key) 763 Must be int, slice, or list/tuple/xrange of ints""" 764 if not isinstance(key, (int, slice, tuple, list, xrange)): --> 765 raise TypeError("key by int/slice/iterable of ints only, not %s"%(type(key))) 766 else: 767 return self.direct_view(key) TypeError: key by int/slice/iterable of ints only, not <type 'str'>
TypeError
def publish(self, source, data, metadata=None): if metadata is None: metadata = {} self._validate_data(source, data, metadata) content = {} content["source"] = source _encode_binary(data) content["data"] = data content["metadata"] = metadata self.session.send( self.pub_socket, "display_data", json_clean(content), parent=self.parent_header )
def publish(self, source, data, metadata=None): if metadata is None: metadata = {} self._validate_data(source, data, metadata) content = {} content["source"] = source _encode_binary(data) content["data"] = data content["metadata"] = metadata self.session.send( self.pub_socket, "display_data", content, parent=self.parent_header )
https://github.com/ipython/ipython/issues/535
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) C:\python\external\ipy-bugs\run_qtcons_bug.py in <module>() 2 3 a=[] ----> 4 a.apppend(u"åäö") AttributeError: 'list' object has no attribute 'apppend'
AttributeError
def _showtraceback(self, etype, evalue, stb): exc_content = { "traceback": stb, "ename": unicode(etype.__name__), "evalue": unicode(evalue), } dh = self.displayhook # Send exception info over pub socket for other clients than the caller # to pick up exc_msg = dh.session.send( dh.pub_socket, "pyerr", json_clean(exc_content), dh.parent_header ) # FIXME - Hack: store exception info in shell object. Right now, the # caller is reading this info after the fact, we need to fix this logic # to remove this hack. Even uglier, we need to store the error status # here, because in the main loop, the logic that sets it is being # skipped because runlines swallows the exceptions. exc_content["status"] = "error" self._reply_content = exc_content # /FIXME return exc_content
def _showtraceback(self, etype, evalue, stb): exc_content = { "traceback": stb, "ename": unicode(etype.__name__), "evalue": unicode(evalue), } dh = self.displayhook # Send exception info over pub socket for other clients than the caller # to pick up exc_msg = dh.session.send(dh.pub_socket, "pyerr", exc_content, dh.parent_header) # FIXME - Hack: store exception info in shell object. Right now, the # caller is reading this info after the fact, we need to fix this logic # to remove this hack. Even uglier, we need to store the error status # here, because in the main loop, the logic that sets it is being # skipped because runlines swallows the exceptions. exc_content["status"] = "error" self._reply_content = exc_content # /FIXME return exc_content
https://github.com/ipython/ipython/issues/535
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) C:\python\external\ipy-bugs\run_qtcons_bug.py in <module>() 2 3 a=[] ----> 4 a.apppend(u"åäö") AttributeError: 'list' object has no attribute 'apppend'
AttributeError
def _exec_file(self, fname): try: full_filename = filefind(fname, [".", self.ipython_dir]) except IOError as e: self.log.warn("File not found: %r" % fname) return # Make sure that the running script gets a proper sys.argv as if it # were run from a system shell. save_argv = sys.argv sys.argv = [full_filename] + self.extra_args[1:] try: if os.path.isfile(full_filename): if full_filename.endswith(".ipy"): self.log.info("Running file in user namespace: %s" % full_filename) self.shell.safe_execfile_ipy(full_filename) else: # default to python, even without extension self.log.info("Running file in user namespace: %s" % full_filename) # Ensure that __file__ is always defined to match Python behavior self.shell.user_ns["__file__"] = fname try: self.shell.safe_execfile(full_filename, self.shell.user_ns) finally: del self.shell.user_ns["__file__"] finally: sys.argv = save_argv
def _exec_file(self, fname): full_filename = filefind(fname, [".", self.ipython_dir]) # Make sure that the running script gets a proper sys.argv as if it # were run from a system shell. save_argv = sys.argv sys.argv = sys.argv[sys.argv.index(fname) :] try: if os.path.isfile(full_filename): if full_filename.endswith(".ipy"): self.log.info("Running file in user namespace: %s" % full_filename) self.shell.safe_execfile_ipy(full_filename) else: # default to python, even without extension self.log.info("Running file in user namespace: %s" % full_filename) # Ensure that __file__ is always defined to match Python behavior self.shell.user_ns["__file__"] = fname try: self.shell.safe_execfile(full_filename, self.shell.user_ns) finally: del self.shell.user_ns["__file__"] finally: sys.argv = save_argv
https://github.com/ipython/ipython/issues/566
[TerminalIPythonApp] Unknown error in handling IPythonApp.exec_files: --------------------------------------------------------------------------- ValueError Traceback (most recent call last) c:\python\external\ipython-js\IPython\core\shellapp.pyc in _exec_file(self, fname 192 # were run from a system shell. 193 save_argv = sys.argv --> 194 sys.argv = sys.argv[sys.argv.index(fname):] 195 try: 196 if os.path.isfile(full_filename): ValueError: list.index(x): x not in list
ValueError
def _handle_object_info_reply(self, rep): """Handle replies for call tips.""" cursor = self._get_cursor() info = self._request_info.get("call_tip") if ( info and info.id == rep["parent_header"]["msg_id"] and info.pos == cursor.position() ): # Get the information for a call tip. For now we format the call # line as string, later we can pass False to format_call and # syntax-highlight it ourselves for nicer formatting in the # calltip. content = rep["content"] # if this is from pykernel, 'docstring' will be the only key if content.get("ismagic", False): # Don't generate a call-tip for magics. Ideally, we should # generate a tooltip, but not on ( like we do for actual # callables. call_info, doc = None, None else: call_info, doc = call_tip(content, format_call=True) if call_info or doc: self._call_tip_widget.show_call_info(call_info, doc)
def _handle_object_info_reply(self, rep): """Handle replies for call tips.""" cursor = self._get_cursor() info = self._request_info.get("call_tip") if ( info and info.id == rep["parent_header"]["msg_id"] and info.pos == cursor.position() ): # Get the information for a call tip. For now we format the call # line as string, later we can pass False to format_call and # syntax-highlight it ourselves for nicer formatting in the # calltip. if rep["content"]["ismagic"]: # Don't generate a call-tip for magics. Ideally, we should # generate a tooltip, but not on ( like we do for actual # callables. call_info, doc = None, None else: call_info, doc = call_tip(rep["content"], format_call=True) if call_info or doc: self._call_tip_widget.show_call_info(call_info, doc)
https://github.com/ipython/ipython/issues/516
{'content': {'oname': 'range'}, 'header': {'username': 'mspacek', 'msg_id': 0, 'session': 'b744a851-3e62-4d64-930b-71ddefde10b0'}, 'msg_type': 'object_info_request', 'parent_header': {}} {'content': {'docstring': 'range([start,] stop[, step]) -> list of integers\n\nReturn a list containing an arithmetic progression of integers.\nrange(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.\nWhen step is given, it specifies the increment (or decrement).\nFor example, range(4) returns [0, 1, 2, 3]. The end point is omitted!\nThese are exactly the valid indices for a list of 4 elements.'}, 'header': {'username': u'kernel', 'msg_id': 0, 'session': 'c2c4ed08-9765-43c9-b3cf-558331f61237'}, 'parent_header': {'username': 'mspacek', 'msg_id': 0, 'session': 'b744a851-3e62-4d64-930b-71ddefde10b0'}, 'msg_type': 'object_info_reply'} Traceback (most recent call last): File "/home/mspacek/source/ipython/IPython/frontend/qt/base_frontend_mixin.py", line 102, in _dispatch handler(msg) File "/home/mspacek/source/ipython/IPython/frontend/qt/console/frontend_widget.py", line 363, in _handle_object_info_reply if rep['content']['ismagic']: KeyError: 'ismagic'
KeyError
def _handle_pyout(self, msg): """Handle display hook output.""" if not self._hidden and self._is_from_this_session(msg): data = msg["content"]["data"] if isinstance(data, basestring): # plaintext data from pure Python kernel text = data else: # formatted output from DisplayFormatter (IPython kernel) text = data.get("text/plain", "") self._append_plain_text(text + "\n")
def _handle_pyout(self, msg): """Handle display hook output.""" if not self._hidden and self._is_from_this_session(msg): self._append_plain_text(msg["content"]["data"]["text/plain"] + "\n")
https://github.com/ipython/ipython/issues/516
{'content': {'oname': 'range'}, 'header': {'username': 'mspacek', 'msg_id': 0, 'session': 'b744a851-3e62-4d64-930b-71ddefde10b0'}, 'msg_type': 'object_info_request', 'parent_header': {}} {'content': {'docstring': 'range([start,] stop[, step]) -> list of integers\n\nReturn a list containing an arithmetic progression of integers.\nrange(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.\nWhen step is given, it specifies the increment (or decrement).\nFor example, range(4) returns [0, 1, 2, 3]. The end point is omitted!\nThese are exactly the valid indices for a list of 4 elements.'}, 'header': {'username': u'kernel', 'msg_id': 0, 'session': 'c2c4ed08-9765-43c9-b3cf-558331f61237'}, 'parent_header': {'username': 'mspacek', 'msg_id': 0, 'session': 'b744a851-3e62-4d64-930b-71ddefde10b0'}, 'msg_type': 'object_info_reply'} Traceback (most recent call last): File "/home/mspacek/source/ipython/IPython/frontend/qt/base_frontend_mixin.py", line 102, in _dispatch handler(msg) File "/home/mspacek/source/ipython/IPython/frontend/qt/console/frontend_widget.py", line 363, in _handle_object_info_reply if rep['content']['ismagic']: KeyError: 'ismagic'
KeyError
def save_svg(string, parent=None): """Prompts the user to save an SVG document to disk. Parameters: ----------- string : basestring A Python string containing a SVG document. parent : QWidget, optional The parent to use for the file dialog. Returns: -------- The name of the file to which the document was saved, or None if the save was cancelled. """ if isinstance(string, unicode): string = string.encode("utf-8") dialog = QtGui.QFileDialog(parent, "Save SVG Document") dialog.setAcceptMode(QtGui.QFileDialog.AcceptSave) dialog.setDefaultSuffix("svg") dialog.setNameFilter("SVG document (*.svg)") if dialog.exec_(): filename = dialog.selectedFiles()[0] f = open(filename, "w") try: f.write(string) finally: f.close() return filename return None
def save_svg(string, parent=None): """Prompts the user to save an SVG document to disk. Parameters: ----------- string : basestring A Python string containing a SVG document. parent : QWidget, optional The parent to use for the file dialog. Returns: -------- The name of the file to which the document was saved, or None if the save was cancelled. """ dialog = QtGui.QFileDialog(parent, "Save SVG Document") dialog.setAcceptMode(QtGui.QFileDialog.AcceptSave) dialog.setDefaultSuffix("svg") dialog.setNameFilter("SVG document (*.svg)") if dialog.exec_(): filename = dialog.selectedFiles()[0] f = open(filename, "w") try: f.write(string) finally: f.close() return filename return None
https://github.com/ipython/ipython/issues/489
Traceback (most recent call last): File "/home/mspacek/source/ipython/IPython/frontend/qt/console/rich_ipython_widget.py", line 60, in <lambda> lambda: save_svg(svg, self._control)) File "/home/mspacek/source/ipython/IPython/frontend/qt/svg.py", line 32, in save_svg f.write(string) UnicodeEncodeError: 'ascii' codec can't encode character u'\u2212' in position 12271: ordinal not in range(128)
UnicodeEncodeError
def get_pool(self, num=None): """Gets a pool of workers to do some parallel work. pool will be cached, which implies that one should be very clear how many processes one needs, as it's allocated at most once. Subsequent calls of get_pool() will reuse the cached pool. Args: num(int): Number of workers one needs. Returns: pool(multiprocessing.Pool): A pool of workers. """ processes = self.get_processes(num or self.processes) logging.info("Calling multiprocessing.Pool(%d)", processes) return multiprocessing.Pool(processes)
def get_pool(self, num=None): """Gets a pool of workers to do some parallel work. pool will be cached, which implies that one should be very clear how many processes one needs, as it's allocated at most once. Subsequent calls of get_pool() will reuse the cached pool. Args: num(int): Number of workers one needs. Returns: pool(multiprocessing.Pool): A pool of workers. """ if self.pool is None: processes = self.get_processes(num or self.processes) logging.info("Calling multiprocessing.Pool(%d)", processes) self.pool = multiprocessing.Pool(processes) return self.pool
https://github.com/quantumlib/OpenFermion/issues/461
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-10-f4067f5432d2> in <module>() 8 9 linear_qubit_op.dot(state) ---> 10 linear_qubit_op.dot(state) ~/environments/ofc/lib/python3.5/site-packages/scipy/sparse/linalg/interface.py in dot(self, x) 360 361 if x.ndim == 1 or x.ndim == 2 and x.shape[1] == 1: --> 362 return self.matvec(x) 363 elif x.ndim == 2: 364 return self.matmat(x) ~/environments/ofc/lib/python3.5/site-packages/scipy/sparse/linalg/interface.py in matvec(self, x) 217 raise ValueError('dimension mismatch') 218 --> 219 y = self._matvec(x) 220 221 if isinstance(x, np.matrix): ~/environments/ofc/lib/python3.5/site-packages/openfermion/utils/_linear_qubit_operator.py in _matvec(self, x) 185 vecs = pool.imap_unordered(apply_operator, 186 [(operator, x) --> 187 for operator in self.linear_operators]) 188 pool.close() 189 pool.join() /usr/lib/python3.5/multiprocessing/pool.py in imap_unordered(self, func, iterable, chunksize) 300 ''' 301 if self._state != RUN: --> 302 raise ValueError("Pool not running") 303 if chunksize == 1: 304 result = IMapUnorderedIterator(self._cache) ValueError: Pool not running
ValueError
def create_dict_node_class(cls): """ Create dynamic node class """ class node_class(cls): """Node class created based on the input class""" def __init__(self, x, start_mark, end_mark): try: cls.__init__(self, x) except TypeError: cls.__init__(self) self.start_mark = start_mark self.end_mark = end_mark self.condition_functions = ["Fn::If"] def __deepcopy__(self, memo): result = dict_node(self, self.start_mark, self.end_mark) memo[id(self)] = result for k, v in self.items(): result[deepcopy(k)] = deepcopy(v, memo) return result def __copy__(self): return self def is_function_returning_object(self, mappings=None): """ Check if an object is using a function that could return an object Return True when Fn::Select: - 0 # or any number - !FindInMap [mapname, key, value] # or any mapname, key, value Otherwise False """ mappings = mappings or {} if len(self) == 1: for k, v in self.items(): if k in ["Fn::Select"]: if isinstance(v, list): if len(v) == 2: p_v = v[1] if isinstance(p_v, dict): if len(p_v) == 1: for l_k in p_v.keys(): if l_k == "Fn::FindInMap": return True return False def get(self, key, default=None): """Override the default get""" if isinstance(default, dict): default = dict_node(default, self.start_mark, self.end_mark) return super(node_class, self).get(key, default) def get_safe(self, key, default=None, path=None, type_t=()): """ Get values in format """ path = path or [] value = self.get(key, default) if value is None and default is None: # if default is None and value is None return empty list return [] # if the value is the default make sure that the default value is of type_t when specified if bool(type_t) and value == default and not isinstance(default, type_t): raise ValueError('"default" type should be of "type_t"') # when not a dict see if if the value is of the right type results = [] if not isinstance(value, (dict)): if isinstance(value, type_t) or not type_t: return [(value, (path[:] + [key]))] else: for sub_v, sub_path in value.items_safe(path + [key]): if isinstance(sub_v, type_t) or not type_t: results.append((sub_v, sub_path)) return results def items_safe(self, path=None, type_t=()): """Get items while handling IFs""" path = path or [] if len(self) == 1: for k, v in self.items(): if k == "Fn::If": if isinstance(v, list): if len(v) == 3: for i, if_v in enumerate(v[1:]): if isinstance(if_v, dict): # yield from if_v.items_safe(path[:] + [k, i - 1]) # Python 2.7 support for items, p in if_v.items_safe( path[:] + [k, i + 1] ): if isinstance(items, type_t) or not type_t: yield items, p elif isinstance(if_v, list): if isinstance(if_v, type_t) or not type_t: yield if_v, path[:] + [k, i + 1] else: if isinstance(if_v, type_t) or not type_t: yield if_v, path[:] + [k, i + 1] elif not (k == "Ref" and v == "AWS::NoValue"): if isinstance(self, type_t) or not type_t: yield self, path[:] else: if isinstance(self, type_t) or not type_t: yield self, path[:] def __getattr__(self, name): raise TemplateAttributeError( "%s.%s is invalid" % (self.__class__.__name__, name) ) node_class.__name__ = "%s_node" % cls.__name__ return node_class
def create_dict_node_class(cls): """ Create dynamic node class """ class node_class(cls): """Node class created based on the input class""" def __init__(self, x, start_mark, end_mark): try: cls.__init__(self, x) except TypeError: cls.__init__(self) self.start_mark = start_mark self.end_mark = end_mark self.condition_functions = ["Fn::If"] def __deepcopy__(self, memo): result = dict_node(self, self.start_mark, self.end_mark) memo[id(self)] = result for k, v in self.items(): result[deepcopy(k)] = deepcopy(v, memo) return result def __copy__(self): return self def is_function_returning_object(self, mappings=None): """ Check if an object is using a function that could return an object Return True when Fn::Select: - 0 # or any number - !FindInMap [mapname, key, value] # or any mapname, key, value Otherwise False """ mappings = mappings or {} if len(self) == 1: for k, v in self.items(): if k in ["Fn::Select"]: if isinstance(v, list): if len(v) == 2: p_v = v[1] if isinstance(p_v, dict): if len(p_v) == 1: for l_k in p_v.keys(): if l_k == "Fn::FindInMap": return True return False def get(self, key, default=None): """Override the default get""" if isinstance(default, dict): default = dict_node(default, self.start_mark, self.end_mark) return super(node_class, self).get(key, default) def get_safe(self, key, default=None, path=None, type_t=()): """ Get values in format """ path = path or [] value = self.get(key, default) if not isinstance(value, (dict)): if isinstance(value, type_t) or not type_t: return [(value, (path[:] + [key]))] results = [] for sub_v, sub_path in value.items_safe(path + [key]): if isinstance(sub_v, type_t) or not type_t: results.append((sub_v, sub_path)) return results def items_safe(self, path=None, type_t=()): """Get items while handling IFs""" path = path or [] if len(self) == 1: for k, v in self.items(): if k == "Fn::If": if isinstance(v, list): if len(v) == 3: for i, if_v in enumerate(v[1:]): if isinstance(if_v, dict): # yield from if_v.items_safe(path[:] + [k, i - 1]) # Python 2.7 support for items, p in if_v.items_safe( path[:] + [k, i + 1] ): if isinstance(items, type_t) or not type_t: yield items, p elif isinstance(if_v, list): if isinstance(if_v, type_t) or not type_t: yield if_v, path[:] + [k, i + 1] else: if isinstance(if_v, type_t) or not type_t: yield if_v, path[:] + [k, i + 1] elif not (k == "Ref" and v == "AWS::NoValue"): if isinstance(self, type_t) or not type_t: yield self, path[:] else: if isinstance(self, type_t) or not type_t: yield self, path[:] def __getattr__(self, name): raise TemplateAttributeError( "%s.%s is invalid" % (self.__class__.__name__, name) ) node_class.__name__ = "%s_node" % cls.__name__ return node_class
https://github.com/aws-cloudformation/cfn-python-lint/issues/1363
2020-02-17 15:24:57,775 - cfnlint - DEBUG - Completed linting of file: .\test.yml E0002 Unknown exception while processing rule E3028: Traceback (most recent call last): File "c:\python36\lib\site-packages\cfnlint\rules\__init__.py", line 203, in run_check return check(*args) File "c:\python36\lib\site-packages\cfnlint\rules\__init__.py", line 89, in wrapper results = match_function(self, filename, cfn, *args, **kwargs) File "c:\python36\lib\site-packages\cfnlint\rules\__init__.py", line 122, in matchall_resource_properties return self.match_resource_properties(resource_properties, property_type, path, cfn) # pylint: disable=E1102 File "c:\python36\lib\site-packages\cfnlint\rules\resources\rds\AuroraScalingConfiguration.py", line 44, in match_resource_properties matches.extend(self.check(properties, path, cfn)) File "c:\python36\lib\site-packages\cfnlint\rules\resources\rds\AuroraScalingConfiguration.py", line 30, in check engine = properties.get_safe('EngineMode', type_t=six.string_types) File "c:\python36\lib\site-packages\cfnlint\decode\node.py", line 125, in get_safe for sub_v, sub_path in value.items_safe(path + [key]): AttributeError: 'NoneType' object has no attribute 'items_safe' .\test.yml:1:1
AttributeError
def get_safe(self, key, default=None, path=None, type_t=()): """ Get values in format """ path = path or [] value = self.get(key, default) if value is None and default is None: # if default is None and value is None return empty list return [] # if the value is the default make sure that the default value is of type_t when specified if bool(type_t) and value == default and not isinstance(default, type_t): raise ValueError('"default" type should be of "type_t"') # when not a dict see if if the value is of the right type results = [] if not isinstance(value, (dict)): if isinstance(value, type_t) or not type_t: return [(value, (path[:] + [key]))] else: for sub_v, sub_path in value.items_safe(path + [key]): if isinstance(sub_v, type_t) or not type_t: results.append((sub_v, sub_path)) return results
def get_safe(self, key, default=None, path=None, type_t=()): """ Get values in format """ path = path or [] value = self.get(key, default) if not isinstance(value, (dict)): if isinstance(value, type_t) or not type_t: return [(value, (path[:] + [key]))] results = [] for sub_v, sub_path in value.items_safe(path + [key]): if isinstance(sub_v, type_t) or not type_t: results.append((sub_v, sub_path)) return results
https://github.com/aws-cloudformation/cfn-python-lint/issues/1363
2020-02-17 15:24:57,775 - cfnlint - DEBUG - Completed linting of file: .\test.yml E0002 Unknown exception while processing rule E3028: Traceback (most recent call last): File "c:\python36\lib\site-packages\cfnlint\rules\__init__.py", line 203, in run_check return check(*args) File "c:\python36\lib\site-packages\cfnlint\rules\__init__.py", line 89, in wrapper results = match_function(self, filename, cfn, *args, **kwargs) File "c:\python36\lib\site-packages\cfnlint\rules\__init__.py", line 122, in matchall_resource_properties return self.match_resource_properties(resource_properties, property_type, path, cfn) # pylint: disable=E1102 File "c:\python36\lib\site-packages\cfnlint\rules\resources\rds\AuroraScalingConfiguration.py", line 44, in match_resource_properties matches.extend(self.check(properties, path, cfn)) File "c:\python36\lib\site-packages\cfnlint\rules\resources\rds\AuroraScalingConfiguration.py", line 30, in check engine = properties.get_safe('EngineMode', type_t=six.string_types) File "c:\python36\lib\site-packages\cfnlint\decode\node.py", line 125, in get_safe for sub_v, sub_path in value.items_safe(path + [key]): AttributeError: 'NoneType' object has no attribute 'items_safe' .\test.yml:1:1
AttributeError
def decode(filename, ignore_bad_template): """ Decode filename into an object """ template = None matches = [] try: template = cfnlint.decode.cfn_yaml.load(filename) except IOError as e: if e.errno == 2: LOGGER.error("Template file not found: %s", filename) matches.append( create_match_file_error( filename, "Template file not found: %s" % filename ) ) elif e.errno == 21: LOGGER.error("Template references a directory, not a file: %s", filename) matches.append( create_match_file_error( filename, "Template references a directory, not a file: %s" % filename, ) ) elif e.errno == 13: LOGGER.error("Permission denied when accessing template file: %s", filename) matches.append( create_match_file_error( filename, "Permission denied when accessing template file: %s" % filename, ) ) if matches: return (None, matches) except UnicodeDecodeError as err: LOGGER.error("Cannot read file contents: %s", filename) matches.append( create_match_file_error( filename, "Cannot read file contents: %s" % filename ) ) except cfnlint.decode.cfn_yaml.CfnParseError as err: err.match.Filename = filename matches = [err.match] except ParserError as err: matches = [create_match_yaml_parser_error(err, filename)] except ScannerError as err: if err.problem == "found character '\\t' that cannot start any token": try: with open(filename) as fp: template = json.load(fp, cls=cfnlint.decode.cfn_json.CfnJSONDecoder) except cfnlint.decode.cfn_json.JSONDecodeError as json_err: json_err.match.filename = filename matches = [json_err.match] except JSONDecodeError as json_err: matches = [create_match_json_parser_error(json_err, filename)] except Exception as json_err: # pylint: disable=W0703 if ignore_bad_template: LOGGER.info("Template %s is malformed: %s", filename, err.problem) LOGGER.info( "Tried to parse %s as JSON but got error: %s", filename, str(json_err), ) else: LOGGER.error("Template %s is malformed: %s", filename, err.problem) LOGGER.error( "Tried to parse %s as JSON but got error: %s", filename, str(json_err), ) return ( None, [ create_match_file_error( filename, "Tried to parse %s as JSON but got error: %s" % (filename, str(json_err)), ) ], ) else: matches = [create_match_yaml_parser_error(err, filename)] except YAMLError as err: matches = [create_match_file_error(filename, err)] if not isinstance(template, dict) and not matches: # Template isn't a dict which means nearly nothing will work matches = [ cfnlint.Match( 1, 1, 1, 1, filename, cfnlint.ParseError(), message="Template needs to be an object.", ) ] return (template, matches)
def decode(filename, ignore_bad_template): """ Decode filename into an object """ template = None matches = [] try: template = cfnlint.decode.cfn_yaml.load(filename) except IOError as e: if e.errno == 2: LOGGER.error("Template file not found: %s", filename) matches.append( create_match_file_error( filename, "Template file not found: %s" % filename ) ) elif e.errno == 21: LOGGER.error("Template references a directory, not a file: %s", filename) matches.append( create_match_file_error( filename, "Template references a directory, not a file: %s" % filename, ) ) elif e.errno == 13: LOGGER.error("Permission denied when accessing template file: %s", filename) matches.append( create_match_file_error( filename, "Permission denied when accessing template file: %s" % filename, ) ) if matches: return (None, matches) except cfnlint.decode.cfn_yaml.CfnParseError as err: err.match.Filename = filename matches = [err.match] except ParserError as err: matches = [create_match_yaml_parser_error(err, filename)] except ScannerError as err: if err.problem == "found character '\\t' that cannot start any token": try: with open(filename) as fp: template = json.load(fp, cls=cfnlint.decode.cfn_json.CfnJSONDecoder) except cfnlint.decode.cfn_json.JSONDecodeError as json_err: json_err.match.filename = filename matches = [json_err.match] except JSONDecodeError as json_err: matches = [create_match_json_parser_error(json_err, filename)] except Exception as json_err: # pylint: disable=W0703 if ignore_bad_template: LOGGER.info("Template %s is malformed: %s", filename, err.problem) LOGGER.info( "Tried to parse %s as JSON but got error: %s", filename, str(json_err), ) else: LOGGER.error("Template %s is malformed: %s", filename, err.problem) LOGGER.error( "Tried to parse %s as JSON but got error: %s", filename, str(json_err), ) return ( None, [ create_match_file_error( filename, "Tried to parse %s as JSON but got error: %s" % (filename, str(json_err)), ) ], ) else: matches = [create_match_yaml_parser_error(err, filename)] if not isinstance(template, dict) and not matches: # Template isn't a dict which means nearly nothing will work matches = [ cfnlint.Match( 1, 1, 1, 1, filename, cfnlint.ParseError(), message="Template needs to be an object.", ) ] return (template, matches)
https://github.com/aws-cloudformation/cfn-python-lint/issues/357
Traceback (most recent call last): File "/usr/local/bin/cfn-lint", line 11, in <module> load_entry_point('cfn-lint==0.7.2', 'console_scripts', 'cfn-lint')() File "/usr/local/lib/python3.6/site-packages/cfn_lint-0.7.2-py3.6.egg/cfnlint/__main__.py", line 30, in main (template, rules, template_matches) = cfnlint.core.get_template_rules(filename, args) File "/usr/local/lib/python3.6/site-packages/cfn_lint-0.7.2-py3.6.egg/cfnlint/core.py", line 245, in get_template_rules (template, matches) = cfnlint.decode.decode(filename, args.ignore_bad_template) File "/usr/local/lib/python3.6/site-packages/cfn_lint-0.7.2-py3.6.egg/cfnlint/decode/__init__.py", line 40, in decode template = cfnlint.decode.cfn_yaml.load(filename) File "/usr/local/lib/python3.6/site-packages/cfn_lint-0.7.2-py3.6.egg/cfnlint/decode/cfn_yaml.py", line 206, in load return loads(fp.read(), filename) File "/usr/local/lib/python3.6/site-packages/cfn_lint-0.7.2-py3.6.egg/cfnlint/decode/cfn_yaml.py", line 191, in loads loader = MarkedLoader(yaml_string, fname) File "/usr/local/lib/python3.6/site-packages/cfn_lint-0.7.2-py3.6.egg/cfnlint/decode/cfn_yaml.py", line 140, in __init__ Reader.__init__(self, stream) File "/usr/local/lib/python3.6/site-packages/yaml/reader.py", line 74, in __init__ self.check_printable(stream) File "/usr/local/lib/python3.6/site-packages/yaml/reader.py", line 144, in check_printable 'unicode', "special characters are not allowed") yaml.reader.ReaderError: unacceptable character #x0000: special characters are not allowed in "<unicode string>", position 0
yaml.reader.ReaderError
def __deepcopy__(self, memo): result = list_node([], self.start_mark, self.end_mark) memo[id(self)] = result for _, v in enumerate(self): result.append(deepcopy(v, memo)) return result
def __deepcopy__(self, memo): cls = self.__class__ result = cls.__new__(cls, self.start_mark, self.end_mark) memo[id(self)] = result for _, v in enumerate(self): result.append(deepcopy(v, memo)) return result
https://github.com/aws-cloudformation/cfn-python-lint/issues/459
Traceback (most recent call last): File "/usr/local/bin/cfn-lint", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/site-packages/cfnlint/__main__.py", line 36, in main args.regions, args.override_spec)) File "/usr/local/lib/python2.7/site-packages/cfnlint/core.py", line 46, in run_cli return run_checks(filename, template, rules, regions) File "/usr/local/lib/python2.7/site-packages/cfnlint/core.py", line 316, in run_checks matches.extend(runner.transform()) File "/usr/local/lib/python2.7/site-packages/cfnlint/__init__.py", line 894, in transform matches = transform.transform_template() File "/usr/local/lib/python2.7/site-packages/cfnlint/transform.py", line 115, in transform_template sam_translator.translate(sam_template=self._template, parameter_values={})) File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/translator/translator.py", line 71, in translate translated = macro.to_cloudformation(**kwargs) File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/sam_resources.py", line 501, in to_cloudformation rest_api, deployment, stage = api_generator.to_cloudformation() File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 160, in to_cloudformation rest_api = self._construct_rest_api() File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 69, in _construct_rest_api self._add_cors() File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 212, in _add_cors self.definition_body = editor.swagger File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/swagger/swagger.py", line 298, in swagger return copy.deepcopy(self._doc) File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 174, in deepcopy y = copier(memo) File "/usr/local/lib/python2.7/site-packages/cfnlint/decode/node.py", line 75, in __deepcopy__ result = cls.__new__(cls, self.start_mark, self.end_mark) AttributeError: 'dict_node' object has no attribute 'start_mark'
AttributeError
def create_dict_node_class(cls): """ Create dynamic node class """ class node_class(cls): """Node class created based on the input class""" def __init__(self, x, start_mark, end_mark): try: cls.__init__(self, x) except TypeError: cls.__init__(self) self.start_mark = start_mark self.end_mark = end_mark self.condition_functions = ["Fn::If"] def __deepcopy__(self, memo): result = dict_node(self, self.start_mark, self.end_mark) memo[id(self)] = result for k, v in self.items(): result[deepcopy(k)] = deepcopy(v, memo) return result def __copy__(self): return self def get_safe(self, key, default=None, path=None, type_t=()): """ Get values in format """ path = path or [] value = self.get(key, default) if not isinstance(value, (dict)): if isinstance(value, type_t) or not type_t: return [(value, (path[:] + [key]))] results = [] for sub_v, sub_path in value.items_safe(path): if isinstance(sub_v, type_t) or not type_t: results.append((sub_v, sub_path)) return results def items_safe(self, path=None, type_t=()): """Get items while handling IFs""" path = path or [] if len(self) == 1: for k, v in self.items(): if k == "Fn::If": if isinstance(v, list): if len(v) == 3: for i, if_v in enumerate(v[1:]): if isinstance(if_v, dict): # yield from if_v.items_safe(path[:] + [k, i - 1]) # Python 2.7 support for items, p in if_v.items_safe( path[:] + [k, i + 1] ): if isinstance(items, type_t) or not type_t: yield items, p elif isinstance(if_v, list): if isinstance(if_v, type_t) or not type_t: yield if_v, path[:] + [k, i + 1] else: if isinstance(if_v, type_t) or not type_t: yield if_v, path[:] + [k, i + 1] elif k != "Ref" and v != "AWS::NoValue": if isinstance(self, type_t) or not type_t: yield self, path[:] else: if isinstance(self, type_t) or not type_t: yield self, path[:] def __getattr__(self, name): raise TemplateAttributeError( "%s.%s is invalid" % (self.__class__.__name__, name) ) node_class.__name__ = "%s_node" % cls.__name__ return node_class
def create_dict_node_class(cls): """ Create dynamic node class """ class node_class(cls): """Node class created based on the input class""" def __init__(self, x, start_mark, end_mark): try: cls.__init__(self, x) except TypeError: cls.__init__(self) self.start_mark = start_mark self.end_mark = end_mark self.condition_functions = ["Fn::If"] def __deepcopy__(self, memo): cls = self.__class__ result = cls.__new__(cls, self.start_mark, self.end_mark) memo[id(self)] = result for k, v in self.items(): result[deepcopy(k)] = deepcopy(v, memo) return result def __copy__(self): return self def get_safe(self, key, default=None, path=None, type_t=()): """ Get values in format """ path = path or [] value = self.get(key, default) if not isinstance(value, (dict)): if isinstance(value, type_t) or not type_t: return [(value, (path[:] + [key]))] results = [] for sub_v, sub_path in value.items_safe(path): if isinstance(sub_v, type_t) or not type_t: results.append((sub_v, sub_path)) return results def items_safe(self, path=None, type_t=()): """Get items while handling IFs""" path = path or [] if len(self) == 1: for k, v in self.items(): if k == "Fn::If": if isinstance(v, list): if len(v) == 3: for i, if_v in enumerate(v[1:]): if isinstance(if_v, dict): # yield from if_v.items_safe(path[:] + [k, i - 1]) # Python 2.7 support for items, p in if_v.items_safe( path[:] + [k, i + 1] ): if isinstance(items, type_t) or not type_t: yield items, p elif isinstance(if_v, list): if isinstance(if_v, type_t) or not type_t: yield if_v, path[:] + [k, i + 1] else: if isinstance(if_v, type_t) or not type_t: yield if_v, path[:] + [k, i + 1] elif k != "Ref" and v != "AWS::NoValue": if isinstance(self, type_t) or not type_t: yield self, path[:] else: if isinstance(self, type_t) or not type_t: yield self, path[:] def __getattr__(self, name): raise TemplateAttributeError( "%s.%s is invalid" % (self.__class__.__name__, name) ) node_class.__name__ = "%s_node" % cls.__name__ return node_class
https://github.com/aws-cloudformation/cfn-python-lint/issues/459
Traceback (most recent call last): File "/usr/local/bin/cfn-lint", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/site-packages/cfnlint/__main__.py", line 36, in main args.regions, args.override_spec)) File "/usr/local/lib/python2.7/site-packages/cfnlint/core.py", line 46, in run_cli return run_checks(filename, template, rules, regions) File "/usr/local/lib/python2.7/site-packages/cfnlint/core.py", line 316, in run_checks matches.extend(runner.transform()) File "/usr/local/lib/python2.7/site-packages/cfnlint/__init__.py", line 894, in transform matches = transform.transform_template() File "/usr/local/lib/python2.7/site-packages/cfnlint/transform.py", line 115, in transform_template sam_translator.translate(sam_template=self._template, parameter_values={})) File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/translator/translator.py", line 71, in translate translated = macro.to_cloudformation(**kwargs) File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/sam_resources.py", line 501, in to_cloudformation rest_api, deployment, stage = api_generator.to_cloudformation() File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 160, in to_cloudformation rest_api = self._construct_rest_api() File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 69, in _construct_rest_api self._add_cors() File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 212, in _add_cors self.definition_body = editor.swagger File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/swagger/swagger.py", line 298, in swagger return copy.deepcopy(self._doc) File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 174, in deepcopy y = copier(memo) File "/usr/local/lib/python2.7/site-packages/cfnlint/decode/node.py", line 75, in __deepcopy__ result = cls.__new__(cls, self.start_mark, self.end_mark) AttributeError: 'dict_node' object has no attribute 'start_mark'
AttributeError
def __deepcopy__(self, memo): result = dict_node(self, self.start_mark, self.end_mark) memo[id(self)] = result for k, v in self.items(): result[deepcopy(k)] = deepcopy(v, memo) return result
def __deepcopy__(self, memo): cls = self.__class__ result = cls.__new__(cls, self.start_mark, self.end_mark) memo[id(self)] = result for k, v in self.items(): result[deepcopy(k)] = deepcopy(v, memo) return result
https://github.com/aws-cloudformation/cfn-python-lint/issues/459
Traceback (most recent call last): File "/usr/local/bin/cfn-lint", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/site-packages/cfnlint/__main__.py", line 36, in main args.regions, args.override_spec)) File "/usr/local/lib/python2.7/site-packages/cfnlint/core.py", line 46, in run_cli return run_checks(filename, template, rules, regions) File "/usr/local/lib/python2.7/site-packages/cfnlint/core.py", line 316, in run_checks matches.extend(runner.transform()) File "/usr/local/lib/python2.7/site-packages/cfnlint/__init__.py", line 894, in transform matches = transform.transform_template() File "/usr/local/lib/python2.7/site-packages/cfnlint/transform.py", line 115, in transform_template sam_translator.translate(sam_template=self._template, parameter_values={})) File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/translator/translator.py", line 71, in translate translated = macro.to_cloudformation(**kwargs) File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/sam_resources.py", line 501, in to_cloudformation rest_api, deployment, stage = api_generator.to_cloudformation() File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 160, in to_cloudformation rest_api = self._construct_rest_api() File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 69, in _construct_rest_api self._add_cors() File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 212, in _add_cors self.definition_body = editor.swagger File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/swagger/swagger.py", line 298, in swagger return copy.deepcopy(self._doc) File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 174, in deepcopy y = copier(memo) File "/usr/local/lib/python2.7/site-packages/cfnlint/decode/node.py", line 75, in __deepcopy__ result = cls.__new__(cls, self.start_mark, self.end_mark) AttributeError: 'dict_node' object has no attribute 'start_mark'
AttributeError
def create_dict_list_class(cls): """ Create dynamic list class """ class node_class(cls): """Node class created based on the input class""" def __init__(self, x, start_mark, end_mark): try: cls.__init__(self, x) except TypeError: cls.__init__(self) self.start_mark = start_mark self.end_mark = end_mark self.condition_functions = ["Fn::If"] def __deepcopy__(self, memo): result = list_node([], self.start_mark, self.end_mark) memo[id(self)] = result for _, v in enumerate(self): result.append(deepcopy(v, memo)) return result def __copy__(self): return self def items_safe(self, path=None, type_t=()): """Get items while handling IFs""" path = path or [] for i, v in enumerate(self): if isinstance(v, dict): for items, p in v.items_safe(path[:] + [i]): if isinstance(items, type_t) or not type_t: yield items, p else: if isinstance(v, type_t) or not type_t: yield v, path[:] + [i] def __getattr__(self, name): raise TemplateAttributeError( "%s.%s is invalid" % (self.__class__.__name__, name) ) node_class.__name__ = "%s_node" % cls.__name__ return node_class
def create_dict_list_class(cls): """ Create dynamic list class """ class node_class(cls): """Node class created based on the input class""" def __init__(self, x, start_mark, end_mark): try: cls.__init__(self, x) except TypeError: cls.__init__(self) self.start_mark = start_mark self.end_mark = end_mark self.condition_functions = ["Fn::If"] def __deepcopy__(self, memo): cls = self.__class__ result = cls.__new__(cls, self.start_mark, self.end_mark) memo[id(self)] = result for _, v in enumerate(self): result.append(deepcopy(v, memo)) return result def __copy__(self): return self def items_safe(self, path=None, type_t=()): """Get items while handling IFs""" path = path or [] for i, v in enumerate(self): if isinstance(v, dict): for items, p in v.items_safe(path[:] + [i]): if isinstance(items, type_t) or not type_t: yield items, p else: if isinstance(v, type_t) or not type_t: yield v, path[:] + [i] def __getattr__(self, name): raise TemplateAttributeError( "%s.%s is invalid" % (self.__class__.__name__, name) ) node_class.__name__ = "%s_node" % cls.__name__ return node_class
https://github.com/aws-cloudformation/cfn-python-lint/issues/459
Traceback (most recent call last): File "/usr/local/bin/cfn-lint", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/site-packages/cfnlint/__main__.py", line 36, in main args.regions, args.override_spec)) File "/usr/local/lib/python2.7/site-packages/cfnlint/core.py", line 46, in run_cli return run_checks(filename, template, rules, regions) File "/usr/local/lib/python2.7/site-packages/cfnlint/core.py", line 316, in run_checks matches.extend(runner.transform()) File "/usr/local/lib/python2.7/site-packages/cfnlint/__init__.py", line 894, in transform matches = transform.transform_template() File "/usr/local/lib/python2.7/site-packages/cfnlint/transform.py", line 115, in transform_template sam_translator.translate(sam_template=self._template, parameter_values={})) File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/translator/translator.py", line 71, in translate translated = macro.to_cloudformation(**kwargs) File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/sam_resources.py", line 501, in to_cloudformation rest_api, deployment, stage = api_generator.to_cloudformation() File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 160, in to_cloudformation rest_api = self._construct_rest_api() File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 69, in _construct_rest_api self._add_cors() File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/model/api/api_generator.py", line 212, in _add_cors self.definition_body = editor.swagger File "/Users/eaddingtonwhite/Library/Python/2.7/lib/python/site-packages/samtranslator/swagger/swagger.py", line 298, in swagger return copy.deepcopy(self._doc) File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 174, in deepcopy y = copier(memo) File "/usr/local/lib/python2.7/site-packages/cfnlint/decode/node.py", line 75, in __deepcopy__ result = cls.__new__(cls, self.start_mark, self.end_mark) AttributeError: 'dict_node' object has no attribute 'start_mark'
AttributeError
def transform_template(self): """ Transform the Template using the Serverless Application Model. """ matches = [] try: sam_translator = Translator( managed_policy_map=self._managed_policy_map, sam_parser=self._sam_parser ) self._replace_local_codeuri() # Tell SAM to use the region we're linting in, this has to be controlled using the default AWS mechanisms, see also: # https://github.com/awslabs/serverless-application-model/blob/master/samtranslator/translator/arn_generator.py os.environ["AWS_DEFAULT_REGION"] = self._region # In the Paser class, within the SAM Translator, they log a warning for when the template # does not match the schema. The logger they use is the root logger instead of one scoped to # their module. Currently this does not cause templates to fail, so we will suppress this # by patching the logging.warning method that is used in that class. class WarningSuppressLogger(object): """Patch the Logger in SAM""" def __init__(self, obj_to_patch): self.obj_to_patch = obj_to_patch def __enter__(self): self.obj_to_patch.warning = self.warning def __exit__(self, exc_type, exc_val, exc_tb): self.obj_to_patch.warning = self.obj_to_patch.warning def warning(self, message): """Ignore warnings from SAM""" pass with WarningSuppressLogger(parser.logging): self._template = cfnlint.helpers.convert_dict( sam_translator.translate( sam_template=self._template, parameter_values={} ) ) except InvalidDocumentException as e: for cause in e.causes: matches.append( cfnlint.Match( 1, 1, 1, 1, self._filename, cfnlint.TransformError(), cause.message ) ) except Exception as e: # pylint: disable=W0703 LOGGER.debug("Error transforming template: %s", str(e)) LOGGER.debug("Stack trace: %s", e, exc_info=True) message = "Error transforming template: {0}" matches.append( cfnlint.Match( 1, 1, 1, 1, self._filename, cfnlint.TransformError(), message.format(str(e)), ) ) return matches
def transform_template(self): """ Transform the Template using the Serverless Application Model. """ matches = [] try: sam_translator = Translator( managed_policy_map=self._managed_policy_map, sam_parser=self._sam_parser ) self._replace_local_codeuri() # Tell SAM to use the region we're linting in, this has to be controlled using the default AWS mechanisms, see also: # https://github.com/awslabs/serverless-application-model/blob/master/samtranslator/translator/arn_generator.py os.environ["AWS_DEFAULT_REGION"] = self._region # In the Paser class, within the SAM Translator, they log a warning for when the template # does not match the schema. The logger they use is the root logger instead of one scoped to # their module. Currently this does not cause templates to fail, so we will suppress this # by patching the logging.warning method that is used in that class. class WarningSuppressLogger(object): """Patch the Logger in SAM""" def __init__(self, obj_to_patch): self.obj_to_patch = obj_to_patch def __enter__(self): self.obj_to_patch.warning = self.warning def __exit__(self, exc_type, exc_val, exc_tb): self.obj_to_patch.warning = self.obj_to_patch.warning def warning(self, message): """Ignore warnings from SAM""" pass with WarningSuppressLogger(parser.logging): self._template = cfnlint.helpers.convert_dict( sam_translator.translate( sam_template=self._template, parameter_values={} ) ) except InvalidDocumentException as e: for cause in e.causes: matches.append( cfnlint.Match( 1, 1, 1, 1, self._filename, cfnlint.TransformError(), cause.message ) ) return matches
https://github.com/aws-cloudformation/cfn-python-lint/issues/436
$ cfn-lint -t template.yaml Traceback (most recent call last): File "/Users/emilbryggare/Library/Python/2.7/bin/cfn-lint", line 11, in <module> sys.exit(main()) File "/Users/emilbryggare/Library/Python/2.7/lib/python/site-packages/cfnlint/__main__.py", line 36, in main args.regions, args.override_spec)) File "/Users/emilbryggare/Library/Python/2.7/lib/python/site-packages/cfnlint/core.py", line 46, in run_cli return run_checks(filename, template, rules, regions) File "/Users/emilbryggare/Library/Python/2.7/lib/python/site-packages/cfnlint/core.py", line 316, in run_checks matches.extend(runner.transform()) File "/Users/emilbryggare/Library/Python/2.7/lib/python/site-packages/cfnlint/__init__.py", line 894, in transform matches = transform.transform_template() File "/Users/emilbryggare/Library/Python/2.7/lib/python/site-packages/cfnlint/transform.py", line 115, in transform_template sam_translator.translate(sam_template=self._template, parameter_values={})) File "/Users/emilbryggare/Library/Python/2.7/lib/python/site-packages/samtranslator/translator/translator.py", line 72, in translate translated = macro.to_cloudformation(**kwargs) File "/Users/emilbryggare/Library/Python/2.7/lib/python/site-packages/samtranslator/model/sam_resources.py", line 537, in to_cloudformation dynamodb_resources = self._construct_dynamodb_table() File "/Users/emilbryggare/Library/Python/2.7/lib/python/site-packages/samtranslator/model/sam_resources.py", line 546, in _construct_dynamodb_table 'AttributeName': self.PrimaryKey['Name'], KeyError: 'Name'
KeyError
def match(self, cfn): """Check CloudFormation Resources""" matches = [] for r_name, r_values in cfn.get_resources().items(): update_policy = r_values.get("UpdatePolicy", {}) resource_type = r_values.get("Type") if isinstance(update_policy, dict): for up_type, up_value in update_policy.items(): path = ["Resources", r_name, "UpdatePolicy", up_type] up_type_spec = self.valid_attributes.get("main").get(up_type) if up_type_spec: if resource_type not in up_type_spec.get("ResourceTypes"): message = "UpdatePolicy only supports this type for resources of type ({0})" matches.append( RuleMatch( path, message.format( ", ".join( map(str, up_type_spec.get("ResourceTypes")) ) ), ) ) if "Type" in up_type_spec: matches.extend( self.check_attributes( up_value, up_type_spec.get("Type"), path[:] ) ) else: matches.extend( self.check_primitive_type( up_value, up_type_spec.get("PrimitiveType"), path[:], valid_values=up_type_spec.get("ValidValues", []), ) ) else: message = "UpdatePolicy doesn't support type {0}" matches.append(RuleMatch(path, message.format(up_type))) else: message = "UpdatePolicy should be an object" matches.append( RuleMatch(["Resources", r_name, "UpdatePolicy"], message.format()) ) return matches
def match(self, cfn): """Check CloudFormation Resources""" matches = [] for r_name, r_values in cfn.get_resources().items(): update_policy = r_values.get("UpdatePolicy", {}) resource_type = r_values.get("Type") if isinstance(update_policy, dict): for up_type, up_value in update_policy.items(): path = ["Resources", r_name, "UpdatePolicy", up_type] up_type_spec = self.valid_attributes.get("main").get(up_type) if up_type_spec: if resource_type not in up_type_spec.get("ResourceTypes"): message = "UpdatePolicy only supports this type for resources of type ({0})" matches.append( RuleMatch( path, message.format( ", ".join( map(str, up_type_spec.get("ResourceTypes")) ) ), ) ) if "Type" in up_type_spec: matches.extend( self.check_attributes( up_value, up_type_spec.get("Type"), path[:] ) ) else: matches.extend( self.check_primitive_type( up_value, up_type_spec.get("PrimitiveType"), path[:], valid_values=up_type_spec.get("ValidValues", []), ) ) else: message = "UpdatePolicy doesn't support type {0}" matches.append(RuleMatch(path, message.format(up_type))) else: message = "UpdatePolicy should be an object" matches.append( RuleMatch( ["Resources", r_name, "UpdatePolicy"], message.format(path[-1]) ) ) return matches
https://github.com/aws-cloudformation/cfn-python-lint/issues/422
FAIL: test_file_negative_alias (rules.resources.updatepolicy.test_configuration.TestConfiguration) Test failure ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/cmmeyer/Documents/DevAdvocate/cfn-python-lint/test/rules/resources/updatepolicy/test_configuration.py", line 37, in test_file_negative_alias self.helper_file_negative('fixtures/templates/bad/resources/updatepolicy/config.yaml', 10) File "/Users/cmmeyer/Documents/DevAdvocate/cfn-python-lint/test/rules/__init__.py", line 52, in helper_file_negative self.assertEqual(err_count, len(errs)) AssertionError: 10 != 1
AssertionError
def decode(filename, ignore_bad_template): """ Decode filename into an object """ template = None matches = [] try: template = cfnlint.decode.cfn_yaml.load(filename) except IOError as e: if e.errno == 2: LOGGER.error("Template file not found: %s", filename) sys.exit(1) elif e.errno == 21: LOGGER.error("Template references a directory, not a file: %s", filename) sys.exit(1) elif e.errno == 13: LOGGER.error("Permission denied when accessing template file: %s", filename) sys.exit(1) except cfnlint.decode.cfn_yaml.CfnParseError as err: err.match.Filename = filename matches = [err.match] except ParserError as err: matches = [create_match_yaml_parser_error(err, filename)] except ScannerError as err: if err.problem == "found character '\\t' that cannot start any token": try: template = json.load( open(filename), cls=cfnlint.decode.cfn_json.CfnJSONDecoder ) except cfnlint.decode.cfn_json.JSONDecodeError as json_err: json_err.match.filename = filename matches = [json_err.match] except JSONDecodeError as json_err: matches = [create_match_json_parser_error(json_err, filename)] except Exception as json_err: # pylint: disable=W0703 if ignore_bad_template: LOGGER.info("Template %s is malformed: %s", filename, err.problem) LOGGER.info( "Tried to parse %s as JSON but got error: %s", filename, str(json_err), ) else: LOGGER.error("Template %s is malformed: %s", filename, err.problem) LOGGER.error( "Tried to parse %s as JSON but got error: %s", filename, str(json_err), ) sys.exit(1) else: matches = [create_match_yaml_parser_error(err, filename)] if not isinstance(template, dict): # Template isn't a dict which means nearly nothing will work matches = [ cfnlint.Match( 1, 1, 1, 1, filename, cfnlint.ParseError(), message="Template needs to be an object.", ) ] return (template, matches)
def decode(filename, ignore_bad_template): """ Decode filename into an object """ template = None matches = [] try: template = cfnlint.decode.cfn_yaml.load(filename) except IOError as e: if e.errno == 2: LOGGER.error("Template file not found: %s", filename) sys.exit(1) elif e.errno == 21: LOGGER.error("Template references a directory, not a file: %s", filename) sys.exit(1) elif e.errno == 13: LOGGER.error("Permission denied when accessing template file: %s", filename) sys.exit(1) except cfnlint.decode.cfn_yaml.CfnParseError as err: err.match.Filename = filename matches = [err.match] except ParserError as err: matches = [create_match_yaml_parser_error(err, filename)] except ScannerError as err: if err.problem == "found character '\\t' that cannot start any token": try: template = json.load( open(filename), cls=cfnlint.decode.cfn_json.CfnJSONDecoder ) except cfnlint.decode.cfn_json.JSONDecodeError as json_err: json_err.match.filename = filename matches = [json_err.match] except JSONDecodeError as json_err: matches = [create_match_json_parser_error(json_err, filename)] except Exception as json_err: # pylint: disable=W0703 if ignore_bad_template: LOGGER.info("Template %s is malformed: %s", filename, err.problem) LOGGER.info( "Tried to parse %s as JSON but got error: %s", filename, str(json_err), ) else: LOGGER.error("Template %s is malformed: %s", filename, err.problem) LOGGER.error( "Tried to parse %s as JSON but got error: %s", filename, str(json_err), ) sys.exit(1) else: matches = [create_match_yaml_parser_error(err, filename)] return (template, matches)
https://github.com/aws-cloudformation/cfn-python-lint/issues/322
$ echo malformed > test.yml $ cfn-lint test.yml Traceback (most recent call last): File "/Users/myusername/.virtualenvs/myvirtualenv/bin/cfn-lint", line 11, in <module> sys.exit(main()) File "/Users/myusername/.virtualenvs/myvirtualenv/lib/python3.7/site-packages/cfnlint/__main__.py", line 27, in main (args, filename, template, rules, fmt, formatter) = cfnlint.core.get_template_args_rules(sys.argv[1:]) File "/Users/myusername/.virtualenvs/myvirtualenv/lib/python3.7/site-packages/cfnlint/core.py", line 222, in get_template_args_rules for section, values in get_default_args(template).items(): File "/Users/myusername/.virtualenvs/myvirtualenv/lib/python3.7/site-packages/cfnlint/core.py", line 258, in get_default_args if isinstance(configs, dict): UnboundLocalError: local variable 'configs' referenced before assignment
UnboundLocalError
def add_field(doc, name, value): if isinstance(value, (list, set)): for v in value: add_field(doc, name, v) return else: field = Element("field", name=name) if not isinstance(value, six.string_types): value = str(value) try: value = strip_bad_char(value) if six.PY2 and isinstance(value, str): value = value.decode("utf-8") field.text = normalize("NFC", value) except: logger.error("Error in normalizing %r", value) raise doc.append(field)
def add_field(doc, name, value): if isinstance(value, (list, set)): for v in value: add_field(doc, name, v) return else: field = Element("field", name=name) if not isinstance(value, six.string_types): value = str(value) try: value = strip_bad_char(value) if isinstance(value, str): value = value.decode("utf-8") field.text = normalize("NFC", value) except: logger.error("Error in normalizing %r", value) raise doc.append(field)
https://github.com/internetarchive/openlibrary/issues/4542
2021-02-04 19:47:02 [420] [openlibrary.solrwriter] [INFO] updating loans/loan-1944642791 2021-02-04 19:47:02 [420] [openlibrary.solrwriter] [ERROR] Error in normalizing 'loans/loan-1944635007' Traceback (most recent call last): File "/openlibrary/scripts/openlibrary-server", line 133, in main() File "/openlibrary/scripts/openlibrary-server", line 130, in main start_server() File "/openlibrary/scripts/openlibrary-server", line 46, in start_server infogami.run(args) File "/openlibrary/infogami/init.py", line 151, in run run_action(args[0], args[1:]) File "/openlibrary/infogami/init.py", line 138, in run_action a(*args) File "/openlibrary/openlibrary/actions.py", line 11, in runmain mod.main(*args) File "/openlibrary/openlibrary/solr/process_stats.py", line 219, in main add_events_to_solr(events) File "/openlibrary/openlibrary/solr/process_stats.py", line 210, in add_events_to_solr update_solr(solrdocs) File "/openlibrary/openlibrary/solr/process_stats.py", line 261, in update_solr solr.update(doc) File "/openlibrary/openlibrary/solr/solrwriter.py", line 57, in update self.flush() File "/openlibrary/openlibrary/solr/solrwriter.py", line 64, in flush node = dict2element(doc) File "/openlibrary/openlibrary/solr/solrwriter.py", line 108, in dict2element add_field(doc, k, v) File "/openlibrary/openlibrary/solr/solrwriter.py", line 98, in add_field value = value.decode('utf-8') AttributeError: 'str' object has no attribute 'decode'
AttributeError
def __init__(self, e): self.code = e.response.status_code self.headers = e.response.headers Exception.__init__(self, "{}. Response: {}".format(e, e.response.text))
def __init__(self, http_error): self.code = http_error.code self.headers = http_error.headers msg = http_error.msg + ": " + http_error.read() Exception.__init__(self, msg)
https://github.com/internetarchive/openlibrary/issues/4212
Error using client: HTTPError Traceback (most recent call last) <ipython-input-5-d841aca49599> in <module>() 6 save_set.append(ed) 7 response = ol.save_many(save_set, 'moving edition(s) to primary work') ----> 8 response.raise_for_status() 9 response /usr/local/lib/python3.6/dist-packages/requests/models.py in raise_for_status(self) 939 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942 943 def close(self):
HTTPError
def _request(self, path, method="GET", data=None, headers=None, params=None): logger.info("%s %s", method, path) url = self.base_url + path headers = headers or {} params = params or {} if self.cookie: headers["Cookie"] = self.cookie try: response = requests.request( method, url, data=data, headers=headers, params=params ) response.raise_for_status() return response except requests.HTTPError as e: raise OLError(e)
def _request(self, path, method="GET", data=None, headers=None): logger.info("%s %s", method, path) url = self.base_url + path headers = headers or {} if self.cookie: headers["Cookie"] = self.cookie try: req = urllib.request.Request(url, data, headers) req.get_method = lambda: method return urllib.request.urlopen(req) except urllib.error.HTTPError as e: raise OLError(e)
https://github.com/internetarchive/openlibrary/issues/4212
Error using client: HTTPError Traceback (most recent call last) <ipython-input-5-d841aca49599> in <module>() 6 save_set.append(ed) 7 response = ol.save_many(save_set, 'moving edition(s) to primary work') ----> 8 response.raise_for_status() 9 response /usr/local/lib/python3.6/dist-packages/requests/models.py in raise_for_status(self) 939 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942 943 def close(self):
HTTPError
def login(self, username, password): """Login to Open Library with given credentials.""" headers = {"Content-Type": "application/json"} try: data = json.dumps(dict(username=username, password=password)) response = self._request( "/account/login", method="POST", data=data, headers=headers ) except OLError as e: response = e if "Set-Cookie" in response.headers: cookies = response.headers["Set-Cookie"].split(",") self.cookie = ";".join([c.split(";")[0] for c in cookies])
def login(self, username, password): """Login to Open Library with given credentials.""" headers = {"Content-Type": "application/json"} try: data = json.dumps(dict(username=username, password=password)) response = self._request( "/account/login", method="POST", data=data, headers=headers ) except urllib.error.HTTPError as e: response = e if "Set-Cookie" in response.headers: cookies = response.headers["Set-Cookie"].split(",") self.cookie = ";".join([c.split(";")[0] for c in cookies])
https://github.com/internetarchive/openlibrary/issues/4212
Error using client: HTTPError Traceback (most recent call last) <ipython-input-5-d841aca49599> in <module>() 6 save_set.append(ed) 7 response = ol.save_many(save_set, 'moving edition(s) to primary work') ----> 8 response.raise_for_status() 9 response /usr/local/lib/python3.6/dist-packages/requests/models.py in raise_for_status(self) 939 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942 943 def close(self):
HTTPError
def get(self, key, v=None): response = self._request(key + ".json", params={"v": v} if v else {}) return unmarshal(response.json())
def get(self, key, v=None): data = self._request(key + ".json" + ("?v=%d" % v if v else "")).read() return unmarshal(json.loads(data))
https://github.com/internetarchive/openlibrary/issues/4212
Error using client: HTTPError Traceback (most recent call last) <ipython-input-5-d841aca49599> in <module>() 6 save_set.append(ed) 7 response = ol.save_many(save_set, 'moving edition(s) to primary work') ----> 8 response.raise_for_status() 9 response /usr/local/lib/python3.6/dist-packages/requests/models.py in raise_for_status(self) 939 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942 943 def close(self):
HTTPError
def _get_many(self, keys): response = self._request("/api/get_many", params={"keys": json.dumps(keys)}) return response.json()["result"]
def _get_many(self, keys): response = self._request( "/api/get_many?" + urllib.parse.urlencode({"keys": json.dumps(keys)}) ) return json.loads(response.read())["result"]
https://github.com/internetarchive/openlibrary/issues/4212
Error using client: HTTPError Traceback (most recent call last) <ipython-input-5-d841aca49599> in <module>() 6 save_set.append(ed) 7 response = ol.save_many(save_set, 'moving edition(s) to primary work') ----> 8 response.raise_for_status() 9 response /usr/local/lib/python3.6/dist-packages/requests/models.py in raise_for_status(self) 939 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942 943 def close(self):
HTTPError
def save(self, key, data, comment=None): headers = {"Content-Type": "application/json"} data = marshal(data) if comment: headers["Opt"] = '"%s/dev/docs/api"; ns=42' % self.base_url headers["42-comment"] = comment data = json.dumps(data) return self._request(key, method="PUT", data=data, headers=headers).content
def save(self, key, data, comment=None): headers = {"Content-Type": "application/json"} data = marshal(data) if comment: headers["Opt"] = '"%s/dev/docs/api"; ns=42' % self.base_url headers["42-comment"] = comment data = json.dumps(data) return self._request(key, method="PUT", data=data, headers=headers).read()
https://github.com/internetarchive/openlibrary/issues/4212
Error using client: HTTPError Traceback (most recent call last) <ipython-input-5-d841aca49599> in <module>() 6 save_set.append(ed) 7 response = ol.save_many(save_set, 'moving edition(s) to primary work') ----> 8 response.raise_for_status() 9 response /usr/local/lib/python3.6/dist-packages/requests/models.py in raise_for_status(self) 939 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942 943 def close(self):
HTTPError
def _call_write(self, name, query, comment, action): headers = {"Content-Type": "application/json"} query = marshal(query) # use HTTP Extension Framework to add custom headers. see RFC 2774 for more details. if comment or action: headers["Opt"] = '"%s/dev/docs/api"; ns=42' % self.base_url if comment: headers["42-comment"] = comment if action: headers["42-action"] = action response = self._request( "/api/" + name, method="POST", data=json.dumps(query), headers=headers ) return response.json()
def _call_write(self, name, query, comment, action): headers = {"Content-Type": "application/json"} query = marshal(query) # use HTTP Extension Framework to add custom headers. see RFC 2774 for more details. if comment or action: headers["Opt"] = '"%s/dev/docs/api"; ns=42' % self.base_url if comment: headers["42-comment"] = comment if action: headers["42-action"] = action response = self._request( "/api/" + name, method="POST", data=json.dumps(query), headers=headers ) return json.loads(response.read())
https://github.com/internetarchive/openlibrary/issues/4212
Error using client: HTTPError Traceback (most recent call last) <ipython-input-5-d841aca49599> in <module>() 6 save_set.append(ed) 7 response = ol.save_many(save_set, 'moving edition(s) to primary work') ----> 8 response.raise_for_status() 9 response /usr/local/lib/python3.6/dist-packages/requests/models.py in raise_for_status(self) 939 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942 943 def close(self):
HTTPError
def query(self, q=None, **kw): """Query Open Library. Open Library always limits the result to 1000 items due to performance issues. Pass limit=False to fetch all matching results by making multiple requests to the server. Please note that an iterator is returned instead of list when limit=False is passed.:: >>> ol.query({'type': '/type/type', 'limit': 2}) #doctest: +SKIP [{'key': '/type/property'}, {'key': '/type/type'}] >>> ol.query(type='/type/type', limit=2) #doctest: +SKIP [{'key': '/type/property'}, {'key': '/type/type'}] """ q = dict(q or {}) q.update(kw) q = marshal(q) def unlimited_query(q): q["limit"] = 1000 q.setdefault("offset", 0) q.setdefault("sort", "key") while True: result = self.query(q) for r in result: yield r if len(result) < 1000: break q["offset"] += len(result) if "limit" in q and q["limit"] == False: return unlimited_query(q) else: response = self._request("/query.json", params=dict(query=json.dumps(q))) return unmarshal(response.json())
def query(self, q=None, **kw): """Query Open Library. Open Library always limits the result to 1000 items due to performance issues. Pass limit=False to fetch all matching results by making multiple requests to the server. Please note that an iterator is returned instead of list when limit=False is passed.:: >>> ol.query({'type': '/type/type', 'limit': 2}) #doctest: +SKIP [{'key': '/type/property'}, {'key': '/type/type'}] >>> ol.query(type='/type/type', limit=2) #doctest: +SKIP [{'key': '/type/property'}, {'key': '/type/type'}] """ q = dict(q or {}) q.update(kw) q = marshal(q) def unlimited_query(q): q["limit"] = 1000 q.setdefault("offset", 0) q.setdefault("sort", "key") while True: result = self.query(q) for r in result: yield r if len(result) < 1000: break q["offset"] += len(result) if "limit" in q and q["limit"] == False: return unlimited_query(q) else: q = json.dumps(q) response = self._request("/query.json?" + urllib.parse.urlencode(dict(query=q))) return unmarshal(json.loads(response.read()))
https://github.com/internetarchive/openlibrary/issues/4212
Error using client: HTTPError Traceback (most recent call last) <ipython-input-5-d841aca49599> in <module>() 6 save_set.append(ed) 7 response = ol.save_many(save_set, 'moving edition(s) to primary work') ----> 8 response.raise_for_status() 9 response /usr/local/lib/python3.6/dist-packages/requests/models.py in raise_for_status(self) 939 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942 943 def close(self):
HTTPError
def import_ocaid(self, ocaid, require_marc=True): data = {"identifier": ocaid, "require_marc": "true" if require_marc else "false"} return self._request("/api/import/ia", method="POST", data=data).content
def import_ocaid(self, ocaid, require_marc=True): data = {"identifier": ocaid, "require_marc": "true" if require_marc else "false"} return self._request( "/api/import/ia", method="POST", data=urllib.parse.urlencode(data) ).read()
https://github.com/internetarchive/openlibrary/issues/4212
Error using client: HTTPError Traceback (most recent call last) <ipython-input-5-d841aca49599> in <module>() 6 save_set.append(ed) 7 response = ol.save_many(save_set, 'moving edition(s) to primary work') ----> 8 response.raise_for_status() 9 response /usr/local/lib/python3.6/dist-packages/requests/models.py in raise_for_status(self) 939 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942 943 def close(self):
HTTPError
def save_many(self, sitename, data): # Work-around for https://github.com/internetarchive/openlibrary/issues/4285 # Infogami seems to read encoded bytes as a string with a byte literal inside # of it, which is invalid JSON and also can't be decode()'d. if isinstance(data.get("query"), bytes): data["query"] = data["query"].decode() return self.conn.request(sitename, "/save_many", "POST", data)
def save_many(self, sitename, data): return self.conn.request(sitename, "/save_many", "POST", data)
https://github.com/internetarchive/openlibrary/issues/4212
Error using client: HTTPError Traceback (most recent call last) <ipython-input-5-d841aca49599> in <module>() 6 save_set.append(ed) 7 response = ol.save_many(save_set, 'moving edition(s) to primary work') ----> 8 response.raise_for_status() 9 response /usr/local/lib/python3.6/dist-packages/requests/models.py in raise_for_status(self) 939 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942 943 def close(self):
HTTPError
def parse_args(): parser = OptionParser( "usage: %s [options] path1 path2" % sys.argv[0], description=desc, version=__version__, ) parser.add_option("-c", "--comment", dest="comment", default="", help="comment") parser.add_option( "--src", dest="src", metavar="SOURCE_URL", default="http://openlibrary.org/", help="URL of the source server (default: %default)", ) parser.add_option( "--dest", dest="dest", metavar="DEST_URL", default="http://localhost", help="URL of the destination server (default: %default)", ) parser.add_option( "-r", "--recursive", dest="recursive", action="store_true", default=True, help="Recursively fetch all the referred docs.", ) parser.add_option( "-l", "--list", dest="lists", action="append", default=[], help="copy docs from a list.", ) return parser.parse_args()
def parse_args(): parser = OptionParser( "usage: %s [options] path1 path2" % sys.argv[0], description=desc, version=__version__, ) parser.add_option("-c", "--comment", dest="comment", default="", help="comment") parser.add_option( "--src", dest="src", metavar="SOURCE_URL", default="http://openlibrary.org/", help="URL of the source server (default: %default)", ) parser.add_option( "--dest", dest="dest", metavar="DEST_URL", default="http://localhost", help="URL of the destination server (default: %default)", ) parser.add_option( "-r", "--recursive", dest="recursive", action="store_true", default=False, help="Recursively fetch all the referred docs.", ) parser.add_option( "-l", "--list", dest="lists", action="append", default=[], help="copy docs from a list.", ) return parser.parse_args()
https://github.com/internetarchive/openlibrary/issues/4212
Error using client: HTTPError Traceback (most recent call last) <ipython-input-5-d841aca49599> in <module>() 6 save_set.append(ed) 7 response = ol.save_many(save_set, 'moving edition(s) to primary work') ----> 8 response.raise_for_status() 9 response /usr/local/lib/python3.6/dist-packages/requests/models.py in raise_for_status(self) 939 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942 943 def close(self):
HTTPError
def GET(self, key): page = web.ctx.site.get(key) if not page: raise web.notfound("") else: from infogami.utils import template from openlibrary.plugins.openlibrary import opds try: result = template.typetemplate("opds")(page, opds) except: raise web.notfound("") else: return delegate.RawText( result, content_type=" application/atom+xml;profile=opds" )
def GET(self, key): page = web.ctx.site.get(key) if not page: raise web.notfound("") else: from infogami.utils import template import opds try: result = template.typetemplate("opds")(page, opds) except: raise web.notfound("") else: return delegate.RawText( result, content_type=" application/atom+xml;profile=opds" )
https://github.com/internetarchive/openlibrary/issues/1409
Traceback (most recent call last): ... File "/opt/openlibrary/deploys/openlibrary/openlibrary/openlibrary/plugins/openlibrary/code.py", line 445, in GET import opds ImportError: No module named opds
ImportError
def prepare(self, elaboratable, name="top", **kwargs): assert not self._prepared self._prepared = True fragment = Fragment.get(elaboratable, self) fragment = SampleLowerer()(fragment) fragment._propagate_domains(self.create_missing_domain, platform=self) fragment = DomainLowerer()(fragment) def add_pin_fragment(pin, pin_fragment): pin_fragment = Fragment.get(pin_fragment, self) if not isinstance(pin_fragment, Instance): pin_fragment.flatten = True fragment.add_subfragment(pin_fragment, name="pin_{}".format(pin.name)) for pin, port, attrs, invert in self.iter_single_ended_pins(): if pin.dir == "i": add_pin_fragment(pin, self.get_input(pin, port, attrs, invert)) if pin.dir == "o": add_pin_fragment(pin, self.get_output(pin, port, attrs, invert)) if pin.dir == "oe": add_pin_fragment(pin, self.get_tristate(pin, port, attrs, invert)) if pin.dir == "io": add_pin_fragment(pin, self.get_input_output(pin, port, attrs, invert)) for pin, port, attrs, invert in self.iter_differential_pins(): if pin.dir == "i": add_pin_fragment(pin, self.get_diff_input(pin, port, attrs, invert)) if pin.dir == "o": add_pin_fragment(pin, self.get_diff_output(pin, port, attrs, invert)) if pin.dir == "oe": add_pin_fragment(pin, self.get_diff_tristate(pin, port, attrs, invert)) if pin.dir == "io": add_pin_fragment(pin, self.get_diff_input_output(pin, port, attrs, invert)) fragment._propagate_ports(ports=self.iter_ports(), all_undef_as_ports=False) return self.toolchain_prepare(fragment, name, **kwargs)
def prepare(self, elaboratable, name="top", **kwargs): assert not self._prepared self._prepared = True fragment = Fragment.get(elaboratable, self) fragment = SampleLowerer()(fragment) fragment._propagate_domains(self.create_missing_domain, platform=self) fragment = DomainLowerer()(fragment) def add_pin_fragment(pin, pin_fragment): pin_fragment = Fragment.get(pin_fragment, self) if not isinstance(pin_fragment, Instance): pin_fragment.flatten = True fragment.add_subfragment(pin_fragment, name="pin_{}".format(pin.name)) for pin, port, attrs, invert in self.iter_single_ended_pins(): if pin.dir == "i": add_pin_fragment(pin, self.get_input(pin, port, attrs, invert)) if pin.dir == "o": add_pin_fragment(pin, self.get_output(pin, port, attrs, invert)) if pin.dir == "oe": add_pin_fragment(pin, self.get_tristate(pin, port, attrs, invert)) if pin.dir == "io": add_pin_fragment(pin, self.get_input_output(pin, port, attrs, invert)) for pin, p_port, n_port, attrs, invert in self.iter_differential_pins(): if pin.dir == "i": add_pin_fragment( pin, self.get_diff_input(pin, p_port, n_port, attrs, invert) ) if pin.dir == "o": add_pin_fragment( pin, self.get_diff_output(pin, p_port, n_port, attrs, invert) ) if pin.dir == "oe": add_pin_fragment( pin, self.get_diff_tristate(pin, p_port, n_port, attrs, invert) ) if pin.dir == "io": add_pin_fragment( pin, self.get_diff_input_output(pin, p_port, n_port, attrs, invert) ) fragment._propagate_ports(ports=self.iter_ports(), all_undef_as_ports=False) return self.toolchain_prepare(fragment, name, **kwargs)
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_input(self, pin, port, attrs, invert): self._check_feature( "differential input", pin, attrs, valid_xdrs=(), valid_attrs=None )
def get_diff_input(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential input", pin, attrs, valid_xdrs=(), valid_attrs=None )
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_output(self, pin, port, attrs, invert): self._check_feature( "differential output", pin, attrs, valid_xdrs=(), valid_attrs=None )
def get_diff_output(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential output", pin, attrs, valid_xdrs=(), valid_attrs=None )
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_tristate(self, pin, port, attrs, invert): self._check_feature( "differential tristate", pin, attrs, valid_xdrs=(), valid_attrs=None )
def get_diff_tristate(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential tristate", pin, attrs, valid_xdrs=(), valid_attrs=None )
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_input_output(self, pin, port, attrs, invert): self._check_feature( "differential input/output", pin, attrs, valid_xdrs=(), valid_attrs=None )
def get_diff_input_output(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential input/output", pin, attrs, valid_xdrs=(), valid_attrs=None )
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def request(self, name, number=0, *, dir=None, xdr=None): resource = self.lookup(name, number) if (resource.name, resource.number) in self._requested: raise ResourceError( "Resource {}#{} has already been requested".format(name, number) ) def merge_options(subsignal, dir, xdr): if isinstance(subsignal.ios[0], Subsignal): if dir is None: dir = dict() if xdr is None: xdr = dict() if not isinstance(dir, dict): raise TypeError( "Directions must be a dict, not {!r}, because {!r} " "has subsignals".format(dir, subsignal) ) if not isinstance(xdr, dict): raise TypeError( "Data rate must be a dict, not {!r}, because {!r} " "has subsignals".format(xdr, subsignal) ) for sub in subsignal.ios: sub_dir = dir.get(sub.name, None) sub_xdr = xdr.get(sub.name, None) dir[sub.name], xdr[sub.name] = merge_options(sub, sub_dir, sub_xdr) else: if dir is None: dir = subsignal.ios[0].dir if xdr is None: xdr = 0 if dir not in ("i", "o", "oe", "io", "-"): raise TypeError( 'Direction must be one of "i", "o", "oe", "io", ' 'or "-", not {!r}'.format(dir) ) if dir != subsignal.ios[0].dir and not ( subsignal.ios[0].dir == "io" or dir == "-" ): raise ValueError( 'Direction of {!r} cannot be changed from "{}" to "{}"; ' 'direction can be changed from "io" to "i", "o", or ' '"oe", or from anything to "-"'.format( subsignal.ios[0], subsignal.ios[0].dir, dir ) ) if not isinstance(xdr, int) or xdr < 0: raise ValueError( "Data rate of {!r} must be a non-negative integer, not {!r}".format( subsignal.ios[0], xdr ) ) return dir, xdr def resolve(resource, dir, xdr, name, attrs): for attr_key, attr_value in attrs.items(): if hasattr(attr_value, "__call__"): attr_value = attr_value(self) assert attr_value is None or isinstance(attr_value, str) if attr_value is None: del attrs[attr_key] else: attrs[attr_key] = attr_value if isinstance(resource.ios[0], Subsignal): fields = OrderedDict() for sub in resource.ios: fields[sub.name] = resolve( sub, dir[sub.name], xdr[sub.name], name="{}__{}".format(name, sub.name), attrs={**attrs, **sub.attrs}, ) return Record( [(f_name, f.layout) for (f_name, f) in fields.items()], fields=fields, name=name, ) elif isinstance(resource.ios[0], (Pins, DiffPairs)): phys = resource.ios[0] if isinstance(phys, Pins): phys_names = phys.names port = Record([("io", len(phys))], name=name) if isinstance(phys, DiffPairs): phys_names = [] record_fields = [] if not self.should_skip_port_component(None, attrs, "p"): phys_names += phys.p.names record_fields.append(("p", len(phys))) if not self.should_skip_port_component(None, attrs, "n"): phys_names += phys.n.names record_fields.append(("n", len(phys))) port = Record(record_fields, name=name) if dir == "-": pin = None else: pin = Pin(len(phys), dir, xdr=xdr, name=name) for phys_name in phys_names: if phys_name in self._phys_reqd: raise ResourceError( "Resource component {} uses physical pin {}, but it " "is already used by resource component {} that was " "requested earlier".format( name, phys_name, self._phys_reqd[phys_name] ) ) self._phys_reqd[phys_name] = name self._ports.append((resource, pin, port, attrs)) if pin is not None and resource.clock is not None: self.add_clock_constraint(pin.i, resource.clock.frequency) return pin if pin is not None else port else: assert False # :nocov: value = resolve( resource, *merge_options(resource, dir, xdr), name="{}_{}".format(resource.name, resource.number), attrs=resource.attrs, ) self._requested[resource.name, resource.number] = value return value
def request(self, name, number=0, *, dir=None, xdr=None): resource = self.lookup(name, number) if (resource.name, resource.number) in self._requested: raise ResourceError( "Resource {}#{} has already been requested".format(name, number) ) def merge_options(subsignal, dir, xdr): if isinstance(subsignal.ios[0], Subsignal): if dir is None: dir = dict() if xdr is None: xdr = dict() if not isinstance(dir, dict): raise TypeError( "Directions must be a dict, not {!r}, because {!r} " "has subsignals".format(dir, subsignal) ) if not isinstance(xdr, dict): raise TypeError( "Data rate must be a dict, not {!r}, because {!r} " "has subsignals".format(xdr, subsignal) ) for sub in subsignal.ios: sub_dir = dir.get(sub.name, None) sub_xdr = xdr.get(sub.name, None) dir[sub.name], xdr[sub.name] = merge_options(sub, sub_dir, sub_xdr) else: if dir is None: dir = subsignal.ios[0].dir if xdr is None: xdr = 0 if dir not in ("i", "o", "oe", "io", "-"): raise TypeError( 'Direction must be one of "i", "o", "oe", "io", ' 'or "-", not {!r}'.format(dir) ) if dir != subsignal.ios[0].dir and not ( subsignal.ios[0].dir == "io" or dir == "-" ): raise ValueError( 'Direction of {!r} cannot be changed from "{}" to "{}"; ' 'direction can be changed from "io" to "i", "o", or ' '"oe", or from anything to "-"'.format( subsignal.ios[0], subsignal.ios[0].dir, dir ) ) if not isinstance(xdr, int) or xdr < 0: raise ValueError( "Data rate of {!r} must be a non-negative integer, not {!r}".format( subsignal.ios[0], xdr ) ) return dir, xdr def resolve(resource, dir, xdr, name, attrs): for attr_key, attr_value in attrs.items(): if hasattr(attr_value, "__call__"): attr_value = attr_value(self) assert attr_value is None or isinstance(attr_value, str) if attr_value is None: del attrs[attr_key] else: attrs[attr_key] = attr_value if isinstance(resource.ios[0], Subsignal): fields = OrderedDict() for sub in resource.ios: fields[sub.name] = resolve( sub, dir[sub.name], xdr[sub.name], name="{}__{}".format(name, sub.name), attrs={**attrs, **sub.attrs}, ) return Record( [(f_name, f.layout) for (f_name, f) in fields.items()], fields=fields, name=name, ) elif isinstance(resource.ios[0], (Pins, DiffPairs)): phys = resource.ios[0] if isinstance(phys, Pins): phys_names = phys.names port = Record([("io", len(phys))], name=name) if isinstance(phys, DiffPairs): phys_names = phys.p.names + phys.n.names port = Record([("p", len(phys)), ("n", len(phys))], name=name) if dir == "-": pin = None else: pin = Pin(len(phys), dir, xdr=xdr, name=name) for phys_name in phys_names: if phys_name in self._phys_reqd: raise ResourceError( "Resource component {} uses physical pin {}, but it " "is already used by resource component {} that was " "requested earlier".format( name, phys_name, self._phys_reqd[phys_name] ) ) self._phys_reqd[phys_name] = name self._ports.append((resource, pin, port, attrs)) if pin is not None and resource.clock is not None: self.add_clock_constraint(pin.i, resource.clock.frequency) return pin if pin is not None else port else: assert False # :nocov: value = resolve( resource, *merge_options(resource, dir, xdr), name="{}_{}".format(resource.name, resource.number), attrs=resource.attrs, ) self._requested[resource.name, resource.number] = value return value
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def resolve(resource, dir, xdr, name, attrs): for attr_key, attr_value in attrs.items(): if hasattr(attr_value, "__call__"): attr_value = attr_value(self) assert attr_value is None or isinstance(attr_value, str) if attr_value is None: del attrs[attr_key] else: attrs[attr_key] = attr_value if isinstance(resource.ios[0], Subsignal): fields = OrderedDict() for sub in resource.ios: fields[sub.name] = resolve( sub, dir[sub.name], xdr[sub.name], name="{}__{}".format(name, sub.name), attrs={**attrs, **sub.attrs}, ) return Record( [(f_name, f.layout) for (f_name, f) in fields.items()], fields=fields, name=name, ) elif isinstance(resource.ios[0], (Pins, DiffPairs)): phys = resource.ios[0] if isinstance(phys, Pins): phys_names = phys.names port = Record([("io", len(phys))], name=name) if isinstance(phys, DiffPairs): phys_names = [] record_fields = [] if not self.should_skip_port_component(None, attrs, "p"): phys_names += phys.p.names record_fields.append(("p", len(phys))) if not self.should_skip_port_component(None, attrs, "n"): phys_names += phys.n.names record_fields.append(("n", len(phys))) port = Record(record_fields, name=name) if dir == "-": pin = None else: pin = Pin(len(phys), dir, xdr=xdr, name=name) for phys_name in phys_names: if phys_name in self._phys_reqd: raise ResourceError( "Resource component {} uses physical pin {}, but it " "is already used by resource component {} that was " "requested earlier".format( name, phys_name, self._phys_reqd[phys_name] ) ) self._phys_reqd[phys_name] = name self._ports.append((resource, pin, port, attrs)) if pin is not None and resource.clock is not None: self.add_clock_constraint(pin.i, resource.clock.frequency) return pin if pin is not None else port else: assert False # :nocov:
def resolve(resource, dir, xdr, name, attrs): for attr_key, attr_value in attrs.items(): if hasattr(attr_value, "__call__"): attr_value = attr_value(self) assert attr_value is None or isinstance(attr_value, str) if attr_value is None: del attrs[attr_key] else: attrs[attr_key] = attr_value if isinstance(resource.ios[0], Subsignal): fields = OrderedDict() for sub in resource.ios: fields[sub.name] = resolve( sub, dir[sub.name], xdr[sub.name], name="{}__{}".format(name, sub.name), attrs={**attrs, **sub.attrs}, ) return Record( [(f_name, f.layout) for (f_name, f) in fields.items()], fields=fields, name=name, ) elif isinstance(resource.ios[0], (Pins, DiffPairs)): phys = resource.ios[0] if isinstance(phys, Pins): phys_names = phys.names port = Record([("io", len(phys))], name=name) if isinstance(phys, DiffPairs): phys_names = phys.p.names + phys.n.names port = Record([("p", len(phys)), ("n", len(phys))], name=name) if dir == "-": pin = None else: pin = Pin(len(phys), dir, xdr=xdr, name=name) for phys_name in phys_names: if phys_name in self._phys_reqd: raise ResourceError( "Resource component {} uses physical pin {}, but it " "is already used by resource component {} that was " "requested earlier".format( name, phys_name, self._phys_reqd[phys_name] ) ) self._phys_reqd[phys_name] = name self._ports.append((resource, pin, port, attrs)) if pin is not None and resource.clock is not None: self.add_clock_constraint(pin.i, resource.clock.frequency) return pin if pin is not None else port else: assert False # :nocov:
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def iter_single_ended_pins(self): for res, pin, port, attrs in self._ports: if pin is None: continue if isinstance(res.ios[0], Pins): yield pin, port, attrs, res.ios[0].invert
def iter_single_ended_pins(self): for res, pin, port, attrs in self._ports: if pin is None: continue if isinstance(res.ios[0], Pins): yield pin, port.io, attrs, res.ios[0].invert
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def iter_differential_pins(self): for res, pin, port, attrs in self._ports: if pin is None: continue if isinstance(res.ios[0], DiffPairs): yield pin, port, attrs, res.ios[0].invert
def iter_differential_pins(self): for res, pin, port, attrs in self._ports: if pin is None: continue if isinstance(res.ios[0], DiffPairs): yield pin, port.p, port.n, attrs, res.ios[0].invert
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_input(self, pin, port, attrs, invert): self._check_feature( "single-ended input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: port.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_in", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="FALSE", i_datain=port.io, o_dataout=self._get_ireg(m, pin, invert), ) return m
def get_input(self, pin, port, attrs, invert): self._check_feature( "single-ended input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: port.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_in", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="FALSE", i_datain=port, o_dataout=self._get_ireg(m, pin, invert), ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_output(self, pin, port, attrs, invert): self._check_feature( "single-ended output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: port.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_out", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="FALSE", p_use_oe="FALSE", i_datain=self._get_oreg(m, pin, invert), o_dataout=port.io, ) return m
def get_output(self, pin, port, attrs, invert): self._check_feature( "single-ended output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: port.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_out", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="FALSE", p_use_oe="FALSE", i_datain=self._get_oreg(m, pin, invert), o_dataout=port, ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_tristate(self, pin, port, attrs, invert): self._check_feature( "single-ended tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: port.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_out", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="FALSE", p_use_oe="TRUE", i_datain=self._get_oreg(m, pin, invert), o_dataout=port.io, i_oe=self._get_oereg(m, pin), ) return m
def get_tristate(self, pin, port, attrs, invert): self._check_feature( "single-ended tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: port.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_out", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="FALSE", p_use_oe="TRUE", i_datain=self._get_oreg(m, pin, invert), o_dataout=port, i_oe=self._get_oereg(m, pin), ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_input_output(self, pin, port, attrs, invert): self._check_feature( "single-ended input/output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: port.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_bidir", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="FALSE", i_datain=self._get_oreg(m, pin, invert), io_dataio=port.io, o_dataout=self._get_ireg(m, pin, invert), i_oe=self._get_oereg(m, pin), ) return m
def get_input_output(self, pin, port, attrs, invert): self._check_feature( "single-ended input/output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: port.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_bidir", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="FALSE", i_datain=self._get_oreg(m, pin, invert), io_dataio=port, o_dataout=self._get_ireg(m, pin, invert), i_oe=self._get_oereg(m, pin), ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_input(self, pin, port, attrs, invert): self._check_feature( "differential input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: port.p.attrs["useioff"] = 1 port.n.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_in", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="TRUE", i_datain=port.p, i_datain_b=port.n, o_dataout=self._get_ireg(m, pin, invert), ) return m
def get_diff_input(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: p_port.attrs["useioff"] = 1 n_port.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_in", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="TRUE", i_datain=p_port, i_datain_b=n_port, o_dataout=self._get_ireg(m, pin, invert), ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_output(self, pin, port, attrs, invert): self._check_feature( "differential output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: port.p.attrs["useioff"] = 1 port.n.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_out", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="TRUE", p_use_oe="FALSE", i_datain=self._get_oreg(m, pin, invert), o_dataout=port.p, o_dataout_b=port.n, ) return m
def get_diff_output(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: p_port.attrs["useioff"] = 1 n_port.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_out", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="TRUE", p_use_oe="FALSE", i_datain=self._get_oreg(m, pin, invert), o_dataout=p_port, o_dataout_b=n_port, ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_tristate(self, pin, port, attrs, invert): self._check_feature( "differential tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: port.p.attrs["useioff"] = 1 port.n.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_out", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="TRUE", p_use_oe="TRUE", i_datain=self._get_oreg(m, pin, invert), o_dataout=port.p, o_dataout_b=port.n, i_oe=self._get_oereg(m, pin), ) return m
def get_diff_tristate(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: p_port.attrs["useioff"] = 1 n_port.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_out", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="TRUE", p_use_oe="TRUE", i_datain=self._get_oreg(m, pin, invert), o_dataout=p_port, o_dataout_b=n_port, i_oe=self._get_oereg(m, pin), ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_input_output(self, pin, port, attrs, invert): self._check_feature( "differential input/output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: port.p.attrs["useioff"] = 1 port.n.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_bidir", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="TRUE", i_datain=self._get_oreg(m, pin, invert), io_dataio=port.p, io_dataio_b=port.n, o_dataout=self._get_ireg(m, pin, invert), i_oe=self._get_oereg(m, pin), ) return m
def get_diff_input_output(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential input/output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) if pin.xdr == 1: p_port.attrs["useioff"] = 1 n_port.attrs["useioff"] = 1 m = Module() m.submodules[pin.name] = Instance( "altiobuf_bidir", p_enable_bus_hold="FALSE", p_number_of_channels=pin.width, p_use_differential_mode="TRUE", i_datain=self._get_oreg(m, pin, invert), io_dataio=p_port, io_dataio_b=n_port, o_dataout=self._get_ireg(m, pin, invert), i_oe=self._get_oereg(m, pin), ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_input(self, pin, port, attrs, invert): self._check_feature( "single-ended input", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IB", i_I=port.io[bit], o_O=i[bit] ) return m
def get_input(self, pin, port, attrs, invert): self._check_feature( "single-ended input", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IB", i_I=port[bit], o_O=i[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_output(self, pin, port, attrs, invert): self._check_feature( "single-ended output", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OB", i_I=o[bit], o_O=port.io[bit] ) return m
def get_output(self, pin, port, attrs, invert): self._check_feature( "single-ended output", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OB", i_I=o[bit], o_O=port[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_tristate(self, pin, port, attrs, invert): self._check_feature( "single-ended tristate", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True, ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBZ", i_T=t, i_I=o[bit], o_O=port.io[bit] ) return m
def get_tristate(self, pin, port, attrs, invert): self._check_feature( "single-ended tristate", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True, ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBZ", i_T=t, i_I=o[bit], o_O=port[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_input_output(self, pin, port, attrs, invert): self._check_feature( "single-ended input/output", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True, ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "BB", i_T=t, i_I=o[bit], o_O=i[bit], io_B=port.io[bit] ) return m
def get_input_output(self, pin, port, attrs, invert): self._check_feature( "single-ended input/output", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True, ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert, o_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "BB", i_T=t, i_I=o[bit], o_O=i[bit], io_B=port[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_input(self, pin, port, attrs, invert): self._check_feature( "differential input", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IB", i_I=port.p[bit], o_O=i[bit] ) return m
def get_diff_input(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential input", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert) for bit in range(len(p_port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IB", i_I=p_port[bit], o_O=i[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_output(self, pin, port, attrs, invert): self._check_feature( "differential output", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OB", i_I=o[bit], o_O=port.p[bit], ) return m
def get_diff_output(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential output", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(p_port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OB", i_I=o[bit], o_O=p_port[bit], ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_tristate(self, pin, port, attrs, invert): self._check_feature( "differential tristate", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True, ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBZ", i_T=t, i_I=o[bit], o_O=port.p[bit], ) return m
def get_diff_tristate(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential tristate", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True, ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(p_port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBZ", i_T=t, i_I=o[bit], o_O=p_port[bit], ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_input_output(self, pin, port, attrs, invert): self._check_feature( "differential input/output", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True, ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "BB", i_T=t, i_I=o[bit], o_O=i[bit], io_B=port.p[bit], ) return m
def get_diff_input_output(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential input/output", pin, attrs, valid_xdrs=(0, 1, 2, 4, 7), valid_attrs=True, ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert, o_invert=invert) for bit in range(len(p_port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "BB", i_T=t, i_I=o[bit], o_O=i[bit], io_B=p_port[bit], ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_input(self, pin, port, attrs, invert): self._check_feature( "single-ended input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() self._get_io_buffer(m, pin, port.io, attrs, i_invert=invert) return m
def get_input(self, pin, port, attrs, invert): self._check_feature( "single-ended input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() self._get_io_buffer(m, pin, port, attrs, i_invert=invert) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_output(self, pin, port, attrs, invert): self._check_feature( "single-ended output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() self._get_io_buffer(m, pin, port.io, attrs, o_invert=invert) return m
def get_output(self, pin, port, attrs, invert): self._check_feature( "single-ended output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() self._get_io_buffer(m, pin, port, attrs, o_invert=invert) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_tristate(self, pin, port, attrs, invert): self._check_feature( "single-ended tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() self._get_io_buffer(m, pin, port.io, attrs, o_invert=invert) return m
def get_tristate(self, pin, port, attrs, invert): self._check_feature( "single-ended tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() self._get_io_buffer(m, pin, port, attrs, o_invert=invert) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_input_output(self, pin, port, attrs, invert): self._check_feature( "single-ended input/output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() self._get_io_buffer(m, pin, port.io, attrs, i_invert=invert, o_invert=invert) return m
def get_input_output(self, pin, port, attrs, invert): self._check_feature( "single-ended input/output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() self._get_io_buffer(m, pin, port, attrs, i_invert=invert, o_invert=invert) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_input(self, pin, port, attrs, invert): self._check_feature( "differential input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() # See comment in should_skip_port_component above. self._get_io_buffer(m, pin, port.p, attrs, i_invert=invert) return m
def get_diff_input(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() # See comment in should_skip_port_component above. self._get_io_buffer(m, pin, p_port, attrs, i_invert=invert) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_output(self, pin, port, attrs, invert): self._check_feature( "differential output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() # Note that the non-inverting output pin is not driven the same way as a regular # output pin. The inverter introduces a delay, so for a non-inverting output pin, # an identical delay is introduced by instantiating a LUT. This makes the waveform # perfectly symmetric in the xdr=0 case. self._get_io_buffer(m, pin, port.p, attrs, o_invert=invert, invert_lut=True) self._get_io_buffer(m, pin, port.n, attrs, o_invert=not invert, invert_lut=True) return m
def get_diff_output(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() # Note that the non-inverting output pin is not driven the same way as a regular # output pin. The inverter introduces a delay, so for a non-inverting output pin, # an identical delay is introduced by instantiating a LUT. This makes the waveform # perfectly symmetric in the xdr=0 case. self._get_io_buffer(m, pin, p_port, attrs, o_invert=invert, invert_lut=True) self._get_io_buffer(m, pin, n_port, attrs, o_invert=not invert, invert_lut=True) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_input(self, pin, port, attrs, invert): self._check_feature( "single-ended input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IB", i_I=port.io[bit], o_O=i[bit] ) return m
def get_input(self, pin, port, attrs, invert): self._check_feature( "single-ended input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IB", i_I=port[bit], o_O=i[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_output(self, pin, port, attrs, invert): self._check_feature( "single-ended output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OB", i_I=o[bit], o_O=port.io[bit] ) return m
def get_output(self, pin, port, attrs, invert): self._check_feature( "single-ended output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OB", i_I=o[bit], o_O=port[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_tristate(self, pin, port, attrs, invert): self._check_feature( "single-ended tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBZ", i_T=t, i_I=o[bit], o_O=port.io[bit] ) return m
def get_tristate(self, pin, port, attrs, invert): self._check_feature( "single-ended tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBZ", i_T=t, i_I=o[bit], o_O=port[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_input_output(self, pin, port, attrs, invert): self._check_feature( "single-ended input/output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert, o_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "BB", i_T=t, i_I=o[bit], o_O=i[bit], io_B=port.io[bit] ) return m
def get_input_output(self, pin, port, attrs, invert): self._check_feature( "single-ended input/output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert, o_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "BB", i_T=t, i_I=o[bit], o_O=i[bit], io_B=port[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_input(self, pin, port, attrs, invert): self._check_feature( "differential input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IB", i_I=port.p[bit], o_O=i[bit] ) return m
def get_diff_input(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert) for bit in range(len(p_port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IB", i_I=p_port[bit], o_O=i[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_output(self, pin, port, attrs, invert): self._check_feature( "differential output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OB", i_I=o[bit], o_O=port.p[bit], ) return m
def get_diff_output(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(p_port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OB", i_I=o[bit], o_O=p_port[bit], ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_tristate(self, pin, port, attrs, invert): self._check_feature( "differential tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBZ", i_T=t, i_I=o[bit], o_O=port.p[bit], ) return m
def get_diff_tristate(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(p_port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBZ", i_T=t, i_I=o[bit], o_O=p_port[bit], ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_input_output(self, pin, port, attrs, invert): self._check_feature( "differential input/output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "BB", i_T=t, i_I=o[bit], o_O=i[bit], io_B=port.p[bit], ) return m
def get_diff_input_output(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential input/output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert, o_invert=invert) for bit in range(len(p_port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "BB", i_T=t, i_I=o[bit], o_O=i[bit], io_B=p_port[bit], ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_input(self, pin, port, attrs, invert): self._check_feature( "single-ended input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IBUF", i_I=port.io[bit], o_O=i[bit] ) return m
def get_input(self, pin, port, attrs, invert): self._check_feature( "single-ended input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IBUF", i_I=port[bit], o_O=i[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_output(self, pin, port, attrs, invert): self._check_feature( "single-ended output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBUF", i_I=o[bit], o_O=port.io[bit] ) return m
def get_output(self, pin, port, attrs, invert): self._check_feature( "single-ended output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBUF", i_I=o[bit], o_O=port[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_tristate(self, pin, port, attrs, invert): self._check_feature( "single-ended tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBUFT", i_T=t, i_I=o[bit], o_O=port.io[bit] ) return m
def get_tristate(self, pin, port, attrs, invert): self._check_feature( "single-ended tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBUFT", i_T=t, i_I=o[bit], o_O=port[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_input_output(self, pin, port, attrs, invert): self._check_feature( "single-ended input/output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IOBUF", i_T=t, i_I=o[bit], o_O=i[bit], io_IO=port.io[bit] ) return m
def get_input_output(self, pin, port, attrs, invert): self._check_feature( "single-ended input/output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert, o_invert=invert) for bit in range(len(port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IOBUF", i_T=t, i_I=o[bit], o_O=i[bit], io_IO=port[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_input(self, pin, port, attrs, invert): self._check_feature( "differential input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IBUFDS", i_I=port.p[bit], i_IB=port.n[bit], o_O=i[bit] ) return m
def get_diff_input(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential input", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, i_invert=invert) for bit in range(len(p_port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "IBUFDS", i_I=p_port[bit], i_IB=n_port[bit], o_O=i[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_output(self, pin, port, attrs, invert): self._check_feature( "differential output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBUFDS", i_I=o[bit], o_O=port.p[bit], o_OB=port.n[bit] ) return m
def get_diff_output(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential output", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(p_port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBUFDS", i_I=o[bit], o_O=p_port[bit], o_OB=n_port[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError
def get_diff_tristate(self, pin, port, attrs, invert): self._check_feature( "differential tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(pin.width): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBUFTDS", i_T=t, i_I=o[bit], o_O=port.p[bit], o_OB=port.n[bit] ) return m
def get_diff_tristate(self, pin, p_port, n_port, attrs, invert): self._check_feature( "differential tristate", pin, attrs, valid_xdrs=(0, 1, 2), valid_attrs=True ) m = Module() i, o, t = self._get_xdr_buffer(m, pin, o_invert=invert) for bit in range(len(p_port)): m.submodules["{}_{}".format(pin.name, bit)] = Instance( "OBUFTDS", i_T=t, i_I=o[bit], o_O=p_port[bit], o_OB=n_port[bit] ) return m
https://github.com/nmigen/nmigen/issues/456
ERROR: IO 'ddr3_0__dqs__n[0]' is unconstrained in LPF (override this error with --lpf-allow-unconstrained) 0 warnings, 1 error Traceback (most recent call last): File "diffpairissue.py", line 20, in <module> ECPIX585Platform().build(Top(), do_program=True) File "/home/jeanthomas/Documents/nmigen/nmigen/build/plat.py", line 94, in build products = plan.execute_local(build_dir) File "/home/jeanthomas/Documents/nmigen/nmigen/build/run.py", line 95, in execute_local subprocess.check_call(["sh", "{}.sh".format(self.script)]) File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sh', 'build_top.sh']' returned non-zero exit status 255.
subprocess.CalledProcessError