original_docstring: Generate docker files for all tags.
docstring: Generate docker files for all tags.
docstring_tokens: Generate docker files for all tags .
code: def make(tag_masks: str = "*", poetry_version: str = "master"):
      """Generate docker files for all tags."""
      tags = requests.get(
          "https://registry.hub.docker.com/v1/repositories/python/tags"
      ).json()
  
      def match_tag(tag) -> bool:
          tag_name = tag["name"]
          return [
              tag_mask
              for tag_mask in tag_masks
              if tag_mask == "*" or fnmatch.fnmatch(tag_name, tag_mask)
          ]
  
      tags = list(filter(match_tag, tags))
  
      click.echo(f"Found {len(tags)} tags.")
      click.echo("Generating ", nl=False)
  
      docker_3_template = Path("./Dockerfile-3.template").read_text("utf8")
      docker_2_template = Path("./Dockerfile-2.template").read_text("utf8")
  
      for tag in tags:
          tag_name = tag["name"]
  
          docker_template = docker_3_template
  
          try:
              tag_major_version = int(tag_name[0])
              tag_major_path = Path(str(tag_major_version))
              try:
                  tag_major_path.mkdir()
              except FileExistsError:
                  pass
              tag_path = tag_major_path / Path(tag_name)
              if tag_major_version == 2:
                  docker_template = docker_2_template
          except ValueError:
              tag_path = Path(tag_name)
  
          try:
              tag_path.mkdir()
          except FileExistsError:
              pass
  
          (tag_path / "Dockerfile").write_text(
              docker_template.format(python_tag=tag_name, poetry_version=poetry_version)
          )
          click.echo(".", nl=False)
      click.echo(" Done.")
code_tokens: def make ( tag_masks : str = "*" , poetry_version : str = "master" ) : tags = requests . get ( "https://registry.hub.docker.com/v1/repositories/python/tags" ) . json ( ) def match_tag ( tag ) -> bool : tag_name = tag [ "name" ] return [ tag_mask for tag_mask in tag_masks if tag_mask == "*" or fnmatch . fnmatch ( tag_name , tag_mask ) ] tags = list ( filter ( match_tag , tags ) ) click . echo ( f"Found {len(tags)} tags." ) click . echo ( "Generating " , nl = False ) docker_3_template = Path ( "./Dockerfile-3.template" ) . read_text ( "utf8" ) docker_2_template = Path ( "./Dockerfile-2.template" ) . read_text ( "utf8" ) for tag in tags : tag_name = tag [ "name" ] docker_template = docker_3_template try : tag_major_version = int ( tag_name [ 0 ] ) tag_major_path = Path ( str ( tag_major_version ) ) try : tag_major_path . mkdir ( ) except FileExistsError : pass tag_path = tag_major_path / Path ( tag_name ) if tag_major_version == 2 : docker_template = docker_2_template except ValueError : tag_path = Path ( tag_name ) try : tag_path . mkdir ( ) except FileExistsError : pass ( tag_path / "Dockerfile" ) . write_text ( docker_template . format ( python_tag = tag_name , poetry_version = poetry_version ) ) click . echo ( "." , nl = False ) click . echo ( " Done." )
short_docstring: Generate docker files for all tags.
short_docstring_tokens: Generate docker files for all tags .
comment: """Generate docker files for all tags."""