Coverage for python/lsst/daf/butler/cli/opt/optionGroups.py: 93%

Shortcuts on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

17 statements  

1# This file is part of ctrl_mpexec. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (https://www.lsst.org). 

6# See the COPYRIGHT file at the top-level directory of this distribution 

7# for details of code ownership. 

8# 

9# This program is free software: you can redistribute it and/or modify 

10# it under the terms of the GNU General Public License as published by 

11# the Free Software Foundation, either version 3 of the License, or 

12# (at your option) any later version. 

13# 

14# This program is distributed in the hope that it will be useful, 

15# but WITHOUT ANY WARRANTY; without even the implied warranty of 

16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

17# GNU General Public License for more details. 

18# 

19# You should have received a copy of the GNU General Public License 

20# along with this program. If not, see <http://www.gnu.org/licenses/>. 

21 

22import click 

23 

24from ..utils import OptionGroup, unwrap, where_help 

25from .arguments import glob_argument, repo_argument 

26from .options import collections_option, dataset_type_option, where_option 

27 

28 

29class query_datasets_options(OptionGroup): # noqa: N801 

30 def __init__(self, repo=True, showUri=True, useArguments=True): 

31 self.decorators = [] 

32 if repo: 

33 if not useArguments: 33 ↛ 34line 33 didn't jump to line 34, because the condition on line 33 was never true

34 raise RuntimeError("repo as an option is not currently supported.") 

35 self.decorators.append(repo_argument(required=True)) 

36 if useArguments: 

37 self.decorators.append( 

38 glob_argument( 

39 help=unwrap( 

40 """GLOB is one or more glob-style expressions that fully or partially identify the 

41 dataset type names to be queried.""" 

42 ) 

43 ) 

44 ) 

45 else: 

46 self.decorators.append( 

47 dataset_type_option( 

48 help=unwrap( 

49 """One or more glob-style expressions that fully or partially identify the dataset 

50 type names to be queried.""" 

51 ) 

52 ) 

53 ) 

54 self.decorators.extend( 

55 [ 

56 collections_option(), 

57 where_option(help=where_help), 

58 click.option( 

59 "--find-first", 

60 is_flag=True, 

61 help=unwrap( 

62 """For each result data ID, only yield one DatasetRef of each 

63 DatasetType, from the first collection in which a dataset of that dataset 

64 type appears (according to the order of 'collections' passed in). If 

65 used, 'collections' must specify at least one expression and must not 

66 contain wildcards.""" 

67 ), 

68 ), 

69 ] 

70 ) 

71 if showUri: 

72 self.decorators.append( 

73 click.option("--show-uri", is_flag=True, help="Show the dataset URI in results.") 

74 )