original_docstring: Return a random port.
  
      Tries to return the same port for the same service each time, when
      possible.
      
docstring: Return a random port.
  Tries to return the same port for the same service each time, when
  possible.
docstring_tokens: Return a random port . Tries to return the same port for the same service each time when possible .
code: def pick_random_port(service_name):
      """Return a random port.
  
      Tries to return the same port for the same service each time, when
      possible.
      """
      hash_key = f'{service_name},{getpass.getuser()}'.encode('utf8')
      hash_number = int(hashlib.sha1(hash_key).hexdigest(), 16)
      preferred_port = 33000 + (hash_number % 25000)
      return ephemeral_port_reserve.reserve('0.0.0.0', preferred_port)
code_tokens: def pick_random_port ( service_name ) : hash_key = f'{service_name},{getpass.getuser()}' . encode ( 'utf8' ) hash_number = int ( hashlib . sha1 ( hash_key ) . hexdigest ( ) , 16 ) preferred_port = 33000 + ( hash_number % 25000 ) return ephemeral_port_reserve . reserve ( '0.0.0.0' , preferred_port )
short_docstring: Return a random port.
short_docstring_tokens: Return a random port .
comment: """Return a random port.
  
      Tries to return the same port for the same service each time, when
      possible.
      """