Page MenuHomeSoftware Heritage
Paste P1293

bzr launchpad fun
ActivePublic

Authored by ardumont on Feb 16 2022, 4:14 PM.
ipython
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.27.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: launchpad = Launchpad.login_anonymously(
...: "softwareheritage", "production", version="devel"
...: )
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-32a91008cb67> in <module>
----> 1 launchpad = Launchpad.login_anonymously(
2 "softwareheritage", "production", version="devel"
3 )
NameError: name 'Launchpad' is not defined
In [2]: from launchpadlib.launchpad import Launchpad
In [3]: launchpad = Launchpad.login_anonymously(
...: "softwareheritage", "production", version="devel"
...: )
In [4]: get_bzr_repos = launchpad.branches.getBranches
In [5]: bzr_repos = get_bzr_repos(
...: order_by="most neglected first", modified_since_date=date_last_modified
...: )
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-5-bc9cef964f45> in <module>
1 bzr_repos = get_bzr_repos(
----> 2 order_by="most neglected first", modified_since_date=date_last_modified
3 )
NameError: name 'date_last_modified' is not defined
In [6]: from datetime import datetime, timedelta, timezone
In [7]: datetime.now(tz=timezone.utc)
Out[7]: datetime.datetime(2022, 2, 16, 14, 58, 34, 222132, tzinfo=datetime.timezone.utc)
In [8]: date_now = datetime.now(tz=timezone.utc) - timedelta(days=7)
In [9]: bzr_repos = get_bzr_repos(
...: order_by="most neglected first", modified_since_date=date_now
...: )
In [10]:
In [10]: next(bzr_repos)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-10-4c39bcada9b0> in <module>
----> 1 next(bzr_repos)
TypeError: 'Collection' object is not an iterator
In [11]: page_bzr = [r for r in bzr_repos]
In [12]: page_bzr[0]
Out[12]: <branch at https://api.launchpad.net/devel/~rosivaldo-fa/set-theory/incremental>
In [13]: page_bzr[1]
Out[13]: <branch at https://api.launchpad.net/devel/~roadmr/codetree/update-charmstore-api-usage>
In [14]: bzr2 = page_bzr[2]
In [15]: bzr2
Out[15]: <branch at https://api.launchpad.net/devel/~codetree-maintainers/codetree/trunk>
In [16]: bzr2.lp_attributes
Out[16]:
['self_link',
'web_link',
'resource_type_link',
'http_etag',
'branch_format',
'branch_type',
'bzr_identity',
'control_format',
'date_created',
'date_last_modified',
'description',
'display_name',
'explicitly_private',
'information_type',
'last_mirror_attempt',
'last_mirrored',
'last_scanned',
'last_scanned_id',
'lifecycle_status',
'mirror_status_message',
'name',
'private',
'repository_format',
'revision_count',
'unique_name',
'url',
'whiteboard']
In [17]: bzr2.bzr_identity
Out[17]: 'lp:codetree'
In [18]: bzr2.branch_type
Out[18]: 'Hosted'
In [19]: bzr2.branch_format
Out[19]: 'Bazaar Branch Format 7 (needs bzr 1.6)\n'
In [20]: bzr2.information_type
Out[20]: 'Public'
In [21]: bzr2.description
In [22]: bzr2.control_format
Out[22]: 'Bazaar-NG meta directory, format 1\n'
In [23]: date_last_modified = date_now
In [24]: date_last_modified
Out[24]: datetime.datetime(2022, 2, 9, 14, 58, 44, 902111, tzinfo=datetime.timezone.utc)
In [25]: get_git_repos = launchpad.git_repositories.getRepositories
In [26]: git_repost = get_git_repos(
...: order_by="most neglected first", modified_since_date=date_last_modified
...: )
In [27]: git_repos = git_repost
In [28]: page_git = [r for r in git_repos]
In [29]: git0 = page_git[0]
In [30]: git0.FIND_ATTRIBUTES
Out[30]: <object at 0x7f21ce491740>
In [31]: git0.lp_attributes
Out[31]:
['self_link',
'web_link',
'resource_type_link',
'http_etag',
'date_created',
'date_last_modified',
'date_last_repacked',
'date_last_scanned',
'default_branch',
'description',
'display_name',
'git_https_url',
'git_identity',
'git_ssh_url',
'id',
'information_type',
'loose_object_count',
'name',
'owner_default',
'pack_count',
'private',
'repository_type',
'target_default',
'unique_name']
In [32]: git0.git_identity
Out[32]: 'lp:~mattig-schauer/+git/yq'
In [33]: git0.git_https_url
Out[33]: 'https://git.launchpad.net/~mattig-schauer/+git/yq'
In [34]: bzr0 = page_bzr[0]
In [35]: bzr0
Out[35]: <branch at https://api.launchpad.net/devel/~rosivaldo-fa/set-theory/incremental>
In [36]: bzr0.lp_collections
Out[36]:
['dependent_branches',
'landing_candidates',
'landing_targets',
'linked_bugs',
'recipes',
'spec_links',
'subscribers',
'subscriptions',
'webhooks']
In [37]: bzr0.lp_entries
Out[37]: ['code_import', 'owner', 'project', 'registrant', 'reviewer', 'sourcepackage']
In [38]: bzr0.lp_attributes
Out[38]:
['self_link',
'web_link',
'resource_type_link',
'http_etag',
'branch_format',
'branch_type',
'bzr_identity',
'control_format',
'date_created',
'date_last_modified',
'description',
'display_name',
'explicitly_private',
'information_type',
'last_mirror_attempt',
'last_mirrored',
'last_scanned',
'last_scanned_id',
'lifecycle_status',
'mirror_status_message',
'name',
'private',
'repository_format',
'revision_count',
'unique_name',
'url',
'whiteboard']
In [39]: bzr0.url
In [40]: bzr0.bzr_identity
Out[40]: 'lp:set-theory'
In [41]: bzr0
Out[41]: <branch at https://api.launchpad.net/devel/~rosivaldo-fa/set-theory/incremental>
In [42]: bzr0.web_link
Out[42]: 'https://code.launchpad.net/~rosivaldo-fa/set-theory/incremental'
In [43]: bzr0.date_last_modified
Out[43]: datetime.datetime(2022, 2, 9, 15, 16, 4, 274000, tzinfo=TimeZone(0))