text stringlengths 0 828 |
|---|
else: |
bars = args |
# Break the bars into groups of two, one for each column in the braille |
# blocks. |
for bar_group in _chunk(bars, 2): |
column = [] |
for braille_col, bar_value in enumerate(bar_group): |
# The number of full braille blocks needed to draw this bar. Each |
# block is four dots tall. |
full_blocks_needed = bar_value // 4 |
# The number of braille blocks needed to draw this bar. This |
# accounts for a possible partial block. |
blocks_needed = full_blocks_needed + (1 if bar_value % 4 else 0) |
# The number of new lines we'll need to prepend to accomodate this |
# bar |
extra_blocks_needed = blocks_needed - len(column) |
# If we need extra blocks, add them. |
column = ([_BRAILLE_EMPTY_BLOCK] * extra_blocks_needed) + column |
# Fill in the majority of the column with full braille colums (four |
# dots). We negate the index to access from the end of the list. |
for block_index in range(-full_blocks_needed, 0, 1): |
column[block_index] += _BRAILLE_FULL_COL[braille_col] |
# If we need a partial column, fill it in. We negate the index to |
# access from the end of the list. |
if bar_value % 4: |
partial_index = (bar_value % 4) - 1 |
column[-blocks_needed] += ( |
_BRAILLE_PARTIAL_COL[braille_col][partial_index] |
) |
# Add this column to the lines. |
_matrix_add_column(lines, column, default=_BRAILLE_EMPTY_BLOCK) |
# Convert all the code points into characters, concatenate them into lines, |
# then concatenate all the lines to make the final graph. |
return '\n'.join(''.join(chr(code) for code in line) for line in lines)" |
3734,"def isValid(self): |
"""""" |
Checks to see if the callback pointers are still valid or not. |
:return <bool> |
"""""" |
if self._callback_func_ref is not None and self._callback_func_ref(): |
if self._callback_self_ref is None or self._callback_self_ref(): |
return True |
return False" |
3735,"def clear(self, signal=None): |
"""""" |
Clears either all the callbacks or the callbacks for a particular |
signal. |
:param signal | <variant> || None |
"""""" |
if signal is not None: |
self._callbacks.pop(signal, None) |
else: |
self._callbacks.clear()" |
3736,"def connect(self, signal, slot): |
"""""" |
Creates a new connection between the inputted signal and slot. |
:param signal | <variant> |
slot | <callable> |
:return <bool> | new connection created |
"""""" |
if self.isConnected(signal, slot): |
return False |
callback = Callback(slot) |
self._callbacks.setdefault(signal, []) |
self._callbacks[signal].append(callback) |
return True" |
3737,"def disconnect(self, signal, slot): |
"""""" |
Breaks the connection between the inputted signal and the given slot. |
:param signal | <variant> |
slot | <callable> |
:return <bool> | connection broken |
"""""" |
sig_calls = self._callbacks.get(signal, []) |
for callback in sig_calls: |
if callback == slot: |
sig_calls.remove(callback) |
return True |
return False" |
3738,"def isConnected(self, signal, slot): |
"""""" |
Returns if the given signal is connected to the inputted slot. |
:param signal | <variant> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.