Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
PublicKeyType.ver_type
(self)
Accessor for the verification type identifier.
Accessor for the verification type identifier.
def ver_type(self) -> str: """Accessor for the verification type identifier.""" return self.value.ver_type
[ "def", "ver_type", "(", "self", ")", "->", "str", ":", "return", "self", ".", "value", ".", "ver_type" ]
[ 64, 4 ]
[ 67, 34 ]
python
en
['en', 'en', 'en']
True
PublicKeyType.authn_type
(self)
Accessor for the authentication type identifier.
Accessor for the authentication type identifier.
def authn_type(self) -> str: """Accessor for the authentication type identifier.""" return self.value.authn_type
[ "def", "authn_type", "(", "self", ")", "->", "str", ":", "return", "self", ".", "value", ".", "authn_type" ]
[ 70, 4 ]
[ 73, 36 ]
python
en
['en', 'en', 'en']
True
PublicKeyType.specifier
(self)
Accessor for the value specifier.
Accessor for the value specifier.
def specifier(self) -> str: """Accessor for the value specifier.""" return self.value.specifier
[ "def", "specifier", "(", "self", ")", "->", "str", ":", "return", "self", ".", "value", ".", "specifier" ]
[ 76, 4 ]
[ 79, 35 ]
python
en
['en', 'en', 'en']
True
PublicKeyType.specification
(self, val: str)
Return specifier and input value for use in public key specification. Args: val: value of public key Returns: dict mapping applicable specifier to input value
Return specifier and input value for use in public key specification.
def specification(self, val: str) -> str: """ Return specifier and input value for use in public key specification. Args: val: value of public key Returns: dict mapping applicable specifier to input value """ return {self.specifier: val}
[ "def", "specification", "(", "self", ",", "val", ":", "str", ")", "->", "str", ":", "return", "{", "self", ".", "specifier", ":", "val", "}" ]
[ 81, 4 ]
[ 92, 36 ]
python
en
['en', 'error', 'th']
False
PublicKey.__init__
( self, did: str, ident: str, value: str, pk_type: PublicKeyType = None, controller: str = None, authn: bool = False, )
Retain key specification particulars. Args: did: DID of DID document embedding public key ident: identifier for public key value: key content, encoded as key specification requires pk_type: public key type (enum), default ED25519_SIG_2018 con...
Retain key specification particulars.
def __init__( self, did: str, ident: str, value: str, pk_type: PublicKeyType = None, controller: str = None, authn: bool = False, ) -> None: """ Retain key specification particulars. Args: did: DID of DID document embedding...
[ "def", "__init__", "(", "self", ",", "did", ":", "str", ",", "ident", ":", "str", ",", "value", ":", "str", ",", "pk_type", ":", "PublicKeyType", "=", "None", ",", "controller", ":", "str", "=", "None", ",", "authn", ":", "bool", "=", "False", ",",...
[ 103, 4 ]
[ 133, 27 ]
python
en
['en', 'error', 'th']
False
PublicKey.did
(self)
Accessor for the DID.
Accessor for the DID.
def did(self) -> str: """Accessor for the DID.""" return self._did
[ "def", "did", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_did" ]
[ 136, 4 ]
[ 139, 24 ]
python
en
['en', 'en', 'en']
True
PublicKey.id
(self)
Accessor for the public key identifier.
Accessor for the public key identifier.
def id(self) -> str: """Accessor for the public key identifier.""" return self._id
[ "def", "id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_id" ]
[ 142, 4 ]
[ 145, 23 ]
python
en
['en', 'fy', 'en']
True
PublicKey.type
(self)
Accessor for the public key type.
Accessor for the public key type.
def type(self) -> PublicKeyType: """Accessor for the public key type.""" return self._type
[ "def", "type", "(", "self", ")", "->", "PublicKeyType", ":", "return", "self", ".", "_type" ]
[ 148, 4 ]
[ 151, 25 ]
python
en
['en', 'en', 'en']
True
PublicKey.value
(self)
Accessor for the public key value.
Accessor for the public key value.
def value(self) -> str: """Accessor for the public key value.""" return self._value
[ "def", "value", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_value" ]
[ 154, 4 ]
[ 157, 26 ]
python
en
['en', 'en', 'en']
True
PublicKey.controller
(self)
Accessor for the controller DID.
Accessor for the controller DID.
def controller(self) -> str: """Accessor for the controller DID.""" return self._controller
[ "def", "controller", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_controller" ]
[ 160, 4 ]
[ 163, 31 ]
python
en
['en', 'en', 'en']
True
PublicKey.authn
(self)
Accessor for the authentication marker. Returns: whether public key is marked as having DID authentication privilege
Accessor for the authentication marker.
def authn(self) -> bool: """Accessor for the authentication marker. Returns: whether public key is marked as having DID authentication privilege """ return self._authn
[ "def", "authn", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_authn" ]
[ 166, 4 ]
[ 172, 26 ]
python
en
['en', 'en', 'en']
True
PublicKey.authn
(self, value: bool)
Setter for the authentication marker. Args: value: authentication marker
Setter for the authentication marker.
def authn(self, value: bool) -> None: """Setter for the authentication marker. Args: value: authentication marker """ self._authn = value
[ "def", "authn", "(", "self", ",", "value", ":", "bool", ")", "->", "None", ":", "self", ".", "_authn", "=", "value" ]
[ 175, 4 ]
[ 182, 27 ]
python
en
['en', 'en', 'en']
True
PublicKey.to_dict
(self)
Return dict representation of public key to embed in DID document.
Return dict representation of public key to embed in DID document.
def to_dict(self) -> dict: """Return dict representation of public key to embed in DID document.""" return { "id": self.id, "type": str(self.type.ver_type), "controller": canon_ref(self.did, self.controller), **self.type.specification(self.value), ...
[ "def", "to_dict", "(", "self", ")", "->", "dict", ":", "return", "{", "\"id\"", ":", "self", ".", "id", ",", "\"type\"", ":", "str", "(", "self", ".", "type", ".", "ver_type", ")", ",", "\"controller\"", ":", "canon_ref", "(", "self", ".", "did", "...
[ 184, 4 ]
[ 192, 9 ]
python
en
['en', 'en', 'en']
True
PublicKey.__repr__
(self)
Return string representation of the public key instance.
Return string representation of the public key instance.
def __repr__(self) -> str: """Return string representation of the public key instance.""" return "PublicKey({}, {}, {}, {}, {}, {})".format( self.did, self.id, self.value, self.type, self.controller, self.authn )
[ "def", "__repr__", "(", "self", ")", "->", "str", ":", "return", "\"PublicKey({}, {}, {}, {}, {}, {})\"", ".", "format", "(", "self", ".", "did", ",", "self", ".", "id", ",", "self", ".", "value", ",", "self", ".", "type", ",", "self", ".", "controller",...
[ 194, 4 ]
[ 199, 9 ]
python
en
['en', 'en', 'en']
True
LiDARPoints.flip
(self, bev_direction='horizontal')
Flip the boxes in BEV along given BEV direction.
Flip the boxes in BEV along given BEV direction.
def flip(self, bev_direction='horizontal'): """Flip the boxes in BEV along given BEV direction.""" if bev_direction == 'horizontal': self.tensor[:, 1] = -self.tensor[:, 1] elif bev_direction == 'vertical': self.tensor[:, 0] = -self.tensor[:, 0]
[ "def", "flip", "(", "self", ",", "bev_direction", "=", "'horizontal'", ")", ":", "if", "bev_direction", "==", "'horizontal'", ":", "self", ".", "tensor", "[", ":", ",", "1", "]", "=", "-", "self", ".", "tensor", "[", ":", ",", "1", "]", "elif", "be...
[ 27, 4 ]
[ 32, 50 ]
python
en
['en', 'da', 'en']
True
LiDARPoints.in_range_bev
(self, point_range)
Check whether the points are in the given range. Args: point_range (list | torch.Tensor): The range of point in order of (x_min, y_min, x_max, y_max). Returns: torch.Tensor: Indicating whether each point is inside \ the reference range.
Check whether the points are in the given range.
def in_range_bev(self, point_range): """Check whether the points are in the given range. Args: point_range (list | torch.Tensor): The range of point in order of (x_min, y_min, x_max, y_max). Returns: torch.Tensor: Indicating whether each point is inside ...
[ "def", "in_range_bev", "(", "self", ",", "point_range", ")", ":", "in_range_flags", "=", "(", "(", "self", ".", "tensor", "[", ":", ",", "0", "]", ">", "point_range", "[", "0", "]", ")", "&", "(", "self", ".", "tensor", "[", ":", ",", "1", "]", ...
[ 34, 4 ]
[ 49, 29 ]
python
en
['en', 'en', 'en']
True
LiDARPoints.convert_to
(self, dst, rt_mat=None)
Convert self to ``dst`` mode. Args: dst (:obj:`CoordMode`): The target Point mode. rt_mat (np.ndarray | torch.Tensor): The rotation and translation matrix between different coordinates. Defaults to None. The conversion from `src` coordinates to `dst` coor...
Convert self to ``dst`` mode.
def convert_to(self, dst, rt_mat=None): """Convert self to ``dst`` mode. Args: dst (:obj:`CoordMode`): The target Point mode. rt_mat (np.ndarray | torch.Tensor): The rotation and translation matrix between different coordinates. Defaults to None. ...
[ "def", "convert_to", "(", "self", ",", "dst", ",", "rt_mat", "=", "None", ")", ":", "from", "mmdet3d", ".", "core", ".", "bbox", "import", "Coord3DMode", "return", "Coord3DMode", ".", "convert_point", "(", "point", "=", "self", ",", "src", "=", "Coord3DM...
[ 51, 4 ]
[ 68, 70 ]
python
en
['en', 'en', 'en']
True
create_indoor_info_file
(data_path, pkl_prefix='sunrgbd', save_path=None, use_v1=False, workers=4)
Create indoor information file. Get information of the raw data and save it to the pkl file. Args: data_path (str): Path of the data. pkl_prefix (str): Prefix of the pkl to be saved. Default: 'sunrgbd'. save_path (str): Path of the pkl to be saved. Default: None. use_v1 (bool):...
Create indoor information file.
def create_indoor_info_file(data_path, pkl_prefix='sunrgbd', save_path=None, use_v1=False, workers=4): """Create indoor information file. Get information of the raw data and save it to the pkl file. ...
[ "def", "create_indoor_info_file", "(", "data_path", ",", "pkl_prefix", "=", "'sunrgbd'", ",", "save_path", "=", "None", ",", "use_v1", "=", "False", ",", "workers", "=", "4", ")", ":", "assert", "os", ".", "path", ".", "exists", "(", "data_path", ")", "a...
[ 7, 0 ]
[ 45, 67 ]
python
nl
['nl', 'nl', 'en']
True
TestPresentationRequest.test_init
(self)
Test initializer.
Test initializer.
def test_init(self): """Test initializer.""" assert PRES_REQ.request_presentations_attach[0].indy_dict == INDY_PROOF_REQ assert PRES_REQ.indy_proof_request(0) == INDY_PROOF_REQ
[ "def", "test_init", "(", "self", ")", ":", "assert", "PRES_REQ", ".", "request_presentations_attach", "[", "0", "]", ".", "indy_dict", "==", "INDY_PROOF_REQ", "assert", "PRES_REQ", ".", "indy_proof_request", "(", "0", ")", "==", "INDY_PROOF_REQ" ]
[ 78, 4 ]
[ 81, 63 ]
python
de
['de', 'pl', 'en']
False
TestPresentationRequest.test_deserialize
(self)
Test deserialization.
Test deserialization.
def test_deserialize(self): """Test deserialization.""" dump = json.dumps( { "@type": PRESENTATION_REQUEST, "comment": "Hello World", "request_presentations~attach": [ AttachDecorator.from_indy_dict( ...
[ "def", "test_deserialize", "(", "self", ")", ":", "dump", "=", "json", ".", "dumps", "(", "{", "\"@type\"", ":", "PRESENTATION_REQUEST", ",", "\"comment\"", ":", "\"Hello World\"", ",", "\"request_presentations~attach\"", ":", "[", "AttachDecorator", ".", "from_in...
[ 87, 4 ]
[ 103, 64 ]
python
de
['ro', 'de', 'en']
False
TestPresentationRequest.test_serialize
(self)
Test serialization.
Test serialization.
def test_serialize(self): """Test serialization.""" pres_req_dict = PRES_REQ.serialize() pres_req_dict.pop("@id") assert pres_req_dict == { "@type": PRESENTATION_REQUEST, "request_presentations~attach": [ AttachDecorator.from_indy_dict( ...
[ "def", "test_serialize", "(", "self", ")", ":", "pres_req_dict", "=", "PRES_REQ", ".", "serialize", "(", ")", "pres_req_dict", ".", "pop", "(", "\"@id\"", ")", "assert", "pres_req_dict", "==", "{", "\"@type\"", ":", "PRESENTATION_REQUEST", ",", "\"request_presen...
[ 105, 4 ]
[ 119, 9 ]
python
en
['en', 'fy', 'en']
False
TestPresentationRequestSchema.test_make_model
(self)
Test making model.
Test making model.
def test_make_model(self): """Test making model.""" pres_req_dict = PRES_REQ.serialize() """ Looks like: { "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/present-proof/1.0/request-presentation", "@id": "f49773e3-bd56-4868-a5f1-456d1e6d1a16", "comment": ...
[ "def", "test_make_model", "(", "self", ")", ":", "pres_req_dict", "=", "PRES_REQ", ".", "serialize", "(", ")", "\"\"\"\n Looks like: {\n \"@type\": \"did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/present-proof/1.0/request-presentation\",\n \"@id\": \"f49773e3-bd56-4868-a...
[ 125, 4 ]
[ 145, 62 ]
python
en
['en', 'no', 'en']
True
Tickformatstop.dtickrange
(self)
range [*min*, *max*], where "min", "max" - dtick values which describe some zoom level, it is possible to omit "min" or "max" value by passing "null" The 'dtickrange' property is an info array that may be specified as: * a list or tuple of 2 elements where: (0) The...
range [*min*, *max*], where "min", "max" - dtick values which describe some zoom level, it is possible to omit "min" or "max" value by passing "null" The 'dtickrange' property is an info array that may be specified as: * a list or tuple of 2 elements where: (0) The...
def dtickrange(self): """ range [*min*, *max*], where "min", "max" - dtick values which describe some zoom level, it is possible to omit "min" or "max" value by passing "null" The 'dtickrange' property is an info array that may be specified as: * a list or tuple...
[ "def", "dtickrange", "(", "self", ")", ":", "return", "self", "[", "\"dtickrange\"", "]" ]
[ 15, 4 ]
[ 31, 33 ]
python
en
['en', 'error', 'th']
False
Tickformatstop.enabled
(self)
Determines whether or not this stop is used. If `false`, this stop is ignored even within its `dtickrange`. The 'enabled' property must be specified as a bool (either True, or False) Returns ------- bool
Determines whether or not this stop is used. If `false`, this stop is ignored even within its `dtickrange`. The 'enabled' property must be specified as a bool (either True, or False)
def enabled(self): """ Determines whether or not this stop is used. If `false`, this stop is ignored even within its `dtickrange`. The 'enabled' property must be specified as a bool (either True, or False) Returns ------- bool """ ret...
[ "def", "enabled", "(", "self", ")", ":", "return", "self", "[", "\"enabled\"", "]" ]
[ 40, 4 ]
[ 52, 30 ]
python
en
['en', 'error', 'th']
False
Tickformatstop.name
(self)
When used in a template, named items are created in the output figure in addition to any items the figure already has in this array. You can modify these items in the output figure by making your own item with `templateitemname` matching this `name` alongside your modifications ...
When used in a template, named items are created in the output figure in addition to any items the figure already has in this array. You can modify these items in the output figure by making your own item with `templateitemname` matching this `name` alongside your modifications ...
def name(self): """ When used in a template, named items are created in the output figure in addition to any items the figure already has in this array. You can modify these items in the output figure by making your own item with `templateitemname` matching this `name` al...
[ "def", "name", "(", "self", ")", ":", "return", "self", "[", "\"name\"", "]" ]
[ 61, 4 ]
[ 79, 27 ]
python
en
['en', 'error', 'th']
False
Tickformatstop.templateitemname
(self)
Used to refer to a named item in this array in the template. Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with `templateitemname` matching its `name`, alongside your modifications (includ...
Used to refer to a named item in this array in the template. Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with `templateitemname` matching its `name`, alongside your modifications (includ...
def templateitemname(self): """ Used to refer to a named item in this array in the template. Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with `templateitemname` matching its `name`, ...
[ "def", "templateitemname", "(", "self", ")", ":", "return", "self", "[", "\"templateitemname\"", "]" ]
[ 88, 4 ]
[ 107, 39 ]
python
en
['en', 'error', 'th']
False
Tickformatstop.value
(self)
string - dtickformat for described zoom level, the same as "tickformat" The 'value' property is a string and must be specified as: - A string - A number that will be converted to a string Returns ------- str
string - dtickformat for described zoom level, the same as "tickformat" The 'value' property is a string and must be specified as: - A string - A number that will be converted to a string
def value(self): """ string - dtickformat for described zoom level, the same as "tickformat" The 'value' property is a string and must be specified as: - A string - A number that will be converted to a string Returns ------- str "...
[ "def", "value", "(", "self", ")", ":", "return", "self", "[", "\"value\"", "]" ]
[ 116, 4 ]
[ 129, 28 ]
python
en
['en', 'error', 'th']
False
Tickformatstop.__init__
( self, arg=None, dtickrange=None, enabled=None, name=None, templateitemname=None, value=None, **kwargs )
Construct a new Tickformatstop object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.bar.marker.col orbar.Tickformatstop` dtickrange range [*min*, ...
Construct a new Tickformatstop object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.bar.marker.col orbar.Tickformatstop` dtickrange range [*min*, ...
def __init__( self, arg=None, dtickrange=None, enabled=None, name=None, templateitemname=None, value=None, **kwargs ): """ Construct a new Tickformatstop object Parameters ---------- arg dict...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "dtickrange", "=", "None", ",", "enabled", "=", "None", ",", "name", "=", "None", ",", "templateitemname", "=", "None", ",", "value", "=", "None", ",", "*", "*", "kwargs", ")", ":", "sup...
[ 172, 4 ]
[ 282, 34 ]
python
en
['en', 'error', 'th']
False
Title.font
(self)
Sets this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute. The 'font' property is an instance of Font that may be specified as: - An instance of :class:`plotly.graph_objs.sunburst.marker.colorbar.title.Font` ...
Sets this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute. The 'font' property is an instance of Font that may be specified as: - An instance of :class:`plotly.graph_objs.sunburst.marker.colorbar.title.Font` ...
def font(self): """ Sets this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute. The 'font' property is an instance of Font that may be specified as: - An instance of :class:`plotly.graph_objs.sunburst.mar...
[ "def", "font", "(", "self", ")", ":", "return", "self", "[", "\"font\"", "]" ]
[ 15, 4 ]
[ 53, 27 ]
python
en
['en', 'error', 'th']
False
Title.side
(self)
Determines the location of color bar's title with respect to the color bar. Note that the title's location used to be set by the now deprecated `titleside` attribute. The 'side' property is an enumeration that may be specified as: - One of the following enumeration values...
Determines the location of color bar's title with respect to the color bar. Note that the title's location used to be set by the now deprecated `titleside` attribute. The 'side' property is an enumeration that may be specified as: - One of the following enumeration values...
def side(self): """ Determines the location of color bar's title with respect to the color bar. Note that the title's location used to be set by the now deprecated `titleside` attribute. The 'side' property is an enumeration that may be specified as: - One of the f...
[ "def", "side", "(", "self", ")", ":", "return", "self", "[", "\"side\"", "]" ]
[ 62, 4 ]
[ 76, 27 ]
python
en
['en', 'error', 'th']
False
Title.text
(self)
Sets the title of the color bar. Note that before the existence of `title.text`, the title's contents used to be defined as the `title` attribute itself. This behavior has been deprecated. The 'text' property is a string and must be specified as: - A string - A ...
Sets the title of the color bar. Note that before the existence of `title.text`, the title's contents used to be defined as the `title` attribute itself. This behavior has been deprecated. The 'text' property is a string and must be specified as: - A string - A ...
def text(self): """ Sets the title of the color bar. Note that before the existence of `title.text`, the title's contents used to be defined as the `title` attribute itself. This behavior has been deprecated. The 'text' property is a string and must be specified as: ...
[ "def", "text", "(", "self", ")", ":", "return", "self", "[", "\"text\"", "]" ]
[ 85, 4 ]
[ 99, 27 ]
python
en
['en', 'error', 'th']
False
Title.__init__
(self, arg=None, font=None, side=None, text=None, **kwargs)
Construct a new Title object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.sunburst.marke r.colorbar.Title` font Sets this color bar's title font....
Construct a new Title object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.sunburst.marke r.colorbar.Title` font Sets this color bar's title font....
def __init__(self, arg=None, font=None, side=None, text=None, **kwargs): """ Construct a new Title object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.sunburst.marke ...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "font", "=", "None", ",", "side", "=", "None", ",", "text", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Title", ",", "self", ")", ".", "__init__", "(", "\"title\"", ...
[ 126, 4 ]
[ 203, 34 ]
python
en
['en', 'error', 'th']
False
MessengerAgent.observe
(self, act)
Send an agent a message through the mturk manager.
Send an agent a message through the mturk manager.
def observe(self, act): """ Send an agent a message through the mturk manager. """ if 'payload' in act: resp = self.manager.observe_payload( self.id, act['payload'], act.get('quick_replies', None), act.get('perso...
[ "def", "observe", "(", "self", ",", "act", ")", ":", "if", "'payload'", "in", "act", ":", "resp", "=", "self", ".", "manager", ".", "observe_payload", "(", "self", ".", "id", ",", "act", "[", "'payload'", "]", ",", "act", ".", "get", "(", "'quick_r...
[ 24, 4 ]
[ 51, 82 ]
python
en
['en', 'error', 'th']
False
MessengerAgent.observe_typing_on
(self, persona_id=None)
Allow agent to observe typing indicator.
Allow agent to observe typing indicator.
def observe_typing_on(self, persona_id=None): """ Allow agent to observe typing indicator. """ self.manager.message_sender.typing_on(self.id, persona_id=persona_id)
[ "def", "observe_typing_on", "(", "self", ",", "persona_id", "=", "None", ")", ":", "self", ".", "manager", ".", "message_sender", ".", "typing_on", "(", "self", ".", "id", ",", "persona_id", "=", "persona_id", ")" ]
[ 53, 4 ]
[ 57, 77 ]
python
en
['en', 'error', 'th']
False
MessengerAgent._is_image_attempt
(self, message)
Determine if a message is an image attempt. The API changes frequently so could be an image for a number of reasons.
Determine if a message is an image attempt.
def _is_image_attempt(self, message): """ Determine if a message is an image attempt. The API changes frequently so could be an image for a number of reasons. """ img_attempt = False if 'attachments' in message: img_attempt = message['attachments'][0]['type']...
[ "def", "_is_image_attempt", "(", "self", ",", "message", ")", ":", "img_attempt", "=", "False", "if", "'attachments'", "in", "message", ":", "img_attempt", "=", "message", "[", "'attachments'", "]", "[", "0", "]", "[", "'type'", "]", "==", "'image'", "elif...
[ 59, 4 ]
[ 70, 26 ]
python
en
['en', 'error', 'th']
False
MessengerAgent.put_data
(self, messenger_data)
Put data into the message queue if it hasn't already been seen.
Put data into the message queue if it hasn't already been seen.
def put_data(self, messenger_data): """ Put data into the message queue if it hasn't already been seen. """ mid = messenger_data['message']['mid'] seq = messenger_data['message'].get('seq', None) message = messenger_data['message'] if 'text' not in message: ...
[ "def", "put_data", "(", "self", ",", "messenger_data", ")", ":", "mid", "=", "messenger_data", "[", "'message'", "]", "[", "'mid'", "]", "seq", "=", "messenger_data", "[", "'message'", "]", ".", "get", "(", "'seq'", ",", "None", ")", "message", "=", "m...
[ 72, 4 ]
[ 102, 38 ]
python
en
['en', 'error', 'th']
False
MessengerAgent.act
(self, timeout=None)
Pulls a message from the message queue. If none exist returns None unless the timeout has expired.
Pulls a message from the message queue.
def act(self, timeout=None): """ Pulls a message from the message queue. If none exist returns None unless the timeout has expired. """ # if this is the first act since last sent message start timing if self.message_request_time is None: self.message_request_...
[ "def", "act", "(", "self", ",", "timeout", "=", "None", ")", ":", "# if this is the first act since last sent message start timing", "if", "self", ".", "message_request_time", "is", "None", ":", "self", ".", "message_request_time", "=", "time", ".", "time", "(", "...
[ 109, 4 ]
[ 147, 18 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.add_cmdline_args
( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None )
Add command line args.
Add command line args.
def add_cmdline_args( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None ) -> ParlaiParser: """ Add command line args. """ arg_group = parser.add_argument_group('Transresnet Arguments') TransresnetModel.add_cmdline_args(parser, partial_opt=partial_opt) ...
[ "def", "add_cmdline_args", "(", "cls", ",", "parser", ":", "ParlaiParser", ",", "partial_opt", ":", "Optional", "[", "Opt", "]", "=", "None", ")", "->", "ParlaiParser", ":", "arg_group", "=", "parser", ".", "add_argument_group", "(", "'Transresnet Arguments'", ...
[ 40, 4 ]
[ 70, 24 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.share
(self)
Share appropriate attributes.
Share appropriate attributes.
def share(self): """ Share appropriate attributes. """ shared = super().share() shared['dict'] = self.dict shared['model'] = self.model shared['personalities_list'] = self.personalities_list shared['fixed_cands'] = self.fixed_cands shared['fixed_ca...
[ "def", "share", "(", "self", ")", ":", "shared", "=", "super", "(", ")", ".", "share", "(", ")", "shared", "[", "'dict'", "]", "=", "self", ".", "dict", "shared", "[", "'model'", "]", "=", "self", ".", "model", "shared", "[", "'personalities_list'", ...
[ 121, 4 ]
[ 131, 21 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.load_personalities
(self)
Load and return the list of personalities.
Load and return the list of personalities.
def load_personalities(self): """ Load and return the list of personalities. """ personality_path = os.path.join( self.opt['datapath'], 'personality_captions/personalities.txt' ) if 'yfcc_path' not in self.opt: self.opt['yfcc_path'] = 'temp_path' ...
[ "def", "load_personalities", "(", "self", ")", ":", "personality_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "opt", "[", "'datapath'", "]", ",", "'personality_captions/personalities.txt'", ")", "if", "'yfcc_path'", "not", "in", "self", ".", ...
[ 183, 4 ]
[ 199, 20 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.observe
(self, observation)
Observe.
Observe.
def observe(self, observation): """ Observe. """ self.observation = observation return observation
[ "def", "observe", "(", "self", ",", "observation", ")", ":", "self", ".", "observation", "=", "observation", "return", "observation" ]
[ 201, 4 ]
[ 206, 26 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.act
(self)
Act.
Act.
def act(self): """ Act. """ return self.batch_act([self.observation])[0]
[ "def", "act", "(", "self", ")", ":", "return", "self", ".", "batch_act", "(", "[", "self", ".", "observation", "]", ")", "[", "0", "]" ]
[ 208, 4 ]
[ 212, 52 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.train_step
(self, valid_obs, image_feats, personalities)
Model train step. :param valid_obs: list of valid observations :param image_feats: list of image features, one per example :param personalities: list of personalities, one per example :return: the total loss, number of correct ...
Model train step.
def train_step(self, valid_obs, image_feats, personalities): """ Model train step. :param valid_obs: list of valid observations :param image_feats: list of image features, one per example :param personalities: list of personalities, one per ...
[ "def", "train_step", "(", "self", ",", "valid_obs", ",", "image_feats", ",", "personalities", ")", ":", "comments", "=", "[", "random", ".", "choice", "(", "v", "[", "'labels'", "]", ")", "for", "v", "in", "valid_obs", "]", "loss", ",", "num_correct", ...
[ 214, 4 ]
[ 235, 46 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.eval_step
(self, valid_obs, image_feats, personalities)
Model eval step. :param valid_obs: list of valid observations :param image_feats: list of image features, one per example :param personalities: list of personalities, one per example :return: the total loss, number of correct e...
Model eval step.
def eval_step(self, valid_obs, image_feats, personalities): """ Model eval step. :param valid_obs: list of valid observations :param image_feats: list of image features, one per example :param personalities: list of personalities, one per ex...
[ "def", "eval_step", "(", "self", ",", "valid_obs", ",", "image_feats", ",", "personalities", ")", ":", "med_rank", "=", "None", "chosen_captions", "=", "None", "if", "'label_candidates'", "in", "valid_obs", "[", "0", "]", "or", "self", ".", "fixed_cands", "i...
[ 237, 4 ]
[ 301, 73 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.batch_act
(self, observations)
Act on a batch of observations. :param observations: list of observations :return: A list of acts, one for each observation
Act on a batch of observations.
def batch_act(self, observations): """ Act on a batch of observations. :param observations: list of observations :return: A list of acts, one for each observation """ is_training = any(['labels' in obs for obs in observations]) valid_obs,...
[ "def", "batch_act", "(", "self", ",", "observations", ")", ":", "is_training", "=", "any", "(", "[", "'labels'", "in", "obs", "for", "obs", "in", "observations", "]", ")", "valid_obs", ",", "valid_indexes", "=", "self", ".", "filter_valid_obs", "(", "obser...
[ 303, 4 ]
[ 337, 21 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.extract_image_feats
(self, obs)
Extract image features from the observations. :param obs: list of observations :return: list of image features
Extract image features from the observations.
def extract_image_feats(self, obs): """ Extract image features from the observations. :param obs: list of observations :return: list of image features """ tmp_image_feats = [v.get('image') for v in obs] for i, im in enumerate(tmp_image_fe...
[ "def", "extract_image_feats", "(", "self", ",", "obs", ")", ":", "tmp_image_feats", "=", "[", "v", ".", "get", "(", "'image'", ")", "for", "v", "in", "obs", "]", "for", "i", ",", "im", "in", "enumerate", "(", "tmp_image_feats", ")", ":", "try", ":", ...
[ 339, 4 ]
[ 360, 26 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.filter_valid_obs
(self, observations, is_training)
Filter out invalid observations.
Filter out invalid observations.
def filter_valid_obs(self, observations, is_training): """ Filter out invalid observations. """ label_key = 'labels' if is_training else 'eval_labels' valid_obs = [] valid_indexes = [] seen_texts = set() for i in range(len(observations)): if 'i...
[ "def", "filter_valid_obs", "(", "self", ",", "observations", ",", "is_training", ")", ":", "label_key", "=", "'labels'", "if", "is_training", "else", "'eval_labels'", "valid_obs", "=", "[", "]", "valid_indexes", "=", "[", "]", "seen_texts", "=", "set", "(", ...
[ 362, 4 ]
[ 381, 39 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.update_metrics
(self, loss, num_correct, num_samples, med_rank=None)
Update Metrics. :param loss: float loss :param num_correct: number of examples for which chosen caption is correct :param num_samples: total number of examples :param med_rank: rank of correct caption for each example
Update Metrics.
def update_metrics(self, loss, num_correct, num_samples, med_rank=None): """ Update Metrics. :param loss: float loss :param num_correct: number of examples for which chosen caption is correct :param num_samples: total number of examples ...
[ "def", "update_metrics", "(", "self", ",", "loss", ",", "num_correct", ",", "num_samples", ",", "med_rank", "=", "None", ")", ":", "self", ".", "metrics", "[", "'hits@1/100'", "]", "+=", "num_correct", "self", ".", "metrics", "[", "'loss'", "]", "+=", "l...
[ 383, 4 ]
[ 400, 48 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent._setup_dict
(self)
Set up the dictionary. The pretrained model used a separate dictionary from the standard ParlAI one.
Set up the dictionary.
def _setup_dict(self): """ Set up the dictionary. The pretrained model used a separate dictionary from the standard ParlAI one. """ self.dict = DictionaryAgent(self.opt) if self.opt.get('pretrained', False): new_tok2ind = {} new_ind2tok = {} ...
[ "def", "_setup_dict", "(", "self", ")", ":", "self", ".", "dict", "=", "DictionaryAgent", "(", "self", ".", "opt", ")", "if", "self", ".", "opt", ".", "get", "(", "'pretrained'", ",", "False", ")", ":", "new_tok2ind", "=", "{", "}", "new_ind2tok", "=...
[ 402, 4 ]
[ 420, 43 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.receive_metrics
(self, metrics_dict)
Receive the metrics from validation. Unfreeze text encoder weights after a certain number of rounds without improvement. :param metrics_dict: the metrics dictionary
Receive the metrics from validation.
def receive_metrics(self, metrics_dict): """ Receive the metrics from validation. Unfreeze text encoder weights after a certain number of rounds without improvement. :param metrics_dict: the metrics dictionary """ if 'tasks' in metrics_dict: metr...
[ "def", "receive_metrics", "(", "self", ",", "metrics_dict", ")", ":", "if", "'tasks'", "in", "metrics_dict", ":", "metrics_dict", "=", "metrics_dict", "[", "'tasks'", "]", "[", "'personality_captions'", "]", "if", "self", ".", "freeze_patience", "!=", "-", "1"...
[ 422, 4 ]
[ 453, 33 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.reset
(self)
Reset metrics.
Reset metrics.
def reset(self): """ Reset metrics. """ super().reset() self.reset_metrics()
[ "def", "reset", "(", "self", ")", ":", "super", "(", ")", ".", "reset", "(", ")", "self", ".", "reset_metrics", "(", ")" ]
[ 455, 4 ]
[ 460, 28 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.reset_metrics
(self)
Reset the metrics.
Reset the metrics.
def reset_metrics(self): """ Reset the metrics. """ self.metrics['hits@1/100'] = 0.0 self.metrics['loss'] = 0.0 self.metrics['num_samples'] = 0.0 if 'med_rank' in self.metrics: self.metrics['med_rank'] = []
[ "def", "reset_metrics", "(", "self", ")", ":", "self", ".", "metrics", "[", "'hits@1/100'", "]", "=", "0.0", "self", ".", "metrics", "[", "'loss'", "]", "=", "0.0", "self", ".", "metrics", "[", "'num_samples'", "]", "=", "0.0", "if", "'med_rank'", "in"...
[ 462, 4 ]
[ 470, 41 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.report
(self)
Report the current metrics. :return: a metrics dict
Report the current metrics.
def report(self): """ Report the current metrics. :return: a metrics dict """ m = {} if self.metrics['num_samples'] > 0: m['hits@1/100'] = round_sigfigs( self.metrics['hits@1/100'] / self.metrics['num_samples'], 4 ) ...
[ "def", "report", "(", "self", ")", ":", "m", "=", "{", "}", "if", "self", ".", "metrics", "[", "'num_samples'", "]", ">", "0", ":", "m", "[", "'hits@1/100'", "]", "=", "round_sigfigs", "(", "self", ".", "metrics", "[", "'hits@1/100'", "]", "/", "se...
[ 472, 4 ]
[ 489, 16 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.save
(self, path=None)
Save the model. :param path: path for saving model
Save the model.
def save(self, path=None): """ Save the model. :param path: path for saving model """ path = self.opt.get('model_file', None) if path is None else path self.dict.save(path + '.dict', sort=False) print('Saving best model') states = {} s...
[ "def", "save", "(", "self", ",", "path", "=", "None", ")", ":", "path", "=", "self", ".", "opt", ".", "get", "(", "'model_file'", ",", "None", ")", "if", "path", "is", "None", "else", "path", "self", ".", "dict", ".", "save", "(", "path", "+", ...
[ 491, 4 ]
[ 507, 30 ]
python
en
['en', 'error', 'th']
False
TransresnetAgent.load
(self, path)
Load a model. :param path: path from which to load model
Load a model.
def load(self, path): """ Load a model. :param path: path from which to load model """ with PathManager.open(path, 'rb') as f: states = torch.load(f, map_location=lambda cpu, _: cpu) if 'model' in states: self.model.load_state_dict(sta...
[ "def", "load", "(", "self", ",", "path", ")", ":", "with", "PathManager", ".", "open", "(", "path", ",", "'rb'", ")", "as", "f", ":", "states", "=", "torch", ".", "load", "(", "f", ",", "map_location", "=", "lambda", "cpu", ",", "_", ":", "cpu", ...
[ 509, 4 ]
[ 519, 55 ]
python
en
['en', 'error', 'th']
False
round_sig
(num, sig: int)
Round num to the input number of significant figures. From https://stackoverflow.com/a/3413529.
Round num to the input number of significant figures.
def round_sig(num, sig: int): """ Round num to the input number of significant figures. From https://stackoverflow.com/a/3413529. """ return round(num, sig - int(floor(log10(abs(num)))) - 1)
[ "def", "round_sig", "(", "num", ",", "sig", ":", "int", ")", ":", "return", "round", "(", "num", ",", "sig", "-", "int", "(", "floor", "(", "log10", "(", "abs", "(", "num", ")", ")", ")", ")", "-", "1", ")" ]
[ 241, 0 ]
[ 247, 60 ]
python
en
['en', 'error', 'th']
False
AbstractTestDistillation.setup
(self)
Download models in advance so that their opt files can be used with --init-opt.
Download models in advance so that their opt files can be used with --init-opt.
def setup(self): """ Download models in advance so that their opt files can be used with --init-opt. """ seed = 0 random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) datapath = 'data' self._download_model(datapath) yield 'Setu...
[ "def", "setup", "(", "self", ")", ":", "seed", "=", "0", "random", ".", "seed", "(", "seed", ")", "np", ".", "random", ".", "seed", "(", "seed", ")", "torch", ".", "manual_seed", "(", "seed", ")", "datapath", "=", "'data'", "self", ".", "_download_...
[ 94, 4 ]
[ 107, 30 ]
python
en
['en', 'error', 'th']
False
AbstractTestDistillation._download_model
(self, datapath: str)
Download the model to calculate distillation losses from.
Download the model to calculate distillation losses from.
def _download_model(self, datapath: str): """ Download the model to calculate distillation losses from. """
[ "def", "_download_model", "(", "self", ",", "datapath", ":", "str", ")", ":" ]
[ 110, 4 ]
[ 113, 11 ]
python
en
['en', 'error', 'th']
False
AbstractTestDistillation._get_model_file
(self)
Return the model file for this model type.
Return the model file for this model type.
def _get_model_file(self) -> str: """ Return the model file for this model type. """
[ "def", "_get_model_file", "(", "self", ")", "->", "str", ":" ]
[ 116, 4 ]
[ 119, 11 ]
python
en
['en', 'error', 'th']
False
AbstractTestDistillation._get_model_opt
(self)
Return opt specifically for this model type.
Return opt specifically for this model type.
def _get_model_opt(self) -> Dict[str, str]: """ Return opt specifically for this model type. """ model_file = self._get_model_file() return { 'dict_file': f'{model_file}.dict', 'init_opt': f'{model_file}.opt', 'teacher_model': model_file, ...
[ "def", "_get_model_opt", "(", "self", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "model_file", "=", "self", ".", "_get_model_file", "(", ")", "return", "{", "'dict_file'", ":", "f'{model_file}.dict'", ",", "'init_opt'", ":", "f'{model_file}.opt'", ...
[ 121, 4 ]
[ 130, 9 ]
python
en
['en', 'error', 'th']
False
AbstractTestDistillation._get_model_identifier
(self)
Return a string identifying this model, used in output files.
Return a string identifying this model, used in output files.
def _get_model_identifier(self) -> str: """ Return a string identifying this model, used in output files. """
[ "def", "_get_model_identifier", "(", "self", ")", "->", "str", ":" ]
[ 133, 4 ]
[ 136, 11 ]
python
en
['en', 'error', 'th']
False
AbstractTestDistillation._get_agents
(self)
Return a dict of strings of agent classes specifically for this model type. 'wide_distillation' and 'narrow_distillation' keys required.
Return a dict of strings of agent classes specifically for this model type.
def _get_agents(self) -> Dict[str, str]: """ Return a dict of strings of agent classes specifically for this model type. 'wide_distillation' and 'narrow_distillation' keys required. """
[ "def", "_get_agents", "(", "self", ")", "->", "Dict", "[", "str", ",", "str", "]", ":" ]
[ 139, 4 ]
[ 144, 11 ]
python
en
['en', 'error', 'th']
False
AbstractTestDistillation.test_wide_distillation_losses
( self, setup, data_regression: DataRegressionFixture )
Check losses for a model with "wide" (DistilBART-style) distillation loss terms.
Check losses for a model with "wide" (DistilBART-style) distillation loss terms.
def test_wide_distillation_losses( self, setup, data_regression: DataRegressionFixture ): """ Check losses for a model with "wide" (DistilBART-style) distillation loss terms. """ model_name = self._get_agents()['wide_distillation'] opt = Opt( { ...
[ "def", "test_wide_distillation_losses", "(", "self", ",", "setup", ",", "data_regression", ":", "DataRegressionFixture", ")", ":", "model_name", "=", "self", ".", "_get_agents", "(", ")", "[", "'wide_distillation'", "]", "opt", "=", "Opt", "(", "{", "*", "*", ...
[ 146, 4 ]
[ 161, 86 ]
python
en
['en', 'error', 'th']
False
AbstractTestDistillation.test_narrow_distillation_losses
( self, setup, data_regression: DataRegressionFixture )
Check losses for a model with "narrow" (TinyBERT-style) distillation loss terms.
Check losses for a model with "narrow" (TinyBERT-style) distillation loss terms.
def test_narrow_distillation_losses( self, setup, data_regression: DataRegressionFixture ): """ Check losses for a model with "narrow" (TinyBERT-style) distillation loss terms. """ model_name = self._get_agents()['narrow_distillation'] opt = Opt( { ...
[ "def", "test_narrow_distillation_losses", "(", "self", ",", "setup", ",", "data_regression", ":", "DataRegressionFixture", ")", ":", "model_name", "=", "self", ".", "_get_agents", "(", ")", "[", "'narrow_distillation'", "]", "opt", "=", "Opt", "(", "{", "*", "...
[ 163, 4 ]
[ 179, 88 ]
python
en
['en', 'error', 'th']
False
AbstractTestDistillation._check_losses
( self, opt: Opt, test_name: str, data_regression: DataRegressionFixture )
Calculate and check distillation loss terms. Given the input opt, run eval and check each of the loss terms to make sure that they match what is expected.
Calculate and check distillation loss terms.
def _check_losses( self, opt: Opt, test_name: str, data_regression: DataRegressionFixture ): """ Calculate and check distillation loss terms. Given the input opt, run eval and check each of the loss terms to make sure that they match what is expected. """ val...
[ "def", "_check_losses", "(", "self", ",", "opt", ":", "Opt", ",", "test_name", ":", "str", ",", "data_regression", ":", "DataRegressionFixture", ")", ":", "valid", ",", "_", "=", "testing_utils", ".", "eval_model", "(", "opt", ",", "skip_test", "=", "True"...
[ 181, 4 ]
[ 196, 56 ]
python
en
['en', 'error', 'th']
False
SystemNoInput.func
(self)
Do nothing.
Do nothing.
def func(self): "Do nothing." pass
[ "def", "func", "(", "self", ")", ":", "pass" ]
[ 45, 4 ]
[ 47, 12 ]
python
en
['en', 'zu', 'en']
False
SystemNoMatch.func
(self)
This is given the failed raw string as input.
This is given the failed raw string as input.
def func(self): """ This is given the failed raw string as input. """ self.msg("Huh?")
[ "def", "func", "(", "self", ")", ":", "self", ".", "msg", "(", "\"Huh?\"", ")" ]
[ 61, 4 ]
[ 65, 24 ]
python
en
['en', 'error', 'th']
False
SystemMultimatch.format_multimatches
(self, caller, matches)
Format multiple command matches to a useful error. This is copied directly from the default method in evennia.commands.cmdhandler.
Format multiple command matches to a useful error.
def format_multimatches(self, caller, matches): """ Format multiple command matches to a useful error. This is copied directly from the default method in evennia.commands.cmdhandler. """ string = "There were multiple matches:" for num, match in enumerate(matches...
[ "def", "format_multimatches", "(", "self", ",", "caller", ",", "matches", ")", ":", "string", "=", "\"There were multiple matches:\"", "for", "num", ",", "match", "in", "enumerate", "(", "matches", ")", ":", "# each match is a tuple (candidate, cmd)", "candidate", "...
[ 86, 4 ]
[ 120, 21 ]
python
en
['en', 'error', 'th']
False
SystemMultimatch.func
(self)
argument to cmd is a comma-separated string of all the clashing matches.
argument to cmd is a comma-separated string of all the clashing matches.
def func(self): """ argument to cmd is a comma-separated string of all the clashing matches. """ string = self.format_multimatches(self.caller, self.matches) self.msg(string)
[ "def", "func", "(", "self", ")", ":", "string", "=", "self", ".", "format_multimatches", "(", "self", ".", "caller", ",", "self", ".", "matches", ")", "self", ".", "msg", "(", "string", ")" ]
[ 122, 4 ]
[ 128, 24 ]
python
en
['en', 'error', 'th']
False
SystemSendToChannel.func
(self)
Create a new message and send it to channel, using the already formatted input.
Create a new message and send it to channel, using the already formatted input.
def func(self): """ Create a new message and send it to channel, using the already formatted input. """ caller = self.caller channelkey, msg = self.args if not msg: caller.msg("Say what?") return channel = ChannelDB.objects.get_chan...
[ "def", "func", "(", "self", ")", ":", "caller", "=", "self", ".", "caller", "channelkey", ",", "msg", "=", "self", ".", "args", "if", "not", "msg", ":", "caller", ".", "msg", "(", "\"Say what?\"", ")", "return", "channel", "=", "ChannelDB", ".", "obj...
[ 150, 4 ]
[ 174, 27 ]
python
en
['en', 'error', 'th']
False
Font.color
(self)
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: ...
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: ...
def color(self): """ The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A name...
[ "def", "color", "(", "self", ")", ":", "return", "self", "[", "\"color\"", "]" ]
[ 15, 4 ]
[ 63, 28 ]
python
en
['en', 'error', 'th']
False
Font.family
(self)
HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts ...
HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts ...
def family(self): """ HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the prefer...
[ "def", "family", "(", "self", ")", ":", "return", "self", "[", "\"family\"", "]" ]
[ 72, 4 ]
[ 94, 29 ]
python
en
['en', 'error', 'th']
False
Font.size
(self)
The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] Returns ------- int|float
The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf]
def size(self): """ The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] Returns ------- int|float """ return self["size"]
[ "def", "size", "(", "self", ")", ":", "return", "self", "[", "\"size\"", "]" ]
[ 103, 4 ]
[ 112, 27 ]
python
en
['en', 'error', 'th']
False
Font.__init__
(self, arg=None, color=None, family=None, size=None, **kwargs)
Construct a new Font object Sets this axis' title font. Note that the title's font used to be customized by the now deprecated `titlefont` attribute. Parameters ---------- arg dict of properties compatible with this constructor or an ins...
Construct a new Font object Sets this axis' title font. Note that the title's font used to be customized by the now deprecated `titlefont` attribute.
def __init__(self, arg=None, color=None, family=None, size=None, **kwargs): """ Construct a new Font object Sets this axis' title font. Note that the title's font used to be customized by the now deprecated `titlefont` attribute. Parameters ---------- ar...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "color", "=", "None", ",", "family", "=", "None", ",", "size", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Font", ",", "self", ")", ".", "__init__", "(", "\"font\"",...
[ 143, 4 ]
[ 227, 34 ]
python
en
['en', 'error', 'th']
False
Lonaxis.dtick
(self)
Sets the graticule's longitude/latitude tick step. The 'dtick' property is a number and may be specified as: - An int or float Returns ------- int|float
Sets the graticule's longitude/latitude tick step. The 'dtick' property is a number and may be specified as: - An int or float
def dtick(self): """ Sets the graticule's longitude/latitude tick step. The 'dtick' property is a number and may be specified as: - An int or float Returns ------- int|float """ return self["dtick"]
[ "def", "dtick", "(", "self", ")", ":", "return", "self", "[", "\"dtick\"", "]" ]
[ 15, 4 ]
[ 26, 28 ]
python
en
['en', 'error', 'th']
False
Lonaxis.gridcolor
(self)
Sets the graticule's stroke color. The 'gridcolor' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,10...
Sets the graticule's stroke color. The 'gridcolor' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,10...
def gridcolor(self): """ Sets the graticule's stroke color. The 'gridcolor' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/...
[ "def", "gridcolor", "(", "self", ")", ":", "return", "self", "[", "\"gridcolor\"", "]" ]
[ 35, 4 ]
[ 85, 32 ]
python
en
['en', 'error', 'th']
False
Lonaxis.gridwidth
(self)
Sets the graticule's stroke width (in px). The 'gridwidth' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Sets the graticule's stroke width (in px). The 'gridwidth' property is a number and may be specified as: - An int or float in the interval [0, inf]
def gridwidth(self): """ Sets the graticule's stroke width (in px). The 'gridwidth' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["gridwidth"]
[ "def", "gridwidth", "(", "self", ")", ":", "return", "self", "[", "\"gridwidth\"", "]" ]
[ 94, 4 ]
[ 105, 32 ]
python
en
['en', 'error', 'th']
False
Lonaxis.range
(self)
Sets the range of this axis (in degrees), sets the map's clipped coordinates. The 'range' property is an info array that may be specified as: * a list or tuple of 2 elements where: (0) The 'range[0]' property is a number and may be specified as: - An int or float...
Sets the range of this axis (in degrees), sets the map's clipped coordinates. The 'range' property is an info array that may be specified as: * a list or tuple of 2 elements where: (0) The 'range[0]' property is a number and may be specified as: - An int or float...
def range(self): """ Sets the range of this axis (in degrees), sets the map's clipped coordinates. The 'range' property is an info array that may be specified as: * a list or tuple of 2 elements where: (0) The 'range[0]' property is a number and may be specified as:...
[ "def", "range", "(", "self", ")", ":", "return", "self", "[", "\"range\"", "]" ]
[ 114, 4 ]
[ 131, 28 ]
python
en
['en', 'error', 'th']
False
Lonaxis.showgrid
(self)
Sets whether or not graticule are shown on the map. The 'showgrid' property must be specified as a bool (either True, or False) Returns ------- bool
Sets whether or not graticule are shown on the map. The 'showgrid' property must be specified as a bool (either True, or False)
def showgrid(self): """ Sets whether or not graticule are shown on the map. The 'showgrid' property must be specified as a bool (either True, or False) Returns ------- bool """ return self["showgrid"]
[ "def", "showgrid", "(", "self", ")", ":", "return", "self", "[", "\"showgrid\"", "]" ]
[ 140, 4 ]
[ 151, 31 ]
python
en
['en', 'error', 'th']
False
Lonaxis.tick0
(self)
Sets the graticule's starting tick longitude/latitude. The 'tick0' property is a number and may be specified as: - An int or float Returns ------- int|float
Sets the graticule's starting tick longitude/latitude. The 'tick0' property is a number and may be specified as: - An int or float
def tick0(self): """ Sets the graticule's starting tick longitude/latitude. The 'tick0' property is a number and may be specified as: - An int or float Returns ------- int|float """ return self["tick0"]
[ "def", "tick0", "(", "self", ")", ":", "return", "self", "[", "\"tick0\"", "]" ]
[ 160, 4 ]
[ 171, 28 ]
python
en
['en', 'error', 'th']
False
Lonaxis.__init__
( self, arg=None, dtick=None, gridcolor=None, gridwidth=None, range=None, showgrid=None, tick0=None, **kwargs )
Construct a new Lonaxis object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.geo.Lonaxis` dtick Sets the graticule's longitude/latitude tic...
Construct a new Lonaxis object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.geo.Lonaxis` dtick Sets the graticule's longitude/latitude tic...
def __init__( self, arg=None, dtick=None, gridcolor=None, gridwidth=None, range=None, showgrid=None, tick0=None, **kwargs ): """ Construct a new Lonaxis object Parameters ---------- arg ...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "dtick", "=", "None", ",", "gridcolor", "=", "None", ",", "gridwidth", "=", "None", ",", "range", "=", "None", ",", "showgrid", "=", "None", ",", "tick0", "=", "None", ",", "*", "*", "...
[ 197, 4 ]
[ 295, 34 ]
python
en
['en', 'error', 'th']
False
ObjectSessionHandler.__init__
(self, obj)
Initializes the handler. Args: obj (Object): The object on which the handler is defined.
Initializes the handler.
def __init__(self, obj): """ Initializes the handler. Args: obj (Object): The object on which the handler is defined. """ self.obj = obj self._sessid_cache = [] self._recache()
[ "def", "__init__", "(", "self", ",", "obj", ")", ":", "self", ".", "obj", "=", "obj", "self", ".", "_sessid_cache", "=", "[", "]", "self", ".", "_recache", "(", ")" ]
[ 48, 4 ]
[ 58, 23 ]
python
en
['en', 'error', 'th']
False
ObjectSessionHandler.get
(self, sessid=None)
Get the sessions linked to this Object. Args: sessid (int, optional): A specific session id. Returns: sessions (list): The sessions connected to this object. If `sessid` is given, this is a list of one (or zero) elements. Notes: Ali...
Get the sessions linked to this Object.
def get(self, sessid=None): """ Get the sessions linked to this Object. Args: sessid (int, optional): A specific session id. Returns: sessions (list): The sessions connected to this object. If `sessid` is given, this is a list of one (or zero) el...
[ "def", "get", "(", "self", ",", "sessid", "=", "None", ")", ":", "global", "_SESSIONS", "if", "not", "_SESSIONS", ":", "from", "evennia", ".", "server", ".", "sessionhandler", "import", "SESSIONS", "as", "_SESSIONS", "if", "sessid", ":", "sessions", "=", ...
[ 71, 4 ]
[ 97, 23 ]
python
en
['en', 'error', 'th']
False
ObjectSessionHandler.all
(self)
Alias to get(), returning all sessions. Returns: sessions (list): All sessions.
Alias to get(), returning all sessions.
def all(self): """ Alias to get(), returning all sessions. Returns: sessions (list): All sessions. """ return self.get()
[ "def", "all", "(", "self", ")", ":", "return", "self", ".", "get", "(", ")" ]
[ 99, 4 ]
[ 107, 25 ]
python
en
['en', 'error', 'th']
False
ObjectSessionHandler.add
(self, session)
Add session to handler. Args: session (Session or int): Session or session id to add. Notes: We will only add a session/sessid if this actually also exists in the the core sessionhandler.
Add session to handler.
def add(self, session): """ Add session to handler. Args: session (Session or int): Session or session id to add. Notes: We will only add a session/sessid if this actually also exists in the the core sessionhandler. """ global _SESSI...
[ "def", "add", "(", "self", ",", "session", ")", ":", "global", "_SESSIONS", "if", "not", "_SESSIONS", ":", "from", "evennia", ".", "server", ".", "sessionhandler", "import", "SESSIONS", "as", "_SESSIONS", "try", ":", "sessid", "=", "session", ".", "sessid"...
[ 109, 4 ]
[ 135, 54 ]
python
en
['en', 'error', 'th']
False
ObjectSessionHandler.remove
(self, session)
Remove session from handler. Args: session (Session or int): Session or session id to remove.
Remove session from handler.
def remove(self, session): """ Remove session from handler. Args: session (Session or int): Session or session id to remove. """ try: sessid = session.sessid except AttributeError: sessid = session sessid_cache = self._sessid...
[ "def", "remove", "(", "self", ",", "session", ")", ":", "try", ":", "sessid", "=", "session", ".", "sessid", "except", "AttributeError", ":", "sessid", "=", "session", "sessid_cache", "=", "self", ".", "_sessid_cache", "if", "sessid", "in", "sessid_cache", ...
[ 137, 4 ]
[ 154, 54 ]
python
en
['en', 'error', 'th']
False
ObjectSessionHandler.clear
(self)
Clear all handled sessids.
Clear all handled sessids.
def clear(self): """ Clear all handled sessids. """ self._sessid_cache = [] self.obj.db_sessid = None self.obj.save(update_fields=["db_sessid"])
[ "def", "clear", "(", "self", ")", ":", "self", ".", "_sessid_cache", "=", "[", "]", "self", ".", "obj", ".", "db_sessid", "=", "None", "self", ".", "obj", ".", "save", "(", "update_fields", "=", "[", "\"db_sessid\"", "]", ")" ]
[ 156, 4 ]
[ 163, 50 ]
python
en
['en', 'error', 'th']
False
ObjectSessionHandler.count
(self)
Get amount of sessions connected. Returns: sesslen (int): Number of sessions handled.
Get amount of sessions connected.
def count(self): """ Get amount of sessions connected. Returns: sesslen (int): Number of sessions handled. """ return len(self._sessid_cache)
[ "def", "count", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_sessid_cache", ")" ]
[ 165, 4 ]
[ 173, 38 ]
python
en
['en', 'error', 'th']
False
DefaultObject.has_account
(self)
Convenience property for checking if an active account is currently connected to this object.
Convenience property for checking if an active account is currently connected to this object.
def has_account(self): """ Convenience property for checking if an active account is currently connected to this object. """ return self.sessions.count()
[ "def", "has_account", "(", "self", ")", ":", "return", "self", ".", "sessions", ".", "count", "(", ")" ]
[ 222, 4 ]
[ 228, 36 ]
python
en
['en', 'error', 'th']
False
DefaultObject.is_superuser
(self)
Check if user has an account, and if so, if it is a superuser.
Check if user has an account, and if so, if it is a superuser.
def is_superuser(self): """ Check if user has an account, and if so, if it is a superuser. """ return self.db_account and self.db_account.is_superuser \ and not self.db_account.attributes.get("_quell")
[ "def", "is_superuser", "(", "self", ")", ":", "return", "self", ".", "db_account", "and", "self", ".", "db_account", ".", "is_superuser", "and", "not", "self", ".", "db_account", ".", "attributes", ".", "get", "(", "\"_quell\"", ")" ]
[ 231, 4 ]
[ 237, 60 ]
python
en
['en', 'error', 'th']
False
DefaultObject.contents_get
(self, exclude=None)
Returns the contents of this object, i.e. all objects that has this object set as its location. This should be publically available. Args: exclude (Object): Object to exclude from returned contents list Returns: contents (list): List of ...
Returns the contents of this object, i.e. all objects that has this object set as its location. This should be publically available.
def contents_get(self, exclude=None): """ Returns the contents of this object, i.e. all objects that has this object set as its location. This should be publically available. Args: exclude (Object): Object to exclude from returned contents list ...
[ "def", "contents_get", "(", "self", ",", "exclude", "=", "None", ")", ":", "con", "=", "self", ".", "contents_cache", ".", "get", "(", "exclude", "=", "exclude", ")", "# print \"contents_get:\", self, con, id(self), calledby() # DEBUG", "return", "con" ]
[ 239, 4 ]
[ 258, 18 ]
python
en
['en', 'error', 'th']
False
DefaultObject.exits
(self)
Returns all exits from this object, i.e. all objects at this location having the property destination != `None`.
Returns all exits from this object, i.e. all objects at this location having the property destination != `None`.
def exits(self): """ Returns all exits from this object, i.e. all objects at this location having the property destination != `None`. """ return [exi for exi in self.contents if exi.destination]
[ "def", "exits", "(", "self", ")", ":", "return", "[", "exi", "for", "exi", "in", "self", ".", "contents", "if", "exi", ".", "destination", "]" ]
[ 262, 4 ]
[ 267, 64 ]
python
en
['en', 'error', 'th']
False
DefaultObject.get_display_name
(self, looker, **kwargs)
Displays the name of the object in a viewer-aware manner. Args: looker (TypedObject): The object or account that is looking at/getting inforamtion for this object. Returns: name (str): A string containing the name of the object, includin...
Displays the name of the object in a viewer-aware manner.
def get_display_name(self, looker, **kwargs): """ Displays the name of the object in a viewer-aware manner. Args: looker (TypedObject): The object or account that is looking at/getting inforamtion for this object. Returns: name (str): A string co...
[ "def", "get_display_name", "(", "self", ",", "looker", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "locks", ".", "check_lockstring", "(", "looker", ",", "\"perm(Builder)\"", ")", ":", "return", "\"{}(#{})\"", ".", "format", "(", "self", ".", "n...
[ 271, 4 ]
[ 294, 24 ]
python
en
['en', 'error', 'th']
False
DefaultObject.get_numbered_name
(self, count, looker, **kwargs)
Return the numbered (singular, plural) forms of this object's key. This is by default called by return_appearance and is used for grouping multiple same-named of this object. Note that this will be called on *every* member of a group even though the plural name will be only shown once. ...
Return the numbered (singular, plural) forms of this object's key. This is by default called by return_appearance and is used for grouping multiple same-named of this object. Note that this will be called on *every* member of a group even though the plural name will be only shown once. ...
def get_numbered_name(self, count, looker, **kwargs): """ Return the numbered (singular, plural) forms of this object's key. This is by default called by return_appearance and is used for grouping multiple same-named of this object. Note that this will be called on *every* member of a gr...
[ "def", "get_numbered_name", "(", "self", ",", "count", ",", "looker", ",", "*", "*", "kwargs", ")", ":", "key", "=", "kwargs", ".", "get", "(", "\"key\"", ",", "self", ".", "key", ")", "key", "=", "ansi", ".", "ANSIString", "(", "key", ")", "# this...
[ 296, 4 ]
[ 325, 31 ]
python
en
['en', 'error', 'th']
False
DefaultObject.search
(self, searchdata, global_search=False, use_nicks=True, typeclass=None, location=None, attribute_name=None, quiet=False, exact=False, candidates=None, nofound_string=None, ...
Returns an Object matching a search string/condition Perform a standard object search in the database, handling multiple results and lack thereof gracefully. By default, only objects in the current `location` of `self` or its inventory are searched for. Args: searc...
Returns an Object matching a search string/condition
def search(self, searchdata, global_search=False, use_nicks=True, typeclass=None, location=None, attribute_name=None, quiet=False, exact=False, candidates=None, nofound_string=None, ...
[ "def", "search", "(", "self", ",", "searchdata", ",", "global_search", "=", "False", ",", "use_nicks", "=", "True", ",", "typeclass", "=", "None", ",", "location", "=", "None", ",", "attribute_name", "=", "None", ",", "quiet", "=", "False", ",", "exact",...
[ 327, 4 ]
[ 456, 100 ]
python
en
['en', 'error', 'th']
False
DefaultObject.search_account
(self, searchdata, quiet=False)
Simple shortcut wrapper to search for accounts, not characters. Args: searchdata (str): Search criterion - the key or dbref of the account to search for. If this is "here" or "me", search for the account connected to this object. quiet (bool): Re...
Simple shortcut wrapper to search for accounts, not characters.
def search_account(self, searchdata, quiet=False): """ Simple shortcut wrapper to search for accounts, not characters. Args: searchdata (str): Search criterion - the key or dbref of the account to search for. If this is "here" or "me", search for the ...
[ "def", "search_account", "(", "self", ",", "searchdata", ",", "quiet", "=", "False", ")", ":", "if", "isinstance", "(", "searchdata", ",", "basestring", ")", ":", "# searchdata is a string; wrap some common self-references", "if", "searchdata", ".", "lower", "(", ...
[ 458, 4 ]
[ 491, 65 ]
python
en
['en', 'error', 'th']
False
DefaultObject.execute_cmd
(self, raw_string, session=None, **kwargs)
Do something as this object. This is never called normally, it's only used when wanting specifically to let an object be the caller of a command. It makes use of nicks of eventual connected accounts as well. Args: raw_string (string): Raw command input s...
Do something as this object. This is never called normally, it's only used when wanting specifically to let an object be the caller of a command. It makes use of nicks of eventual connected accounts as well.
def execute_cmd(self, raw_string, session=None, **kwargs): """ Do something as this object. This is never called normally, it's only used when wanting specifically to let an object be the caller of a command. It makes use of nicks of eventual connected accounts as well. ...
[ "def", "execute_cmd", "(", "self", ",", "raw_string", ",", "session", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# nick replacement - we require full-word matching.", "# do text encoding conversion", "raw_string", "=", "to_unicode", "(", "raw_string", ")", "raw_...
[ 493, 4 ]
[ 527, 102 ]
python
en
['en', 'error', 'th']
False
DefaultObject.msg
(self, text=None, from_obj=None, session=None, options=None, **kwargs)
Emits something to a session attached to the object. Args: text (str or tuple, optional): The message to send. This is treated internally like any send-command, so its value can be a tuple if sending multiple arguments to the `text` oob comma...
Emits something to a session attached to the object.
def msg(self, text=None, from_obj=None, session=None, options=None, **kwargs): """ Emits something to a session attached to the object. Args: text (str or tuple, optional): The message to send. This is treated internally like any send-command, so its ...
[ "def", "msg", "(", "self", ",", "text", "=", "None", ",", "from_obj", "=", "None", ",", "session", "=", "None", ",", "options", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# try send hooks", "if", "from_obj", ":", "for", "obj", "in", "make_iter"...
[ 529, 4 ]
[ 585, 38 ]
python
en
['en', 'error', 'th']
False
DefaultObject.for_contents
(self, func, exclude=None, **kwargs)
Runs a function on every object contained within this one. Args: func (callable): Function to call. This must have the formal call sign func(obj, **kwargs), where obj is the object currently being processed and `**kwargs` are passed on from t...
Runs a function on every object contained within this one.
def for_contents(self, func, exclude=None, **kwargs): """ Runs a function on every object contained within this one. Args: func (callable): Function to call. This must have the formal call sign func(obj, **kwargs), where obj is the object currently be...
[ "def", "for_contents", "(", "self", ",", "func", ",", "exclude", "=", "None", ",", "*", "*", "kwargs", ")", ":", "contents", "=", "self", ".", "contents", "if", "exclude", ":", "exclude", "=", "make_iter", "(", "exclude", ")", "contents", "=", "[", "...
[ 588, 4 ]
[ 608, 31 ]
python
en
['en', 'error', 'th']
False
DefaultObject.msg_contents
(self, text=None, exclude=None, from_obj=None, mapping=None, **kwargs)
Emits a message to all objects inside this object. Args: text (str or tuple): Message to send. If a tuple, this should be on the valid OOB outmessage form `(message, {kwargs})`, where kwargs are optional data passed to the `text` outputfunc. ...
Emits a message to all objects inside this object.
def msg_contents(self, text=None, exclude=None, from_obj=None, mapping=None, **kwargs): """ Emits a message to all objects inside this object. Args: text (str or tuple): Message to send. If a tuple, this should be on the valid OOB outmessage form `(message, {kwargs})...
[ "def", "msg_contents", "(", "self", ",", "text", "=", "None", ",", "exclude", "=", "None", ",", "from_obj", "=", "None", ",", "mapping", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# we also accept an outcommand on the form (message, {kwargs})", "is_outcmd"...
[ 610, 4 ]
[ 674, 78 ]
python
en
['en', 'error', 'th']
False