parameters: ()
docstring: Verify and normalize ``disambiguation``.
  
  	``disambiguation`` is a map of ambiguous OpenType language system
  	tags to the particular BCP 47 tags they correspond to. This function
  	checks that all its keys really are ambiguous and that each key's
  	value is valid for that key. It checks that no ambiguous tag is
  	missing, except when it can figure out which BCP 47 tag is the best
  	by itself.
  
  	It modifies ``disambiguation`` to remove keys whose values are the
  	same as those that the fallback would return anyway, and to add
  	ambiguous keys whose disambiguations it determined automatically.
  
  	Raises:
  		AssertionError: Verification failed.
docstring_summary: Verify and normalize ``disambiguation``.
docstring_tokens: Verify and normalize disambiguation .
function: def verify_disambiguation_dict ():
  	"""Verify and normalize ``disambiguation``.
  
  	``disambiguation`` is a map of ambiguous OpenType language system
  	tags to the particular BCP 47 tags they correspond to. This function
  	checks that all its keys really are ambiguous and that each key's
  	value is valid for that key. It checks that no ambiguous tag is
  	missing, except when it can figure out which BCP 47 tag is the best
  	by itself.
  
  	It modifies ``disambiguation`` to remove keys whose values are the
  	same as those that the fallback would return anyway, and to add
  	ambiguous keys whose disambiguations it determined automatically.
  
  	Raises:
  		AssertionError: Verification failed.
  	"""
  	global bcp_47
  	global disambiguation
  	global ot
  	for ot_tag, bcp_47_tags in ot.to_bcp_47.items ():
  		primary_tags = list (t for t in bcp_47_tags if t not in bcp_47.grandfathered and ot.from_bcp_47.get (t)[0] == ot_tag)
  		if len (primary_tags) == 1:
  			expect (ot_tag not in disambiguation, 'unnecessary disambiguation for OT tag: %s' % ot_tag)
  			if '-' in primary_tags[0]:
  				disambiguation[ot_tag] = primary_tags[0]
  		elif len (primary_tags) == 0:
  			expect (ot_tag not in disambiguation, 'There is no possible valid disambiguation for %s' % ot_tag)
  		else:
  			macrolanguages = list (t for t in primary_tags if bcp_47.scopes.get (t) == ' [macrolanguage]')
  			if len (macrolanguages) != 1:
  				macrolanguages = list (t for t in primary_tags if bcp_47.scopes.get (t) == ' [family]')
  			if len (macrolanguages) != 1:
  				macrolanguages = list (t for t in primary_tags if 'retired code' not in bcp_47.scopes.get (t, ''))
  			if len (macrolanguages) != 1:
  				expect (ot_tag in disambiguation, 'ambiguous OT tag: %s %s' % (ot_tag, str (macrolanguages)))
  				expect (disambiguation[ot_tag] in bcp_47_tags,
  						'%s is not a valid disambiguation for %s' % (disambiguation[ot_tag], ot_tag))
  			elif ot_tag not in disambiguation:
  				disambiguation[ot_tag] = macrolanguages[0]
  			different_primary_tags = sorted (t for t in primary_tags if not same_tag (t, ot.from_bcp_47.get (t)))
  			if different_primary_tags and disambiguation[ot_tag] == different_primary_tags[0] and '-' not in disambiguation[ot_tag]:
  				del disambiguation[ot_tag]
  	for ot_tag in disambiguation.keys ():
  		expect (ot_tag in ot.to_bcp_47, 'unknown OT tag: %s' % ot_tag)
function_tokens: def verify_disambiguation_dict ( ) : global bcp_47 global disambiguation global ot for ot_tag , bcp_47_tags in ot . to_bcp_47 . items ( ) : primary_tags = list ( t for t in bcp_47_tags if t not in bcp_47 . grandfathered and ot . from_bcp_47 . get ( t ) [ 0 ] == ot_tag ) if len ( primary_tags ) == 1 : expect ( ot_tag not in disambiguation , 'unnecessary disambiguation for OT tag: %s' % ot_tag ) if '-' in primary_tags [ 0 ] : disambiguation [ ot_tag ] = primary_tags [ 0 ] elif len ( primary_tags ) == 0 : expect ( ot_tag not in disambiguation , 'There is no possible valid disambiguation for %s' % ot_tag ) else : macrolanguages = list ( t for t in primary_tags if bcp_47 . scopes . get ( t ) == ' [macrolanguage]' ) if len ( macrolanguages ) != 1 : macrolanguages = list ( t for t in primary_tags if bcp_47 . scopes . get ( t ) == ' [family]' ) if len ( macrolanguages ) != 1 : macrolanguages = list ( t for t in primary_tags if 'retired code' not in bcp_47 . scopes . get ( t , '' ) ) if len ( macrolanguages ) != 1 : expect ( ot_tag in disambiguation , 'ambiguous OT tag: %s %s' % ( ot_tag , str ( macrolanguages ) ) ) expect ( disambiguation [ ot_tag ] in bcp_47_tags , '%s is not a valid disambiguation for %s' % ( disambiguation [ ot_tag ] , ot_tag ) ) elif ot_tag not in disambiguation : disambiguation [ ot_tag ] = macrolanguages [ 0 ] different_primary_tags = sorted ( t for t in primary_tags if not same_tag ( t , ot . from_bcp_47 . get ( t ) ) ) if different_primary_tags and disambiguation [ ot_tag ] == different_primary_tags [ 0 ] and '-' not in disambiguation [ ot_tag ] : del disambiguation [ ot_tag ] for ot_tag in disambiguation . keys ( ) : expect ( ot_tag in ot . to_bcp_47 , 'unknown OT tag: %s' % ot_tag )