Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • pystencils pystencils
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 18
    • Issues 18
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pycodegen
  • pystencilspystencils
  • Merge requests
  • !177

Fix: shift_slice to accept single slices as argument, and return tuples

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Frederik Hennig requested to merge da15siwa/pystencils:fix_slicing into master Oct 06, 2020
  • Overview 0
  • Commits 2
  • Pipelines 1
  • Changes 2

Two fixes to pystencils.slicing.shift_slice:

  • Previously, shift_slice assumed its argument slices to be iterable. Thus, it did not accept single slices as arguments. There are use cases, though, where it is necessary to shift a plain slice object, or even int or float objects which can also be seen as slices. An additional isinstance check takes care of this.
  • Previously, shift_slice returned lists of slices. By default, Python wraps multidimensional slices as tuples. Code for manipulating multidimensional slices thus expects them to be given as tuples. Also, although it is currently possible to access numpy arrays with lists of slices instead of tuples, this action produces a deprecation warning. Thus, shift_slice is changed to return tuples.

An additional test case evaluating array accesses with shifted slices is also added.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix_slicing