misc module

This is a storage for now useless pieces of code that used to be, or could be useful one day.

EOF_reader(path)[source]

Read a file until the EOF.

Warning

This is far too slow because tell() is bugged in python 2.x !

class InputThread[source]

Bases: threading.Thread

An always waiting for input tread, printing what it gets.

run()[source]
class Monitor(input_queue)[source]

Bases: threading.Thread

A thread used to demonstrate how a queue object is working

run()[source]
random_local_URL(factor=2, max_depth=2)[source]
Returns:A random local URL
Return type:string

Warning

The repartition of the returned URL is not uniform ! ULR with 0-depth (ie ‘/’, with or without file name) are returned more often that longer URL. Use uniform_random_local_URL_maker() to get a uniform_random_local_URL function.

Notes

number of section = len(section) * factor

max_depth is the highest number possible of /section/subsection/subsubsection/etc. /archive2/blog0/archive2/page1/ -> depth = 4

Examples

  • / <- min_depth without URL_end
  • /index.html <- min_depth with URL_end
  • /page0/
  • /archive0/blog1/
  • /blog0/picture.png
  • /page0/archive1/archive2/index.html
  • /archive2/archive0/archive2/archive2/form.php <- max_depth = 4, with URL_end
read_log(log_name)[source]

A “two liner” that read the log file given. Fun.

Returns:A list of all the non-empty line that are not starting with ‘#’
Return type:list of strings

Note

The returned line are .strip()-ed