parameters: (argv)
return_statement: return 0
docstring: Get the directory from argv, build a list of sgfs found under the
      directory, extract the pairings, compute the ratings, print them out
docstring_summary: Get the directory from argv, build a list of sgfs found under the
      directory, extract the pairings, compute the ratings, print them out
docstring_tokens: Get the directory from argv build a list of sgfs found under the directory extract the pairings compute the ratings print them out
function: def main(argv):
      """Get the directory from argv, build a list of sgfs found under the
      directory, extract the pairings, compute the ratings, print them out"""
      if len(argv) < 2:
          print("Usage: rate_subdir.py <directory of sgfs to rate>")
          return 1
      sgfs = []
      for root, _, filenames in os.walk(argv[1]):
          for filename in fnmatch.filter(filenames, '*.sgf'):
              sgfs.append(os.path.join(root, filename))
  
      if not sgfs:
          print("No SGFs found in", argv)
          return 1
  
      print("Found {} sgfs".format(len(sgfs)))
      ids, results = extract_pairwise(sgfs)
      if not results:
          for m in sgfs:
              print(m)
          print("No SGFs with valid results were found")
          return 1
      rs = math_ratings.compute_ratings(results)
  
      fancyprint_ratings(ids, rs, results)
      return 0
function_tokens: def main ( argv ) : if len ( argv ) < 2 : print ( "Usage: rate_subdir.py <directory of sgfs to rate>" ) return 1 sgfs = [ ] for root , _ , filenames in os . walk ( argv [ 1 ] ) : for filename in fnmatch . filter ( filenames , '*.sgf' ) : sgfs . append ( os . path . join ( root , filename ) ) if not sgfs : print ( "No SGFs found in" , argv ) return 1 print ( "Found {} sgfs" . format ( len ( sgfs ) ) ) ids , results = extract_pairwise ( sgfs ) if not results : for m in sgfs : print ( m ) print ( "No SGFs with valid results were found" ) return 1 rs = math_ratings . compute_ratings ( results ) fancyprint_ratings ( ids , rs , results ) return 0