doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
exception queue.Empty
Exception raised when non-blocking get() (or get_nowait()) is called on a Queue object which is empty. | python.library.queue#queue.Empty |
exception queue.Full
Exception raised when non-blocking put() (or put_nowait()) is called on a Queue object which is full. | python.library.queue#queue.Full |
class queue.LifoQueue(maxsize=0)
Constructor for a LIFO queue. maxsize is an integer that sets the upperbound limit on the number of items that can be placed in the queue. Insertion will block once this size has been reached, until queue items are consumed. If maxsize is less than or equal to zero, the queue size is ... | python.library.queue#queue.LifoQueue |
class queue.PriorityQueue(maxsize=0)
Constructor for a priority queue. maxsize is an integer that sets the upperbound limit on the number of items that can be placed in the queue. Insertion will block once this size has been reached, until queue items are consumed. If maxsize is less than or equal to zero, the queue ... | python.library.queue#queue.PriorityQueue |
class queue.Queue(maxsize=0)
Constructor for a FIFO queue. maxsize is an integer that sets the upperbound limit on the number of items that can be placed in the queue. Insertion will block once this size has been reached, until queue items are consumed. If maxsize is less than or equal to zero, the queue size is infi... | python.library.queue#queue.Queue |
Queue.empty()
Return True if the queue is empty, False otherwise. If empty() returns True it doesn’t guarantee that a subsequent call to put() will not block. Similarly, if empty() returns False it doesn’t guarantee that a subsequent call to get() will not block. | python.library.queue#queue.Queue.empty |
Queue.full()
Return True if the queue is full, False otherwise. If full() returns True it doesn’t guarantee that a subsequent call to get() will not block. Similarly, if full() returns False it doesn’t guarantee that a subsequent call to put() will not block. | python.library.queue#queue.Queue.full |
Queue.get(block=True, timeout=None)
Remove and return an item from the queue. If optional args block is true and timeout is None (the default), block if necessary until an item is available. If timeout is a positive number, it blocks at most timeout seconds and raises the Empty exception if no item was available with... | python.library.queue#queue.Queue.get |
Queue.get_nowait()
Equivalent to get(False). | python.library.queue#queue.Queue.get_nowait |
Queue.join()
Blocks until all items in the queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer thread calls task_done() to indicate that the item was retrieved and all work on it is complete. When the count of unfi... | python.library.queue#queue.Queue.join |
Queue.put(item, block=True, timeout=None)
Put item into the queue. If optional args block is true and timeout is None (the default), block if necessary until a free slot is available. If timeout is a positive number, it blocks at most timeout seconds and raises the Full exception if no free slot was available within ... | python.library.queue#queue.Queue.put |
Queue.put_nowait(item)
Equivalent to put(item, False). | python.library.queue#queue.Queue.put_nowait |
Queue.qsize()
Return the approximate size of the queue. Note, qsize() > 0 doesn’t guarantee that a subsequent get() will not block, nor will qsize() < maxsize guarantee that put() will not block. | python.library.queue#queue.Queue.qsize |
Queue.task_done()
Indicate that a formerly enqueued task is complete. Used by queue consumer threads. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will resume when all items have been processed ... | python.library.queue#queue.Queue.task_done |
class queue.SimpleQueue
Constructor for an unbounded FIFO queue. Simple queues lack advanced functionality such as task tracking. New in version 3.7. | python.library.queue#queue.SimpleQueue |
SimpleQueue.empty()
Return True if the queue is empty, False otherwise. If empty() returns False it doesn’t guarantee that a subsequent call to get() will not block. | python.library.queue#queue.SimpleQueue.empty |
SimpleQueue.get(block=True, timeout=None)
Remove and return an item from the queue. If optional args block is true and timeout is None (the default), block if necessary until an item is available. If timeout is a positive number, it blocks at most timeout seconds and raises the Empty exception if no item was availabl... | python.library.queue#queue.SimpleQueue.get |
SimpleQueue.get_nowait()
Equivalent to get(False). | python.library.queue#queue.SimpleQueue.get_nowait |
SimpleQueue.put(item, block=True, timeout=None)
Put item into the queue. The method never blocks and always succeeds (except for potential low-level errors such as failure to allocate memory). The optional args block and timeout are ignored and only provided for compatibility with Queue.put(). CPython implementation... | python.library.queue#queue.SimpleQueue.put |
SimpleQueue.put_nowait(item)
Equivalent to put(item), provided for compatibility with Queue.put_nowait(). | python.library.queue#queue.SimpleQueue.put_nowait |
SimpleQueue.qsize()
Return the approximate size of the queue. Note, qsize() > 0 doesn’t guarantee that a subsequent get() will not block. | python.library.queue#queue.SimpleQueue.qsize |
Queues Source code: Lib/asyncio/queues.py asyncio queues are designed to be similar to classes of the queue module. Although asyncio queues are not thread-safe, they are designed to be used specifically in async/await code. Note that methods of asyncio queues don’t have a timeout parameter; use asyncio.wait_for() funct... | python.library.asyncio-queue |
quit(code=None)
exit(code=None)
Objects that when printed, print a message like “Use quit() or Ctrl-D (i.e. EOF) to exit”, and when called, raise SystemExit with the specified exit code. | python.library.constants#quit |
quopri — Encode and decode MIME quoted-printable data Source code: Lib/quopri.py This module performs quoted-printable transport encoding and decoding, as defined in RFC 1521: “MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies”. The quo... | python.library.quopri |
quopri.decode(input, output, header=False)
Decode the contents of the input file and write the resulting decoded binary data to the output file. input and output must be binary file objects. If the optional argument header is present and true, underscore will be decoded as space. This is used to decode “Q”-encoded he... | python.library.quopri#quopri.decode |
quopri.decodestring(s, header=False)
Like decode(), except that it accepts a source bytes and returns the corresponding decoded bytes. | python.library.quopri#quopri.decodestring |
quopri.encode(input, output, quotetabs, header=False)
Encode the contents of the input file and write the resulting quoted-printable data to the output file. input and output must be binary file objects. quotetabs, a non-optional flag which controls whether to encode embedded spaces and tabs; when true it encodes suc... | python.library.quopri#quopri.encode |
quopri.encodestring(s, quotetabs=False, header=False)
Like encode(), except that it accepts a source bytes and returns the corresponding encoded bytes. By default, it sends a False value to quotetabs parameter of the encode() function. | python.library.quopri#quopri.encodestring |
random — Generate pseudo-random numbers Source code: Lib/random.py This module implements pseudo-random number generators for various distributions. For integers, there is uniform selection from a range. For sequences, there is uniform selection of a random element, a function to generate a random permutation of a list... | python.library.random |
random.betavariate(alpha, beta)
Beta distribution. Conditions on the parameters are alpha > 0 and beta > 0. Returned values range between 0 and 1. | python.library.random#random.betavariate |
random.choice(seq)
Return a random element from the non-empty sequence seq. If seq is empty, raises IndexError. | python.library.random#random.choice |
random.choices(population, weights=None, *, cum_weights=None, k=1)
Return a k sized list of elements chosen from the population with replacement. If the population is empty, raises IndexError. If a weights sequence is specified, selections are made according to the relative weights. Alternatively, if a cum_weights se... | python.library.random#random.choices |
random.expovariate(lambd)
Exponential distribution. lambd is 1.0 divided by the desired mean. It should be nonzero. (The parameter would be called “lambda”, but that is a reserved word in Python.) Returned values range from 0 to positive infinity if lambd is positive, and from negative infinity to 0 if lambd is negat... | python.library.random#random.expovariate |
random.gammavariate(alpha, beta)
Gamma distribution. (Not the gamma function!) Conditions on the parameters are alpha > 0 and beta > 0. The probability distribution function is: x ** (alpha - 1) * math.exp(-x / beta)
pdf(x) = --------------------------------------
math.gamma(alpha) * beta ** al... | python.library.random#random.gammavariate |
random.gauss(mu, sigma)
Gaussian distribution. mu is the mean, and sigma is the standard deviation. This is slightly faster than the normalvariate() function defined below. Multithreading note: When two threads call this function simultaneously, it is possible that they will receive the same return value. This can be... | python.library.random#random.gauss |
random.getrandbits(k)
Returns a non-negative Python integer with k random bits. This method is supplied with the MersenneTwister generator and some other generators may also provide it as an optional part of the API. When available, getrandbits() enables randrange() to handle arbitrarily large ranges. Changed in ver... | python.library.random#random.getrandbits |
random.getstate()
Return an object capturing the current internal state of the generator. This object can be passed to setstate() to restore the state. | python.library.random#random.getstate |
random.lognormvariate(mu, sigma)
Log normal distribution. If you take the natural logarithm of this distribution, you’ll get a normal distribution with mean mu and standard deviation sigma. mu can have any value, and sigma must be greater than zero. | python.library.random#random.lognormvariate |
random.normalvariate(mu, sigma)
Normal distribution. mu is the mean, and sigma is the standard deviation. | python.library.random#random.normalvariate |
random.paretovariate(alpha)
Pareto distribution. alpha is the shape parameter. | python.library.random#random.paretovariate |
random.randbytes(n)
Generate n random bytes. This method should not be used for generating security tokens. Use secrets.token_bytes() instead. New in version 3.9. | python.library.random#random.randbytes |
random.randint(a, b)
Return a random integer N such that a <= N <= b. Alias for randrange(a, b+1). | python.library.random#random.randint |
class random.Random([seed])
Class that implements the default pseudo-random number generator used by the random module. Deprecated since version 3.9: In the future, the seed must be one of the following types: NoneType, int, float, str, bytes, or bytearray. | python.library.random#random.Random |
random.random()
Return the next random floating point number in the range [0.0, 1.0). | python.library.random#random.random |
random.randrange(stop)
random.randrange(start, stop[, step])
Return a randomly selected element from range(start, stop, step). This is equivalent to choice(range(start, stop, step)), but doesn’t actually build a range object. The positional argument pattern matches that of range(). Keyword arguments should not be u... | python.library.random#random.randrange |
random.sample(population, k, *, counts=None)
Return a k length list of unique elements chosen from the population sequence or set. Used for random sampling without replacement. Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selectio... | python.library.random#random.sample |
random.seed(a=None, version=2)
Initialize the random number generator. If a is omitted or None, the current system time is used. If randomness sources are provided by the operating system, they are used instead of the system time (see the os.urandom() function for details on availability). If a is an int, it is used ... | python.library.random#random.seed |
random.setstate(state)
state should have been obtained from a previous call to getstate(), and setstate() restores the internal state of the generator to what it was at the time getstate() was called. | python.library.random#random.setstate |
random.shuffle(x[, random])
Shuffle the sequence x in place. The optional argument random is a 0-argument function returning a random float in [0.0, 1.0); by default, this is the function random(). To shuffle an immutable sequence and return a new shuffled list, use sample(x, k=len(x)) instead. Note that even for sma... | python.library.random#random.shuffle |
class random.SystemRandom([seed])
Class that uses the os.urandom() function for generating random numbers from sources provided by the operating system. Not available on all systems. Does not rely on software state, and sequences are not reproducible. Accordingly, the seed() method has no effect and is ignored. The g... | python.library.random#random.SystemRandom |
random.triangular(low, high, mode)
Return a random floating point number N such that low <= N <= high and with the specified mode between those bounds. The low and high bounds default to zero and one. The mode argument defaults to the midpoint between the bounds, giving a symmetric distribution. | python.library.random#random.triangular |
random.uniform(a, b)
Return a random floating point number N such that a <= N <= b for a <= b and b <= N <= a for b < a. The end-point value b may or may not be included in the range depending on floating-point rounding in the equation a + (b-a) * random(). | python.library.random#random.uniform |
random.vonmisesvariate(mu, kappa)
mu is the mean angle, expressed in radians between 0 and 2*pi, and kappa is the concentration parameter, which must be greater than or equal to zero. If kappa is equal to zero, this distribution reduces to a uniform random angle over the range 0 to 2*pi. | python.library.random#random.vonmisesvariate |
random.weibullvariate(alpha, beta)
Weibull distribution. alpha is the scale parameter and beta is the shape parameter. | python.library.random#random.weibullvariate |
class range(stop)
class range(start, stop[, step])
The arguments to the range constructor must be integers (either built-in int or any object that implements the __index__ special method). If the step argument is omitted, it defaults to 1. If the start argument is omitted, it defaults to 0. If step is zero, ValueEr... | python.library.stdtypes#range |
class range(stop)
class range(start, stop[, step])
Rather than being a function, range is actually an immutable sequence type, as documented in Ranges and Sequence Types — list, tuple, range. | python.library.functions#range |
start
The value of the start parameter (or 0 if the parameter was not supplied) | python.library.stdtypes#range.start |
step
The value of the step parameter (or 1 if the parameter was not supplied) | python.library.stdtypes#range.step |
stop
The value of the stop parameter | python.library.stdtypes#range.stop |
re — Regular expression operations Source code: Lib/re.py This module provides regular expression matching operations similar to those found in Perl. Both patterns and strings to be searched can be Unicode strings (str) as well as 8-bit strings (bytes). However, Unicode strings and 8-bit strings cannot be mixed: that i... | python.library.re |
re.A
re.ASCII
Make \w, \W, \b, \B, \d, \D, \s and \S perform ASCII-only matching instead of full Unicode matching. This is only meaningful for Unicode patterns, and is ignored for byte patterns. Corresponds to the inline flag (?a). Note that for backward compatibility, the re.U flag still exists (as well as its syn... | python.library.re#re.A |
re.A
re.ASCII
Make \w, \W, \b, \B, \d, \D, \s and \S perform ASCII-only matching instead of full Unicode matching. This is only meaningful for Unicode patterns, and is ignored for byte patterns. Corresponds to the inline flag (?a). Note that for backward compatibility, the re.U flag still exists (as well as its syn... | python.library.re#re.ASCII |
re.compile(pattern, flags=0)
Compile a regular expression pattern into a regular expression object, which can be used for matching using its match(), search() and other methods, described below. The expression’s behaviour can be modified by specifying a flags value. Values can be any of the following variables, combi... | python.library.re#re.compile |
re.DEBUG
Display debug information about compiled expression. No corresponding inline flag. | python.library.re#re.DEBUG |
re.S
re.DOTALL
Make the '.' special character match any character at all, including a newline; without this flag, '.' will match anything except a newline. Corresponds to the inline flag (?s). | python.library.re#re.DOTALL |
exception re.error(msg, pattern=None, pos=None)
Exception raised when a string passed to one of the functions here is not a valid regular expression (for example, it might contain unmatched parentheses) or when some other error occurs during compilation or matching. It is never an error if a string contains no match ... | python.library.re#re.error |
colno
The column corresponding to pos (may be None). | python.library.re#re.error.colno |
lineno
The line corresponding to pos (may be None). | python.library.re#re.error.lineno |
msg
The unformatted error message. | python.library.re#re.error.msg |
pattern
The regular expression pattern. | python.library.re#re.error.pattern |
pos
The index in pattern where compilation failed (may be None). | python.library.re#re.error.pos |
re.escape(pattern)
Escape special characters in pattern. This is useful if you want to match an arbitrary literal string that may have regular expression metacharacters in it. For example: >>> print(re.escape('http://www.python.org'))
http://www\.python\.org
>>> legal_chars = string.ascii_lowercase + string.digits +... | python.library.re#re.escape |
re.findall(pattern, string, flags=0)
Return all non-overlapping matches of pattern in string, as a list of strings. The string is scanned left-to-right, and matches are returned in the order found. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern ... | python.library.re#re.findall |
re.finditer(pattern, string, flags=0)
Return an iterator yielding match objects over all non-overlapping matches for the RE pattern in string. The string is scanned left-to-right, and matches are returned in the order found. Empty matches are included in the result. Changed in version 3.7: Non-empty matches can now ... | python.library.re#re.finditer |
re.fullmatch(pattern, string, flags=0)
If the whole string matches the regular expression pattern, return a corresponding match object. Return None if the string does not match the pattern; note that this is different from a zero-length match. New in version 3.4. | python.library.re#re.fullmatch |
re.I
re.IGNORECASE
Perform case-insensitive matching; expressions like [A-Z] will also match lowercase letters. Full Unicode matching (such as Ü matching ü) also works unless the re.ASCII flag is used to disable non-ASCII matches. The current locale does not change the effect of this flag unless the re.LOCALE flag ... | python.library.re#re.I |
re.I
re.IGNORECASE
Perform case-insensitive matching; expressions like [A-Z] will also match lowercase letters. Full Unicode matching (such as Ü matching ü) also works unless the re.ASCII flag is used to disable non-ASCII matches. The current locale does not change the effect of this flag unless the re.LOCALE flag ... | python.library.re#re.IGNORECASE |
re.L
re.LOCALE
Make \w, \W, \b, \B and case-insensitive matching dependent on the current locale. This flag can be used only with bytes patterns. The use of this flag is discouraged as the locale mechanism is very unreliable, it only handles one “culture” at a time, and it only works with 8-bit locales. Unicode mat... | python.library.re#re.L |
re.L
re.LOCALE
Make \w, \W, \b, \B and case-insensitive matching dependent on the current locale. This flag can be used only with bytes patterns. The use of this flag is discouraged as the locale mechanism is very unreliable, it only handles one “culture” at a time, and it only works with 8-bit locales. Unicode mat... | python.library.re#re.LOCALE |
re.M
re.MULTILINE
When specified, the pattern character '^' matches at the beginning of the string and at the beginning of each line (immediately following each newline); and the pattern character '$' matches at the end of the string and at the end of each line (immediately preceding each newline). By default, '^' ... | python.library.re#re.M |
re.match(pattern, string, flags=0)
If zero or more characters at the beginning of string match the regular expression pattern, return a corresponding match object. Return None if the string does not match the pattern; note that this is different from a zero-length match. Note that even in MULTILINE mode, re.match() w... | python.library.re#re.match |
Match.start([group])
Match.end([group])
Return the indices of the start and end of the substring matched by group; group defaults to zero (meaning the whole matched substring). Return -1 if group exists but did not contribute to the match. For a match object m, and a group g that did contribute to the match, the su... | python.library.re#re.Match.end |
Match.endpos
The value of endpos which was passed to the search() or match() method of a regex object. This is the index into the string beyond which the RE engine will not go. | python.library.re#re.Match.endpos |
Match.expand(template)
Return the string obtained by doing backslash substitution on the template string template, as done by the sub() method. Escapes such as \n are converted to the appropriate characters, and numeric backreferences (\1, \2) and named backreferences (\g<1>, \g<name>) are replaced by the contents of... | python.library.re#re.Match.expand |
Match.group([group1, ...])
Returns one or more subgroups of the match. If there is a single argument, the result is a single string; if there are multiple arguments, the result is a tuple with one item per argument. Without arguments, group1 defaults to zero (the whole match is returned). If a groupN argument is zero... | python.library.re#re.Match.group |
Match.groupdict(default=None)
Return a dictionary containing all the named subgroups of the match, keyed by the subgroup name. The default argument is used for groups that did not participate in the match; it defaults to None. For example: >>> m = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Malcolm Reynolds"... | python.library.re#re.Match.groupdict |
Match.groups(default=None)
Return a tuple containing all the subgroups of the match, from 1 up to however many groups are in the pattern. The default argument is used for groups that did not participate in the match; it defaults to None. For example: >>> m = re.match(r"(\d+)\.(\d+)", "24.1632")
>>> m.groups()
('24', ... | python.library.re#re.Match.groups |
Match.lastgroup
The name of the last matched capturing group, or None if the group didn’t have a name, or if no group was matched at all. | python.library.re#re.Match.lastgroup |
Match.lastindex
The integer index of the last matched capturing group, or None if no group was matched at all. For example, the expressions (a)b, ((a)(b)), and ((ab)) will have lastindex == 1 if applied to the string 'ab', while the expression (a)(b) will have lastindex == 2, if applied to the same string. | python.library.re#re.Match.lastindex |
Match.pos
The value of pos which was passed to the search() or match() method of a regex object. This is the index into the string at which the RE engine started looking for a match. | python.library.re#re.Match.pos |
Match.re
The regular expression object whose match() or search() method produced this match instance. | python.library.re#re.Match.re |
Match.span([group])
For a match m, return the 2-tuple (m.start(group), m.end(group)). Note that if group did not contribute to the match, this is (-1, -1). group defaults to zero, the entire match. | python.library.re#re.Match.span |
Match.start([group])
Match.end([group])
Return the indices of the start and end of the substring matched by group; group defaults to zero (meaning the whole matched substring). Return -1 if group exists but did not contribute to the match. For a match object m, and a group g that did contribute to the match, the su... | python.library.re#re.Match.start |
Match.string
The string passed to match() or search(). | python.library.re#re.Match.string |
Match.__getitem__(g)
This is identical to m.group(g). This allows easier access to an individual group from a match: >>> m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
>>> m[0] # The entire match
'Isaac Newton'
>>> m[1] # The first parenthesized subgroup.
'Isaac'
>>> m[2] # The second paren... | python.library.re#re.Match.__getitem__ |
re.M
re.MULTILINE
When specified, the pattern character '^' matches at the beginning of the string and at the beginning of each line (immediately following each newline); and the pattern character '$' matches at the end of the string and at the end of each line (immediately preceding each newline). By default, '^' ... | python.library.re#re.MULTILINE |
Pattern.findall(string[, pos[, endpos]])
Similar to the findall() function, using the compiled pattern, but also accepts optional pos and endpos parameters that limit the search region like for search(). | python.library.re#re.Pattern.findall |
Pattern.finditer(string[, pos[, endpos]])
Similar to the finditer() function, using the compiled pattern, but also accepts optional pos and endpos parameters that limit the search region like for search(). | python.library.re#re.Pattern.finditer |
Pattern.flags
The regex matching flags. This is a combination of the flags given to compile(), any (?...) inline flags in the pattern, and implicit flags such as UNICODE if the pattern is a Unicode string. | python.library.re#re.Pattern.flags |
Pattern.fullmatch(string[, pos[, endpos]])
If the whole string matches this regular expression, return a corresponding match object. Return None if the string does not match the pattern; note that this is different from a zero-length match. The optional pos and endpos parameters have the same meaning as for the searc... | python.library.re#re.Pattern.fullmatch |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.