partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | Radiotap.strip_db_antsignal | strip(1 byte) radiotap.db_antsignal
:return: int
idx
:return: int | pcapfile/protocols/linklayer/wifi.py | def strip_db_antsignal(self, idx):
"""strip(1 byte) radiotap.db_antsignal
:return: int
idx
:return: int
"""
db_antsignal, = struct.unpack_from('<B', self._rtap, idx)
return idx + 1, db_antsignal | def strip_db_antsignal(self, idx):
"""strip(1 byte) radiotap.db_antsignal
:return: int
idx
:return: int
"""
db_antsignal, = struct.unpack_from('<B', self._rtap, idx)
return idx + 1, db_antsignal | [
"strip",
"(",
"1",
"byte",
")",
"radiotap",
".",
"db_antsignal",
":",
"return",
":",
"int",
"idx",
":",
"return",
":",
"int"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L940-L947 | [
"def",
"strip_db_antsignal",
"(",
"self",
",",
"idx",
")",
":",
"db_antsignal",
",",
"=",
"struct",
".",
"unpack_from",
"(",
"'<B'",
",",
"self",
".",
"_rtap",
",",
"idx",
")",
"return",
"idx",
"+",
"1",
",",
"db_antsignal"
] | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Radiotap.strip_db_antnoise | strip(1 byte) radiotap.db_antnoise
:return: int
idx
:return: int | pcapfile/protocols/linklayer/wifi.py | def strip_db_antnoise(self, idx):
"""strip(1 byte) radiotap.db_antnoise
:return: int
idx
:return: int
"""
db_antnoise, = struct.unpack_from('<B', self._rtap, idx)
return idx + 1, db_antnoise | def strip_db_antnoise(self, idx):
"""strip(1 byte) radiotap.db_antnoise
:return: int
idx
:return: int
"""
db_antnoise, = struct.unpack_from('<B', self._rtap, idx)
return idx + 1, db_antnoise | [
"strip",
"(",
"1",
"byte",
")",
"radiotap",
".",
"db_antnoise",
":",
"return",
":",
"int",
"idx",
":",
"return",
":",
"int"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L949-L956 | [
"def",
"strip_db_antnoise",
"(",
"self",
",",
"idx",
")",
":",
"db_antnoise",
",",
"=",
"struct",
".",
"unpack_from",
"(",
"'<B'",
",",
"self",
".",
"_rtap",
",",
"idx",
")",
"return",
"idx",
"+",
"1",
",",
"db_antnoise"
] | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Radiotap.strip_rx_flags | strip(2 byte) radiotap.rxflags
:idx: int
:return: int
idx
:return: collections.namedtuple | pcapfile/protocols/linklayer/wifi.py | def strip_rx_flags(self, idx):
"""strip(2 byte) radiotap.rxflags
:idx: int
:return: int
idx
:return: collections.namedtuple
"""
rx_flags = collections.namedtuple('rx_flags', ['reserved', 'badplcp'])
idx = Radiotap.align(idx, 2)
flags, = struct... | def strip_rx_flags(self, idx):
"""strip(2 byte) radiotap.rxflags
:idx: int
:return: int
idx
:return: collections.namedtuple
"""
rx_flags = collections.namedtuple('rx_flags', ['reserved', 'badplcp'])
idx = Radiotap.align(idx, 2)
flags, = struct... | [
"strip",
"(",
"2",
"byte",
")",
"radiotap",
".",
"rxflags",
":",
"idx",
":",
"int",
":",
"return",
":",
"int",
"idx",
":",
"return",
":",
"collections",
".",
"namedtuple"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L958-L972 | [
"def",
"strip_rx_flags",
"(",
"self",
",",
"idx",
")",
":",
"rx_flags",
"=",
"collections",
".",
"namedtuple",
"(",
"'rx_flags'",
",",
"[",
"'reserved'",
",",
"'badplcp'",
"]",
")",
"idx",
"=",
"Radiotap",
".",
"align",
"(",
"idx",
",",
"2",
")",
"flag... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Radiotap.strip_tx_flags | strip(1 byte) tx_flags
:idx: int
:return: int
idx
:return: int | pcapfile/protocols/linklayer/wifi.py | def strip_tx_flags(self, idx):
"""strip(1 byte) tx_flags
:idx: int
:return: int
idx
:return: int
"""
idx = Radiotap.align(idx, 2)
tx_flags, = struct.unpack_from('<B', self._rtap, idx)
return idx + 1, tx_flags | def strip_tx_flags(self, idx):
"""strip(1 byte) tx_flags
:idx: int
:return: int
idx
:return: int
"""
idx = Radiotap.align(idx, 2)
tx_flags, = struct.unpack_from('<B', self._rtap, idx)
return idx + 1, tx_flags | [
"strip",
"(",
"1",
"byte",
")",
"tx_flags",
":",
"idx",
":",
"int",
":",
"return",
":",
"int",
"idx",
":",
"return",
":",
"int"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L974-L983 | [
"def",
"strip_tx_flags",
"(",
"self",
",",
"idx",
")",
":",
"idx",
"=",
"Radiotap",
".",
"align",
"(",
"idx",
",",
"2",
")",
"tx_flags",
",",
"=",
"struct",
".",
"unpack_from",
"(",
"'<B'",
",",
"self",
".",
"_rtap",
",",
"idx",
")",
"return",
"idx... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Radiotap.strip_rts_retries | strip(1 byte) rts_retries
:idx: int
:return: int
idx
:return: int | pcapfile/protocols/linklayer/wifi.py | def strip_rts_retries(self, idx):
"""strip(1 byte) rts_retries
:idx: int
:return: int
idx
:return: int
"""
rts_retries, = struct.unpack_from('<B', self._rtap, idx)
return idx + 1, rts_retries | def strip_rts_retries(self, idx):
"""strip(1 byte) rts_retries
:idx: int
:return: int
idx
:return: int
"""
rts_retries, = struct.unpack_from('<B', self._rtap, idx)
return idx + 1, rts_retries | [
"strip",
"(",
"1",
"byte",
")",
"rts_retries",
":",
"idx",
":",
"int",
":",
"return",
":",
"int",
"idx",
":",
"return",
":",
"int"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L985-L993 | [
"def",
"strip_rts_retries",
"(",
"self",
",",
"idx",
")",
":",
"rts_retries",
",",
"=",
"struct",
".",
"unpack_from",
"(",
"'<B'",
",",
"self",
".",
"_rtap",
",",
"idx",
")",
"return",
"idx",
"+",
"1",
",",
"rts_retries"
] | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Radiotap.strip_data_retries | strip(1 byte) data_retries
:idx: int
:return: int
idx
:return: int | pcapfile/protocols/linklayer/wifi.py | def strip_data_retries(self, idx):
"""strip(1 byte) data_retries
:idx: int
:return: int
idx
:return: int
"""
data_retries, = struct.unpack_from('<B', self._rtap, idx)
return idx + 1, data_retries | def strip_data_retries(self, idx):
"""strip(1 byte) data_retries
:idx: int
:return: int
idx
:return: int
"""
data_retries, = struct.unpack_from('<B', self._rtap, idx)
return idx + 1, data_retries | [
"strip",
"(",
"1",
"byte",
")",
"data_retries",
":",
"idx",
":",
"int",
":",
"return",
":",
"int",
"idx",
":",
"return",
":",
"int"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L995-L1003 | [
"def",
"strip_data_retries",
"(",
"self",
",",
"idx",
")",
":",
"data_retries",
",",
"=",
"struct",
".",
"unpack_from",
"(",
"'<B'",
",",
"self",
".",
"_rtap",
",",
"idx",
")",
"return",
"idx",
"+",
"1",
",",
"data_retries"
] | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Radiotap.strip_xchannel | strip(7 bytes) radiotap.xchannel.channel(1 byte),
radiotap.xchannel.freq(2 bytes) and radiotap.xchannel.flags(4 bytes)
:idx: int
:return: int
idx
:return: collections.namedtuple | pcapfile/protocols/linklayer/wifi.py | def strip_xchannel(self, idx):
"""strip(7 bytes) radiotap.xchannel.channel(1 byte),
radiotap.xchannel.freq(2 bytes) and radiotap.xchannel.flags(4 bytes)
:idx: int
:return: int
idx
:return: collections.namedtuple
"""
xchannel = collections.namedtuple(
... | def strip_xchannel(self, idx):
"""strip(7 bytes) radiotap.xchannel.channel(1 byte),
radiotap.xchannel.freq(2 bytes) and radiotap.xchannel.flags(4 bytes)
:idx: int
:return: int
idx
:return: collections.namedtuple
"""
xchannel = collections.namedtuple(
... | [
"strip",
"(",
"7",
"bytes",
")",
"radiotap",
".",
"xchannel",
".",
"channel",
"(",
"1",
"byte",
")",
"radiotap",
".",
"xchannel",
".",
"freq",
"(",
"2",
"bytes",
")",
"and",
"radiotap",
".",
"xchannel",
".",
"flags",
"(",
"4",
"bytes",
")",
":",
"i... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1005-L1046 | [
"def",
"strip_xchannel",
"(",
"self",
",",
"idx",
")",
":",
"xchannel",
"=",
"collections",
".",
"namedtuple",
"(",
"'xchannel'",
",",
"[",
"'flags'",
",",
"'freq'",
",",
"'channel'",
",",
"'max_power'",
"]",
")",
"flags",
"=",
"collections",
".",
"namedtu... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Radiotap.strip_mcs | strip(3 byte) radiotap.mcs which contains 802.11n bandwidth,
mcs(modulation and coding scheme) and stbc(space time block coding)
information.
:idx: int
:return: int
idx
:return: collections.namedtuple | pcapfile/protocols/linklayer/wifi.py | def strip_mcs(self, idx):
"""strip(3 byte) radiotap.mcs which contains 802.11n bandwidth,
mcs(modulation and coding scheme) and stbc(space time block coding)
information.
:idx: int
:return: int
idx
:return: collections.namedtuple
"""
mcs = coll... | def strip_mcs(self, idx):
"""strip(3 byte) radiotap.mcs which contains 802.11n bandwidth,
mcs(modulation and coding scheme) and stbc(space time block coding)
information.
:idx: int
:return: int
idx
:return: collections.namedtuple
"""
mcs = coll... | [
"strip",
"(",
"3",
"byte",
")",
"radiotap",
".",
"mcs",
"which",
"contains",
"802",
".",
"11n",
"bandwidth",
"mcs",
"(",
"modulation",
"and",
"coding",
"scheme",
")",
"and",
"stbc",
"(",
"space",
"time",
"block",
"coding",
")",
"information",
".",
":",
... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1048-L1076 | [
"def",
"strip_mcs",
"(",
"self",
",",
"idx",
")",
":",
"mcs",
"=",
"collections",
".",
"namedtuple",
"(",
"'mcs'",
",",
"[",
"'known'",
",",
"'index'",
",",
"'have_bw'",
",",
"'have_mcs'",
",",
"'have_gi'",
",",
"'have_format'",
",",
"'have_fec'",
",",
"... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Radiotap.strip_ampdu | strip(8 byte) radiotap.ampdu
:idx: int
:return: int
idx
:return: collections.namedtuple | pcapfile/protocols/linklayer/wifi.py | def strip_ampdu(self, idx):
"""strip(8 byte) radiotap.ampdu
:idx: int
:return: int
idx
:return: collections.namedtuple
"""
ampdu = collections.namedtuple(
'ampdu', ['reference', 'crc_val', 'reservered', 'flags'])
flags = collections.namedtu... | def strip_ampdu(self, idx):
"""strip(8 byte) radiotap.ampdu
:idx: int
:return: int
idx
:return: collections.namedtuple
"""
ampdu = collections.namedtuple(
'ampdu', ['reference', 'crc_val', 'reservered', 'flags'])
flags = collections.namedtu... | [
"strip",
"(",
"8",
"byte",
")",
"radiotap",
".",
"ampdu",
":",
"idx",
":",
"int",
":",
"return",
":",
"int",
"idx",
":",
"return",
":",
"collections",
".",
"namedtuple"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1078-L1104 | [
"def",
"strip_ampdu",
"(",
"self",
",",
"idx",
")",
":",
"ampdu",
"=",
"collections",
".",
"namedtuple",
"(",
"'ampdu'",
",",
"[",
"'reference'",
",",
"'crc_val'",
",",
"'reservered'",
",",
"'flags'",
"]",
")",
"flags",
"=",
"collections",
".",
"namedtuple... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Radiotap.strip_vht | strip(12 byte) radiotap.vht
:idx: int
:return: int
idx
:return: collections.namedtuple | pcapfile/protocols/linklayer/wifi.py | def strip_vht(self, idx):
"""strip(12 byte) radiotap.vht
:idx: int
:return: int
idx
:return: collections.namedtuple
"""
vht = collections.namedtuple(
'vht', ['known_bits', 'have_stbc', 'have_txop_ps', 'have_gi',
'have_sgi_nsym_d... | def strip_vht(self, idx):
"""strip(12 byte) radiotap.vht
:idx: int
:return: int
idx
:return: collections.namedtuple
"""
vht = collections.namedtuple(
'vht', ['known_bits', 'have_stbc', 'have_txop_ps', 'have_gi',
'have_sgi_nsym_d... | [
"strip",
"(",
"12",
"byte",
")",
"radiotap",
".",
"vht",
":",
"idx",
":",
"int",
":",
"return",
":",
"int",
"idx",
":",
"return",
":",
"collections",
".",
"namedtuple"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1106-L1168 | [
"def",
"strip_vht",
"(",
"self",
",",
"idx",
")",
":",
"vht",
"=",
"collections",
".",
"namedtuple",
"(",
"'vht'",
",",
"[",
"'known_bits'",
",",
"'have_stbc'",
",",
"'have_txop_ps'",
",",
"'have_gi'",
",",
"'have_sgi_nsym_da'",
",",
"'have_ldpc_extra'",
",",
... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Radiotap.extract_protocol | extract 802.11 protocol from radiotap.channel.flags
:return: str
protocol name
one of below in success
[.11a, .11b, .11g, .11n, .11ac]
None in fail | pcapfile/protocols/linklayer/wifi.py | def extract_protocol(self):
"""extract 802.11 protocol from radiotap.channel.flags
:return: str
protocol name
one of below in success
[.11a, .11b, .11g, .11n, .11ac]
None in fail
"""
if self.present.mcs:
return '.11n'
i... | def extract_protocol(self):
"""extract 802.11 protocol from radiotap.channel.flags
:return: str
protocol name
one of below in success
[.11a, .11b, .11g, .11n, .11ac]
None in fail
"""
if self.present.mcs:
return '.11n'
i... | [
"extract",
"802",
".",
"11",
"protocol",
"from",
"radiotap",
".",
"channel",
".",
"flags",
":",
"return",
":",
"str",
"protocol",
"name",
"one",
"of",
"below",
"in",
"success",
"[",
".",
"11a",
".",
"11b",
".",
"11g",
".",
"11n",
".",
"11ac",
"]",
... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1170-L1193 | [
"def",
"extract_protocol",
"(",
"self",
")",
":",
"if",
"self",
".",
"present",
".",
"mcs",
":",
"return",
"'.11n'",
"if",
"self",
".",
"present",
".",
"vht",
":",
"return",
"'.11ac'",
"if",
"self",
".",
"present",
".",
"channel",
"and",
"hasattr",
"("... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Wifi.get_shark_field | get parameters via wireshark syntax.
out = x.get_shark_field('wlan.fc.type')
out = x.get_shark_field(['wlan.fc.type', 'wlan.seq'])
:fields: str or str[]
:return: dict
out[fields[0]] = val[0] or None
out[fields[1]] = val[1] or None ... | pcapfile/protocols/linklayer/wifi.py | def get_shark_field(self, fields):
"""get parameters via wireshark syntax.
out = x.get_shark_field('wlan.fc.type')
out = x.get_shark_field(['wlan.fc.type', 'wlan.seq'])
:fields: str or str[]
:return: dict
out[fields[0]] = val[0] or None
out[fields[1]] = va... | def get_shark_field(self, fields):
"""get parameters via wireshark syntax.
out = x.get_shark_field('wlan.fc.type')
out = x.get_shark_field(['wlan.fc.type', 'wlan.seq'])
:fields: str or str[]
:return: dict
out[fields[0]] = val[0] or None
out[fields[1]] = va... | [
"get",
"parameters",
"via",
"wireshark",
"syntax",
".",
"out",
"=",
"x",
".",
"get_shark_field",
"(",
"wlan",
".",
"fc",
".",
"type",
")",
"out",
"=",
"x",
".",
"get_shark_field",
"(",
"[",
"wlan",
".",
"fc",
".",
"type",
"wlan",
".",
"seq",
"]",
"... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1283-L1326 | [
"def",
"get_shark_field",
"(",
"self",
",",
"fields",
")",
":",
"keys",
",",
"exist",
",",
"out",
"=",
"None",
",",
"{",
"}",
",",
"None",
"if",
"isinstance",
"(",
"fields",
",",
"str",
")",
":",
"fields",
"=",
"[",
"fields",
"]",
"elif",
"not",
... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Wifi.get_mac_addr | converts bytes to mac addr format
:mac_addr: ctypes.structure
:return: str
mac addr in format
11:22:33:aa:bb:cc | pcapfile/protocols/linklayer/wifi.py | def get_mac_addr(mac_addr):
"""converts bytes to mac addr format
:mac_addr: ctypes.structure
:return: str
mac addr in format
11:22:33:aa:bb:cc
"""
mac_addr = bytearray(mac_addr)
mac = b':'.join([('%02x' % o).encode('ascii') for o in mac_addr])
... | def get_mac_addr(mac_addr):
"""converts bytes to mac addr format
:mac_addr: ctypes.structure
:return: str
mac addr in format
11:22:33:aa:bb:cc
"""
mac_addr = bytearray(mac_addr)
mac = b':'.join([('%02x' % o).encode('ascii') for o in mac_addr])
... | [
"converts",
"bytes",
"to",
"mac",
"addr",
"format",
":",
"mac_addr",
":",
"ctypes",
".",
"structure",
":",
"return",
":",
"str",
"mac",
"addr",
"in",
"format",
"11",
":",
"22",
":",
"33",
":",
"aa",
":",
"bb",
":",
"cc"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1329-L1338 | [
"def",
"get_mac_addr",
"(",
"mac_addr",
")",
":",
"mac_addr",
"=",
"bytearray",
"(",
"mac_addr",
")",
"mac",
"=",
"b':'",
".",
"join",
"(",
"[",
"(",
"'%02x'",
"%",
"o",
")",
".",
"encode",
"(",
"'ascii'",
")",
"for",
"o",
"in",
"mac_addr",
"]",
")... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Wifi.strip_mac_addrs | strip mac address(each 6 byte) information.
(wlan.ta, wlan.ra, wlan.sa, wlan.da)
(transmitter, receiver, source, destination)
:return: int
index of sequence control
:return: int
index after mac addresses
:return: str
source address (sa)
... | pcapfile/protocols/linklayer/wifi.py | def strip_mac_addrs(self):
"""strip mac address(each 6 byte) information.
(wlan.ta, wlan.ra, wlan.sa, wlan.da)
(transmitter, receiver, source, destination)
:return: int
index of sequence control
:return: int
index after mac addresses
:return: str
... | def strip_mac_addrs(self):
"""strip mac address(each 6 byte) information.
(wlan.ta, wlan.ra, wlan.sa, wlan.da)
(transmitter, receiver, source, destination)
:return: int
index of sequence control
:return: int
index after mac addresses
:return: str
... | [
"strip",
"mac",
"address",
"(",
"each",
"6",
"byte",
")",
"information",
".",
"(",
"wlan",
".",
"ta",
"wlan",
".",
"ra",
"wlan",
".",
"sa",
"wlan",
".",
"da",
")",
"(",
"transmitter",
"receiver",
"source",
"destination",
")",
":",
"return",
":",
"int... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1346-L1397 | [
"def",
"strip_mac_addrs",
"(",
"self",
")",
":",
"qos_idx",
",",
"seq_idx",
"=",
"0",
",",
"0",
"sa",
",",
"ta",
",",
"ra",
",",
"da",
",",
"bssid",
"=",
"None",
",",
"None",
",",
"None",
",",
"None",
",",
"None",
"if",
"self",
".",
"to_ds",
"=... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Wifi.strip_seq_cntrl | strip(2 byte) wlan.seq(12 bit) and wlan.fram(4 bit)
number information.
:seq_cntrl: ctypes.Structure
:return: int
sequence number
:return: int
fragment number | pcapfile/protocols/linklayer/wifi.py | def strip_seq_cntrl(self, idx):
"""strip(2 byte) wlan.seq(12 bit) and wlan.fram(4 bit)
number information.
:seq_cntrl: ctypes.Structure
:return: int
sequence number
:return: int
fragment number
"""
seq_cntrl = struct.unpack('H', self._packe... | def strip_seq_cntrl(self, idx):
"""strip(2 byte) wlan.seq(12 bit) and wlan.fram(4 bit)
number information.
:seq_cntrl: ctypes.Structure
:return: int
sequence number
:return: int
fragment number
"""
seq_cntrl = struct.unpack('H', self._packe... | [
"strip",
"(",
"2",
"byte",
")",
"wlan",
".",
"seq",
"(",
"12",
"bit",
")",
"and",
"wlan",
".",
"fram",
"(",
"4",
"bit",
")",
"number",
"information",
".",
":",
"seq_cntrl",
":",
"ctypes",
".",
"Structure",
":",
"return",
":",
"int",
"sequence",
"nu... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1399-L1411 | [
"def",
"strip_seq_cntrl",
"(",
"self",
",",
"idx",
")",
":",
"seq_cntrl",
"=",
"struct",
".",
"unpack",
"(",
"'H'",
",",
"self",
".",
"_packet",
"[",
"idx",
":",
"idx",
"+",
"2",
"]",
")",
"[",
"0",
"]",
"seq_num",
"=",
"seq_cntrl",
">>",
"4",
"f... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | QosData.strip_qos_cntrl | strip(2 byte) wlan.qos
:idx: int
:prot_type: string
802.11 protocol type(.11ac, .11a, .11n, etc)
:return: int
number of processed bytes
:return: int
qos priority
:return: int
qos bit
:return: int
qos acknowledgem... | pcapfile/protocols/linklayer/wifi.py | def strip_qos_cntrl(self, idx, prot_type):
"""strip(2 byte) wlan.qos
:idx: int
:prot_type: string
802.11 protocol type(.11ac, .11a, .11n, etc)
:return: int
number of processed bytes
:return: int
qos priority
:return: int
qos... | def strip_qos_cntrl(self, idx, prot_type):
"""strip(2 byte) wlan.qos
:idx: int
:prot_type: string
802.11 protocol type(.11ac, .11a, .11n, etc)
:return: int
number of processed bytes
:return: int
qos priority
:return: int
qos... | [
"strip",
"(",
"2",
"byte",
")",
"wlan",
".",
"qos",
":",
"idx",
":",
"int",
":",
"prot_type",
":",
"string",
"802",
".",
"11",
"protocol",
"type",
"(",
".",
"11ac",
".",
"11a",
".",
"11n",
"etc",
")",
":",
"return",
":",
"int",
"number",
"of",
... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1543-L1567 | [
"def",
"strip_qos_cntrl",
"(",
"self",
",",
"idx",
",",
"prot_type",
")",
":",
"qos_cntrl",
",",
"=",
"struct",
".",
"unpack",
"(",
"'H'",
",",
"self",
".",
"_packet",
"[",
"idx",
":",
"idx",
"+",
"2",
"]",
")",
"qos_cntrl_bits",
"=",
"format",
"(",
... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | QosData.strip_ccmp | strip(8 byte) wlan.ccmp.extiv
CCMP Extended Initialization Vector
:return: int
number of processed bytes
:return: ctypes.raw
ccmp vector | pcapfile/protocols/linklayer/wifi.py | def strip_ccmp(self, idx):
"""strip(8 byte) wlan.ccmp.extiv
CCMP Extended Initialization Vector
:return: int
number of processed bytes
:return: ctypes.raw
ccmp vector
"""
ccmp_extiv = None
if len(self._packet[idx:]) >= 8:
raw_by... | def strip_ccmp(self, idx):
"""strip(8 byte) wlan.ccmp.extiv
CCMP Extended Initialization Vector
:return: int
number of processed bytes
:return: ctypes.raw
ccmp vector
"""
ccmp_extiv = None
if len(self._packet[idx:]) >= 8:
raw_by... | [
"strip",
"(",
"8",
"byte",
")",
"wlan",
".",
"ccmp",
".",
"extiv",
"CCMP",
"Extended",
"Initialization",
"Vector",
":",
"return",
":",
"int",
"number",
"of",
"processed",
"bytes",
":",
"return",
":",
"ctypes",
".",
"raw",
"ccmp",
"vector"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1569-L1581 | [
"def",
"strip_ccmp",
"(",
"self",
",",
"idx",
")",
":",
"ccmp_extiv",
"=",
"None",
"if",
"len",
"(",
"self",
".",
"_packet",
"[",
"idx",
":",
"]",
")",
">=",
"8",
":",
"raw_bytes",
"=",
"self",
".",
"_packet",
"[",
"idx",
":",
"idx",
"+",
"8",
... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | QosData.strip_msdu | strip single mac servis data unit(msdu)
see -> https://mrncciew.com/2014/11/01/cwap-802-11-data-frame-aggregation/
:idx: int
:return: dict
msdu
:return: int
number of processed bytes | pcapfile/protocols/linklayer/wifi.py | def strip_msdu(self, idx):
"""strip single mac servis data unit(msdu)
see -> https://mrncciew.com/2014/11/01/cwap-802-11-data-frame-aggregation/
:idx: int
:return: dict
msdu
:return: int
number of processed bytes
"""
# length of msdu payloa... | def strip_msdu(self, idx):
"""strip single mac servis data unit(msdu)
see -> https://mrncciew.com/2014/11/01/cwap-802-11-data-frame-aggregation/
:idx: int
:return: dict
msdu
:return: int
number of processed bytes
"""
# length of msdu payloa... | [
"strip",
"single",
"mac",
"servis",
"data",
"unit",
"(",
"msdu",
")",
"see",
"-",
">",
"https",
":",
"//",
"mrncciew",
".",
"com",
"/",
"2014",
"/",
"11",
"/",
"01",
"/",
"cwap",
"-",
"802",
"-",
"11",
"-",
"data",
"-",
"frame",
"-",
"aggregation... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1583-L1615 | [
"def",
"strip_msdu",
"(",
"self",
",",
"idx",
")",
":",
"# length of msdu payload has to be multiple of 4,",
"# this guaranteed with padding",
"padding",
"=",
"0",
"len_payload",
"=",
"0",
"msdu",
"=",
"{",
"'llc'",
":",
"{",
"}",
",",
"'wlan.da'",
":",
"None",
... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | QosData.strip_llc | strip(4 or 8 byte) logical link control headers
:return: int
number of processed bytes
:return: dict
llc information
see -> http://www.wildpackets.com/resources/compendium/ethernet/frame_snap_iee8023
ABBRVS.
ssap: source service access point
dsap: ... | pcapfile/protocols/linklayer/wifi.py | def strip_llc(self, idx):
"""strip(4 or 8 byte) logical link control headers
:return: int
number of processed bytes
:return: dict
llc information
see -> http://www.wildpackets.com/resources/compendium/ethernet/frame_snap_iee8023
ABBRVS.
ssap: sourc... | def strip_llc(self, idx):
"""strip(4 or 8 byte) logical link control headers
:return: int
number of processed bytes
:return: dict
llc information
see -> http://www.wildpackets.com/resources/compendium/ethernet/frame_snap_iee8023
ABBRVS.
ssap: sourc... | [
"strip",
"(",
"4",
"or",
"8",
"byte",
")",
"logical",
"link",
"control",
"headers",
":",
"return",
":",
"int",
"number",
"of",
"processed",
"bytes",
":",
"return",
":",
"dict",
"llc",
"information",
"see",
"-",
">",
"http",
":",
"//",
"www",
".",
"wi... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1617-L1649 | [
"def",
"strip_llc",
"(",
"self",
",",
"idx",
")",
":",
"llc",
"=",
"{",
"}",
"snap",
"=",
"170",
"llc_dsap",
"=",
"struct",
".",
"unpack",
"(",
"'B'",
",",
"self",
".",
"_packet",
"[",
"idx",
":",
"idx",
"+",
"1",
"]",
")",
"[",
"0",
"]",
"ll... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Management.parse_tagged_params | strip tagged information elements wlan_mgt.tag
which has generic type-length-value structure
[type, length, value]
type(1 byte), length(1 byte), value(varies)
[wlan_mgt.tag.number, wlan_mgt.tag.length, payload]
structured fields.
:return: dict[]
list of tagged... | pcapfile/protocols/linklayer/wifi.py | def parse_tagged_params(raw_tagged_params):
"""strip tagged information elements wlan_mgt.tag
which has generic type-length-value structure
[type, length, value]
type(1 byte), length(1 byte), value(varies)
[wlan_mgt.tag.number, wlan_mgt.tag.length, payload]
structured fie... | def parse_tagged_params(raw_tagged_params):
"""strip tagged information elements wlan_mgt.tag
which has generic type-length-value structure
[type, length, value]
type(1 byte), length(1 byte), value(varies)
[wlan_mgt.tag.number, wlan_mgt.tag.length, payload]
structured fie... | [
"strip",
"tagged",
"information",
"elements",
"wlan_mgt",
".",
"tag",
"which",
"has",
"generic",
"type",
"-",
"length",
"-",
"value",
"structure",
"[",
"type",
"length",
"value",
"]",
"type",
"(",
"1",
"byte",
")",
"length",
"(",
"1",
"byte",
")",
"value... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1706-L1745 | [
"def",
"parse_tagged_params",
"(",
"raw_tagged_params",
")",
":",
"fcs_len",
"=",
"4",
"# wlan.fcs (4 bytes)",
"idx",
"=",
"0",
"tagged_params",
"=",
"[",
"]",
"while",
"idx",
"<",
"len",
"(",
"raw_tagged_params",
")",
"-",
"fcs_len",
":",
"tag_num",
",",
"t... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Management.get_fixed_capabils | strip(2 byte) wlan_mgt.fixed.capabilities
:payload: ctypes.structure
2 byte
:return: dict
None in error | pcapfile/protocols/linklayer/wifi.py | def get_fixed_capabils(payload):
"""strip(2 byte) wlan_mgt.fixed.capabilities
:payload: ctypes.structure
2 byte
:return: dict
None in error
"""
if len(payload) != 2:
return None
capabils = {}
fix_cap = struct.unpack('H', payload... | def get_fixed_capabils(payload):
"""strip(2 byte) wlan_mgt.fixed.capabilities
:payload: ctypes.structure
2 byte
:return: dict
None in error
"""
if len(payload) != 2:
return None
capabils = {}
fix_cap = struct.unpack('H', payload... | [
"strip",
"(",
"2",
"byte",
")",
"wlan_mgt",
".",
"fixed",
".",
"capabilities",
":",
"payload",
":",
"ctypes",
".",
"structure",
"2",
"byte",
":",
"return",
":",
"dict",
"None",
"in",
"error"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1748-L1773 | [
"def",
"get_fixed_capabils",
"(",
"payload",
")",
":",
"if",
"len",
"(",
"payload",
")",
"!=",
"2",
":",
"return",
"None",
"capabils",
"=",
"{",
"}",
"fix_cap",
"=",
"struct",
".",
"unpack",
"(",
"'H'",
",",
"payload",
")",
"[",
"0",
"]",
"cap_bits",... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Management.parse_vendor_ie | parse vendor specific information element
oui -> organizationally unique identifier
first 3 bytes of mac addresses
see:https://www.wireshark.org/tools/oui-lookup.html
strip wlan_mgt.tag.oui(3 bytes),
wlan_mgt.tag.vendor.oui.type(1 byte)
wlan_mgt.tag.vendor.data (varies)
... | pcapfile/protocols/linklayer/wifi.py | def parse_vendor_ie(payload):
"""parse vendor specific information element
oui -> organizationally unique identifier
first 3 bytes of mac addresses
see:https://www.wireshark.org/tools/oui-lookup.html
strip wlan_mgt.tag.oui(3 bytes),
wlan_mgt.tag.vendor.oui.type(1 byte)
... | def parse_vendor_ie(payload):
"""parse vendor specific information element
oui -> organizationally unique identifier
first 3 bytes of mac addresses
see:https://www.wireshark.org/tools/oui-lookup.html
strip wlan_mgt.tag.oui(3 bytes),
wlan_mgt.tag.vendor.oui.type(1 byte)
... | [
"parse",
"vendor",
"specific",
"information",
"element",
"oui",
"-",
">",
"organizationally",
"unique",
"identifier",
"first",
"3",
"bytes",
"of",
"mac",
"addresses",
"see",
":",
"https",
":",
"//",
"www",
".",
"wireshark",
".",
"org",
"/",
"tools",
"/",
"... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1776-L1796 | [
"def",
"parse_vendor_ie",
"(",
"payload",
")",
":",
"output",
"=",
"{",
"}",
"oui",
"=",
"struct",
".",
"unpack",
"(",
"'BBB'",
",",
"payload",
"[",
"0",
":",
"3",
"]",
")",
"oui",
"=",
"b'-'",
".",
"join",
"(",
"[",
"(",
"'%02x'",
"%",
"o",
")... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Management.strip_fixed_params | strip(12 byte) wlan_mgt.fixed.all
:payload: ctypes.structure
:return: int
timestamp
:return: int
beacon interval
:return: dict
capabilities | pcapfile/protocols/linklayer/wifi.py | def strip_fixed_params(payload):
"""strip(12 byte) wlan_mgt.fixed.all
:payload: ctypes.structure
:return: int
timestamp
:return: int
beacon interval
:return: dict
capabilities
"""
if len(payload) != 12:
return None, ... | def strip_fixed_params(payload):
"""strip(12 byte) wlan_mgt.fixed.all
:payload: ctypes.structure
:return: int
timestamp
:return: int
beacon interval
:return: dict
capabilities
"""
if len(payload) != 12:
return None, ... | [
"strip",
"(",
"12",
"byte",
")",
"wlan_mgt",
".",
"fixed",
".",
"all",
":",
"payload",
":",
"ctypes",
".",
"structure",
":",
"return",
":",
"int",
"timestamp",
":",
"return",
":",
"int",
"beacon",
"interval",
":",
"return",
":",
"dict",
"capabilities"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1824-L1842 | [
"def",
"strip_fixed_params",
"(",
"payload",
")",
":",
"if",
"len",
"(",
"payload",
")",
"!=",
"12",
":",
"return",
"None",
",",
"None",
",",
"None",
"idx",
"=",
"0",
"timestamp",
"=",
"Management",
".",
"get_timestamp",
"(",
"payload",
"[",
"idx",
":"... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Management.is_valid_mac_oui | checks whether mac block is in format of
00-11-22 or 00:11:22.
:return: int | pcapfile/protocols/linklayer/wifi.py | def is_valid_mac_oui(mac_block):
"""checks whether mac block is in format of
00-11-22 or 00:11:22.
:return: int
"""
if len(mac_block) != 8:
return 0
if ':' in mac_block:
if len(mac_block.split(':')) != 3:
return 0
elif '-' i... | def is_valid_mac_oui(mac_block):
"""checks whether mac block is in format of
00-11-22 or 00:11:22.
:return: int
"""
if len(mac_block) != 8:
return 0
if ':' in mac_block:
if len(mac_block.split(':')) != 3:
return 0
elif '-' i... | [
"checks",
"whether",
"mac",
"block",
"is",
"in",
"format",
"of",
"00",
"-",
"11",
"-",
"22",
"or",
"00",
":",
"11",
":",
"22",
".",
":",
"return",
":",
"int"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1845-L1858 | [
"def",
"is_valid_mac_oui",
"(",
"mac_block",
")",
":",
"if",
"len",
"(",
"mac_block",
")",
"!=",
"8",
":",
"return",
"0",
"if",
"':'",
"in",
"mac_block",
":",
"if",
"len",
"(",
"mac_block",
".",
"split",
"(",
"':'",
")",
")",
"!=",
"3",
":",
"retur... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Management.set_fixed_capabils | set keys of capabils into fields of object
:capabils: dict | pcapfile/protocols/linklayer/wifi.py | def set_fixed_capabils(self, capabils):
"""set keys of capabils into fields of object
:capabils: dict
"""
self.ess = capabils['ess']
self.ibss = capabils['ibss']
self.priv = capabils['priv']
self.short_preamble = capabils['short_preamble']
self.pbcc = capa... | def set_fixed_capabils(self, capabils):
"""set keys of capabils into fields of object
:capabils: dict
"""
self.ess = capabils['ess']
self.ibss = capabils['ibss']
self.priv = capabils['priv']
self.short_preamble = capabils['short_preamble']
self.pbcc = capa... | [
"set",
"keys",
"of",
"capabils",
"into",
"fields",
"of",
"object",
":",
"capabils",
":",
"dict"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1860-L1876 | [
"def",
"set_fixed_capabils",
"(",
"self",
",",
"capabils",
")",
":",
"self",
".",
"ess",
"=",
"capabils",
"[",
"'ess'",
"]",
"self",
".",
"ibss",
"=",
"capabils",
"[",
"'ibss'",
"]",
"self",
".",
"priv",
"=",
"capabils",
"[",
"'priv'",
"]",
"self",
"... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | Management.get_vendor_ies | vendor information element querying
:mac_block: str
first 3 bytes of mac addresses in format of
00-11-22 or 00:11:22 or 001122
:oui_type: int
vendors ie type
:return: int
is valid mac_block format
-1 is unknown
:return: dict[]
... | pcapfile/protocols/linklayer/wifi.py | def get_vendor_ies(self, mac_block=None, oui_type=None):
"""vendor information element querying
:mac_block: str
first 3 bytes of mac addresses in format of
00-11-22 or 00:11:22 or 001122
:oui_type: int
vendors ie type
:return: int
is valid ... | def get_vendor_ies(self, mac_block=None, oui_type=None):
"""vendor information element querying
:mac_block: str
first 3 bytes of mac addresses in format of
00-11-22 or 00:11:22 or 001122
:oui_type: int
vendors ie type
:return: int
is valid ... | [
"vendor",
"information",
"element",
"querying",
":",
"mac_block",
":",
"str",
"first",
"3",
"bytes",
"of",
"mac",
"addresses",
"in",
"format",
"of",
"00",
"-",
"11",
"-",
"22",
"or",
"00",
":",
"11",
":",
"22",
"or",
"001122",
":",
"oui_type",
":",
"... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L1878-L1912 | [
"def",
"get_vendor_ies",
"(",
"self",
",",
"mac_block",
"=",
"None",
",",
"oui_type",
"=",
"None",
")",
":",
"vendor_ies",
"=",
"[",
"]",
"if",
"mac_block",
"is",
"not",
"None",
":",
"if",
"Management",
".",
"is_valid_mac_oui",
"(",
"mac_block",
")",
":"... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | BACK.get_shark_field | :fields: str[] | pcapfile/protocols/linklayer/wifi.py | def get_shark_field(self, fields):
"""
:fields: str[]
"""
out = super(BACK, self).get_shark_field(fields)
out.update({'acked_seqs': self.acked_seqs,
'bitmap_str': self.bitmap_str})
return out | def get_shark_field(self, fields):
"""
:fields: str[]
"""
out = super(BACK, self).get_shark_field(fields)
out.update({'acked_seqs': self.acked_seqs,
'bitmap_str': self.bitmap_str})
return out | [
":",
"fields",
":",
"str",
"[]"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L2215-L2222 | [
"def",
"get_shark_field",
"(",
"self",
",",
"fields",
")",
":",
"out",
"=",
"super",
"(",
"BACK",
",",
"self",
")",
".",
"get_shark_field",
"(",
"fields",
")",
"out",
".",
"update",
"(",
"{",
"'acked_seqs'",
":",
"self",
".",
"acked_seqs",
",",
"'bitma... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | BACK.strip_cntrl | strip(2 byte) wlan.ba.control
:payload: ctypes.structure
:return: int
multitid (tid: traffic indicator)
:return: int
ackpolicy | pcapfile/protocols/linklayer/wifi.py | def strip_cntrl(payload):
"""strip(2 byte) wlan.ba.control
:payload: ctypes.structure
:return: int
multitid (tid: traffic indicator)
:return: int
ackpolicy
"""
cntrl = struct.unpack('H', payload)[0]
cntrl_bits = format(cntrl, '016b')[::-1]
... | def strip_cntrl(payload):
"""strip(2 byte) wlan.ba.control
:payload: ctypes.structure
:return: int
multitid (tid: traffic indicator)
:return: int
ackpolicy
"""
cntrl = struct.unpack('H', payload)[0]
cntrl_bits = format(cntrl, '016b')[::-1]
... | [
"strip",
"(",
"2",
"byte",
")",
"wlan",
".",
"ba",
".",
"control",
":",
"payload",
":",
"ctypes",
".",
"structure",
":",
"return",
":",
"int",
"multitid",
"(",
"tid",
":",
"traffic",
"indicator",
")",
":",
"return",
":",
"int",
"ackpolicy"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L2225-L2237 | [
"def",
"strip_cntrl",
"(",
"payload",
")",
":",
"cntrl",
"=",
"struct",
".",
"unpack",
"(",
"'H'",
",",
"payload",
")",
"[",
"0",
"]",
"cntrl_bits",
"=",
"format",
"(",
"cntrl",
",",
"'016b'",
")",
"[",
":",
":",
"-",
"1",
"]",
"ackpolicy",
"=",
... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | BACK.strip_ssc | strip(2 byte) wlan_mgt.fixed.ssc
:payload: ctypes.structure
:return: int
ssc_seq (starting sequence control sequence)
:return: int
ssc_frag (starting sequence control fragment number) | pcapfile/protocols/linklayer/wifi.py | def strip_ssc(payload):
"""strip(2 byte) wlan_mgt.fixed.ssc
:payload: ctypes.structure
:return: int
ssc_seq (starting sequence control sequence)
:return: int
ssc_frag (starting sequence control fragment number)
"""
ssc = struct.unpack('H', payload)... | def strip_ssc(payload):
"""strip(2 byte) wlan_mgt.fixed.ssc
:payload: ctypes.structure
:return: int
ssc_seq (starting sequence control sequence)
:return: int
ssc_frag (starting sequence control fragment number)
"""
ssc = struct.unpack('H', payload)... | [
"strip",
"(",
"2",
"byte",
")",
"wlan_mgt",
".",
"fixed",
".",
"ssc",
":",
"payload",
":",
"ctypes",
".",
"structure",
":",
"return",
":",
"int",
"ssc_seq",
"(",
"starting",
"sequence",
"control",
"sequence",
")",
":",
"return",
":",
"int",
"ssc_frag",
... | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L2240-L2251 | [
"def",
"strip_ssc",
"(",
"payload",
")",
":",
"ssc",
"=",
"struct",
".",
"unpack",
"(",
"'H'",
",",
"payload",
")",
"[",
"0",
"]",
"ssc_seq",
"=",
"ssc",
">>",
"4",
"ssc_frag",
"=",
"ssc",
"&",
"0x000f",
"return",
"ssc_seq",
",",
"ssc_frag"
] | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | BACK.strip_bitmap_str | strip(8 byte) wlan.ba.bm
:payload: ctypes.structure
:return: str
bitmap | pcapfile/protocols/linklayer/wifi.py | def strip_bitmap_str(payload):
"""strip(8 byte) wlan.ba.bm
:payload: ctypes.structure
:return: str
bitmap
"""
bitmap = struct.unpack('BBBBBBBB', payload)
bitmap_str = ''
for elem in bitmap:
bitmap_str += format(elem, '08b')[::-1]
re... | def strip_bitmap_str(payload):
"""strip(8 byte) wlan.ba.bm
:payload: ctypes.structure
:return: str
bitmap
"""
bitmap = struct.unpack('BBBBBBBB', payload)
bitmap_str = ''
for elem in bitmap:
bitmap_str += format(elem, '08b')[::-1]
re... | [
"strip",
"(",
"8",
"byte",
")",
"wlan",
".",
"ba",
".",
"bm",
":",
"payload",
":",
"ctypes",
".",
"structure",
":",
"return",
":",
"str",
"bitmap"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L2254-L2264 | [
"def",
"strip_bitmap_str",
"(",
"payload",
")",
":",
"bitmap",
"=",
"struct",
".",
"unpack",
"(",
"'BBBBBBBB'",
",",
"payload",
")",
"bitmap_str",
"=",
"''",
"for",
"elem",
"in",
"bitmap",
":",
"bitmap_str",
"+=",
"format",
"(",
"elem",
",",
"'08b'",
")"... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | BACK.extract_acked_seqs | extracts acknowledged sequences from bitmap and
starting sequence number.
:bitmap: str
:ssc_seq: int
:return: int[]
acknowledged sequence numbers | pcapfile/protocols/linklayer/wifi.py | def extract_acked_seqs(bitmap, ssc_seq):
"""extracts acknowledged sequences from bitmap and
starting sequence number.
:bitmap: str
:ssc_seq: int
:return: int[]
acknowledged sequence numbers
"""
acked_seqs = []
for idx, val in enumerate(bitmap):... | def extract_acked_seqs(bitmap, ssc_seq):
"""extracts acknowledged sequences from bitmap and
starting sequence number.
:bitmap: str
:ssc_seq: int
:return: int[]
acknowledged sequence numbers
"""
acked_seqs = []
for idx, val in enumerate(bitmap):... | [
"extracts",
"acknowledged",
"sequences",
"from",
"bitmap",
"and",
"starting",
"sequence",
"number",
".",
":",
"bitmap",
":",
"str",
":",
"ssc_seq",
":",
"int",
":",
"return",
":",
"int",
"[]",
"acknowledged",
"sequence",
"numbers"
] | kisom/pypcapfile | python | https://github.com/kisom/pypcapfile/blob/67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8/pcapfile/protocols/linklayer/wifi.py#L2267-L2280 | [
"def",
"extract_acked_seqs",
"(",
"bitmap",
",",
"ssc_seq",
")",
":",
"acked_seqs",
"=",
"[",
"]",
"for",
"idx",
",",
"val",
"in",
"enumerate",
"(",
"bitmap",
")",
":",
"if",
"int",
"(",
"val",
")",
"==",
"1",
":",
"seq",
"=",
"(",
"ssc_seq",
"+",
... | 67520cfbb6c2e9ab3e7c181a8012ddc56ec5cad8 |
valid | heartbeat | Call Heartbeat URL | examples/phonemenu/phonemenu.py | def heartbeat():
"""Call Heartbeat URL"""
print "We got a call heartbeat notification\n"
if request.method == 'POST':
print request.form
else:
print request.args
return "OK" | def heartbeat():
"""Call Heartbeat URL"""
print "We got a call heartbeat notification\n"
if request.method == 'POST':
print request.form
else:
print request.args
return "OK" | [
"Call",
"Heartbeat",
"URL"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/examples/phonemenu/phonemenu.py#L58-L67 | [
"def",
"heartbeat",
"(",
")",
":",
"print",
"\"We got a call heartbeat notification\\n\"",
"if",
"request",
".",
"method",
"==",
"'POST'",
":",
"print",
"request",
".",
"form",
"else",
":",
"print",
"request",
".",
"args",
"return",
"\"OK\""
] | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.request | sends a request and gets a response from the Plivo REST API
path: the URL (relative to the endpoint URL, after the /v1
method: the HTTP method to use, defaults to POST
data: for POST or PUT, a dict of data to send
returns Plivo response in XML or raises an exception on error | plivohelper.py | def request(self, path, method=None, data={}):
"""sends a request and gets a response from the Plivo REST API
path: the URL (relative to the endpoint URL, after the /v1
method: the HTTP method to use, defaults to POST
data: for POST or PUT, a dict of data to send
returns Plivo ... | def request(self, path, method=None, data={}):
"""sends a request and gets a response from the Plivo REST API
path: the URL (relative to the endpoint URL, after the /v1
method: the HTTP method to use, defaults to POST
data: for POST or PUT, a dict of data to send
returns Plivo ... | [
"sends",
"a",
"request",
"and",
"gets",
"a",
"response",
"from",
"the",
"Plivo",
"REST",
"API"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L115-L137 | [
"def",
"request",
"(",
"self",
",",
"path",
",",
"method",
"=",
"None",
",",
"data",
"=",
"{",
"}",
")",
":",
"if",
"not",
"path",
":",
"raise",
"ValueError",
"(",
"'Invalid path parameter'",
")",
"if",
"method",
"and",
"method",
"not",
"in",
"[",
"'... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.reload_config | REST Reload Plivo Config helper | plivohelper.py | def reload_config(self, call_params):
"""REST Reload Plivo Config helper
"""
path = '/' + self.api_version + '/ReloadConfig/'
method = 'POST'
return self.request(path, method, call_params) | def reload_config(self, call_params):
"""REST Reload Plivo Config helper
"""
path = '/' + self.api_version + '/ReloadConfig/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Reload",
"Plivo",
"Config",
"helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L139-L144 | [
"def",
"reload_config",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ReloadConfig/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.reload_cache_config | REST Reload Plivo Cache Config helper | plivohelper.py | def reload_cache_config(self, call_params):
"""REST Reload Plivo Cache Config helper
"""
path = '/' + self.api_version + '/ReloadCacheConfig/'
method = 'POST'
return self.request(path, method, call_params) | def reload_cache_config(self, call_params):
"""REST Reload Plivo Cache Config helper
"""
path = '/' + self.api_version + '/ReloadCacheConfig/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Reload",
"Plivo",
"Cache",
"Config",
"helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L146-L151 | [
"def",
"reload_cache_config",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ReloadCacheConfig/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_para... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.call | REST Call Helper | plivohelper.py | def call(self, call_params):
"""REST Call Helper
"""
path = '/' + self.api_version + '/Call/'
method = 'POST'
return self.request(path, method, call_params) | def call(self, call_params):
"""REST Call Helper
"""
path = '/' + self.api_version + '/Call/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Call",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L153-L158 | [
"def",
"call",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/Call/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
] | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.bulk_call | REST BulkCalls Helper | plivohelper.py | def bulk_call(self, call_params):
"""REST BulkCalls Helper
"""
path = '/' + self.api_version + '/BulkCall/'
method = 'POST'
return self.request(path, method, call_params) | def bulk_call(self, call_params):
"""REST BulkCalls Helper
"""
path = '/' + self.api_version + '/BulkCall/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"BulkCalls",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L160-L165 | [
"def",
"bulk_call",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/BulkCall/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
] | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.group_call | REST GroupCalls Helper | plivohelper.py | def group_call(self, call_params):
"""REST GroupCalls Helper
"""
path = '/' + self.api_version + '/GroupCall/'
method = 'POST'
return self.request(path, method, call_params) | def group_call(self, call_params):
"""REST GroupCalls Helper
"""
path = '/' + self.api_version + '/GroupCall/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"GroupCalls",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L167-L172 | [
"def",
"group_call",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/GroupCall/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
] | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.transfer_call | REST Transfer Live Call Helper | plivohelper.py | def transfer_call(self, call_params):
"""REST Transfer Live Call Helper
"""
path = '/' + self.api_version + '/TransferCall/'
method = 'POST'
return self.request(path, method, call_params) | def transfer_call(self, call_params):
"""REST Transfer Live Call Helper
"""
path = '/' + self.api_version + '/TransferCall/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Transfer",
"Live",
"Call",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L174-L179 | [
"def",
"transfer_call",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/TransferCall/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.hangup_all_calls | REST Hangup All Live Calls Helper | plivohelper.py | def hangup_all_calls(self):
"""REST Hangup All Live Calls Helper
"""
path = '/' + self.api_version + '/HangupAllCalls/'
method = 'POST'
return self.request(path, method) | def hangup_all_calls(self):
"""REST Hangup All Live Calls Helper
"""
path = '/' + self.api_version + '/HangupAllCalls/'
method = 'POST'
return self.request(path, method) | [
"REST",
"Hangup",
"All",
"Live",
"Calls",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L181-L186 | [
"def",
"hangup_all_calls",
"(",
"self",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/HangupAllCalls/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
")"
] | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.hangup_call | REST Hangup Live Call Helper | plivohelper.py | def hangup_call(self, call_params):
"""REST Hangup Live Call Helper
"""
path = '/' + self.api_version + '/HangupCall/'
method = 'POST'
return self.request(path, method, call_params) | def hangup_call(self, call_params):
"""REST Hangup Live Call Helper
"""
path = '/' + self.api_version + '/HangupCall/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Hangup",
"Live",
"Call",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L188-L193 | [
"def",
"hangup_call",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/HangupCall/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
] | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.schedule_hangup | REST Schedule Hangup Helper | plivohelper.py | def schedule_hangup(self, call_params):
"""REST Schedule Hangup Helper
"""
path = '/' + self.api_version + '/ScheduleHangup/'
method = 'POST'
return self.request(path, method, call_params) | def schedule_hangup(self, call_params):
"""REST Schedule Hangup Helper
"""
path = '/' + self.api_version + '/ScheduleHangup/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Schedule",
"Hangup",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L195-L200 | [
"def",
"schedule_hangup",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ScheduleHangup/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.cancel_scheduled_hangup | REST Cancel a Scheduled Hangup Helper | plivohelper.py | def cancel_scheduled_hangup(self, call_params):
"""REST Cancel a Scheduled Hangup Helper
"""
path = '/' + self.api_version + '/CancelScheduledHangup/'
method = 'POST'
return self.request(path, method, call_params) | def cancel_scheduled_hangup(self, call_params):
"""REST Cancel a Scheduled Hangup Helper
"""
path = '/' + self.api_version + '/CancelScheduledHangup/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Cancel",
"a",
"Scheduled",
"Hangup",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L202-L207 | [
"def",
"cancel_scheduled_hangup",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/CancelScheduledHangup/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"c... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.record_start | REST RecordStart helper | plivohelper.py | def record_start(self, call_params):
"""REST RecordStart helper
"""
path = '/' + self.api_version + '/RecordStart/'
method = 'POST'
return self.request(path, method, call_params) | def record_start(self, call_params):
"""REST RecordStart helper
"""
path = '/' + self.api_version + '/RecordStart/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"RecordStart",
"helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L209-L214 | [
"def",
"record_start",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/RecordStart/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
] | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.record_stop | REST RecordStop | plivohelper.py | def record_stop(self, call_params):
"""REST RecordStop
"""
path = '/' + self.api_version + '/RecordStop/'
method = 'POST'
return self.request(path, method, call_params) | def record_stop(self, call_params):
"""REST RecordStop
"""
path = '/' + self.api_version + '/RecordStop/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"RecordStop"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L216-L221 | [
"def",
"record_stop",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/RecordStop/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
] | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.conference_mute | REST Conference Mute helper | plivohelper.py | def conference_mute(self, call_params):
"""REST Conference Mute helper
"""
path = '/' + self.api_version + '/ConferenceMute/'
method = 'POST'
return self.request(path, method, call_params) | def conference_mute(self, call_params):
"""REST Conference Mute helper
"""
path = '/' + self.api_version + '/ConferenceMute/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Conference",
"Mute",
"helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L223-L228 | [
"def",
"conference_mute",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ConferenceMute/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.play | REST Play something on a Call Helper | plivohelper.py | def play(self, call_params):
"""REST Play something on a Call Helper
"""
path = '/' + self.api_version + '/Play/'
method = 'POST'
return self.request(path, method, call_params) | def play(self, call_params):
"""REST Play something on a Call Helper
"""
path = '/' + self.api_version + '/Play/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Play",
"something",
"on",
"a",
"Call",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L230-L235 | [
"def",
"play",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/Play/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
] | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.play_stop | REST PlayStop on a Call Helper | plivohelper.py | def play_stop(self, call_params):
"""REST PlayStop on a Call Helper
"""
path = '/' + self.api_version + '/PlayStop/'
method = 'POST'
return self.request(path, method, call_params) | def play_stop(self, call_params):
"""REST PlayStop on a Call Helper
"""
path = '/' + self.api_version + '/PlayStop/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"PlayStop",
"on",
"a",
"Call",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L237-L242 | [
"def",
"play_stop",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/PlayStop/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
] | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.schedule_play | REST Schedule playing something on a call Helper | plivohelper.py | def schedule_play(self, call_params):
"""REST Schedule playing something on a call Helper
"""
path = '/' + self.api_version + '/SchedulePlay/'
method = 'POST'
return self.request(path, method, call_params) | def schedule_play(self, call_params):
"""REST Schedule playing something on a call Helper
"""
path = '/' + self.api_version + '/SchedulePlay/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Schedule",
"playing",
"something",
"on",
"a",
"call",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L244-L249 | [
"def",
"schedule_play",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/SchedulePlay/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.cancel_scheduled_play | REST Cancel a Scheduled Play Helper | plivohelper.py | def cancel_scheduled_play(self, call_params):
"""REST Cancel a Scheduled Play Helper
"""
path = '/' + self.api_version + '/CancelScheduledPlay/'
method = 'POST'
return self.request(path, method, call_params) | def cancel_scheduled_play(self, call_params):
"""REST Cancel a Scheduled Play Helper
"""
path = '/' + self.api_version + '/CancelScheduledPlay/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Cancel",
"a",
"Scheduled",
"Play",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L251-L256 | [
"def",
"cancel_scheduled_play",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/CancelScheduledPlay/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.sound_touch | REST Add soundtouch audio effects to a Call | plivohelper.py | def sound_touch(self, call_params):
"""REST Add soundtouch audio effects to a Call
"""
path = '/' + self.api_version + '/SoundTouch/'
method = 'POST'
return self.request(path, method, call_params) | def sound_touch(self, call_params):
"""REST Add soundtouch audio effects to a Call
"""
path = '/' + self.api_version + '/SoundTouch/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Add",
"soundtouch",
"audio",
"effects",
"to",
"a",
"Call"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L258-L263 | [
"def",
"sound_touch",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/SoundTouch/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
] | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.sound_touch_stop | REST Remove soundtouch audio effects on a Call | plivohelper.py | def sound_touch_stop(self, call_params):
"""REST Remove soundtouch audio effects on a Call
"""
path = '/' + self.api_version + '/SoundTouchStop/'
method = 'POST'
return self.request(path, method, call_params) | def sound_touch_stop(self, call_params):
"""REST Remove soundtouch audio effects on a Call
"""
path = '/' + self.api_version + '/SoundTouchStop/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Remove",
"soundtouch",
"audio",
"effects",
"on",
"a",
"Call"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L265-L270 | [
"def",
"sound_touch_stop",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/SoundTouchStop/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.send_digits | REST Send digits to a Call | plivohelper.py | def send_digits(self, call_params):
"""REST Send digits to a Call
"""
path = '/' + self.api_version + '/SendDigits/'
method = 'POST'
return self.request(path, method, call_params) | def send_digits(self, call_params):
"""REST Send digits to a Call
"""
path = '/' + self.api_version + '/SendDigits/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Send",
"digits",
"to",
"a",
"Call"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L272-L277 | [
"def",
"send_digits",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/SendDigits/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
")"
] | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.conference_unmute | REST Conference Unmute helper | plivohelper.py | def conference_unmute(self, call_params):
"""REST Conference Unmute helper
"""
path = '/' + self.api_version + '/ConferenceUnmute/'
method = 'POST'
return self.request(path, method, call_params) | def conference_unmute(self, call_params):
"""REST Conference Unmute helper
"""
path = '/' + self.api_version + '/ConferenceUnmute/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Conference",
"Unmute",
"helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L279-L284 | [
"def",
"conference_unmute",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ConferenceUnmute/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params"... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.conference_kick | REST Conference Kick helper | plivohelper.py | def conference_kick(self, call_params):
"""REST Conference Kick helper
"""
path = '/' + self.api_version + '/ConferenceKick/'
method = 'POST'
return self.request(path, method, call_params) | def conference_kick(self, call_params):
"""REST Conference Kick helper
"""
path = '/' + self.api_version + '/ConferenceKick/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Conference",
"Kick",
"helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L286-L291 | [
"def",
"conference_kick",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ConferenceKick/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.conference_hangup | REST Conference Hangup helper | plivohelper.py | def conference_hangup(self, call_params):
"""REST Conference Hangup helper
"""
path = '/' + self.api_version + '/ConferenceHangup/'
method = 'POST'
return self.request(path, method, call_params) | def conference_hangup(self, call_params):
"""REST Conference Hangup helper
"""
path = '/' + self.api_version + '/ConferenceHangup/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Conference",
"Hangup",
"helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L293-L298 | [
"def",
"conference_hangup",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ConferenceHangup/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params"... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.conference_deaf | REST Conference Deaf helper | plivohelper.py | def conference_deaf(self, call_params):
"""REST Conference Deaf helper
"""
path = '/' + self.api_version + '/ConferenceDeaf/'
method = 'POST'
return self.request(path, method, call_params) | def conference_deaf(self, call_params):
"""REST Conference Deaf helper
"""
path = '/' + self.api_version + '/ConferenceDeaf/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Conference",
"Deaf",
"helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L300-L305 | [
"def",
"conference_deaf",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ConferenceDeaf/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.conference_undeaf | REST Conference Undeaf helper | plivohelper.py | def conference_undeaf(self, call_params):
"""REST Conference Undeaf helper
"""
path = '/' + self.api_version + '/ConferenceUndeaf/'
method = 'POST'
return self.request(path, method, call_params) | def conference_undeaf(self, call_params):
"""REST Conference Undeaf helper
"""
path = '/' + self.api_version + '/ConferenceUndeaf/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Conference",
"Undeaf",
"helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L307-L312 | [
"def",
"conference_undeaf",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ConferenceUndeaf/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params"... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.conference_record_start | REST Conference RecordStart helper | plivohelper.py | def conference_record_start(self, call_params):
"""REST Conference RecordStart helper
"""
path = '/' + self.api_version + '/ConferenceRecordStart/'
method = 'POST'
return self.request(path, method, call_params) | def conference_record_start(self, call_params):
"""REST Conference RecordStart helper
"""
path = '/' + self.api_version + '/ConferenceRecordStart/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Conference",
"RecordStart",
"helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L314-L319 | [
"def",
"conference_record_start",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ConferenceRecordStart/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"c... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.conference_record_stop | REST Conference RecordStop | plivohelper.py | def conference_record_stop(self, call_params):
"""REST Conference RecordStop
"""
path = '/' + self.api_version + '/ConferenceRecordStop/'
method = 'POST'
return self.request(path, method, call_params) | def conference_record_stop(self, call_params):
"""REST Conference RecordStop
"""
path = '/' + self.api_version + '/ConferenceRecordStop/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Conference",
"RecordStop"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L321-L326 | [
"def",
"conference_record_stop",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ConferenceRecordStop/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"cal... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.conference_play | REST Conference Play helper | plivohelper.py | def conference_play(self, call_params):
"""REST Conference Play helper
"""
path = '/' + self.api_version + '/ConferencePlay/'
method = 'POST'
return self.request(path, method, call_params) | def conference_play(self, call_params):
"""REST Conference Play helper
"""
path = '/' + self.api_version + '/ConferencePlay/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Conference",
"Play",
"helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L328-L333 | [
"def",
"conference_play",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ConferencePlay/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.conference_speak | REST Conference Speak helper | plivohelper.py | def conference_speak(self, call_params):
"""REST Conference Speak helper
"""
path = '/' + self.api_version + '/ConferenceSpeak/'
method = 'POST'
return self.request(path, method, call_params) | def conference_speak(self, call_params):
"""REST Conference Speak helper
"""
path = '/' + self.api_version + '/ConferenceSpeak/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Conference",
"Speak",
"helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L335-L340 | [
"def",
"conference_speak",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ConferenceSpeak/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.conference_list | REST Conference List Helper | plivohelper.py | def conference_list(self, call_params):
"""REST Conference List Helper
"""
path = '/' + self.api_version + '/ConferenceList/'
method = 'POST'
return self.request(path, method, call_params) | def conference_list(self, call_params):
"""REST Conference List Helper
"""
path = '/' + self.api_version + '/ConferenceList/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Conference",
"List",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L342-L347 | [
"def",
"conference_list",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ConferenceList/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"call_params",
... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | REST.conference_list_members | REST Conference List Members Helper | plivohelper.py | def conference_list_members(self, call_params):
"""REST Conference List Members Helper
"""
path = '/' + self.api_version + '/ConferenceListMembers/'
method = 'POST'
return self.request(path, method, call_params) | def conference_list_members(self, call_params):
"""REST Conference List Members Helper
"""
path = '/' + self.api_version + '/ConferenceListMembers/'
method = 'POST'
return self.request(path, method, call_params) | [
"REST",
"Conference",
"List",
"Members",
"Helper"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L349-L354 | [
"def",
"conference_list_members",
"(",
"self",
",",
"call_params",
")",
":",
"path",
"=",
"'/'",
"+",
"self",
".",
"api_version",
"+",
"'/ConferenceListMembers/'",
"method",
"=",
"'POST'",
"return",
"self",
".",
"request",
"(",
"path",
",",
"method",
",",
"c... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | Element._xml | Return an XML element representing this element | plivohelper.py | def _xml(self, root):
"""
Return an XML element representing this element
"""
element = root.createElement(self.name)
# Add attributes
keys = self.attrs.keys()
keys.sort()
for a in keys:
element.setAttribute(a, self.attrs[a])
if self.... | def _xml(self, root):
"""
Return an XML element representing this element
"""
element = root.createElement(self.name)
# Add attributes
keys = self.attrs.keys()
keys.sort()
for a in keys:
element.setAttribute(a, self.attrs[a])
if self.... | [
"Return",
"an",
"XML",
"element",
"representing",
"this",
"element"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L404-L423 | [
"def",
"_xml",
"(",
"self",
",",
"root",
")",
":",
"element",
"=",
"root",
".",
"createElement",
"(",
"self",
".",
"name",
")",
"# Add attributes",
"keys",
"=",
"self",
".",
"attrs",
".",
"keys",
"(",
")",
"keys",
".",
"sort",
"(",
")",
"for",
"a",... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | Utils.validateRequest | validate a request from plivo
uri: the full URI that Plivo requested on your server
postVars: post vars that Plivo sent with the request
expectedSignature: signature in HTTP X-Plivo-Signature header
returns true if the request passes validation, false if not | plivohelper.py | def validateRequest(self, uri, postVars, expectedSignature):
"""validate a request from plivo
uri: the full URI that Plivo requested on your server
postVars: post vars that Plivo sent with the request
expectedSignature: signature in HTTP X-Plivo-Signature header
returns true if... | def validateRequest(self, uri, postVars, expectedSignature):
"""validate a request from plivo
uri: the full URI that Plivo requested on your server
postVars: post vars that Plivo sent with the request
expectedSignature: signature in HTTP X-Plivo-Signature header
returns true if... | [
"validate",
"a",
"request",
"from",
"plivo"
] | plivo/plivohelper-python | python | https://github.com/plivo/plivohelper-python/blob/a2f706d69e2138fbb973f792041341f662072d26/plivohelper.py#L764-L781 | [
"def",
"validateRequest",
"(",
"self",
",",
"uri",
",",
"postVars",
",",
"expectedSignature",
")",
":",
"# append the POST variables sorted by key to the uri",
"s",
"=",
"uri",
"for",
"k",
",",
"v",
"in",
"sorted",
"(",
"postVars",
".",
"items",
"(",
")",
")",... | a2f706d69e2138fbb973f792041341f662072d26 |
valid | Graph.DFS_prefix | Depth-first search.
.. seealso::
`Wikipedia DFS descritpion <http://en.wikipedia.org/wiki/Depth-first_search>`_
:param root: first to start the search
:return: list of nodes | pygraphml/graph.py | def DFS_prefix(self, root=None):
"""
Depth-first search.
.. seealso::
`Wikipedia DFS descritpion <http://en.wikipedia.org/wiki/Depth-first_search>`_
:param root: first to start the search
:return: list of nodes
"""
if not root:
root = sel... | def DFS_prefix(self, root=None):
"""
Depth-first search.
.. seealso::
`Wikipedia DFS descritpion <http://en.wikipedia.org/wiki/Depth-first_search>`_
:param root: first to start the search
:return: list of nodes
"""
if not root:
root = sel... | [
"Depth",
"-",
"first",
"search",
"."
] | hadim/pygraphml | python | https://github.com/hadim/pygraphml/blob/dce007bd7f078427c73a2a1d6f4b834af1b4dc03/pygraphml/graph.py#L34-L48 | [
"def",
"DFS_prefix",
"(",
"self",
",",
"root",
"=",
"None",
")",
":",
"if",
"not",
"root",
":",
"root",
"=",
"self",
".",
"_root",
"return",
"self",
".",
"_DFS_prefix",
"(",
"root",
")"
] | dce007bd7f078427c73a2a1d6f4b834af1b4dc03 |
valid | Graph.BFS | Breadth-first search.
.. seealso::
`Wikipedia BFS descritpion <http://en.wikipedia.org/wiki/Breadth-first_search>`_
:param root: first to start the search
:return: list of nodes | pygraphml/graph.py | def BFS(self, root=None):
"""
Breadth-first search.
.. seealso::
`Wikipedia BFS descritpion <http://en.wikipedia.org/wiki/Breadth-first_search>`_
:param root: first to start the search
:return: list of nodes
"""
if not root:
root = self... | def BFS(self, root=None):
"""
Breadth-first search.
.. seealso::
`Wikipedia BFS descritpion <http://en.wikipedia.org/wiki/Breadth-first_search>`_
:param root: first to start the search
:return: list of nodes
"""
if not root:
root = self... | [
"Breadth",
"-",
"first",
"search",
"."
] | hadim/pygraphml | python | https://github.com/hadim/pygraphml/blob/dce007bd7f078427c73a2a1d6f4b834af1b4dc03/pygraphml/graph.py#L63-L91 | [
"def",
"BFS",
"(",
"self",
",",
"root",
"=",
"None",
")",
":",
"if",
"not",
"root",
":",
"root",
"=",
"self",
".",
"root",
"(",
")",
"queue",
"=",
"deque",
"(",
")",
"queue",
".",
"append",
"(",
"root",
")",
"nodes",
"=",
"[",
"]",
"while",
"... | dce007bd7f078427c73a2a1d6f4b834af1b4dc03 |
valid | NoDupesGraph.add_node | Return a node with label. Create node if label is new | pygraphml/graph.py | def add_node(self,label):
'''Return a node with label. Create node if label is new'''
try:
n = self._nodes[label]
except KeyError:
n = Node()
n['label'] = label
self._nodes[label]=n
return n | def add_node(self,label):
'''Return a node with label. Create node if label is new'''
try:
n = self._nodes[label]
except KeyError:
n = Node()
n['label'] = label
self._nodes[label]=n
return n | [
"Return",
"a",
"node",
"with",
"label",
".",
"Create",
"node",
"if",
"label",
"is",
"new"
] | hadim/pygraphml | python | https://github.com/hadim/pygraphml/blob/dce007bd7f078427c73a2a1d6f4b834af1b4dc03/pygraphml/graph.py#L263-L271 | [
"def",
"add_node",
"(",
"self",
",",
"label",
")",
":",
"try",
":",
"n",
"=",
"self",
".",
"_nodes",
"[",
"label",
"]",
"except",
"KeyError",
":",
"n",
"=",
"Node",
"(",
")",
"n",
"[",
"'label'",
"]",
"=",
"label",
"self",
".",
"_nodes",
"[",
"... | dce007bd7f078427c73a2a1d6f4b834af1b4dc03 |
valid | NoDupesGraph.add_edge | Get or create edges using get_or_create_node | pygraphml/graph.py | def add_edge(self, n1_label, n2_label,directed=False):
"""
Get or create edges using get_or_create_node
"""
n1 = self.add_node(n1_label)
n2 = self.add_node(n2_label)
e = Edge(n1, n2, directed)
self._edges.append(e)
return e | def add_edge(self, n1_label, n2_label,directed=False):
"""
Get or create edges using get_or_create_node
"""
n1 = self.add_node(n1_label)
n2 = self.add_node(n2_label)
e = Edge(n1, n2, directed)
self._edges.append(e)
return e | [
"Get",
"or",
"create",
"edges",
"using",
"get_or_create_node"
] | hadim/pygraphml | python | https://github.com/hadim/pygraphml/blob/dce007bd7f078427c73a2a1d6f4b834af1b4dc03/pygraphml/graph.py#L273-L281 | [
"def",
"add_edge",
"(",
"self",
",",
"n1_label",
",",
"n2_label",
",",
"directed",
"=",
"False",
")",
":",
"n1",
"=",
"self",
".",
"add_node",
"(",
"n1_label",
")",
"n2",
"=",
"self",
".",
"add_node",
"(",
"n2_label",
")",
"e",
"=",
"Edge",
"(",
"n... | dce007bd7f078427c73a2a1d6f4b834af1b4dc03 |
valid | GraphMLParser.parse_dom | Parse dom into a Graph.
:param dom: dom as returned by minidom.parse or minidom.parseString
:return: A Graph representation | pygraphml/graphml_parser.py | def parse_dom(dom):
"""Parse dom into a Graph.
:param dom: dom as returned by minidom.parse or minidom.parseString
:return: A Graph representation
"""
root = dom.getElementsByTagName("graphml")[0]
graph = root.getElementsByTagName("graph")[0]
name = graph.getAttr... | def parse_dom(dom):
"""Parse dom into a Graph.
:param dom: dom as returned by minidom.parse or minidom.parseString
:return: A Graph representation
"""
root = dom.getElementsByTagName("graphml")[0]
graph = root.getElementsByTagName("graph")[0]
name = graph.getAttr... | [
"Parse",
"dom",
"into",
"a",
"Graph",
"."
] | hadim/pygraphml | python | https://github.com/hadim/pygraphml/blob/dce007bd7f078427c73a2a1d6f4b834af1b4dc03/pygraphml/graphml_parser.py#L82-L123 | [
"def",
"parse_dom",
"(",
"dom",
")",
":",
"root",
"=",
"dom",
".",
"getElementsByTagName",
"(",
"\"graphml\"",
")",
"[",
"0",
"]",
"graph",
"=",
"root",
".",
"getElementsByTagName",
"(",
"\"graph\"",
")",
"[",
"0",
"]",
"name",
"=",
"graph",
".",
"getA... | dce007bd7f078427c73a2a1d6f4b834af1b4dc03 |
valid | GraphMLParser.parse_string | Parse a string into a Graph.
:param string: String that is to be passed into Grapg
:return: Graph | pygraphml/graphml_parser.py | def parse_string(self, string):
"""Parse a string into a Graph.
:param string: String that is to be passed into Grapg
:return: Graph
"""
dom = minidom.parseString(string)
return self.parse_dom(dom) | def parse_string(self, string):
"""Parse a string into a Graph.
:param string: String that is to be passed into Grapg
:return: Graph
"""
dom = minidom.parseString(string)
return self.parse_dom(dom) | [
"Parse",
"a",
"string",
"into",
"a",
"Graph",
"."
] | hadim/pygraphml | python | https://github.com/hadim/pygraphml/blob/dce007bd7f078427c73a2a1d6f4b834af1b4dc03/pygraphml/graphml_parser.py#L169-L176 | [
"def",
"parse_string",
"(",
"self",
",",
"string",
")",
":",
"dom",
"=",
"minidom",
".",
"parseString",
"(",
"string",
")",
"return",
"self",
".",
"parse_dom",
"(",
"dom",
")"
] | dce007bd7f078427c73a2a1d6f4b834af1b4dc03 |
valid | Edge.node | Return the other node | pygraphml/edge.py | def node(self, node):
"""
Return the other node
"""
if node == self.node1:
return self.node2
elif node == self.node2:
return self.node1
else:
return None | def node(self, node):
"""
Return the other node
"""
if node == self.node1:
return self.node2
elif node == self.node2:
return self.node1
else:
return None | [
"Return",
"the",
"other",
"node"
] | hadim/pygraphml | python | https://github.com/hadim/pygraphml/blob/dce007bd7f078427c73a2a1d6f4b834af1b4dc03/pygraphml/edge.py#L29-L39 | [
"def",
"node",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
"==",
"self",
".",
"node1",
":",
"return",
"self",
".",
"node2",
"elif",
"node",
"==",
"self",
".",
"node2",
":",
"return",
"self",
".",
"node1",
"else",
":",
"return",
"None"
] | dce007bd7f078427c73a2a1d6f4b834af1b4dc03 |
valid | HotQueue.consume | Return a generator that yields whenever a message is waiting in the
queue. Will block otherwise. Example:
>>> for msg in queue.consume(timeout=1):
... print msg
my message
another message
:param kwargs: any arguments that :meth:`~hotqueue.HotQueue.ge... | hotqueue.py | def consume(self, **kwargs):
"""Return a generator that yields whenever a message is waiting in the
queue. Will block otherwise. Example:
>>> for msg in queue.consume(timeout=1):
... print msg
my message
another message
:param kwargs: any arg... | def consume(self, **kwargs):
"""Return a generator that yields whenever a message is waiting in the
queue. Will block otherwise. Example:
>>> for msg in queue.consume(timeout=1):
... print msg
my message
another message
:param kwargs: any arg... | [
"Return",
"a",
"generator",
"that",
"yields",
"whenever",
"a",
"message",
"is",
"waiting",
"in",
"the",
"queue",
".",
"Will",
"block",
"otherwise",
".",
"Example",
":",
">>>",
"for",
"msg",
"in",
"queue",
".",
"consume",
"(",
"timeout",
"=",
"1",
")",
... | richardhenry/hotqueue | python | https://github.com/richardhenry/hotqueue/blob/0364d62840c575099bff25d50bfc4312a50c0cff/hotqueue.py#L60-L80 | [
"def",
"consume",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'block'",
",",
"True",
")",
"try",
":",
"while",
"True",
":",
"msg",
"=",
"self",
".",
"get",
"(",
"*",
"*",
"kwargs",
")",
"if",
"msg",
"is",
... | 0364d62840c575099bff25d50bfc4312a50c0cff |
valid | HotQueue.get | Return a message from the queue. Example:
>>> queue.get()
'my message'
>>> queue.get()
'another message'
:param block: whether or not to wait until a msg is available in
the queue before returning; ``False`` by default
:param timeout: when using ... | hotqueue.py | def get(self, block=False, timeout=None):
"""Return a message from the queue. Example:
>>> queue.get()
'my message'
>>> queue.get()
'another message'
:param block: whether or not to wait until a msg is available in
the queue before returning; ``F... | def get(self, block=False, timeout=None):
"""Return a message from the queue. Example:
>>> queue.get()
'my message'
>>> queue.get()
'another message'
:param block: whether or not to wait until a msg is available in
the queue before returning; ``F... | [
"Return",
"a",
"message",
"from",
"the",
"queue",
".",
"Example",
":",
">>>",
"queue",
".",
"get",
"()",
"my",
"message",
">>>",
"queue",
".",
"get",
"()",
"another",
"message",
":",
"param",
"block",
":",
"whether",
"or",
"not",
"to",
"wait",
"until",... | richardhenry/hotqueue | python | https://github.com/richardhenry/hotqueue/blob/0364d62840c575099bff25d50bfc4312a50c0cff/hotqueue.py#L82-L105 | [
"def",
"get",
"(",
"self",
",",
"block",
"=",
"False",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"block",
":",
"if",
"timeout",
"is",
"None",
":",
"timeout",
"=",
"0",
"msg",
"=",
"self",
".",
"__redis",
".",
"blpop",
"(",
"self",
".",
"key",
... | 0364d62840c575099bff25d50bfc4312a50c0cff |
valid | HotQueue.put | Put one or more messages onto the queue. Example:
>>> queue.put("my message")
>>> queue.put("another message")
To put messages onto the queue in bulk, which can be significantly
faster if you have a large number of messages:
>>> queue.put("my message", ... | hotqueue.py | def put(self, *msgs):
"""Put one or more messages onto the queue. Example:
>>> queue.put("my message")
>>> queue.put("another message")
To put messages onto the queue in bulk, which can be significantly
faster if you have a large number of messages:
... | def put(self, *msgs):
"""Put one or more messages onto the queue. Example:
>>> queue.put("my message")
>>> queue.put("another message")
To put messages onto the queue in bulk, which can be significantly
faster if you have a large number of messages:
... | [
"Put",
"one",
"or",
"more",
"messages",
"onto",
"the",
"queue",
".",
"Example",
":",
">>>",
"queue",
".",
"put",
"(",
"my",
"message",
")",
">>>",
"queue",
".",
"put",
"(",
"another",
"message",
")",
"To",
"put",
"messages",
"onto",
"the",
"queue",
"... | richardhenry/hotqueue | python | https://github.com/richardhenry/hotqueue/blob/0364d62840c575099bff25d50bfc4312a50c0cff/hotqueue.py#L107-L120 | [
"def",
"put",
"(",
"self",
",",
"*",
"msgs",
")",
":",
"if",
"self",
".",
"serializer",
"is",
"not",
"None",
":",
"msgs",
"=",
"map",
"(",
"self",
".",
"serializer",
".",
"dumps",
",",
"msgs",
")",
"self",
".",
"__redis",
".",
"rpush",
"(",
"self... | 0364d62840c575099bff25d50bfc4312a50c0cff |
valid | HotQueue.worker | Decorator for using a function as a queue worker. Example:
>>> @queue.worker(timeout=1)
... def printer(msg):
... print msg
>>> printer()
my message
another message
You can also use it without passing any keyword arguments:
>... | hotqueue.py | def worker(self, *args, **kwargs):
"""Decorator for using a function as a queue worker. Example:
>>> @queue.worker(timeout=1)
... def printer(msg):
... print msg
>>> printer()
my message
another message
You can also use it without pas... | def worker(self, *args, **kwargs):
"""Decorator for using a function as a queue worker. Example:
>>> @queue.worker(timeout=1)
... def printer(msg):
... print msg
>>> printer()
my message
another message
You can also use it without pas... | [
"Decorator",
"for",
"using",
"a",
"function",
"as",
"a",
"queue",
"worker",
".",
"Example",
":",
">>>"
] | richardhenry/hotqueue | python | https://github.com/richardhenry/hotqueue/blob/0364d62840c575099bff25d50bfc4312a50c0cff/hotqueue.py#L122-L152 | [
"def",
"worker",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"decorator",
"(",
"worker",
")",
":",
"@",
"wraps",
"(",
"worker",
")",
"def",
"wrapper",
"(",
"*",
"args",
")",
":",
"for",
"msg",
"in",
"self",
".",
"co... | 0364d62840c575099bff25d50bfc4312a50c0cff |
valid | _arg_parser | Factory for creating the argument parser | litezip/cli/validate.py | def _arg_parser():
"""Factory for creating the argument parser"""
description = "Converts a completezip to a litezip"
parser = argparse.ArgumentParser(description=description)
verbose_group = parser.add_mutually_exclusive_group()
verbose_group.add_argument(
'-v', '--verbose', action='store_t... | def _arg_parser():
"""Factory for creating the argument parser"""
description = "Converts a completezip to a litezip"
parser = argparse.ArgumentParser(description=description)
verbose_group = parser.add_mutually_exclusive_group()
verbose_group.add_argument(
'-v', '--verbose', action='store_t... | [
"Factory",
"for",
"creating",
"the",
"argument",
"parser"
] | openstax/cnx-litezip | python | https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/cli/validate.py#L9-L25 | [
"def",
"_arg_parser",
"(",
")",
":",
"description",
"=",
"\"Converts a completezip to a litezip\"",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"description",
")",
"verbose_group",
"=",
"parser",
".",
"add_mutually_exclusive_group",
"(",
... | 5e613f486f29fe350999d6b990d32847ac16a1b8 |
valid | IF.to_bytes | Complex code ahead. Comments have been added in as needed. | pyte/ops/if_.py | def to_bytes(self, previous: bytes):
"""
Complex code ahead. Comments have been added in as needed.
"""
# First, validate the lengths.
if len(self.conditions) != len(self.body):
raise exc.CompileError("Conditions and body length mismatch!")
bc = b""
... | def to_bytes(self, previous: bytes):
"""
Complex code ahead. Comments have been added in as needed.
"""
# First, validate the lengths.
if len(self.conditions) != len(self.body):
raise exc.CompileError("Conditions and body length mismatch!")
bc = b""
... | [
"Complex",
"code",
"ahead",
".",
"Comments",
"have",
"been",
"added",
"in",
"as",
"needed",
"."
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/ops/if_.py#L39-L77 | [
"def",
"to_bytes",
"(",
"self",
",",
"previous",
":",
"bytes",
")",
":",
"# First, validate the lengths.",
"if",
"len",
"(",
"self",
".",
"conditions",
")",
"!=",
"len",
"(",
"self",
".",
"body",
")",
":",
"raise",
"exc",
".",
"CompileError",
"(",
"\"Con... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
valid | FOR_LOOP.to_bytes_35 | A to-bytes specific to Python 3.5 and below. | pyte/ops/for_.py | def to_bytes_35(self, previous: bytes):
"""
A to-bytes specific to Python 3.5 and below.
"""
# Calculations ahead.
bc = b""
# Calculate the length of the iterator.
it_bc = util.generate_bytecode_from_obb(self.iterator, previous)
bc += it_bc
# Pu... | def to_bytes_35(self, previous: bytes):
"""
A to-bytes specific to Python 3.5 and below.
"""
# Calculations ahead.
bc = b""
# Calculate the length of the iterator.
it_bc = util.generate_bytecode_from_obb(self.iterator, previous)
bc += it_bc
# Pu... | [
"A",
"to",
"-",
"bytes",
"specific",
"to",
"Python",
"3",
".",
"5",
"and",
"below",
"."
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/ops/for_.py#L30-L71 | [
"def",
"to_bytes_35",
"(",
"self",
",",
"previous",
":",
"bytes",
")",
":",
"# Calculations ahead.",
"bc",
"=",
"b\"\"",
"# Calculate the length of the iterator.",
"it_bc",
"=",
"util",
".",
"generate_bytecode_from_obb",
"(",
"self",
".",
"iterator",
",",
"previous"... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
valid | FOR_LOOP.to_bytes_36 | A to-bytes specific to Python 3.6 and above. | pyte/ops/for_.py | def to_bytes_36(self, previous: bytes):
"""
A to-bytes specific to Python 3.6 and above.
"""
# Calculations ahead.
bc = b""
# Calculate the length of the iterator.
it_bc = util.generate_bytecode_from_obb(self.iterator, previous)
bc += it_bc
bc +=... | def to_bytes_36(self, previous: bytes):
"""
A to-bytes specific to Python 3.6 and above.
"""
# Calculations ahead.
bc = b""
# Calculate the length of the iterator.
it_bc = util.generate_bytecode_from_obb(self.iterator, previous)
bc += it_bc
bc +=... | [
"A",
"to",
"-",
"bytes",
"specific",
"to",
"Python",
"3",
".",
"6",
"and",
"above",
"."
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/ops/for_.py#L73-L84 | [
"def",
"to_bytes_36",
"(",
"self",
",",
"previous",
":",
"bytes",
")",
":",
"# Calculations ahead.",
"bc",
"=",
"b\"\"",
"# Calculate the length of the iterator.",
"it_bc",
"=",
"util",
".",
"generate_bytecode_from_obb",
"(",
"self",
".",
"iterator",
",",
"previous"... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
valid | validate_content | Runs the correct validator for given `obj`ects. Assumes all same type | litezip/validate.py | def validate_content(*objs):
"""Runs the correct validator for given `obj`ects. Assumes all same type"""
from .main import Collection, Module
validator = {
Collection: cnxml.validate_collxml,
Module: cnxml.validate_cnxml,
}[type(objs[0])]
return validator(*[obj.file for obj in objs]) | def validate_content(*objs):
"""Runs the correct validator for given `obj`ects. Assumes all same type"""
from .main import Collection, Module
validator = {
Collection: cnxml.validate_collxml,
Module: cnxml.validate_cnxml,
}[type(objs[0])]
return validator(*[obj.file for obj in objs]) | [
"Runs",
"the",
"correct",
"validator",
"for",
"given",
"obj",
"ects",
".",
"Assumes",
"all",
"same",
"type"
] | openstax/cnx-litezip | python | https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/validate.py#L26-L33 | [
"def",
"validate_content",
"(",
"*",
"objs",
")",
":",
"from",
".",
"main",
"import",
"Collection",
",",
"Module",
"validator",
"=",
"{",
"Collection",
":",
"cnxml",
".",
"validate_collxml",
",",
"Module",
":",
"cnxml",
".",
"validate_cnxml",
",",
"}",
"["... | 5e613f486f29fe350999d6b990d32847ac16a1b8 |
valid | validate_litezip | Validate the given litezip as `struct`.
Returns a list of validation messages. | litezip/validate.py | def validate_litezip(struct):
"""Validate the given litezip as `struct`.
Returns a list of validation messages.
"""
msgs = []
def _fmt_err(err):
return (Path(err.filename), "{}:{} -- {}: {}".format(*(err[1:])))
obj_by_type = {}
for obj in struct:
if not is_valid_identifier... | def validate_litezip(struct):
"""Validate the given litezip as `struct`.
Returns a list of validation messages.
"""
msgs = []
def _fmt_err(err):
return (Path(err.filename), "{}:{} -- {}: {}".format(*(err[1:])))
obj_by_type = {}
for obj in struct:
if not is_valid_identifier... | [
"Validate",
"the",
"given",
"litezip",
"as",
"struct",
".",
"Returns",
"a",
"list",
"of",
"validation",
"messages",
"."
] | openstax/cnx-litezip | python | https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/validate.py#L36-L61 | [
"def",
"validate_litezip",
"(",
"struct",
")",
":",
"msgs",
"=",
"[",
"]",
"def",
"_fmt_err",
"(",
"err",
")",
":",
"return",
"(",
"Path",
"(",
"err",
".",
"filename",
")",
",",
"\"{}:{} -- {}: {}\"",
".",
"format",
"(",
"*",
"(",
"err",
"[",
"1",
... | 5e613f486f29fe350999d6b990d32847ac16a1b8 |
valid | ensure_instruction | Wraps an instruction to be Python 3.6+ compatible. This does nothing on Python 3.5 and below.
This is most useful for operating on bare, single-width instructions such as
``RETURN_FUNCTION`` in a version portable way.
:param instruction: The instruction integer to use.
:return: A safe bytes object, if... | pyte/util.py | def ensure_instruction(instruction: int) -> bytes:
"""
Wraps an instruction to be Python 3.6+ compatible. This does nothing on Python 3.5 and below.
This is most useful for operating on bare, single-width instructions such as
``RETURN_FUNCTION`` in a version portable way.
:param instruction: The i... | def ensure_instruction(instruction: int) -> bytes:
"""
Wraps an instruction to be Python 3.6+ compatible. This does nothing on Python 3.5 and below.
This is most useful for operating on bare, single-width instructions such as
``RETURN_FUNCTION`` in a version portable way.
:param instruction: The i... | [
"Wraps",
"an",
"instruction",
"to",
"be",
"Python",
"3",
".",
"6",
"+",
"compatible",
".",
"This",
"does",
"nothing",
"on",
"Python",
"3",
".",
"5",
"and",
"below",
"."
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/util.py#L15-L28 | [
"def",
"ensure_instruction",
"(",
"instruction",
":",
"int",
")",
"->",
"bytes",
":",
"if",
"PY36",
":",
"return",
"instruction",
".",
"to_bytes",
"(",
"2",
",",
"byteorder",
"=",
"\"little\"",
")",
"else",
":",
"return",
"instruction",
".",
"to_bytes",
"(... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
valid | pack_value | Small helper value to pack an index value into bytecode.
This is used for version compat between 3.5- and 3.6+
:param index: The item to pack.
:return: The packed item. | pyte/util.py | def pack_value(index: int) -> bytes:
"""
Small helper value to pack an index value into bytecode.
This is used for version compat between 3.5- and 3.6+
:param index: The item to pack.
:return: The packed item.
"""
if PY36:
return index.to_bytes(1, byteorder="little")
else:
... | def pack_value(index: int) -> bytes:
"""
Small helper value to pack an index value into bytecode.
This is used for version compat between 3.5- and 3.6+
:param index: The item to pack.
:return: The packed item.
"""
if PY36:
return index.to_bytes(1, byteorder="little")
else:
... | [
"Small",
"helper",
"value",
"to",
"pack",
"an",
"index",
"value",
"into",
"bytecode",
"."
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/util.py#L31-L43 | [
"def",
"pack_value",
"(",
"index",
":",
"int",
")",
"->",
"bytes",
":",
"if",
"PY36",
":",
"return",
"index",
".",
"to_bytes",
"(",
"1",
",",
"byteorder",
"=",
"\"little\"",
")",
"else",
":",
"return",
"index",
".",
"to_bytes",
"(",
"2",
",",
"byteor... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
valid | generate_simple_call | Generates a simple call, with an index for something.
:param opcode: The opcode to generate.
:param index: The index to use as an argument.
:return: | pyte/util.py | def generate_simple_call(opcode: int, index: int):
"""
Generates a simple call, with an index for something.
:param opcode: The opcode to generate.
:param index: The index to use as an argument.
:return:
"""
bs = b""
# add the opcode
bs += opcode.to_bytes(1, byteorder="little")
... | def generate_simple_call(opcode: int, index: int):
"""
Generates a simple call, with an index for something.
:param opcode: The opcode to generate.
:param index: The index to use as an argument.
:return:
"""
bs = b""
# add the opcode
bs += opcode.to_bytes(1, byteorder="little")
... | [
"Generates",
"a",
"simple",
"call",
"with",
"an",
"index",
"for",
"something",
"."
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/util.py#L46-L65 | [
"def",
"generate_simple_call",
"(",
"opcode",
":",
"int",
",",
"index",
":",
"int",
")",
":",
"bs",
"=",
"b\"\"",
"# add the opcode",
"bs",
"+=",
"opcode",
".",
"to_bytes",
"(",
"1",
",",
"byteorder",
"=",
"\"little\"",
")",
"# Add the index",
"if",
"isins... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
valid | generate_bytecode_from_obb | Generates a bytecode from an object.
:param obb: The object to generate.
:param previous: The previous bytecode to use when generating subobjects.
:return: The generated bytecode. | pyte/util.py | def generate_bytecode_from_obb(obb: object, previous: bytes) -> bytes:
"""
Generates a bytecode from an object.
:param obb: The object to generate.
:param previous: The previous bytecode to use when generating subobjects.
:return: The generated bytecode.
"""
# Generates bytecode from a spec... | def generate_bytecode_from_obb(obb: object, previous: bytes) -> bytes:
"""
Generates a bytecode from an object.
:param obb: The object to generate.
:param previous: The previous bytecode to use when generating subobjects.
:return: The generated bytecode.
"""
# Generates bytecode from a spec... | [
"Generates",
"a",
"bytecode",
"from",
"an",
"object",
"."
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/util.py#L68-L90 | [
"def",
"generate_bytecode_from_obb",
"(",
"obb",
":",
"object",
",",
"previous",
":",
"bytes",
")",
"->",
"bytes",
":",
"# Generates bytecode from a specified object, be it a validator or an int or bytes even.",
"if",
"isinstance",
"(",
"obb",
",",
"pyte",
".",
"superclas... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
valid | _get_const_info | Helper to get optional details about const references
Returns the dereferenced constant and its repr if the constant
list is defined.
Otherwise returns the constant index and its repr(). | pyte/util.py | def _get_const_info(const_index, const_list):
"""
Helper to get optional details about const references
Returns the dereferenced constant and its repr if the constant
list is defined.
Otherwise returns the constant index and its repr().
"""
argval = const_index
if const_list is... | def _get_const_info(const_index, const_list):
"""
Helper to get optional details about const references
Returns the dereferenced constant and its repr if the constant
list is defined.
Otherwise returns the constant index and its repr().
"""
argval = const_index
if const_list is... | [
"Helper",
"to",
"get",
"optional",
"details",
"about",
"const",
"references"
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/util.py#L136-L150 | [
"def",
"_get_const_info",
"(",
"const_index",
",",
"const_list",
")",
":",
"argval",
"=",
"const_index",
"if",
"const_list",
"is",
"not",
"None",
":",
"try",
":",
"argval",
"=",
"const_list",
"[",
"const_index",
"]",
"except",
"IndexError",
":",
"raise",
"Va... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
valid | _get_name_info | Helper to get optional details about named references
Returns the dereferenced name as both value and repr if the name
list is defined.
Otherwise returns the name index and its repr(). | pyte/util.py | def _get_name_info(name_index, name_list):
"""Helper to get optional details about named references
Returns the dereferenced name as both value and repr if the name
list is defined.
Otherwise returns the name index and its repr().
"""
argval = name_index
if name_list is not None:
... | def _get_name_info(name_index, name_list):
"""Helper to get optional details about named references
Returns the dereferenced name as both value and repr if the name
list is defined.
Otherwise returns the name index and its repr().
"""
argval = name_index
if name_list is not None:
... | [
"Helper",
"to",
"get",
"optional",
"details",
"about",
"named",
"references"
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/util.py#L153-L169 | [
"def",
"_get_name_info",
"(",
"name_index",
",",
"name_list",
")",
":",
"argval",
"=",
"name_index",
"if",
"name_list",
"is",
"not",
"None",
":",
"try",
":",
"argval",
"=",
"name_list",
"[",
"name_index",
"]",
"except",
"IndexError",
":",
"raise",
"Validatio... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
valid | add_to_parser | Add arguments described in the usage string to the
parser. View more details at the <create_parser> docs
Args:
parser (ArgumentParser): parser to add arguments to
usage (str): Usage string in the format described above
ignore_existing (bool): Ignore any arguments that have already been ... | prettyparse/prettyparse.py | def add_to_parser(parser, usage, ignore_existing=False):
"""
Add arguments described in the usage string to the
parser. View more details at the <create_parser> docs
Args:
parser (ArgumentParser): parser to add arguments to
usage (str): Usage string in the format described above
... | def add_to_parser(parser, usage, ignore_existing=False):
"""
Add arguments described in the usage string to the
parser. View more details at the <create_parser> docs
Args:
parser (ArgumentParser): parser to add arguments to
usage (str): Usage string in the format described above
... | [
"Add",
"arguments",
"described",
"in",
"the",
"usage",
"string",
"to",
"the",
"parser",
".",
"View",
"more",
"details",
"at",
"the",
"<create_parser",
">",
"docs"
] | MatthewScholefield/prettyparse | python | https://github.com/MatthewScholefield/prettyparse/blob/18c57d71b58afd2d8d9dc605ade8f3ca6e66895d/prettyparse/prettyparse.py#L36-L82 | [
"def",
"add_to_parser",
"(",
"parser",
",",
"usage",
",",
"ignore_existing",
"=",
"False",
")",
":",
"usage",
"=",
"'\\n'",
"+",
"usage",
"first_line",
"=",
"[",
"i",
"for",
"i",
"in",
"usage",
".",
"split",
"(",
"'\\n'",
")",
"if",
"i",
"]",
"[",
... | 18c57d71b58afd2d8d9dc605ade8f3ca6e66895d |
valid | compile_bytecode | Compiles Pyte objects into a bytecode list.
:param code: A list of objects to compile.
:return: The computed bytecode. | pyte/compiler.py | def compile_bytecode(code: list) -> bytes:
"""
Compiles Pyte objects into a bytecode list.
:param code: A list of objects to compile.
:return: The computed bytecode.
"""
bc = b""
for i, op in enumerate(code):
try:
# Get the bytecode.
if isinstance(op, _PyteOp... | def compile_bytecode(code: list) -> bytes:
"""
Compiles Pyte objects into a bytecode list.
:param code: A list of objects to compile.
:return: The computed bytecode.
"""
bc = b""
for i, op in enumerate(code):
try:
# Get the bytecode.
if isinstance(op, _PyteOp... | [
"Compiles",
"Pyte",
"objects",
"into",
"a",
"bytecode",
"list",
"."
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/compiler.py#L19-L43 | [
"def",
"compile_bytecode",
"(",
"code",
":",
"list",
")",
"->",
"bytes",
":",
"bc",
"=",
"b\"\"",
"for",
"i",
",",
"op",
"in",
"enumerate",
"(",
"code",
")",
":",
"try",
":",
"# Get the bytecode.",
"if",
"isinstance",
"(",
"op",
",",
"_PyteOp",
")",
... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
valid | _simulate_stack | Simulates the actions of the stack, to check safety.
This returns the maximum needed stack. | pyte/compiler.py | def _simulate_stack(code: list) -> int:
"""
Simulates the actions of the stack, to check safety.
This returns the maximum needed stack.
"""
max_stack = 0
curr_stack = 0
def _check_stack(ins):
if curr_stack < 0:
raise CompileError("Stack turned negative on instruction: ... | def _simulate_stack(code: list) -> int:
"""
Simulates the actions of the stack, to check safety.
This returns the maximum needed stack.
"""
max_stack = 0
curr_stack = 0
def _check_stack(ins):
if curr_stack < 0:
raise CompileError("Stack turned negative on instruction: ... | [
"Simulates",
"the",
"actions",
"of",
"the",
"stack",
"to",
"check",
"safety",
"."
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/compiler.py#L47-L84 | [
"def",
"_simulate_stack",
"(",
"code",
":",
"list",
")",
"->",
"int",
":",
"max_stack",
"=",
"0",
"curr_stack",
"=",
"0",
"def",
"_check_stack",
"(",
"ins",
")",
":",
"if",
"curr_stack",
"<",
"0",
":",
"raise",
"CompileError",
"(",
"\"Stack turned negative... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
valid | compile | Compiles a set of bytecode instructions into a working function, using Python's bytecode
compiler.
:param code: A list of bytecode instructions.
:param consts: A list of constants to compile into the function.
:param names: A list of names to compile into the function.
:param varnames: A list of ``... | pyte/compiler.py | def compile(code: list, consts: list, names: list, varnames: list,
func_name: str = "<unknown, compiled>",
arg_count: int = 0, kwarg_defaults: Tuple[Any] = (), use_safety_wrapper: bool = True):
"""
Compiles a set of bytecode instructions into a working function, using Python's bytecode
... | def compile(code: list, consts: list, names: list, varnames: list,
func_name: str = "<unknown, compiled>",
arg_count: int = 0, kwarg_defaults: Tuple[Any] = (), use_safety_wrapper: bool = True):
"""
Compiles a set of bytecode instructions into a working function, using Python's bytecode
... | [
"Compiles",
"a",
"set",
"of",
"bytecode",
"instructions",
"into",
"a",
"working",
"function",
"using",
"Python",
"s",
"bytecode",
"compiler",
"."
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/compiler.py#L101-L213 | [
"def",
"compile",
"(",
"code",
":",
"list",
",",
"consts",
":",
"list",
",",
"names",
":",
"list",
",",
"varnames",
":",
"list",
",",
"func_name",
":",
"str",
"=",
"\"<unknown, compiled>\"",
",",
"arg_count",
":",
"int",
"=",
"0",
",",
"kwarg_defaults",
... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
valid | _parse_document_id | Given the parsed xml to an `ElementTree`,
parse the id from the content. | litezip/main.py | def _parse_document_id(elm_tree):
"""Given the parsed xml to an `ElementTree`,
parse the id from the content.
"""
xpath = '//md:content-id/text()'
return [x for x in elm_tree.xpath(xpath, namespaces=COLLECTION_NSMAP)][0] | def _parse_document_id(elm_tree):
"""Given the parsed xml to an `ElementTree`,
parse the id from the content.
"""
xpath = '//md:content-id/text()'
return [x for x in elm_tree.xpath(xpath, namespaces=COLLECTION_NSMAP)][0] | [
"Given",
"the",
"parsed",
"xml",
"to",
"an",
"ElementTree",
"parse",
"the",
"id",
"from",
"the",
"content",
"."
] | openstax/cnx-litezip | python | https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/main.py#L62-L68 | [
"def",
"_parse_document_id",
"(",
"elm_tree",
")",
":",
"xpath",
"=",
"'//md:content-id/text()'",
"return",
"[",
"x",
"for",
"x",
"in",
"elm_tree",
".",
"xpath",
"(",
"xpath",
",",
"namespaces",
"=",
"COLLECTION_NSMAP",
")",
"]",
"[",
"0",
"]"
] | 5e613f486f29fe350999d6b990d32847ac16a1b8 |
valid | _find_resources | Return a list of resource paths from the directory.
Ignore records via the list of `excludes`,
which are callables that take a file parameter (as a `Path` instance). | litezip/main.py | def _find_resources(directory, excludes=[]):
"""Return a list of resource paths from the directory.
Ignore records via the list of `excludes`,
which are callables that take a file parameter (as a `Path` instance).
"""
return sorted([r for r in directory.glob('*')
if True not in [... | def _find_resources(directory, excludes=[]):
"""Return a list of resource paths from the directory.
Ignore records via the list of `excludes`,
which are callables that take a file parameter (as a `Path` instance).
"""
return sorted([r for r in directory.glob('*')
if True not in [... | [
"Return",
"a",
"list",
"of",
"resource",
"paths",
"from",
"the",
"directory",
".",
"Ignore",
"records",
"via",
"the",
"list",
"of",
"excludes",
"which",
"are",
"callables",
"that",
"take",
"a",
"file",
"parameter",
"(",
"as",
"a",
"Path",
"instance",
")",
... | openstax/cnx-litezip | python | https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/main.py#L71-L78 | [
"def",
"_find_resources",
"(",
"directory",
",",
"excludes",
"=",
"[",
"]",
")",
":",
"return",
"sorted",
"(",
"[",
"r",
"for",
"r",
"in",
"directory",
".",
"glob",
"(",
"'*'",
")",
"if",
"True",
"not",
"in",
"[",
"e",
"(",
"r",
")",
"for",
"e",
... | 5e613f486f29fe350999d6b990d32847ac16a1b8 |
valid | parse_module | Parse the file structure to a data structure given the path to
a module directory. | litezip/main.py | def parse_module(path, excludes=None):
"""Parse the file structure to a data structure given the path to
a module directory.
"""
file = path / MODULE_FILENAME
if not file.exists():
raise MissingFile(file)
id = _parse_document_id(etree.parse(file.open()))
excludes = excludes or []
... | def parse_module(path, excludes=None):
"""Parse the file structure to a data structure given the path to
a module directory.
"""
file = path / MODULE_FILENAME
if not file.exists():
raise MissingFile(file)
id = _parse_document_id(etree.parse(file.open()))
excludes = excludes or []
... | [
"Parse",
"the",
"file",
"structure",
"to",
"a",
"data",
"structure",
"given",
"the",
"path",
"to",
"a",
"module",
"directory",
"."
] | openstax/cnx-litezip | python | https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/main.py#L94-L113 | [
"def",
"parse_module",
"(",
"path",
",",
"excludes",
"=",
"None",
")",
":",
"file",
"=",
"path",
"/",
"MODULE_FILENAME",
"if",
"not",
"file",
".",
"exists",
"(",
")",
":",
"raise",
"MissingFile",
"(",
"file",
")",
"id",
"=",
"_parse_document_id",
"(",
... | 5e613f486f29fe350999d6b990d32847ac16a1b8 |
valid | parse_collection | Parse a file structure to a data structure given the path to
a collection directory. | litezip/main.py | def parse_collection(path, excludes=None):
"""Parse a file structure to a data structure given the path to
a collection directory.
"""
file = path / COLLECTION_FILENAME
if not file.exists():
raise MissingFile(file)
id = _parse_document_id(etree.parse(file.open()))
excludes = exclud... | def parse_collection(path, excludes=None):
"""Parse a file structure to a data structure given the path to
a collection directory.
"""
file = path / COLLECTION_FILENAME
if not file.exists():
raise MissingFile(file)
id = _parse_document_id(etree.parse(file.open()))
excludes = exclud... | [
"Parse",
"a",
"file",
"structure",
"to",
"a",
"data",
"structure",
"given",
"the",
"path",
"to",
"a",
"collection",
"directory",
"."
] | openstax/cnx-litezip | python | https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/main.py#L116-L134 | [
"def",
"parse_collection",
"(",
"path",
",",
"excludes",
"=",
"None",
")",
":",
"file",
"=",
"path",
"/",
"COLLECTION_FILENAME",
"if",
"not",
"file",
".",
"exists",
"(",
")",
":",
"raise",
"MissingFile",
"(",
"file",
")",
"id",
"=",
"_parse_document_id",
... | 5e613f486f29fe350999d6b990d32847ac16a1b8 |
valid | parse_litezip | Parse a litezip file structure to a data structure given the path
to the litezip directory. | litezip/main.py | def parse_litezip(path):
"""Parse a litezip file structure to a data structure given the path
to the litezip directory.
"""
struct = [parse_collection(path)]
struct.extend([parse_module(x) for x in path.iterdir()
if x.is_dir() and x.name.startswith('m')])
return tuple(sorted(... | def parse_litezip(path):
"""Parse a litezip file structure to a data structure given the path
to the litezip directory.
"""
struct = [parse_collection(path)]
struct.extend([parse_module(x) for x in path.iterdir()
if x.is_dir() and x.name.startswith('m')])
return tuple(sorted(... | [
"Parse",
"a",
"litezip",
"file",
"structure",
"to",
"a",
"data",
"structure",
"given",
"the",
"path",
"to",
"the",
"litezip",
"directory",
"."
] | openstax/cnx-litezip | python | https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/main.py#L137-L145 | [
"def",
"parse_litezip",
"(",
"path",
")",
":",
"struct",
"=",
"[",
"parse_collection",
"(",
"path",
")",
"]",
"struct",
".",
"extend",
"(",
"[",
"parse_module",
"(",
"x",
")",
"for",
"x",
"in",
"path",
".",
"iterdir",
"(",
")",
"if",
"x",
".",
"is_... | 5e613f486f29fe350999d6b990d32847ac16a1b8 |
valid | convert_completezip | Converts a completezip file structure to a litezip file structure.
Returns a litezip data structure. | litezip/completezip.py | def convert_completezip(path):
"""Converts a completezip file structure to a litezip file structure.
Returns a litezip data structure.
"""
for filepath in path.glob('**/index_auto_generated.cnxml'):
filepath.rename(filepath.parent / 'index.cnxml')
logger.debug('removed {}'.format(filepa... | def convert_completezip(path):
"""Converts a completezip file structure to a litezip file structure.
Returns a litezip data structure.
"""
for filepath in path.glob('**/index_auto_generated.cnxml'):
filepath.rename(filepath.parent / 'index.cnxml')
logger.debug('removed {}'.format(filepa... | [
"Converts",
"a",
"completezip",
"file",
"structure",
"to",
"a",
"litezip",
"file",
"structure",
".",
"Returns",
"a",
"litezip",
"data",
"structure",
"."
] | openstax/cnx-litezip | python | https://github.com/openstax/cnx-litezip/blob/5e613f486f29fe350999d6b990d32847ac16a1b8/litezip/completezip.py#L11-L21 | [
"def",
"convert_completezip",
"(",
"path",
")",
":",
"for",
"filepath",
"in",
"path",
".",
"glob",
"(",
"'**/index_auto_generated.cnxml'",
")",
":",
"filepath",
".",
"rename",
"(",
"filepath",
".",
"parent",
"/",
"'index.cnxml'",
")",
"logger",
".",
"debug",
... | 5e613f486f29fe350999d6b990d32847ac16a1b8 |
valid | _get_instructions_bytes | Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional information about the code's runtime environment
(e.g. variable names, constants) can be specified using optional
arguments. | pyte/backports.py | def _get_instructions_bytes(code, varnames=None, names=None, constants=None,
cells=None, linestarts=None, line_offset=0):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional informa... | def _get_instructions_bytes(code, varnames=None, names=None, constants=None,
cells=None, linestarts=None, line_offset=0):
"""Iterate over the instructions in a bytecode string.
Generates a sequence of Instruction namedtuples giving the details of each
opcode. Additional informa... | [
"Iterate",
"over",
"the",
"instructions",
"in",
"a",
"bytecode",
"string",
"."
] | Fuyukai/Pyte | python | https://github.com/Fuyukai/Pyte/blob/7ef04938d80f8b646bd73d976ac9787a5b88edd9/pyte/backports.py#L64-L123 | [
"def",
"_get_instructions_bytes",
"(",
"code",
",",
"varnames",
"=",
"None",
",",
"names",
"=",
"None",
",",
"constants",
"=",
"None",
",",
"cells",
"=",
"None",
",",
"linestarts",
"=",
"None",
",",
"line_offset",
"=",
"0",
")",
":",
"labels",
"=",
"di... | 7ef04938d80f8b646bd73d976ac9787a5b88edd9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.