repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
ambitioninc/django-query-builder
querybuilder/tables.py
Table.get_alias
def get_alias(self): """ Gets the alias for the table or the auto_alias if one is set. If there isn't any kind of alias, None is returned. :returns: The table alias, auto_alias, or None :rtype: str or None """ alias = None if self.alias: alias...
python
def get_alias(self): """ Gets the alias for the table or the auto_alias if one is set. If there isn't any kind of alias, None is returned. :returns: The table alias, auto_alias, or None :rtype: str or None """ alias = None if self.alias: alias...
[ "def", "get_alias", "(", "self", ")", ":", "alias", "=", "None", "if", "self", ".", "alias", ":", "alias", "=", "self", ".", "alias", "elif", "self", ".", "auto_alias", ":", "alias", "=", "self", ".", "auto_alias", "return", "alias" ]
Gets the alias for the table or the auto_alias if one is set. If there isn't any kind of alias, None is returned. :returns: The table alias, auto_alias, or None :rtype: str or None
[ "Gets", "the", "alias", "for", "the", "table", "or", "the", "auto_alias", "if", "one", "is", "set", ".", "If", "there", "isn", "t", "any", "kind", "of", "alias", "None", "is", "returned", "." ]
113a7d845d3ddc6a45621b9880308e756f87c5bf
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/tables.py#L136-L150
train
59,600
ambitioninc/django-query-builder
querybuilder/tables.py
Table.add_field
def add_field(self, field): """ Adds a field to this table :param field: This can be a string of a field name, a dict of {'alias': field}, or a ``Field`` instance :type field: str or dict or Field """ field = FieldFactory( field, ) ...
python
def add_field(self, field): """ Adds a field to this table :param field: This can be a string of a field name, a dict of {'alias': field}, or a ``Field`` instance :type field: str or dict or Field """ field = FieldFactory( field, ) ...
[ "def", "add_field", "(", "self", ",", "field", ")", ":", "field", "=", "FieldFactory", "(", "field", ",", ")", "field", ".", "set_table", "(", "self", ")", "# make sure field is not already added", "field_name", "=", "field", ".", "get_name", "(", ")", "for"...
Adds a field to this table :param field: This can be a string of a field name, a dict of {'alias': field}, or a ``Field`` instance :type field: str or dict or Field
[ "Adds", "a", "field", "to", "this", "table" ]
113a7d845d3ddc6a45621b9880308e756f87c5bf
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/tables.py#L186-L211
train
59,601
ambitioninc/django-query-builder
querybuilder/tables.py
Table.remove_field
def remove_field(self, field): """ Removes a field from this table :param field: This can be a string of a field name, a dict of {'alias': field}, or a ``Field`` instance :type field: str or dict or :class:`Field <querybuilder.fields.Field>` """ new_field = F...
python
def remove_field(self, field): """ Removes a field from this table :param field: This can be a string of a field name, a dict of {'alias': field}, or a ``Field`` instance :type field: str or dict or :class:`Field <querybuilder.fields.Field>` """ new_field = F...
[ "def", "remove_field", "(", "self", ",", "field", ")", ":", "new_field", "=", "FieldFactory", "(", "field", ",", ")", "new_field", ".", "set_table", "(", "self", ")", "new_field_identifier", "=", "new_field", ".", "get_identifier", "(", ")", "for", "field", ...
Removes a field from this table :param field: This can be a string of a field name, a dict of {'alias': field}, or a ``Field`` instance :type field: str or dict or :class:`Field <querybuilder.fields.Field>`
[ "Removes", "a", "field", "from", "this", "table" ]
113a7d845d3ddc6a45621b9880308e756f87c5bf
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/tables.py#L213-L230
train
59,602
ambitioninc/django-query-builder
querybuilder/tables.py
Table.add_fields
def add_fields(self, fields): """ Adds all of the passed fields to the table's current field list :param fields: The fields to select from ``table``. This can be a single field, a tuple of fields, or a list of fields. Each field can be a string or ``Field`` instance ...
python
def add_fields(self, fields): """ Adds all of the passed fields to the table's current field list :param fields: The fields to select from ``table``. This can be a single field, a tuple of fields, or a list of fields. Each field can be a string or ``Field`` instance ...
[ "def", "add_fields", "(", "self", ",", "fields", ")", ":", "if", "isinstance", "(", "fields", ",", "string_types", ")", ":", "fields", "=", "[", "fields", "]", "elif", "type", "(", "fields", ")", "is", "tuple", ":", "fields", "=", "list", "(", "field...
Adds all of the passed fields to the table's current field list :param fields: The fields to select from ``table``. This can be a single field, a tuple of fields, or a list of fields. Each field can be a string or ``Field`` instance :type fields: str or tuple or list of str or l...
[ "Adds", "all", "of", "the", "passed", "fields", "to", "the", "table", "s", "current", "field", "list" ]
113a7d845d3ddc6a45621b9880308e756f87c5bf
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/tables.py#L253-L268
train
59,603
ambitioninc/django-query-builder
querybuilder/tables.py
Table.find_field
def find_field(self, field=None, alias=None): """ Finds a field by name or alias. :param field: string of the field name or alias, dict of {'alias': field}, or a Field instance :type field: str or dict or Field :returns: The field if it is found, otherwise None :rtype: ...
python
def find_field(self, field=None, alias=None): """ Finds a field by name or alias. :param field: string of the field name or alias, dict of {'alias': field}, or a Field instance :type field: str or dict or Field :returns: The field if it is found, otherwise None :rtype: ...
[ "def", "find_field", "(", "self", ",", "field", "=", "None", ",", "alias", "=", "None", ")", ":", "if", "alias", ":", "field", "=", "alias", "field", "=", "FieldFactory", "(", "field", ",", "table", "=", "self", ",", "alias", "=", "alias", ")", "id...
Finds a field by name or alias. :param field: string of the field name or alias, dict of {'alias': field}, or a Field instance :type field: str or dict or Field :returns: The field if it is found, otherwise None :rtype: :class:`Field <querybuilder.fields.Field>` or None
[ "Finds", "a", "field", "by", "name", "or", "alias", "." ]
113a7d845d3ddc6a45621b9880308e756f87c5bf
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/tables.py#L311-L328
train
59,604
ambitioninc/django-query-builder
querybuilder/tables.py
SimpleTable.init_defaults
def init_defaults(self): """ Sets the name of the table to the passed in table value """ super(SimpleTable, self).init_defaults() self.name = self.table
python
def init_defaults(self): """ Sets the name of the table to the passed in table value """ super(SimpleTable, self).init_defaults() self.name = self.table
[ "def", "init_defaults", "(", "self", ")", ":", "super", "(", "SimpleTable", ",", "self", ")", ".", "init_defaults", "(", ")", "self", ".", "name", "=", "self", ".", "table" ]
Sets the name of the table to the passed in table value
[ "Sets", "the", "name", "of", "the", "table", "to", "the", "passed", "in", "table", "value" ]
113a7d845d3ddc6a45621b9880308e756f87c5bf
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/tables.py#L336-L341
train
59,605
ambitioninc/django-query-builder
querybuilder/tables.py
ModelTable.init_defaults
def init_defaults(self): """ Sets a model instance variable to the table value and sets the name to the table name as determined from the model class """ super(ModelTable, self).init_defaults() self.model = self.table self.name = self.model._meta.db_table
python
def init_defaults(self): """ Sets a model instance variable to the table value and sets the name to the table name as determined from the model class """ super(ModelTable, self).init_defaults() self.model = self.table self.name = self.model._meta.db_table
[ "def", "init_defaults", "(", "self", ")", ":", "super", "(", "ModelTable", ",", "self", ")", ".", "init_defaults", "(", ")", "self", ".", "model", "=", "self", ".", "table", "self", ".", "name", "=", "self", ".", "model", ".", "_meta", ".", "db_table...
Sets a model instance variable to the table value and sets the name to the table name as determined from the model class
[ "Sets", "a", "model", "instance", "variable", "to", "the", "table", "value", "and", "sets", "the", "name", "to", "the", "table", "name", "as", "determined", "from", "the", "model", "class" ]
113a7d845d3ddc6a45621b9880308e756f87c5bf
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/tables.py#L350-L357
train
59,606
ambitioninc/django-query-builder
querybuilder/tables.py
QueryTable.init_defaults
def init_defaults(self): """ Sets a query instance variable to the table value """ super(QueryTable, self).init_defaults() self.query = self.table self.query.is_inner = True
python
def init_defaults(self): """ Sets a query instance variable to the table value """ super(QueryTable, self).init_defaults() self.query = self.table self.query.is_inner = True
[ "def", "init_defaults", "(", "self", ")", ":", "super", "(", "QueryTable", ",", "self", ")", ".", "init_defaults", "(", ")", "self", ".", "query", "=", "self", ".", "table", "self", ".", "query", ".", "is_inner", "=", "True" ]
Sets a query instance variable to the table value
[ "Sets", "a", "query", "instance", "variable", "to", "the", "table", "value" ]
113a7d845d3ddc6a45621b9880308e756f87c5bf
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/tables.py#L376-L382
train
59,607
markfinger/python-nodejs
nodejs/interrogate.py
run_command
def run_command(cmd_to_run): """ Wrapper around subprocess that pipes the stderr and stdout from `cmd_to_run` to temporary files. Using the temporary files gets around subprocess.PIPE's issues with handling large buffers. Note: this command will block the python process until `cmd_to_run` has compl...
python
def run_command(cmd_to_run): """ Wrapper around subprocess that pipes the stderr and stdout from `cmd_to_run` to temporary files. Using the temporary files gets around subprocess.PIPE's issues with handling large buffers. Note: this command will block the python process until `cmd_to_run` has compl...
[ "def", "run_command", "(", "cmd_to_run", ")", ":", "with", "tempfile", ".", "TemporaryFile", "(", ")", "as", "stdout_file", ",", "tempfile", ".", "TemporaryFile", "(", ")", "as", "stderr_file", ":", "# Run the command", "popen", "=", "subprocess", ".", "Popen"...
Wrapper around subprocess that pipes the stderr and stdout from `cmd_to_run` to temporary files. Using the temporary files gets around subprocess.PIPE's issues with handling large buffers. Note: this command will block the python process until `cmd_to_run` has completed. Returns a tuple, containing th...
[ "Wrapper", "around", "subprocess", "that", "pipes", "the", "stderr", "and", "stdout", "from", "cmd_to_run", "to", "temporary", "files", ".", "Using", "the", "temporary", "files", "gets", "around", "subprocess", ".", "PIPE", "s", "issues", "with", "handling", "...
3c0c84e953b9af68cbc3f124f1802361baf006bb
https://github.com/markfinger/python-nodejs/blob/3c0c84e953b9af68cbc3f124f1802361baf006bb/nodejs/interrogate.py#L8-L34
train
59,608
jlaine/python-netfilter
netfilter/rule.py
Extension.log
def log(self, level, prefix = ''): """Writes the contents of the Extension to the logging system. """ logging.log(level, "%sname: %s", prefix, self.__name) logging.log(level, "%soptions: %s", prefix, self.__options)
python
def log(self, level, prefix = ''): """Writes the contents of the Extension to the logging system. """ logging.log(level, "%sname: %s", prefix, self.__name) logging.log(level, "%soptions: %s", prefix, self.__options)
[ "def", "log", "(", "self", ",", "level", ",", "prefix", "=", "''", ")", ":", "logging", ".", "log", "(", "level", ",", "\"%sname: %s\"", ",", "prefix", ",", "self", ".", "__name", ")", "logging", ".", "log", "(", "level", ",", "\"%soptions: %s\"", ",...
Writes the contents of the Extension to the logging system.
[ "Writes", "the", "contents", "of", "the", "Extension", "to", "the", "logging", "system", "." ]
e4942c0f6a654a985049b629ead3dc6dcdb30145
https://github.com/jlaine/python-netfilter/blob/e4942c0f6a654a985049b629ead3dc6dcdb30145/netfilter/rule.py#L91-L95
train
59,609
jlaine/python-netfilter
netfilter/rule.py
Extension.specbits
def specbits(self): """Returns the array of arguments that would be given to iptables for the current Extension. """ bits = [] for opt in sorted(self.__options): # handle the case where this is a negated option m = re.match(r'^! (.*)', opt) if ...
python
def specbits(self): """Returns the array of arguments that would be given to iptables for the current Extension. """ bits = [] for opt in sorted(self.__options): # handle the case where this is a negated option m = re.match(r'^! (.*)', opt) if ...
[ "def", "specbits", "(", "self", ")", ":", "bits", "=", "[", "]", "for", "opt", "in", "sorted", "(", "self", ".", "__options", ")", ":", "# handle the case where this is a negated option", "m", "=", "re", ".", "match", "(", "r'^! (.*)'", ",", "opt", ")", ...
Returns the array of arguments that would be given to iptables for the current Extension.
[ "Returns", "the", "array", "of", "arguments", "that", "would", "be", "given", "to", "iptables", "for", "the", "current", "Extension", "." ]
e4942c0f6a654a985049b629ead3dc6dcdb30145
https://github.com/jlaine/python-netfilter/blob/e4942c0f6a654a985049b629ead3dc6dcdb30145/netfilter/rule.py#L107-L125
train
59,610
jlaine/python-netfilter
netfilter/rule.py
Rule.log
def log(self, level, prefix = ''): """Writes the contents of the Rule to the logging system. """ logging.log(level, "%sin interface: %s", prefix, self.in_interface) logging.log(level, "%sout interface: %s", prefix, self.out_interface) logging.log(level, "%ssource: %s", prefix, se...
python
def log(self, level, prefix = ''): """Writes the contents of the Rule to the logging system. """ logging.log(level, "%sin interface: %s", prefix, self.in_interface) logging.log(level, "%sout interface: %s", prefix, self.out_interface) logging.log(level, "%ssource: %s", prefix, se...
[ "def", "log", "(", "self", ",", "level", ",", "prefix", "=", "''", ")", ":", "logging", ".", "log", "(", "level", ",", "\"%sin interface: %s\"", ",", "prefix", ",", "self", ".", "in_interface", ")", "logging", ".", "log", "(", "level", ",", "\"%sout in...
Writes the contents of the Rule to the logging system.
[ "Writes", "the", "contents", "of", "the", "Rule", "to", "the", "logging", "system", "." ]
e4942c0f6a654a985049b629ead3dc6dcdb30145
https://github.com/jlaine/python-netfilter/blob/e4942c0f6a654a985049b629ead3dc6dcdb30145/netfilter/rule.py#L206-L218
train
59,611
jlaine/python-netfilter
netfilter/rule.py
Rule.specbits
def specbits(self): """Returns the array of arguments that would be given to iptables for the current Rule. """ def host_bits(opt, optval): # handle the case where this is a negated value m = re.match(r'^!\s*(.*)', optval) if m: return ...
python
def specbits(self): """Returns the array of arguments that would be given to iptables for the current Rule. """ def host_bits(opt, optval): # handle the case where this is a negated value m = re.match(r'^!\s*(.*)', optval) if m: return ...
[ "def", "specbits", "(", "self", ")", ":", "def", "host_bits", "(", "opt", ",", "optval", ")", ":", "# handle the case where this is a negated value", "m", "=", "re", ".", "match", "(", "r'^!\\s*(.*)'", ",", "optval", ")", "if", "m", ":", "return", "[", "'!...
Returns the array of arguments that would be given to iptables for the current Rule.
[ "Returns", "the", "array", "of", "arguments", "that", "would", "be", "given", "to", "iptables", "for", "the", "current", "Rule", "." ]
e4942c0f6a654a985049b629ead3dc6dcdb30145
https://github.com/jlaine/python-netfilter/blob/e4942c0f6a654a985049b629ead3dc6dcdb30145/netfilter/rule.py#L220-L252
train
59,612
jlaine/python-netfilter
netfilter/parser.py
parse_chains
def parse_chains(data): """ Parse the chain definitions. """ chains = odict() for line in data.splitlines(True): m = re_chain.match(line) if m: policy = None if m.group(2) != '-': policy = m.group(2) chains[m.group(1)] = { ...
python
def parse_chains(data): """ Parse the chain definitions. """ chains = odict() for line in data.splitlines(True): m = re_chain.match(line) if m: policy = None if m.group(2) != '-': policy = m.group(2) chains[m.group(1)] = { ...
[ "def", "parse_chains", "(", "data", ")", ":", "chains", "=", "odict", "(", ")", "for", "line", "in", "data", ".", "splitlines", "(", "True", ")", ":", "m", "=", "re_chain", ".", "match", "(", "line", ")", "if", "m", ":", "policy", "=", "None", "i...
Parse the chain definitions.
[ "Parse", "the", "chain", "definitions", "." ]
e4942c0f6a654a985049b629ead3dc6dcdb30145
https://github.com/jlaine/python-netfilter/blob/e4942c0f6a654a985049b629ead3dc6dcdb30145/netfilter/parser.py#L117-L133
train
59,613
jlaine/python-netfilter
netfilter/parser.py
parse_rules
def parse_rules(data, chain): """ Parse the rules for the specified chain. """ rules = [] for line in data.splitlines(True): m = re_rule.match(line) if m and m.group(3) == chain: rule = parse_rule(m.group(4)) rule.packets = int(m.group(1)) rule.byt...
python
def parse_rules(data, chain): """ Parse the rules for the specified chain. """ rules = [] for line in data.splitlines(True): m = re_rule.match(line) if m and m.group(3) == chain: rule = parse_rule(m.group(4)) rule.packets = int(m.group(1)) rule.byt...
[ "def", "parse_rules", "(", "data", ",", "chain", ")", ":", "rules", "=", "[", "]", "for", "line", "in", "data", ".", "splitlines", "(", "True", ")", ":", "m", "=", "re_rule", ".", "match", "(", "line", ")", "if", "m", "and", "m", ".", "group", ...
Parse the rules for the specified chain.
[ "Parse", "the", "rules", "for", "the", "specified", "chain", "." ]
e4942c0f6a654a985049b629ead3dc6dcdb30145
https://github.com/jlaine/python-netfilter/blob/e4942c0f6a654a985049b629ead3dc6dcdb30145/netfilter/parser.py#L135-L147
train
59,614
denisenkom/django-sqlserver
sqlserver/base.py
_get_new_connection
def _get_new_connection(self, conn_params): """Opens a connection to the database.""" self.__connection_string = conn_params.get('connection_string', '') conn = self.Database.connect(**conn_params) return conn
python
def _get_new_connection(self, conn_params): """Opens a connection to the database.""" self.__connection_string = conn_params.get('connection_string', '') conn = self.Database.connect(**conn_params) return conn
[ "def", "_get_new_connection", "(", "self", ",", "conn_params", ")", ":", "self", ".", "__connection_string", "=", "conn_params", ".", "get", "(", "'connection_string'", ",", "''", ")", "conn", "=", "self", ".", "Database", ".", "connect", "(", "*", "*", "c...
Opens a connection to the database.
[ "Opens", "a", "connection", "to", "the", "database", "." ]
f5d5dc8637799746f1bd11bd8c479d3acd468581
https://github.com/denisenkom/django-sqlserver/blob/f5d5dc8637799746f1bd11bd8c479d3acd468581/sqlserver/base.py#L216-L220
train
59,615
denisenkom/django-sqlserver
sqlserver/base.py
DatabaseWrapper.get_connection_params
def get_connection_params(self): """Returns a dict of parameters suitable for get_new_connection.""" from django.conf import settings settings_dict = self.settings_dict options = settings_dict.get('OPTIONS', {}) autocommit = options.get('autocommit', False) conn_params = ...
python
def get_connection_params(self): """Returns a dict of parameters suitable for get_new_connection.""" from django.conf import settings settings_dict = self.settings_dict options = settings_dict.get('OPTIONS', {}) autocommit = options.get('autocommit', False) conn_params = ...
[ "def", "get_connection_params", "(", "self", ")", ":", "from", "django", ".", "conf", "import", "settings", "settings_dict", "=", "self", ".", "settings_dict", "options", "=", "settings_dict", ".", "get", "(", "'OPTIONS'", ",", "{", "}", ")", "autocommit", "...
Returns a dict of parameters suitable for get_new_connection.
[ "Returns", "a", "dict", "of", "parameters", "suitable", "for", "get_new_connection", "." ]
f5d5dc8637799746f1bd11bd8c479d3acd468581
https://github.com/denisenkom/django-sqlserver/blob/f5d5dc8637799746f1bd11bd8c479d3acd468581/sqlserver/base.py#L53-L79
train
59,616
denisenkom/django-sqlserver
sqlserver/base.py
DatabaseWrapper.create_cursor
def create_cursor(self, name=None): """Creates a cursor. Assumes that a connection is established.""" cursor = self.connection.cursor() cursor.tzinfo_factory = self.tzinfo_factory return cursor
python
def create_cursor(self, name=None): """Creates a cursor. Assumes that a connection is established.""" cursor = self.connection.cursor() cursor.tzinfo_factory = self.tzinfo_factory return cursor
[ "def", "create_cursor", "(", "self", ",", "name", "=", "None", ")", ":", "cursor", "=", "self", ".", "connection", ".", "cursor", "(", ")", "cursor", ".", "tzinfo_factory", "=", "self", ".", "tzinfo_factory", "return", "cursor" ]
Creates a cursor. Assumes that a connection is established.
[ "Creates", "a", "cursor", ".", "Assumes", "that", "a", "connection", "is", "established", "." ]
f5d5dc8637799746f1bd11bd8c479d3acd468581
https://github.com/denisenkom/django-sqlserver/blob/f5d5dc8637799746f1bd11bd8c479d3acd468581/sqlserver/base.py#L81-L85
train
59,617
denisenkom/django-sqlserver
sqlserver/base.py
DatabaseWrapper.__get_dbms_version
def __get_dbms_version(self, make_connection=True): """ Returns the 'DBMS Version' string """ major, minor, _, _ = self.get_server_version(make_connection=make_connection) return '{}.{}'.format(major, minor)
python
def __get_dbms_version(self, make_connection=True): """ Returns the 'DBMS Version' string """ major, minor, _, _ = self.get_server_version(make_connection=make_connection) return '{}.{}'.format(major, minor)
[ "def", "__get_dbms_version", "(", "self", ",", "make_connection", "=", "True", ")", ":", "major", ",", "minor", ",", "_", ",", "_", "=", "self", ".", "get_server_version", "(", "make_connection", "=", "make_connection", ")", "return", "'{}.{}'", ".", "format...
Returns the 'DBMS Version' string
[ "Returns", "the", "DBMS", "Version", "string" ]
f5d5dc8637799746f1bd11bd8c479d3acd468581
https://github.com/denisenkom/django-sqlserver/blob/f5d5dc8637799746f1bd11bd8c479d3acd468581/sqlserver/base.py#L87-L92
train
59,618
jlaine/python-netfilter
netfilter/firewall.py
Firewall.get_buffer
def get_buffer(self): """Get the change buffers.""" buffer = [] for table in self.__tables: buffer.extend(table.get_buffer()) return buffer
python
def get_buffer(self): """Get the change buffers.""" buffer = [] for table in self.__tables: buffer.extend(table.get_buffer()) return buffer
[ "def", "get_buffer", "(", "self", ")", ":", "buffer", "=", "[", "]", "for", "table", "in", "self", ".", "__tables", ":", "buffer", ".", "extend", "(", "table", ".", "get_buffer", "(", ")", ")", "return", "buffer" ]
Get the change buffers.
[ "Get", "the", "change", "buffers", "." ]
e4942c0f6a654a985049b629ead3dc6dcdb30145
https://github.com/jlaine/python-netfilter/blob/e4942c0f6a654a985049b629ead3dc6dcdb30145/netfilter/firewall.py#L59-L64
train
59,619
jlaine/python-netfilter
netfilter/firewall.py
Firewall.start
def start(self): """Start the firewall.""" self.clear() self.setDefaultPolicy() self.acceptIcmp() self.acceptInput('lo')
python
def start(self): """Start the firewall.""" self.clear() self.setDefaultPolicy() self.acceptIcmp() self.acceptInput('lo')
[ "def", "start", "(", "self", ")", ":", "self", ".", "clear", "(", ")", "self", ".", "setDefaultPolicy", "(", ")", "self", ".", "acceptIcmp", "(", ")", "self", ".", "acceptInput", "(", "'lo'", ")" ]
Start the firewall.
[ "Start", "the", "firewall", "." ]
e4942c0f6a654a985049b629ead3dc6dcdb30145
https://github.com/jlaine/python-netfilter/blob/e4942c0f6a654a985049b629ead3dc6dcdb30145/netfilter/firewall.py#L89-L94
train
59,620
jlaine/python-netfilter
netfilter/table.py
Table.list_rules
def list_rules(self, chainname): """Returns a list of Rules in the specified chain. """ data = self.__run([self.__iptables_save, '-t', self.__name, '-c']) return netfilter.parser.parse_rules(data, chainname)
python
def list_rules(self, chainname): """Returns a list of Rules in the specified chain. """ data = self.__run([self.__iptables_save, '-t', self.__name, '-c']) return netfilter.parser.parse_rules(data, chainname)
[ "def", "list_rules", "(", "self", ",", "chainname", ")", ":", "data", "=", "self", ".", "__run", "(", "[", "self", ".", "__iptables_save", ",", "'-t'", ",", "self", ".", "__name", ",", "'-c'", "]", ")", "return", "netfilter", ".", "parser", ".", "par...
Returns a list of Rules in the specified chain.
[ "Returns", "a", "list", "of", "Rules", "in", "the", "specified", "chain", "." ]
e4942c0f6a654a985049b629ead3dc6dcdb30145
https://github.com/jlaine/python-netfilter/blob/e4942c0f6a654a985049b629ead3dc6dcdb30145/netfilter/table.py#L120-L124
train
59,621
jlaine/python-netfilter
netfilter/table.py
Table.commit
def commit(self): """Commits any buffered commands. This is only useful if auto_commit is False. """ while len(self.__buffer) > 0: self.__run(self.__buffer.pop(0))
python
def commit(self): """Commits any buffered commands. This is only useful if auto_commit is False. """ while len(self.__buffer) > 0: self.__run(self.__buffer.pop(0))
[ "def", "commit", "(", "self", ")", ":", "while", "len", "(", "self", ".", "__buffer", ")", ">", "0", ":", "self", ".", "__run", "(", "self", ".", "__buffer", ".", "pop", "(", "0", ")", ")" ]
Commits any buffered commands. This is only useful if auto_commit is False.
[ "Commits", "any", "buffered", "commands", ".", "This", "is", "only", "useful", "if", "auto_commit", "is", "False", "." ]
e4942c0f6a654a985049b629ead3dc6dcdb30145
https://github.com/jlaine/python-netfilter/blob/e4942c0f6a654a985049b629ead3dc6dcdb30145/netfilter/table.py#L126-L131
train
59,622
rauenzi/discordbot.py
discordbot/bot_utils/paginator.py
Pages.numbered_page
async def numbered_page(self): """lets you type a page number to go to""" to_delete = [] to_delete.append(await self.bot.send_message(self.message.channel, 'What page do you want to go to?')) msg = await self.bot.wait_for_message(author=self.author, channel=self.message.channel, ...
python
async def numbered_page(self): """lets you type a page number to go to""" to_delete = [] to_delete.append(await self.bot.send_message(self.message.channel, 'What page do you want to go to?')) msg = await self.bot.wait_for_message(author=self.author, channel=self.message.channel, ...
[ "async", "def", "numbered_page", "(", "self", ")", ":", "to_delete", "=", "[", "]", "to_delete", ".", "append", "(", "await", "self", ".", "bot", ".", "send_message", "(", "self", ".", "message", ".", "channel", ",", "'What page do you want to go to?'", ")",...
lets you type a page number to go to
[ "lets", "you", "type", "a", "page", "number", "to", "go", "to" ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/bot_utils/paginator.py#L133-L154
train
59,623
rauenzi/discordbot.py
discordbot/bot_utils/paginator.py
Pages.show_help
async def show_help(self): """shows this message""" e = discord.Embed() messages = ['Welcome to the interactive paginator!\n'] messages.append('This interactively allows you to see pages of text by navigating with ' \ 'reactions. They are as follows:\n') ...
python
async def show_help(self): """shows this message""" e = discord.Embed() messages = ['Welcome to the interactive paginator!\n'] messages.append('This interactively allows you to see pages of text by navigating with ' \ 'reactions. They are as follows:\n') ...
[ "async", "def", "show_help", "(", "self", ")", ":", "e", "=", "discord", ".", "Embed", "(", ")", "messages", "=", "[", "'Welcome to the interactive paginator!\\n'", "]", "messages", ".", "append", "(", "'This interactively allows you to see pages of text by navigating w...
shows this message
[ "shows", "this", "message" ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/bot_utils/paginator.py#L156-L175
train
59,624
rauenzi/discordbot.py
discordbot/bot_utils/paginator.py
Pages.stop_pages
async def stop_pages(self): """stops the interactive pagination session""" await self.bot.delete_message(self.message) self.paginating = False
python
async def stop_pages(self): """stops the interactive pagination session""" await self.bot.delete_message(self.message) self.paginating = False
[ "async", "def", "stop_pages", "(", "self", ")", ":", "await", "self", ".", "bot", ".", "delete_message", "(", "self", ".", "message", ")", "self", ".", "paginating", "=", "False" ]
stops the interactive pagination session
[ "stops", "the", "interactive", "pagination", "session" ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/bot_utils/paginator.py#L177-L180
train
59,625
rauenzi/discordbot.py
discordbot/bot_utils/paginator.py
Pages.paginate
async def paginate(self): """Actually paginate the entries and run the interactive loop if necessary.""" await self.show_page(1, first=True) while self.paginating: react = await self.bot.wait_for_reaction(message=self.message, check=self.react_check, timeout=120.0) if re...
python
async def paginate(self): """Actually paginate the entries and run the interactive loop if necessary.""" await self.show_page(1, first=True) while self.paginating: react = await self.bot.wait_for_reaction(message=self.message, check=self.react_check, timeout=120.0) if re...
[ "async", "def", "paginate", "(", "self", ")", ":", "await", "self", ".", "show_page", "(", "1", ",", "first", "=", "True", ")", "while", "self", ".", "paginating", ":", "react", "=", "await", "self", ".", "bot", ".", "wait_for_reaction", "(", "message"...
Actually paginate the entries and run the interactive loop if necessary.
[ "Actually", "paginate", "the", "entries", "and", "run", "the", "interactive", "loop", "if", "necessary", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/bot_utils/paginator.py#L192-L212
train
59,626
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin._senddms
async def _senddms(self): """Toggles sending DMs to owner.""" data = self.bot.config.get("meta", {}) tosend = data.get('send_dms', True) data['send_dms'] = not tosend await self.bot.config.put('meta', data) await self.bot.responses.toggle(message="Forwarding of DMs to own...
python
async def _senddms(self): """Toggles sending DMs to owner.""" data = self.bot.config.get("meta", {}) tosend = data.get('send_dms', True) data['send_dms'] = not tosend await self.bot.config.put('meta', data) await self.bot.responses.toggle(message="Forwarding of DMs to own...
[ "async", "def", "_senddms", "(", "self", ")", ":", "data", "=", "self", ".", "bot", ".", "config", ".", "get", "(", "\"meta\"", ",", "{", "}", ")", "tosend", "=", "data", ".", "get", "(", "'send_dms'", ",", "True", ")", "data", "[", "'send_dms'", ...
Toggles sending DMs to owner.
[ "Toggles", "sending", "DMs", "to", "owner", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L101-L107
train
59,627
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin._quit
async def _quit(self): """Quits the bot.""" await self.bot.responses.failure(message="Bot shutting down") await self.bot.logout()
python
async def _quit(self): """Quits the bot.""" await self.bot.responses.failure(message="Bot shutting down") await self.bot.logout()
[ "async", "def", "_quit", "(", "self", ")", ":", "await", "self", ".", "bot", ".", "responses", ".", "failure", "(", "message", "=", "\"Bot shutting down\"", ")", "await", "self", ".", "bot", ".", "logout", "(", ")" ]
Quits the bot.
[ "Quits", "the", "bot", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L111-L114
train
59,628
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin._setcolor
async def _setcolor(self, *, color : discord.Colour): """Sets the default color of embeds.""" data = self.bot.config.get("meta", {}) data['default_color'] = str(color) await self.bot.config.put('meta', data) await self.bot.responses.basic(message="The default color has been updat...
python
async def _setcolor(self, *, color : discord.Colour): """Sets the default color of embeds.""" data = self.bot.config.get("meta", {}) data['default_color'] = str(color) await self.bot.config.put('meta', data) await self.bot.responses.basic(message="The default color has been updat...
[ "async", "def", "_setcolor", "(", "self", ",", "*", ",", "color", ":", "discord", ".", "Colour", ")", ":", "data", "=", "self", ".", "bot", ".", "config", ".", "get", "(", "\"meta\"", ",", "{", "}", ")", "data", "[", "'default_color'", "]", "=", ...
Sets the default color of embeds.
[ "Sets", "the", "default", "color", "of", "embeds", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L124-L129
train
59,629
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin._do
async def _do(self, ctx, times: int, *, command): """Repeats a command a specified number of times.""" msg = copy.copy(ctx.message) msg.content = command for i in range(times): await self.bot.process_commands(msg)
python
async def _do(self, ctx, times: int, *, command): """Repeats a command a specified number of times.""" msg = copy.copy(ctx.message) msg.content = command for i in range(times): await self.bot.process_commands(msg)
[ "async", "def", "_do", "(", "self", ",", "ctx", ",", "times", ":", "int", ",", "*", ",", "command", ")", ":", "msg", "=", "copy", ".", "copy", "(", "ctx", ".", "message", ")", "msg", ".", "content", "=", "command", "for", "i", "in", "range", "(...
Repeats a command a specified number of times.
[ "Repeats", "a", "command", "a", "specified", "number", "of", "times", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L142-L147
train
59,630
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin.disable
async def disable(self, ctx, *, command: str): """Disables a command for this server. You must have Manage Server permissions or the Bot Admin role to use this command. """ command = command.lower() if command in ('enable', 'disable'): return await self.bot....
python
async def disable(self, ctx, *, command: str): """Disables a command for this server. You must have Manage Server permissions or the Bot Admin role to use this command. """ command = command.lower() if command in ('enable', 'disable'): return await self.bot....
[ "async", "def", "disable", "(", "self", ",", "ctx", ",", "*", ",", "command", ":", "str", ")", ":", "command", "=", "command", ".", "lower", "(", ")", "if", "command", "in", "(", "'enable'", ",", "'disable'", ")", ":", "return", "await", "self", "....
Disables a command for this server. You must have Manage Server permissions or the Bot Admin role to use this command.
[ "Disables", "a", "command", "for", "this", "server", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L151-L171
train
59,631
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin.enable
async def enable(self, ctx, *, command: str): """Enables a command for this server. You must have Manage Server permissions or the Bot Admin role to use this command. """ command = command.lower() guild_id = ctx.message.server.id cmds = self.config.get('commands'...
python
async def enable(self, ctx, *, command: str): """Enables a command for this server. You must have Manage Server permissions or the Bot Admin role to use this command. """ command = command.lower() guild_id = ctx.message.server.id cmds = self.config.get('commands'...
[ "async", "def", "enable", "(", "self", ",", "ctx", ",", "*", ",", "command", ":", "str", ")", ":", "command", "=", "command", ".", "lower", "(", ")", "guild_id", "=", "ctx", ".", "message", ".", "server", ".", "id", "cmds", "=", "self", ".", "con...
Enables a command for this server. You must have Manage Server permissions or the Bot Admin role to use this command.
[ "Enables", "a", "command", "for", "this", "server", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L175-L193
train
59,632
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin.ignore
async def ignore(self, ctx): """Handles the bot's ignore lists. To use these commands, you must have the Bot Admin role or have Manage Channels permissions. These commands are not allowed to be used in a private message context. Users with Manage Roles or Bot Admin role can sti...
python
async def ignore(self, ctx): """Handles the bot's ignore lists. To use these commands, you must have the Bot Admin role or have Manage Channels permissions. These commands are not allowed to be used in a private message context. Users with Manage Roles or Bot Admin role can sti...
[ "async", "def", "ignore", "(", "self", ",", "ctx", ")", ":", "if", "ctx", ".", "invoked_subcommand", "is", "None", ":", "await", "self", ".", "bot", ".", "say", "(", "'Invalid subcommand passed: {0.subcommand_passed}'", ".", "format", "(", "ctx", ")", ")" ]
Handles the bot's ignore lists. To use these commands, you must have the Bot Admin role or have Manage Channels permissions. These commands are not allowed to be used in a private message context. Users with Manage Roles or Bot Admin role can still invoke the bot in ignored cha...
[ "Handles", "the", "bot", "s", "ignore", "lists", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L197-L208
train
59,633
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin.ignore_list
async def ignore_list(self, ctx): """Tells you what channels are currently ignored in this server.""" ignored = self.config.get('ignored', []) channel_ids = set(c.id for c in ctx.message.server.channels) result = [] for channel in ignored: if channel in channel_ids: ...
python
async def ignore_list(self, ctx): """Tells you what channels are currently ignored in this server.""" ignored = self.config.get('ignored', []) channel_ids = set(c.id for c in ctx.message.server.channels) result = [] for channel in ignored: if channel in channel_ids: ...
[ "async", "def", "ignore_list", "(", "self", ",", "ctx", ")", ":", "ignored", "=", "self", ".", "config", ".", "get", "(", "'ignored'", ",", "[", "]", ")", "channel_ids", "=", "set", "(", "c", ".", "id", "for", "c", "in", "ctx", ".", "message", "....
Tells you what channels are currently ignored in this server.
[ "Tells", "you", "what", "channels", "are", "currently", "ignored", "in", "this", "server", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L211-L224
train
59,634
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin.channel_cmd
async def channel_cmd(self, ctx, *, channel : discord.Channel = None): """Ignores a specific channel from being processed. If no channel is specified, the current channel is ignored. If a channel is ignored then the bot does not process commands in that channel until it is unignored. ...
python
async def channel_cmd(self, ctx, *, channel : discord.Channel = None): """Ignores a specific channel from being processed. If no channel is specified, the current channel is ignored. If a channel is ignored then the bot does not process commands in that channel until it is unignored. ...
[ "async", "def", "channel_cmd", "(", "self", ",", "ctx", ",", "*", ",", "channel", ":", "discord", ".", "Channel", "=", "None", ")", ":", "if", "channel", "is", "None", ":", "channel", "=", "ctx", ".", "message", ".", "channel", "ignored", "=", "self"...
Ignores a specific channel from being processed. If no channel is specified, the current channel is ignored. If a channel is ignored then the bot does not process commands in that channel until it is unignored.
[ "Ignores", "a", "specific", "channel", "from", "being", "processed", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L227-L245
train
59,635
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin._all
async def _all(self, ctx): """Ignores every channel in the server from being processed. This works by adding every channel that the server currently has into the ignore list. If more channels are added then they will have to be ignored by using the ignore command. To use this c...
python
async def _all(self, ctx): """Ignores every channel in the server from being processed. This works by adding every channel that the server currently has into the ignore list. If more channels are added then they will have to be ignored by using the ignore command. To use this c...
[ "async", "def", "_all", "(", "self", ",", "ctx", ")", ":", "ignored", "=", "self", ".", "config", ".", "get", "(", "'ignored'", ",", "[", "]", ")", "channels", "=", "ctx", ".", "message", ".", "server", ".", "channels", "ignored", ".", "extend", "(...
Ignores every channel in the server from being processed. This works by adding every channel that the server currently has into the ignore list. If more channels are added then they will have to be ignored by using the ignore command. To use this command you must have Manage Server per...
[ "Ignores", "every", "channel", "in", "the", "server", "from", "being", "processed", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L249-L264
train
59,636
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin.unignore
async def unignore(self, ctx, *channels: discord.Channel): """Unignores channels from being processed. If no channels are specified, it unignores the current channel. To use this command you must have the Manage Channels permission or have the Bot Admin role. """ if le...
python
async def unignore(self, ctx, *channels: discord.Channel): """Unignores channels from being processed. If no channels are specified, it unignores the current channel. To use this command you must have the Manage Channels permission or have the Bot Admin role. """ if le...
[ "async", "def", "unignore", "(", "self", ",", "ctx", ",", "*", "channels", ":", "discord", ".", "Channel", ")", ":", "if", "len", "(", "channels", ")", "==", "0", ":", "channels", "=", "(", "ctx", ".", "message", ".", "channel", ",", ")", "# a set ...
Unignores channels from being processed. If no channels are specified, it unignores the current channel. To use this command you must have the Manage Channels permission or have the Bot Admin role.
[ "Unignores", "channels", "from", "being", "processed", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L268-L293
train
59,637
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin.unignore_all
async def unignore_all(self, ctx): """Unignores all channels in this server from being processed. To use this command you must have the Manage Channels permission or have the Bot Admin role. """ channels = [c for c in ctx.message.server.channels if c.type is discord.ChannelType....
python
async def unignore_all(self, ctx): """Unignores all channels in this server from being processed. To use this command you must have the Manage Channels permission or have the Bot Admin role. """ channels = [c for c in ctx.message.server.channels if c.type is discord.ChannelType....
[ "async", "def", "unignore_all", "(", "self", ",", "ctx", ")", ":", "channels", "=", "[", "c", "for", "c", "in", "ctx", ".", "message", ".", "server", ".", "channels", "if", "c", ".", "type", "is", "discord", ".", "ChannelType", ".", "text", "]", "a...
Unignores all channels in this server from being processed. To use this command you must have the Manage Channels permission or have the Bot Admin role.
[ "Unignores", "all", "channels", "in", "this", "server", "from", "being", "processed", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L297-L304
train
59,638
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin.cleanup
async def cleanup(self, ctx, search : int = 100): """Cleans up the bot's messages from the channel. If a search number is specified, it searches that many messages to delete. If the bot has Manage Messages permissions, then it will try to delete messages that look like they invoked the ...
python
async def cleanup(self, ctx, search : int = 100): """Cleans up the bot's messages from the channel. If a search number is specified, it searches that many messages to delete. If the bot has Manage Messages permissions, then it will try to delete messages that look like they invoked the ...
[ "async", "def", "cleanup", "(", "self", ",", "ctx", ",", "search", ":", "int", "=", "100", ")", ":", "spammers", "=", "Counter", "(", ")", "channel", "=", "ctx", ".", "message", ".", "channel", "prefixes", "=", "self", ".", "bot", ".", "command_prefi...
Cleans up the bot's messages from the channel. If a search number is specified, it searches that many messages to delete. If the bot has Manage Messages permissions, then it will try to delete messages that look like they invoked the bot as well. After the cleanup is completed, the bot...
[ "Cleans", "up", "the", "bot", "s", "messages", "from", "the", "channel", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L308-L368
train
59,639
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin.plonk
async def plonk(self, ctx, *, member: discord.Member): """Bans a user from using the bot. This bans a person from using the bot in the current server. There is no concept of a global ban. This ban can be bypassed by having the Manage Server permission. To use this command you m...
python
async def plonk(self, ctx, *, member: discord.Member): """Bans a user from using the bot. This bans a person from using the bot in the current server. There is no concept of a global ban. This ban can be bypassed by having the Manage Server permission. To use this command you m...
[ "async", "def", "plonk", "(", "self", ",", "ctx", ",", "*", ",", "member", ":", "discord", ".", "Member", ")", ":", "plonks", "=", "self", ".", "config", ".", "get", "(", "'plonks'", ",", "{", "}", ")", "guild_id", "=", "ctx", ".", "message", "."...
Bans a user from using the bot. This bans a person from using the bot in the current server. There is no concept of a global ban. This ban can be bypassed by having the Manage Server permission. To use this command you must have the Manage Server permission or have a Bot Admin ...
[ "Bans", "a", "user", "from", "using", "the", "bot", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L372-L394
train
59,640
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin.plonks
async def plonks(self, ctx): """Shows members banned from the bot.""" plonks = self.config.get('plonks', {}) guild = ctx.message.server db = plonks.get(guild.id, []) members = '\n'.join(map(str, filter(None, map(guild.get_member, db)))) if members: await self....
python
async def plonks(self, ctx): """Shows members banned from the bot.""" plonks = self.config.get('plonks', {}) guild = ctx.message.server db = plonks.get(guild.id, []) members = '\n'.join(map(str, filter(None, map(guild.get_member, db)))) if members: await self....
[ "async", "def", "plonks", "(", "self", ",", "ctx", ")", ":", "plonks", "=", "self", ".", "config", ".", "get", "(", "'plonks'", ",", "{", "}", ")", "guild", "=", "ctx", ".", "message", ".", "server", "db", "=", "plonks", ".", "get", "(", "guild",...
Shows members banned from the bot.
[ "Shows", "members", "banned", "from", "the", "bot", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L398-L407
train
59,641
rauenzi/discordbot.py
discordbot/cogs/botadmin.py
BotAdmin.unplonk
async def unplonk(self, ctx, *, member: discord.Member): """Unbans a user from using the bot. To use this command you must have the Manage Server permission or have a Bot Admin role. """ plonks = self.config.get('plonks', {}) guild_id = ctx.message.server.id db ...
python
async def unplonk(self, ctx, *, member: discord.Member): """Unbans a user from using the bot. To use this command you must have the Manage Server permission or have a Bot Admin role. """ plonks = self.config.get('plonks', {}) guild_id = ctx.message.server.id db ...
[ "async", "def", "unplonk", "(", "self", ",", "ctx", ",", "*", ",", "member", ":", "discord", ".", "Member", ")", ":", "plonks", "=", "self", ".", "config", ".", "get", "(", "'plonks'", ",", "{", "}", ")", "guild_id", "=", "ctx", ".", "message", "...
Unbans a user from using the bot. To use this command you must have the Manage Server permission or have a Bot Admin role.
[ "Unbans", "a", "user", "from", "using", "the", "bot", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/botadmin.py#L411-L429
train
59,642
rauenzi/discordbot.py
discordbot/cogs/meta.py
Meta.join
async def join(self, ctx): """Sends you the bot invite link.""" perms = discord.Permissions.none() perms.read_messages = True perms.send_messages = True perms.manage_messages = True perms.embed_links = True perms.read_message_history = True perms.attach_fi...
python
async def join(self, ctx): """Sends you the bot invite link.""" perms = discord.Permissions.none() perms.read_messages = True perms.send_messages = True perms.manage_messages = True perms.embed_links = True perms.read_message_history = True perms.attach_fi...
[ "async", "def", "join", "(", "self", ",", "ctx", ")", ":", "perms", "=", "discord", ".", "Permissions", ".", "none", "(", ")", "perms", ".", "read_messages", "=", "True", "perms", ".", "send_messages", "=", "True", "perms", ".", "manage_messages", "=", ...
Sends you the bot invite link.
[ "Sends", "you", "the", "bot", "invite", "link", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/meta.py#L31-L41
train
59,643
rauenzi/discordbot.py
discordbot/cogs/meta.py
Meta.info
async def info(self, ctx, *, member : discord.Member = None): """Shows info about a member. This cannot be used in private messages. If you don't specify a member then the info returned will be yours. """ channel = ctx.message.channel if member is None: membe...
python
async def info(self, ctx, *, member : discord.Member = None): """Shows info about a member. This cannot be used in private messages. If you don't specify a member then the info returned will be yours. """ channel = ctx.message.channel if member is None: membe...
[ "async", "def", "info", "(", "self", ",", "ctx", ",", "*", ",", "member", ":", "discord", ".", "Member", "=", "None", ")", ":", "channel", "=", "ctx", ".", "message", ".", "channel", "if", "member", "is", "None", ":", "member", "=", "ctx", ".", "...
Shows info about a member. This cannot be used in private messages. If you don't specify a member then the info returned will be yours.
[ "Shows", "info", "about", "a", "member", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/meta.py#L44-L77
train
59,644
rauenzi/discordbot.py
discordbot/bot_utils/config.py
Config.put
async def put(self, key, value, *args): """Edits a data entry.""" self._db[key] = value await self.save()
python
async def put(self, key, value, *args): """Edits a data entry.""" self._db[key] = value await self.save()
[ "async", "def", "put", "(", "self", ",", "key", ",", "value", ",", "*", "args", ")", ":", "self", ".", "_db", "[", "key", "]", "=", "value", "await", "self", ".", "save", "(", ")" ]
Edits a data entry.
[ "Edits", "a", "data", "entry", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/bot_utils/config.py#L52-L55
train
59,645
rauenzi/discordbot.py
discordbot/cogs/reactions.py
Reactions.addreaction
async def addreaction(self, ctx, *, reactor=""): """Interactively adds a custom reaction""" if not reactor: await self.bot.say("What should I react to?") response = await self.bot.wait_for_message(author=ctx.message.author) reactor = response.content data = s...
python
async def addreaction(self, ctx, *, reactor=""): """Interactively adds a custom reaction""" if not reactor: await self.bot.say("What should I react to?") response = await self.bot.wait_for_message(author=ctx.message.author) reactor = response.content data = s...
[ "async", "def", "addreaction", "(", "self", ",", "ctx", ",", "*", ",", "reactor", "=", "\"\"", ")", ":", "if", "not", "reactor", ":", "await", "self", ".", "bot", ".", "say", "(", "\"What should I react to?\"", ")", "response", "=", "await", "self", "....
Interactively adds a custom reaction
[ "Interactively", "adds", "a", "custom", "reaction" ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/reactions.py#L52-L91
train
59,646
rauenzi/discordbot.py
discordbot/cogs/reactions.py
Reactions.listreactions
async def listreactions(self, ctx): """Lists all the reactions for the server""" data = self.config.get(ctx.message.server.id, {}) if not data: await self.bot.responses.failure(message="There are no reactions on this server.") return try: pager = Pages...
python
async def listreactions(self, ctx): """Lists all the reactions for the server""" data = self.config.get(ctx.message.server.id, {}) if not data: await self.bot.responses.failure(message="There are no reactions on this server.") return try: pager = Pages...
[ "async", "def", "listreactions", "(", "self", ",", "ctx", ")", ":", "data", "=", "self", ".", "config", ".", "get", "(", "ctx", ".", "message", ".", "server", ".", "id", ",", "{", "}", ")", "if", "not", "data", ":", "await", "self", ".", "bot", ...
Lists all the reactions for the server
[ "Lists", "all", "the", "reactions", "for", "the", "server" ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/reactions.py#L95-L108
train
59,647
rauenzi/discordbot.py
discordbot/cogs/reactions.py
Reactions.viewreaction
async def viewreaction(self, ctx, *, reactor : str): """Views a specific reaction""" data = self.config.get(ctx.message.server.id, {}) keyword = data.get(reactor, {}) if not keyword: await self.bot.responses.failure(message="Reaction '{}' was not found.".format(reactor)) ...
python
async def viewreaction(self, ctx, *, reactor : str): """Views a specific reaction""" data = self.config.get(ctx.message.server.id, {}) keyword = data.get(reactor, {}) if not keyword: await self.bot.responses.failure(message="Reaction '{}' was not found.".format(reactor)) ...
[ "async", "def", "viewreaction", "(", "self", ",", "ctx", ",", "*", ",", "reactor", ":", "str", ")", ":", "data", "=", "self", ".", "config", ".", "get", "(", "ctx", ".", "message", ".", "server", ".", "id", ",", "{", "}", ")", "keyword", "=", "...
Views a specific reaction
[ "Views", "a", "specific", "reaction" ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/cogs/reactions.py#L112-L135
train
59,648
rauenzi/discordbot.py
discordbot/discordbot.py
_default_help_command
async def _default_help_command(ctx, *commands : str): """Shows this message.""" bot = ctx.bot destination = ctx.message.author if bot.pm_help else ctx.message.channel def repl(obj): return _mentions_transforms.get(obj.group(0), '') # help by itself just lists our own commands. if len(...
python
async def _default_help_command(ctx, *commands : str): """Shows this message.""" bot = ctx.bot destination = ctx.message.author if bot.pm_help else ctx.message.channel def repl(obj): return _mentions_transforms.get(obj.group(0), '') # help by itself just lists our own commands. if len(...
[ "async", "def", "_default_help_command", "(", "ctx", ",", "*", "commands", ":", "str", ")", ":", "bot", "=", "ctx", ".", "bot", "destination", "=", "ctx", ".", "message", ".", "author", "if", "bot", ".", "pm_help", "else", "ctx", ".", "message", ".", ...
Shows this message.
[ "Shows", "this", "message", "." ]
39bb98dae4e49487e6c6c597f85fc41c74b62bb8
https://github.com/rauenzi/discordbot.py/blob/39bb98dae4e49487e6c6c597f85fc41c74b62bb8/discordbot/discordbot.py#L15-L64
train
59,649
Robpol86/libnl
libnl/attr.py
nla_ok
def nla_ok(nla, remaining): """Check if the attribute header and payload can be accessed safely. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L148 Verifies that the header and payload do not exceed the number of bytes left in the attribute stream. This function must be called before ac...
python
def nla_ok(nla, remaining): """Check if the attribute header and payload can be accessed safely. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L148 Verifies that the header and payload do not exceed the number of bytes left in the attribute stream. This function must be called before ac...
[ "def", "nla_ok", "(", "nla", ",", "remaining", ")", ":", "return", "remaining", ".", "value", ">=", "nla", ".", "SIZEOF", "and", "nla", ".", "SIZEOF", "<=", "nla", ".", "nla_len", "<=", "remaining", ".", "value" ]
Check if the attribute header and payload can be accessed safely. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L148 Verifies that the header and payload do not exceed the number of bytes left in the attribute stream. This function must be called before access the attribute header or payloa...
[ "Check", "if", "the", "attribute", "header", "and", "payload", "can", "be", "accessed", "safely", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L160-L176
train
59,650
Robpol86/libnl
libnl/attr.py
nla_next
def nla_next(nla, remaining): """Return next attribute in a stream of attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L171 Calculates the offset to the next attribute based on the attribute given. The attribute provided is assumed to be accessible, the caller is responsible to...
python
def nla_next(nla, remaining): """Return next attribute in a stream of attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L171 Calculates the offset to the next attribute based on the attribute given. The attribute provided is assumed to be accessible, the caller is responsible to...
[ "def", "nla_next", "(", "nla", ",", "remaining", ")", ":", "totlen", "=", "int", "(", "NLA_ALIGN", "(", "nla", ".", "nla_len", ")", ")", "remaining", ".", "value", "-=", "totlen", "return", "nlattr", "(", "bytearray_ptr", "(", "nla", ".", "bytearray", ...
Return next attribute in a stream of attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L171 Calculates the offset to the next attribute based on the attribute given. The attribute provided is assumed to be accessible, the caller is responsible to use nla_ok() beforehand. The offset ...
[ "Return", "next", "attribute", "in", "a", "stream", "of", "attributes", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L179-L200
train
59,651
Robpol86/libnl
libnl/attr.py
nla_parse
def nla_parse(tb, maxtype, head, len_, policy): """Create attribute index based on a stream of attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L242 Iterates over the stream of attributes and stores a pointer to each attribute in the index array using the attribute type as inde...
python
def nla_parse(tb, maxtype, head, len_, policy): """Create attribute index based on a stream of attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L242 Iterates over the stream of attributes and stores a pointer to each attribute in the index array using the attribute type as inde...
[ "def", "nla_parse", "(", "tb", ",", "maxtype", ",", "head", ",", "len_", ",", "policy", ")", ":", "rem", "=", "c_int", "(", ")", "for", "nla", "in", "nla_for_each_attr", "(", "head", ",", "len_", ",", "rem", ")", ":", "type_", "=", "nla_type", "(",...
Create attribute index based on a stream of attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L242 Iterates over the stream of attributes and stores a pointer to each attribute in the index array using the attribute type as index to the array. Attribute with a type greater than the ...
[ "Create", "attribute", "index", "based", "on", "a", "stream", "of", "attributes", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L253-L292
train
59,652
Robpol86/libnl
libnl/attr.py
nla_for_each_attr
def nla_for_each_attr(head, len_, rem): """Iterate over a stream of attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/attr.h#L262 Positional arguments: head -- first nlattr with more in its bytearray payload (nlattr class instance). len_ -- length of attribute stream (i...
python
def nla_for_each_attr(head, len_, rem): """Iterate over a stream of attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/attr.h#L262 Positional arguments: head -- first nlattr with more in its bytearray payload (nlattr class instance). len_ -- length of attribute stream (i...
[ "def", "nla_for_each_attr", "(", "head", ",", "len_", ",", "rem", ")", ":", "pos", "=", "head", "rem", ".", "value", "=", "len_", "while", "nla_ok", "(", "pos", ",", "rem", ")", ":", "yield", "pos", "pos", "=", "nla_next", "(", "pos", ",", "rem", ...
Iterate over a stream of attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/attr.h#L262 Positional arguments: head -- first nlattr with more in its bytearray payload (nlattr class instance). len_ -- length of attribute stream (integer). rem -- initialized to len, holds b...
[ "Iterate", "over", "a", "stream", "of", "attributes", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L295-L312
train
59,653
Robpol86/libnl
libnl/attr.py
nla_for_each_nested
def nla_for_each_nested(nla, rem): """Iterate over a stream of nested attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/attr.h#L274 Positional arguments: nla -- attribute containing the nested attributes (nlattr class instance). rem -- initialized to len, holds bytes cu...
python
def nla_for_each_nested(nla, rem): """Iterate over a stream of nested attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/attr.h#L274 Positional arguments: nla -- attribute containing the nested attributes (nlattr class instance). rem -- initialized to len, holds bytes cu...
[ "def", "nla_for_each_nested", "(", "nla", ",", "rem", ")", ":", "pos", "=", "nlattr", "(", "nla_data", "(", "nla", ")", ")", "rem", ".", "value", "=", "nla_len", "(", "nla", ")", "while", "nla_ok", "(", "pos", ",", "rem", ")", ":", "yield", "pos", ...
Iterate over a stream of nested attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/attr.h#L274 Positional arguments: nla -- attribute containing the nested attributes (nlattr class instance). rem -- initialized to len, holds bytes currently remaining in stream (c_int). ...
[ "Iterate", "over", "a", "stream", "of", "nested", "attributes", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L315-L331
train
59,654
Robpol86/libnl
libnl/attr.py
nla_find
def nla_find(head, len_, attrtype): """Find a single attribute in a stream of attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L323 Iterates over the stream of attributes and compares each type with the type specified. Returns the first attribute which matches the type. Po...
python
def nla_find(head, len_, attrtype): """Find a single attribute in a stream of attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L323 Iterates over the stream of attributes and compares each type with the type specified. Returns the first attribute which matches the type. Po...
[ "def", "nla_find", "(", "head", ",", "len_", ",", "attrtype", ")", ":", "rem", "=", "c_int", "(", ")", "for", "nla", "in", "nla_for_each_attr", "(", "head", ",", "len_", ",", "rem", ")", ":", "if", "nla_type", "(", "nla", ")", "==", "attrtype", ":"...
Find a single attribute in a stream of attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L323 Iterates over the stream of attributes and compares each type with the type specified. Returns the first attribute which matches the type. Positional arguments: head -- first nlatt...
[ "Find", "a", "single", "attribute", "in", "a", "stream", "of", "attributes", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L334-L354
train
59,655
Robpol86/libnl
libnl/attr.py
nla_reserve
def nla_reserve(msg, attrtype, attrlen): """Reserve space for an attribute. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L456 Reserves room for an attribute in the specified Netlink message and fills in the attribute header (type, length). Returns None if there is insufficient space fo...
python
def nla_reserve(msg, attrtype, attrlen): """Reserve space for an attribute. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L456 Reserves room for an attribute in the specified Netlink message and fills in the attribute header (type, length). Returns None if there is insufficient space fo...
[ "def", "nla_reserve", "(", "msg", ",", "attrtype", ",", "attrlen", ")", ":", "tlen", "=", "NLMSG_ALIGN", "(", "msg", ".", "nm_nlh", ".", "nlmsg_len", ")", "+", "nla_total_size", "(", "attrlen", ")", "if", "tlen", ">", "msg", ".", "nm_size", ":", "retur...
Reserve space for an attribute. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L456 Reserves room for an attribute in the specified Netlink message and fills in the attribute header (type, length). Returns None if there is insufficient space for the attribute. Any padding between payloa...
[ "Reserve", "space", "for", "an", "attribute", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L357-L392
train
59,656
Robpol86/libnl
libnl/attr.py
nla_put
def nla_put(msg, attrtype, datalen, data): """Add a unspecific attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L497 Reserves room for an unspecific attribute and copies the provided data into the message as payload of the attribute. Returns an error if there ...
python
def nla_put(msg, attrtype, datalen, data): """Add a unspecific attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L497 Reserves room for an unspecific attribute and copies the provided data into the message as payload of the attribute. Returns an error if there ...
[ "def", "nla_put", "(", "msg", ",", "attrtype", ",", "datalen", ",", "data", ")", ":", "nla", "=", "nla_reserve", "(", "msg", ",", "attrtype", ",", "datalen", ")", "if", "not", "nla", ":", "return", "-", "NLE_NOMEM", "if", "datalen", "<=", "0", ":", ...
Add a unspecific attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L497 Reserves room for an unspecific attribute and copies the provided data into the message as payload of the attribute. Returns an error if there is insufficient space for the attribute. Posi...
[ "Add", "a", "unspecific", "attribute", "to", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L395-L421
train
59,657
Robpol86/libnl
libnl/attr.py
nla_put_data
def nla_put_data(msg, attrtype, data): """Add abstract data as unspecific attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L527 Equivalent to nla_put() except that the length of the payload is derived from the bytearray data object. Positional arguments: ...
python
def nla_put_data(msg, attrtype, data): """Add abstract data as unspecific attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L527 Equivalent to nla_put() except that the length of the payload is derived from the bytearray data object. Positional arguments: ...
[ "def", "nla_put_data", "(", "msg", ",", "attrtype", ",", "data", ")", ":", "return", "nla_put", "(", "msg", ",", "attrtype", ",", "len", "(", "data", ")", ",", "data", ")" ]
Add abstract data as unspecific attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L527 Equivalent to nla_put() except that the length of the payload is derived from the bytearray data object. Positional arguments: msg -- Netlink message (nl_msg class instance)...
[ "Add", "abstract", "data", "as", "unspecific", "attribute", "to", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L424-L439
train
59,658
Robpol86/libnl
libnl/attr.py
nla_put_u8
def nla_put_u8(msg, attrtype, value): """Add 8 bit integer attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L563 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- numeric value to store...
python
def nla_put_u8(msg, attrtype, value): """Add 8 bit integer attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L563 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- numeric value to store...
[ "def", "nla_put_u8", "(", "msg", ",", "attrtype", ",", "value", ")", ":", "data", "=", "bytearray", "(", "value", "if", "isinstance", "(", "value", ",", "c_uint8", ")", "else", "c_uint8", "(", "value", ")", ")", "return", "nla_put", "(", "msg", ",", ...
Add 8 bit integer attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L563 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- numeric value to store as payload (int() or c_uint8()). Return...
[ "Add", "8", "bit", "integer", "attribute", "to", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L442-L456
train
59,659
Robpol86/libnl
libnl/attr.py
nla_put_u16
def nla_put_u16(msg, attrtype, value): """Add 16 bit integer attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L588 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- numeric value to sto...
python
def nla_put_u16(msg, attrtype, value): """Add 16 bit integer attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L588 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- numeric value to sto...
[ "def", "nla_put_u16", "(", "msg", ",", "attrtype", ",", "value", ")", ":", "data", "=", "bytearray", "(", "value", "if", "isinstance", "(", "value", ",", "c_uint16", ")", "else", "c_uint16", "(", "value", ")", ")", "return", "nla_put", "(", "msg", ",",...
Add 16 bit integer attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L588 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- numeric value to store as payload (int() or c_uint16()). Retu...
[ "Add", "16", "bit", "integer", "attribute", "to", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L473-L487
train
59,660
Robpol86/libnl
libnl/attr.py
nla_put_u32
def nla_put_u32(msg, attrtype, value): """Add 32 bit integer attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L613 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- numeric value to sto...
python
def nla_put_u32(msg, attrtype, value): """Add 32 bit integer attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L613 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- numeric value to sto...
[ "def", "nla_put_u32", "(", "msg", ",", "attrtype", ",", "value", ")", ":", "data", "=", "bytearray", "(", "value", "if", "isinstance", "(", "value", ",", "c_uint32", ")", "else", "c_uint32", "(", "value", ")", ")", "return", "nla_put", "(", "msg", ",",...
Add 32 bit integer attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L613 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- numeric value to store as payload (int() or c_uint32()). Retu...
[ "Add", "32", "bit", "integer", "attribute", "to", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L504-L518
train
59,661
Robpol86/libnl
libnl/attr.py
nla_put_u64
def nla_put_u64(msg, attrtype, value): """Add 64 bit integer attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L638 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- numeric value to sto...
python
def nla_put_u64(msg, attrtype, value): """Add 64 bit integer attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L638 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- numeric value to sto...
[ "def", "nla_put_u64", "(", "msg", ",", "attrtype", ",", "value", ")", ":", "data", "=", "bytearray", "(", "value", "if", "isinstance", "(", "value", ",", "c_uint64", ")", "else", "c_uint64", "(", "value", ")", ")", "return", "nla_put", "(", "msg", ",",...
Add 64 bit integer attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L638 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- numeric value to store as payload (int() or c_uint64()). Retu...
[ "Add", "64", "bit", "integer", "attribute", "to", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L535-L549
train
59,662
Robpol86/libnl
libnl/attr.py
nla_put_string
def nla_put_string(msg, attrtype, value): """Add string attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L674 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- bytes() or bytearray() va...
python
def nla_put_string(msg, attrtype, value): """Add string attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L674 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- bytes() or bytearray() va...
[ "def", "nla_put_string", "(", "msg", ",", "attrtype", ",", "value", ")", ":", "data", "=", "bytearray", "(", "value", ")", "+", "bytearray", "(", "b'\\0'", ")", "return", "nla_put", "(", "msg", ",", "attrtype", ",", "len", "(", "data", ")", ",", "dat...
Add string attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L674 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). value -- bytes() or bytearray() value (e.g. 'Test'.encode('ascii')). Returns: ...
[ "Add", "string", "attribute", "to", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L569-L583
train
59,663
Robpol86/libnl
libnl/attr.py
nla_put_msecs
def nla_put_msecs(msg, attrtype, msecs): """Add msecs Netlink attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L737 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). msecs -- number of msecs (in...
python
def nla_put_msecs(msg, attrtype, msecs): """Add msecs Netlink attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L737 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). msecs -- number of msecs (in...
[ "def", "nla_put_msecs", "(", "msg", ",", "attrtype", ",", "msecs", ")", ":", "if", "isinstance", "(", "msecs", ",", "c_uint64", ")", ":", "pass", "elif", "isinstance", "(", "msecs", ",", "c_ulong", ")", ":", "msecs", "=", "c_uint64", "(", "msecs", ".",...
Add msecs Netlink attribute to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L737 Positional arguments: msg -- Netlink message (nl_msg class instance). attrtype -- attribute type (integer). msecs -- number of msecs (int(), c_uint64(), or c_ulong()). Returns: ...
[ "Add", "msecs", "Netlink", "attribute", "to", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L629-L648
train
59,664
Robpol86/libnl
libnl/attr.py
nla_put_nested
def nla_put_nested(msg, attrtype, nested): """Add nested attributes to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L772 Takes the attributes found in the `nested` message and appends them to the message `msg` nested in a container of the type `attrtype`. The `nested` ...
python
def nla_put_nested(msg, attrtype, nested): """Add nested attributes to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L772 Takes the attributes found in the `nested` message and appends them to the message `msg` nested in a container of the type `attrtype`. The `nested` ...
[ "def", "nla_put_nested", "(", "msg", ",", "attrtype", ",", "nested", ")", ":", "_LOGGER", ".", "debug", "(", "'msg 0x%x: attr <> %d: adding msg 0x%x as nested attribute'", ",", "id", "(", "msg", ")", ",", "attrtype", ",", "id", "(", "nested", ")", ")", "return...
Add nested attributes to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L772 Takes the attributes found in the `nested` message and appends them to the message `msg` nested in a container of the type `attrtype`. The `nested` message may not have a family specific header. ...
[ "Add", "nested", "attributes", "to", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L665-L682
train
59,665
Robpol86/libnl
libnl/attr.py
nla_parse_nested
def nla_parse_nested(tb, maxtype, nla, policy): """Create attribute index based on nested attribute. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L885 Feeds the stream of attributes nested into the specified attribute to nla_parse(). Positional arguments: tb -- dictionary to be fi...
python
def nla_parse_nested(tb, maxtype, nla, policy): """Create attribute index based on nested attribute. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L885 Feeds the stream of attributes nested into the specified attribute to nla_parse(). Positional arguments: tb -- dictionary to be fi...
[ "def", "nla_parse_nested", "(", "tb", ",", "maxtype", ",", "nla", ",", "policy", ")", ":", "return", "nla_parse", "(", "tb", ",", "maxtype", ",", "nlattr", "(", "nla_data", "(", "nla", ")", ")", ",", "nla_len", "(", "nla", ")", ",", "policy", ")" ]
Create attribute index based on nested attribute. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/attr.c#L885 Feeds the stream of attributes nested into the specified attribute to nla_parse(). Positional arguments: tb -- dictionary to be filled (maxtype+1 elements). maxtype -- maximum attri...
[ "Create", "attribute", "index", "based", "on", "nested", "attribute", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/attr.py#L685-L701
train
59,666
Robpol86/libnl
libnl/genl/genl.py
genl_send_simple
def genl_send_simple(sk, family, cmd, version, flags): """Send a Generic Netlink message consisting only of a header. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L84 This function is a shortcut for sending a Generic Netlink message without any message payload. The message will only ...
python
def genl_send_simple(sk, family, cmd, version, flags): """Send a Generic Netlink message consisting only of a header. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L84 This function is a shortcut for sending a Generic Netlink message without any message payload. The message will only ...
[ "def", "genl_send_simple", "(", "sk", ",", "family", ",", "cmd", ",", "version", ",", "flags", ")", ":", "hdr", "=", "genlmsghdr", "(", "cmd", "=", "cmd", ",", "version", "=", "version", ")", "return", "int", "(", "nl_send_simple", "(", "sk", ",", "f...
Send a Generic Netlink message consisting only of a header. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L84 This function is a shortcut for sending a Generic Netlink message without any message payload. The message will only consist of the Netlink and Generic Netlink headers. The hea...
[ "Send", "a", "Generic", "Netlink", "message", "consisting", "only", "of", "a", "header", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/genl/genl.py#L44-L64
train
59,667
Robpol86/libnl
libnl/genl/genl.py
genlmsg_valid_hdr
def genlmsg_valid_hdr(nlh, hdrlen): """Validate Generic Netlink message headers. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L117 Verifies the integrity of the Netlink and Generic Netlink headers by enforcing the following requirements: - Valid Netlink message header (`nlmsg_vali...
python
def genlmsg_valid_hdr(nlh, hdrlen): """Validate Generic Netlink message headers. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L117 Verifies the integrity of the Netlink and Generic Netlink headers by enforcing the following requirements: - Valid Netlink message header (`nlmsg_vali...
[ "def", "genlmsg_valid_hdr", "(", "nlh", ",", "hdrlen", ")", ":", "if", "not", "nlmsg_valid_hdr", "(", "nlh", ",", "GENL_HDRLEN", ")", ":", "return", "False", "ghdr", "=", "genlmsghdr", "(", "nlmsg_data", "(", "nlh", ")", ")", "if", "genlmsg_len", "(", "g...
Validate Generic Netlink message headers. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L117 Verifies the integrity of the Netlink and Generic Netlink headers by enforcing the following requirements: - Valid Netlink message header (`nlmsg_valid_hdr()`) - Presence of a complete Gene...
[ "Validate", "Generic", "Netlink", "message", "headers", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/genl/genl.py#L67-L91
train
59,668
Robpol86/libnl
libnl/genl/genl.py
genlmsg_parse
def genlmsg_parse(nlh, hdrlen, tb, maxtype, policy): """Parse Generic Netlink message including attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L191 Verifies the validity of the Netlink and Generic Netlink headers using genlmsg_valid_hdr() and calls nla_parse() on the mes...
python
def genlmsg_parse(nlh, hdrlen, tb, maxtype, policy): """Parse Generic Netlink message including attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L191 Verifies the validity of the Netlink and Generic Netlink headers using genlmsg_valid_hdr() and calls nla_parse() on the mes...
[ "def", "genlmsg_parse", "(", "nlh", ",", "hdrlen", ",", "tb", ",", "maxtype", ",", "policy", ")", ":", "if", "not", "genlmsg_valid_hdr", "(", "nlh", ",", "hdrlen", ")", ":", "return", "-", "NLE_MSG_TOOSHORT", "ghdr", "=", "genlmsghdr", "(", "nlmsg_data", ...
Parse Generic Netlink message including attributes. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L191 Verifies the validity of the Netlink and Generic Netlink headers using genlmsg_valid_hdr() and calls nla_parse() on the message payload to parse eventual attributes. Positional a...
[ "Parse", "Generic", "Netlink", "message", "including", "attributes", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/genl/genl.py#L94-L116
train
59,669
Robpol86/libnl
libnl/genl/genl.py
genlmsg_len
def genlmsg_len(gnlh): """Return length of message payload including user header. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L224 Positional arguments: gnlh -- Generic Netlink message header (genlmsghdr class instance). Returns: Length of user payload including an event...
python
def genlmsg_len(gnlh): """Return length of message payload including user header. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L224 Positional arguments: gnlh -- Generic Netlink message header (genlmsghdr class instance). Returns: Length of user payload including an event...
[ "def", "genlmsg_len", "(", "gnlh", ")", ":", "nlh", "=", "nlmsghdr", "(", "bytearray_ptr", "(", "gnlh", ".", "bytearray", ",", "-", "NLMSG_HDRLEN", ",", "oob", "=", "True", ")", ")", "return", "nlh", ".", "nlmsg_len", "-", "GENL_HDRLEN", "-", "NLMSG_HDRL...
Return length of message payload including user header. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L224 Positional arguments: gnlh -- Generic Netlink message header (genlmsghdr class instance). Returns: Length of user payload including an eventual user header in number of b...
[ "Return", "length", "of", "message", "payload", "including", "user", "header", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/genl/genl.py#L133-L145
train
59,670
Robpol86/libnl
libnl/genl/genl.py
genlmsg_put
def genlmsg_put(msg, port, seq, family, hdrlen, flags, cmd, version): """Add Generic Netlink headers to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L348 Calls nlmsg_put() on the specified message object to reserve space for the Netlink header, the Generic Netlink ...
python
def genlmsg_put(msg, port, seq, family, hdrlen, flags, cmd, version): """Add Generic Netlink headers to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L348 Calls nlmsg_put() on the specified message object to reserve space for the Netlink header, the Generic Netlink ...
[ "def", "genlmsg_put", "(", "msg", ",", "port", ",", "seq", ",", "family", ",", "hdrlen", ",", "flags", ",", "cmd", ",", "version", ")", ":", "hdr", "=", "genlmsghdr", "(", "cmd", "=", "cmd", ",", "version", "=", "version", ")", "nlh", "=", "nlmsg_p...
Add Generic Netlink headers to Netlink message. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c#L348 Calls nlmsg_put() on the specified message object to reserve space for the Netlink header, the Generic Netlink header, and a user header of specified length. Fills out the header fields w...
[ "Add", "Generic", "Netlink", "headers", "to", "Netlink", "message", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/genl/genl.py#L211-L238
train
59,671
Robpol86/libnl
libnl/netlink_private/netlink.py
nl_cb_call
def nl_cb_call(cb, type_, msg): """Call a callback function. https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink-private/netlink.h#L136 Positional arguments: cb -- nl_cb class instance. type_ -- callback type integer (e.g. NL_CB_MSG_OUT). msg -- Netlink message (nl_msg class inst...
python
def nl_cb_call(cb, type_, msg): """Call a callback function. https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink-private/netlink.h#L136 Positional arguments: cb -- nl_cb class instance. type_ -- callback type integer (e.g. NL_CB_MSG_OUT). msg -- Netlink message (nl_msg class inst...
[ "def", "nl_cb_call", "(", "cb", ",", "type_", ",", "msg", ")", ":", "cb", ".", "cb_active", "=", "type_", "ret", "=", "cb", ".", "cb_set", "[", "type_", "]", "(", "msg", ",", "cb", ".", "cb_args", "[", "type_", "]", ")", "cb", ".", "cb_active", ...
Call a callback function. https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink-private/netlink.h#L136 Positional arguments: cb -- nl_cb class instance. type_ -- callback type integer (e.g. NL_CB_MSG_OUT). msg -- Netlink message (nl_msg class instance). Returns: Integer from t...
[ "Call", "a", "callback", "function", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/netlink_private/netlink.py#L18-L34
train
59,672
Robpol86/libnl
libnl/linux_private/netlink.py
sockaddr_nl.nl_pad
def nl_pad(self, value): """Pad setter.""" self.bytearray[self._get_slicers(1)] = bytearray(c_ushort(value or 0))
python
def nl_pad(self, value): """Pad setter.""" self.bytearray[self._get_slicers(1)] = bytearray(c_ushort(value or 0))
[ "def", "nl_pad", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "1", ")", "]", "=", "bytearray", "(", "c_ushort", "(", "value", "or", "0", ")", ")" ]
Pad setter.
[ "Pad", "setter", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/linux_private/netlink.py#L81-L83
train
59,673
Robpol86/libnl
libnl/linux_private/netlink.py
sockaddr_nl.nl_groups
def nl_groups(self, value): """Group setter.""" self.bytearray[self._get_slicers(3)] = bytearray(c_uint32(value or 0))
python
def nl_groups(self, value): """Group setter.""" self.bytearray[self._get_slicers(3)] = bytearray(c_uint32(value or 0))
[ "def", "nl_groups", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "3", ")", "]", "=", "bytearray", "(", "c_uint32", "(", "value", "or", "0", ")", ")" ]
Group setter.
[ "Group", "setter", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/linux_private/netlink.py#L101-L103
train
59,674
Robpol86/libnl
libnl/linux_private/netlink.py
nlmsghdr.nlmsg_type
def nlmsg_type(self, value): """Message content setter.""" self.bytearray[self._get_slicers(1)] = bytearray(c_uint16(value or 0))
python
def nlmsg_type(self, value): """Message content setter.""" self.bytearray[self._get_slicers(1)] = bytearray(c_uint16(value or 0))
[ "def", "nlmsg_type", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "1", ")", "]", "=", "bytearray", "(", "c_uint16", "(", "value", "or", "0", ")", ")" ]
Message content setter.
[ "Message", "content", "setter", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/linux_private/netlink.py#L162-L164
train
59,675
Robpol86/libnl
libnl/linux_private/netlink.py
nlmsghdr.nlmsg_seq
def nlmsg_seq(self, value): """Sequence setter.""" self.bytearray[self._get_slicers(3)] = bytearray(c_uint32(value or 0))
python
def nlmsg_seq(self, value): """Sequence setter.""" self.bytearray[self._get_slicers(3)] = bytearray(c_uint32(value or 0))
[ "def", "nlmsg_seq", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "3", ")", "]", "=", "bytearray", "(", "c_uint32", "(", "value", "or", "0", ")", ")" ]
Sequence setter.
[ "Sequence", "setter", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/linux_private/netlink.py#L182-L184
train
59,676
Robpol86/libnl
libnl/socket_.py
nl_socket_alloc
def nl_socket_alloc(cb=None): """Allocate new Netlink socket. Does not yet actually open a socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L206 Also has code for generating local port once. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/nl.c#L123 Keyword arguments: ...
python
def nl_socket_alloc(cb=None): """Allocate new Netlink socket. Does not yet actually open a socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L206 Also has code for generating local port once. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/nl.c#L123 Keyword arguments: ...
[ "def", "nl_socket_alloc", "(", "cb", "=", "None", ")", ":", "# Allocate the callback.", "cb", "=", "cb", "or", "nl_cb_alloc", "(", "default_cb", ")", "if", "not", "cb", ":", "return", "None", "# Allocate the socket.", "sk", "=", "nl_sock", "(", ")", "sk", ...
Allocate new Netlink socket. Does not yet actually open a socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L206 Also has code for generating local port once. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/nl.c#L123 Keyword arguments: cb -- custom callback handler. ...
[ "Allocate", "new", "Netlink", "socket", ".", "Does", "not", "yet", "actually", "open", "a", "socket", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/socket_.py#L64-L94
train
59,677
Robpol86/libnl
libnl/socket_.py
nl_socket_add_memberships
def nl_socket_add_memberships(sk, *group): """Join groups. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L417 Joins the specified groups using the modern socket option. The list of groups has to be terminated by 0. Make sure to use the correct group definitions as the older bitmask d...
python
def nl_socket_add_memberships(sk, *group): """Join groups. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L417 Joins the specified groups using the modern socket option. The list of groups has to be terminated by 0. Make sure to use the correct group definitions as the older bitmask d...
[ "def", "nl_socket_add_memberships", "(", "sk", ",", "*", "group", ")", ":", "if", "sk", ".", "s_fd", "==", "-", "1", ":", "return", "-", "NLE_BAD_SOCK", "for", "grp", "in", "group", ":", "if", "not", "grp", ":", "break", "if", "grp", "<", "0", ":",...
Join groups. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L417 Joins the specified groups using the modern socket option. The list of groups has to be terminated by 0. Make sure to use the correct group definitions as the older bitmask definitions for nl_join_groups() are likely to ...
[ "Join", "groups", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/socket_.py#L122-L150
train
59,678
Robpol86/libnl
libnl/socket_.py
nl_socket_drop_memberships
def nl_socket_drop_memberships(sk, *group): """Leave groups. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L465 Leaves the specified groups using the modern socket option. The list of groups has to terminated by 0. Positional arguments: sk -- Netlink socket (nl_sock class instanc...
python
def nl_socket_drop_memberships(sk, *group): """Leave groups. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L465 Leaves the specified groups using the modern socket option. The list of groups has to terminated by 0. Positional arguments: sk -- Netlink socket (nl_sock class instanc...
[ "def", "nl_socket_drop_memberships", "(", "sk", ",", "*", "group", ")", ":", "if", "sk", ".", "s_fd", "==", "-", "1", ":", "return", "-", "NLE_BAD_SOCK", "for", "grp", "in", "group", ":", "if", "not", "grp", ":", "break", "if", "grp", "<", "0", ":"...
Leave groups. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L465 Leaves the specified groups using the modern socket option. The list of groups has to terminated by 0. Positional arguments: sk -- Netlink socket (nl_sock class instance). group -- group identifier (integer). R...
[ "Leave", "groups", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/socket_.py#L168-L193
train
59,679
Robpol86/libnl
libnl/socket_.py
nl_socket_modify_cb
def nl_socket_modify_cb(sk, type_, kind, func, arg): """Modify the callback handler associated with the socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L633 Sets specific callback functions in the existing nl_cb class instance stored in the nl_sock socket. Positional arguments:...
python
def nl_socket_modify_cb(sk, type_, kind, func, arg): """Modify the callback handler associated with the socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L633 Sets specific callback functions in the existing nl_cb class instance stored in the nl_sock socket. Positional arguments:...
[ "def", "nl_socket_modify_cb", "(", "sk", ",", "type_", ",", "kind", ",", "func", ",", "arg", ")", ":", "return", "int", "(", "nl_cb_set", "(", "sk", ".", "s_cb", ",", "type_", ",", "kind", ",", "func", ",", "arg", ")", ")" ]
Modify the callback handler associated with the socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L633 Sets specific callback functions in the existing nl_cb class instance stored in the nl_sock socket. Positional arguments: sk -- Netlink socket (nl_sock class instance). type...
[ "Modify", "the", "callback", "handler", "associated", "with", "the", "socket", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/socket_.py#L239-L256
train
59,680
Robpol86/libnl
libnl/socket_.py
nl_socket_modify_err_cb
def nl_socket_modify_err_cb(sk, kind, func, arg): """Modify the error callback handler associated with the socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L649 Positional arguments: sk -- Netlink socket (nl_sock class instance). kind -- kind of callback (integer). func -...
python
def nl_socket_modify_err_cb(sk, kind, func, arg): """Modify the error callback handler associated with the socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L649 Positional arguments: sk -- Netlink socket (nl_sock class instance). kind -- kind of callback (integer). func -...
[ "def", "nl_socket_modify_err_cb", "(", "sk", ",", "kind", ",", "func", ",", "arg", ")", ":", "return", "int", "(", "nl_cb_err", "(", "sk", ".", "s_cb", ",", "kind", ",", "func", ",", "arg", ")", ")" ]
Modify the error callback handler associated with the socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L649 Positional arguments: sk -- Netlink socket (nl_sock class instance). kind -- kind of callback (integer). func -- callback function. arg -- argument to be passed to ...
[ "Modify", "the", "error", "callback", "handler", "associated", "with", "the", "socket", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/socket_.py#L259-L273
train
59,681
Robpol86/libnl
libnl/socket_.py
nl_socket_set_buffer_size
def nl_socket_set_buffer_size(sk, rxbuf, txbuf): """Set socket buffer size of Netlink socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L675 Sets the socket buffer size of a Netlink socket to the specified values `rxbuf` and `txbuf`. Providing a value of 0 assumes a good default v...
python
def nl_socket_set_buffer_size(sk, rxbuf, txbuf): """Set socket buffer size of Netlink socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L675 Sets the socket buffer size of a Netlink socket to the specified values `rxbuf` and `txbuf`. Providing a value of 0 assumes a good default v...
[ "def", "nl_socket_set_buffer_size", "(", "sk", ",", "rxbuf", ",", "txbuf", ")", ":", "rxbuf", "=", "32768", "if", "rxbuf", "<=", "0", "else", "rxbuf", "txbuf", "=", "32768", "if", "txbuf", "<=", "0", "else", "txbuf", "if", "sk", ".", "s_fd", "==", "-...
Set socket buffer size of Netlink socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L675 Sets the socket buffer size of a Netlink socket to the specified values `rxbuf` and `txbuf`. Providing a value of 0 assumes a good default value. Positional arguments: sk -- Netlink socke...
[ "Set", "socket", "buffer", "size", "of", "Netlink", "socket", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/socket_.py#L276-L308
train
59,682
Robpol86/libnl
libnl/linux_private/genetlink.py
genlmsghdr.cmd
def cmd(self, value): """Command setter.""" self.bytearray[self._get_slicers(0)] = bytearray(c_uint8(value or 0))
python
def cmd(self, value): """Command setter.""" self.bytearray[self._get_slicers(0)] = bytearray(c_uint8(value or 0))
[ "def", "cmd", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "0", ")", "]", "=", "bytearray", "(", "c_uint8", "(", "value", "or", "0", ")", ")" ]
Command setter.
[ "Command", "setter", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/linux_private/genetlink.py#L51-L53
train
59,683
Robpol86/libnl
libnl/linux_private/genetlink.py
genlmsghdr.version
def version(self, value): """Version setter.""" self.bytearray[self._get_slicers(1)] = bytearray(c_uint8(value or 0))
python
def version(self, value): """Version setter.""" self.bytearray[self._get_slicers(1)] = bytearray(c_uint8(value or 0))
[ "def", "version", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "1", ")", "]", "=", "bytearray", "(", "c_uint8", "(", "value", "or", "0", ")", ")" ]
Version setter.
[ "Version", "setter", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/linux_private/genetlink.py#L61-L63
train
59,684
Robpol86/libnl
libnl/linux_private/genetlink.py
genlmsghdr.reserved
def reserved(self, value): """Reserved setter.""" self.bytearray[self._get_slicers(2)] = bytearray(c_uint16(value or 0))
python
def reserved(self, value): """Reserved setter.""" self.bytearray[self._get_slicers(2)] = bytearray(c_uint16(value or 0))
[ "def", "reserved", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "2", ")", "]", "=", "bytearray", "(", "c_uint16", "(", "value", "or", "0", ")", ")" ]
Reserved setter.
[ "Reserved", "setter", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/linux_private/genetlink.py#L71-L73
train
59,685
Robpol86/libnl
libnl/nl80211/helpers.py
_get
def _get(out_parsed, in_bss, key, parser_func): """Handle calling the parser function to convert bytearray data into Python data types. Positional arguments: out_parsed -- dictionary to update with parsed data and string keys. in_bss -- dictionary of integer keys and bytearray values. key -- key st...
python
def _get(out_parsed, in_bss, key, parser_func): """Handle calling the parser function to convert bytearray data into Python data types. Positional arguments: out_parsed -- dictionary to update with parsed data and string keys. in_bss -- dictionary of integer keys and bytearray values. key -- key st...
[ "def", "_get", "(", "out_parsed", ",", "in_bss", ",", "key", ",", "parser_func", ")", ":", "short_key", "=", "key", "[", "12", ":", "]", ".", "lower", "(", ")", "key_integer", "=", "getattr", "(", "nl80211", ",", "key", ")", "if", "in_bss", ".", "g...
Handle calling the parser function to convert bytearray data into Python data types. Positional arguments: out_parsed -- dictionary to update with parsed data and string keys. in_bss -- dictionary of integer keys and bytearray values. key -- key string to lookup (must be a variable name in libnl.nl8021...
[ "Handle", "calling", "the", "parser", "function", "to", "convert", "bytearray", "data", "into", "Python", "data", "types", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/nl80211/helpers.py#L10-L26
train
59,686
Robpol86/libnl
libnl/nl80211/helpers.py
_fetch
def _fetch(in_parsed, *keys): """Retrieve nested dict data from either information elements or beacon IES dicts. Positional arguments: in_parsed -- dictionary to read from. keys -- one or more nested dict keys to lookup. Returns: Found value or None. """ for ie in ('information_element...
python
def _fetch(in_parsed, *keys): """Retrieve nested dict data from either information elements or beacon IES dicts. Positional arguments: in_parsed -- dictionary to read from. keys -- one or more nested dict keys to lookup. Returns: Found value or None. """ for ie in ('information_element...
[ "def", "_fetch", "(", "in_parsed", ",", "*", "keys", ")", ":", "for", "ie", "in", "(", "'information_elements'", ",", "'beacon_ies'", ")", ":", "target", "=", "in_parsed", ".", "get", "(", "ie", ",", "{", "}", ")", "for", "key", "in", "keys", ":", ...
Retrieve nested dict data from either information elements or beacon IES dicts. Positional arguments: in_parsed -- dictionary to read from. keys -- one or more nested dict keys to lookup. Returns: Found value or None.
[ "Retrieve", "nested", "dict", "data", "from", "either", "information", "elements", "or", "beacon", "IES", "dicts", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/nl80211/helpers.py#L29-L45
train
59,687
Robpol86/libnl
libnl/handlers.py
nl_cb_alloc
def nl_cb_alloc(kind): """Allocate a new callback handle. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L201 Positional arguments: kind -- callback kind to be used for initialization. Returns: Newly allocated callback handle (nl_cb class instance) or None. """ if ki...
python
def nl_cb_alloc(kind): """Allocate a new callback handle. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L201 Positional arguments: kind -- callback kind to be used for initialization. Returns: Newly allocated callback handle (nl_cb class instance) or None. """ if ki...
[ "def", "nl_cb_alloc", "(", "kind", ")", ":", "if", "kind", "<", "0", "or", "kind", ">", "NL_CB_KIND_MAX", ":", "return", "None", "cb", "=", "nl_cb", "(", ")", "cb", ".", "cb_active", "=", "NL_CB_TYPE_MAX", "+", "1", "for", "i", "in", "range", "(", ...
Allocate a new callback handle. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L201 Positional arguments: kind -- callback kind to be used for initialization. Returns: Newly allocated callback handle (nl_cb class instance) or None.
[ "Allocate", "a", "new", "callback", "handle", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/handlers.py#L151-L169
train
59,688
Robpol86/libnl
libnl/handlers.py
nl_cb_set
def nl_cb_set(cb, type_, kind, func, arg): """Set up a callback. Updates `cb` in place. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L293 Positional arguments: cb -- nl_cb class instance. type_ -- callback to modify (integer). kind -- kind of implementation (integer). f...
python
def nl_cb_set(cb, type_, kind, func, arg): """Set up a callback. Updates `cb` in place. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L293 Positional arguments: cb -- nl_cb class instance. type_ -- callback to modify (integer). kind -- kind of implementation (integer). f...
[ "def", "nl_cb_set", "(", "cb", ",", "type_", ",", "kind", ",", "func", ",", "arg", ")", ":", "if", "type_", "<", "0", "or", "type_", ">", "NL_CB_TYPE_MAX", "or", "kind", "<", "0", "or", "kind", ">", "NL_CB_KIND_MAX", ":", "return", "-", "NLE_RANGE", ...
Set up a callback. Updates `cb` in place. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L293 Positional arguments: cb -- nl_cb class instance. type_ -- callback to modify (integer). kind -- kind of implementation (integer). func -- callback function (NL_CB_CUSTOM). arg -...
[ "Set", "up", "a", "callback", ".", "Updates", "cb", "in", "place", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/handlers.py#L191-L216
train
59,689
Robpol86/libnl
libnl/handlers.py
nl_cb_err
def nl_cb_err(cb, kind, func, arg): """Set up an error callback. Updates `cb` in place. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L343 Positional arguments: cb -- nl_cb class instance. kind -- kind of callback (integer). func -- callback function. arg -- argument to ...
python
def nl_cb_err(cb, kind, func, arg): """Set up an error callback. Updates `cb` in place. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L343 Positional arguments: cb -- nl_cb class instance. kind -- kind of callback (integer). func -- callback function. arg -- argument to ...
[ "def", "nl_cb_err", "(", "cb", ",", "kind", ",", "func", ",", "arg", ")", ":", "if", "kind", "<", "0", "or", "kind", ">", "NL_CB_KIND_MAX", ":", "return", "-", "NLE_RANGE", "if", "kind", "==", "NL_CB_CUSTOM", ":", "cb", ".", "cb_err", "=", "func", ...
Set up an error callback. Updates `cb` in place. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/handlers.c#L343 Positional arguments: cb -- nl_cb class instance. kind -- kind of callback (integer). func -- callback function. arg -- argument to be passed to callback function. Return...
[ "Set", "up", "an", "error", "callback", ".", "Updates", "cb", "in", "place", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/handlers.py#L219-L243
train
59,690
Robpol86/libnl
libnl/linux_private/rtnetlink.py
ifinfomsg.ifi_index
def ifi_index(self, value): """Index setter.""" self.bytearray[self._get_slicers(3)] = bytearray(c_int(value or 0))
python
def ifi_index(self, value): """Index setter.""" self.bytearray[self._get_slicers(3)] = bytearray(c_int(value or 0))
[ "def", "ifi_index", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "3", ")", "]", "=", "bytearray", "(", "c_int", "(", "value", "or", "0", ")", ")" ]
Index setter.
[ "Index", "setter", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/linux_private/rtnetlink.py#L215-L217
train
59,691
Robpol86/libnl
libnl/linux_private/rtnetlink.py
ifinfomsg.ifi_change
def ifi_change(self, value): """Change setter.""" self.bytearray[self._get_slicers(5)] = bytearray(c_uint(value or 0))
python
def ifi_change(self, value): """Change setter.""" self.bytearray[self._get_slicers(5)] = bytearray(c_uint(value or 0))
[ "def", "ifi_change", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "5", ")", "]", "=", "bytearray", "(", "c_uint", "(", "value", "or", "0", ")", ")" ]
Change setter.
[ "Change", "setter", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/linux_private/rtnetlink.py#L235-L237
train
59,692
Robpol86/libnl
libnl/misc.py
_class_factory
def _class_factory(base): """Create subclasses of ctypes. Positional arguments: base -- base class to subclass. Returns: New class definition. """ class ClsPyPy(base): def __repr__(self): return repr(base(super(ClsPyPy, self).value)) @classmethod def fr...
python
def _class_factory(base): """Create subclasses of ctypes. Positional arguments: base -- base class to subclass. Returns: New class definition. """ class ClsPyPy(base): def __repr__(self): return repr(base(super(ClsPyPy, self).value)) @classmethod def fr...
[ "def", "_class_factory", "(", "base", ")", ":", "class", "ClsPyPy", "(", "base", ")", ":", "def", "__repr__", "(", "self", ")", ":", "return", "repr", "(", "base", "(", "super", "(", "ClsPyPy", ",", "self", ")", ".", "value", ")", ")", "@", "classm...
Create subclasses of ctypes. Positional arguments: base -- base class to subclass. Returns: New class definition.
[ "Create", "subclasses", "of", "ctypes", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/misc.py#L7-L50
train
59,693
Robpol86/libnl
libnl/misc.py
ucred.pid
def pid(self, value): """Process ID setter.""" self.bytearray[self._get_slicers(0)] = bytearray(c_int32(value or 0))
python
def pid(self, value): """Process ID setter.""" self.bytearray[self._get_slicers(0)] = bytearray(c_int32(value or 0))
[ "def", "pid", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "0", ")", "]", "=", "bytearray", "(", "c_int32", "(", "value", "or", "0", ")", ")" ]
Process ID setter.
[ "Process", "ID", "setter", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/misc.py#L183-L185
train
59,694
Robpol86/libnl
libnl/misc.py
ucred.uid
def uid(self, value): """User ID setter.""" self.bytearray[self._get_slicers(1)] = bytearray(c_int32(value or 0))
python
def uid(self, value): """User ID setter.""" self.bytearray[self._get_slicers(1)] = bytearray(c_int32(value or 0))
[ "def", "uid", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "1", ")", "]", "=", "bytearray", "(", "c_int32", "(", "value", "or", "0", ")", ")" ]
User ID setter.
[ "User", "ID", "setter", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/misc.py#L193-L195
train
59,695
Robpol86/libnl
libnl/misc.py
ucred.gid
def gid(self, value): """Group ID setter.""" self.bytearray[self._get_slicers(2)] = bytearray(c_int32(value or 0))
python
def gid(self, value): """Group ID setter.""" self.bytearray[self._get_slicers(2)] = bytearray(c_int32(value or 0))
[ "def", "gid", "(", "self", ",", "value", ")", ":", "self", ".", "bytearray", "[", "self", ".", "_get_slicers", "(", "2", ")", "]", "=", "bytearray", "(", "c_int32", "(", "value", "or", "0", ")", ")" ]
Group ID setter.
[ "Group", "ID", "setter", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/misc.py#L203-L205
train
59,696
joeferraro/mm
mm/util.py
put_skeleton_files_on_disk
def put_skeleton_files_on_disk(metadata_type, where, github_template=None, params={}): """ Generates file based on jinja2 templates """ api_name = params["api_name"] file_name = github_template["file_name"] template_source = config.connection.get_plugin_client_setting('mm_template_source', '...
python
def put_skeleton_files_on_disk(metadata_type, where, github_template=None, params={}): """ Generates file based on jinja2 templates """ api_name = params["api_name"] file_name = github_template["file_name"] template_source = config.connection.get_plugin_client_setting('mm_template_source', '...
[ "def", "put_skeleton_files_on_disk", "(", "metadata_type", ",", "where", ",", "github_template", "=", "None", ",", "params", "=", "{", "}", ")", ":", "api_name", "=", "params", "[", "\"api_name\"", "]", "file_name", "=", "github_template", "[", "\"file_name\"", ...
Generates file based on jinja2 templates
[ "Generates", "file", "based", "on", "jinja2", "templates" ]
43dce48a2249faab4d872c228ada9fbdbeec147b
https://github.com/joeferraro/mm/blob/43dce48a2249faab4d872c228ada9fbdbeec147b/mm/util.py#L468-L500
train
59,697
Robpol86/libnl
libnl/genl/ctrl.py
genl_ctrl_probe_by_name
def genl_ctrl_probe_by_name(sk, name): """Look up generic Netlink family by family name querying the kernel directly. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/ctrl.c#L237 Directly query's the kernel for a given family name. Note: This API call differs from genl_ctrl_search_by_name i...
python
def genl_ctrl_probe_by_name(sk, name): """Look up generic Netlink family by family name querying the kernel directly. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/ctrl.c#L237 Directly query's the kernel for a given family name. Note: This API call differs from genl_ctrl_search_by_name i...
[ "def", "genl_ctrl_probe_by_name", "(", "sk", ",", "name", ")", ":", "ret", "=", "genl_family_alloc", "(", ")", "if", "not", "ret", ":", "return", "None", "genl_family_set_name", "(", "ret", ",", "name", ")", "msg", "=", "nlmsg_alloc", "(", ")", "orig", "...
Look up generic Netlink family by family name querying the kernel directly. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/ctrl.c#L237 Directly query's the kernel for a given family name. Note: This API call differs from genl_ctrl_search_by_name in that it queries the kernel directly, allowin...
[ "Look", "up", "generic", "Netlink", "family", "by", "family", "name", "querying", "the", "kernel", "directly", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/genl/ctrl.py#L149-L186
train
59,698
Robpol86/libnl
libnl/genl/ctrl.py
genl_ctrl_resolve
def genl_ctrl_resolve(sk, name): """Resolve Generic Netlink family name to numeric identifier. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/ctrl.c#L429 Resolves the Generic Netlink family name to the corresponding numeric family identifier. This function queries the kernel directly, use ...
python
def genl_ctrl_resolve(sk, name): """Resolve Generic Netlink family name to numeric identifier. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/ctrl.c#L429 Resolves the Generic Netlink family name to the corresponding numeric family identifier. This function queries the kernel directly, use ...
[ "def", "genl_ctrl_resolve", "(", "sk", ",", "name", ")", ":", "family", "=", "genl_ctrl_probe_by_name", "(", "sk", ",", "name", ")", "if", "family", "is", "None", ":", "return", "-", "NLE_OBJ_NOTFOUND", "return", "int", "(", "genl_family_get_id", "(", "famil...
Resolve Generic Netlink family name to numeric identifier. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/ctrl.c#L429 Resolves the Generic Netlink family name to the corresponding numeric family identifier. This function queries the kernel directly, use genl_ctrl_search_by_name() if you need t...
[ "Resolve", "Generic", "Netlink", "family", "name", "to", "numeric", "identifier", "." ]
274e9fdaa39822d06ef70b799ed4a95937a4d923
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/genl/ctrl.py#L189-L208
train
59,699