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

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

16 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 . import ( 

25 collections_option, 

26 dataset_type_option, 

27 glob_argument, 

28 repo_argument, 

29 where_option, 

30) 

31from ..utils import OptionGroup, unwrap, where_help 

32 

33 

34class query_datasets_options(OptionGroup): # noqa: N801 

35 

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

37 self.decorators = [] 

38 if repo: 

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

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

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

42 if useArguments: 

43 self.decorators.append(glob_argument( 

44 help=unwrap("""GLOB is one or more glob-style expressions that fully or partially identify the 

45 dataset type names to be queried."""))) 

46 else: 

47 self.decorators.append(dataset_type_option( 

48 help=unwrap("""One or more glob-style expressions that fully or partially identify the dataset 

49 type names to be queried."""))) 

50 self.decorators.extend([ 

51 collections_option(), 

52 where_option(help=where_help), 

53 click.option("--find-first", 

54 is_flag=True, 

55 help=unwrap("""For each result data ID, only yield one DatasetRef of each 

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

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

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

59 contain wildcards."""))]) 

60 if showUri: 

61 self.decorators.append(click.option("--show-uri", 

62 is_flag=True, 

63 help="Show the dataset URI in results."))