Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct splitext() description, and example #74377

Merged
merged 1 commit into from
Apr 22, 2021
Merged

Conversation

moreati
Copy link
Contributor

@moreati moreati commented Apr 22, 2021

SUMMARY

splitext() returns a 2-tuple of strings, and the last element of the return value includes the .

ISSUE TYPE
  • Docs Pull Request

+label: docsite_pr

$ v/bin/ansible localhost -mdebug -a msg="{{ 'foo.bar' | splitext }}"
localhost | SUCCESS => {
    "msg": "('foo', '.bar')"
}
$  v/bin/ansible --version
ansible 2.10.8
  config file = /home/alex/.ansible.cfg
  configured module search path = ['/home/alex/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/alex/src/ansible-jq-filter/v/lib/python3.8/site-packages/ansible
  executable location = v/bin/ansible
  python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
SUMMARY
ISSUE TYPE
  • Bugfix Pull Request
  • Docs Pull Request
  • Feature Pull Request
  • Test Pull Request
COMPONENT NAME
ADDITIONAL INFORMATION

##### SUMMARY
`splitext()` returns a 2-tuple of strings, and the last element of the return value includes the `.`

##### ISSUE TYPE
- Docs Pull Request

+label: docsite_pr

```
$ v/bin/ansible localhost -mdebug -a msg="{{ 'foo.bar' | splitext }}"
localhost | SUCCESS => {
    "msg": "('foo', '.bar')"
}
$  v/bin/ansible --version
ansible 2.10.8
  config file = /home/alex/.ansible.cfg
  configured module search path = ['/home/alex/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/alex/src/ansible-jq-filter/v/lib/python3.8/site-packages/ansible
  executable location = v/bin/ansible
  python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
```
@ansibot ansibot added affects_2.12 core_review In order to be merged, this PR must follow the core review workflow. docs This issue/PR relates to or includes documentation. docs_only All changes are to files within the docs/docsite/ directory needs_triage Needs a first human triage before being processed. small_patch support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Apr 22, 2021
@Akasurde Akasurde self-assigned this Apr 22, 2021
@bcoca bcoca added P3 Priority 3 - Approved, No Time Limitation and removed needs_triage Needs a first human triage before being processed. labels Apr 22, 2021
@acozine
Copy link
Contributor

acozine commented Apr 22, 2021

This behavior might be different in Python3 and Python2.

@samdoran
Copy link
Contributor

I just verified this on Python 2.7.18 and 3.9.4. The behavior is the same.

In [57]: path = '/some/path/with/a/file.txt'

In [58]: os.path.splitext(path)
Out[58]: ('/some/path/with/a/file', '.txt')

The suggested changes are correct.

@acozine
Copy link
Contributor

acozine commented Apr 22, 2021

Thanks @moreati for the PR. Thanks @samdoran for the testing/review.

@acozine acozine merged commit c295de6 into ansible:devel Apr 22, 2021
acozine pushed a commit to acozine/ansible that referenced this pull request Apr 28, 2021
`splitext()` returns a 2-tuple of strings, and the last element of the return value includes the `.`

(cherry picked from commit c295de6)
@acozine acozine mentioned this pull request Apr 28, 2021
acozine added a commit that referenced this pull request Apr 28, 2021
* Add description for COLLECTIONS_SCAN_SYS_PATH (#74351)

Fixes: #74275

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 567361b)

* lighten navigation background to make section labels easier to read for core docs (#74356)

* make section labels for /ansible-core/ docs easier to read, with black text and lighter gray background

(cherry picked from commit 6119fb0)

* Correct splitext() description, and example (#74377)

`splitext()` returns a 2-tuple of strings, and the last element of the return value includes the `.`

(cherry picked from commit c295de6)

* Using "~" instead of "+" for concatination (#74364)

Changed FAQ examples to conform with the Jinja documentation:
If both values on either side of a plus/+ are numbers, they will be added whereas using "~" will convert all operands into strings and then concatenate them. Closes #73799.

(cherry picked from commit e6a5245)

* Docs - Split Developing collections page, add info on optional module_utils (#74105)

*

(cherry picked from commit c90922e)

* Add weos4 network platform to documentation (#74088)

* Add weos4 network platform to documentation

* Fix small format issues

(cherry picked from commit 7ca5ded)

* Fix typo in Makefile (#74396)

Fixed minor typo specfic -> specific

(cherry picked from commit 4880fee)

* Update complex_data_manipulation.rst (#72509)

(cherry picked from commit c2985c4)

* Update VMware library installation docs (#71219)

Depending upon OS/distro, please use pip/pip3.

(cherry picked from commit ddfc648)

* Update AWS dev guides to use collections utils and fragments (#72312)

(cherry picked from commit cf08c23)

* Use is_boto3_error_code in 'standard' example (#72313)

Use is_boto3_error_code in 'standard' example rather than e.response['Error']['Code'] (#72313)

Co-authored-by: Sloane Hertel <shertel@redhat.com>
(cherry picked from commit 63afb33)

* Update Kubernetes collection name in docs (#74440)

(cherry picked from commit 8d499bb)

* Update argcomplete docs links on installation guide (#74410)

Link on installation docs is outdated. Switch to currently docs at: https://kislyuk.github.io/argcomplete/

(cherry picked from commit f97787c)

* fix spacing to fix header, reorg contributing page (#74421)

Co-authored-by: John R Barker <john@johnrbarker.com>
(cherry picked from commit 9d9b08b)

* Update first_found documentation (#70502)

* import_tasks do not work with loop, use use include_tasks instead
* update documentation

(cherry picked from commit bacede7)

* Product-related updates. (#74454)

(cherry picked from commit 34c9ed8)

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Sandra McCann <samccann@redhat.com>
Co-authored-by: Alex Willmer <alex@moreati.org.uk>
Co-authored-by: Hublerho <43293510+Hublerho@users.noreply.github.com>
Co-authored-by: Ernst Oudhof <17832702+ernst-s@users.noreply.github.com>
Co-authored-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
Co-authored-by: dhx-mike-palandra <45608336+dhx-mike-palandra@users.noreply.github.com>
Co-authored-by: jakelevinez <31458570+jakelevinez@users.noreply.github.com>
Co-authored-by: Mark Chappell <mchappel@redhat.com>
Co-authored-by: Lidiane Taquehara <lidi.mayra@gmail.com>
Co-authored-by: Alex Domoradov <alex.hha@gmail.com>
Co-authored-by: Bill Nottingham <notting@redhat.com>
@ansible ansible locked and limited conversation to collaborators May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.12 core_review In order to be merged, this PR must follow the core review workflow. docs_only All changes are to files within the docs/docsite/ directory docs This issue/PR relates to or includes documentation. P3 Priority 3 - Approved, No Time Limitation small_patch support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants