# sbws.core package

## Submodules

### sbws.core.cleanup module

Util functions to cleanup disk space.

`sbws.core.cleanup.``gen_parser`(sub)

  Helper function for the broader argument parser generating code that adds in all the possible command line arguments for the cleanup command.

  Parameters: | sub (argparse._SubParsersAction) – what to add a sub-parser to

`sbws.core.cleanup.``main`(args, conf)

  Main entry point in to the cleanup command.

  Parameters:

  - args (argparse.Namespace) – command line arguments
  - conf (configparser.ConfigParser) – parsed config files

### sbws.core.generate module

`sbws.core.generate.``gen_parser`(sub)

`sbws.core.generate.``main`(args, conf)

### sbws.core.scanner module

Measure the relays.

`sbws.core.scanner.``dispatch_worker_thread`(*a, **kw)

`sbws.core.scanner.``gen_parser`(sub)

`sbws.core.scanner.``get_random_range_string`(content_length, size)

  Return a random range of bytes of length size. content_length is the size of the file we will be requesting a range of bytes from.

  For example, for content_length of 100 and size 10, this function will return one of the following: ‘0-9’, ‘1-10’, ‘2-11’, […] ‘89-98’, ‘90-99’

`sbws.core.scanner.``main`(args, conf)

`sbws.core.scanner.``measure_bandwidth_to_server`(session, conf, dest, content_length)

`sbws.core.scanner.``measure_relay`(args, conf, destinations, cb, rl, relay)

`sbws.core.scanner.``measure_rtt_to_server`(session, conf, dest, content_length)

  Make multiple end-to-end RTT measurements by making small HTTP requests over a circuit + stream that should already exist, persist, and not need rebuilding. If something goes wrong and not all of the RTT measurements can be made, return None. Otherwise return a list of the RTTs (in seconds).

`sbws.core.scanner.``result_putter`(result_dump)

  Create a function that takes a single argument – the measurement result – and return that function so it can be used by someone else

`sbws.core.scanner.``result_putter_error`(target)

  Create a function that takes a single argument – an error from a measurement – and return that function so it can be used by someone else

`sbws.core.scanner.``run_speedtest`(args, conf)

`sbws.core.scanner.``timed_recv_from_server`(session, dest, byte_range)

  Request the byte_range from the URL at dest. If successful, return True and the time it took to download. Otherwise return False and an exception.

### sbws.core.stats module

`sbws.core.stats.``gen_parser`(sub)

  Helper function for the broader argument parser generating code that adds in all the possible command line arguments for the stats command.

  Parameters: | sub (argparse._SubParsersAction) – what to add a sub-parser to

`sbws.core.stats.``main`(args, conf)

  Main entry point into the stats command.

  Parameters:

  - args (argparse.Namespace) – command line arguments
  - conf (configparser.ConfigParser) – parsed config files

`sbws.core.stats.``print_stats`(args, data)

  Called from main to print various statistics about the organized data to stdout.

  Parameters:

  - args (argparse.Namespace) – command line arguments
  - data (dict) – keyed by relay fingerprint, and with values of `sbws.lib.resultdump.Result` subclasses

## Module contents