text stringlengths 81 112k |
|---|
Retrieve a list of all uncommitted changes on the device.
Requires PANOS version 8.0.0 or greater.
CLI Example:
.. code-block:: bash
salt '*' panos.get_uncommitted_changes
def get_uncommitted_changes():
'''
Retrieve a list of all uncommitted changes on the device.
Requires PANOS vers... |
Install anti-virus packages.
Args:
version(str): The version of the PANOS file to install.
latest(bool): If true, the latest anti-virus file will be installed.
The specified version option will be ignored.
synch(bool): If true, the anti-virus will synch to the peer u... |
Force refreshes all FQDNs used in rules.
force
Forces all fqdn refresh
CLI Example:
.. code-block:: bash
salt '*' panos.refresh_fqdn_cache
salt '*' panos.refresh_fqdn_cache force=True
def refresh_fqdn_cache(force=False):
'''
Force refreshes all FQDNs used in rules.
... |
Resolve address to ip address.
Required version 7.0.0 or greater.
address
Address name you want to resolve.
vsys
The vsys name.
CLI Example:
.. code-block:: bash
salt '*' panos.resolve_address foo.bar.com
salt '*' panos.resolve_address foo.bar.com vsys=2
def res... |
Set the authentication profile of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
profile (str): The name of the authentication profile to set.
deploy (bool): If true then commit the full candidate configuration, if false only set pending cha... |
Set the hostname of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
hostname (str): The hostname to set
deploy (bool): If true then commit the full candidate configuration, if false only set pending change.
.. code-block:: bash
... |
Enables or disables the ICMP management service on the device.
CLI Example:
Args:
enabled (bool): If true the service will be enabled. If false the service will be disabled.
deploy (bool): If true then commit the full candidate configuration, if false only set pending change.
.. code-blo... |
Set the NTP authentication of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
target(str): Determines the target of the authentication. Valid options are primary, secondary, or both.
authentication_type(str): The authentication type to be use... |
Set the NTP servers of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
primary_server(str): The primary NTP server IP address or FQDN.
secondary_server(str): The secondary NTP server IP address or FQDN.
deploy (bool): If true then co... |
Add an IPv4 address or network to the permitted IP list.
CLI Example:
Args:
address (str): The IPv4 address or network to allow access to add to the Palo Alto device.
deploy (bool): If true then commit the full candidate configuration, if false only set pending change.
.. code-block:: ba... |
Set the timezone of the Palo Alto proxy minion. A commit will be required before this is processed.
CLI Example:
Args:
tz (str): The name of the timezone to set.
deploy (bool): If true then commit the full candidate configuration, if false only set pending change.
.. code-block:: bash
... |
Ensure a Vault policy with the given name and rules is present.
name
The name of the policy
rules
Rules formatted as in-line HCL
.. code-block:: yaml
demo-policy:
vault.policy_present:
- name: foo/bar
- rules: |
path "secret/top-... |
Write the return data to a file on the minion.
def returner(ret):
'''
Write the return data to a file on the minion.
'''
opts = _get_options(ret)
try:
with salt.utils.files.flopen(opts['filename'], 'a') as logfile:
salt.utils.json.dump(ret, logfile)
logfile.write(str... |
Write event data (return data and non-return data) to file on the master.
def event_return(events):
'''
Write event data (return data and non-return data) to file on the master.
'''
if not events:
# events is an empty list.
# Don't open the logfile in vain.
return
opts = _ge... |
Turn the layout data into usable vdevs spedcification
We need to support 2 ways of passing the layout:
.. code::
layout_new:
- mirror:
- disk0
- disk1
- mirror:
- disk2
- disk3
.. code:
layout_legacy:
mirror-0:
... |
ensure storage pool is present on the system
name : string
name of storage pool
properties : dict
optional set of properties to set for the storage pool
filesystem_properties : dict
optional set of filesystem properties to set for the storage pool (creation only)
layout: dict
... |
ensure storage pool is absent on the system
name : string
name of storage pool
export : boolean
export instread of destroy the zpool if present
force : boolean
force destroy or export
def absent(name, export=False, force=False):
'''
ensure storage pool is absent on the syst... |
Return True if the system was booted with systemd, False otherwise. If the
loader context dict ``__context__`` is passed, this function will set the
``salt.utils.systemd.booted`` key to represent if systemd is running and
keep the logic below from needing to be run again during the same salt run.
def boot... |
Attempts to run systemctl --version. Returns None if unable to determine
version.
def version(context=None):
'''
Attempts to run systemctl --version. Returns None if unable to determine
version.
'''
contextkey = 'salt.utils.systemd.version'
if isinstance(context, dict):
# Can't put ... |
Scopes were introduced in systemd 205, this function returns a boolean
which is true when the minion is systemd-booted and running systemd>=205.
def has_scope(context=None):
'''
Scopes were introduced in systemd 205, this function returns a boolean
which is true when the minion is systemd-booted and ru... |
Return a postgres connection.
def _get_conn():
'''
Return a postgres connection.
'''
try:
conn = psycopg2.connect(
host=__opts__['master_job_cache.postgres.host'],
user=__opts__['master_job_cache.postgres.user'],
password=__opts__['master_job_cache.p... |
Format the job instance correctly
def _format_job_instance(job):
'''
Format the job instance correctly
'''
ret = {'Function': job.get('fun', 'unknown-function'),
'Arguments': salt.utils.json.loads(job.get('arg', '[]')),
# unlikely but safeguard from invalid returns
'Tar... |
Generate an unique job id
def _gen_jid(cur):
'''
Generate an unique job id
'''
jid = salt.utils.jid.gen_jid(__opts__)
sql = '''SELECT jid FROM jids WHERE jid = %s'''
cur.execute(sql, (jid,))
data = cur.fetchall()
if not data:
return jid
return None |
Return a job id and prepare the job id directory
This is the function responsible for making sure jids don't collide
(unless its passed a jid). So do what you have to do to make sure that
stays the case
def prep_jid(nocache=False, passed_jid=None):
'''
Return a job id and prepare the job id directo... |
Return data to a postgres server
def returner(load):
'''
Return data to a postgres server
'''
conn = _get_conn()
if conn is None:
return None
cur = conn.cursor()
sql = '''INSERT INTO salt_returns
(fun, jid, return, id, success)
VALUES (%s, %s, %s, %s, %s)'''
... |
Return event to a postgres server
Require that configuration be enabled via 'event_return'
option in master config.
def event_return(events):
'''
Return event to a postgres server
Require that configuration be enabled via 'event_return'
option in master config.
'''
conn = _get_conn()
... |
Save the load to the specified jid id
def save_load(jid, clear_load, minions=None):
'''
Save the load to the specified jid id
'''
jid = _escape_jid(jid)
conn = _get_conn()
if conn is None:
return None
cur = conn.cursor()
sql = '''INSERT INTO jids ''' \
'''(jid, started... |
Do proper formatting of the jid
def _escape_jid(jid):
'''
Do proper formatting of the jid
'''
jid = six.text_type(jid)
jid = re.sub(r"'*", "", jid)
return jid |
Rebuild dict
def _build_dict(data):
'''
Rebuild dict
'''
result = {}
# TODO: Add Metadata support when it is merged from develop
result["jid"] = data[0]
result["tgt_type"] = data[1]
result["cmd"] = data[2]
result["tgt"] = data[3]
result["kwargs"] = data[4]
result["ret"] = da... |
Return the load data that marks a specified jid
def get_load(jid):
'''
Return the load data that marks a specified jid
'''
jid = _escape_jid(jid)
conn = _get_conn()
if conn is None:
return None
cur = conn.cursor()
sql = '''SELECT jid, tgt_type, cmd, tgt, kwargs, ret, username, a... |
Return the information returned when the specified job id was executed
def get_jid(jid):
'''
Return the information returned when the specified job id was executed
'''
jid = _escape_jid(jid)
conn = _get_conn()
if conn is None:
return None
cur = conn.cursor()
sql = '''SELECT id, ... |
Return a list of all job ids
For master job cache this also formats the output and returns a string
def get_jids():
'''
Return a list of all job ids
For master job cache this also formats the output and returns a string
'''
conn = _get_conn()
cur = conn.cursor()
sql = '''SELECT ''' \
... |
Query for all accounts which have 3 or more login failures.
CLI Example:
.. code-block:: bash
salt <minion_id> shadow.login_failures ALL
def login_failures(user):
'''
Query for all accounts which have 3 or more login failures.
CLI Example:
.. code-block:: bash
salt <minio... |
Unlock user for locked account
CLI Example:
.. code-block:: bash
salt <minion_id> shadow.unlock user
def unlock(user):
'''
Unlock user for locked account
CLI Example:
.. code-block:: bash
salt <minion_id> shadow.unlock user
'''
cmd = 'chuser account_locked=false {... |
Create an alert in OpsGenie. Example usage with Salt's requisites and other
global state arguments could be found above.
Required Parameters:
api_key
It's the API Key you've copied while adding integration in OpsGenie.
reason
It will be used as alert's default message in OpsGenie.
... |
Close an alert in OpsGenie. It's a wrapper function for create_alert.
Example usage with Salt's requisites and other global state arguments
could be found above.
Required Parameters:
name
It will be used as alert's alias. If you want to use the close
functionality you must provide name... |
Updates the probes dictionary with different levels of default values.
def _expand_probes(probes, defaults):
'''
Updates the probes dictionary with different levels of default values.
'''
expected_probes = {}
for probe_name, probe_test in six.iteritems(probes):
if probe_name not in expec... |
Will remove empty and useless values from the probes dictionary.
def _clean_probes(probes):
'''
Will remove empty and useless values from the probes dictionary.
'''
probes = _ordered_dict_to_dict(probes) # make sure we are working only with dict-type
probes_copy = deepcopy(probes)
for probe_... |
Compares configured probes on the device with the expected configuration and returns the differences.
def _compare_probes(configured_probes, expected_probes):
'''
Compares configured probes on the device with the expected configuration and returns the differences.
'''
new_probes = {}
update_probe... |
Ensure the networks device is configured as specified in the state SLS file.
Probes not specified will be removed, while probes not confiured as expected will trigger config updates.
:param probes: Defines the probes as expected to be configured on the
device. In order to ease the configuration and av... |
Send an email with the data
def returner(ret):
'''
Send an email with the data
'''
_options = _get_options(ret)
from_addr = _options.get('from')
to_addrs = _options.get('to').split(',')
host = _options.get('host')
port = _options.get('port')
user = _options.get('username')
pass... |
Return event data via SMTP
def event_return(events):
'''
Return event data via SMTP
'''
for event in events:
ret = event.get('data', False)
if ret:
returner(ret) |
Takes a tab list structure and renders it to a list for applying it to
a file
def _render_tab(lst):
'''
Takes a tab list structure and renders it to a list for applying it to
a file
'''
ret = []
for pre in lst['pre']:
ret.append('{0}\n'.format(pre))
for cron in lst['crons']:
... |
Writes the contents of a file to a user's incrontab
CLI Example:
.. code-block:: bash
salt '*' incron.write_incron_file root /tmp/new_incron
def write_incron_file(user, path):
'''
Writes the contents of a file to a user's incrontab
CLI Example:
.. code-block:: bash
salt '*... |
Writes the contents of a file to a user's incrontab and return error message on error
CLI Example:
.. code-block:: bash
salt '*' incron.write_incron_file_verbose root /tmp/new_incron
def write_incron_file_verbose(user, path):
'''
Writes the contents of a file to a user's incrontab and return... |
Takes a list of lines to be committed to a user's incrontab and writes it
def _write_incron_lines(user, lines):
'''
Takes a list of lines to be committed to a user's incrontab and writes it
'''
if user == 'system':
ret = {}
ret['retcode'] = _write_file(_INCRON_SYSTEM_TAB, 'salt', ''.joi... |
Writes a file to disk
def _write_file(folder, filename, data):
'''
Writes a file to disk
'''
path = os.path.join(folder, filename)
if not os.path.exists(folder):
msg = '{0} cannot be written. {1} does not exist'.format(filename, folder)
log.error(msg)
raise AttributeError(si... |
Reads and returns the contents of a file
def _read_file(folder, filename):
'''
Reads and returns the contents of a file
'''
path = os.path.join(folder, filename)
try:
with salt.utils.files.fopen(path, 'rb') as contents:
return salt.utils.data.decode(contents.readlines())
exc... |
Return the contents of the user's incrontab
CLI Example:
.. code-block:: bash
salt '*' incron.raw_incron root
def raw_incron(user):
'''
Return the contents of the user's incrontab
CLI Example:
.. code-block:: bash
salt '*' incron.raw_incron root
'''
if __grains__['... |
Return the contents of the specified user's incrontab
CLI Example:
.. code-block:: bash
salt '*' incron.list_tab root
def list_tab(user):
'''
Return the contents of the specified user's incrontab
CLI Example:
.. code-block:: bash
salt '*' incron.list_tab root
'''
i... |
Sets an incron job up for a specified user.
CLI Example:
.. code-block:: bash
salt '*' incron.set_job root '/root' 'IN_MODIFY' 'echo "$$ $@ $# $% $&"'
def set_job(user, path, mask, cmd):
'''
Sets an incron job up for a specified user.
CLI Example:
.. code-block:: bash
salt... |
Remove a incron job for a specified user. If any of the day/time params are
specified, the job will only be removed if the specified params match.
CLI Example:
.. code-block:: bash
salt '*' incron.rm_job root /path
def rm_job(user,
path,
mask,
cmd):
'''
R... |
IRC Bot for interacting with salt.
nick
Nickname of the connected Bot.
host
irc server (example - chat.freenode.net).
port
irc port. Default: 6667
password
password for authenticating. If not provided, user will not authenticate on the irc server.
channels
... |
Checks to see if the specific apache mod is enabled.
This will only be functional on operating systems that support
`a2enmod -l` to list the enabled mods.
CLI Example:
.. code-block:: bash
salt '*' apache.check_mod_enabled status
def check_mod_enabled(mod):
'''
Checks to see if the ... |
Create a display name for a key.
CLI example::
salt myminion boto_kms.create_alias 'alias/mykey' key_id
def create_alias(alias_name, target_key_id, region=None, key=None, keyid=None,
profile=None):
'''
Create a display name for a key.
CLI example::
salt myminion bot... |
Adds a grant to a key to specify who can access the key and under what
conditions.
CLI example::
salt myminion boto_kms.create_grant 'alias/mykey' 'arn:aws:iam::1111111:/role/myrole' operations='["Encrypt","Decrypt"]'
def create_grant(key_id, grantee_principal, retiring_principal=None,
... |
Creates a master key.
CLI example::
salt myminion boto_kms.create_key '{"Statement":...}' "My master key"
def create_key(policy=None, description=None, key_usage=None, region=None,
key=None, keyid=None, profile=None):
'''
Creates a master key.
CLI example::
salt mymin... |
Decrypt ciphertext.
CLI example::
salt myminion boto_kms.decrypt encrypted_ciphertext
def decrypt(ciphertext_blob, encryption_context=None, grant_tokens=None,
region=None, key=None, keyid=None, profile=None):
'''
Decrypt ciphertext.
CLI example::
salt myminion boto_kms.d... |
Check for the existence of a key.
CLI example::
salt myminion boto_kms.key_exists 'alias/mykey'
def key_exists(key_id, region=None, key=None, keyid=None, profile=None):
'''
Check for the existence of a key.
CLI example::
salt myminion boto_kms.key_exists 'alias/mykey'
'''
co... |
From an alias, get a key_id.
def _get_key_id(alias, region=None, key=None, keyid=None, profile=None):
'''
From an alias, get a key_id.
'''
key_metadata = describe_key(
alias, region, key, keyid, profile
)['key_metadata']
return key_metadata['KeyId'] |
Mark key as disabled.
CLI example::
salt myminion boto_kms.disable_key 'alias/mykey'
def disable_key(key_id, region=None, key=None, keyid=None, profile=None):
'''
Mark key as disabled.
CLI example::
salt myminion boto_kms.disable_key 'alias/mykey'
'''
conn = _get_conn(region... |
Encrypt plaintext into cipher text using specified key.
CLI example::
salt myminion boto_kms.encrypt 'alias/mykey' 'myplaindata' '{"aws:username":"myuser"}'
def encrypt(key_id, plaintext, encryption_context=None, grant_tokens=None,
region=None, key=None, keyid=None, profile=None):
'''
... |
Generate a secure data key.
CLI example::
salt myminion boto_kms.generate_data_key 'alias/mykey' number_of_bytes=1024 key_spec=AES_128
def generate_data_key(key_id, encryption_context=None, number_of_bytes=None,
key_spec=None, grant_tokens=None, region=None, key=None,
... |
Generate a random string.
CLI example::
salt myminion boto_kms.generate_random number_of_bytes=1024
def generate_random(number_of_bytes=None, region=None, key=None, keyid=None,
profile=None):
'''
Generate a random string.
CLI example::
salt myminion boto_kms.gene... |
Get the policy for the specified key.
CLI example::
salt myminion boto_kms.get_key_policy 'alias/mykey' mypolicy
def get_key_policy(key_id, policy_name, region=None, key=None, keyid=None,
profile=None):
'''
Get the policy for the specified key.
CLI example::
salt ... |
Get status of whether or not key rotation is enabled for a key.
CLI example::
salt myminion boto_kms.get_key_rotation_status 'alias/mykey'
def get_key_rotation_status(key_id, region=None, key=None, keyid=None,
profile=None):
'''
Get status of whether or not key rotatio... |
List grants for the specified key.
CLI example::
salt myminion boto_kms.list_grants 'alias/mykey'
def list_grants(key_id, limit=None, marker=None, region=None, key=None,
keyid=None, profile=None):
'''
List grants for the specified key.
CLI example::
salt myminion bot... |
List key_policies for the specified key.
CLI example::
salt myminion boto_kms.list_key_policies 'alias/mykey'
def list_key_policies(key_id, limit=None, marker=None, region=None, key=None,
keyid=None, profile=None):
'''
List key_policies for the specified key.
CLI exampl... |
Attach a key policy to the specified key.
CLI example::
salt myminion boto_kms.put_key_policy 'alias/mykey' default '{"Statement":...}'
def put_key_policy(key_id, policy_name, policy, region=None, key=None,
keyid=None, profile=None):
'''
Attach a key policy to the specified key... |
Reencrypt encrypted data with a new master key.
CLI example::
salt myminion boto_kms.re_encrypt 'encrypted_data' 'alias/mynewkey' default '{"Statement":...}'
def re_encrypt(ciphertext_blob, destination_key_id,
source_encryption_context=None,
destination_encryption_context=No... |
Revoke a grant from a key.
CLI example::
salt myminion boto_kms.revoke_grant 'alias/mykey' 8u89hf-j09j...
def revoke_grant(key_id, grant_id, region=None, key=None, keyid=None,
profile=None):
'''
Revoke a grant from a key.
CLI example::
salt myminion boto_kms.revoke_... |
Pretty print the stack trace and environment information
for debugging those hard to reproduce user problems. :)
def _makepretty(printout, stack):
'''
Pretty print the stack trace and environment information
for debugging those hard to reproduce user problems. :)
'''
printout.write('======== ... |
Signal handler for SIGUSR1, only available on Unix-like systems
def _handle_sigusr1(sig, stack):
'''
Signal handler for SIGUSR1, only available on Unix-like systems
'''
# When running in the foreground, do the right thing
# and spit out the debug info straight to the console
if sys.stderr.isat... |
Signal handler for SIGUSR2, only available on Unix-like systems
def _handle_sigusr2(sig, stack):
'''
Signal handler for SIGUSR2, only available on Unix-like systems
'''
try:
import yappi
except ImportError:
return
if yappi.is_running():
yappi.stop()
filename = 'c... |
Add signal handler for signal name if it exists on given platform
def enable_sig_handler(signal_name, handler):
'''
Add signal handler for signal name if it exists on given platform
'''
if hasattr(signal, signal_name):
signal.signal(getattr(signal, signal_name), handler) |
Get a name of a caller in the format module.class.method
`skip` specifies how many levels of stack to skip while getting caller
name. skip=1 means "who calls me", skip=2 "who calls my caller" etc.
An empty string is returned if skipped levels exceed stack height
Source: https://gist.github.com/techto... |
Ensure the NX-OS system image is running on the device.
name
Name of the salt state task
system_image
Name of the system image file on bootflash:
kickstart_image
Name of the kickstart image file on bootflash:
This is not needed if the system_image is a combined system and
... |
Given the service instance si and tasks, it returns after all the
tasks are complete
def WaitForTasks(tasks, si):
"""
Given the service instance si and tasks, it returns after all the
tasks are complete
"""
pc = si.content.propertyCollector
taskList = [str(task) for task in tasks]
# Create f... |
Calculates the checksum char used for the 16th char.
Author: Vincenzo Palazzo
def checksum(value):
"""
Calculates the checksum char used for the 16th char.
Author: Vincenzo Palazzo
"""
return chr(65 + sum(CHECKSUM_TABLE[index % 2][ALPHANUMERICS_DICT[char]]
for index, cha... |
Returns random binary blob.
Default blob size is 1 Mb.
def binary(self, length=(1 * 1024 * 1024)):
""" Returns random binary blob.
Default blob size is 1 Mb.
"""
blob = [self.generator.random.randrange(256) for _ in range(length)]
return bytes(blob) if sys.version_info... |
Calculates the md5 hash of a given string
:example 'cfcd208495d565ef66e7dff9f98764da'
def md5(self, raw_output=False):
"""
Calculates the md5 hash of a given string
:example 'cfcd208495d565ef66e7dff9f98764da'
"""
res = hashlib.md5(str(self.generator.random.random()).enco... |
Generates a random UUID4 string.
:param cast_to: Specify what type the UUID should be cast to. Default is `str`
:type cast_to: callable
def uuid4(self, cast_to=str):
"""
Generates a random UUID4 string.
:param cast_to: Specify what type the UUID should be cast to. Default is `st... |
Generates a random password.
@param length: Integer. Length of a password
@param special_chars: Boolean. Whether to use special characters !@#$%^&*()_+
@param digits: Boolean. Whether to use digits
@param upper_case: Boolean. Whether to use upper letters
@param lower_case: Boolea... |
Calculates and returns a control digit for given list of characters basing on Identity Card Number standards.
def checksum_identity_card_number(characters):
"""
Calculates and returns a control digit for given list of characters basing on Identity Card Number standards.
"""
weights_for_check_digit = [7... |
Returns 9 character Polish Identity Card Number,
Polish: Numer Dowodu Osobistego.
The card number consists of 3 letters followed by 6 digits (for example, ABA300000),
of which the first digit (at position 3) is the check digit.
https://en.wikipedia.org/wiki/Polish_identity_card
def id... |
A simple method that runs a Command.
def execute_from_command_line(argv=None):
"""A simple method that runs a Command."""
if sys.stdout.encoding is None:
print('please set python env PYTHONIOENCODING=UTF-8, example: '
'export PYTHONIOENCODING=UTF-8, when writing to stdout',
... |
Given the command-line arguments, this creates a parser appropriate
to that command, and runs it.
def execute(self):
"""
Given the command-line arguments, this creates a parser appropriate
to that command, and runs it.
"""
# retrieve default language from system environ... |
Calculate the check digit for ISBN-13.
See https://en.wikipedia.org/wiki/International_Standard_Book_Number
for calculation.
def _check_digit(self):
""" Calculate the check digit for ISBN-13.
See https://en.wikipedia.org/wiki/International_Standard_Book_Number
for calculation.
... |
Validates a french catch phrase.
:param catch_phrase: The catch phrase to validate.
def _is_catch_phrase_valid(self, catch_phrase):
"""
Validates a french catch phrase.
:param catch_phrase: The catch phrase to validate.
"""
for word in self.words_which_should_not_appea... |
Generates a siret number (14 digits).
It is in fact the result of the concatenation of a siren number (9 digits),
a sequential number (4 digits) and a control number (1 digit) concatenation.
If $max_sequential_digits is invalid, it is set to 2.
:param max_sequential_digits The maximum nu... |
Remove accents from characters in the given string.
def remove_accents(value):
"""
Remove accents from characters in the given string.
"""
search = 'ΆΈΉΊΌΎΏάέήίόύώΪϊΐϋΰ'
replace = 'ΑΕΗΙΟΥΩαεηιουωΙιιυυ'
def replace_accented_character(match):
matched = match.group(0)
if matched i... |
Converts (transliterates) greek letters to latin equivalents.
def latinize(value):
"""
Converts (transliterates) greek letters to latin equivalents.
"""
def replace_double_character(match):
search = ('Θ Χ Ψ '
'θ χ ψ '
'ΟΥ ΑΥ ΕΥ '
'Ου Αυ Ευ '... |
Returns an Israeli identity number, known as Teudat Zehut ("tz").
https://en.wikipedia.org/wiki/Israeli_identity_card
def ssn(self):
"""
Returns an Israeli identity number, known as Teudat Zehut ("tz").
https://en.wikipedia.org/wiki/Israeli_identity_card
"""
newID = s... |
:returns: An array of random words. for example: ['Lorem', 'ipsum', 'dolor']
Keyword arguments:
:param nb: how many words to return
:param ext_word_list: a list of words you would like to have instead of
'Lorem ipsum'
:param unique: If True, the returned word list will conta... |
Generate a random sentence
:example 'Lorem ipsum dolor sit amet.'
:param nb_words: around how many words the sentence should contain
:param variable_nb_words: set to false if you want exactly ``nb``
words returned, otherwise the result may include a number of words
of ``... |
Generate an array of sentences
:example ['Lorem ipsum dolor sit amet.', 'Consectetur adipisicing eli.']
Keyword arguments:
:param nb: how many sentences to return
:param ext_word_list: a list of words you would like to have instead of
'Lorem ipsum'.
:rtype: list
de... |
:returns: A single paragraph. For example: 'Sapiente sunt omnis. Ut
pariatur ad autem ducimus et. Voluptas rem voluptas sint modi dolorem amet.'
Keyword arguments:
:param nb_sentences: around how many sentences the paragraph should contain
:param variable_nb_sentences: set to false ... |
Generate an array of paragraphs
:example [paragraph1, paragraph2, paragraph3]
:param nb: how many paragraphs to return
:param ext_word_list: a list of words you would like to have instead of
'Lorem ipsum'.
:rtype: list
def paragraphs(self, nb=3, ext_word_list=None):
... |
Generate a text string.
Depending on the ``max_nb_chars, returns a string made of words, sentences, or paragraphs.
:example 'Sapiente sunt omnis. Ut pariatur ad autem ducimus et. Voluptas rem voluptas sint modi dolorem amet.'
Keyword arguments:
:param max_nb_chars: Maximum number of cha... |
:example 'Sashabury'
def city(self):
"""
:example 'Sashabury'
"""
pattern = self.random_element(self.city_formats)
return self.generator.parse(pattern) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.