body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
async def pin(self, *, reason: Optional[str]=None) -> None: '|coro|\n\n Pins the message.\n\n You must have the :attr:`~Permissions.manage_messages` permission to do\n this in a non-private channel context.\n\n Parameters\n -----------\n reason: Optional[:class:`str`]\n ...
1,276,763,971,700,800,000
|coro| Pins the message. You must have the :attr:`~Permissions.manage_messages` permission to do this in a non-private channel context. Parameters ----------- reason: Optional[:class:`str`] The reason for pinning the message. Shows up on the audit log. .. versionadded:: 1.4 Raises ------- Forbidden You...
discord/message.py
pin
NQN-Discord/discord.py
python
async def pin(self, *, reason: Optional[str]=None) -> None: '|coro|\n\n Pins the message.\n\n You must have the :attr:`~Permissions.manage_messages` permission to do\n this in a non-private channel context.\n\n Parameters\n -----------\n reason: Optional[:class:`str`]\n ...
async def unpin(self, *, reason: Optional[str]=None) -> None: '|coro|\n\n Unpins the message.\n\n You must have the :attr:`~Permissions.manage_messages` permission to do\n this in a non-private channel context.\n\n Parameters\n -----------\n reason: Optional[:class:`str`]\n...
1,803,090,453,734,832,400
|coro| Unpins the message. You must have the :attr:`~Permissions.manage_messages` permission to do this in a non-private channel context. Parameters ----------- reason: Optional[:class:`str`] The reason for unpinning the message. Shows up on the audit log. .. versionadded:: 1.4 Raises ------- Forbidden ...
discord/message.py
unpin
NQN-Discord/discord.py
python
async def unpin(self, *, reason: Optional[str]=None) -> None: '|coro|\n\n Unpins the message.\n\n You must have the :attr:`~Permissions.manage_messages` permission to do\n this in a non-private channel context.\n\n Parameters\n -----------\n reason: Optional[:class:`str`]\n...
async def add_reaction(self, emoji: EmojiInputType, /) -> None: '|coro|\n\n Adds a reaction to the message.\n\n The emoji may be a unicode emoji or a custom guild :class:`Emoji`.\n\n You must have the :attr:`~Permissions.read_message_history` permission\n to use this. If nobody else has ...
-5,923,241,129,052,162,000
|coro| Adds a reaction to the message. The emoji may be a unicode emoji or a custom guild :class:`Emoji`. You must have the :attr:`~Permissions.read_message_history` permission to use this. If nobody else has reacted to the message using this emoji, the :attr:`~Permissions.add_reactions` permission is required. .. ...
discord/message.py
add_reaction
NQN-Discord/discord.py
python
async def add_reaction(self, emoji: EmojiInputType, /) -> None: '|coro|\n\n Adds a reaction to the message.\n\n The emoji may be a unicode emoji or a custom guild :class:`Emoji`.\n\n You must have the :attr:`~Permissions.read_message_history` permission\n to use this. If nobody else has ...
async def remove_reaction(self, emoji: Union[(EmojiInputType, Reaction)], member: Snowflake) -> None: '|coro|\n\n Remove a reaction by the member from the message.\n\n The emoji may be a unicode emoji or a custom guild :class:`Emoji`.\n\n If the reaction is not your own (i.e. ``member`` paramet...
3,879,932,355,644,813,000
|coro| Remove a reaction by the member from the message. The emoji may be a unicode emoji or a custom guild :class:`Emoji`. If the reaction is not your own (i.e. ``member`` parameter is not you) then the :attr:`~Permissions.manage_messages` permission is needed. The ``member`` parameter must represent a member and ...
discord/message.py
remove_reaction
NQN-Discord/discord.py
python
async def remove_reaction(self, emoji: Union[(EmojiInputType, Reaction)], member: Snowflake) -> None: '|coro|\n\n Remove a reaction by the member from the message.\n\n The emoji may be a unicode emoji or a custom guild :class:`Emoji`.\n\n If the reaction is not your own (i.e. ``member`` paramet...
async def clear_reaction(self, emoji: Union[(EmojiInputType, Reaction)]) -> None: '|coro|\n\n Clears a specific reaction from the message.\n\n The emoji may be a unicode emoji or a custom guild :class:`Emoji`.\n\n You need the :attr:`~Permissions.manage_messages` permission to use this.\n\n ...
3,887,587,292,013,516,000
|coro| Clears a specific reaction from the message. The emoji may be a unicode emoji or a custom guild :class:`Emoji`. You need the :attr:`~Permissions.manage_messages` permission to use this. .. versionadded:: 1.3 .. versionchanged:: 2.0 This function will now raise :exc:`TypeError` instead of ``InvalidAr...
discord/message.py
clear_reaction
NQN-Discord/discord.py
python
async def clear_reaction(self, emoji: Union[(EmojiInputType, Reaction)]) -> None: '|coro|\n\n Clears a specific reaction from the message.\n\n The emoji may be a unicode emoji or a custom guild :class:`Emoji`.\n\n You need the :attr:`~Permissions.manage_messages` permission to use this.\n\n ...
async def clear_reactions(self) -> None: '|coro|\n\n Removes all the reactions from the message.\n\n You need the :attr:`~Permissions.manage_messages` permission to use this.\n\n Raises\n --------\n HTTPException\n Removing the reactions failed.\n Forbidden\n ...
2,889,683,392,026,840,000
|coro| Removes all the reactions from the message. You need the :attr:`~Permissions.manage_messages` permission to use this. Raises -------- HTTPException Removing the reactions failed. Forbidden You do not have the proper permissions to remove all the reactions.
discord/message.py
clear_reactions
NQN-Discord/discord.py
python
async def clear_reactions(self) -> None: '|coro|\n\n Removes all the reactions from the message.\n\n You need the :attr:`~Permissions.manage_messages` permission to use this.\n\n Raises\n --------\n HTTPException\n Removing the reactions failed.\n Forbidden\n ...
async def create_thread(self, *, name: str, auto_archive_duration: ThreadArchiveDuration=MISSING, slowmode_delay: Optional[int]=None, reason: Optional[str]=None) -> Thread: "|coro|\n\n Creates a public thread from this message.\n\n You must have :attr:`~discord.Permissions.create_public_threads` in or...
-1,888,505,170,059,735,300
|coro| Creates a public thread from this message. You must have :attr:`~discord.Permissions.create_public_threads` in order to create a public thread from a message. The channel this message belongs in must be a :class:`TextChannel`. .. versionadded:: 2.0 Parameters ----------- name: :class:`str` The name of t...
discord/message.py
create_thread
NQN-Discord/discord.py
python
async def create_thread(self, *, name: str, auto_archive_duration: ThreadArchiveDuration=MISSING, slowmode_delay: Optional[int]=None, reason: Optional[str]=None) -> Thread: "|coro|\n\n Creates a public thread from this message.\n\n You must have :attr:`~discord.Permissions.create_public_threads` in or...
async def reply(self, content: Optional[str]=None, **kwargs: Any) -> Message: '|coro|\n\n A shortcut method to :meth:`.abc.Messageable.send` to reply to the\n :class:`.Message`.\n\n .. versionadded:: 1.6\n\n .. versionchanged:: 2.0\n This function will now raise :exc:`TypeErro...
-6,370,809,901,766,997,000
|coro| A shortcut method to :meth:`.abc.Messageable.send` to reply to the :class:`.Message`. .. versionadded:: 1.6 .. versionchanged:: 2.0 This function will now raise :exc:`TypeError` or :exc:`ValueError` instead of ``InvalidArgument``. Raises -------- ~discord.HTTPException Sending the message failed....
discord/message.py
reply
NQN-Discord/discord.py
python
async def reply(self, content: Optional[str]=None, **kwargs: Any) -> Message: '|coro|\n\n A shortcut method to :meth:`.abc.Messageable.send` to reply to the\n :class:`.Message`.\n\n .. versionadded:: 1.6\n\n .. versionchanged:: 2.0\n This function will now raise :exc:`TypeErro...
def to_reference(self, *, fail_if_not_exists: bool=True) -> MessageReference: 'Creates a :class:`~discord.MessageReference` from the current message.\n\n .. versionadded:: 1.6\n\n Parameters\n ----------\n fail_if_not_exists: :class:`bool`\n Whether replying using the message ...
-2,354,094,330,619,156,500
Creates a :class:`~discord.MessageReference` from the current message. .. versionadded:: 1.6 Parameters ---------- fail_if_not_exists: :class:`bool` Whether replying using the message reference should raise :class:`HTTPException` if the message no longer exists or Discord could not fetch the message. .. ...
discord/message.py
to_reference
NQN-Discord/discord.py
python
def to_reference(self, *, fail_if_not_exists: bool=True) -> MessageReference: 'Creates a :class:`~discord.MessageReference` from the current message.\n\n .. versionadded:: 1.6\n\n Parameters\n ----------\n fail_if_not_exists: :class:`bool`\n Whether replying using the message ...
@utils.cached_slot_property('_cs_raw_mentions') def raw_mentions(self) -> List[int]: 'List[:class:`int`]: A property that returns an array of user IDs matched with\n the syntax of ``<@user_id>`` in the message content.\n\n This allows you to receive the user IDs of mentioned users\n even in a p...
-2,450,987,508,572,274,700
List[:class:`int`]: A property that returns an array of user IDs matched with the syntax of ``<@user_id>`` in the message content. This allows you to receive the user IDs of mentioned users even in a private message context.
discord/message.py
raw_mentions
NQN-Discord/discord.py
python
@utils.cached_slot_property('_cs_raw_mentions') def raw_mentions(self) -> List[int]: 'List[:class:`int`]: A property that returns an array of user IDs matched with\n the syntax of ``<@user_id>`` in the message content.\n\n This allows you to receive the user IDs of mentioned users\n even in a p...
@utils.cached_slot_property('_cs_raw_channel_mentions') def raw_channel_mentions(self) -> List[int]: 'List[:class:`int`]: A property that returns an array of channel IDs matched with\n the syntax of ``<#channel_id>`` in the message content.\n ' return [int(x) for x in re.findall('<#([0-9]{15,20})>...
2,727,383,027,906,410,500
List[:class:`int`]: A property that returns an array of channel IDs matched with the syntax of ``<#channel_id>`` in the message content.
discord/message.py
raw_channel_mentions
NQN-Discord/discord.py
python
@utils.cached_slot_property('_cs_raw_channel_mentions') def raw_channel_mentions(self) -> List[int]: 'List[:class:`int`]: A property that returns an array of channel IDs matched with\n the syntax of ``<#channel_id>`` in the message content.\n ' return [int(x) for x in re.findall('<#([0-9]{15,20})>...
@utils.cached_slot_property('_cs_raw_role_mentions') def raw_role_mentions(self) -> List[int]: 'List[:class:`int`]: A property that returns an array of role IDs matched with\n the syntax of ``<@&role_id>`` in the message content.\n ' return [int(x) for x in re.findall('<@&([0-9]{15,20})>', self.co...
4,036,653,611,598,352,400
List[:class:`int`]: A property that returns an array of role IDs matched with the syntax of ``<@&role_id>`` in the message content.
discord/message.py
raw_role_mentions
NQN-Discord/discord.py
python
@utils.cached_slot_property('_cs_raw_role_mentions') def raw_role_mentions(self) -> List[int]: 'List[:class:`int`]: A property that returns an array of role IDs matched with\n the syntax of ``<@&role_id>`` in the message content.\n ' return [int(x) for x in re.findall('<@&([0-9]{15,20})>', self.co...
@utils.cached_slot_property('_cs_clean_content') def clean_content(self) -> str: ':class:`str`: A property that returns the content in a "cleaned up"\n manner. This basically means that mentions are transformed\n into the way the client shows it. e.g. ``<#id>`` will transform\n into ``#name``.\...
-2,081,618,440,603,724,500
:class:`str`: A property that returns the content in a "cleaned up" manner. This basically means that mentions are transformed into the way the client shows it. e.g. ``<#id>`` will transform into ``#name``. This will also transform @everyone and @here mentions into non-mentions. .. note:: This *does not* affect ...
discord/message.py
clean_content
NQN-Discord/discord.py
python
@utils.cached_slot_property('_cs_clean_content') def clean_content(self) -> str: ':class:`str`: A property that returns the content in a "cleaned up"\n manner. This basically means that mentions are transformed\n into the way the client shows it. e.g. ``<#id>`` will transform\n into ``#name``.\...
@property def created_at(self) -> datetime.datetime: ":class:`datetime.datetime`: The message's creation time in UTC." return utils.snowflake_time(self.id)
2,226,906,350,220,452,000
:class:`datetime.datetime`: The message's creation time in UTC.
discord/message.py
created_at
NQN-Discord/discord.py
python
@property def created_at(self) -> datetime.datetime: return utils.snowflake_time(self.id)
@property def edited_at(self) -> Optional[datetime.datetime]: 'Optional[:class:`datetime.datetime`]: An aware UTC datetime object containing the edited time of the message.' return self._edited_timestamp
-2,929,397,423,306,802,000
Optional[:class:`datetime.datetime`]: An aware UTC datetime object containing the edited time of the message.
discord/message.py
edited_at
NQN-Discord/discord.py
python
@property def edited_at(self) -> Optional[datetime.datetime]: return self._edited_timestamp
def is_system(self) -> bool: ':class:`bool`: Whether the message is a system message.\n\n A system message is a message that is constructed entirely by the Discord API\n in response to something.\n\n .. versionadded:: 1.3\n ' return (self.type not in (MessageType.default, MessageType...
-3,696,030,808,504,782,300
:class:`bool`: Whether the message is a system message. A system message is a message that is constructed entirely by the Discord API in response to something. .. versionadded:: 1.3
discord/message.py
is_system
NQN-Discord/discord.py
python
def is_system(self) -> bool: ':class:`bool`: Whether the message is a system message.\n\n A system message is a message that is constructed entirely by the Discord API\n in response to something.\n\n .. versionadded:: 1.3\n ' return (self.type not in (MessageType.default, MessageType...
@utils.cached_slot_property('_cs_system_content') def system_content(self) -> Optional[str]: ':class:`str`: A property that returns the content that is rendered\n regardless of the :attr:`Message.type`.\n\n In the case of :attr:`MessageType.default` and :attr:`MessageType.reply`\\,\n this just ...
-4,320,280,416,202,102,300
:class:`str`: A property that returns the content that is rendered regardless of the :attr:`Message.type`. In the case of :attr:`MessageType.default` and :attr:`MessageType.reply`\, this just returns the regular :attr:`Message.content`. Otherwise this returns an English message denoting the contents of the system mess...
discord/message.py
system_content
NQN-Discord/discord.py
python
@utils.cached_slot_property('_cs_system_content') def system_content(self) -> Optional[str]: ':class:`str`: A property that returns the content that is rendered\n regardless of the :attr:`Message.type`.\n\n In the case of :attr:`MessageType.default` and :attr:`MessageType.reply`\\,\n this just ...
async def edit(self, content: Optional[str]=MISSING, embed: Optional[Embed]=MISSING, embeds: Sequence[Embed]=MISSING, attachments: Sequence[Union[(Attachment, File)]]=MISSING, suppress: bool=False, delete_after: Optional[float]=None, allowed_mentions: Optional[AllowedMentions]=MISSING, view: Optional[View]=MISSING) -> ...
712,034,988,315,412,700
|coro| Edits the message. The content must be able to be transformed into a string via ``str(content)``. .. versionchanged:: 1.3 The ``suppress`` keyword-only parameter was added. .. versionchanged:: 2.0 Edits are no longer in-place, the newly edited message is returned instead. .. versionchanged:: 2.0 ...
discord/message.py
edit
NQN-Discord/discord.py
python
async def edit(self, content: Optional[str]=MISSING, embed: Optional[Embed]=MISSING, embeds: Sequence[Embed]=MISSING, attachments: Sequence[Union[(Attachment, File)]]=MISSING, suppress: bool=False, delete_after: Optional[float]=None, allowed_mentions: Optional[AllowedMentions]=MISSING, view: Optional[View]=MISSING) -> ...
async def add_files(self, *files: File) -> Message: "|coro|\n\n Adds new files to the end of the message attachments.\n\n .. versionadded:: 2.0\n\n Parameters\n -----------\n \\*files: :class:`File`\n New files to add to the message.\n\n Raises\n -------\n...
-3,431,482,641,138,352,600
|coro| Adds new files to the end of the message attachments. .. versionadded:: 2.0 Parameters ----------- \*files: :class:`File` New files to add to the message. Raises ------- HTTPException Editing the message failed. Forbidden Tried to edit a message that isn't yours. Returns -------- :class:`Message...
discord/message.py
add_files
NQN-Discord/discord.py
python
async def add_files(self, *files: File) -> Message: "|coro|\n\n Adds new files to the end of the message attachments.\n\n .. versionadded:: 2.0\n\n Parameters\n -----------\n \\*files: :class:`File`\n New files to add to the message.\n\n Raises\n -------\n...
async def remove_attachments(self, *attachments: Attachment) -> Message: "|coro|\n\n Removes attachments from the message.\n\n .. versionadded:: 2.0\n\n Parameters\n -----------\n \\*attachments: :class:`Attachment`\n Attachments to remove from the message.\n\n R...
1,765,899,621,065,355,500
|coro| Removes attachments from the message. .. versionadded:: 2.0 Parameters ----------- \*attachments: :class:`Attachment` Attachments to remove from the message. Raises ------- HTTPException Editing the message failed. Forbidden Tried to edit a message that isn't yours. Returns -------- :class:`Mess...
discord/message.py
remove_attachments
NQN-Discord/discord.py
python
async def remove_attachments(self, *attachments: Attachment) -> Message: "|coro|\n\n Removes attachments from the message.\n\n .. versionadded:: 2.0\n\n Parameters\n -----------\n \\*attachments: :class:`Attachment`\n Attachments to remove from the message.\n\n R...
def get_default_options(max_num_machines: int=1, max_wallclock_seconds: int=1800, with_mpi: bool=False) -> dict: 'Return an instance of the options dictionary with the minimally required parameters for a `CalcJob`.\n\n :param max_num_machines: set the number of nodes, default=1\n :param max_wallclock_seconds:...
231,383,380,334,743,800
Return an instance of the options dictionary with the minimally required parameters for a `CalcJob`. :param max_num_machines: set the number of nodes, default=1 :param max_wallclock_seconds: set the maximum number of wallclock seconds, default=1800 :param with_mpi: whether to run the calculation with MPI enabled
aiida_abinit/utils/resources.py
get_default_options
azadoks/aiida-abinit
python
def get_default_options(max_num_machines: int=1, max_wallclock_seconds: int=1800, with_mpi: bool=False) -> dict: 'Return an instance of the options dictionary with the minimally required parameters for a `CalcJob`.\n\n :param max_num_machines: set the number of nodes, default=1\n :param max_wallclock_seconds:...
def seconds_to_timelimit(seconds: int) -> str: 'Convert seconds into a Slum-notation time limit for the ABINIT flag `--timelimit`.\n\n :param seconds: time limit in seconds\n :returns: Slurm-notation time limit (hours:minutes:seconds)\n ' days = (seconds // 86400) seconds -= (days * 86400) hour...
-2,278,181,695,880,247,000
Convert seconds into a Slum-notation time limit for the ABINIT flag `--timelimit`. :param seconds: time limit in seconds :returns: Slurm-notation time limit (hours:minutes:seconds)
aiida_abinit/utils/resources.py
seconds_to_timelimit
azadoks/aiida-abinit
python
def seconds_to_timelimit(seconds: int) -> str: 'Convert seconds into a Slum-notation time limit for the ABINIT flag `--timelimit`.\n\n :param seconds: time limit in seconds\n :returns: Slurm-notation time limit (hours:minutes:seconds)\n ' days = (seconds // 86400) seconds -= (days * 86400) hour...
def get_data_type(self): '\n Get the type of the field.\n ' return Field.DATA_TYPE_STRING
-6,874,559,618,132,447,000
Get the type of the field.
splunk_eventgen/splunk_app/lib/mod_input/fields.py
get_data_type
kamaljitsingh76/eventgen
python
def get_data_type(self): '\n \n ' return Field.DATA_TYPE_STRING
def __init__(self, name, title, description, required_on_create=True, required_on_edit=False): '\n Create the field.\n\n Arguments:\n name -- Set the name of the field (e.g. "database_server")\n title -- Set the human readable title (e.g. "Database server")\n description -- Set th...
-2,107,707,271,251,261,400
Create the field. Arguments: name -- Set the name of the field (e.g. "database_server") title -- Set the human readable title (e.g. "Database server") description -- Set the human-readable description of the field (e.g. "The IP or domain name of the database server") required_on_create -- If "true", the...
splunk_eventgen/splunk_app/lib/mod_input/fields.py
__init__
kamaljitsingh76/eventgen
python
def __init__(self, name, title, description, required_on_create=True, required_on_edit=False): '\n Create the field.\n\n Arguments:\n name -- Set the name of the field (e.g. "database_server")\n title -- Set the human readable title (e.g. "Database server")\n description -- Set th...
def to_python(self, value): '\n Convert the field to a Python object. Should throw a FieldValidationException if the data is invalid.\n\n Arguments:\n value -- The value to convert\n ' return value
-3,484,464,218,273,584,600
Convert the field to a Python object. Should throw a FieldValidationException if the data is invalid. Arguments: value -- The value to convert
splunk_eventgen/splunk_app/lib/mod_input/fields.py
to_python
kamaljitsingh76/eventgen
python
def to_python(self, value): '\n Convert the field to a Python object. Should throw a FieldValidationException if the data is invalid.\n\n Arguments:\n value -- The value to convert\n ' return value
def to_string(self, value): '\n Convert the field to a string value that can be returned. Should throw a FieldValidationException if the data is\n invalid.\n\n Arguments:\n value -- The value to convert\n ' return str(value)
6,424,125,471,210,500,000
Convert the field to a string value that can be returned. Should throw a FieldValidationException if the data is invalid. Arguments: value -- The value to convert
splunk_eventgen/splunk_app/lib/mod_input/fields.py
to_string
kamaljitsingh76/eventgen
python
def to_string(self, value): '\n Convert the field to a string value that can be returned. Should throw a FieldValidationException if the data is\n invalid.\n\n Arguments:\n value -- The value to convert\n ' return str(value)
def parse_cron(self, value): 'Check for valid cron string.' fields = value.split() if ((len(fields) == 5) and all([self.cron_rx.match(i) for i in fields])): return True return False
1,671,326,357,499,886,000
Check for valid cron string.
splunk_eventgen/splunk_app/lib/mod_input/fields.py
parse_cron
kamaljitsingh76/eventgen
python
def parse_cron(self, value): fields = value.split() if ((len(fields) == 5) and all([self.cron_rx.match(i) for i in fields])): return True return False
def __init__(self, documents=None, id_range=32000, myhash=zlib.adler32, debug=True): '\n\n Parameters\n ----------\n documents : iterable of iterable of str\n Iterable of documents, if given - use them to initialization.\n id_range : int, optional\n Number of hash-v...
-2,451,617,401,247,219,700
Parameters ---------- documents : iterable of iterable of str Iterable of documents, if given - use them to initialization. id_range : int, optional Number of hash-values in table, used as `id = myhash(key) % id_range`. myhash : function Hash function, should support interface myhash(str) -> int, used `zlib...
gensim/gensim/corpora/hashdictionary.py
__init__
Abas-Khan/thesis
python
def __init__(self, documents=None, id_range=32000, myhash=zlib.adler32, debug=True): '\n\n Parameters\n ----------\n documents : iterable of iterable of str\n Iterable of documents, if given - use them to initialization.\n id_range : int, optional\n Number of hash-v...
def __getitem__(self, tokenid): 'Get all words that have mapped to the given id so far, as a set.\n\n Warnings\n --------\n Works only if `debug=True`.\n\n Parameters\n ----------\n tokenid : int\n Token identifier (result of hashing).\n\n Return\n ...
7,491,187,019,800,647,000
Get all words that have mapped to the given id so far, as a set. Warnings -------- Works only if `debug=True`. Parameters ---------- tokenid : int Token identifier (result of hashing). Return ------ set of str Set of all corresponding words.
gensim/gensim/corpora/hashdictionary.py
__getitem__
Abas-Khan/thesis
python
def __getitem__(self, tokenid): 'Get all words that have mapped to the given id so far, as a set.\n\n Warnings\n --------\n Works only if `debug=True`.\n\n Parameters\n ----------\n tokenid : int\n Token identifier (result of hashing).\n\n Return\n ...
def restricted_hash(self, token): 'Calculate id of the given token.\n Also keep track of what words were mapped to what ids, for debugging reasons.\n\n Parameters\n ----------\n token : str\n Input token.\n\n Return\n ------\n int\n Hash value o...
-3,578,973,074,447,717,400
Calculate id of the given token. Also keep track of what words were mapped to what ids, for debugging reasons. Parameters ---------- token : str Input token. Return ------ int Hash value of `token`.
gensim/gensim/corpora/hashdictionary.py
restricted_hash
Abas-Khan/thesis
python
def restricted_hash(self, token): 'Calculate id of the given token.\n Also keep track of what words were mapped to what ids, for debugging reasons.\n\n Parameters\n ----------\n token : str\n Input token.\n\n Return\n ------\n int\n Hash value o...
def __len__(self): 'Get the number of distinct ids = the entire dictionary size.' return self.id_range
3,453,205,310,461,073,400
Get the number of distinct ids = the entire dictionary size.
gensim/gensim/corpora/hashdictionary.py
__len__
Abas-Khan/thesis
python
def __len__(self): return self.id_range
def keys(self): 'Get a list of all token ids.' return range(len(self))
2,063,100,109,681,629,000
Get a list of all token ids.
gensim/gensim/corpora/hashdictionary.py
keys
Abas-Khan/thesis
python
def keys(self): return range(len(self))
def add_documents(self, documents): 'Build dictionary from a collection of documents.\n\n Notes\n -----\n This is only a convenience wrapper for calling `doc2bow` on each document with `allow_update=True`.\n\n Parameters\n ----------\n documents : iterable of list of str\n ...
4,811,325,091,924,992,000
Build dictionary from a collection of documents. Notes ----- This is only a convenience wrapper for calling `doc2bow` on each document with `allow_update=True`. Parameters ---------- documents : iterable of list of str Collection of documents. Examples -------- >>> from gensim.corpora import HashDictionary >>> >...
gensim/gensim/corpora/hashdictionary.py
add_documents
Abas-Khan/thesis
python
def add_documents(self, documents): 'Build dictionary from a collection of documents.\n\n Notes\n -----\n This is only a convenience wrapper for calling `doc2bow` on each document with `allow_update=True`.\n\n Parameters\n ----------\n documents : iterable of list of str\n ...
def doc2bow(self, document, allow_update=False, return_missing=False): 'Convert `document` into the bag-of-words format, like [(1, 4), (150, 1), (2005, 2)].\n\n Notes\n -----\n Each word is assumed to be a **tokenized and normalized** utf-8 encoded string. No further preprocessing\n is d...
-1,872,236,048,489,406,500
Convert `document` into the bag-of-words format, like [(1, 4), (150, 1), (2005, 2)]. Notes ----- Each word is assumed to be a **tokenized and normalized** utf-8 encoded string. No further preprocessing is done on the words in `document` (apply tokenization, stemming etc) before calling this method. If `allow_update` ...
gensim/gensim/corpora/hashdictionary.py
doc2bow
Abas-Khan/thesis
python
def doc2bow(self, document, allow_update=False, return_missing=False): 'Convert `document` into the bag-of-words format, like [(1, 4), (150, 1), (2005, 2)].\n\n Notes\n -----\n Each word is assumed to be a **tokenized and normalized** utf-8 encoded string. No further preprocessing\n is d...
def filter_extremes(self, no_below=5, no_above=0.5, keep_n=100000): 'Filter tokens in dictionary by frequency.\n\n Parameters\n ----------\n no_below : int, optional\n Keep tokens which are contained in at least `no_below` documents.\n no_above : float, optional\n K...
-678,942,940,960,847,700
Filter tokens in dictionary by frequency. Parameters ---------- no_below : int, optional Keep tokens which are contained in at least `no_below` documents. no_above : float, optional Keep tokens which are contained in no more than `no_above` documents (fraction of total corpus size, not an absolute number)....
gensim/gensim/corpora/hashdictionary.py
filter_extremes
Abas-Khan/thesis
python
def filter_extremes(self, no_below=5, no_above=0.5, keep_n=100000): 'Filter tokens in dictionary by frequency.\n\n Parameters\n ----------\n no_below : int, optional\n Keep tokens which are contained in at least `no_below` documents.\n no_above : float, optional\n K...
def save_as_text(self, fname): 'Save this HashDictionary to a text file.\n\n Parameters\n ----------\n fname : str\n Path to output file.\n\n Notes\n -----\n The format is:\n `id[TAB]document frequency of this id[TAB]tab-separated set of words in UTF8 that...
1,265,885,426,637,448,000
Save this HashDictionary to a text file. Parameters ---------- fname : str Path to output file. Notes ----- The format is: `id[TAB]document frequency of this id[TAB]tab-separated set of words in UTF8 that map to this id[NEWLINE]`. Examples -------- >>> from gensim.corpora import HashDictionary >>> from gensim.t...
gensim/gensim/corpora/hashdictionary.py
save_as_text
Abas-Khan/thesis
python
def save_as_text(self, fname): 'Save this HashDictionary to a text file.\n\n Parameters\n ----------\n fname : str\n Path to output file.\n\n Notes\n -----\n The format is:\n `id[TAB]document frequency of this id[TAB]tab-separated set of words in UTF8 that...
def dict_url(conf): 'Add all url from file url.ini with\n key = name of the parking end value is\n the url.\n\n :returns: dictionnary with all parking and url\n :rtype: dict\n ' url = configparser.ConfigParser() logging.debug('initializing the variable url') url.read(conf) logging.deb...
57,583,237,643,510,530
Add all url from file url.ini with key = name of the parking end value is the url. :returns: dictionnary with all parking and url :rtype: dict
backend/function_park/dict_url.py
dict_url
Mancid/data_parking_montpellier
python
def dict_url(conf): 'Add all url from file url.ini with\n key = name of the parking end value is\n the url.\n\n :returns: dictionnary with all parking and url\n :rtype: dict\n ' url = configparser.ConfigParser() logging.debug('initializing the variable url') url.read(conf) logging.deb...
def pad_batch_equal(batch, padding_values: AxesParams=0, ratio: AxesParams=0.5): '\n Pad each element of ``batch`` to obtain a correctly shaped array.\n\n References\n ----------\n `pad_to_shape`\n ' max_shapes = np.max(lmap(np.shape, batch), axis=0) if (max_shapes.size != 0): batch =...
-3,535,126,758,089,575,000
Pad each element of ``batch`` to obtain a correctly shaped array. References ---------- `pad_to_shape`
dpipe/batch_iter/utils.py
pad_batch_equal
neuro-ml/deep_pipe
python
def pad_batch_equal(batch, padding_values: AxesParams=0, ratio: AxesParams=0.5): '\n Pad each element of ``batch`` to obtain a correctly shaped array.\n\n References\n ----------\n `pad_to_shape`\n ' max_shapes = np.max(lmap(np.shape, batch), axis=0) if (max_shapes.size != 0): batch =...
def unpack_args(func: Callable, *args, **kwargs): '\n Returns a function that takes an iterable and unpacks it while calling ``func``.\n\n ``args`` and ``kwargs`` are passed to ``func`` as additional arguments.\n\n Examples\n --------\n >>> def add(x, y):\n >>> return x + y\n >>>\n >>> a...
2,034,436,781,968,058,400
Returns a function that takes an iterable and unpacks it while calling ``func``. ``args`` and ``kwargs`` are passed to ``func`` as additional arguments. Examples -------- >>> def add(x, y): >>> return x + y >>> >>> add_ = unpack_args(add) >>> add(1, 2) == add_([1, 2]) >>> True
dpipe/batch_iter/utils.py
unpack_args
neuro-ml/deep_pipe
python
def unpack_args(func: Callable, *args, **kwargs): '\n Returns a function that takes an iterable and unpacks it while calling ``func``.\n\n ``args`` and ``kwargs`` are passed to ``func`` as additional arguments.\n\n Examples\n --------\n >>> def add(x, y):\n >>> return x + y\n >>>\n >>> a...
def multiply(func: Callable, *args, **kwargs): '\n Returns a function that takes an iterable and maps ``func`` over it.\n Useful when multiple batches require the same function.\n\n ``args`` and ``kwargs`` are passed to ``func`` as additional arguments.\n ' def wrapped(xs: Iterable, *args_, **kwarg...
-8,247,229,217,920,018,000
Returns a function that takes an iterable and maps ``func`` over it. Useful when multiple batches require the same function. ``args`` and ``kwargs`` are passed to ``func`` as additional arguments.
dpipe/batch_iter/utils.py
multiply
neuro-ml/deep_pipe
python
def multiply(func: Callable, *args, **kwargs): '\n Returns a function that takes an iterable and maps ``func`` over it.\n Useful when multiple batches require the same function.\n\n ``args`` and ``kwargs`` are passed to ``func`` as additional arguments.\n ' def wrapped(xs: Iterable, *args_, **kwarg...
def apply_at(index: AxesLike, func: Callable, *args, **kwargs): '\n Returns a function that takes an iterable and applies ``func`` to the values at the corresponding ``index``.\n\n ``args`` and ``kwargs`` are passed to ``func`` as additional arguments.\n\n Examples\n --------\n >>> first_sqr = apply_...
-7,314,694,831,249,120,000
Returns a function that takes an iterable and applies ``func`` to the values at the corresponding ``index``. ``args`` and ``kwargs`` are passed to ``func`` as additional arguments. Examples -------- >>> first_sqr = apply_at(0, np.square) >>> first_sqr([3, 2, 1]) >>> (9, 2, 1)
dpipe/batch_iter/utils.py
apply_at
neuro-ml/deep_pipe
python
def apply_at(index: AxesLike, func: Callable, *args, **kwargs): '\n Returns a function that takes an iterable and applies ``func`` to the values at the corresponding ``index``.\n\n ``args`` and ``kwargs`` are passed to ``func`` as additional arguments.\n\n Examples\n --------\n >>> first_sqr = apply_...
def zip_apply(*functions: Callable, **kwargs): '\n Returns a function that takes an iterable and zips ``functions`` over it.\n\n ``kwargs`` are passed to each function as additional arguments.\n\n Examples\n --------\n >>> zipper = zip_apply(np.square, np.sqrt)\n >>> zipper([4, 9])\n >>> (16, 3...
3,684,211,283,208,276,500
Returns a function that takes an iterable and zips ``functions`` over it. ``kwargs`` are passed to each function as additional arguments. Examples -------- >>> zipper = zip_apply(np.square, np.sqrt) >>> zipper([4, 9]) >>> (16, 3)
dpipe/batch_iter/utils.py
zip_apply
neuro-ml/deep_pipe
python
def zip_apply(*functions: Callable, **kwargs): '\n Returns a function that takes an iterable and zips ``functions`` over it.\n\n ``kwargs`` are passed to each function as additional arguments.\n\n Examples\n --------\n >>> zipper = zip_apply(np.square, np.sqrt)\n >>> zipper([4, 9])\n >>> (16, 3...
def random_apply(p: float, func: Callable, *args, **kwargs): '\n Returns a function that applies ``func`` with a given probability ``p``.\n\n ``args`` and ``kwargs`` are passed to ``func`` as additional arguments.\n ' def wrapped(*args_, **kwargs_): if np.random.binomial(1, p): ret...
3,067,490,294,753,660,400
Returns a function that applies ``func`` with a given probability ``p``. ``args`` and ``kwargs`` are passed to ``func`` as additional arguments.
dpipe/batch_iter/utils.py
random_apply
neuro-ml/deep_pipe
python
def random_apply(p: float, func: Callable, *args, **kwargs): '\n Returns a function that applies ``func`` with a given probability ``p``.\n\n ``args`` and ``kwargs`` are passed to ``func`` as additional arguments.\n ' def wrapped(*args_, **kwargs_): if np.random.binomial(1, p): ret...
def sample_args(func: Callable, *args: Callable, **kwargs: Callable): '\n Returns a function that samples arguments for ``func`` from ``args`` and ``kwargs``.\n\n Each argument in ``args`` and ``kwargs`` must be a callable that samples a random value.\n\n Examples\n --------\n >>> from scipy.ndimage ...
7,986,351,789,278,345,000
Returns a function that samples arguments for ``func`` from ``args`` and ``kwargs``. Each argument in ``args`` and ``kwargs`` must be a callable that samples a random value. Examples -------- >>> from scipy.ndimage import rotate >>> >>> random_rotate = sample_args(rotate, angle=np.random.normal) >>> random_rotate(x)...
dpipe/batch_iter/utils.py
sample_args
neuro-ml/deep_pipe
python
def sample_args(func: Callable, *args: Callable, **kwargs: Callable): '\n Returns a function that samples arguments for ``func`` from ``args`` and ``kwargs``.\n\n Each argument in ``args`` and ``kwargs`` must be a callable that samples a random value.\n\n Examples\n --------\n >>> from scipy.ndimage ...
def __init__(self, group=None, load=False, *args, **kwargs): '\n Validate that group is either a string or a tuple of valid entry point groups, or if it\n is not specified use the tuple of all recognized entry point groups.\n ' valid_entry_point_groups = get_entry_point_groups() if (gro...
4,148,809,400,762,458,000
Validate that group is either a string or a tuple of valid entry point groups, or if it is not specified use the tuple of all recognized entry point groups.
aiida/cmdline/params/types/plugin.py
__init__
DanielMarchand/aiida_core
python
def __init__(self, group=None, load=False, *args, **kwargs): '\n Validate that group is either a string or a tuple of valid entry point groups, or if it\n is not specified use the tuple of all recognized entry point groups.\n ' valid_entry_point_groups = get_entry_point_groups() if (gro...
def _init_entry_points(self): '\n Populate entry point information that will be used later on. This should only be called\n once in the constructor after setting self.groups because the groups should not be changed\n after instantiation\n ' self._entry_points = [(group, entry_point)...
7,916,297,276,349,707,000
Populate entry point information that will be used later on. This should only be called once in the constructor after setting self.groups because the groups should not be changed after instantiation
aiida/cmdline/params/types/plugin.py
_init_entry_points
DanielMarchand/aiida_core
python
def _init_entry_points(self): '\n Populate entry point information that will be used later on. This should only be called\n once in the constructor after setting self.groups because the groups should not be changed\n after instantiation\n ' self._entry_points = [(group, entry_point)...
@property def has_potential_ambiguity(self): '\n Returns whether the set of supported entry point groups can lead to ambiguity when only an entry point name\n is specified. This will happen if one ore more groups share an entry point with a common name\n ' return (len(self._entry_point_name...
8,702,056,656,915,079,000
Returns whether the set of supported entry point groups can lead to ambiguity when only an entry point name is specified. This will happen if one ore more groups share an entry point with a common name
aiida/cmdline/params/types/plugin.py
has_potential_ambiguity
DanielMarchand/aiida_core
python
@property def has_potential_ambiguity(self): '\n Returns whether the set of supported entry point groups can lead to ambiguity when only an entry point name\n is specified. This will happen if one ore more groups share an entry point with a common name\n ' return (len(self._entry_point_name...
def get_valid_arguments(self): '\n Return a list of all available plugins for the groups configured for this PluginParamType instance.\n If the entry point names are not unique, because there are multiple groups that contain an entry\n point that has an identical name, we need to prefix the nam...
-4,401,533,748,211,632,000
Return a list of all available plugins for the groups configured for this PluginParamType instance. If the entry point names are not unique, because there are multiple groups that contain an entry point that has an identical name, we need to prefix the names with the full group name :returns: list of valid entry point...
aiida/cmdline/params/types/plugin.py
get_valid_arguments
DanielMarchand/aiida_core
python
def get_valid_arguments(self): '\n Return a list of all available plugins for the groups configured for this PluginParamType instance.\n If the entry point names are not unique, because there are multiple groups that contain an entry\n point that has an identical name, we need to prefix the nam...
def get_possibilities(self, incomplete=''): '\n Return a list of plugins starting with incomplete\n ' if (incomplete == ''): return self.get_valid_arguments() if self.has_potential_ambiguity: possibilites = [eps for eps in self.get_valid_arguments() if eps.startswith(incomplete...
2,020,066,774,342,964,200
Return a list of plugins starting with incomplete
aiida/cmdline/params/types/plugin.py
get_possibilities
DanielMarchand/aiida_core
python
def get_possibilities(self, incomplete=): '\n \n ' if (incomplete == ): return self.get_valid_arguments() if self.has_potential_ambiguity: possibilites = [eps for eps in self.get_valid_arguments() if eps.startswith(incomplete)] else: possibilites = [] fmt = ...
def complete(self, ctx, incomplete): '\n Return possible completions based on an incomplete value\n\n :returns: list of tuples of valid entry points (matching incomplete) and a description\n ' return [(p, '') for p in self.get_possibilities(incomplete=incomplete)]
-8,842,338,152,452,906,000
Return possible completions based on an incomplete value :returns: list of tuples of valid entry points (matching incomplete) and a description
aiida/cmdline/params/types/plugin.py
complete
DanielMarchand/aiida_core
python
def complete(self, ctx, incomplete): '\n Return possible completions based on an incomplete value\n\n :returns: list of tuples of valid entry points (matching incomplete) and a description\n ' return [(p, ) for p in self.get_possibilities(incomplete=incomplete)]
def get_entry_point_from_string(self, entry_point_string): '\n Validate a given entry point string, which means that it should have a valid entry point string format\n and that the entry point unambiguously corresponds to an entry point in the groups configured for this\n instance of PluginPara...
2,415,760,058,202,702,000
Validate a given entry point string, which means that it should have a valid entry point string format and that the entry point unambiguously corresponds to an entry point in the groups configured for this instance of PluginParameterType. :returns: the entry point if valid :raises: ValueError if the entry point string...
aiida/cmdline/params/types/plugin.py
get_entry_point_from_string
DanielMarchand/aiida_core
python
def get_entry_point_from_string(self, entry_point_string): '\n Validate a given entry point string, which means that it should have a valid entry point string format\n and that the entry point unambiguously corresponds to an entry point in the groups configured for this\n instance of PluginPara...
@decorators.with_dbenv() def convert(self, value, param, ctx): '\n Convert the string value to an entry point instance, if the value can be successfully parsed\n into an actual entry point. Will raise click.BadParameter if validation fails.\n ' if (not value): raise click.BadParamet...
-4,141,031,112,145,093,600
Convert the string value to an entry point instance, if the value can be successfully parsed into an actual entry point. Will raise click.BadParameter if validation fails.
aiida/cmdline/params/types/plugin.py
convert
DanielMarchand/aiida_core
python
@decorators.with_dbenv() def convert(self, value, param, ctx): '\n Convert the string value to an entry point instance, if the value can be successfully parsed\n into an actual entry point. Will raise click.BadParameter if validation fails.\n ' if (not value): raise click.BadParamet...
async def execute(self, query: str) -> None: "Execute an EdgeQL command (or commands).\n\n Example:\n\n .. code-block:: pycon\n\n >>> await con.execute('''\n ... CREATE TYPE MyType { CREATE PROPERTY a -> int64 };\n ... FOR x IN {100, 200, 300} UNION INSERT MyTy...
702,758,126,970,604,200
Execute an EdgeQL command (or commands). Example: .. code-block:: pycon >>> await con.execute(''' ... CREATE TYPE MyType { CREATE PROPERTY a -> int64 }; ... FOR x IN {100, 200, 300} UNION INSERT MyType { a := x }; ... ''')
edgedb/transaction.py
execute
edgedb/edgedb-python
python
async def execute(self, query: str) -> None: "Execute an EdgeQL command (or commands).\n\n Example:\n\n .. code-block:: pycon\n\n >>> await con.execute('\n ... CREATE TYPE MyType { CREATE PROPERTY a -> int64 };\n ... FOR x IN {100, 200, 300} UNION INSERT MyType...
async def start(self) -> None: 'Enter the transaction or savepoint block.' (await self._start()) self._borrow()
8,014,743,481,410,684,000
Enter the transaction or savepoint block.
edgedb/transaction.py
start
edgedb/edgedb-python
python
async def start(self) -> None: (await self._start()) self._borrow()
async def commit(self) -> None: 'Exit the transaction or savepoint block and commit changes.' if self._managed: raise errors.InterfaceError('cannot manually commit from within an `async with` block') (await self._commit())
8,287,463,235,824,175,000
Exit the transaction or savepoint block and commit changes.
edgedb/transaction.py
commit
edgedb/edgedb-python
python
async def commit(self) -> None: if self._managed: raise errors.InterfaceError('cannot manually commit from within an `async with` block') (await self._commit())
async def rollback(self) -> None: 'Exit the transaction or savepoint block and rollback changes.' if self._managed: raise errors.InterfaceError('cannot manually rollback from within an `async with` block') (await self._rollback())
-7,523,355,772,203,383,000
Exit the transaction or savepoint block and rollback changes.
edgedb/transaction.py
rollback
edgedb/edgedb-python
python
async def rollback(self) -> None: if self._managed: raise errors.InterfaceError('cannot manually rollback from within an `async with` block') (await self._rollback())
def start(self) -> None: 'Enter the transaction or savepoint block.' self._start() self._borrow()
-6,337,271,078,978,315,000
Enter the transaction or savepoint block.
edgedb/transaction.py
start
edgedb/edgedb-python
python
def start(self) -> None: self._start() self._borrow()
def commit(self) -> None: 'Exit the transaction or savepoint block and commit changes.' if self._managed: raise errors.InterfaceError('cannot manually commit from within a `with` block') self._commit()
-7,869,346,230,001,466,000
Exit the transaction or savepoint block and commit changes.
edgedb/transaction.py
commit
edgedb/edgedb-python
python
def commit(self) -> None: if self._managed: raise errors.InterfaceError('cannot manually commit from within a `with` block') self._commit()
def rollback(self) -> None: 'Exit the transaction or savepoint block and rollback changes.' if self._managed: raise errors.InterfaceError('cannot manually rollback from within a `with` block') self._rollback()
-1,726,692,286,727,184,100
Exit the transaction or savepoint block and rollback changes.
edgedb/transaction.py
rollback
edgedb/edgedb-python
python
def rollback(self) -> None: if self._managed: raise errors.InterfaceError('cannot manually rollback from within a `with` block') self._rollback()
def get_character_url(name): "Gets a character's tibia.com URL" return (url_character + urllib.parse.quote(name.encode('iso-8859-1')))
-297,893,429,502,317,060
Gets a character's tibia.com URL
NabBot-master/utils/tibia.py
get_character_url
LadyKeladry/Guardian-Bot
python
def get_character_url(name): return (url_character + urllib.parse.quote(name.encode('iso-8859-1')))
@asyncio.coroutine def get_highscores(server, category, pagenum, profession=0, tries=5): 'Gets a specific page of the highscores\n Each list element is a dictionary with the following keys: rank, name, value.\n May return ERROR_NETWORK' url = url_highscores.format(server, category, profession, pagenum) ...
-5,330,932,196,894,501,000
Gets a specific page of the highscores Each list element is a dictionary with the following keys: rank, name, value. May return ERROR_NETWORK
NabBot-master/utils/tibia.py
get_highscores
LadyKeladry/Guardian-Bot
python
@asyncio.coroutine def get_highscores(server, category, pagenum, profession=0, tries=5): 'Gets a specific page of the highscores\n Each list element is a dictionary with the following keys: rank, name, value.\n May return ERROR_NETWORK' url = url_highscores.format(server, category, profession, pagenum) ...
@asyncio.coroutine def get_server_online(server, tries=5): 'Returns a list of all the online players in current server.\n\n Each list element is a dictionary with the following keys: name, level' server = server.capitalize() url = ('https://secure.tibia.com/community/?subtopic=worlds&world=' + server) ...
-5,595,284,433,105,008,000
Returns a list of all the online players in current server. Each list element is a dictionary with the following keys: name, level
NabBot-master/utils/tibia.py
get_server_online
LadyKeladry/Guardian-Bot
python
@asyncio.coroutine def get_server_online(server, tries=5): 'Returns a list of all the online players in current server.\n\n Each list element is a dictionary with the following keys: name, level' server = server.capitalize() url = ('https://secure.tibia.com/community/?subtopic=worlds&world=' + server) ...
@asyncio.coroutine def get_guild_online(guildname, titlecase=True, tries=5): "Returns a guild's world and online member list in a dictionary.\n\n The dictionary contains the following keys: name, logo_url, world and members.\n The key members contains a list where each element is a dictionary with the followi...
-7,008,559,775,826,219,000
Returns a guild's world and online member list in a dictionary. The dictionary contains the following keys: name, logo_url, world and members. The key members contains a list where each element is a dictionary with the following keys: rank, name, title, vocation, level, joined. Guilds are case sensitive on tibia.c...
NabBot-master/utils/tibia.py
get_guild_online
LadyKeladry/Guardian-Bot
python
@asyncio.coroutine def get_guild_online(guildname, titlecase=True, tries=5): "Returns a guild's world and online member list in a dictionary.\n\n The dictionary contains the following keys: name, logo_url, world and members.\n The key members contains a list where each element is a dictionary with the followi...
@asyncio.coroutine def get_character(name, tries=5): "Returns a dictionary with a player's info\n\n The dictionary contains the following keys: name, deleted, level, vocation, world, residence,\n married, gender, guild, last,login, chars*.\n *chars is list that contains other characters in the same acc...
538,496,630,067,673,900
Returns a dictionary with a player's info The dictionary contains the following keys: name, deleted, level, vocation, world, residence, married, gender, guild, last,login, chars*. *chars is list that contains other characters in the same account (if not hidden). Each list element is dictionary with the keys: n...
NabBot-master/utils/tibia.py
get_character
LadyKeladry/Guardian-Bot
python
@asyncio.coroutine def get_character(name, tries=5): "Returns a dictionary with a player's info\n\n The dictionary contains the following keys: name, deleted, level, vocation, world, residence,\n married, gender, guild, last,login, chars*.\n *chars is list that contains other characters in the same acc...
def get_rashid_city() -> str: 'Returns the city Rashid is currently in.' offset = (get_tibia_time_zone() - get_local_timezone()) tibia_time = (datetime.now() + timedelta(hours=(offset - 10))) return ['Svargrond', 'Liberty Bay', 'Port Hope', 'Ankrahmun', 'Darashia', 'Edron', 'Carlin'][tibia_time.weekday(...
-2,082,319,499,515,995,000
Returns the city Rashid is currently in.
NabBot-master/utils/tibia.py
get_rashid_city
LadyKeladry/Guardian-Bot
python
def get_rashid_city() -> str: offset = (get_tibia_time_zone() - get_local_timezone()) tibia_time = (datetime.now() + timedelta(hours=(offset - 10))) return ['Svargrond', 'Liberty Bay', 'Port Hope', 'Ankrahmun', 'Darashia', 'Edron', 'Carlin'][tibia_time.weekday()]
def get_monster(name): "Returns a dictionary with a monster's info, if no exact match was found, it returns a list of suggestions.\n\n The dictionary has the following keys: name, id, hp, exp, maxdmg, elem_physical, elem_holy,\n elem_death, elem_fire, elem_energy, elem_ice, elem_earth, elem_drown, elem_lifedr...
-901,352,362,940,470,500
Returns a dictionary with a monster's info, if no exact match was found, it returns a list of suggestions. The dictionary has the following keys: name, id, hp, exp, maxdmg, elem_physical, elem_holy, elem_death, elem_fire, elem_energy, elem_ice, elem_earth, elem_drown, elem_lifedrain, senseinvis, arm, image.
NabBot-master/utils/tibia.py
get_monster
LadyKeladry/Guardian-Bot
python
def get_monster(name): "Returns a dictionary with a monster's info, if no exact match was found, it returns a list of suggestions.\n\n The dictionary has the following keys: name, id, hp, exp, maxdmg, elem_physical, elem_holy,\n elem_death, elem_fire, elem_energy, elem_ice, elem_earth, elem_drown, elem_lifedr...
def get_item(name): "Returns a dictionary containing an item's info, if no exact match was found, it returns a list of suggestions.\n\n The dictionary has the following keys: name, look_text, npcs_sold*, value_sell, npcs_bought*, value_buy.\n *npcs_sold and npcs_bought are list, each element is a dictiona...
-3,596,232,935,869,390,000
Returns a dictionary containing an item's info, if no exact match was found, it returns a list of suggestions. The dictionary has the following keys: name, look_text, npcs_sold*, value_sell, npcs_bought*, value_buy. *npcs_sold and npcs_bought are list, each element is a dictionary with the keys: name, city.
NabBot-master/utils/tibia.py
get_item
LadyKeladry/Guardian-Bot
python
def get_item(name): "Returns a dictionary containing an item's info, if no exact match was found, it returns a list of suggestions.\n\n The dictionary has the following keys: name, look_text, npcs_sold*, value_sell, npcs_bought*, value_buy.\n *npcs_sold and npcs_bought are list, each element is a dictiona...
def parse_tibia_time(tibia_time: str) -> datetime: 'Gets a time object from a time string from tibia.com' tibia_time = tibia_time.replace(',', '').replace('&#160;', ' ') t = time.localtime() u = time.gmtime(time.mktime(t)) local_utc_offset = (((timegm(t) - timegm(u)) / 60) / 60) tz = tibia_time[...
1,220,089,986,400,324,900
Gets a time object from a time string from tibia.com
NabBot-master/utils/tibia.py
parse_tibia_time
LadyKeladry/Guardian-Bot
python
def parse_tibia_time(tibia_time: str) -> datetime: tibia_time = tibia_time.replace(',', ).replace('&#160;', ' ') t = time.localtime() u = time.gmtime(time.mktime(t)) local_utc_offset = (((timegm(t) - timegm(u)) / 60) / 60) tz = tibia_time[(- 4):].strip() try: t = datetime.strptime(t...
def get_stats(level: int, vocation: str): 'Returns a dictionary with the stats for a character of a certain vocation and level.\n\n The dictionary has the following keys: vocation, hp, mp, cap.' try: level = int(level) except ValueError: return 'bad level' if (level <= 0): ret...
-2,773,699,681,780,761,000
Returns a dictionary with the stats for a character of a certain vocation and level. The dictionary has the following keys: vocation, hp, mp, cap.
NabBot-master/utils/tibia.py
get_stats
LadyKeladry/Guardian-Bot
python
def get_stats(level: int, vocation: str): 'Returns a dictionary with the stats for a character of a certain vocation and level.\n\n The dictionary has the following keys: vocation, hp, mp, cap.' try: level = int(level) except ValueError: return 'bad level' if (level <= 0): ret...
def get_share_range(level: int): 'Returns the share range for a specific level\n\n The returned value is a list with the lower limit and the upper limit in that order.' return (int(round(((level * 2) / 3), 0)), int(round(((level * 3) / 2), 0)))
-468,969,052,756,241,660
Returns the share range for a specific level The returned value is a list with the lower limit and the upper limit in that order.
NabBot-master/utils/tibia.py
get_share_range
LadyKeladry/Guardian-Bot
python
def get_share_range(level: int): 'Returns the share range for a specific level\n\n The returned value is a list with the lower limit and the upper limit in that order.' return (int(round(((level * 2) / 3), 0)), int(round(((level * 3) / 2), 0)))
def get_spell(name): "Returns a dictionary containing a spell's info, a list of possible matches or None" c = tibiaDatabase.cursor() try: c.execute('SELECT * FROM Spells WHERE words LIKE ? OR name LIKE ? ORDER BY LENGTH(name) LIMIT 15', ((('%' + name) + '%'), (('%' + name) + '%'))) result = ...
-1,031,592,425,114,744,700
Returns a dictionary containing a spell's info, a list of possible matches or None
NabBot-master/utils/tibia.py
get_spell
LadyKeladry/Guardian-Bot
python
def get_spell(name): c = tibiaDatabase.cursor() try: c.execute('SELECT * FROM Spells WHERE words LIKE ? OR name LIKE ? ORDER BY LENGTH(name) LIMIT 15', ((('%' + name) + '%'), (('%' + name) + '%'))) result = c.fetchall() if (len(result) == 0): return None elif ((r...
def get_npc(name): "Returns a dictionary containing a NPC's info, a list of possible matches or None" c = tibiaDatabase.cursor() try: c.execute('SELECT * FROM NPCs WHERE title LIKE ? ORDER BY LENGTH(title) ASC LIMIT 15', ((('%' + name) + '%'),)) result = c.fetchall() if (len(result) ...
5,319,743,790,913,926,000
Returns a dictionary containing a NPC's info, a list of possible matches or None
NabBot-master/utils/tibia.py
get_npc
LadyKeladry/Guardian-Bot
python
def get_npc(name): c = tibiaDatabase.cursor() try: c.execute('SELECT * FROM NPCs WHERE title LIKE ? ORDER BY LENGTH(title) ASC LIMIT 15', ((('%' + name) + '%'),)) result = c.fetchall() if (len(result) == 0): return None elif ((result[0]['title'].lower() == name.l...
@asyncio.coroutine def get_house(name, world=None): "Returns a dictionary containing a house's info, a list of possible matches or None.\n\n If world is specified, it will also find the current status of the house in that world." c = tibiaDatabase.cursor() try: c.execute('SELECT * FROM Houses WHE...
6,161,030,971,851,621,000
Returns a dictionary containing a house's info, a list of possible matches or None. If world is specified, it will also find the current status of the house in that world.
NabBot-master/utils/tibia.py
get_house
LadyKeladry/Guardian-Bot
python
@asyncio.coroutine def get_house(name, world=None): "Returns a dictionary containing a house's info, a list of possible matches or None.\n\n If world is specified, it will also find the current status of the house in that world." c = tibiaDatabase.cursor() try: c.execute('SELECT * FROM Houses WHE...
def get_achievement(name): 'Returns an achievement (dictionary), a list of possible matches or none' c = tibiaDatabase.cursor() try: c.execute('SELECT * FROM Achievements WHERE name LIKE ? ORDER BY LENGTH(name) ASC LIMIT 15', ((('%' + name) + '%'),)) result = c.fetchall() if (len(res...
-7,458,789,280,913,675,000
Returns an achievement (dictionary), a list of possible matches or none
NabBot-master/utils/tibia.py
get_achievement
LadyKeladry/Guardian-Bot
python
def get_achievement(name): c = tibiaDatabase.cursor() try: c.execute('SELECT * FROM Achievements WHERE name LIKE ? ORDER BY LENGTH(name) ASC LIMIT 15', ((('%' + name) + '%'),)) result = c.fetchall() if (len(result) == 0): return None elif ((result[0]['name'].lowe...
def get_tibia_time_zone() -> int: "Returns Germany's timezone, considering their daylight saving time dates" gt = (datetime.utcnow() + timedelta(hours=1)) germany_date = date(gt.year, gt.month, gt.day) dst_start = date(gt.year, 3, (31 - (int((((5 * gt.year) / 4) + 4)) % int(7)))) dst_end = date(gt.y...
4,995,092,581,345,460,000
Returns Germany's timezone, considering their daylight saving time dates
NabBot-master/utils/tibia.py
get_tibia_time_zone
LadyKeladry/Guardian-Bot
python
def get_tibia_time_zone() -> int: gt = (datetime.utcnow() + timedelta(hours=1)) germany_date = date(gt.year, gt.month, gt.day) dst_start = date(gt.year, 3, (31 - (int((((5 * gt.year) / 4) + 4)) % int(7)))) dst_end = date(gt.year, 10, (31 - (int((((5 * gt.year) / 4) + 1)) % int(7)))) if (dst_sta...
def get_voc_abb(vocation: str) -> str: 'Given a vocation name, it returns an abbreviated string' abbrev = {'none': 'N', 'druid': 'D', 'sorcerer': 'S', 'paladin': 'P', 'knight': 'K', 'elder druid': 'ED', 'master sorcerer': 'MS', 'royal paladin': 'RP', 'elite knight': 'EK'} try: return abbrev[vocation...
5,079,631,086,416,907,000
Given a vocation name, it returns an abbreviated string
NabBot-master/utils/tibia.py
get_voc_abb
LadyKeladry/Guardian-Bot
python
def get_voc_abb(vocation: str) -> str: abbrev = {'none': 'N', 'druid': 'D', 'sorcerer': 'S', 'paladin': 'P', 'knight': 'K', 'elder druid': 'ED', 'master sorcerer': 'MS', 'royal paladin': 'RP', 'elite knight': 'EK'} try: return abbrev[vocation.lower()] except KeyError: return 'N'
def get_voc_emoji(vocation: str) -> str: 'Given a vocation name, returns a emoji representing it' emoji = {'none': EMOJI[':hatching_chick:'], 'druid': EMOJI[':snowflake:'], 'sorcerer': EMOJI[':flame:'], 'paladin': EMOJI[':archery:'], 'knight': EMOJI[':shield:'], 'elder druid': EMOJI[':snowflake:'], 'master sorc...
-3,352,309,903,081,343,000
Given a vocation name, returns a emoji representing it
NabBot-master/utils/tibia.py
get_voc_emoji
LadyKeladry/Guardian-Bot
python
def get_voc_emoji(vocation: str) -> str: emoji = {'none': EMOJI[':hatching_chick:'], 'druid': EMOJI[':snowflake:'], 'sorcerer': EMOJI[':flame:'], 'paladin': EMOJI[':archery:'], 'knight': EMOJI[':shield:'], 'elder druid': EMOJI[':snowflake:'], 'master sorcerer': EMOJI[':flame:'], 'royal paladin': EMOJI[':archer...
def get_pronouns(gender: str): 'Gets a list of pronouns based on the gender given. Only binary genders supported, sorry.' gender = gender.lower() if (gender == 'female'): pronoun = ['she', 'her', 'her'] elif (gender == 'male'): pronoun = ['he', 'his', 'him'] else: pronoun = [...
5,217,491,315,904,803,000
Gets a list of pronouns based on the gender given. Only binary genders supported, sorry.
NabBot-master/utils/tibia.py
get_pronouns
LadyKeladry/Guardian-Bot
python
def get_pronouns(gender: str): gender = gender.lower() if (gender == 'female'): pronoun = ['she', 'her', 'her'] elif (gender == 'male'): pronoun = ['he', 'his', 'him'] else: pronoun = ['it', 'its', 'it'] return pronoun
def get_map_area(x, y, z, size=15, scale=8, crosshair=True): 'Gets a minimap picture of a map area\n\n size refers to the radius of the image in actual tibia sqm\n scale is how much the image will be streched (1 = 1 sqm = 1 pixel)' c = tibiaDatabase.cursor() c.execute('SELECT * FROM WorldMap WHERE z L...
-2,065,824,990,881,618,000
Gets a minimap picture of a map area size refers to the radius of the image in actual tibia sqm scale is how much the image will be streched (1 = 1 sqm = 1 pixel)
NabBot-master/utils/tibia.py
get_map_area
LadyKeladry/Guardian-Bot
python
def get_map_area(x, y, z, size=15, scale=8, crosshair=True): 'Gets a minimap picture of a map area\n\n size refers to the radius of the image in actual tibia sqm\n scale is how much the image will be streched (1 = 1 sqm = 1 pixel)' c = tibiaDatabase.cursor() c.execute('SELECT * FROM WorldMap WHERE z L...
async def http_request_handler(request: HttpRequest) -> HttpResponse: 'Handle the request' return (await Jinja2TemplateProvider.apply(request, 'example1.html', {'name': 'rob'}))
559,925,934,568,345,540
Handle the request
examples/example1.py
http_request_handler
rob-blackbourn/bareASGI-jinja2
python
async def http_request_handler(request: HttpRequest) -> HttpResponse: return (await Jinja2TemplateProvider.apply(request, 'example1.html', {'name': 'rob'}))
async def handle_no_template(request: HttpRequest) -> HttpResponse: 'This is what happens if there is no template' return (await Jinja2TemplateProvider.apply(request, 'notemplate.html', {'name': 'rob'}))
3,969,731,022,605,455,000
This is what happens if there is no template
examples/example1.py
handle_no_template
rob-blackbourn/bareASGI-jinja2
python
async def handle_no_template(request: HttpRequest) -> HttpResponse: return (await Jinja2TemplateProvider.apply(request, 'notemplate.html', {'name': 'rob'}))
@staticmethod def wait_key(message=''): ' Wait for a key press on the console and return it. ' if (message != ''): print(message) result = None if (os.name == 'nt'): import msvcrt result = msvcrt.getch() else: import termios fd = sys.stdin.fileno() old...
-3,410,446,983,536,551,400
Wait for a key press on the console and return it.
run_demo.py
wait_key
ybettan/AirSimTensorFlow
python
@staticmethod def wait_key(message=): ' ' if (message != ): print(message) result = None if (os.name == 'nt'): import msvcrt result = msvcrt.getch() else: import termios fd = sys.stdin.fileno() oldterm = termios.tcgetattr(fd) newattr = termios...
@staticmethod def read_pfm(file): ' Read a pfm file ' file = open(file, 'rb') color = None width = None height = None scale = None endian = None header = file.readline().rstrip() header = str(bytes.decode(header, encoding='utf-8')) if (header == 'PF'): color = True el...
-9,088,422,383,959,874,000
Read a pfm file
run_demo.py
read_pfm
ybettan/AirSimTensorFlow
python
@staticmethod def read_pfm(file): ' ' file = open(file, 'rb') color = None width = None height = None scale = None endian = None header = file.readline().rstrip() header = str(bytes.decode(header, encoding='utf-8')) if (header == 'PF'): color = True elif (header == '...
@staticmethod def write_pfm(file, image, scale=1): ' Write a pfm file ' file = open(file, 'wb') color = None if (image.dtype.name != 'float32'): raise Exception('Image dtype must be float32.') image = np.flipud(image) if ((len(image.shape) == 3) and (image.shape[2] == 3)): color ...
-2,485,777,137,442,465,000
Write a pfm file
run_demo.py
write_pfm
ybettan/AirSimTensorFlow
python
@staticmethod def write_pfm(file, image, scale=1): ' ' file = open(file, 'wb') color = None if (image.dtype.name != 'float32'): raise Exception('Image dtype must be float32.') image = np.flipud(image) if ((len(image.shape) == 3) and (image.shape[2] == 3)): color = True elif ...
@staticmethod def write_png(filename, image): ' image must be numpy array H X W X channels\n ' import zlib, struct buf = image.flatten().tobytes() width = image.shape[1] height = image.shape[0] width_byte_4 = (width * 4) raw_data = b''.join(((b'\x00' + buf[span:(span + width_byte_4)])...
-8,640,846,976,574,449,000
image must be numpy array H X W X channels
run_demo.py
write_png
ybettan/AirSimTensorFlow
python
@staticmethod def write_png(filename, image): ' \n ' import zlib, struct buf = image.flatten().tobytes() width = image.shape[1] height = image.shape[0] width_byte_4 = (width * 4) raw_data = b.join(((b'\x00' + buf[span:(span + width_byte_4)]) for span in range(((height - 1) * width_byt...
def __init__(self, chainlen=2): '\n Building the dictionary\n ' if ((chainlen > 10) or (chainlen < 1)): print('Chain length must be between 1 and 10, inclusive') sys.exit(0) self.mcd = Mdict() oldnames = [] self.chainlen = chainlen for l in PLACES: l = l.str...
-8,257,344,179,054,929,000
Building the dictionary
lib/markov_usernames.py
__init__
doc22940/Bash-Utils
python
def __init__(self, chainlen=2): '\n \n ' if ((chainlen > 10) or (chainlen < 1)): print('Chain length must be between 1 and 10, inclusive') sys.exit(0) self.mcd = Mdict() oldnames = [] self.chainlen = chainlen for l in PLACES: l = l.strip() oldnames.a...
def New(self): '\n New name from the Markov chain\n ' prefix = (' ' * self.chainlen) name = '' suffix = '' while True: suffix = self.mcd.get_suffix(prefix) if ((suffix == '\n') or (len(name) > 9)): break else: name = (name + suffix) ...
-3,993,756,492,327,136,000
New name from the Markov chain
lib/markov_usernames.py
New
doc22940/Bash-Utils
python
def New(self): '\n \n ' prefix = (' ' * self.chainlen) name = suffix = while True: suffix = self.mcd.get_suffix(prefix) if ((suffix == '\n') or (len(name) > 9)): break else: name = (name + suffix) prefix = (prefix[1:] + suff...
def __eq__(self, *args, **kwargs): ' Return self==value. ' pass
6,816,163,063,501,262,000
Return self==value.
_pycharm_skeletons/renderdoc/BlendStats.py
__eq__
Lex-DRL/renderdoc-py-stubs
python
def __eq__(self, *args, **kwargs): ' ' pass
def __ge__(self, *args, **kwargs): ' Return self>=value. ' pass
-6,967,964,760,159,473,000
Return self>=value.
_pycharm_skeletons/renderdoc/BlendStats.py
__ge__
Lex-DRL/renderdoc-py-stubs
python
def __ge__(self, *args, **kwargs): ' ' pass
def __gt__(self, *args, **kwargs): ' Return self>value. ' pass
-2,387,978,140,579,432,400
Return self>value.
_pycharm_skeletons/renderdoc/BlendStats.py
__gt__
Lex-DRL/renderdoc-py-stubs
python
def __gt__(self, *args, **kwargs): ' ' pass
def __hash__(self, *args, **kwargs): ' Return hash(self). ' pass
7,522,954,561,806,290,000
Return hash(self).
_pycharm_skeletons/renderdoc/BlendStats.py
__hash__
Lex-DRL/renderdoc-py-stubs
python
def __hash__(self, *args, **kwargs): ' ' pass
def __le__(self, *args, **kwargs): ' Return self<=value. ' pass
555,903,605,434,510,850
Return self<=value.
_pycharm_skeletons/renderdoc/BlendStats.py
__le__
Lex-DRL/renderdoc-py-stubs
python
def __le__(self, *args, **kwargs): ' ' pass
def __lt__(self, *args, **kwargs): ' Return self<value. ' pass
-1,514,029,532,418,184,000
Return self<value.
_pycharm_skeletons/renderdoc/BlendStats.py
__lt__
Lex-DRL/renderdoc-py-stubs
python
def __lt__(self, *args, **kwargs): ' ' pass
@staticmethod def __new__(*args, **kwargs): ' Create and return a new object. See help(type) for accurate signature. ' pass
-659,758,195,336,737,200
Create and return a new object. See help(type) for accurate signature.
_pycharm_skeletons/renderdoc/BlendStats.py
__new__
Lex-DRL/renderdoc-py-stubs
python
@staticmethod def __new__(*args, **kwargs): ' ' pass
def __ne__(self, *args, **kwargs): ' Return self!=value. ' pass
-3,179,579,680,757,598,000
Return self!=value.
_pycharm_skeletons/renderdoc/BlendStats.py
__ne__
Lex-DRL/renderdoc-py-stubs
python
def __ne__(self, *args, **kwargs): ' ' pass
def test_displacy_parse_ents(en_vocab): "Test that named entities on a Doc are converted into displaCy's format." doc = Doc(en_vocab, words=['But', 'Google', 'is', 'starting', 'from', 'behind']) doc.ents = [Span(doc, 1, 2, label=doc.vocab.strings['ORG'])] ents = displacy.parse_ents(doc) assert isins...
-7,496,353,557,940,837,000
Test that named entities on a Doc are converted into displaCy's format.
spacy/tests/test_displacy.py
test_displacy_parse_ents
xettrisomeman/spaCy
python
def test_displacy_parse_ents(en_vocab): doc = Doc(en_vocab, words=['But', 'Google', 'is', 'starting', 'from', 'behind']) doc.ents = [Span(doc, 1, 2, label=doc.vocab.strings['ORG'])] ents = displacy.parse_ents(doc) assert isinstance(ents, dict) assert (ents['text'] == 'But Google is starting fro...
def test_displacy_parse_ents_with_kb_id_options(en_vocab): "Test that named entities with kb_id on a Doc are converted into displaCy's format." doc = Doc(en_vocab, words=['But', 'Google', 'is', 'starting', 'from', 'behind']) doc.ents = [Span(doc, 1, 2, label=doc.vocab.strings['ORG'], kb_id='Q95')] ents ...
-5,475,753,648,586,574,000
Test that named entities with kb_id on a Doc are converted into displaCy's format.
spacy/tests/test_displacy.py
test_displacy_parse_ents_with_kb_id_options
xettrisomeman/spaCy
python
def test_displacy_parse_ents_with_kb_id_options(en_vocab): doc = Doc(en_vocab, words=['But', 'Google', 'is', 'starting', 'from', 'behind']) doc.ents = [Span(doc, 1, 2, label=doc.vocab.strings['ORG'], kb_id='Q95')] ents = displacy.parse_ents(doc, {'kb_url_template': 'https://www.wikidata.org/wiki/{}'}) ...
def test_displacy_parse_deps(en_vocab): "Test that deps and tags on a Doc are converted into displaCy's format." words = ['This', 'is', 'a', 'sentence'] heads = [1, 1, 3, 1] pos = ['DET', 'VERB', 'DET', 'NOUN'] tags = ['DT', 'VBZ', 'DT', 'NN'] deps = ['nsubj', 'ROOT', 'det', 'attr'] doc = Do...
5,578,797,609,663,022,000
Test that deps and tags on a Doc are converted into displaCy's format.
spacy/tests/test_displacy.py
test_displacy_parse_deps
xettrisomeman/spaCy
python
def test_displacy_parse_deps(en_vocab): words = ['This', 'is', 'a', 'sentence'] heads = [1, 1, 3, 1] pos = ['DET', 'VERB', 'DET', 'NOUN'] tags = ['DT', 'VBZ', 'DT', 'NN'] deps = ['nsubj', 'ROOT', 'det', 'attr'] doc = Doc(en_vocab, words=words, heads=heads, pos=pos, tags=tags, deps=deps) ...
def test_displacy_spans(en_vocab): 'Test that displaCy can render Spans.' doc = Doc(en_vocab, words=['But', 'Google', 'is', 'starting', 'from', 'behind']) doc.ents = [Span(doc, 1, 2, label=doc.vocab.strings['ORG'])] html = displacy.render(doc[1:4], style='ent') assert html.startswith('<div')
3,441,236,095,723,474,000
Test that displaCy can render Spans.
spacy/tests/test_displacy.py
test_displacy_spans
xettrisomeman/spaCy
python
def test_displacy_spans(en_vocab): doc = Doc(en_vocab, words=['But', 'Google', 'is', 'starting', 'from', 'behind']) doc.ents = [Span(doc, 1, 2, label=doc.vocab.strings['ORG'])] html = displacy.render(doc[1:4], style='ent') assert html.startswith('<div')
def test_displacy_render_wrapper(en_vocab): 'Test that displaCy accepts custom rendering wrapper.' def wrapper(html): return (('TEST' + html) + 'TEST') displacy.set_render_wrapper(wrapper) doc = Doc(en_vocab, words=['But', 'Google', 'is', 'starting', 'from', 'behind']) doc.ents = [Span(doc,...
-3,702,502,177,086,248,400
Test that displaCy accepts custom rendering wrapper.
spacy/tests/test_displacy.py
test_displacy_render_wrapper
xettrisomeman/spaCy
python
def test_displacy_render_wrapper(en_vocab): def wrapper(html): return (('TEST' + html) + 'TEST') displacy.set_render_wrapper(wrapper) doc = Doc(en_vocab, words=['But', 'Google', 'is', 'starting', 'from', 'behind']) doc.ents = [Span(doc, 1, 2, label=doc.vocab.strings['ORG'])] html = dis...