class_docstr: Nested annotation structure.
  
  >>> bar = hl.Struct(**{'foo': 5, '1kg': 10})
  
  Struct elements are treated as both 'items' and 'attributes', which
  allows either syntax for accessing the element "foo" of struct "bar":
  
  >>> bar.foo
  >>> bar['foo']
  
  Field names that are not valid Python identifiers, such as fields that
  start with numbers or contain spaces, must be accessed with the latter
  syntax:
  
  >>> bar['1kg']
  
  The ``pprint`` module can be used to print nested Structs in a more
  human-readable fashion:
  
  >>> from pprint import pprint
  >>> pprint(bar)
  
  Parameters
  ----------
  attributes
      Field names and values.
  
  Note
  ----
  This object refers to the Python value returned by taking or collecting
  Hail expressions, e.g. ``mt.info.take(5)``. This is rare; it is much
  more common to manipulate the :class:`.StructExpression` object, which is
  constructed using the :func:`.struct` function.
class_docstr_tok: ["Nested","annotation","structure",".",">",">",">","bar","=","hl.Struct","(","*","*","{","'foo","'",":","5",",","'1kg","'",":","10","}",")","Struct","elements","are","treated","as","both","'items","'","and","'attributes","'",",","which","allows","either","syntax","for","accessing","the","element","``","foo","''","of","struct","``","bar","''",":",">",">",">","bar.foo",">",">",">","bar","[","'foo","'","]","Field","names","that","are","not","valid","Python","identifiers",",","such","as","fields","that","start","with","numbers","or","contain","spaces",",","must","be","accessed","with","the","latter","syntax",":",">",">",">","bar","[","'1kg","'","]","The","``","pprint","``","module","can","be","used","to","print","nested","Structs","in","a","more","human-readable","fashion",":",">",">",">","from","pprint","import","pprint",">",">",">","pprint","(","bar",")","Parameters","--","--","--","--","--","attributes","Field","names","and","values",".","Note","--","--","This","object","refers","to","the","Python","value","returned","by","taking","or","collecting","Hail","expressions",",","e.g",".","``","mt.info.take","(","5",")","``",".","This","is","rare",";","it","is","much","more","common","to","manipulate","the",":","class",":","`",".StructExpression","`","object",",","which","is","constructed","using","the",":","func",":","`",".struct","`","function","."]
docstr: Select existing fields and compute new ones.
  
  Notes
  -----
  The `fields` argument is a list of field names to keep. These fields
  will appear in the resulting struct in the order they appear in
  `fields`.
  
  The `kwargs` arguments are new fields to add.
  
  Parameters
  ----------
  fields : varargs of :class:`str`
      Field names to keep.
  named_exprs : keyword args
      New field.
  
  Returns
  -------
  :class:`.Struct`
      Struct containing specified existing fields and computed fields.
  
  Examples
  --------
  Define a Struct 's'
  
  >>> s = hl.Struct(foo=5, apple=10)
  
  Keep just one original field
  
  >>> s.select('foo')
  Struct(foo=5)
  
  Add one new field and keeps one old field
  
  >>> s.select('apple', bar=123)
  Struct(apple=10, bar=123)
  
  Adds two new fields and replaces old fields
  
  >>> s.select(bar=123, banana=1)
  Struct(bar=123, banana=1)
docstr_tok: ["Select","existing","fields","and","compute","new","ones",".","Notes","--","--","-","The","`","fields","`","argument","is","a","list","of","field","names","to","keep",".","These","fields","will","appear","in","the","resulting","struct","in","the","order","they","appear","in","`","fields","`",".","The","`","kwargs","`","arguments","are","new","fields","to","add",".","Parameters","--","--","--","--","--","fields",":","varargs","of",":","class",":","`","str","`","Field","names","to","keep",".","named_exprs",":","keyword","args","New","field",".","Returns","--","--","--","-",":","class",":","`",".Struct","`","Struct","containing","specified","existing","fields","and","computed","fields",".","Examples","--","--","--","--","Define","a","Struct","'s'",">",">",">","s","=","hl.Struct","(","foo=5",",","apple=10",")","Keep","just","one","original","field",">",">",">","s.select","(","'foo","'",")","Struct","(","foo=5",")","Add","one","new","field","and","keeps","one","old","field",">",">",">","s.select","(","'apple","'",",","bar=123",")","Struct","(","apple=10",",","bar=123",")","Adds","two","new","fields","and","replaces","old","fields",">",">",">","s.select","(","bar=123",",","banana=1",")","Struct","(","bar=123",",","banana=1",")"]
code: def select(self, *fields, **kwargs):
      """Select existing fields and compute new ones.
  
      Notes
      -----
      The `fields` argument is a list of field names to keep. These fields
      will appear in the resulting struct in the order they appear in
      `fields`.
  
      The `kwargs` arguments are new fields to add.
  
      Parameters
      ----------
      fields : varargs of :class:`str`
          Field names to keep.
      named_exprs : keyword args
          New field.
  
      Returns
      -------
      :class:`.Struct`
          Struct containing specified existing fields and computed fields.
  
      Examples
      --------
      Define a Struct 's'
  
      >>> s = hl.Struct(foo=5, apple=10)
  
      Keep just one original field
  
      >>> s.select('foo')
      Struct(foo=5)
  
      Add one new field and keeps one old field
  
      >>> s.select('apple', bar=123)
      Struct(apple=10, bar=123)
  
      Adds two new fields and replaces old fields
  
      >>> s.select(bar=123, banana=1)
      Struct(bar=123, banana=1)
  
      """
      d = OrderedDict()
      for a in fields:
          d[a] = self[a]
      for k, v in kwargs.items():
          if k in d:
              raise ValueError(
                  "Cannot select and assign field '{}' in the same statement".format(
                      k
                  )
              )
          d[k] = v
      return Struct(**d)
  
imports: from typing import Dict, Any
  from collections import OrderedDict
  from collections.abc import Mapping
  import pprint
  from hail.utils.misc import get_nice_attr_error, get_nice_field_error
  from hail.typecheck import typecheck, typecheck_method, anytype
label_desc: Use image node_id 17 for calling the Struct obj's underlying member method code with example usage: obj.select() and returns: Struct