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 | BiColorDisplayController.set_brightness | Set the brightness level for the entire display
@param brightness: brightness level (0 -15) | examples/i2c/pymata_i2c_write/bicolor_display_controller.py | def set_brightness(self, brightness):
"""
Set the brightness level for the entire display
@param brightness: brightness level (0 -15)
"""
if brightness > 15:
brightness = 15
brightness |= 0xE0
self.brightness = brightness
self.firmata.i2c_write... | def set_brightness(self, brightness):
"""
Set the brightness level for the entire display
@param brightness: brightness level (0 -15)
"""
if brightness > 15:
brightness = 15
brightness |= 0xE0
self.brightness = brightness
self.firmata.i2c_write... | [
"Set",
"the",
"brightness",
"level",
"for",
"the",
"entire",
"display"
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/examples/i2c/pymata_i2c_write/bicolor_display_controller.py#L113-L122 | [
"def",
"set_brightness",
"(",
"self",
",",
"brightness",
")",
":",
"if",
"brightness",
">",
"15",
":",
"brightness",
"=",
"15",
"brightness",
"|=",
"0xE0",
"self",
".",
"brightness",
"=",
"brightness",
"self",
".",
"firmata",
".",
"i2c_write",
"(",
"0x70",... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | BiColorDisplayController.set_bit_map | Populate the bit map with the supplied "shape" and color
and then write the entire bitmap to the display
@param shape: pattern to display
@param color: color for the pattern | examples/i2c/pymata_i2c_write/bicolor_display_controller.py | def set_bit_map(self, shape, color):
"""
Populate the bit map with the supplied "shape" and color
and then write the entire bitmap to the display
@param shape: pattern to display
@param color: color for the pattern
"""
for row in range(0, 8):
data = sh... | def set_bit_map(self, shape, color):
"""
Populate the bit map with the supplied "shape" and color
and then write the entire bitmap to the display
@param shape: pattern to display
@param color: color for the pattern
"""
for row in range(0, 8):
data = sh... | [
"Populate",
"the",
"bit",
"map",
"with",
"the",
"supplied",
"shape",
"and",
"color",
"and",
"then",
"write",
"the",
"entire",
"bitmap",
"to",
"the",
"display"
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/examples/i2c/pymata_i2c_write/bicolor_display_controller.py#L170-L185 | [
"def",
"set_bit_map",
"(",
"self",
",",
"shape",
",",
"color",
")",
":",
"for",
"row",
"in",
"range",
"(",
"0",
",",
"8",
")",
":",
"data",
"=",
"shape",
"[",
"row",
"]",
"# shift data into buffer",
"bit_mask",
"=",
"0x80",
"for",
"column",
"in",
"ra... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | BiColorDisplayController.output_entire_buffer | Write the entire buffer to the display | examples/i2c/pymata_i2c_write/bicolor_display_controller.py | def output_entire_buffer(self):
"""
Write the entire buffer to the display
"""
green = 0
red = 0
for row in range(0, 8):
for col in range(0, 8):
if self.display_buffer[row][col] == self.LED_GREEN:
green |= 1 << col
... | def output_entire_buffer(self):
"""
Write the entire buffer to the display
"""
green = 0
red = 0
for row in range(0, 8):
for col in range(0, 8):
if self.display_buffer[row][col] == self.LED_GREEN:
green |= 1 << col
... | [
"Write",
"the",
"entire",
"buffer",
"to",
"the",
"display"
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/examples/i2c/pymata_i2c_write/bicolor_display_controller.py#L187-L208 | [
"def",
"output_entire_buffer",
"(",
"self",
")",
":",
"green",
"=",
"0",
"red",
"=",
"0",
"for",
"row",
"in",
"range",
"(",
"0",
",",
"8",
")",
":",
"for",
"col",
"in",
"range",
"(",
"0",
",",
"8",
")",
":",
"if",
"self",
".",
"display_buffer",
... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | BiColorDisplayController.clear_display_buffer | Set all led's to off. | examples/i2c/pymata_i2c_write/bicolor_display_controller.py | def clear_display_buffer(self):
"""
Set all led's to off.
"""
for row in range(0, 8):
self.firmata.i2c_write(0x70, row * 2, 0, 0)
self.firmata.i2c_write(0x70, (row * 2) + 1, 0, 0)
for column in range(0, 8):
self.display_buffer[row][col... | def clear_display_buffer(self):
"""
Set all led's to off.
"""
for row in range(0, 8):
self.firmata.i2c_write(0x70, row * 2, 0, 0)
self.firmata.i2c_write(0x70, (row * 2) + 1, 0, 0)
for column in range(0, 8):
self.display_buffer[row][col... | [
"Set",
"all",
"led",
"s",
"to",
"off",
"."
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/examples/i2c/pymata_i2c_write/bicolor_display_controller.py#L210-L219 | [
"def",
"clear_display_buffer",
"(",
"self",
")",
":",
"for",
"row",
"in",
"range",
"(",
"0",
",",
"8",
")",
":",
"self",
".",
"firmata",
".",
"i2c_write",
"(",
"0x70",
",",
"row",
"*",
"2",
",",
"0",
",",
"0",
")",
"self",
".",
"firmata",
".",
... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.auto_discover_board | This method will allow up to 30 seconds for discovery (communicating with) an Arduino board
and then will determine a pin configuration table for the board.
:return: True if board is successfully discovered or False upon timeout | PyMata/pymata_command_handler.py | def auto_discover_board(self, verbose):
"""
This method will allow up to 30 seconds for discovery (communicating with) an Arduino board
and then will determine a pin configuration table for the board.
:return: True if board is successfully discovered or False upon timeout
"""
... | def auto_discover_board(self, verbose):
"""
This method will allow up to 30 seconds for discovery (communicating with) an Arduino board
and then will determine a pin configuration table for the board.
:return: True if board is successfully discovered or False upon timeout
"""
... | [
"This",
"method",
"will",
"allow",
"up",
"to",
"30",
"seconds",
"for",
"discovery",
"(",
"communicating",
"with",
")",
"an",
"Arduino",
"board",
"and",
"then",
"will",
"determine",
"a",
"pin",
"configuration",
"table",
"for",
"the",
"board",
".",
":",
"ret... | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L220-L270 | [
"def",
"auto_discover_board",
"(",
"self",
",",
"verbose",
")",
":",
"# get current time",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"# wait for up to 30 seconds for a successful capability query to occur",
"while",
"len",
"(",
"self",
".",
"analog_mapping_query_r... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.report_version | This method processes the report version message, sent asynchronously by Firmata when it starts up
or after refresh_report_version() is called
Use the api method api_get_version to retrieve this information
:param data: Message data from Firmata
:return: No return val... | PyMata/pymata_command_handler.py | def report_version(self, data):
"""
This method processes the report version message, sent asynchronously by Firmata when it starts up
or after refresh_report_version() is called
Use the api method api_get_version to retrieve this information
:param data: Message data ... | def report_version(self, data):
"""
This method processes the report version message, sent asynchronously by Firmata when it starts up
or after refresh_report_version() is called
Use the api method api_get_version to retrieve this information
:param data: Message data ... | [
"This",
"method",
"processes",
"the",
"report",
"version",
"message",
"sent",
"asynchronously",
"by",
"Firmata",
"when",
"it",
"starts",
"up",
"or",
"after",
"refresh_report_version",
"()",
"is",
"called"
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L272-L284 | [
"def",
"report_version",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"firmata_version",
".",
"append",
"(",
"data",
"[",
"0",
"]",
")",
"# add major",
"self",
".",
"firmata_version",
".",
"append",
"(",
"data",
"[",
"1",
"]",
")"
] | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.set_analog_latch | This method "arms" a pin to allow data latching for the pin.
:param pin: Analog pin number (value following an 'A' designator, i.e. A5 = 5
:param threshold_type: ANALOG_LATCH_GT | ANALOG_LATCH_LT | ANALOG_LATCH_GTE | ANALOG_LATCH_LTE
:param threshold_value: numerical value
:param cb... | PyMata/pymata_command_handler.py | def set_analog_latch(self, pin, threshold_type, threshold_value, cb):
"""
This method "arms" a pin to allow data latching for the pin.
:param pin: Analog pin number (value following an 'A' designator, i.e. A5 = 5
:param threshold_type: ANALOG_LATCH_GT | ANALOG_LATCH_LT | ANALOG_LATCH_... | def set_analog_latch(self, pin, threshold_type, threshold_value, cb):
"""
This method "arms" a pin to allow data latching for the pin.
:param pin: Analog pin number (value following an 'A' designator, i.e. A5 = 5
:param threshold_type: ANALOG_LATCH_GT | ANALOG_LATCH_LT | ANALOG_LATCH_... | [
"This",
"method",
"arms",
"a",
"pin",
"to",
"allow",
"data",
"latching",
"for",
"the",
"pin",
"."
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L286-L299 | [
"def",
"set_analog_latch",
"(",
"self",
",",
"pin",
",",
"threshold_type",
",",
"threshold_value",
",",
"cb",
")",
":",
"with",
"self",
".",
"pymata",
".",
"data_lock",
":",
"self",
".",
"analog_latch_table",
"[",
"pin",
"]",
"=",
"[",
"self",
".",
"LATC... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.set_digital_latch | This method "arms" a pin to allow data latching for the pin.
:param pin: digital pin number
:param threshold_type: DIGITAL_LATCH_HIGH | DIGITAL_LATCH_LOW
:param cb: User provided callback function | PyMata/pymata_command_handler.py | def set_digital_latch(self, pin, threshold_type, cb):
"""
This method "arms" a pin to allow data latching for the pin.
:param pin: digital pin number
:param threshold_type: DIGITAL_LATCH_HIGH | DIGITAL_LATCH_LOW
:param cb: User provided callback function
"""
wi... | def set_digital_latch(self, pin, threshold_type, cb):
"""
This method "arms" a pin to allow data latching for the pin.
:param pin: digital pin number
:param threshold_type: DIGITAL_LATCH_HIGH | DIGITAL_LATCH_LOW
:param cb: User provided callback function
"""
wi... | [
"This",
"method",
"arms",
"a",
"pin",
"to",
"allow",
"data",
"latching",
"for",
"the",
"pin",
"."
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L301-L312 | [
"def",
"set_digital_latch",
"(",
"self",
",",
"pin",
",",
"threshold_type",
",",
"cb",
")",
":",
"with",
"self",
".",
"pymata",
".",
"data_lock",
":",
"self",
".",
"digital_latch_table",
"[",
"pin",
"]",
"=",
"[",
"self",
".",
"LATCH_ARMED",
",",
"thresh... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.get_analog_latch_data | This method reads the analog latch table for the specified pin and returns a list that contains:
[latch_state, latched_data, and time_stamp].
If the latch state is latched, the entry in the table is cleared
:param pin: pin number
:return: [latch_state, latched_data, and time_stamp] | PyMata/pymata_command_handler.py | def get_analog_latch_data(self, pin):
"""
This method reads the analog latch table for the specified pin and returns a list that contains:
[latch_state, latched_data, and time_stamp].
If the latch state is latched, the entry in the table is cleared
:param pin: pin number
... | def get_analog_latch_data(self, pin):
"""
This method reads the analog latch table for the specified pin and returns a list that contains:
[latch_state, latched_data, and time_stamp].
If the latch state is latched, the entry in the table is cleared
:param pin: pin number
... | [
"This",
"method",
"reads",
"the",
"analog",
"latch",
"table",
"for",
"the",
"specified",
"pin",
"and",
"returns",
"a",
"list",
"that",
"contains",
":",
"[",
"latch_state",
"latched_data",
"and",
"time_stamp",
"]",
".",
"If",
"the",
"latch",
"state",
"is",
... | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L314-L334 | [
"def",
"get_analog_latch_data",
"(",
"self",
",",
"pin",
")",
":",
"with",
"self",
".",
"pymata",
".",
"data_lock",
":",
"pin_data",
"=",
"self",
".",
"analog_latch_table",
"[",
"pin",
"]",
"current_latch_data",
"=",
"[",
"pin",
",",
"pin_data",
"[",
"self... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.get_digital_latch_data | This method reads the digital latch table for the specified pin and returns a list that contains:
[latch_state, latched_data, and time_stamp].
If the latch state is latched, the entry in the table is cleared
:param pin: pin number
:return: [latch_state, latched_data, and time_stamp] | PyMata/pymata_command_handler.py | def get_digital_latch_data(self, pin):
"""
This method reads the digital latch table for the specified pin and returns a list that contains:
[latch_state, latched_data, and time_stamp].
If the latch state is latched, the entry in the table is cleared
:param pin: pin number
... | def get_digital_latch_data(self, pin):
"""
This method reads the digital latch table for the specified pin and returns a list that contains:
[latch_state, latched_data, and time_stamp].
If the latch state is latched, the entry in the table is cleared
:param pin: pin number
... | [
"This",
"method",
"reads",
"the",
"digital",
"latch",
"table",
"for",
"the",
"specified",
"pin",
"and",
"returns",
"a",
"list",
"that",
"contains",
":",
"[",
"latch_state",
"latched_data",
"and",
"time_stamp",
"]",
".",
"If",
"the",
"latch",
"state",
"is",
... | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L336-L355 | [
"def",
"get_digital_latch_data",
"(",
"self",
",",
"pin",
")",
":",
"with",
"self",
".",
"pymata",
".",
"data_lock",
":",
"pin_data",
"=",
"self",
".",
"digital_latch_table",
"[",
"pin",
"]",
"current_latch_data",
"=",
"[",
"pin",
",",
"pin_data",
"[",
"se... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.report_firmware | This method processes the report firmware message, sent asynchronously by Firmata when it starts up
or after refresh_report_firmware() is called
Use the api method api_get_firmware_version to retrieve this information
:param data: Message data from Firmata
:return: No return ... | PyMata/pymata_command_handler.py | def report_firmware(self, data):
"""
This method processes the report firmware message, sent asynchronously by Firmata when it starts up
or after refresh_report_firmware() is called
Use the api method api_get_firmware_version to retrieve this information
:param data: M... | def report_firmware(self, data):
"""
This method processes the report firmware message, sent asynchronously by Firmata when it starts up
or after refresh_report_firmware() is called
Use the api method api_get_firmware_version to retrieve this information
:param data: M... | [
"This",
"method",
"processes",
"the",
"report",
"firmware",
"message",
"sent",
"asynchronously",
"by",
"Firmata",
"when",
"it",
"starts",
"up",
"or",
"after",
"refresh_report_firmware",
"()",
"is",
"called",
"Use",
"the",
"api",
"method",
"api_get_firmware_version",... | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L357-L384 | [
"def",
"report_firmware",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"firmata_firmware",
".",
"append",
"(",
"data",
"[",
"0",
"]",
")",
"# add major",
"self",
".",
"firmata_firmware",
".",
"append",
"(",
"data",
"[",
"1",
"]",
")",
"# add minor",
... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.analog_message | This method handles the incoming analog data message.
It stores the data value for the pin in the analog response table.
If a callback function was associated with this pin, the callback function is invoked.
This method also checks to see if latching was requested for the pin. If the latch crite... | PyMata/pymata_command_handler.py | def analog_message(self, data):
"""
This method handles the incoming analog data message.
It stores the data value for the pin in the analog response table.
If a callback function was associated with this pin, the callback function is invoked.
This method also checks to see if la... | def analog_message(self, data):
"""
This method handles the incoming analog data message.
It stores the data value for the pin in the analog response table.
If a callback function was associated with this pin, the callback function is invoked.
This method also checks to see if la... | [
"This",
"method",
"handles",
"the",
"incoming",
"analog",
"data",
"message",
".",
"It",
"stores",
"the",
"data",
"value",
"for",
"the",
"pin",
"in",
"the",
"analog",
"response",
"table",
".",
"If",
"a",
"callback",
"function",
"was",
"associated",
"with",
... | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L386-L482 | [
"def",
"analog_message",
"(",
"self",
",",
"data",
")",
":",
"with",
"self",
".",
"pymata",
".",
"data_lock",
":",
"# hold on to the previous value",
"previous_value",
"=",
"self",
".",
"analog_response_table",
"[",
"data",
"[",
"self",
".",
"RESPONSE_TABLE_MODE",... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.digital_message | This method handles the incoming digital message.
It stores the data values in the digital response table.
Data is stored for all 8 bits of a digital port
:param data: Message data from Firmata
:return: No return value. | PyMata/pymata_command_handler.py | def digital_message(self, data):
"""
This method handles the incoming digital message.
It stores the data values in the digital response table.
Data is stored for all 8 bits of a digital port
:param data: Message data from Firmata
:return: No return value.
"""
... | def digital_message(self, data):
"""
This method handles the incoming digital message.
It stores the data values in the digital response table.
Data is stored for all 8 bits of a digital port
:param data: Message data from Firmata
:return: No return value.
"""
... | [
"This",
"method",
"handles",
"the",
"incoming",
"digital",
"message",
".",
"It",
"stores",
"the",
"data",
"values",
"in",
"the",
"digital",
"response",
"table",
".",
"Data",
"is",
"stored",
"for",
"all",
"8",
"bits",
"of",
"a",
"digital",
"port"
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L484-L552 | [
"def",
"digital_message",
"(",
"self",
",",
"data",
")",
":",
"port",
"=",
"data",
"[",
"0",
"]",
"port_data",
"=",
"(",
"data",
"[",
"self",
".",
"MSB",
"]",
"<<",
"7",
")",
"+",
"data",
"[",
"self",
".",
"LSB",
"]",
"# set all the pins for this rep... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.encoder_data | This method handles the incoming encoder data message and stores
the data in the digital response table.
:param data: Message data from Firmata
:return: No return value. | PyMata/pymata_command_handler.py | def encoder_data(self, data):
"""
This method handles the incoming encoder data message and stores
the data in the digital response table.
:param data: Message data from Firmata
:return: No return value.
"""
prev_val = self.digital_response_table[data[self.RESPO... | def encoder_data(self, data):
"""
This method handles the incoming encoder data message and stores
the data in the digital response table.
:param data: Message data from Firmata
:return: No return value.
"""
prev_val = self.digital_response_table[data[self.RESPO... | [
"This",
"method",
"handles",
"the",
"incoming",
"encoder",
"data",
"message",
"and",
"stores",
"the",
"data",
"in",
"the",
"digital",
"response",
"table",
"."
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L554-L575 | [
"def",
"encoder_data",
"(",
"self",
",",
"data",
")",
":",
"prev_val",
"=",
"self",
".",
"digital_response_table",
"[",
"data",
"[",
"self",
".",
"RESPONSE_TABLE_MODE",
"]",
"]",
"[",
"self",
".",
"RESPONSE_TABLE_PIN_DATA_VALUE",
"]",
"val",
"=",
"int",
"(",... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.sonar_data | This method handles the incoming sonar data message and stores
the data in the response table.
:param data: Message data from Firmata
:return: No return value. | PyMata/pymata_command_handler.py | def sonar_data(self, data):
"""
This method handles the incoming sonar data message and stores
the data in the response table.
:param data: Message data from Firmata
:return: No return value.
"""
val = int((data[self.MSB] << 7) + data[self.LSB])
pin_numb... | def sonar_data(self, data):
"""
This method handles the incoming sonar data message and stores
the data in the response table.
:param data: Message data from Firmata
:return: No return value.
"""
val = int((data[self.MSB] << 7) + data[self.LSB])
pin_numb... | [
"This",
"method",
"handles",
"the",
"incoming",
"sonar",
"data",
"message",
"and",
"stores",
"the",
"data",
"in",
"the",
"response",
"table",
"."
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L577-L599 | [
"def",
"sonar_data",
"(",
"self",
",",
"data",
")",
":",
"val",
"=",
"int",
"(",
"(",
"data",
"[",
"self",
".",
"MSB",
"]",
"<<",
"7",
")",
"+",
"data",
"[",
"self",
".",
"LSB",
"]",
")",
"pin_number",
"=",
"data",
"[",
"0",
"]",
"with",
"sel... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.send_sysex | This method will send a Sysex command to Firmata with any accompanying data
:param sysex_command: sysex command
:param sysex_data: data for command
:return : No return value. | PyMata/pymata_command_handler.py | def send_sysex(self, sysex_command, sysex_data=None):
"""
This method will send a Sysex command to Firmata with any accompanying data
:param sysex_command: sysex command
:param sysex_data: data for command
:return : No return value.
"""
if not sysex_data:
... | def send_sysex(self, sysex_command, sysex_data=None):
"""
This method will send a Sysex command to Firmata with any accompanying data
:param sysex_command: sysex command
:param sysex_data: data for command
:return : No return value.
"""
if not sysex_data:
... | [
"This",
"method",
"will",
"send",
"a",
"Sysex",
"command",
"to",
"Firmata",
"with",
"any",
"accompanying",
"data"
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L619-L641 | [
"def",
"send_sysex",
"(",
"self",
",",
"sysex_command",
",",
"sysex_data",
"=",
"None",
")",
":",
"if",
"not",
"sysex_data",
":",
"sysex_data",
"=",
"[",
"]",
"# convert the message command and data to characters",
"sysex_message",
"=",
"chr",
"(",
"self",
".",
... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.send_command | This method is used to transmit a non-sysex command.
:param command: Command to send to firmata includes command + data formatted by caller
:return : No return value. | PyMata/pymata_command_handler.py | def send_command(self, command):
"""
This method is used to transmit a non-sysex command.
:param command: Command to send to firmata includes command + data formatted by caller
:return : No return value.
"""
send_message = ""
for i in command:
send_m... | def send_command(self, command):
"""
This method is used to transmit a non-sysex command.
:param command: Command to send to firmata includes command + data formatted by caller
:return : No return value.
"""
send_message = ""
for i in command:
send_m... | [
"This",
"method",
"is",
"used",
"to",
"transmit",
"a",
"non",
"-",
"sysex",
"command",
"."
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L643-L656 | [
"def",
"send_command",
"(",
"self",
",",
"command",
")",
":",
"send_message",
"=",
"\"\"",
"for",
"i",
"in",
"command",
":",
"send_message",
"+=",
"chr",
"(",
"i",
")",
"for",
"data",
"in",
"send_message",
":",
"self",
".",
"pymata",
".",
"transport",
... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.system_reset | Send the reset command to the Arduino.
It resets the response tables to their initial values
:return: No return value | PyMata/pymata_command_handler.py | def system_reset(self):
"""
Send the reset command to the Arduino.
It resets the response tables to their initial values
:return: No return value
"""
data = chr(self.SYSTEM_RESET)
self.pymata.transport.write(data)
# response table re-initialization
... | def system_reset(self):
"""
Send the reset command to the Arduino.
It resets the response tables to their initial values
:return: No return value
"""
data = chr(self.SYSTEM_RESET)
self.pymata.transport.write(data)
# response table re-initialization
... | [
"Send",
"the",
"reset",
"command",
"to",
"the",
"Arduino",
".",
"It",
"resets",
"the",
"response",
"tables",
"to",
"their",
"initial",
"values"
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L658-L685 | [
"def",
"system_reset",
"(",
"self",
")",
":",
"data",
"=",
"chr",
"(",
"self",
".",
"SYSTEM_RESET",
")",
"self",
".",
"pymata",
".",
"transport",
".",
"write",
"(",
"data",
")",
"# response table re-initialization",
"# for each pin set the mode to input and the last... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler._string_data | This method handles the incoming string data message from Firmata.
The string is printed to the console
:param data: Message data from Firmata
:return: No return value.s | PyMata/pymata_command_handler.py | def _string_data(self, data):
"""
This method handles the incoming string data message from Firmata.
The string is printed to the console
:param data: Message data from Firmata
:return: No return value.s
"""
print("_string_data:")
string_to_print = []
... | def _string_data(self, data):
"""
This method handles the incoming string data message from Firmata.
The string is printed to the console
:param data: Message data from Firmata
:return: No return value.s
"""
print("_string_data:")
string_to_print = []
... | [
"This",
"method",
"handles",
"the",
"incoming",
"string",
"data",
"message",
"from",
"Firmata",
".",
"The",
"string",
"is",
"printed",
"to",
"the",
"console"
] | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L689-L702 | [
"def",
"_string_data",
"(",
"self",
",",
"data",
")",
":",
"print",
"(",
"\"_string_data:\"",
")",
"string_to_print",
"=",
"[",
"]",
"for",
"i",
"in",
"data",
"[",
":",
":",
"2",
"]",
":",
"string_to_print",
".",
"append",
"(",
"chr",
"(",
"i",
")",
... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.i2c_reply | This method receives replies to i2c_read requests. It stores the data for each i2c device
address in a dictionary called i2c_map. The data is retrieved via a call to i2c_get_read_data()
in pymata.py
It a callback was specified in pymata.i2c_read, the raw data is sent through the callback
... | PyMata/pymata_command_handler.py | def i2c_reply(self, data):
"""
This method receives replies to i2c_read requests. It stores the data for each i2c device
address in a dictionary called i2c_map. The data is retrieved via a call to i2c_get_read_data()
in pymata.py
It a callback was specified in pymata.i2c_read, th... | def i2c_reply(self, data):
"""
This method receives replies to i2c_read requests. It stores the data for each i2c device
address in a dictionary called i2c_map. The data is retrieved via a call to i2c_get_read_data()
in pymata.py
It a callback was specified in pymata.i2c_read, th... | [
"This",
"method",
"receives",
"replies",
"to",
"i2c_read",
"requests",
".",
"It",
"stores",
"the",
"data",
"for",
"each",
"i2c",
"device",
"address",
"in",
"a",
"dictionary",
"called",
"i2c_map",
".",
"The",
"data",
"is",
"retrieved",
"via",
"a",
"call",
"... | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L704-L730 | [
"def",
"i2c_reply",
"(",
"self",
",",
"data",
")",
":",
"reply_data",
"=",
"[",
"]",
"address",
"=",
"(",
"data",
"[",
"0",
"]",
"&",
"0x7f",
")",
"+",
"(",
"data",
"[",
"1",
"]",
"<<",
"7",
")",
"register",
"=",
"data",
"[",
"2",
"]",
"&",
... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | PyMataCommandHandler.run | This method starts the thread that continuously runs to receive and interpret
messages coming from Firmata. This must be the last method in this file
It also checks the deque for messages to be sent to Firmata. | PyMata/pymata_command_handler.py | def run(self):
"""
This method starts the thread that continuously runs to receive and interpret
messages coming from Firmata. This must be the last method in this file
It also checks the deque for messages to be sent to Firmata.
"""
# To add a command to the command disp... | def run(self):
"""
This method starts the thread that continuously runs to receive and interpret
messages coming from Firmata. This must be the last method in this file
It also checks the deque for messages to be sent to Firmata.
"""
# To add a command to the command disp... | [
"This",
"method",
"starts",
"the",
"thread",
"that",
"continuously",
"runs",
"to",
"receive",
"and",
"interpret",
"messages",
"coming",
"from",
"Firmata",
".",
"This",
"must",
"be",
"the",
"last",
"method",
"in",
"this",
"file",
"It",
"also",
"checks",
"the"... | MrYsLab/PyMata | python | https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata_command_handler.py#L765-L863 | [
"def",
"run",
"(",
"self",
")",
":",
"# To add a command to the command dispatch table, append here.",
"self",
".",
"command_dispatch",
".",
"update",
"(",
"{",
"self",
".",
"REPORT_VERSION",
":",
"[",
"self",
".",
"report_version",
",",
"2",
"]",
"}",
")",
"sel... | 7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429 |
valid | Haul.retrieve_url | Use requests to fetch remote content | haul/core.py | def retrieve_url(self, url):
"""
Use requests to fetch remote content
"""
try:
r = requests.get(url)
except requests.ConnectionError:
raise exceptions.RetrieveError('Connection fail')
if r.status_code >= 400:
raise exceptions.Retrieve... | def retrieve_url(self, url):
"""
Use requests to fetch remote content
"""
try:
r = requests.get(url)
except requests.ConnectionError:
raise exceptions.RetrieveError('Connection fail')
if r.status_code >= 400:
raise exceptions.Retrieve... | [
"Use",
"requests",
"to",
"fetch",
"remote",
"content"
] | vinta/haul | python | https://github.com/vinta/haul/blob/234024ab8452ea2f41b18561377295cf2879fb20/haul/core.py#L45-L68 | [
"def",
"retrieve_url",
"(",
"self",
",",
"url",
")",
":",
"try",
":",
"r",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"except",
"requests",
".",
"ConnectionError",
":",
"raise",
"exceptions",
".",
"RetrieveError",
"(",
"'Connection fail'",
")",
"if",
... | 234024ab8452ea2f41b18561377295cf2879fb20 |
valid | Haul.parse_html | Use BeautifulSoup to parse HTML / XML
http://www.crummy.com/software/BeautifulSoup/bs4/doc/#specifying-the-parser-to-use | haul/core.py | def parse_html(self, html):
"""
Use BeautifulSoup to parse HTML / XML
http://www.crummy.com/software/BeautifulSoup/bs4/doc/#specifying-the-parser-to-use
"""
soup = BeautifulSoup(html, self.parser)
title_tag = soup.find('title')
self.result.title = title_tag.stri... | def parse_html(self, html):
"""
Use BeautifulSoup to parse HTML / XML
http://www.crummy.com/software/BeautifulSoup/bs4/doc/#specifying-the-parser-to-use
"""
soup = BeautifulSoup(html, self.parser)
title_tag = soup.find('title')
self.result.title = title_tag.stri... | [
"Use",
"BeautifulSoup",
"to",
"parse",
"HTML",
"/",
"XML",
"http",
":",
"//",
"www",
".",
"crummy",
".",
"com",
"/",
"software",
"/",
"BeautifulSoup",
"/",
"bs4",
"/",
"doc",
"/",
"#specifying",
"-",
"the",
"-",
"parser",
"-",
"to",
"-",
"use"
] | vinta/haul | python | https://github.com/vinta/haul/blob/234024ab8452ea2f41b18561377295cf2879fb20/haul/core.py#L70-L83 | [
"def",
"parse_html",
"(",
"self",
",",
"html",
")",
":",
"soup",
"=",
"BeautifulSoup",
"(",
"html",
",",
"self",
".",
"parser",
")",
"title_tag",
"=",
"soup",
".",
"find",
"(",
"'title'",
")",
"self",
".",
"result",
".",
"title",
"=",
"title_tag",
".... | 234024ab8452ea2f41b18561377295cf2879fb20 |
valid | HaulResult.image_urls | Combine finder_image_urls and extender_image_urls,
remove duplicate but keep order | haul/core.py | def image_urls(self):
"""
Combine finder_image_urls and extender_image_urls,
remove duplicate but keep order
"""
all_image_urls = self.finder_image_urls[:]
for image_url in self.extender_image_urls:
if image_url not in all_image_urls:
all_imag... | def image_urls(self):
"""
Combine finder_image_urls and extender_image_urls,
remove duplicate but keep order
"""
all_image_urls = self.finder_image_urls[:]
for image_url in self.extender_image_urls:
if image_url not in all_image_urls:
all_imag... | [
"Combine",
"finder_image_urls",
"and",
"extender_image_urls",
"remove",
"duplicate",
"but",
"keep",
"order"
] | vinta/haul | python | https://github.com/vinta/haul/blob/234024ab8452ea2f41b18561377295cf2879fb20/haul/core.py#L209-L220 | [
"def",
"image_urls",
"(",
"self",
")",
":",
"all_image_urls",
"=",
"self",
".",
"finder_image_urls",
"[",
":",
"]",
"for",
"image_url",
"in",
"self",
".",
"extender_image_urls",
":",
"if",
"image_url",
"not",
"in",
"all_image_urls",
":",
"all_image_urls",
".",... | 234024ab8452ea2f41b18561377295cf2879fb20 |
valid | ggpht_s1600_extender | Example:
http://lh4.ggpht.com/-fFi-qJRuxeY/UjwHSOTHGOI/AAAAAAAArgE/SWTMT-hXzB4/s640/Celeber-ru-Emma-Watson-Net-A-Porter-The-Edit-Magazine-Photoshoot-2013-01.jpg
to
http://lh4.ggpht.com/-fFi-qJRuxeY/UjwHSOTHGOI/AAAAAAAArgE/SWTMT-hXzB4/s1600/Celeber-ru-Emma-Watson-Net-A-Porter-The-Edit-Magazine-Photoshoot-201... | haul/extenders/pipeline/google.py | def ggpht_s1600_extender(pipeline_index,
finder_image_urls,
extender_image_urls=[],
*args, **kwargs):
"""
Example:
http://lh4.ggpht.com/-fFi-qJRuxeY/UjwHSOTHGOI/AAAAAAAArgE/SWTMT-hXzB4/s640/Celeber-ru-Emma-Watson-Net-A-Porter-The-Edi... | def ggpht_s1600_extender(pipeline_index,
finder_image_urls,
extender_image_urls=[],
*args, **kwargs):
"""
Example:
http://lh4.ggpht.com/-fFi-qJRuxeY/UjwHSOTHGOI/AAAAAAAArgE/SWTMT-hXzB4/s640/Celeber-ru-Emma-Watson-Net-A-Porter-The-Edi... | [
"Example",
":",
"http",
":",
"//",
"lh4",
".",
"ggpht",
".",
"com",
"/",
"-",
"fFi",
"-",
"qJRuxeY",
"/",
"UjwHSOTHGOI",
"/",
"AAAAAAAArgE",
"/",
"SWTMT",
"-",
"hXzB4",
"/",
"s640",
"/",
"Celeber",
"-",
"ru",
"-",
"Emma",
"-",
"Watson",
"-",
"Net",... | vinta/haul | python | https://github.com/vinta/haul/blob/234024ab8452ea2f41b18561377295cf2879fb20/haul/extenders/pipeline/google.py#L33-L57 | [
"def",
"ggpht_s1600_extender",
"(",
"pipeline_index",
",",
"finder_image_urls",
",",
"extender_image_urls",
"=",
"[",
"]",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"now_extender_image_urls",
"=",
"[",
"]",
"search_re",
"=",
"re",
".",
"compile",
... | 234024ab8452ea2f41b18561377295cf2879fb20 |
valid | background_image_finder | Find image URL in background-image
Example:
<div style="width: 100%; height: 100%; background-image: url(http://distilleryimage10.ak.instagram.com/bde04558a43b11e28e5d22000a1f979a_7.jpg);" class="Image iLoaded iWithTransition Frame" src="http://distilleryimage10.ak.instagram.com/bde04558a43b11e28e5d22000a1f979... | haul/finders/pipeline/css.py | def background_image_finder(pipeline_index,
soup,
finder_image_urls=[],
*args, **kwargs):
"""
Find image URL in background-image
Example:
<div style="width: 100%; height: 100%; background-image: url(http://distilleryima... | def background_image_finder(pipeline_index,
soup,
finder_image_urls=[],
*args, **kwargs):
"""
Find image URL in background-image
Example:
<div style="width: 100%; height: 100%; background-image: url(http://distilleryima... | [
"Find",
"image",
"URL",
"in",
"background",
"-",
"image"
] | vinta/haul | python | https://github.com/vinta/haul/blob/234024ab8452ea2f41b18561377295cf2879fb20/haul/finders/pipeline/css.py#L6-L37 | [
"def",
"background_image_finder",
"(",
"pipeline_index",
",",
"soup",
",",
"finder_image_urls",
"=",
"[",
"]",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"now_finder_image_urls",
"=",
"[",
"]",
"for",
"tag",
"in",
"soup",
".",
"find_all",
"(",
... | 234024ab8452ea2f41b18561377295cf2879fb20 |
valid | img_src_finder | Find image URL in <img>'s src attribute | haul/finders/pipeline/html.py | def img_src_finder(pipeline_index,
soup,
finder_image_urls=[],
*args, **kwargs):
"""
Find image URL in <img>'s src attribute
"""
now_finder_image_urls = []
for img in soup.find_all('img'):
src = img.get('src', None)
if src:
... | def img_src_finder(pipeline_index,
soup,
finder_image_urls=[],
*args, **kwargs):
"""
Find image URL in <img>'s src attribute
"""
now_finder_image_urls = []
for img in soup.find_all('img'):
src = img.get('src', None)
if src:
... | [
"Find",
"image",
"URL",
"in",
"<img",
">",
"s",
"src",
"attribute"
] | vinta/haul | python | https://github.com/vinta/haul/blob/234024ab8452ea2f41b18561377295cf2879fb20/haul/finders/pipeline/html.py#L6-L27 | [
"def",
"img_src_finder",
"(",
"pipeline_index",
",",
"soup",
",",
"finder_image_urls",
"=",
"[",
"]",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"now_finder_image_urls",
"=",
"[",
"]",
"for",
"img",
"in",
"soup",
".",
"find_all",
"(",
"'img'",
... | 234024ab8452ea2f41b18561377295cf2879fb20 |
valid | a_href_finder | Find image URL in <a>'s href attribute | haul/finders/pipeline/html.py | def a_href_finder(pipeline_index,
soup,
finder_image_urls=[],
*args, **kwargs):
"""
Find image URL in <a>'s href attribute
"""
now_finder_image_urls = []
for a in soup.find_all('a'):
href = a.get('href', None)
if href:
... | def a_href_finder(pipeline_index,
soup,
finder_image_urls=[],
*args, **kwargs):
"""
Find image URL in <a>'s href attribute
"""
now_finder_image_urls = []
for a in soup.find_all('a'):
href = a.get('href', None)
if href:
... | [
"Find",
"image",
"URL",
"in",
"<a",
">",
"s",
"href",
"attribute"
] | vinta/haul | python | https://github.com/vinta/haul/blob/234024ab8452ea2f41b18561377295cf2879fb20/haul/finders/pipeline/html.py#L30-L52 | [
"def",
"a_href_finder",
"(",
"pipeline_index",
",",
"soup",
",",
"finder_image_urls",
"=",
"[",
"]",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"now_finder_image_urls",
"=",
"[",
"]",
"for",
"a",
"in",
"soup",
".",
"find_all",
"(",
"'a'",
")"... | 234024ab8452ea2f41b18561377295cf2879fb20 |
valid | StrictRedisCluster._getnodenamefor | Return the node name where the ``name`` would land to | rediscluster/cluster_client.py | def _getnodenamefor(self, name):
"Return the node name where the ``name`` would land to"
return 'node_' + str(
(abs(binascii.crc32(b(name)) & 0xffffffff) % self.no_servers) + 1) | def _getnodenamefor(self, name):
"Return the node name where the ``name`` would land to"
return 'node_' + str(
(abs(binascii.crc32(b(name)) & 0xffffffff) % self.no_servers) + 1) | [
"Return",
"the",
"node",
"name",
"where",
"the",
"name",
"would",
"land",
"to"
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L271-L274 | [
"def",
"_getnodenamefor",
"(",
"self",
",",
"name",
")",
":",
"return",
"'node_'",
"+",
"str",
"(",
"(",
"abs",
"(",
"binascii",
".",
"crc32",
"(",
"b",
"(",
"name",
")",
")",
"&",
"0xffffffff",
")",
"%",
"self",
".",
"no_servers",
")",
"+",
"1",
... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster.getnodefor | Return the node where the ``name`` would land to | rediscluster/cluster_client.py | def getnodefor(self, name):
"Return the node where the ``name`` would land to"
node = self._getnodenamefor(name)
return {node: self.cluster['nodes'][node]} | def getnodefor(self, name):
"Return the node where the ``name`` would land to"
node = self._getnodenamefor(name)
return {node: self.cluster['nodes'][node]} | [
"Return",
"the",
"node",
"where",
"the",
"name",
"would",
"land",
"to"
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L276-L279 | [
"def",
"getnodefor",
"(",
"self",
",",
"name",
")",
":",
"node",
"=",
"self",
".",
"_getnodenamefor",
"(",
"name",
")",
"return",
"{",
"node",
":",
"self",
".",
"cluster",
"[",
"'nodes'",
"]",
"[",
"node",
"]",
"}"
] | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster.object | Return the encoding, idletime, or refcount about the key | rediscluster/cluster_client.py | def object(self, infotype, key):
"Return the encoding, idletime, or refcount about the key"
redisent = self.redises[self._getnodenamefor(key) + '_slave']
return getattr(redisent, 'object')(infotype, key) | def object(self, infotype, key):
"Return the encoding, idletime, or refcount about the key"
redisent = self.redises[self._getnodenamefor(key) + '_slave']
return getattr(redisent, 'object')(infotype, key) | [
"Return",
"the",
"encoding",
"idletime",
"or",
"refcount",
"about",
"the",
"key"
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L299-L302 | [
"def",
"object",
"(",
"self",
",",
"infotype",
",",
"key",
")",
":",
"redisent",
"=",
"self",
".",
"redises",
"[",
"self",
".",
"_getnodenamefor",
"(",
"key",
")",
"+",
"'_slave'",
"]",
"return",
"getattr",
"(",
"redisent",
",",
"'object'",
")",
"(",
... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_brpoplpush | Pop a value off the tail of ``src``, push it on the head of ``dst``
and then return it.
This command blocks until a value is in ``src`` or until ``timeout``
seconds elapse, whichever is first. A ``timeout`` value of 0 blocks
forever.
Not atomic | rediscluster/cluster_client.py | def _rc_brpoplpush(self, src, dst, timeout=0):
"""
Pop a value off the tail of ``src``, push it on the head of ``dst``
and then return it.
This command blocks until a value is in ``src`` or until ``timeout``
seconds elapse, whichever is first. A ``timeout`` value of 0 blocks
... | def _rc_brpoplpush(self, src, dst, timeout=0):
"""
Pop a value off the tail of ``src``, push it on the head of ``dst``
and then return it.
This command blocks until a value is in ``src`` or until ``timeout``
seconds elapse, whichever is first. A ``timeout`` value of 0 blocks
... | [
"Pop",
"a",
"value",
"off",
"the",
"tail",
"of",
"src",
"push",
"it",
"on",
"the",
"head",
"of",
"dst",
"and",
"then",
"return",
"it",
"."
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L304-L318 | [
"def",
"_rc_brpoplpush",
"(",
"self",
",",
"src",
",",
"dst",
",",
"timeout",
"=",
"0",
")",
":",
"rpop",
"=",
"self",
".",
"brpop",
"(",
"src",
",",
"timeout",
")",
"if",
"rpop",
"is",
"not",
"None",
":",
"self",
".",
"lpush",
"(",
"dst",
",",
... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_rpoplpush | RPOP a value off of the ``src`` list and LPUSH it
on to the ``dst`` list. Returns the value. | rediscluster/cluster_client.py | def _rc_rpoplpush(self, src, dst):
"""
RPOP a value off of the ``src`` list and LPUSH it
on to the ``dst`` list. Returns the value.
"""
rpop = self.rpop(src)
if rpop is not None:
self.lpush(dst, rpop)
return rpop
return None | def _rc_rpoplpush(self, src, dst):
"""
RPOP a value off of the ``src`` list and LPUSH it
on to the ``dst`` list. Returns the value.
"""
rpop = self.rpop(src)
if rpop is not None:
self.lpush(dst, rpop)
return rpop
return None | [
"RPOP",
"a",
"value",
"off",
"of",
"the",
"src",
"list",
"and",
"LPUSH",
"it",
"on",
"to",
"the",
"dst",
"list",
".",
"Returns",
"the",
"value",
"."
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L320-L329 | [
"def",
"_rc_rpoplpush",
"(",
"self",
",",
"src",
",",
"dst",
")",
":",
"rpop",
"=",
"self",
".",
"rpop",
"(",
"src",
")",
"if",
"rpop",
"is",
"not",
"None",
":",
"self",
".",
"lpush",
"(",
"dst",
",",
"rpop",
")",
"return",
"rpop",
"return",
"Non... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_sdiff | Returns the members of the set resulting from the difference between
the first set and all the successive sets. | rediscluster/cluster_client.py | def _rc_sdiff(self, src, *args):
"""
Returns the members of the set resulting from the difference between
the first set and all the successive sets.
"""
args = list_or_args(src, args)
src_set = self.smembers(args.pop(0))
if src_set is not set([]):
for ... | def _rc_sdiff(self, src, *args):
"""
Returns the members of the set resulting from the difference between
the first set and all the successive sets.
"""
args = list_or_args(src, args)
src_set = self.smembers(args.pop(0))
if src_set is not set([]):
for ... | [
"Returns",
"the",
"members",
"of",
"the",
"set",
"resulting",
"from",
"the",
"difference",
"between",
"the",
"first",
"set",
"and",
"all",
"the",
"successive",
"sets",
"."
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L331-L341 | [
"def",
"_rc_sdiff",
"(",
"self",
",",
"src",
",",
"*",
"args",
")",
":",
"args",
"=",
"list_or_args",
"(",
"src",
",",
"args",
")",
"src_set",
"=",
"self",
".",
"smembers",
"(",
"args",
".",
"pop",
"(",
"0",
")",
")",
"if",
"src_set",
"is",
"not"... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_sdiffstore | Store the difference of sets ``src``, ``args`` into a new
set named ``dest``. Returns the number of keys in the new set. | rediscluster/cluster_client.py | def _rc_sdiffstore(self, dst, src, *args):
"""
Store the difference of sets ``src``, ``args`` into a new
set named ``dest``. Returns the number of keys in the new set.
"""
args = list_or_args(src, args)
result = self.sdiff(*args)
if result is not set([]):
... | def _rc_sdiffstore(self, dst, src, *args):
"""
Store the difference of sets ``src``, ``args`` into a new
set named ``dest``. Returns the number of keys in the new set.
"""
args = list_or_args(src, args)
result = self.sdiff(*args)
if result is not set([]):
... | [
"Store",
"the",
"difference",
"of",
"sets",
"src",
"args",
"into",
"a",
"new",
"set",
"named",
"dest",
".",
"Returns",
"the",
"number",
"of",
"keys",
"in",
"the",
"new",
"set",
"."
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L343-L352 | [
"def",
"_rc_sdiffstore",
"(",
"self",
",",
"dst",
",",
"src",
",",
"*",
"args",
")",
":",
"args",
"=",
"list_or_args",
"(",
"src",
",",
"args",
")",
"result",
"=",
"self",
".",
"sdiff",
"(",
"*",
"args",
")",
"if",
"result",
"is",
"not",
"set",
"... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_sinter | Returns the members of the set resulting from the difference between
the first set and all the successive sets. | rediscluster/cluster_client.py | def _rc_sinter(self, src, *args):
"""
Returns the members of the set resulting from the difference between
the first set and all the successive sets.
"""
args = list_or_args(src, args)
src_set = self.smembers(args.pop(0))
if src_set is not set([]):
for... | def _rc_sinter(self, src, *args):
"""
Returns the members of the set resulting from the difference between
the first set and all the successive sets.
"""
args = list_or_args(src, args)
src_set = self.smembers(args.pop(0))
if src_set is not set([]):
for... | [
"Returns",
"the",
"members",
"of",
"the",
"set",
"resulting",
"from",
"the",
"difference",
"between",
"the",
"first",
"set",
"and",
"all",
"the",
"successive",
"sets",
"."
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L354-L364 | [
"def",
"_rc_sinter",
"(",
"self",
",",
"src",
",",
"*",
"args",
")",
":",
"args",
"=",
"list_or_args",
"(",
"src",
",",
"args",
")",
"src_set",
"=",
"self",
".",
"smembers",
"(",
"args",
".",
"pop",
"(",
"0",
")",
")",
"if",
"src_set",
"is",
"not... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_sinterstore | Store the difference of sets ``src``, ``args`` into a new
set named ``dest``. Returns the number of keys in the new set. | rediscluster/cluster_client.py | def _rc_sinterstore(self, dst, src, *args):
"""
Store the difference of sets ``src``, ``args`` into a new
set named ``dest``. Returns the number of keys in the new set.
"""
args = list_or_args(src, args)
result = self.sinter(*args)
if result is not set([]):
... | def _rc_sinterstore(self, dst, src, *args):
"""
Store the difference of sets ``src``, ``args`` into a new
set named ``dest``. Returns the number of keys in the new set.
"""
args = list_or_args(src, args)
result = self.sinter(*args)
if result is not set([]):
... | [
"Store",
"the",
"difference",
"of",
"sets",
"src",
"args",
"into",
"a",
"new",
"set",
"named",
"dest",
".",
"Returns",
"the",
"number",
"of",
"keys",
"in",
"the",
"new",
"set",
"."
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L366-L375 | [
"def",
"_rc_sinterstore",
"(",
"self",
",",
"dst",
",",
"src",
",",
"*",
"args",
")",
":",
"args",
"=",
"list_or_args",
"(",
"src",
",",
"args",
")",
"result",
"=",
"self",
".",
"sinter",
"(",
"*",
"args",
")",
"if",
"result",
"is",
"not",
"set",
... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_smove | Move ``value`` from set ``src`` to set ``dst``
not atomic | rediscluster/cluster_client.py | def _rc_smove(self, src, dst, value):
"""
Move ``value`` from set ``src`` to set ``dst``
not atomic
"""
if self.type(src) != b("set"):
return self.smove(src + "{" + src + "}", dst, value)
if self.type(dst) != b("set"):
return self.smove(dst + "{" +... | def _rc_smove(self, src, dst, value):
"""
Move ``value`` from set ``src`` to set ``dst``
not atomic
"""
if self.type(src) != b("set"):
return self.smove(src + "{" + src + "}", dst, value)
if self.type(dst) != b("set"):
return self.smove(dst + "{" +... | [
"Move",
"value",
"from",
"set",
"src",
"to",
"set",
"dst",
"not",
"atomic"
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L377-L388 | [
"def",
"_rc_smove",
"(",
"self",
",",
"src",
",",
"dst",
",",
"value",
")",
":",
"if",
"self",
".",
"type",
"(",
"src",
")",
"!=",
"b",
"(",
"\"set\"",
")",
":",
"return",
"self",
".",
"smove",
"(",
"src",
"+",
"\"{\"",
"+",
"src",
"+",
"\"}\""... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_sunion | Returns the members of the set resulting from the union between
the first set and all the successive sets. | rediscluster/cluster_client.py | def _rc_sunion(self, src, *args):
"""
Returns the members of the set resulting from the union between
the first set and all the successive sets.
"""
args = list_or_args(src, args)
src_set = self.smembers(args.pop(0))
if src_set is not set([]):
for key ... | def _rc_sunion(self, src, *args):
"""
Returns the members of the set resulting from the union between
the first set and all the successive sets.
"""
args = list_or_args(src, args)
src_set = self.smembers(args.pop(0))
if src_set is not set([]):
for key ... | [
"Returns",
"the",
"members",
"of",
"the",
"set",
"resulting",
"from",
"the",
"union",
"between",
"the",
"first",
"set",
"and",
"all",
"the",
"successive",
"sets",
"."
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L390-L400 | [
"def",
"_rc_sunion",
"(",
"self",
",",
"src",
",",
"*",
"args",
")",
":",
"args",
"=",
"list_or_args",
"(",
"src",
",",
"args",
")",
"src_set",
"=",
"self",
".",
"smembers",
"(",
"args",
".",
"pop",
"(",
"0",
")",
")",
"if",
"src_set",
"is",
"not... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_sunionstore | Store the union of sets ``src``, ``args`` into a new
set named ``dest``. Returns the number of keys in the new set. | rediscluster/cluster_client.py | def _rc_sunionstore(self, dst, src, *args):
"""
Store the union of sets ``src``, ``args`` into a new
set named ``dest``. Returns the number of keys in the new set.
"""
args = list_or_args(src, args)
result = self.sunion(*args)
if result is not set([]):
... | def _rc_sunionstore(self, dst, src, *args):
"""
Store the union of sets ``src``, ``args`` into a new
set named ``dest``. Returns the number of keys in the new set.
"""
args = list_or_args(src, args)
result = self.sunion(*args)
if result is not set([]):
... | [
"Store",
"the",
"union",
"of",
"sets",
"src",
"args",
"into",
"a",
"new",
"set",
"named",
"dest",
".",
"Returns",
"the",
"number",
"of",
"keys",
"in",
"the",
"new",
"set",
"."
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L402-L411 | [
"def",
"_rc_sunionstore",
"(",
"self",
",",
"dst",
",",
"src",
",",
"*",
"args",
")",
":",
"args",
"=",
"list_or_args",
"(",
"src",
",",
"args",
")",
"result",
"=",
"self",
".",
"sunion",
"(",
"*",
"args",
")",
"if",
"result",
"is",
"not",
"set",
... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_mset | Sets each key in the ``mapping`` dict to its corresponding value | rediscluster/cluster_client.py | def _rc_mset(self, mapping):
"Sets each key in the ``mapping`` dict to its corresponding value"
result = True
for k, v in iteritems(mapping):
result = result and self.set(k, v)
return result | def _rc_mset(self, mapping):
"Sets each key in the ``mapping`` dict to its corresponding value"
result = True
for k, v in iteritems(mapping):
result = result and self.set(k, v)
return result | [
"Sets",
"each",
"key",
"in",
"the",
"mapping",
"dict",
"to",
"its",
"corresponding",
"value"
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L413-L418 | [
"def",
"_rc_mset",
"(",
"self",
",",
"mapping",
")",
":",
"result",
"=",
"True",
"for",
"k",
",",
"v",
"in",
"iteritems",
"(",
"mapping",
")",
":",
"result",
"=",
"result",
"and",
"self",
".",
"set",
"(",
"k",
",",
"v",
")",
"return",
"result"
] | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_msetnx | Sets each key in the ``mapping`` dict to its corresponding value if
none of the keys are already set | rediscluster/cluster_client.py | def _rc_msetnx(self, mapping):
"""
Sets each key in the ``mapping`` dict to its corresponding value if
none of the keys are already set
"""
for k in iterkeys(mapping):
if self.exists(k):
return False
return self._rc_mset(mapping) | def _rc_msetnx(self, mapping):
"""
Sets each key in the ``mapping`` dict to its corresponding value if
none of the keys are already set
"""
for k in iterkeys(mapping):
if self.exists(k):
return False
return self._rc_mset(mapping) | [
"Sets",
"each",
"key",
"in",
"the",
"mapping",
"dict",
"to",
"its",
"corresponding",
"value",
"if",
"none",
"of",
"the",
"keys",
"are",
"already",
"set"
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L420-L429 | [
"def",
"_rc_msetnx",
"(",
"self",
",",
"mapping",
")",
":",
"for",
"k",
"in",
"iterkeys",
"(",
"mapping",
")",
":",
"if",
"self",
".",
"exists",
"(",
"k",
")",
":",
"return",
"False",
"return",
"self",
".",
"_rc_mset",
"(",
"mapping",
")"
] | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_mget | Returns a list of values ordered identically to ``*args`` | rediscluster/cluster_client.py | def _rc_mget(self, keys, *args):
"""
Returns a list of values ordered identically to ``*args``
"""
args = list_or_args(keys, args)
result = []
for key in args:
result.append(self.get(key))
return result | def _rc_mget(self, keys, *args):
"""
Returns a list of values ordered identically to ``*args``
"""
args = list_or_args(keys, args)
result = []
for key in args:
result.append(self.get(key))
return result | [
"Returns",
"a",
"list",
"of",
"values",
"ordered",
"identically",
"to",
"*",
"args"
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L431-L439 | [
"def",
"_rc_mget",
"(",
"self",
",",
"keys",
",",
"*",
"args",
")",
":",
"args",
"=",
"list_or_args",
"(",
"keys",
",",
"args",
")",
"result",
"=",
"[",
"]",
"for",
"key",
"in",
"args",
":",
"result",
".",
"append",
"(",
"self",
".",
"get",
"(",
... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_rename | Rename key ``src`` to ``dst`` | rediscluster/cluster_client.py | def _rc_rename(self, src, dst):
"""
Rename key ``src`` to ``dst``
"""
if src == dst:
return self.rename(src + "{" + src + "}", src)
if not self.exists(src):
return self.rename(src + "{" + src + "}", src)
self.delete(dst)
ktype = self.type(... | def _rc_rename(self, src, dst):
"""
Rename key ``src`` to ``dst``
"""
if src == dst:
return self.rename(src + "{" + src + "}", src)
if not self.exists(src):
return self.rename(src + "{" + src + "}", src)
self.delete(dst)
ktype = self.type(... | [
"Rename",
"key",
"src",
"to",
"dst"
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L441-L476 | [
"def",
"_rc_rename",
"(",
"self",
",",
"src",
",",
"dst",
")",
":",
"if",
"src",
"==",
"dst",
":",
"return",
"self",
".",
"rename",
"(",
"src",
"+",
"\"{\"",
"+",
"src",
"+",
"\"}\"",
",",
"src",
")",
"if",
"not",
"self",
".",
"exists",
"(",
"s... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_renamenx | Rename key ``src`` to ``dst`` if ``dst`` doesn't already exist | rediscluster/cluster_client.py | def _rc_renamenx(self, src, dst):
"Rename key ``src`` to ``dst`` if ``dst`` doesn't already exist"
if self.exists(dst):
return False
return self._rc_rename(src, dst) | def _rc_renamenx(self, src, dst):
"Rename key ``src`` to ``dst`` if ``dst`` doesn't already exist"
if self.exists(dst):
return False
return self._rc_rename(src, dst) | [
"Rename",
"key",
"src",
"to",
"dst",
"if",
"dst",
"doesn",
"t",
"already",
"exist"
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L478-L483 | [
"def",
"_rc_renamenx",
"(",
"self",
",",
"src",
",",
"dst",
")",
":",
"if",
"self",
".",
"exists",
"(",
"dst",
")",
":",
"return",
"False",
"return",
"self",
".",
"_rc_rename",
"(",
"src",
",",
"dst",
")"
] | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_keys | Returns a list of keys matching ``pattern`` | rediscluster/cluster_client.py | def _rc_keys(self, pattern='*'):
"Returns a list of keys matching ``pattern``"
result = []
for alias, redisent in iteritems(self.redises):
if alias.find('_slave') == -1:
continue
result.extend(redisent.keys(pattern))
return result | def _rc_keys(self, pattern='*'):
"Returns a list of keys matching ``pattern``"
result = []
for alias, redisent in iteritems(self.redises):
if alias.find('_slave') == -1:
continue
result.extend(redisent.keys(pattern))
return result | [
"Returns",
"a",
"list",
"of",
"keys",
"matching",
"pattern"
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L485-L495 | [
"def",
"_rc_keys",
"(",
"self",
",",
"pattern",
"=",
"'*'",
")",
":",
"result",
"=",
"[",
"]",
"for",
"alias",
",",
"redisent",
"in",
"iteritems",
"(",
"self",
".",
"redises",
")",
":",
"if",
"alias",
".",
"find",
"(",
"'_slave'",
")",
"==",
"-",
... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | StrictRedisCluster._rc_dbsize | Returns the number of keys in the current database | rediscluster/cluster_client.py | def _rc_dbsize(self):
"Returns the number of keys in the current database"
result = 0
for alias, redisent in iteritems(self.redises):
if alias.find('_slave') == -1:
continue
result += redisent.dbsize()
return result | def _rc_dbsize(self):
"Returns the number of keys in the current database"
result = 0
for alias, redisent in iteritems(self.redises):
if alias.find('_slave') == -1:
continue
result += redisent.dbsize()
return result | [
"Returns",
"the",
"number",
"of",
"keys",
"in",
"the",
"current",
"database"
] | salimane/rediscluster-py | python | https://github.com/salimane/rediscluster-py/blob/4fe4d928cd6fe3e7564f7362e3996898bda5a285/rediscluster/cluster_client.py#L497-L507 | [
"def",
"_rc_dbsize",
"(",
"self",
")",
":",
"result",
"=",
"0",
"for",
"alias",
",",
"redisent",
"in",
"iteritems",
"(",
"self",
".",
"redises",
")",
":",
"if",
"alias",
".",
"find",
"(",
"'_slave'",
")",
"==",
"-",
"1",
":",
"continue",
"result",
... | 4fe4d928cd6fe3e7564f7362e3996898bda5a285 |
valid | Base.prepare | Prepare the date in the instance state for serialization. | saml/schema/base.py | def prepare(self):
"""Prepare the date in the instance state for serialization.
"""
# Create a collection for the attributes and elements of
# this instance.
attributes, elements = OrderedDict(), []
# Initialize the namespace map.
nsmap = dict([self.meta.namespa... | def prepare(self):
"""Prepare the date in the instance state for serialization.
"""
# Create a collection for the attributes and elements of
# this instance.
attributes, elements = OrderedDict(), []
# Initialize the namespace map.
nsmap = dict([self.meta.namespa... | [
"Prepare",
"the",
"date",
"in",
"the",
"instance",
"state",
"for",
"serialization",
"."
] | mehcode/python-saml | python | https://github.com/mehcode/python-saml/blob/33ed62018efa9ec15b551f309429de510fa44321/saml/schema/base.py#L301-L326 | [
"def",
"prepare",
"(",
"self",
")",
":",
"# Create a collection for the attributes and elements of",
"# this instance.",
"attributes",
",",
"elements",
"=",
"OrderedDict",
"(",
")",
",",
"[",
"]",
"# Initialize the namespace map.",
"nsmap",
"=",
"dict",
"(",
"[",
"sel... | 33ed62018efa9ec15b551f309429de510fa44321 |
valid | sign | Sign an XML document with the given private key file. This will add a
<Signature> element to the document.
:param lxml.etree._Element xml: The document to sign
:param file stream: The private key to sign the document with
:param str password: The password used to access the private key
:rtype: Non... | saml/signature.py | def sign(xml, stream, password=None):
"""
Sign an XML document with the given private key file. This will add a
<Signature> element to the document.
:param lxml.etree._Element xml: The document to sign
:param file stream: The private key to sign the document with
:param str password: The passwo... | def sign(xml, stream, password=None):
"""
Sign an XML document with the given private key file. This will add a
<Signature> element to the document.
:param lxml.etree._Element xml: The document to sign
:param file stream: The private key to sign the document with
:param str password: The passwo... | [
"Sign",
"an",
"XML",
"document",
"with",
"the",
"given",
"private",
"key",
"file",
".",
"This",
"will",
"add",
"a",
"<Signature",
">",
"element",
"to",
"the",
"document",
"."
] | mehcode/python-saml | python | https://github.com/mehcode/python-saml/blob/33ed62018efa9ec15b551f309429de510fa44321/saml/signature.py#L11-L110 | [
"def",
"sign",
"(",
"xml",
",",
"stream",
",",
"password",
"=",
"None",
")",
":",
"# Import xmlsec here to delay initializing the C library in",
"# case we don't need it.",
"import",
"xmlsec",
"# Resolve the SAML/2.0 element in question.",
"from",
"saml",
".",
"schema",
"."... | 33ed62018efa9ec15b551f309429de510fa44321 |
valid | verify | Verify the signaure of an XML document with the given certificate.
Returns `True` if the document is signed with a valid signature.
Returns `False` if the document is not signed or if the signature is
invalid.
:param lxml.etree._Element xml: The document to sign
:param file stream: The private key ... | saml/signature.py | def verify(xml, stream):
"""
Verify the signaure of an XML document with the given certificate.
Returns `True` if the document is signed with a valid signature.
Returns `False` if the document is not signed or if the signature is
invalid.
:param lxml.etree._Element xml: The document to sign
... | def verify(xml, stream):
"""
Verify the signaure of an XML document with the given certificate.
Returns `True` if the document is signed with a valid signature.
Returns `False` if the document is not signed or if the signature is
invalid.
:param lxml.etree._Element xml: The document to sign
... | [
"Verify",
"the",
"signaure",
"of",
"an",
"XML",
"document",
"with",
"the",
"given",
"certificate",
".",
"Returns",
"True",
"if",
"the",
"document",
"is",
"signed",
"with",
"a",
"valid",
"signature",
".",
"Returns",
"False",
"if",
"the",
"document",
"is",
"... | mehcode/python-saml | python | https://github.com/mehcode/python-saml/blob/33ed62018efa9ec15b551f309429de510fa44321/saml/signature.py#L113-L166 | [
"def",
"verify",
"(",
"xml",
",",
"stream",
")",
":",
"# Import xmlsec here to delay initializing the C library in",
"# case we don't need it.",
"import",
"xmlsec",
"# Find the <Signature/> node.",
"signature_node",
"=",
"xmlsec",
".",
"tree",
".",
"find_node",
"(",
"xml",
... | 33ed62018efa9ec15b551f309429de510fa44321 |
valid | GalleryAdmin.get_queryset | Add number of photos to each gallery. | pgallery/admin.py | def get_queryset(self, request):
"""
Add number of photos to each gallery.
"""
qs = super(GalleryAdmin, self).get_queryset(request)
return qs.annotate(photo_count=Count('photos')) | def get_queryset(self, request):
"""
Add number of photos to each gallery.
"""
qs = super(GalleryAdmin, self).get_queryset(request)
return qs.annotate(photo_count=Count('photos')) | [
"Add",
"number",
"of",
"photos",
"to",
"each",
"gallery",
"."
] | zsiciarz/django-pgallery | python | https://github.com/zsiciarz/django-pgallery/blob/4c7b23f64747c257b5c5e148fb6c565a648c08e7/pgallery/admin.py#L49-L54 | [
"def",
"get_queryset",
"(",
"self",
",",
"request",
")",
":",
"qs",
"=",
"super",
"(",
"GalleryAdmin",
",",
"self",
")",
".",
"get_queryset",
"(",
"request",
")",
"return",
"qs",
".",
"annotate",
"(",
"photo_count",
"=",
"Count",
"(",
"'photos'",
")",
... | 4c7b23f64747c257b5c5e148fb6c565a648c08e7 |
valid | GalleryAdmin.save_model | Set currently authenticated user as the author of the gallery. | pgallery/admin.py | def save_model(self, request, obj, form, change):
"""
Set currently authenticated user as the author of the gallery.
"""
obj.author = request.user
obj.save() | def save_model(self, request, obj, form, change):
"""
Set currently authenticated user as the author of the gallery.
"""
obj.author = request.user
obj.save() | [
"Set",
"currently",
"authenticated",
"user",
"as",
"the",
"author",
"of",
"the",
"gallery",
"."
] | zsiciarz/django-pgallery | python | https://github.com/zsiciarz/django-pgallery/blob/4c7b23f64747c257b5c5e148fb6c565a648c08e7/pgallery/admin.py#L56-L61 | [
"def",
"save_model",
"(",
"self",
",",
"request",
",",
"obj",
",",
"form",
",",
"change",
")",
":",
"obj",
".",
"author",
"=",
"request",
".",
"user",
"obj",
".",
"save",
"(",
")"
] | 4c7b23f64747c257b5c5e148fb6c565a648c08e7 |
valid | GalleryAdmin.save_formset | For each photo set it's author to currently authenticated user. | pgallery/admin.py | def save_formset(self, request, form, formset, change):
"""
For each photo set it's author to currently authenticated user.
"""
instances = formset.save(commit=False)
for instance in instances:
if isinstance(instance, Photo):
instance.author = request.... | def save_formset(self, request, form, formset, change):
"""
For each photo set it's author to currently authenticated user.
"""
instances = formset.save(commit=False)
for instance in instances:
if isinstance(instance, Photo):
instance.author = request.... | [
"For",
"each",
"photo",
"set",
"it",
"s",
"author",
"to",
"currently",
"authenticated",
"user",
"."
] | zsiciarz/django-pgallery | python | https://github.com/zsiciarz/django-pgallery/blob/4c7b23f64747c257b5c5e148fb6c565a648c08e7/pgallery/admin.py#L63-L71 | [
"def",
"save_formset",
"(",
"self",
",",
"request",
",",
"form",
",",
"formset",
",",
"change",
")",
":",
"instances",
"=",
"formset",
".",
"save",
"(",
"commit",
"=",
"False",
")",
"for",
"instance",
"in",
"instances",
":",
"if",
"isinstance",
"(",
"i... | 4c7b23f64747c257b5c5e148fb6c565a648c08e7 |
valid | Ranges.parse_byteranges | Outputs a list of tuples with ranges or the empty list
According to the rfc, start or end values can be omitted | static_ranges.py | def parse_byteranges(cls, environ):
"""
Outputs a list of tuples with ranges or the empty list
According to the rfc, start or end values can be omitted
"""
r = []
s = environ.get(cls.header_range, '').replace(' ','').lower()
if s:
l = s.split('=')
... | def parse_byteranges(cls, environ):
"""
Outputs a list of tuples with ranges or the empty list
According to the rfc, start or end values can be omitted
"""
r = []
s = environ.get(cls.header_range, '').replace(' ','').lower()
if s:
l = s.split('=')
... | [
"Outputs",
"a",
"list",
"of",
"tuples",
"with",
"ranges",
"or",
"the",
"empty",
"list",
"According",
"to",
"the",
"rfc",
"start",
"or",
"end",
"values",
"can",
"be",
"omitted"
] | racitup/static-ranges | python | https://github.com/racitup/static-ranges/blob/a15c2e2bd6f643279ae046494b8714634dd380a4/static_ranges.py#L91-L107 | [
"def",
"parse_byteranges",
"(",
"cls",
",",
"environ",
")",
":",
"r",
"=",
"[",
"]",
"s",
"=",
"environ",
".",
"get",
"(",
"cls",
".",
"header_range",
",",
"''",
")",
".",
"replace",
"(",
"' '",
",",
"''",
")",
".",
"lower",
"(",
")",
"if",
"s"... | a15c2e2bd6f643279ae046494b8714634dd380a4 |
valid | Ranges.check_ranges | Removes errored ranges | static_ranges.py | def check_ranges(cls, ranges, length):
"""Removes errored ranges"""
result = []
for start, end in ranges:
if isinstance(start, int) or isinstance(end, int):
if isinstance(start, int) and not (0 <= start < length):
continue
elif isin... | def check_ranges(cls, ranges, length):
"""Removes errored ranges"""
result = []
for start, end in ranges:
if isinstance(start, int) or isinstance(end, int):
if isinstance(start, int) and not (0 <= start < length):
continue
elif isin... | [
"Removes",
"errored",
"ranges"
] | racitup/static-ranges | python | https://github.com/racitup/static-ranges/blob/a15c2e2bd6f643279ae046494b8714634dd380a4/static_ranges.py#L110-L122 | [
"def",
"check_ranges",
"(",
"cls",
",",
"ranges",
",",
"length",
")",
":",
"result",
"=",
"[",
"]",
"for",
"start",
",",
"end",
"in",
"ranges",
":",
"if",
"isinstance",
"(",
"start",
",",
"int",
")",
"or",
"isinstance",
"(",
"end",
",",
"int",
")",... | a15c2e2bd6f643279ae046494b8714634dd380a4 |
valid | Ranges.convert_ranges | Converts to valid byte ranges | static_ranges.py | def convert_ranges(cls, ranges, length):
"""Converts to valid byte ranges"""
result = []
for start, end in ranges:
if end is None:
result.append( (start, length-1) )
elif start is None:
s = length - end
result.append( (0 if ... | def convert_ranges(cls, ranges, length):
"""Converts to valid byte ranges"""
result = []
for start, end in ranges:
if end is None:
result.append( (start, length-1) )
elif start is None:
s = length - end
result.append( (0 if ... | [
"Converts",
"to",
"valid",
"byte",
"ranges"
] | racitup/static-ranges | python | https://github.com/racitup/static-ranges/blob/a15c2e2bd6f643279ae046494b8714634dd380a4/static_ranges.py#L125-L136 | [
"def",
"convert_ranges",
"(",
"cls",
",",
"ranges",
",",
"length",
")",
":",
"result",
"=",
"[",
"]",
"for",
"start",
",",
"end",
"in",
"ranges",
":",
"if",
"end",
"is",
"None",
":",
"result",
".",
"append",
"(",
"(",
"start",
",",
"length",
"-",
... | a15c2e2bd6f643279ae046494b8714634dd380a4 |
valid | Ranges.condense_ranges | Sorts and removes overlaps | static_ranges.py | def condense_ranges(cls, ranges):
"""Sorts and removes overlaps"""
result = []
if ranges:
ranges.sort(key=lambda tup: tup[0])
result.append(ranges[0])
for i in range(1, len(ranges)):
if result[-1][1] + 1 >= ranges[i][0]:
res... | def condense_ranges(cls, ranges):
"""Sorts and removes overlaps"""
result = []
if ranges:
ranges.sort(key=lambda tup: tup[0])
result.append(ranges[0])
for i in range(1, len(ranges)):
if result[-1][1] + 1 >= ranges[i][0]:
res... | [
"Sorts",
"and",
"removes",
"overlaps"
] | racitup/static-ranges | python | https://github.com/racitup/static-ranges/blob/a15c2e2bd6f643279ae046494b8714634dd380a4/static_ranges.py#L139-L150 | [
"def",
"condense_ranges",
"(",
"cls",
",",
"ranges",
")",
":",
"result",
"=",
"[",
"]",
"if",
"ranges",
":",
"ranges",
".",
"sort",
"(",
"key",
"=",
"lambda",
"tup",
":",
"tup",
"[",
"0",
"]",
")",
"result",
".",
"append",
"(",
"ranges",
"[",
"0"... | a15c2e2bd6f643279ae046494b8714634dd380a4 |
valid | social_widget_render | Renders the selected social widget. You can specify optional settings
that will be passed to widget template.
Sample usage:
{% social_widget_render widget_template ke1=val1 key2=val2 %}
For example to render Twitter follow button you can use code like this:
{% social_widget_render 'twitter/follow... | social_widgets/templatetags/social_widgets.py | def social_widget_render(parser, token):
""" Renders the selected social widget. You can specify optional settings
that will be passed to widget template.
Sample usage:
{% social_widget_render widget_template ke1=val1 key2=val2 %}
For example to render Twitter follow button you can use code like ... | def social_widget_render(parser, token):
""" Renders the selected social widget. You can specify optional settings
that will be passed to widget template.
Sample usage:
{% social_widget_render widget_template ke1=val1 key2=val2 %}
For example to render Twitter follow button you can use code like ... | [
"Renders",
"the",
"selected",
"social",
"widget",
".",
"You",
"can",
"specify",
"optional",
"settings",
"that",
"will",
"be",
"passed",
"to",
"widget",
"template",
"."
] | creafz/django-social-widgets | python | https://github.com/creafz/django-social-widgets/blob/785c599621549f7b111d98f28ce3c7958c747dd1/social_widgets/templatetags/social_widgets.py#L122-L159 | [
"def",
"social_widget_render",
"(",
"parser",
",",
"token",
")",
":",
"bits",
"=",
"token",
".",
"split_contents",
"(",
")",
"tag_name",
"=",
"bits",
"[",
"0",
"]",
"if",
"len",
"(",
"bits",
")",
"<",
"2",
":",
"raise",
"TemplateSyntaxError",
"(",
"\"'... | 785c599621549f7b111d98f28ce3c7958c747dd1 |
valid | Sparse3DMatrix.add | In-place addition
:param addend_mat: A matrix to be added on the Sparse3DMatrix object
:param axis: The dimension along the addend_mat is added
:return: Nothing (as it performs in-place operations) | emase/Sparse3DMatrix.py | def add(self, addend_mat, axis=1):
"""
In-place addition
:param addend_mat: A matrix to be added on the Sparse3DMatrix object
:param axis: The dimension along the addend_mat is added
:return: Nothing (as it performs in-place operations)
"""
if self.finalized:
... | def add(self, addend_mat, axis=1):
"""
In-place addition
:param addend_mat: A matrix to be added on the Sparse3DMatrix object
:param axis: The dimension along the addend_mat is added
:return: Nothing (as it performs in-place operations)
"""
if self.finalized:
... | [
"In",
"-",
"place",
"addition"
] | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/Sparse3DMatrix.py#L238-L257 | [
"def",
"add",
"(",
"self",
",",
"addend_mat",
",",
"axis",
"=",
"1",
")",
":",
"if",
"self",
".",
"finalized",
":",
"if",
"axis",
"==",
"0",
":",
"raise",
"NotImplementedError",
"(",
"'The method is not yet implemented for the axis.'",
")",
"elif",
"axis",
"... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | Sparse3DMatrix.multiply | In-place multiplication
:param multiplier: A matrix or vector to be multiplied
:param axis: The dim along which 'multiplier' is multiplied
:return: Nothing (as it performs in-place operations) | emase/Sparse3DMatrix.py | def multiply(self, multiplier, axis=None):
"""
In-place multiplication
:param multiplier: A matrix or vector to be multiplied
:param axis: The dim along which 'multiplier' is multiplied
:return: Nothing (as it performs in-place operations)
"""
if self.finalized:
... | def multiply(self, multiplier, axis=None):
"""
In-place multiplication
:param multiplier: A matrix or vector to be multiplied
:param axis: The dim along which 'multiplier' is multiplied
:return: Nothing (as it performs in-place operations)
"""
if self.finalized:
... | [
"In",
"-",
"place",
"multiplication"
] | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/Sparse3DMatrix.py#L259-L302 | [
"def",
"multiply",
"(",
"self",
",",
"multiplier",
",",
"axis",
"=",
"None",
")",
":",
"if",
"self",
".",
"finalized",
":",
"if",
"multiplier",
".",
"ndim",
"==",
"1",
":",
"if",
"axis",
"==",
"0",
":",
"# multiplier is np.array of length |haplotypes|",
"r... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | EMfactory.prepare | Initializes the probability of read origin according to the alignment profile
:param pseudocount: Uniform prior for allele specificity estimation
:return: Nothing (as it performs an in-place operations) | emase/EMfactory.py | def prepare(self, pseudocount=0.0, lenfile=None, read_length=100):
"""
Initializes the probability of read origin according to the alignment profile
:param pseudocount: Uniform prior for allele specificity estimation
:return: Nothing (as it performs an in-place operations)
"""
... | def prepare(self, pseudocount=0.0, lenfile=None, read_length=100):
"""
Initializes the probability of read origin according to the alignment profile
:param pseudocount: Uniform prior for allele specificity estimation
:return: Nothing (as it performs an in-place operations)
"""
... | [
"Initializes",
"the",
"probability",
"of",
"read",
"origin",
"according",
"to",
"the",
"alignment",
"profile"
] | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/EMfactory.py#L20-L70 | [
"def",
"prepare",
"(",
"self",
",",
"pseudocount",
"=",
"0.0",
",",
"lenfile",
"=",
"None",
",",
"read_length",
"=",
"100",
")",
":",
"if",
"self",
".",
"probability",
".",
"num_groups",
">",
"0",
":",
"self",
".",
"grp_conv_mat",
"=",
"lil_matrix",
"(... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | EMfactory.reset | Initializes the probability of read origin according to the alignment profile
:param pseudocount: Uniform prior for allele specificity estimation
:return: Nothing (as it performs an in-place operations) | emase/EMfactory.py | def reset(self, pseudocount=0.0):
"""
Initializes the probability of read origin according to the alignment profile
:param pseudocount: Uniform prior for allele specificity estimation
:return: Nothing (as it performs an in-place operations)
"""
self.probability.reset()
... | def reset(self, pseudocount=0.0):
"""
Initializes the probability of read origin according to the alignment profile
:param pseudocount: Uniform prior for allele specificity estimation
:return: Nothing (as it performs an in-place operations)
"""
self.probability.reset()
... | [
"Initializes",
"the",
"probability",
"of",
"read",
"origin",
"according",
"to",
"the",
"alignment",
"profile"
] | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/EMfactory.py#L72-L88 | [
"def",
"reset",
"(",
"self",
",",
"pseudocount",
"=",
"0.0",
")",
":",
"self",
".",
"probability",
".",
"reset",
"(",
")",
"self",
".",
"probability",
".",
"normalize_reads",
"(",
"axis",
"=",
"APM",
".",
"Axis",
".",
"READ",
")",
"# Initialize alignment... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | EMfactory.update_probability_at_read_level | Updates the probability of read origin at read level
:param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)
:return: Nothing (as it performs in-place operations) | emase/EMfactory.py | def update_probability_at_read_level(self, model=3):
"""
Updates the probability of read origin at read level
:param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)
:return: Nothing (as it performs in-place... | def update_probability_at_read_level(self, model=3):
"""
Updates the probability of read origin at read level
:param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)
:return: Nothing (as it performs in-place... | [
"Updates",
"the",
"probability",
"of",
"read",
"origin",
"at",
"read",
"level"
] | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/EMfactory.py#L96-L128 | [
"def",
"update_probability_at_read_level",
"(",
"self",
",",
"model",
"=",
"3",
")",
":",
"self",
".",
"probability",
".",
"reset",
"(",
")",
"# reset to alignment incidence matrix",
"if",
"model",
"==",
"1",
":",
"self",
".",
"probability",
".",
"multiply",
"... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | EMfactory.update_allelic_expression | A single EM step: Update probability at read level and then re-estimate allelic specific expression
:param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)
:return: Nothing (as it performs in-place operations) | emase/EMfactory.py | def update_allelic_expression(self, model=3):
"""
A single EM step: Update probability at read level and then re-estimate allelic specific expression
:param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)
:... | def update_allelic_expression(self, model=3):
"""
A single EM step: Update probability at read level and then re-estimate allelic specific expression
:param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)
:... | [
"A",
"single",
"EM",
"step",
":",
"Update",
"probability",
"at",
"read",
"level",
"and",
"then",
"re",
"-",
"estimate",
"allelic",
"specific",
"expression"
] | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/EMfactory.py#L130-L140 | [
"def",
"update_allelic_expression",
"(",
"self",
",",
"model",
"=",
"3",
")",
":",
"self",
".",
"update_probability_at_read_level",
"(",
"model",
")",
"self",
".",
"allelic_expression",
"=",
"self",
".",
"probability",
".",
"sum",
"(",
"axis",
"=",
"APM",
".... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | EMfactory.run | Runs EM iterations
:param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)
:param tol: Tolerance for termination
:param max_iters: Maximum number of iterations until termination
:param verbose: Display infor... | emase/EMfactory.py | def run(self, model, tol=0.001, max_iters=999, verbose=True):
"""
Runs EM iterations
:param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)
:param tol: Tolerance for termination
:param max_iters: Ma... | def run(self, model, tol=0.001, max_iters=999, verbose=True):
"""
Runs EM iterations
:param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)
:param tol: Tolerance for termination
:param max_iters: Ma... | [
"Runs",
"EM",
"iterations"
] | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/EMfactory.py#L142-L175 | [
"def",
"run",
"(",
"self",
",",
"model",
",",
"tol",
"=",
"0.001",
",",
"max_iters",
"=",
"999",
",",
"verbose",
"=",
"True",
")",
":",
"orig_err_states",
"=",
"np",
".",
"seterr",
"(",
"all",
"=",
"'raise'",
")",
"np",
".",
"seterr",
"(",
"under",... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | EMfactory.report_read_counts | Exports expected read counts
:param filename: File name for output
:param grp_wise: whether the report is at isoform level or gene level
:param reorder: whether the report should be either 'decreasing' or 'increasing' order or just 'as-is'
:return: Nothing but the method writes a file | emase/EMfactory.py | def report_read_counts(self, filename, grp_wise=False, reorder='as-is', notes=None):
"""
Exports expected read counts
:param filename: File name for output
:param grp_wise: whether the report is at isoform level or gene level
:param reorder: whether the report should be either '... | def report_read_counts(self, filename, grp_wise=False, reorder='as-is', notes=None):
"""
Exports expected read counts
:param filename: File name for output
:param grp_wise: whether the report is at isoform level or gene level
:param reorder: whether the report should be either '... | [
"Exports",
"expected",
"read",
"counts"
] | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/EMfactory.py#L177-L212 | [
"def",
"report_read_counts",
"(",
"self",
",",
"filename",
",",
"grp_wise",
"=",
"False",
",",
"reorder",
"=",
"'as-is'",
",",
"notes",
"=",
"None",
")",
":",
"expected_read_counts",
"=",
"self",
".",
"probability",
".",
"sum",
"(",
"axis",
"=",
"APM",
"... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | EMfactory.report_depths | Exports expected depths
:param filename: File name for output
:param grp_wise: whether the report is at isoform level or gene level
:param reorder: whether the report should be either 'decreasing' or 'increasing' order or just 'as-is'
:return: Nothing but the method writes a file | emase/EMfactory.py | def report_depths(self, filename, tpm=True, grp_wise=False, reorder='as-is', notes=None):
"""
Exports expected depths
:param filename: File name for output
:param grp_wise: whether the report is at isoform level or gene level
:param reorder: whether the report should be either '... | def report_depths(self, filename, tpm=True, grp_wise=False, reorder='as-is', notes=None):
"""
Exports expected depths
:param filename: File name for output
:param grp_wise: whether the report is at isoform level or gene level
:param reorder: whether the report should be either '... | [
"Exports",
"expected",
"depths"
] | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/EMfactory.py#L214-L251 | [
"def",
"report_depths",
"(",
"self",
",",
"filename",
",",
"tpm",
"=",
"True",
",",
"grp_wise",
"=",
"False",
",",
"reorder",
"=",
"'as-is'",
",",
"notes",
"=",
"None",
")",
":",
"if",
"grp_wise",
":",
"lname",
"=",
"self",
".",
"probability",
".",
"... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | EMfactory.export_posterior_probability | Writes the posterior probability of read origin
:param filename: File name for output
:param title: The title of the posterior probability matrix
:return: Nothing but the method writes a file in EMASE format (PyTables) | emase/EMfactory.py | def export_posterior_probability(self, filename, title="Posterior Probability"):
"""
Writes the posterior probability of read origin
:param filename: File name for output
:param title: The title of the posterior probability matrix
:return: Nothing but the method writes a file in... | def export_posterior_probability(self, filename, title="Posterior Probability"):
"""
Writes the posterior probability of read origin
:param filename: File name for output
:param title: The title of the posterior probability matrix
:return: Nothing but the method writes a file in... | [
"Writes",
"the",
"posterior",
"probability",
"of",
"read",
"origin"
] | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/EMfactory.py#L253-L261 | [
"def",
"export_posterior_probability",
"(",
"self",
",",
"filename",
",",
"title",
"=",
"\"Posterior Probability\"",
")",
":",
"self",
".",
"probability",
".",
"save",
"(",
"h5file",
"=",
"filename",
",",
"title",
"=",
"title",
")"
] | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | AlignmentPropertyMatrix.bundle | Returns ``AlignmentPropertyMatrix`` object in which loci are bundled using grouping information.
:param reset: whether to reset the values at the loci
:param shallow: whether to copy all the meta data | emase/AlignmentPropertyMatrix.py | def bundle(self, reset=False, shallow=False): # Copies the original matrix (Use lots of memory)
"""
Returns ``AlignmentPropertyMatrix`` object in which loci are bundled using grouping information.
:param reset: whether to reset the values at the loci
:param shallow: whether to copy... | def bundle(self, reset=False, shallow=False): # Copies the original matrix (Use lots of memory)
"""
Returns ``AlignmentPropertyMatrix`` object in which loci are bundled using grouping information.
:param reset: whether to reset the values at the loci
:param shallow: whether to copy... | [
"Returns",
"AlignmentPropertyMatrix",
"object",
"in",
"which",
"loci",
"are",
"bundled",
"using",
"grouping",
"information",
".",
":",
"param",
"reset",
":",
"whether",
"to",
"reset",
"the",
"values",
"at",
"the",
"loci",
":",
"param",
"shallow",
":",
"whether... | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/AlignmentPropertyMatrix.py#L141-L171 | [
"def",
"bundle",
"(",
"self",
",",
"reset",
"=",
"False",
",",
"shallow",
"=",
"False",
")",
":",
"# Copies the original matrix (Use lots of memory)\r",
"if",
"self",
".",
"finalized",
":",
"# if self.num_groups > 0:\r",
"if",
"self",
".",
"groups",
"is",
"not",
... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | AlignmentPropertyMatrix.normalize_reads | Read-wise normalization
:param axis: The dimension along which we want to normalize values
:param grouping_mat: An incidence matrix that specifies which isoforms are from a same gene
:return: Nothing (as the method performs in-place operations)
:rtype: None | emase/AlignmentPropertyMatrix.py | def normalize_reads(self, axis, grouping_mat=None):
"""
Read-wise normalization
:param axis: The dimension along which we want to normalize values
:param grouping_mat: An incidence matrix that specifies which isoforms are from a same gene
:return: Nothing (as the method pe... | def normalize_reads(self, axis, grouping_mat=None):
"""
Read-wise normalization
:param axis: The dimension along which we want to normalize values
:param grouping_mat: An incidence matrix that specifies which isoforms are from a same gene
:return: Nothing (as the method pe... | [
"Read",
"-",
"wise",
"normalization",
":",
"param",
"axis",
":",
"The",
"dimension",
"along",
"which",
"we",
"want",
"to",
"normalize",
"values",
":",
"param",
"grouping_mat",
":",
"An",
"incidence",
"matrix",
"that",
"specifies",
"which",
"isoforms",
"are",
... | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/AlignmentPropertyMatrix.py#L236-L280 | [
"def",
"normalize_reads",
"(",
"self",
",",
"axis",
",",
"grouping_mat",
"=",
"None",
")",
":",
"if",
"self",
".",
"finalized",
":",
"if",
"axis",
"==",
"self",
".",
"Axis",
".",
"LOCUS",
":",
"# Locus-wise normalization on each read\r",
"normalizer",
"=",
"... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | AlignmentPropertyMatrix.pull_alignments_from | Pull out alignments of certain reads
:param reads_to_use: numpy array of dtype=bool specifying which reads to use
:param shallow: whether to copy sparse 3D matrix only or not
:return: a new AlignmentPropertyMatrix object that particular reads are | emase/AlignmentPropertyMatrix.py | def pull_alignments_from(self, reads_to_use, shallow=False):
"""
Pull out alignments of certain reads
:param reads_to_use: numpy array of dtype=bool specifying which reads to use
:param shallow: whether to copy sparse 3D matrix only or not
:return: a new AlignmentPropertyM... | def pull_alignments_from(self, reads_to_use, shallow=False):
"""
Pull out alignments of certain reads
:param reads_to_use: numpy array of dtype=bool specifying which reads to use
:param shallow: whether to copy sparse 3D matrix only or not
:return: a new AlignmentPropertyM... | [
"Pull",
"out",
"alignments",
"of",
"certain",
"reads",
":",
"param",
"reads_to_use",
":",
"numpy",
"array",
"of",
"dtype",
"=",
"bool",
"specifying",
"which",
"reads",
"to",
"use",
":",
"param",
"shallow",
":",
"whether",
"to",
"copy",
"sparse",
"3D",
"mat... | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/AlignmentPropertyMatrix.py#L282-L297 | [
"def",
"pull_alignments_from",
"(",
"self",
",",
"reads_to_use",
",",
"shallow",
"=",
"False",
")",
":",
"new_alnmat",
"=",
"self",
".",
"copy",
"(",
"shallow",
"=",
"shallow",
")",
"for",
"hid",
"in",
"xrange",
"(",
"self",
".",
"num_haplotypes",
")",
"... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | AlignmentPropertyMatrix.get_unique_reads | Pull out alignments of uniquely-aligning reads
:param ignore_haplotype: whether to regard allelic multiread as uniquely-aligning read
:param shallow: whether to copy sparse 3D matrix only or not
:return: a new AlignmentPropertyMatrix object that particular reads are | emase/AlignmentPropertyMatrix.py | def get_unique_reads(self, ignore_haplotype=False, shallow=False):
"""
Pull out alignments of uniquely-aligning reads
:param ignore_haplotype: whether to regard allelic multiread as uniquely-aligning read
:param shallow: whether to copy sparse 3D matrix only or not
:return... | def get_unique_reads(self, ignore_haplotype=False, shallow=False):
"""
Pull out alignments of uniquely-aligning reads
:param ignore_haplotype: whether to regard allelic multiread as uniquely-aligning read
:param shallow: whether to copy sparse 3D matrix only or not
:return... | [
"Pull",
"out",
"alignments",
"of",
"uniquely",
"-",
"aligning",
"reads",
":",
"param",
"ignore_haplotype",
":",
"whether",
"to",
"regard",
"allelic",
"multiread",
"as",
"uniquely",
"-",
"aligning",
"read",
":",
"param",
"shallow",
":",
"whether",
"to",
"copy",... | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/AlignmentPropertyMatrix.py#L299-L317 | [
"def",
"get_unique_reads",
"(",
"self",
",",
"ignore_haplotype",
"=",
"False",
",",
"shallow",
"=",
"False",
")",
":",
"if",
"self",
".",
"finalized",
":",
"if",
"ignore_haplotype",
":",
"summat",
"=",
"self",
".",
"sum",
"(",
"axis",
"=",
"self",
".",
... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | AlignmentPropertyMatrix.print_read | Prints nonzero rows of the read wanted | emase/AlignmentPropertyMatrix.py | def print_read(self, rid):
"""
Prints nonzero rows of the read wanted
"""
if self.rname is not None:
print self.rname[rid]
print '--'
r = self.get_read_data(rid)
aligned_loci = np.unique(r.nonzero()[1])
for locus in aligned_loci:... | def print_read(self, rid):
"""
Prints nonzero rows of the read wanted
"""
if self.rname is not None:
print self.rname[rid]
print '--'
r = self.get_read_data(rid)
aligned_loci = np.unique(r.nonzero()[1])
for locus in aligned_loci:... | [
"Prints",
"nonzero",
"rows",
"of",
"the",
"read",
"wanted"
] | churchill-lab/emase | python | https://github.com/churchill-lab/emase/blob/ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449/emase/AlignmentPropertyMatrix.py#L388-L404 | [
"def",
"print_read",
"(",
"self",
",",
"rid",
")",
":",
"if",
"self",
".",
"rname",
"is",
"not",
"None",
":",
"print",
"self",
".",
"rname",
"[",
"rid",
"]",
"print",
"'--'",
"r",
"=",
"self",
".",
"get_read_data",
"(",
"rid",
")",
"aligned_loci",
... | ae3c6955bb175c1dec88dbf9fac1a7dcc16f4449 |
valid | RomanScheme.get_standard_form | Roman schemes define multiple representations of the same devanAgarI character. This method gets a library-standard representation.
data : a text in the given scheme. | indic_transliteration/sanscript/schemes/roman.py | def get_standard_form(self, data):
"""Roman schemes define multiple representations of the same devanAgarI character. This method gets a library-standard representation.
data : a text in the given scheme.
"""
if self.synonym_map is None:
return data
from indi... | def get_standard_form(self, data):
"""Roman schemes define multiple representations of the same devanAgarI character. This method gets a library-standard representation.
data : a text in the given scheme.
"""
if self.synonym_map is None:
return data
from indi... | [
"Roman",
"schemes",
"define",
"multiple",
"representations",
"of",
"the",
"same",
"devanAgarI",
"character",
".",
"This",
"method",
"gets",
"a",
"library",
"-",
"standard",
"representation",
".",
"data",
":",
"a",
"text",
"in",
"the",
"given",
"scheme",
"."
] | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration/sanscript/schemes/roman.py#L30-L38 | [
"def",
"get_standard_form",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"synonym_map",
"is",
"None",
":",
"return",
"data",
"from",
"indic_transliteration",
"import",
"sanscript",
"return",
"sanscript",
".",
"transliterate",
"(",
"data",
"=",
"sansc... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | _roman | Transliterate `data` with the given `scheme_map`. This function is used
when the source scheme is a Roman scheme.
:param data: the data to transliterate
:param scheme_map: a dict that maps between characters in the old scheme
and characters in the new scheme | indic_transliteration/sanscript/roman_mapper.py | def _roman(data, scheme_map, **kw):
"""Transliterate `data` with the given `scheme_map`. This function is used
when the source scheme is a Roman scheme.
:param data: the data to transliterate
:param scheme_map: a dict that maps between characters in the old scheme
and characters in the new... | def _roman(data, scheme_map, **kw):
"""Transliterate `data` with the given `scheme_map`. This function is used
when the source scheme is a Roman scheme.
:param data: the data to transliterate
:param scheme_map: a dict that maps between characters in the old scheme
and characters in the new... | [
"Transliterate",
"data",
"with",
"the",
"given",
"scheme_map",
".",
"This",
"function",
"is",
"used",
"when",
"the",
"source",
"scheme",
"is",
"a",
"Roman",
"scheme",
"."
] | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration/sanscript/roman_mapper.py#L1-L103 | [
"def",
"_roman",
"(",
"data",
",",
"scheme_map",
",",
"*",
"*",
"kw",
")",
":",
"vowels",
"=",
"scheme_map",
".",
"vowels",
"marks",
"=",
"scheme_map",
".",
"marks",
"virama",
"=",
"scheme_map",
".",
"virama",
"consonants",
"=",
"scheme_map",
".",
"conso... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | get_approx_deduplicating_key | Given some devanAgarI sanskrit text, this function produces a "key" so
that
1] The key should be the same for different observed orthographical
forms of the same text. For example:
::
- "dharmma" vs "dharma"
- "rAmaM gacChati" vs "rAma~N gacChati" vs "rAma~N gacChati"
- ... | indic_transliteration/deduplication.py | def get_approx_deduplicating_key(text, encoding_scheme=sanscript.DEVANAGARI):
"""
Given some devanAgarI sanskrit text, this function produces a "key" so
that
1] The key should be the same for different observed orthographical
forms of the same text. For example:
::
- "dharmma" v... | def get_approx_deduplicating_key(text, encoding_scheme=sanscript.DEVANAGARI):
"""
Given some devanAgarI sanskrit text, this function produces a "key" so
that
1] The key should be the same for different observed orthographical
forms of the same text. For example:
::
- "dharmma" v... | [
"Given",
"some",
"devanAgarI",
"sanskrit",
"text",
"this",
"function",
"produces",
"a",
"key",
"so",
"that",
"1",
"]",
"The",
"key",
"should",
"be",
"the",
"same",
"for",
"different",
"observed",
"orthographical",
"forms",
"of",
"the",
"same",
"text",
".",
... | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration/deduplication.py#L13-L82 | [
"def",
"get_approx_deduplicating_key",
"(",
"text",
",",
"encoding_scheme",
"=",
"sanscript",
".",
"DEVANAGARI",
")",
":",
"if",
"encoding_scheme",
"==",
"sanscript",
".",
"DEVANAGARI",
":",
"key",
"=",
"text",
"key",
"=",
"regex",
".",
"sub",
"(",
"\"\\\\P{Is... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | _brahmic | Transliterate `data` with the given `scheme_map`. This function is used
when the source scheme is a Brahmic scheme.
:param data: the data to transliterate
:param scheme_map: a dict that maps between characters in the old scheme
and characters in the new scheme | indic_transliteration/sanscript/brahmic_mapper.py | def _brahmic(data, scheme_map, **kw):
"""Transliterate `data` with the given `scheme_map`. This function is used
when the source scheme is a Brahmic scheme.
:param data: the data to transliterate
:param scheme_map: a dict that maps between characters in the old scheme
and characters in the... | def _brahmic(data, scheme_map, **kw):
"""Transliterate `data` with the given `scheme_map`. This function is used
when the source scheme is a Brahmic scheme.
:param data: the data to transliterate
:param scheme_map: a dict that maps between characters in the old scheme
and characters in the... | [
"Transliterate",
"data",
"with",
"the",
"given",
"scheme_map",
".",
"This",
"function",
"is",
"used",
"when",
"the",
"source",
"scheme",
"is",
"a",
"Brahmic",
"scheme",
"."
] | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration/sanscript/brahmic_mapper.py#L4-L81 | [
"def",
"_brahmic",
"(",
"data",
",",
"scheme_map",
",",
"*",
"*",
"kw",
")",
":",
"if",
"scheme_map",
".",
"from_scheme",
".",
"name",
"==",
"northern",
".",
"GURMUKHI",
":",
"data",
"=",
"northern",
".",
"GurmukhiScheme",
".",
"replace_tippi",
"(",
"tex... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | transliterate | Transliterate `data` with the given parameters::
output = transliterate('idam adbhutam', HK, DEVANAGARI)
Each time the function is called, a new :class:`SchemeMap` is created
to map the input scheme to the output scheme. This operation is fast
enough for most use cases. But for higher performance, you can... | indic_transliteration/sanscript/__init__.py | def transliterate(data, _from=None, _to=None, scheme_map=None, **kw):
"""Transliterate `data` with the given parameters::
output = transliterate('idam adbhutam', HK, DEVANAGARI)
Each time the function is called, a new :class:`SchemeMap` is created
to map the input scheme to the output scheme. This operati... | def transliterate(data, _from=None, _to=None, scheme_map=None, **kw):
"""Transliterate `data` with the given parameters::
output = transliterate('idam adbhutam', HK, DEVANAGARI)
Each time the function is called, a new :class:`SchemeMap` is created
to map the input scheme to the output scheme. This operati... | [
"Transliterate",
"data",
"with",
"the",
"given",
"parameters",
"::"
] | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration/sanscript/__init__.py#L202-L232 | [
"def",
"transliterate",
"(",
"data",
",",
"_from",
"=",
"None",
",",
"_to",
"=",
"None",
",",
"scheme_map",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"if",
"scheme_map",
"is",
"None",
":",
"scheme_map",
"=",
"_get_scheme_map",
"(",
"_from",
",",
"_... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | detect | Detect the input's transliteration scheme.
:param text: some text data, either a `unicode` or a `str` encoded
in UTF-8. | indic_transliteration/detect.py | def detect(text):
"""Detect the input's transliteration scheme.
:param text: some text data, either a `unicode` or a `str` encoded
in UTF-8.
"""
if sys.version_info < (3, 0):
# Verify encoding
try:
text = text.decode('utf-8')
except UnicodeError:
pass
# Brahmic s... | def detect(text):
"""Detect the input's transliteration scheme.
:param text: some text data, either a `unicode` or a `str` encoded
in UTF-8.
"""
if sys.version_info < (3, 0):
# Verify encoding
try:
text = text.decode('utf-8')
except UnicodeError:
pass
# Brahmic s... | [
"Detect",
"the",
"input",
"s",
"transliteration",
"scheme",
"."
] | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration/detect.py#L127-L167 | [
"def",
"detect",
"(",
"text",
")",
":",
"if",
"sys",
".",
"version_info",
"<",
"(",
"3",
",",
"0",
")",
":",
"# Verify encoding",
"try",
":",
"text",
"=",
"text",
".",
"decode",
"(",
"'utf-8'",
")",
"except",
"UnicodeError",
":",
"pass",
"# Brahmic sch... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | transliterate | Transliterate `data` with the given parameters::
output = transliterate('idam adbhutam', HK, DEVANAGARI)
Each time the function is called, a new :class:`SchemeMap` is created
to map the input scheme to the output scheme. This operation is fast
enough for most use cases. But for higher performance, y... | indic_transliteration/xsanscript.py | def transliterate(data, _from=None, _to=None, scheme_map=None, **kw):
"""Transliterate `data` with the given parameters::
output = transliterate('idam adbhutam', HK, DEVANAGARI)
Each time the function is called, a new :class:`SchemeMap` is created
to map the input scheme to the output scheme. This... | def transliterate(data, _from=None, _to=None, scheme_map=None, **kw):
"""Transliterate `data` with the given parameters::
output = transliterate('idam adbhutam', HK, DEVANAGARI)
Each time the function is called, a new :class:`SchemeMap` is created
to map the input scheme to the output scheme. This... | [
"Transliterate",
"data",
"with",
"the",
"given",
"parameters",
"::",
"output",
"=",
"transliterate",
"(",
"idam",
"adbhutam",
"HK",
"DEVANAGARI",
")",
"Each",
"time",
"the",
"function",
"is",
"called",
"a",
"new",
":",
"class",
":",
"SchemeMap",
"is",
"creat... | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration/xsanscript.py#L33-L57 | [
"def",
"transliterate",
"(",
"data",
",",
"_from",
"=",
"None",
",",
"_to",
"=",
"None",
",",
"scheme_map",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"if",
"scheme_map",
"is",
"None",
":",
"from_scheme",
"=",
"SCHEMES",
"[",
"_from",
"]",
"to_schem... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | _setup | Add a variety of default schemes. | indic_transliteration/xsanscript.py | def _setup():
"""Add a variety of default schemes."""
s = str.split
if sys.version_info < (3, 0):
# noinspection PyUnresolvedReferences
s = unicode.split
def pop_all(some_dict, some_list):
for scheme in some_list:
some_dict.pop(scheme)
global SCHEMES
... | def _setup():
"""Add a variety of default schemes."""
s = str.split
if sys.version_info < (3, 0):
# noinspection PyUnresolvedReferences
s = unicode.split
def pop_all(some_dict, some_list):
for scheme in some_list:
some_dict.pop(scheme)
global SCHEMES
... | [
"Add",
"a",
"variety",
"of",
"default",
"schemes",
"."
] | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration/xsanscript.py#L60-L89 | [
"def",
"_setup",
"(",
")",
":",
"s",
"=",
"str",
".",
"split",
"if",
"sys",
".",
"version_info",
"<",
"(",
"3",
",",
"0",
")",
":",
"# noinspection PyUnresolvedReferences\r",
"s",
"=",
"unicode",
".",
"split",
"def",
"pop_all",
"(",
"some_dict",
",",
"... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | to_utf8 | converts an array of integers to utf8 string | indic_transliteration_unmaintained/iscii2utf8.py | def to_utf8(y):
"""
converts an array of integers to utf8 string
"""
out = []
for x in y:
if x < 0x080:
out.append(x)
elif x < 0x0800:
out.append((x >> 6) | 0xC0)
out.append((x & 0x3F) | 0x80)
elif x < 0x10000:
out.append((x ... | def to_utf8(y):
"""
converts an array of integers to utf8 string
"""
out = []
for x in y:
if x < 0x080:
out.append(x)
elif x < 0x0800:
out.append((x >> 6) | 0xC0)
out.append((x & 0x3F) | 0x80)
elif x < 0x10000:
out.append((x ... | [
"converts",
"an",
"array",
"of",
"integers",
"to",
"utf8",
"string"
] | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration_unmaintained/iscii2utf8.py#L423-L447 | [
"def",
"to_utf8",
"(",
"y",
")",
":",
"out",
"=",
"[",
"]",
"for",
"x",
"in",
"y",
":",
"if",
"x",
"<",
"0x080",
":",
"out",
".",
"append",
"(",
"x",
")",
"elif",
"x",
"<",
"0x0800",
":",
"out",
".",
"append",
"(",
"(",
"x",
">>",
"6",
")... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | Parser.set_script | set the value of delta to reflect the current codepage | indic_transliteration_unmaintained/iscii2utf8.py | def set_script(self, i):
"""
set the value of delta to reflect the current codepage
"""
if i in range(1, 10):
n = i - 1
else:
raise IllegalInput("Invalid Value for ATR %s" % (hex(i)))
if n > -1: # n = -1 is the default script ..
... | def set_script(self, i):
"""
set the value of delta to reflect the current codepage
"""
if i in range(1, 10):
n = i - 1
else:
raise IllegalInput("Invalid Value for ATR %s" % (hex(i)))
if n > -1: # n = -1 is the default script ..
... | [
"set",
"the",
"value",
"of",
"delta",
"to",
"reflect",
"the",
"current",
"codepage"
] | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration_unmaintained/iscii2utf8.py#L480-L495 | [
"def",
"set_script",
"(",
"self",
",",
"i",
")",
":",
"if",
"i",
"in",
"range",
"(",
"1",
",",
"10",
")",
":",
"n",
"=",
"i",
"-",
"1",
"else",
":",
"raise",
"IllegalInput",
"(",
"\"Invalid Value for ATR %s\"",
"%",
"(",
"hex",
"(",
"i",
")",
")"... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | _unrecognised | Handle unrecognised characters. | indic_transliteration_unmaintained/little/transliterator_tam.py | def _unrecognised(chr):
""" Handle unrecognised characters. """
if options['handleUnrecognised'] == UNRECOGNISED_ECHO:
return chr
elif options['handleUnrecognised'] == UNRECOGNISED_SUBSTITUTE:
return options['substituteChar']
else:
raise (KeyError, chr) | def _unrecognised(chr):
""" Handle unrecognised characters. """
if options['handleUnrecognised'] == UNRECOGNISED_ECHO:
return chr
elif options['handleUnrecognised'] == UNRECOGNISED_SUBSTITUTE:
return options['substituteChar']
else:
raise (KeyError, chr) | [
"Handle",
"unrecognised",
"characters",
"."
] | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration_unmaintained/little/transliterator_tam.py#L139-L146 | [
"def",
"_unrecognised",
"(",
"chr",
")",
":",
"if",
"options",
"[",
"'handleUnrecognised'",
"]",
"==",
"UNRECOGNISED_ECHO",
":",
"return",
"chr",
"elif",
"options",
"[",
"'handleUnrecognised'",
"]",
"==",
"UNRECOGNISED_SUBSTITUTE",
":",
"return",
"options",
"[",
... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | main | Call transliterator from a command line.
python transliterator.py text inputFormat outputFormat
... writes the transliterated text to stdout
text -- the text to be transliterated OR the name of a file containing the text
inputFormat -- the name of the character block or transliteration sc... | indic_transliteration_unmaintained/little/transliterator_tam.py | def main(argv=None):
""" Call transliterator from a command line.
python transliterator.py text inputFormat outputFormat
... writes the transliterated text to stdout
text -- the text to be transliterated OR the name of a file containing the text
inputFormat -- the name of the characte... | def main(argv=None):
""" Call transliterator from a command line.
python transliterator.py text inputFormat outputFormat
... writes the transliterated text to stdout
text -- the text to be transliterated OR the name of a file containing the text
inputFormat -- the name of the characte... | [
"Call",
"transliterator",
"from",
"a",
"command",
"line",
".",
"python",
"transliterator",
".",
"py",
"text",
"inputFormat",
"outputFormat",
"...",
"writes",
"the",
"transliterated",
"text",
"to",
"stdout",
"text",
"--",
"the",
"text",
"to",
"be",
"transliterate... | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration_unmaintained/little/transliterator_tam.py#L1040-L1080 | [
"def",
"main",
"(",
"argv",
"=",
"None",
")",
":",
"print",
"(",
"transliterate",
"(",
"'jaya gaNeza! zrIrAmajayam'",
",",
"'harvardkyoto'",
",",
"'devanagari'",
")",
")",
"if",
"argv",
"is",
"None",
":",
"argv",
"=",
"sys",
".",
"argv",
"try",
":",
"tex... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | _Devanagari._transliterate | Transliterate a devanagari text into the target format.
Transliterating a character to or from Devanagari is not a simple
lookup: it depends on the preceding and following characters. | indic_transliteration_unmaintained/little/transliterator_tam.py | def _transliterate(self, text, outFormat):
""" Transliterate a devanagari text into the target format.
Transliterating a character to or from Devanagari is not a simple
lookup: it depends on the preceding and following characters.
"""
def getResult():
if cu... | def _transliterate(self, text, outFormat):
""" Transliterate a devanagari text into the target format.
Transliterating a character to or from Devanagari is not a simple
lookup: it depends on the preceding and following characters.
"""
def getResult():
if cu... | [
"Transliterate",
"a",
"devanagari",
"text",
"into",
"the",
"target",
"format",
".",
"Transliterating",
"a",
"character",
"to",
"or",
"from",
"Devanagari",
"is",
"not",
"a",
"simple",
"lookup",
":",
"it",
"depends",
"on",
"the",
"preceding",
"and",
"following",... | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration_unmaintained/little/transliterator_tam.py#L526-L575 | [
"def",
"_transliterate",
"(",
"self",
",",
"text",
",",
"outFormat",
")",
":",
"def",
"getResult",
"(",
")",
":",
"if",
"curMatch",
".",
"isspace",
"(",
")",
":",
"result",
".",
"append",
"(",
"curMatch",
")",
"return",
"if",
"prevMatch",
"in",
"self",... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | DevanagariCharacterBlock._equivalent | Transliterate a Latin character equivalent to Devanagari.
Add VIRAMA for ligatures.
Convert standalone to dependent vowels. | indic_transliteration_unmaintained/little/transliterator_tam.py | def _equivalent(self, char, prev, next, implicitA):
""" Transliterate a Latin character equivalent to Devanagari.
Add VIRAMA for ligatures.
Convert standalone to dependent vowels.
"""
result = []
if char.isVowel == False:
result.append(char.c... | def _equivalent(self, char, prev, next, implicitA):
""" Transliterate a Latin character equivalent to Devanagari.
Add VIRAMA for ligatures.
Convert standalone to dependent vowels.
"""
result = []
if char.isVowel == False:
result.append(char.c... | [
"Transliterate",
"a",
"Latin",
"character",
"equivalent",
"to",
"Devanagari",
".",
"Add",
"VIRAMA",
"for",
"ligatures",
".",
"Convert",
"standalone",
"to",
"dependent",
"vowels",
"."
] | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration_unmaintained/little/transliterator_tam.py#L598-L618 | [
"def",
"_equivalent",
"(",
"self",
",",
"char",
",",
"prev",
",",
"next",
",",
"implicitA",
")",
":",
"result",
"=",
"[",
"]",
"if",
"char",
".",
"isVowel",
"==",
"False",
":",
"result",
".",
"append",
"(",
"char",
".",
"chr",
")",
"if",
"char",
... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | Scheme.from_devanagari | A convenience method | indic_transliteration/sanscript/schemes/__init__.py | def from_devanagari(self, data):
"""A convenience method"""
from indic_transliteration import sanscript
return sanscript.transliterate(data=data, _from=sanscript.DEVANAGARI, _to=self.name) | def from_devanagari(self, data):
"""A convenience method"""
from indic_transliteration import sanscript
return sanscript.transliterate(data=data, _from=sanscript.DEVANAGARI, _to=self.name) | [
"A",
"convenience",
"method"
] | sanskrit-coders/indic_transliteration | python | https://github.com/sanskrit-coders/indic_transliteration/blob/b7c5166a275c15a612fbb96fd3d765bc9004b299/indic_transliteration/sanscript/schemes/__init__.py#L29-L32 | [
"def",
"from_devanagari",
"(",
"self",
",",
"data",
")",
":",
"from",
"indic_transliteration",
"import",
"sanscript",
"return",
"sanscript",
".",
"transliterate",
"(",
"data",
"=",
"data",
",",
"_from",
"=",
"sanscript",
".",
"DEVANAGARI",
",",
"_to",
"=",
"... | b7c5166a275c15a612fbb96fd3d765bc9004b299 |
valid | generate | Load and generate ``num`` number of top-level rules from the specified grammar.
:param list grammar: The grammar file to load and generate data from
:param int num: The number of times to generate data
:param output: The output destination (an open, writable stream-type object. default=``sys.stdout``)
... | examples/example.py | def generate(grammar=None, num=1, output=sys.stdout, max_recursion=10, seed=None):
"""Load and generate ``num`` number of top-level rules from the specified grammar.
:param list grammar: The grammar file to load and generate data from
:param int num: The number of times to generate data
:param output: ... | def generate(grammar=None, num=1, output=sys.stdout, max_recursion=10, seed=None):
"""Load and generate ``num`` number of top-level rules from the specified grammar.
:param list grammar: The grammar file to load and generate data from
:param int num: The number of times to generate data
:param output: ... | [
"Load",
"and",
"generate",
"num",
"number",
"of",
"top",
"-",
"level",
"rules",
"from",
"the",
"specified",
"grammar",
"."
] | d0c-s4vage/gramfuzz | python | https://github.com/d0c-s4vage/gramfuzz/blob/023727ac8744ae026d1105cc97c152bdf3abb8d6/examples/example.py#L18-L37 | [
"def",
"generate",
"(",
"grammar",
"=",
"None",
",",
"num",
"=",
"1",
",",
"output",
"=",
"sys",
".",
"stdout",
",",
"max_recursion",
"=",
"10",
",",
"seed",
"=",
"None",
")",
":",
"if",
"seed",
"is",
"not",
"None",
":",
"gramfuzz",
".",
"rand",
... | 023727ac8744ae026d1105cc97c152bdf3abb8d6 |
valid | Q.build | Build the ``Quote`` instance
:param list pre: The prerequisites list
:param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated. | gramfuzz/fields.py | def build(self, pre=None, shortest=False):
"""Build the ``Quote`` instance
:param list pre: The prerequisites list
:param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
"""
res = super(Q, self).build(pre, short... | def build(self, pre=None, shortest=False):
"""Build the ``Quote`` instance
:param list pre: The prerequisites list
:param bool shortest: Whether or not the shortest reference-chain (most minimal) version of the field should be generated.
"""
res = super(Q, self).build(pre, short... | [
"Build",
"the",
"Quote",
"instance"
] | d0c-s4vage/gramfuzz | python | https://github.com/d0c-s4vage/gramfuzz/blob/023727ac8744ae026d1105cc97c152bdf3abb8d6/gramfuzz/fields.py#L491-L504 | [
"def",
"build",
"(",
"self",
",",
"pre",
"=",
"None",
",",
"shortest",
"=",
"False",
")",
":",
"res",
"=",
"super",
"(",
"Q",
",",
"self",
")",
".",
"build",
"(",
"pre",
",",
"shortest",
"=",
"shortest",
")",
"if",
"self",
".",
"escape",
":",
"... | 023727ac8744ae026d1105cc97c152bdf3abb8d6 |
valid | make_present_participles | Make the list of verbs into present participles
E.g.:
empower -> empowering
drive -> driving | examples/grams/bizbs.py | def make_present_participles(verbs):
"""Make the list of verbs into present participles
E.g.:
empower -> empowering
drive -> driving
"""
res = []
for verb in verbs:
parts = verb.split()
if parts[0].endswith("e"):
parts[0] = parts[0][:-1] + "ing"
... | def make_present_participles(verbs):
"""Make the list of verbs into present participles
E.g.:
empower -> empowering
drive -> driving
"""
res = []
for verb in verbs:
parts = verb.split()
if parts[0].endswith("e"):
parts[0] = parts[0][:-1] + "ing"
... | [
"Make",
"the",
"list",
"of",
"verbs",
"into",
"present",
"participles"
] | d0c-s4vage/gramfuzz | python | https://github.com/d0c-s4vage/gramfuzz/blob/023727ac8744ae026d1105cc97c152bdf3abb8d6/examples/grams/bizbs.py#L32-L48 | [
"def",
"make_present_participles",
"(",
"verbs",
")",
":",
"res",
"=",
"[",
"]",
"for",
"verb",
"in",
"verbs",
":",
"parts",
"=",
"verb",
".",
"split",
"(",
")",
"if",
"parts",
"[",
"0",
"]",
".",
"endswith",
"(",
"\"e\"",
")",
":",
"parts",
"[",
... | 023727ac8744ae026d1105cc97c152bdf3abb8d6 |
valid | MailerMessageManager.clear_sent_messages | Deletes sent MailerMessage records | mailqueue/models.py | def clear_sent_messages(self, offset=None):
""" Deletes sent MailerMessage records """
if offset is None:
offset = getattr(settings, 'MAILQUEUE_CLEAR_OFFSET', defaults.MAILQUEUE_CLEAR_OFFSET)
if type(offset) is int:
offset = datetime.timedelta(hours=offset)
dele... | def clear_sent_messages(self, offset=None):
""" Deletes sent MailerMessage records """
if offset is None:
offset = getattr(settings, 'MAILQUEUE_CLEAR_OFFSET', defaults.MAILQUEUE_CLEAR_OFFSET)
if type(offset) is int:
offset = datetime.timedelta(hours=offset)
dele... | [
"Deletes",
"sent",
"MailerMessage",
"records"
] | dstegelman/django-mail-queue | python | https://github.com/dstegelman/django-mail-queue/blob/c9429d53454b117cde2e7a8cb912c8f5ae8394af/mailqueue/models.py#L28-L37 | [
"def",
"clear_sent_messages",
"(",
"self",
",",
"offset",
"=",
"None",
")",
":",
"if",
"offset",
"is",
"None",
":",
"offset",
"=",
"getattr",
"(",
"settings",
",",
"'MAILQUEUE_CLEAR_OFFSET'",
",",
"defaults",
".",
"MAILQUEUE_CLEAR_OFFSET",
")",
"if",
"type",
... | c9429d53454b117cde2e7a8cb912c8f5ae8394af |
valid | unicodevalues_asstring | Return string with unicodenames (unless that is disabled) | fontaine/builder.py | def unicodevalues_asstring(values):
""" Return string with unicodenames (unless that is disabled) """
if not os.environ.get('DISABLE_UNAMES'):
return map(lambda x: '%s' % format(x).strip(), values)
return map(lambda x: u'U+%04x %s' % (x, unichr(x)), sorted(values)) | def unicodevalues_asstring(values):
""" Return string with unicodenames (unless that is disabled) """
if not os.environ.get('DISABLE_UNAMES'):
return map(lambda x: '%s' % format(x).strip(), values)
return map(lambda x: u'U+%04x %s' % (x, unichr(x)), sorted(values)) | [
"Return",
"string",
"with",
"unicodenames",
"(",
"unless",
"that",
"is",
"disabled",
")"
] | davelab6/pyfontaine | python | https://github.com/davelab6/pyfontaine/blob/e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95/fontaine/builder.py#L44-L48 | [
"def",
"unicodevalues_asstring",
"(",
"values",
")",
":",
"if",
"not",
"os",
".",
"environ",
".",
"get",
"(",
"'DISABLE_UNAMES'",
")",
":",
"return",
"map",
"(",
"lambda",
"x",
":",
"'%s'",
"%",
"format",
"(",
"x",
")",
".",
"strip",
"(",
")",
",",
... | e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95 |
valid | _loadNamelistIncludes | Load the includes of an encoding Namelist files.
This is an implementation detail of readNamelist. | fontaine/charsets/internals/gfonts_utils.py | def _loadNamelistIncludes(item, unique_glyphs, cache):
"""Load the includes of an encoding Namelist files.
This is an implementation detail of readNamelist.
"""
includes = item["includes"] = []
charset = item["charset"] = set() | item["ownCharset"]
noCharcode = item["noCharcode"] = set() | item["ownNoChar... | def _loadNamelistIncludes(item, unique_glyphs, cache):
"""Load the includes of an encoding Namelist files.
This is an implementation detail of readNamelist.
"""
includes = item["includes"] = []
charset = item["charset"] = set() | item["ownCharset"]
noCharcode = item["noCharcode"] = set() | item["ownNoChar... | [
"Load",
"the",
"includes",
"of",
"an",
"encoding",
"Namelist",
"files",
"."
] | davelab6/pyfontaine | python | https://github.com/davelab6/pyfontaine/blob/e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95/fontaine/charsets/internals/gfonts_utils.py#L104-L126 | [
"def",
"_loadNamelistIncludes",
"(",
"item",
",",
"unique_glyphs",
",",
"cache",
")",
":",
"includes",
"=",
"item",
"[",
"\"includes\"",
"]",
"=",
"[",
"]",
"charset",
"=",
"item",
"[",
"\"charset\"",
"]",
"=",
"set",
"(",
")",
"|",
"item",
"[",
"\"own... | e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95 |
valid | __readNamelist | Return a dict with the data of an encoding Namelist file.
This is an implementation detail of readNamelist. | fontaine/charsets/internals/gfonts_utils.py | def __readNamelist(cache, filename, unique_glyphs):
"""Return a dict with the data of an encoding Namelist file.
This is an implementation detail of readNamelist.
"""
if filename in cache:
item = cache[filename]
else:
cps, header, noncodes = parseNamelist(filename)
item = {
"fileName": file... | def __readNamelist(cache, filename, unique_glyphs):
"""Return a dict with the data of an encoding Namelist file.
This is an implementation detail of readNamelist.
"""
if filename in cache:
item = cache[filename]
else:
cps, header, noncodes = parseNamelist(filename)
item = {
"fileName": file... | [
"Return",
"a",
"dict",
"with",
"the",
"data",
"of",
"an",
"encoding",
"Namelist",
"file",
"."
] | davelab6/pyfontaine | python | https://github.com/davelab6/pyfontaine/blob/e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95/fontaine/charsets/internals/gfonts_utils.py#L128-L153 | [
"def",
"__readNamelist",
"(",
"cache",
",",
"filename",
",",
"unique_glyphs",
")",
":",
"if",
"filename",
"in",
"cache",
":",
"item",
"=",
"cache",
"[",
"filename",
"]",
"else",
":",
"cps",
",",
"header",
",",
"noncodes",
"=",
"parseNamelist",
"(",
"file... | e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95 |
valid | _readNamelist | Detect infinite recursion and prevent it.
This is an implementation detail of readNamelist.
Raises NamelistRecursionError if namFilename is in the process of being included | fontaine/charsets/internals/gfonts_utils.py | def _readNamelist(currentlyIncluding, cache, namFilename, unique_glyphs):
""" Detect infinite recursion and prevent it.
This is an implementation detail of readNamelist.
Raises NamelistRecursionError if namFilename is in the process of being included
"""
# normalize
filename = os.path.abspath(os.path.norm... | def _readNamelist(currentlyIncluding, cache, namFilename, unique_glyphs):
""" Detect infinite recursion and prevent it.
This is an implementation detail of readNamelist.
Raises NamelistRecursionError if namFilename is in the process of being included
"""
# normalize
filename = os.path.abspath(os.path.norm... | [
"Detect",
"infinite",
"recursion",
"and",
"prevent",
"it",
"."
] | davelab6/pyfontaine | python | https://github.com/davelab6/pyfontaine/blob/e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95/fontaine/charsets/internals/gfonts_utils.py#L160-L176 | [
"def",
"_readNamelist",
"(",
"currentlyIncluding",
",",
"cache",
",",
"namFilename",
",",
"unique_glyphs",
")",
":",
"# normalize",
"filename",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"normcase",
"(",
"namFilename",
")",
")",
"... | e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95 |
valid | readNamelist | Args:
namFilename: The path to the Namelist file.
unique_glyphs: Optional, whether to only include glyphs unique to subset.
cache: Optional, a dict used to cache loaded Namelist files
Returns:
A dict with following keys:
"fileName": (string) absolut path to namFilename
"ownCharset": (set) the set ... | fontaine/charsets/internals/gfonts_utils.py | def readNamelist(namFilename, unique_glyphs=False, cache=None):
"""
Args:
namFilename: The path to the Namelist file.
unique_glyphs: Optional, whether to only include glyphs unique to subset.
cache: Optional, a dict used to cache loaded Namelist files
Returns:
A dict with following keys:
"fileNa... | def readNamelist(namFilename, unique_glyphs=False, cache=None):
"""
Args:
namFilename: The path to the Namelist file.
unique_glyphs: Optional, whether to only include glyphs unique to subset.
cache: Optional, a dict used to cache loaded Namelist files
Returns:
A dict with following keys:
"fileNa... | [
"Args",
":",
"namFilename",
":",
"The",
"path",
"to",
"the",
"Namelist",
"file",
".",
"unique_glyphs",
":",
"Optional",
"whether",
"to",
"only",
"include",
"glyphs",
"unique",
"to",
"subset",
".",
"cache",
":",
"Optional",
"a",
"dict",
"used",
"to",
"cache... | davelab6/pyfontaine | python | https://github.com/davelab6/pyfontaine/blob/e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95/fontaine/charsets/internals/gfonts_utils.py#L178-L207 | [
"def",
"readNamelist",
"(",
"namFilename",
",",
"unique_glyphs",
"=",
"False",
",",
"cache",
"=",
"None",
")",
":",
"currentlyIncluding",
"=",
"set",
"(",
")",
"if",
"not",
"cache",
":",
"cache",
"=",
"{",
"}",
"return",
"_readNamelist",
"(",
"currentlyInc... | e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95 |
valid | codepointsInNamelist | Returns the set of codepoints contained in a given Namelist file.
This is a replacement CodepointsInSubset and implements the "#$ include"
header format.
Args:
namFilename: The path to the Namelist file.
unique_glyphs: Optional, whether to only include glyphs unique to subset.
Returns:
A set cont... | fontaine/charsets/internals/gfonts_utils.py | def codepointsInNamelist(namFilename, unique_glyphs=False, cache=None):
"""Returns the set of codepoints contained in a given Namelist file.
This is a replacement CodepointsInSubset and implements the "#$ include"
header format.
Args:
namFilename: The path to the Namelist file.
unique_glyphs: Optiona... | def codepointsInNamelist(namFilename, unique_glyphs=False, cache=None):
"""Returns the set of codepoints contained in a given Namelist file.
This is a replacement CodepointsInSubset and implements the "#$ include"
header format.
Args:
namFilename: The path to the Namelist file.
unique_glyphs: Optiona... | [
"Returns",
"the",
"set",
"of",
"codepoints",
"contained",
"in",
"a",
"given",
"Namelist",
"file",
"."
] | davelab6/pyfontaine | python | https://github.com/davelab6/pyfontaine/blob/e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95/fontaine/charsets/internals/gfonts_utils.py#L209-L226 | [
"def",
"codepointsInNamelist",
"(",
"namFilename",
",",
"unique_glyphs",
"=",
"False",
",",
"cache",
"=",
"None",
")",
":",
"key",
"=",
"'charset'",
"if",
"not",
"unique_glyphs",
"else",
"'ownCharset'",
"internals_dir",
"=",
"os",
".",
"path",
".",
"dirname",
... | e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95 |
valid | TTFont.get_orthographies | Returns list of CharsetInfo about supported orthographies | fontaine/font.py | def get_orthographies(self, _library=library):
''' Returns list of CharsetInfo about supported orthographies '''
results = []
for charset in _library.charsets:
if self._charsets:
cn = getattr(charset, 'common_name', False)
abbr = getattr(charset, 'abbr... | def get_orthographies(self, _library=library):
''' Returns list of CharsetInfo about supported orthographies '''
results = []
for charset in _library.charsets:
if self._charsets:
cn = getattr(charset, 'common_name', False)
abbr = getattr(charset, 'abbr... | [
"Returns",
"list",
"of",
"CharsetInfo",
"about",
"supported",
"orthographies"
] | davelab6/pyfontaine | python | https://github.com/davelab6/pyfontaine/blob/e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95/fontaine/font.py#L237-L262 | [
"def",
"get_orthographies",
"(",
"self",
",",
"_library",
"=",
"library",
")",
":",
"results",
"=",
"[",
"]",
"for",
"charset",
"in",
"_library",
".",
"charsets",
":",
"if",
"self",
".",
"_charsets",
":",
"cn",
"=",
"getattr",
"(",
"charset",
",",
"'co... | e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95 |
valid | Extension.get_codepoints | Return all XML <scanning-codepoints> in received XML | fontaine/ext/extensis.py | def get_codepoints():
""" Return all XML <scanning-codepoints> in received XML """
# response = requests.get(EXTENSIS_LANG_XML)
# if response.status_code != 200:
# return []
path = get_from_cache('languages.xml', EXTENSIS_LANG_XML)
try:
xml_content = ope... | def get_codepoints():
""" Return all XML <scanning-codepoints> in received XML """
# response = requests.get(EXTENSIS_LANG_XML)
# if response.status_code != 200:
# return []
path = get_from_cache('languages.xml', EXTENSIS_LANG_XML)
try:
xml_content = ope... | [
"Return",
"all",
"XML",
"<scanning",
"-",
"codepoints",
">",
"in",
"received",
"XML"
] | davelab6/pyfontaine | python | https://github.com/davelab6/pyfontaine/blob/e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95/fontaine/ext/extensis.py#L43-L60 | [
"def",
"get_codepoints",
"(",
")",
":",
"# response = requests.get(EXTENSIS_LANG_XML)",
"# if response.status_code != 200:",
"# return []",
"path",
"=",
"get_from_cache",
"(",
"'languages.xml'",
",",
"EXTENSIS_LANG_XML",
")",
"try",
":",
"xml_content",
"=",
"open",
"(",... | e9af7f2667e85803a7f5ea2b1f0d9a34931f3b95 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.