<commit_before>defmodule MarcoPolo.Connection do
  @moduledoc false

  use Connection

  require Logger

  alias MarcoPolo.Connection.Auth
  alias MarcoPolo.Protocol
  alias MarcoPolo.Document
  alias MarcoPolo.Error

  @socket_opts [:binary, active: false, packet: :raw]

  @timeout 5000

  @initial_state %{
    socket: nil,
    session_id: nil,
    queue: :queue.new,
    schema: nil,
    tail: "",
    transaction_id: 1,
  }

  ## Client code.

  @doc """
  Starts the current `Connection`. If the (successful) connection is to a
  database, fetch the schema.
  """
  @spec start_link(Keyword.t) :: GenServer.on_start
  def start_link(opts) do
    # The first `opts` is the value to pass to the `init/1` callback, the second
    # one is the list of options being passed to `Connection.start_link` (e.g.,
    # `:name` or `:timeout`).
    case Connection.start_link(__MODULE__, opts, opts) do<commit_msg>Add some comments to MarcoPolo.Connection<commit_after>defmodule MarcoPolo.Connection do
  @moduledoc false

  use Connection

  require Logger

  alias MarcoPolo.Connection.Auth
  alias MarcoPolo.Protocol
  alias MarcoPolo.Document
  alias MarcoPolo.Error

  @socket_opts [:binary, active: false, packet: :raw]

  @timeout 5000

  @initial_state %{
    # The TCP socket to the OrientDB server
    socket: nil,
    # The session id for the session held by this genserver
    session_id: nil,
    # The queue of commands sent to the server
    queue: :queue.new,
    # The schema of the OrientDB database (if we're connected to a db)
    schema: nil,
    # The tail of binary data from parsing
    tail: "",
    # A monothonically increasing transaction id (must be unique per session)
    transaction_id: 1,
    # The options used to start this genserver
    opts: nil,
  }

  ## Client code.

  @doc """
  Starts the current `Connection`. If the (successful) connection is to a
  database, fetch the schema.
  """
  @spec start_link(Keyword.t) :: GenServer.on_start
  def start_link(opts) do
    # The first `opts` is the value to pass to the `init/1` callback, the second
    # one is the list of options being passed to `Connection.start_link` (e.g.,
    # `:name` or `:timeout`).
    case Connection.start_link(__MODULE__, opts, opts) do
{'fraction_non_alphanumeric': 0.09115162294353046, 'fraction_numerical': 0.005335704757670075, 'mean_word_length': 3.3436293436293436, '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': '4484544', 'n_tokens_mistral': 717, 'n_tokens_neox': 688, 'n_words': 254}