Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joseph Weston
kwant
Commits
973338d3
Commit
973338d3
authored
11 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
fix quotes in a docstring
parent
b108491c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kwant/builder.py
+17
-8
17 additions, 8 deletions
kwant/builder.py
with
17 additions
and
8 deletions
kwant/builder.py
+
17
−
8
View file @
973338d3
...
...
@@ -563,10 +563,10 @@ class Builder(object):
tags which are sequences of integers. It *makes sense* only when these
sites live on a regular lattice, like the ones provided by `kwant.lattice`.
`builder0 += builder1` adds all the sites, hoppings, and leads of
`builder1`
to `builder0`. Sites and hoppings present in both systems
are overwritten
by those in `builder1`. The leads of `builder1` are
appended to the leads
of the system being extended.
`
`builder0 += builder1`
`
adds all the sites, hoppings, and leads of
``builder1``
to
`
`builder0`
`
. Sites and hoppings present in both systems
are overwritten
by those in
`
`builder1`
`
. The leads of
`
`builder1`
`
are
appended to the leads
of the system being extended.
.. warning::
...
...
@@ -677,9 +677,13 @@ class Builder(object):
"""
Expand a general (possibly fancy) key into an iterator over simple keys.
This method is used to expand the keys when getting or deleting items of
a builder (i.e. ``sys[key] = value`` or ``del sys[key]``).
Parameters
----------
key : builder key (see notes)
The key to be expanded
Notes
-----
Keys are (recursively):
* Simple keys: sites or 2-tuples of sites (=hoppings).
* Any (non-tuple) iterable of keys, e.g. a list or a generator
...
...
@@ -687,17 +691,22 @@ class Builder(object):
* Any function that returns a key when passed a builder as sole
argument, e.g. a `HoppingKind` instance or the function returned
by `~kwant.lattice.Polyatomic.shape`.
This method is internally used to expand the keys when getting or
deleting items of a builder (i.e. ``sys[key] = value`` or ``del
sys[key]``).
"""
itr
=
iter
((
key
,))
iter_stack
=
[
None
]
while
iter_stack
:
for
key
in
itr
:
while
callable
(
key
):
key
=
key
(
self
)
if
isinstance
(
key
,
Site
)
or
isinstance
(
key
,
tuple
):
yield
key
else
:
iter_stack
.
append
(
itr
)
if
callable
(
key
):
key
=
key
(
self
)
itr
=
iter
(
key
)
break
else
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment