text
stringlengths
81
112k
scannerData(EWrapper self, int reqId, int rank, ContractDetails contractDetails, IBString const & distance, IBString const & benchmark, IBString const & projection, IBString const & legsStr) def scannerData(self, reqId, rank, contractDetails, distance, benchmark, projection, legsStr): """scannerData(EWrapper s...
realtimeBar(EWrapper self, TickerId reqId, long time, double open, double high, double low, double close, long volume, double wap, int count) def realtimeBar(self, reqId, time, open, high, low, close, volume, wap, count): """realtimeBar(EWrapper self, TickerId reqId, long time, double open, double high, double...
position(EWrapper self, IBString const & account, Contract contract, int position, double avgCost) def position(self, account, contract, position, avgCost): """position(EWrapper self, IBString const & account, Contract contract, int position, double avgCost)""" return _swigibpy.EWrapper_position(self, ...
accountSummary(EWrapper self, int reqId, IBString const & account, IBString const & tag, IBString const & value, IBString const & curency) def accountSummary(self, reqId, account, tag, value, curency): """accountSummary(EWrapper self, int reqId, IBString const & account, IBString const & tag, IBString const & ...
Handles an error thrown during invocation of an EWrapper method. Arguments are those provided by sys.exc_info() def pyError(self, type, value, traceback): '''Handles an error thrown during invocation of an EWrapper method. Arguments are those provided by sys.exc_info() ''' sys...
Called after instantiating with a compressed payload Params: counts_len counts size to use based on decoded settings in the header def init_counts(self, counts_len): '''Called after instantiating with a compressed payload Params: counts_len counts size to use based on de...
Decompress a compressed payload into this payload wrapper. Note that the decompressed buffer is saved in self._data and the counts array is not yet allocated. Args: compressed_payload (string) a payload in zlib compressed form Exception: HdrCookieException: ...
Compress this payload instance Args: counts_limit how many counters should be encoded starting from index 0 (can be 0), Return: the compressed payload (python string) def compress(self, counts_limit): '''Compress this payload instance A...
Compress the associated encodable payload, prepend the header then encode with base64 if requested Returns: the b64 encoded wire encoding of the histogram (as a string) or the compressed payload (as a string, if b64 wrappinb is disabled) def encode(self): '''Compress th...
Decode a wire histogram encoding into a read-only Hdr Payload instance Args: encoded_histogram a string containing the wire encoding of a histogram such as one returned from encode() Returns: an hdr_payload instance with all the decoded/uncompressed ...
Record a new value into the histogram Args: value: the value to record (must be in the valid range) count: incremental count (defaults to 1) def record_value(self, value, count=1): '''Record a new value into the histogram Args: value: the value to record (m...
Record a new value into the histogram and correct for coordinated omission if needed Args: value: the value to record (must be in the valid range) expected_interval: the expected interval between 2 value samples count: incremental count (defaults to 1) def record_co...
Get the value for a given percentile Args: percentile: a float in [0.0..100.0] Returns: the value for the given percentile def get_value_at_percentile(self, percentile): '''Get the value for a given percentile Args: percentile: a float in [0.0..100....
A faster alternative to query values for a list of percentiles. Args: percentile_list: a list of percentiles in any order, dups will be ignored each element in the list must be a float value in [0.0 .. 100.0] Returns: a dict of percentile values indexed by the percen...
Check whether 2 values are equivalent (meaning they are in the same bucket/range) Returns: true if the 2 values are equivalent def values_are_equivalent(self, val1, val2): '''Check whether 2 values are equivalent (meaning they are in the same bucket/range) Returns:...
Reset the histogram to a pristine state def reset(self): '''Reset the histogram to a pristine state ''' for index in range(self.counts_len): self.counts[index] = 0 self.total_count = 0 self.min_value = sys.maxsize self.max_value = 0 self.start_time_st...
Called during decoding and add to adjust the new min/max value and total count Args: min_non_zero_index min nonzero index of all added counts (-1 if none) max_index max index of all added counts (-1 if none) def adjust_internal_tacking_values(self, ...
Called during decoding and add to adjust the new min/max value and total count Args: min_non_zero_index min nonzero index of all added counts (-1 if none) max_index max index of all added counts (-1 if none) def set_internal_tacking_values(self, ...
Return the index in the counts array for a given value def get_counts_array_index(self, value): '''Return the index in the counts array for a given value ''' if value < 0: raise ValueError("Histogram recorded value cannot be negative.") bucket_index = self._get_bucket_index...
Decode an encoded histogram and add it to this histogram Args: encoded_histogram (string) an encoded histogram following the V1 format, such as one returned by the encode() method Exception: TypeError in case of base64 decode error HdrCookieException: ...
Decode an encoded histogram and return a new histogram instance that has been initialized with the decoded content Return: a new histogram instance representing the decoded content Exception: TypeError in case of base64 decode error HdrCookieException: ...
Validate JSON according to JSONSchema *Args*:\n _checked_json_: validated JSON. _schema_: schema that used for validation. def _validate_json(self, checked_json, schema): """ Validate JSON according to JSONSchema *Args*:\n _checked_json_: validated JSON. _schem...
Validate JSON according to schema, loaded from a file. *Args:*\n _json_string_ - JSON string;\n _path_to_schema_ - path to file with JSON schema; *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonValidator | ...
Validate JSON according to schema. *Args:*\n _json_string_ - JSON string;\n _input_schema_ - schema in string format; *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonValidator | | Library | OperatingSys...
Deserialize string into JSON structure. *Args:*\n _source_ - JSON string *Returns:*\n JSON structure *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonValidator | | Library | OperatingSystem | ...
Serialize JSON structure into string. *Args:*\n _source_ - JSON structure *Returns:*\n JSON string *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonValidator | | Library | OperatingSystem | ...
Get list of elements from _json_string_, matching [http://goessner.net/articles/JsonPath/|JSONPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression; *Returns:*\n List of found elements or ``None`` if no elements were found *Example:*\n...
Return list of elements from _json_string_, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. *Args:*\n _json_string_ - JSON string;\n _ex...
Return list of elements from _json_string_, matching [ http://objectpath.org// | ObjectPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - ObjectPath expression; *Returns:*\n List of found elements. If no elements were found, empty list will be returned ...
Check the existence of one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. *Args:*\n _json_string_ - JSON string;\n _e...
Check that one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression, don't exist. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. *Args:*\n _json_string_ - JSON string;\n _...
Scan JSON dictionary with using json-path passed sting of the format of $.element..element1[index] etc. *Args:*\n _json_dict_ - JSON dictionary;\n _expr_ - string of fuzzy search for items within the directory;\n *Returns:*\n List of DatumInContext objects: ``[DatumInCo...
Replace the value in the JSON string. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression for determining the value to be replaced;\n _value_ - the value to be replaced with;\n _index_ - index for selecting item within a match list, default value is 0;\n ...
Return formatted JSON string _json_string_.\n Using method json.dumps with settings: _indent=2, ensure_ascii=False_. *Args:*\n _json_string_ - JSON string. *Returns:*\n Formatted JSON string. *Example:*\n | *Settings* | *Value* | | Library | JsonVali...
Output an interval histogram, with the given timestamp and a configurable maxValueUnitRatio. (note that the specified timestamp will be used, and the timestamp in the actual histogram will be ignored). The max value reported with the interval line will be scaled by the given max_...
Log a start time in the log. Params: start_time_msec time (in milliseconds) since the absolute start time (the epoch) def output_start_time(self, start_time_msec): '''Log a start time in the log. Params: start_time_msec time (in milliseconds) since the absolute start tim...
Read the next interval histogram from the log, if interval falls within an absolute or relative time range. Timestamps are assumed to appear in order in the log file, and as such this method will return a null upon encountering a timestamp larger than range_end_time_sec. Relati...
Read the next interval histogram from the log, if interval falls within an absolute or relative time range. Timestamps are assumed to appear in order in the log file, and as such this method will return a null upon encountering a timestamp larger than range_end_time_sec. Relati...
Read the next interval histogram from the log, if interval falls within an absolute or relative time range, and add it to the destination histogram (or to the reference histogram if dest_histogram is None) Timestamps are assumed to appear in order in the log file, and as such this metho...
Sanitizes strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|escape_html }} def sanitize(value): ''' Sanitizes strings according to SANITIZER_ALLOWED_TAGS, SA...
Strips HTML tags from strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|strip_html }} def strip_filter(value): ''' Strips HTML tags from strings according to SAN...
Strip HTML tags other than provided tags and attributes. Example usage: {% load sanitizer %} {{ post.body|sanitize_allow:'a, strong, img; href, src'}} def sanitize_allow(value, args=''): ''' Strip HTML tags other than provided tags and attributes. Example usage: {% load sanitizer %} {...
Template tag to sanitize string values. It accepts lists of allowed tags, attributes or styles in comma separated string or list format. For example: {% load sanitizer %} {% escape_html '<a href="">bar</a> <script>alert('baz')</script>' "a,img' 'href',src' %} Will output: <a href="">bar</a> ...
Template tag to strip html from string values. It accepts lists of allowed tags, attributes or stylesin comma separated string or list format. For example: {% load sanitizer %} {% strip_html '<a href="">bar</a> <script>alert('baz')</script>' "a,img' 'href',src' %} Will output: <a href="">bar...
Plucks a letter out of the censor_pool. If the censor_pool is empty, replenishes it. This is done to ensure all censor chars are used before grabbing more (avoids ugly duplicates). def get_censor_char(): """Plucks a letter out of the censor_pool. If the censor_pool is empty, replenishes it. This is don...
Returns the input string with profanity replaced with a random string of characters plucked from the censor_characters pool. def censor(input_text): """ Returns the input string with profanity replaced with a random string of characters plucked from the censor_characters pool. """ ret = input_text...
Loads and caches the profanity word list. Input file (if provided) should be a flat text file with one profanity entry per line. def load_words(wordlist=None): """ Loads and caches the profanity word list. Input file (if provided) should be a flat text file with one profanity entry per line. """ g...
Convert csv to json. csv: filename or file-like object json: filename or file-like object if csv is '-' or None: stdin is used for input if json is '-' or None: stdout is used for output def convert(csv, json, **kwargs): '''Convert csv to json. csv: filename or file-like ...
Add new sentence to generate dictionaries. :param sentence: A list of strings representing the sentence. def update_dicts(self, sentence): """Add new sentence to generate dictionaries. :param sentence: A list of strings representing the sentence. """ self.dict_generator(senten...
Set with custom dictionaries. :param word_dict: The word dictionary. :param char_dict: The character dictionary. def set_dicts(self, word_dict, char_dict): """Set with custom dictionaries. :param word_dict: The word dictionary. :param char_dict: The character dictionary. ...
Get word and character dictionaries. :return word_dict, char_dict: def get_dicts(self): """Get word and character dictionaries. :return word_dict, char_dict: """ if self.word_dict is None: self.word_dict, self.char_dict, self.max_word_len = self.dict_generator(retu...
Get the merged embedding layer. :param word_embd_dim: The dimensions of the word embedding. :param char_embd_dim: The dimensions of the character embedding :param char_hidden_dim: The dimensions of the hidden states of RNN in one direction. :param word_embd_weights: A numpy array repres...
Convert sentences to desired input tensors. :param sentences: A list of lists representing the input sentences. :return word_embd_input, char_embd_input: The desired inputs. def get_batch_input(self, sentences): """Convert sentences to desired input tensors. :param sentences: A list ...
Convert sentences to desired input tensors. :param sentences: A list of lists representing the input sentences. :param max_word_len: The maximum allowed length of word. :param word_dict: Map a word to an integer. (0 and 1 should be preserved) :param char_dict: Map a character to an integer. (0 and 1 sh...
Get the merged embedding layer. :param word_dict_len: The number of words in the dictionary including the ones mapped to 0 or 1. :param char_dict_len: The number of characters in the dictionary including the ones mapped to 0 or 1. :param max_word_len: The maximum allowed length of word. :param word_emb...
Get word and character dictionaries from sentences. :param word_min_freq: The minimum frequency of a word. :param char_min_freq: The minimum frequency of a character. :param word_ignore_case: Word will be transformed to lower case before saving to dictionary. :param char_ignore_case: Character will be ...
A naive function that extracts English words from raw texts. :param text: The raw text. :return words: A list of strings. def get_word_list_eng(text): """A naive function that extracts English words from raw texts. :param text: The raw text. :return words: A list of strings. """ words, in...
Load pre-trained embeddings from a text file. Each line in the file should look like this: word feature_dim_1 feature_dim_2 ... feature_dim_n The `feature_dim_i` should be a floating point number. :param word_dict: A dict that maps words to indice. :param file_path: The location of the text f...
Loads all backends def init_backends(): """Loads all backends""" global _BACKENDS, _ACTIVE_BACKENDS try: from .cffi_backend import CFFIBackend except ImportError: pass else: _BACKENDS.append(CFFIBackend) from .ctypes_backend import CTypesBackend from .null_backend...
Returns the backend by name or raises KeyError def get_backend(name): """Returns the backend by name or raises KeyError""" for backend in _BACKENDS: if backend.NAME == name: return backend raise KeyError("Backend %r not available" % name)
Set a prefered ffi backend (cffi, ctypes). set_backend() -- default set_backend("cffi") -- cffi first, others as fallback set_backend("ctypes") -- ctypes first, others as fallback def set_backend(name=None): """Set a prefered ffi backend (cffi, ctypes). set_backend() -- default set_backend("c...
Prints debug information for various public objects like methods, functions, constructors etc. def pprint(obj, file_=None): """Prints debug information for various public objects like methods, functions, constructors etc. """ if file_ is None: file_ = sys.stdout # functions, methods ...
A field python type def get_field_type(info): """A field python type""" type_ = info.get_type() cls = get_field_class(type_) field = cls(info, type_, None) field.setup() return field.py_type
Return a new Color object from red/green/blue values from 0.0 to 1.0. def from_floats(red, green, blue): """Return a new Color object from red/green/blue values from 0.0 to 1.0.""" return Color(int(red * Color.MAX_VALUE), int(green * Color.MAX_VALUE), int(blue...
Create a list of TargetEntry items from a list of tuples in the form (target, flags, info) The list can also contain existing TargetEntry items in which case the existing entry is re-used in the return list. def _construct_target_list(targets): """Create a list of TargetEntry items from a list of tuples i...
style_get_property(property_name, value=None) :param property_name: the name of a style property :type property_name: :obj:`str` :param value: Either :obj:`None` or a correctly initialized :obj:`GObject.Value` :type value: :obj:`GObject.Value` or :obj:`None` ...
child_get_property(child, property_name, value=None) :param child: a widget which is a child of `self` :type child: :obj:`Gtk.Widget` :param property_name: the name of the property to get :type property_name: :obj:`str` :param value: Either ...
Returns a list of child property values for the given names. def child_get(self, child, *prop_names): """Returns a list of child property values for the given names.""" return [self.child_get_property(child, name) for name in prop_names]
Set a child properties on the given child to key/value pairs. def child_set(self, child, **kwargs): """Set a child properties on the given child to key/value pairs.""" for name, value in kwargs.items(): name = name.replace('_', '-') self.child_set_property(child, name, value)
insert_text(self, text, position) :param new_text: the text to append :type new_text: :obj:`str` :param position: location of the position text will be inserted at :type position: :obj:`int` :returns: location of the position text will be in...
The add_actions() method is a convenience method that creates a number of gtk.Action objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples can vary in size from one to six items with the following inf...
The add_toggle_actions() method is a convenience method that creates a number of gtk.ToggleAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The toggle action entry tuples can vary in size from one to seven ...
The add_radio_actions() method is a convenience method that creates a number of gtk.RadioAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples can vary in size from one to six items with the fol...
add_ui_from_string(buffer, length=-1) {{ all }} def add_ui_from_string(self, buffer, length=-1): """add_ui_from_string(buffer, length=-1) {{ all }} """ return Gtk.UIManager.add_ui_from_string(self, buffer, length)
add_from_string(buffer, length=-1) {{ all }} def add_from_string(self, buffer, length=-1): """add_from_string(buffer, length=-1) {{ all }} """ return Gtk.Builder.add_from_string(self, buffer, length)
add_objects_from_string(buffer, object_ids) :param buffer: the string to parse :type buffer: :obj:`str` :param object_ids: array of objects to build :type object_ids: [:obj:`str`] :raises: :class:`GLib.Error` :returns: A positive value on success, 0 if an error occurre...
add_buttons(*args) The add_buttons() method adds several buttons to the Gtk.Dialog using the button data passed as arguments to the method. This method is the same as calling the Gtk.Dialog.add_button() repeatedly. The button data pairs - button text (or stock ID) and a response ID inte...
Creates a tag and adds it to the tag table of the TextBuffer. :param str tag_name: Name of the new tag, or None :param **properties: Keyword list of properties and their values :returns: A new tag. This is equivalent to creating a Gtk.TextTag and the...
set_text(text, length=-1) {{ all }} def set_text(self, text, length=-1): """set_text(text, length=-1) {{ all }} """ Gtk.TextBuffer.set_text(self, text, length)
insert(iter, text, length=-1) {{ all }} def insert(self, iter, text, length=-1): """insert(iter, text, length=-1) {{ all }} """ Gtk.TextBuffer.insert(self, iter, text, length)
:param path: the :obj:`Gtk.TreePath`-struct :type path: :obj:`Gtk.TreePath` :raises: :class:`ValueError` if `path` doesn't exist :returns: a :obj:`Gtk.TreeIter` :rtype: :obj:`Gtk.TreeIter` Returns an iterator pointing to `path`. If `path` does not exist :class:`ValueErr...
:param iter: the :obj:`Gtk.TreeIter`-struct :type iter: :obj:`Gtk.TreeIter` :returns: a :obj:`Gtk.TreeIter` or :obj:`None` :rtype: :obj:`Gtk.TreeIter` or :obj:`None` Returns an iterator pointing to the node following `iter` at the current level. If there is no next `it...
:param iter: the :obj:`Gtk.TreeIter`-struct :type iter: :obj:`Gtk.TreeIter` :returns: a :obj:`Gtk.TreeIter` or :obj:`None` :rtype: :obj:`Gtk.TreeIter` or :obj:`None` Returns an iterator pointing to the previous node at the current level. If there is no previous `iter`, :obj:`N...
:param treeiter: the :obj:`Gtk.TreeIter` :type treeiter: :obj:`Gtk.TreeIter` :param row: a list of values for each column :type row: [:obj:`object`] Sets all values of a row pointed to by `treeiter` from a list of values passes as `row`. The length of the row has to match the n...
Convert value to a GObject.Value of the expected type def _convert_value(self, column, value): '''Convert value to a GObject.Value of the expected type''' if isinstance(value, GObject.Value): return value return GObject.Value(self.get_column_type(column), value)
:param treeiter: the :obj:`Gtk.TreeIter` :type treeiter: :obj:`Gtk.TreeIter` :param \\*columns: a list of column indices to fetch :type columns: (:obj:`int`) Returns a tuple of all values specified by their indices in `columns` in the order the indices are contained in `columns...
append(row=None) :param row: a list of values to apply to the newly append row or :obj:`None` :type row: [:obj:`object`] or :obj:`None` :returns: :obj:`Gtk.TreeIter` of the appended row :rtype: :obj:`Gtk.TreeIter` If `row` is :obj:`None` the appended row will be empty and to f...
insert_before(sibling, row=None) :param sibling: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type sibling: :obj:`Gtk.TreeIter` or :obj:`None` :param row: a list of values to apply to the newly inserted row or :obj:`None` :type row: [:obj:`object`] or :obj:`None` :returns: :ob...
insert_after(sibling, row=None) :param sibling: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type sibling: :obj:`Gtk.TreeIter` or :obj:`None` :param row: a list of values to apply to the newly inserted row or :obj:`None` :type row: [:obj:`object`] or :obj:`None` :returns: :obj...
{{ all }} `value` can also be a Python value and will be converted to a :obj:`GObject.Value` using the corresponding column type (See :obj:`Gtk.ListStore.set_column_types`\\()). def set_value(self, treeiter, column, value): """ {{ all }} `value` can also be a Python va...
Returns the next :obj:`Gtk.TreeModelRow` or None def get_next(self): """Returns the next :obj:`Gtk.TreeModelRow` or None""" next_iter = self.model.iter_next(self.iter) if next_iter: return TreeModelRow(self.model, next_iter)
Returns the previous :obj:`Gtk.TreeModelRow` or None def get_previous(self): """Returns the previous :obj:`Gtk.TreeModelRow` or None""" prev_iter = self.model.iter_previous(self.iter) if prev_iter: return TreeModelRow(self.model, prev_iter)
Returns the parent :obj:`Gtk.TreeModelRow` or htis row or None def get_parent(self): """Returns the parent :obj:`Gtk.TreeModelRow` or htis row or None""" parent_iter = self.model.iter_parent(self.iter) if parent_iter: return TreeModelRow(self.model, parent_iter)
Returns a :obj:`Gtk.TreeModelRowIter` for the row's children def iterchildren(self): """Returns a :obj:`Gtk.TreeModelRowIter` for the row's children""" child_iter = self.model.iter_children(self.iter) return TreeModelRowIter(self.model, child_iter)
insert(parent, position, row=None) :param parent: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type parent: :obj:`Gtk.TreeIter` or :obj:`None` :param position: position to insert the new row, or -1 for last :type position: :obj:`int` :param row: a list ...
insert_before(parent, sibling, row=None) :param parent: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type parent: :obj:`Gtk.TreeIter` or :obj:`None` :param sibling: A valid :obj:`Gtk.TreeIter`, or :obj:`None` :type sibling: :obj:`Gtk.TreeIter` or :obj:`None` :param row: a list...
{{ all }} `value` can also be a Python value and will be converted to a :obj:`GObject.Value` using the corresponding column type (See :obj:`Gtk.ListStore.set_column_types`\\()). def set_value(self, treeiter, column, value): """ {{ all }} `value` can also be a Python va...
:param position: The position to insert the new column in :type position: :obj:`int` :param title: The title to set the header to :type title: :obj:`str` :param cell: The :obj:`Gtk.CellRenderer` :type cell: :obj:`Gtk.CellRenderer` {{ docs }} def insert_column_with_att...
:param cell_renderer: the :obj:`Gtk.CellRenderer` we're setting the attributes of :type cell_renderer: :obj:`Gtk.CellRenderer` {{ docs }} def set_attributes(self, cell_renderer, **attributes): """ :param cell_renderer: the :obj:`Gtk.CellRenderer` we're setting the attributes of ...
:returns: :model: the :obj:`Gtk.TreeModel` :iter: The :obj:`Gtk.TreeIter` or :obj:`None` :rtype: (**model**: :obj:`Gtk.TreeModel`, **iter**: :obj:`Gtk.TreeIter` or :obj:`None`) {{ docs }} def get_selected(self): """ :returns: :model: the :obj:`Gtk.T...