def find_release_resources():
 rx_release = '^\\[([\\w-]+\\.release-[\\w-]+)\\]$'
 with open('.tx/config') as tx_config:
  resources = re.findall(rx_release, tx_config.read(), re.MULTILINE)
 if (len(resources) == 2):
  return resources
 if (len(resources) == 0):
  raise ValueError('You need two release-* resources defined to use this command.')
 else:
  msg = ('Strange Transifex config! Found these release-* resources:\n' + '\n'.join(resources))
  raise ValueError(msg)

def find_release_resources ( ) : rx_release = '^\\[([\\w-]+\\.release-[\\w-]+)\\]$' with open ( '.tx/config' ) as tx_config : resources = re . findall ( rx_release , tx_config . read ( ) , re . MULTILINE ) if ( len ( resources ) == 2 ) : return resources if ( len ( resources ) == 0 ) : raise ValueError ( 'You need two release-* resources defined to use this command.' ) else : msg = ( 'Strange Transifex config! Found these release-* resources:\n' + '\n' . join ( resources ) ) raise ValueError ( msg )
validate the .