<commit_before># coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

import os
import subprocess
from collections import OrderedDict, namedtuple

from pants.base.workunit import WorkUnit, WorkUnitLabel
from pants.binaries.binary_util import BinaryUtil
from pants.fs.archive import TGZ
from pants.subsystem.subsystem import Subsystem
from pants.util.contextutil import temporary_dir
from pants.util.memo import memoized_property


class GoDistribution(object):
  """Represents a self-bootstrapping Go distribution."""

  class Factory(Subsystem):
    options_scope = 'go-distribution'

    @classmethod
    def subsystem_dependencies(cls):
      return (BinaryUtil.Factory,)

    @classmethod
    def register_options(cls, register):
      register('--supportdir', advanced=True, default='bin/go',
               help='Find the go distributions under this dir.  Used as part of the path to lookup '
                    'the distribution with --binary-util-baseurls and --pants-bootstrapdir')
      register('--version', advanced=True, default='1.6.2',
               help='Go distribution version.  Used as part of the path to lookup the distribution '
                    'with --binary-util-baseurls and --pants-bootstrapdir')

    def create(self):
      # NB: create is an instance method to allow the user to choose global or scoped.
      # It's not unreasonable to imagine multiple go versions in play; for example: when
      # transitioning from the 1.x series to the 2.x series.
      binary_util = BinaryUtil.Factory.create()
      options = self.get_options()
      return GoDistribution(binary_util, options.supportdir, options.version)

  def __init__(self, binary_util, relpath, version):
    self._binary_util = binary_util
    self._relpath = relpath
    self._version = version

  @property
  def version(self):
    """Returns the version of the Go distribution.

    :returns: The Go distribution version number string.<commit_msg>Upgrade default go to 1.6.3.<commit_after># coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

import os
import subprocess
from collections import OrderedDict, namedtuple

from pants.base.workunit import WorkUnit, WorkUnitLabel
from pants.binaries.binary_util import BinaryUtil
from pants.fs.archive import TGZ
from pants.subsystem.subsystem import Subsystem
from pants.util.contextutil import temporary_dir
from pants.util.memo import memoized_property


class GoDistribution(object):
  """Represents a self-bootstrapping Go distribution."""

  class Factory(Subsystem):
    options_scope = 'go-distribution'

    @classmethod
    def subsystem_dependencies(cls):
      return (BinaryUtil.Factory,)

    @classmethod
    def register_options(cls, register):
      register('--supportdir', advanced=True, default='bin/go',
               help='Find the go distributions under this dir.  Used as part of the path to lookup '
                    'the distribution with --binary-util-baseurls and --pants-bootstrapdir')
      register('--version', advanced=True, default='1.6.3',
               help='Go distribution version.  Used as part of the path to lookup the distribution '
                    'with --binary-util-baseurls and --pants-bootstrapdir')

    def create(self):
      # NB: create is an instance method to allow the user to choose global or scoped.
      # It's not unreasonable to imagine multiple go versions in play; for example: when
      # transitioning from the 1.x series to the 2.x series.
      binary_util = BinaryUtil.Factory.create()
      options = self.get_options()
      return GoDistribution(binary_util, options.supportdir, options.version)

  def __init__(self, binary_util, relpath, version):
    self._binary_util = binary_util
    self._relpath = relpath
    self._version = version

  @property
  def version(self):
    """Returns the version of the Go distribution.

    :returns: The Go distribution version number string.
{'fraction_non_alphanumeric': 0.08104426787741204, 'fraction_numerical': 0.0061293984108967085, 'mean_word_length': 3.486761710794297, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3403380', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1128, 'n_words': 405}