body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def process_file(filename: str) -> DateDict: '\n Method that take path to crawled file and outputs date dictionary:\n Date dictionary is a dictionary where keys are dates in format YYYY-mm-dd-hh (2018-04-08-15)\n and value is dictionary where keys are devices (specified in configuration file)\n and valu...
-5,522,921,133,619,537,000
Method that take path to crawled file and outputs date dictionary: Date dictionary is a dictionary where keys are dates in format YYYY-mm-dd-hh (2018-04-08-15) and value is dictionary where keys are devices (specified in configuration file) and value is CSVDataLine.csv_data_line with device,date and occurrence Args: f...
modules/crawler/DatasetProcessing/OBSAZENIMISTNOSTI_processor.py
process_file
kivzcu/heatmap.zcu
python
def process_file(filename: str) -> DateDict: '\n Method that take path to crawled file and outputs date dictionary:\n Date dictionary is a dictionary where keys are dates in format YYYY-mm-dd-hh (2018-04-08-15)\n and value is dictionary where keys are devices (specified in configuration file)\n and valu...
def user_input_handling_function_ninth(): ' a parser ' print() user_input = input('Enter: ') print() term = '' lict = [] for element in user_input: if (element != ' '): term = (term + element) else: lict.append(term) term = '' lict.appe...
8,264,336,917,387,615,000
a parser
lists_of_terms/shodule_for_lists_of_terms.py
user_input_handling_function_ninth
ShawnJSavoie2/ToBeRedone
python
def user_input_handling_function_ninth(): ' ' print() user_input = input('Enter: ') print() term = lict = [] for element in user_input: if (element != ' '): term = (term + element) else: lict.append(term) term = lict.append(term) ...
def user_input_handling_function_tenth(dictionary): ' a dictionary checker ' user_input = user_input_handling_function_ninth() good_to_go = 'no' errors = [] while (good_to_go == 'no'): string = '' lict = [] for element in user_input: string = (string + element) ...
-2,635,322,934,253,187,600
a dictionary checker
lists_of_terms/shodule_for_lists_of_terms.py
user_input_handling_function_tenth
ShawnJSavoie2/ToBeRedone
python
def user_input_handling_function_tenth(dictionary): ' ' user_input = user_input_handling_function_ninth() good_to_go = 'no' errors = [] while (good_to_go == 'no'): string = lict = [] for element in user_input: string = (string + element) for key in dicti...
@login_required def contact_list(request, pk): '\n Displays a list of :model:`rr.Contact` linked to\n :model:`rr.ServiceProvider`.\n\n Includes a ModelForm for adding :model:`rr.Contact` to\n :model:`rr.ServiceProvider`.\n\n **Context**\n\n ``object_list``\n List of :model:`rr.Contact`.\n\n...
7,067,613,641,276,462,000
Displays a list of :model:`rr.Contact` linked to :model:`rr.ServiceProvider`. Includes a ModelForm for adding :model:`rr.Contact` to :model:`rr.ServiceProvider`. **Context** ``object_list`` List of :model:`rr.Contact`. ``form`` ModelForm for creating a :model:`rr.Contact` ``object`` An instance of :mod...
rr/views/contact.py
contact_list
UniversityofHelsinki/sp-registry
python
@login_required def contact_list(request, pk): '\n Displays a list of :model:`rr.Contact` linked to\n :model:`rr.ServiceProvider`.\n\n Includes a ModelForm for adding :model:`rr.Contact` to\n :model:`rr.ServiceProvider`.\n\n **Context**\n\n ``object_list``\n List of :model:`rr.Contact`.\n\n...
def preprocess_input(x): 'Preprocesses a numpy array encoding a batch of images.\n\n Arguments:\n x: a 4D numpy array consists of RGB values within [0, 255].\n\n Returns:\n Preprocessed array.\n ' return imagenet_utils.preprocess_input(x, mode='tf')
-231,657,472,479,496,000
Preprocesses a numpy array encoding a batch of images. Arguments: x: a 4D numpy array consists of RGB values within [0, 255]. Returns: Preprocessed array.
tensorflow/python/keras/_impl/keras/applications/mobilenet.py
preprocess_input
DylanDmitri/tensorflow
python
def preprocess_input(x): 'Preprocesses a numpy array encoding a batch of images.\n\n Arguments:\n x: a 4D numpy array consists of RGB values within [0, 255].\n\n Returns:\n Preprocessed array.\n ' return imagenet_utils.preprocess_input(x, mode='tf')
def MobileNet(input_shape=None, alpha=1.0, depth_multiplier=1, dropout=0.001, include_top=True, weights='imagenet', input_tensor=None, pooling=None, classes=1000): "Instantiates the MobileNet architecture.\n\n Note that only TensorFlow is supported for now,\n therefore it only works with the data format\n `image...
-3,885,951,292,928,177,000
Instantiates the MobileNet architecture. Note that only TensorFlow is supported for now, therefore it only works with the data format `image_data_format='channels_last'` in your Keras config at `~/.keras/keras.json`. To load a MobileNet model via `load_model`, import the custom objects `relu6` and `DepthwiseConv2D` a...
tensorflow/python/keras/_impl/keras/applications/mobilenet.py
MobileNet
DylanDmitri/tensorflow
python
def MobileNet(input_shape=None, alpha=1.0, depth_multiplier=1, dropout=0.001, include_top=True, weights='imagenet', input_tensor=None, pooling=None, classes=1000): "Instantiates the MobileNet architecture.\n\n Note that only TensorFlow is supported for now,\n therefore it only works with the data format\n `image...
def _conv_block(inputs, filters, alpha, kernel=(3, 3), strides=(1, 1)): "Adds an initial convolution layer (with batch normalization and relu6).\n\n Arguments:\n inputs: Input tensor of shape `(rows, cols, 3)`\n (with `channels_last` data format) or\n (3, rows, cols) (with `channels_first` d...
321,854,916,225,204,350
Adds an initial convolution layer (with batch normalization and relu6). Arguments: inputs: Input tensor of shape `(rows, cols, 3)` (with `channels_last` data format) or (3, rows, cols) (with `channels_first` data format). It should have exactly 3 inputs channels, and width and heigh...
tensorflow/python/keras/_impl/keras/applications/mobilenet.py
_conv_block
DylanDmitri/tensorflow
python
def _conv_block(inputs, filters, alpha, kernel=(3, 3), strides=(1, 1)): "Adds an initial convolution layer (with batch normalization and relu6).\n\n Arguments:\n inputs: Input tensor of shape `(rows, cols, 3)`\n (with `channels_last` data format) or\n (3, rows, cols) (with `channels_first` d...
def _depthwise_conv_block(inputs, pointwise_conv_filters, alpha, depth_multiplier=1, strides=(1, 1), block_id=1): "Adds a depthwise convolution block.\n\n A depthwise convolution block consists of a depthwise conv,\n batch normalization, relu6, pointwise convolution,\n batch normalization and relu6 activation.\n...
4,224,460,810,474,824,700
Adds a depthwise convolution block. A depthwise convolution block consists of a depthwise conv, batch normalization, relu6, pointwise convolution, batch normalization and relu6 activation. Arguments: inputs: Input tensor of shape `(rows, cols, channels)` (with `channels_last` data format) or (chan...
tensorflow/python/keras/_impl/keras/applications/mobilenet.py
_depthwise_conv_block
DylanDmitri/tensorflow
python
def _depthwise_conv_block(inputs, pointwise_conv_filters, alpha, depth_multiplier=1, strides=(1, 1), block_id=1): "Adds a depthwise convolution block.\n\n A depthwise convolution block consists of a depthwise conv,\n batch normalization, relu6, pointwise convolution,\n batch normalization and relu6 activation.\n...
def __call__(self, image, crop_region=False, return_result=False, output_path=None): '\n Input: path to image\n Output: boxes (coordinates of 4 points)\n ' if (output_path is None): assert crop_region, 'Please specify output_path' else: output_path = os.path.join(output_...
-4,561,561,648,685,451,000
Input: path to image Output: boxes (coordinates of 4 points)
modules/__init__.py
__call__
kaylode/vietnamese-ocr-toolbox
python
def __call__(self, image, crop_region=False, return_result=False, output_path=None): '\n Input: path to image\n Output: boxes (coordinates of 4 points)\n ' if (output_path is None): assert crop_region, 'Please specify output_path' else: output_path = os.path.join(output_...
def successful_signing_test(self): 'Create and sign a valid raw transaction with one input.\n\n Expected results:\n\n 1) The transaction has a complete set of signatures\n 2) No script verification error occurred' privKeys = ['EXAMPLE_KEY'] inputs = [{'txid': 'EXAMPLE_KEY', 'vout': 0, '...
1,666,485,727,681,946,600
Create and sign a valid raw transaction with one input. Expected results: 1) The transaction has a complete set of signatures 2) No script verification error occurred
test/functional/rpc_signrawtransaction.py
successful_signing_test
anandsinha095/JDCION
python
def successful_signing_test(self): 'Create and sign a valid raw transaction with one input.\n\n Expected results:\n\n 1) The transaction has a complete set of signatures\n 2) No script verification error occurred' privKeys = ['EXAMPLE_KEY'] inputs = [{'txid': 'EXAMPLE_KEY', 'vout': 0, '...
def script_verification_error_test(self): 'Create and sign a raw transaction with valid (vin 0), invalid (vin 1) and one missing (vin 2) input script.\n\n Expected results:\n\n 3) The transaction has no complete set of signatures\n 4) Two script verification errors occurred\n 5) Script v...
-7,263,459,259,928,583,000
Create and sign a raw transaction with valid (vin 0), invalid (vin 1) and one missing (vin 2) input script. Expected results: 3) The transaction has no complete set of signatures 4) Two script verification errors occurred 5) Script verification errors have certain properties ("txid", "vout", "scriptSig", "sequence", ...
test/functional/rpc_signrawtransaction.py
script_verification_error_test
anandsinha095/JDCION
python
def script_verification_error_test(self): 'Create and sign a raw transaction with valid (vin 0), invalid (vin 1) and one missing (vin 2) input script.\n\n Expected results:\n\n 3) The transaction has no complete set of signatures\n 4) Two script verification errors occurred\n 5) Script v...
def assertTypedEquals(self, expected, actual): 'Asserts that both the types and values are the same.' self.assertEqual(type(expected), type(actual)) self.assertEqual(expected, actual)
-3,258,969,304,466,242,600
Asserts that both the types and values are the same.
Mark_attandance_py_selenium/py/App/Python/Lib/test/test_fractions.py
assertTypedEquals
4nkitd/pyAutomation
python
def assertTypedEquals(self, expected, actual): self.assertEqual(type(expected), type(actual)) self.assertEqual(expected, actual)
def assertRaisesMessage(self, exc_type, message, callable, *args, **kwargs): 'Asserts that callable(*args, **kwargs) raises exc_type(message).' try: callable(*args, **kwargs) except exc_type as e: self.assertEqual(message, str(e)) else: self.fail(('%s not raised' % exc_type.__nam...
-4,005,090,857,821,129,000
Asserts that callable(*args, **kwargs) raises exc_type(message).
Mark_attandance_py_selenium/py/App/Python/Lib/test/test_fractions.py
assertRaisesMessage
4nkitd/pyAutomation
python
def assertRaisesMessage(self, exc_type, message, callable, *args, **kwargs): try: callable(*args, **kwargs) except exc_type as e: self.assertEqual(message, str(e)) else: self.fail(('%s not raised' % exc_type.__name__))
def __init__(self, parametrization): 'Initializes the CirqOperation\n\n Args:\n parametrization (Tuple[float] -> Union[Cirq:Qid, List[Cirq:Qid]]): Converts the\n PennyLane gate parameters to an ordered list of gates that are to be applied.\n ' self.parametrization = param...
-9,183,222,663,540,377,000
Initializes the CirqOperation Args: parametrization (Tuple[float] -> Union[Cirq:Qid, List[Cirq:Qid]]): Converts the PennyLane gate parameters to an ordered list of gates that are to be applied.
pennylane_cirq/cirq_operation.py
__init__
PennyLaneAI/pennylane-cirq
python
def __init__(self, parametrization): 'Initializes the CirqOperation\n\n Args:\n parametrization (Tuple[float] -> Union[Cirq:Qid, List[Cirq:Qid]]): Converts the\n PennyLane gate parameters to an ordered list of gates that are to be applied.\n ' self.parametrization = param...
def parametrize(self, *args): 'Parametrizes the CirqOperation.\n\n Args:\n *args (float): the parameters for the operations\n ' self.parametrized_cirq_gates = self.parametrization(*args) if (not isinstance(self.parametrized_cirq_gates, Sequence)): self.parametrized_cirq_gate...
-2,579,435,966,490,960,400
Parametrizes the CirqOperation. Args: *args (float): the parameters for the operations
pennylane_cirq/cirq_operation.py
parametrize
PennyLaneAI/pennylane-cirq
python
def parametrize(self, *args): 'Parametrizes the CirqOperation.\n\n Args:\n *args (float): the parameters for the operations\n ' self.parametrized_cirq_gates = self.parametrization(*args) if (not isinstance(self.parametrized_cirq_gates, Sequence)): self.parametrized_cirq_gate...
def apply(self, *qubits): 'Applies the CirqOperation.\n\n Args:\n *qubits (Cirq:Qid): the qubits on which the Cirq gates should be performed.\n ' if (not self.parametrized_cirq_gates): raise qml.DeviceError('CirqOperation must be parametrized before it can be applied.') retu...
7,338,081,575,973,967,000
Applies the CirqOperation. Args: *qubits (Cirq:Qid): the qubits on which the Cirq gates should be performed.
pennylane_cirq/cirq_operation.py
apply
PennyLaneAI/pennylane-cirq
python
def apply(self, *qubits): 'Applies the CirqOperation.\n\n Args:\n *qubits (Cirq:Qid): the qubits on which the Cirq gates should be performed.\n ' if (not self.parametrized_cirq_gates): raise qml.DeviceError('CirqOperation must be parametrized before it can be applied.') retu...
def inv(self): 'Inverses the CirqOperation.' if self.parametrized_cirq_gates: raise qml.DeviceError("CirqOperation can't be inverted after it was parametrized.") self.is_inverse = (not self.is_inverse)
4,247,073,013,365,585,000
Inverses the CirqOperation.
pennylane_cirq/cirq_operation.py
inv
PennyLaneAI/pennylane-cirq
python
def inv(self): if self.parametrized_cirq_gates: raise qml.DeviceError("CirqOperation can't be inverted after it was parametrized.") self.is_inverse = (not self.is_inverse)
@commands.Cog.listener() async def on_command_error(self, ctx, error): 'The event triggered when an error is raised while invoking a command.' if hasattr(ctx.command, 'on_error'): return error = getattr(error, 'original', error) if isinstance(error, commands.CommandNotFound): return ...
6,489,049,612,741,809,000
The event triggered when an error is raised while invoking a command.
cogs/errorhandler.py
on_command_error
ZackHart2400/miso-bot
python
@commands.Cog.listener() async def on_command_error(self, ctx, error): if hasattr(ctx.command, 'on_error'): return error = getattr(error, 'original', error) if isinstance(error, commands.CommandNotFound): return if isinstance(error, commands.MissingRequiredArgument): return ...
def sigmoid_rampup(current, rampup_length): 'Exponential rampup from https://arxiv.org/abs/1610.02242' if (rampup_length == 0): return 1.0 else: current = np.clip(current, 0.0, rampup_length) phase = (1.0 - (current / rampup_length)) w = float(np.exp((((- 2.0) * phase) * phas...
-5,048,476,405,849,566,000
Exponential rampup from https://arxiv.org/abs/1610.02242
PNet/train_pnet.py
sigmoid_rampup
mangye16/ReID-Label-Noise
python
def sigmoid_rampup(current, rampup_length): if (rampup_length == 0): return 1.0 else: current = np.clip(current, 0.0, rampup_length) phase = (1.0 - (current / rampup_length)) w = float(np.exp((((- 2.0) * phase) * phase))) return min(w, 0.5)
@abstractmethod def apply(self, board): '\n Apply a move to a board and retrieve the board produced by the move.\n\n Parameters\n ----------\n board\n The board to apply the move to.\n\n Returns\n -------\n Board\n A new board that will be produ...
-6,482,721,186,070,927,000
Apply a move to a board and retrieve the board produced by the move. Parameters ---------- board The board to apply the move to. Returns ------- Board A new board that will be produced after applying this move.
libcheckers/movement.py
apply
YuriyGuts/libcheckers
python
@abstractmethod def apply(self, board): '\n Apply a move to a board and retrieve the board produced by the move.\n\n Parameters\n ----------\n board\n The board to apply the move to.\n\n Returns\n -------\n Board\n A new board that will be produ...
def find_opponent_square(self, board): '\n Retrieve the index of the square that contains the enemy piece to be captured.\n ' path_indexes = get_indexes_between(self.start_index, self.end_index) own_color = board.owner[self.start_index] own_path_squares = [index for index in path_indexes i...
2,956,729,355,891,111,000
Retrieve the index of the square that contains the enemy piece to be captured.
libcheckers/movement.py
find_opponent_square
YuriyGuts/libcheckers
python
def find_opponent_square(self, board): '\n \n ' path_indexes = get_indexes_between(self.start_index, self.end_index) own_color = board.owner[self.start_index] own_path_squares = [index for index in path_indexes if (board.owner[index] == own_color)] opponent_path_squares = [index for in...
def move_piece(self, start_index, end_index): '\n Move an existing game piece from point A to point B.\n ' self.owner[end_index] = self.owner[start_index] self.owner[start_index] = None self.piece_class[end_index] = self.piece_class[start_index] self.piece_class[start_index] = None ...
-6,216,466,120,835,834,000
Move an existing game piece from point A to point B.
libcheckers/movement.py
move_piece
YuriyGuts/libcheckers
python
def move_piece(self, start_index, end_index): '\n \n ' self.owner[end_index] = self.owner[start_index] self.owner[start_index] = None self.piece_class[end_index] = self.piece_class[start_index] self.piece_class[start_index] = None if ((self.owner[end_index] == Player.WHITE) and is_...
def add_piece(self, index, player, piece_class): '\n Place a new piece on the board with the specified owner and class.\n ' self.owner[index] = player self.piece_class[index] = piece_class
467,345,209,544,386,750
Place a new piece on the board with the specified owner and class.
libcheckers/movement.py
add_piece
YuriyGuts/libcheckers
python
def add_piece(self, index, player, piece_class): '\n \n ' self.owner[index] = player self.piece_class[index] = piece_class
def remove_piece(self, index): '\n Clear the specified square from the board.\n ' self.owner[index] = None self.piece_class[index] = None
-6,348,893,047,659,651,000
Clear the specified square from the board.
libcheckers/movement.py
remove_piece
YuriyGuts/libcheckers
python
def remove_piece(self, index): '\n \n ' self.owner[index] = None self.piece_class[index] = None
def get_player_squares(self, player): '\n Get all squares on the board owned by the specified player.\n ' return [index for index in range(1, (BoardConfig.total_squares + 1)) if (self.owner[index] == player)]
1,008,148,386,689,905,000
Get all squares on the board owned by the specified player.
libcheckers/movement.py
get_player_squares
YuriyGuts/libcheckers
python
def get_player_squares(self, player): '\n \n ' return [index for index in range(1, (BoardConfig.total_squares + 1)) if (self.owner[index] == player)]
def get_free_movement_destinations(self, index): '\n Get all allowed destinations for free movement for the piece at the specified square.\n ' own_color = self.owner[index] own_class = self.piece_class[index] visibility_range = (BoardConfig.board_dim if (own_class == PieceClass.KING) else ...
-241,082,711,958,797,380
Get all allowed destinations for free movement for the piece at the specified square.
libcheckers/movement.py
get_free_movement_destinations
YuriyGuts/libcheckers
python
def get_free_movement_destinations(self, index): '\n \n ' own_color = self.owner[index] own_class = self.piece_class[index] visibility_range = (BoardConfig.board_dim if (own_class == PieceClass.KING) else 1) lines_of_sight = get_lines_of_sight(index, visibility_range) if ((own_clas...
def get_capturable_pieces(self, index): "\n Get all squares that contain opponent's pieces capturable from the specified position.\n " own_color = self.owner[index] own_class = self.piece_class[index] visibility_range = (BoardConfig.board_dim if (own_class == PieceClass.KING) else 2) l...
3,072,183,555,115,830,300
Get all squares that contain opponent's pieces capturable from the specified position.
libcheckers/movement.py
get_capturable_pieces
YuriyGuts/libcheckers
python
def get_capturable_pieces(self, index): "\n \n " own_color = self.owner[index] own_class = self.piece_class[index] visibility_range = (BoardConfig.board_dim if (own_class == PieceClass.KING) else 2) lines_of_sight = get_lines_of_sight(index, visibility_range) result = [] for li...
def get_available_capture_landing_positions(self, attacker_index, capture_index): '\n If the specified square is captured by the specified attacker,\n get all possible squares the attacker can land on.\n ' own_class = self.piece_class[attacker_index] (attacker_row, attacker_col) = index...
9,079,244,142,070,687,000
If the specified square is captured by the specified attacker, get all possible squares the attacker can land on.
libcheckers/movement.py
get_available_capture_landing_positions
YuriyGuts/libcheckers
python
def get_available_capture_landing_positions(self, attacker_index, capture_index): '\n If the specified square is captured by the specified attacker,\n get all possible squares the attacker can land on.\n ' own_class = self.piece_class[attacker_index] (attacker_row, attacker_col) = index...
def get_capture_sequence_candidates(self, player): '\n Get all possible capture move sequences (not necessarily maximum ones)\n starting from every piece owned by the specified player.\n ' player_squares = self.get_player_squares(player) attack_options = [] for attacker in player_sq...
-7,375,068,571,418,206,000
Get all possible capture move sequences (not necessarily maximum ones) starting from every piece owned by the specified player.
libcheckers/movement.py
get_capture_sequence_candidates
YuriyGuts/libcheckers
python
def get_capture_sequence_candidates(self, player): '\n Get all possible capture move sequences (not necessarily maximum ones)\n starting from every piece owned by the specified player.\n ' player_squares = self.get_player_squares(player) attack_options = [] for attacker in player_sq...
def get_available_moves(self, player): '\n For the specified player, get the list of all allowed moves that are applicable\n to this board according to the game rules.\n ' result = [] capture_sequences = self.get_capture_sequence_candidates(player) if (not capture_sequences): ...
-5,256,897,743,708,423,000
For the specified player, get the list of all allowed moves that are applicable to this board according to the game rules.
libcheckers/movement.py
get_available_moves
YuriyGuts/libcheckers
python
def get_available_moves(self, player): '\n For the specified player, get the list of all allowed moves that are applicable\n to this board according to the game rules.\n ' result = [] capture_sequences = self.get_capture_sequence_candidates(player) if (not capture_sequences): ...
def check_game_over(self, player_turn): "\n Check if the game board is in a terminal state from the specified player's point of view.\n (e.g. a certain player has won or lost, or there is a draw).\n " white_moves = self.get_available_moves(Player.WHITE) black_moves = self.get_available_...
-3,846,133,922,372,637,700
Check if the game board is in a terminal state from the specified player's point of view. (e.g. a certain player has won or lost, or there is a draw).
libcheckers/movement.py
check_game_over
YuriyGuts/libcheckers
python
def check_game_over(self, player_turn): "\n Check if the game board is in a terminal state from the specified player's point of view.\n (e.g. a certain player has won or lost, or there is a draw).\n " white_moves = self.get_available_moves(Player.WHITE) black_moves = self.get_available_...
def clone(self): '\n Create an independent copy of this board.\n ' return deepcopy(self)
7,946,742,403,737,371,000
Create an independent copy of this board.
libcheckers/movement.py
clone
YuriyGuts/libcheckers
python
def clone(self): '\n \n ' return deepcopy(self)
def __init__(self): '\n Inits a new transaction.\n ' import revitron bundle = script.get_bundle_name().replace('.pushbutton', '') self.transaction = revitron.DB.Transaction(revitron.DOC, bundle) self.transaction.Start()
-3,308,001,345,332,747,300
Inits a new transaction.
revitron/transaction.py
__init__
YKato521/revitron-for-RevitPythonShell
python
def __init__(self): '\n \n ' import revitron bundle = script.get_bundle_name().replace('.pushbutton', ) self.transaction = revitron.DB.Transaction(revitron.DOC, bundle) self.transaction.Start()
def commit(self): '\n Commits the open transaction.\n ' self.transaction.Commit()
6,035,886,319,970,189,000
Commits the open transaction.
revitron/transaction.py
commit
YKato521/revitron-for-RevitPythonShell
python
def commit(self): '\n \n ' self.transaction.Commit()
def rollback(self): '\n Rolls back the open transaction.\n ' self.transaction.RollBack()
-1,146,533,772,664,958,100
Rolls back the open transaction.
revitron/transaction.py
rollback
YKato521/revitron-for-RevitPythonShell
python
def rollback(self): '\n \n ' self.transaction.RollBack()
@classmethod def defaults(cls, *args): 'Get default arguments added to a parser by all ``*args``.' dummy_parser = cls() for callback in args: callback(dummy_parser) defaults = dummy_parser.parse_known_args([])[0] return defaults
3,302,161,372,159,137,000
Get default arguments added to a parser by all ``*args``.
onmt/utils/parse.py
defaults
ACL2020-Submission/ACL2020
python
@classmethod def defaults(cls, *args): dummy_parser = cls() for callback in args: callback(dummy_parser) defaults = dummy_parser.parse_known_args([])[0] return defaults
def __init__(self, hass: HomeAssistant, entry: ConfigEntry, client: GitHubAPI, repository: str) -> None: 'Initialize GitHub data update coordinator base class.' self.config_entry = entry self.repository = repository self._client = client super().__init__(hass, LOGGER, name=DOMAIN, update_interval=DE...
5,124,193,583,015,939,000
Initialize GitHub data update coordinator base class.
homeassistant/components/github/coordinator.py
__init__
Arquiteto/core
python
def __init__(self, hass: HomeAssistant, entry: ConfigEntry, client: GitHubAPI, repository: str) -> None: self.config_entry = entry self.repository = repository self._client = client super().__init__(hass, LOGGER, name=DOMAIN, update_interval=DEFAULT_UPDATE_INTERVAL)
async def fetch_data(self) -> T: 'Fetch data from GitHub API.'
-5,836,349,995,842,303,000
Fetch data from GitHub API.
homeassistant/components/github/coordinator.py
fetch_data
Arquiteto/core
python
async def fetch_data(self) -> T:
async def fetch_data(self) -> GitHubRepositoryModel: 'Get the latest data from GitHub.' result = (await self._client.repos.get(self.repository)) return result.data
4,338,848,196,831,356,400
Get the latest data from GitHub.
homeassistant/components/github/coordinator.py
fetch_data
Arquiteto/core
python
async def fetch_data(self) -> GitHubRepositoryModel: result = (await self._client.repos.get(self.repository)) return result.data
async def fetch_data(self) -> (GitHubReleaseModel | None): 'Get the latest data from GitHub.' result = (await self._client.repos.releases.list(self.repository, **{'params': {'per_page': 1}})) if (not result.data): return None for release in result.data: if (not release.prerelease): ...
5,219,791,198,494,509,000
Get the latest data from GitHub.
homeassistant/components/github/coordinator.py
fetch_data
Arquiteto/core
python
async def fetch_data(self) -> (GitHubReleaseModel | None): result = (await self._client.repos.releases.list(self.repository, **{'params': {'per_page': 1}})) if (not result.data): return None for release in result.data: if (not release.prerelease): return release return r...
async def fetch_data(self) -> IssuesPulls: 'Get the latest data from GitHub.' base_issue_response = (await self._client.repos.issues.list(self.repository, **{'params': {'per_page': 1}})) pull_response = (await self._client.repos.pulls.list(self.repository, **{'params': {'per_page': 1}})) pulls_count = (...
-2,304,525,900,436,716,000
Get the latest data from GitHub.
homeassistant/components/github/coordinator.py
fetch_data
Arquiteto/core
python
async def fetch_data(self) -> IssuesPulls: base_issue_response = (await self._client.repos.issues.list(self.repository, **{'params': {'per_page': 1}})) pull_response = (await self._client.repos.pulls.list(self.repository, **{'params': {'per_page': 1}})) pulls_count = (pull_response.last_page_number or ...
async def fetch_data(self) -> (GitHubCommitModel | None): 'Get the latest data from GitHub.' result = (await self._client.repos.list_commits(self.repository, **{'params': {'per_page': 1}})) return (result.data[0] if result.data else None)
-1,005,978,423,350,740,500
Get the latest data from GitHub.
homeassistant/components/github/coordinator.py
fetch_data
Arquiteto/core
python
async def fetch_data(self) -> (GitHubCommitModel | None): result = (await self._client.repos.list_commits(self.repository, **{'params': {'per_page': 1}})) return (result.data[0] if result.data else None)
def htCache(factory): 'Output the cache of a servlet factory.' html = [] wr = html.append cache = factory._classCache keys = sorted(cache) wr(('<p>Uniqueness: %s</p>' % factory.uniqueness())) wr(('<p>Extensions: %s</p>' % ', '.join(map(repr, factory.extensions())))) wr(('<p>Unique paths ...
2,626,865,298,280,618,000
Output the cache of a servlet factory.
WebKit/Admin/ServletCache.py
htCache
Cito/w4py
python
def htCache(factory): html = [] wr = html.append cache = factory._classCache keys = sorted(cache) wr(('<p>Uniqueness: %s</p>' % factory.uniqueness())) wr(('<p>Extensions: %s</p>' % ', '.join(map(repr, factory.extensions())))) wr(('<p>Unique paths in the servlet cache: <strong>%d</strong...
def register_modules(self, **kwargs): ' Registers modules in current module dictionary.\n ' self.module_dict.update(kwargs)
-1,205,675,546,938,575,400
Registers modules in current module dictionary.
graf-main/submodules/GAN_stability/gan_training/checkpoints.py
register_modules
1ucky40nc3/mednerf
python
def register_modules(self, **kwargs): ' \n ' self.module_dict.update(kwargs)
def save(self, filename, **kwargs): ' Saves the current module dictionary.\n\n Args:\n filename (str): name of output file\n ' if (not os.path.isabs(filename)): filename = os.path.join(self.checkpoint_dir, filename) outdict = kwargs for (k, v) in self.module_dict.items()...
-7,547,054,072,814,241,000
Saves the current module dictionary. Args: filename (str): name of output file
graf-main/submodules/GAN_stability/gan_training/checkpoints.py
save
1ucky40nc3/mednerf
python
def save(self, filename, **kwargs): ' Saves the current module dictionary.\n\n Args:\n filename (str): name of output file\n ' if (not os.path.isabs(filename)): filename = os.path.join(self.checkpoint_dir, filename) outdict = kwargs for (k, v) in self.module_dict.items()...
def load(self, filename): 'Loads a module dictionary from local file or url.\n \n Args:\n filename (str): name of saved module dictionary\n ' if is_url(filename): return self.load_url(filename) else: return self.load_file(filename)
-2,890,154,249,354,038,300
Loads a module dictionary from local file or url. Args: filename (str): name of saved module dictionary
graf-main/submodules/GAN_stability/gan_training/checkpoints.py
load
1ucky40nc3/mednerf
python
def load(self, filename): 'Loads a module dictionary from local file or url.\n \n Args:\n filename (str): name of saved module dictionary\n ' if is_url(filename): return self.load_url(filename) else: return self.load_file(filename)
def load_file(self, filename): 'Loads a module dictionary from file.\n \n Args:\n filename (str): name of saved module dictionary\n ' if (not os.path.isabs(filename)): filename = os.path.join(self.checkpoint_dir, filename) if os.path.exists(filename): print(fi...
-6,940,442,115,957,106,000
Loads a module dictionary from file. Args: filename (str): name of saved module dictionary
graf-main/submodules/GAN_stability/gan_training/checkpoints.py
load_file
1ucky40nc3/mednerf
python
def load_file(self, filename): 'Loads a module dictionary from file.\n \n Args:\n filename (str): name of saved module dictionary\n ' if (not os.path.isabs(filename)): filename = os.path.join(self.checkpoint_dir, filename) if os.path.exists(filename): print(fi...
def load_url(self, url): 'Load a module dictionary from url.\n \n Args:\n url (str): url to saved model\n ' print(url) print('=> Loading checkpoint from url...') state_dict = model_zoo.load_url(url, progress=True) scalars = self.parse_state_dict(state_dict) return...
610,299,147,669,909,500
Load a module dictionary from url. Args: url (str): url to saved model
graf-main/submodules/GAN_stability/gan_training/checkpoints.py
load_url
1ucky40nc3/mednerf
python
def load_url(self, url): 'Load a module dictionary from url.\n \n Args:\n url (str): url to saved model\n ' print(url) print('=> Loading checkpoint from url...') state_dict = model_zoo.load_url(url, progress=True) scalars = self.parse_state_dict(state_dict) return...
def parse_state_dict(self, state_dict): 'Parse state_dict of model and return scalars.\n \n Args:\n state_dict (dict): State dict of model\n ' for (k, v) in self.module_dict.items(): if (k in state_dict): v.load_state_dict(state_dict[k]) else: ...
-3,472,864,303,789,836,300
Parse state_dict of model and return scalars. Args: state_dict (dict): State dict of model
graf-main/submodules/GAN_stability/gan_training/checkpoints.py
parse_state_dict
1ucky40nc3/mednerf
python
def parse_state_dict(self, state_dict): 'Parse state_dict of model and return scalars.\n \n Args:\n state_dict (dict): State dict of model\n ' for (k, v) in self.module_dict.items(): if (k in state_dict): v.load_state_dict(state_dict[k]) else: ...
def __init__(self, k: int) -> PolynomialFitting: '\n Instantiate a polynomial fitting estimator\n\n Parameters\n ----------\n k : int\n Degree of polynomial to fit\n ' super().__init__() self.deg_ = k (self.vander_, self.vander_linear_) = (None, LinearRegres...
2,860,509,653,220,064,000
Instantiate a polynomial fitting estimator Parameters ---------- k : int Degree of polynomial to fit
IMLearn/learners/regressors/polynomial_fitting.py
__init__
shirlevy007/IML.HUJI
python
def __init__(self, k: int) -> PolynomialFitting: '\n Instantiate a polynomial fitting estimator\n\n Parameters\n ----------\n k : int\n Degree of polynomial to fit\n ' super().__init__() self.deg_ = k (self.vander_, self.vander_linear_) = (None, LinearRegres...
def _fit(self, X: np.ndarray, y: np.ndarray) -> NoReturn: '\n Fit Least Squares model to polynomial transformed samples\n\n Parameters\n ----------\n X : ndarray of shape (n_samples, n_features)\n Input data to fit an estimator for\n\n y : ndarray of shape (n_samples, )...
1,178,176,510,061,192,200
Fit Least Squares model to polynomial transformed samples Parameters ---------- X : ndarray of shape (n_samples, n_features) Input data to fit an estimator for y : ndarray of shape (n_samples, ) Responses of input data to fit to
IMLearn/learners/regressors/polynomial_fitting.py
_fit
shirlevy007/IML.HUJI
python
def _fit(self, X: np.ndarray, y: np.ndarray) -> NoReturn: '\n Fit Least Squares model to polynomial transformed samples\n\n Parameters\n ----------\n X : ndarray of shape (n_samples, n_features)\n Input data to fit an estimator for\n\n y : ndarray of shape (n_samples, )...
def _predict(self, X: np.ndarray) -> np.ndarray: '\n Predict responses for given samples using fitted estimator\n\n Parameters\n ----------\n X : ndarray of shape (n_samples, n_features)\n Input data to predict responses for\n\n Returns\n -------\n respons...
3,464,361,381,715,352,000
Predict responses for given samples using fitted estimator Parameters ---------- X : ndarray of shape (n_samples, n_features) Input data to predict responses for Returns ------- responses : ndarray of shape (n_samples, ) Predicted responses of given samples
IMLearn/learners/regressors/polynomial_fitting.py
_predict
shirlevy007/IML.HUJI
python
def _predict(self, X: np.ndarray) -> np.ndarray: '\n Predict responses for given samples using fitted estimator\n\n Parameters\n ----------\n X : ndarray of shape (n_samples, n_features)\n Input data to predict responses for\n\n Returns\n -------\n respons...
def _loss(self, X: np.ndarray, y: np.ndarray) -> float: '\n Evaluate performance under MSE loss function\n\n Parameters\n ----------\n X : ndarray of shape (n_samples, n_features)\n Test samples\n\n y : ndarray of shape (n_samples, )\n True labels of test sam...
-4,140,011,508,131,796,500
Evaluate performance under MSE loss function Parameters ---------- X : ndarray of shape (n_samples, n_features) Test samples y : ndarray of shape (n_samples, ) True labels of test samples Returns ------- loss : float Performance under MSE loss function
IMLearn/learners/regressors/polynomial_fitting.py
_loss
shirlevy007/IML.HUJI
python
def _loss(self, X: np.ndarray, y: np.ndarray) -> float: '\n Evaluate performance under MSE loss function\n\n Parameters\n ----------\n X : ndarray of shape (n_samples, n_features)\n Test samples\n\n y : ndarray of shape (n_samples, )\n True labels of test sam...
def __transform(self, X: np.ndarray) -> np.ndarray: '\n Transform given input according to the univariate polynomial transformation\n\n Parameters\n ----------\n X: ndarray of shape (n_samples,)\n\n Returns\n -------\n transformed: ndarray of shape (n_samples, k+1)\n...
-2,425,109,902,432,135,700
Transform given input according to the univariate polynomial transformation Parameters ---------- X: ndarray of shape (n_samples,) Returns ------- transformed: ndarray of shape (n_samples, k+1) Vandermonde matrix of given samples up to degree k
IMLearn/learners/regressors/polynomial_fitting.py
__transform
shirlevy007/IML.HUJI
python
def __transform(self, X: np.ndarray) -> np.ndarray: '\n Transform given input according to the univariate polynomial transformation\n\n Parameters\n ----------\n X: ndarray of shape (n_samples,)\n\n Returns\n -------\n transformed: ndarray of shape (n_samples, k+1)\n...
def __init__(self, config): '\n Initialize SGD Env\n\n Parameters\n -------\n config : objdict\n Environment configuration\n ' super(SGDEnv, self).__init__(config) self.batch_size = config.training_batch_size self.validation_batch_size = config.validation_ba...
-5,901,484,696,904,247,000
Initialize SGD Env Parameters ------- config : objdict Environment configuration
dacbench/envs/sgd.py
__init__
goktug97/DACBench
python
def __init__(self, config): '\n Initialize SGD Env\n\n Parameters\n -------\n config : objdict\n Environment configuration\n ' super(SGDEnv, self).__init__(config) self.batch_size = config.training_batch_size self.validation_batch_size = config.validation_ba...
def seed(self, seed=None): '\n Set rng seed\n\n Parameters\n ----------\n seed:\n seed for rng\n ' (_, seed) = seeding.np_random(seed) if (seed is not None): torch.manual_seed(seed) np.random.seed(seed) return [seed]
-1,746,096,113,128,371,000
Set rng seed Parameters ---------- seed: seed for rng
dacbench/envs/sgd.py
seed
goktug97/DACBench
python
def seed(self, seed=None): '\n Set rng seed\n\n Parameters\n ----------\n seed:\n seed for rng\n ' (_, seed) = seeding.np_random(seed) if (seed is not None): torch.manual_seed(seed) np.random.seed(seed) return [seed]
def step(self, action): '\n Execute environment step\n\n Parameters\n ----------\n action : list\n action to execute\n\n Returns\n -------\n np.array, float, bool, dict\n state, reward, done, info\n ' done = super(SGDEnv, self).step_(...
483,047,106,780,406,660
Execute environment step Parameters ---------- action : list action to execute Returns ------- np.array, float, bool, dict state, reward, done, info
dacbench/envs/sgd.py
step
goktug97/DACBench
python
def step(self, action): '\n Execute environment step\n\n Parameters\n ----------\n action : list\n action to execute\n\n Returns\n -------\n np.array, float, bool, dict\n state, reward, done, info\n ' done = super(SGDEnv, self).step_(...
def reset(self): '\n Reset environment\n\n Returns\n -------\n np.array\n Environment state\n ' super(SGDEnv, self).reset_() dataset = self.instance[0] instance_seed = self.instance[1] construct_model = self.instance[2] self.seed(instance_seed) s...
-2,251,031,008,396,713,500
Reset environment Returns ------- np.array Environment state
dacbench/envs/sgd.py
reset
goktug97/DACBench
python
def reset(self): '\n Reset environment\n\n Returns\n -------\n np.array\n Environment state\n ' super(SGDEnv, self).reset_() dataset = self.instance[0] instance_seed = self.instance[1] construct_model = self.instance[2] self.seed(instance_seed) s...
def close(self): '\n No additional cleanup necessary\n\n Returns\n -------\n bool\n Cleanup flag\n ' return True
-9,155,946,635,410,039,000
No additional cleanup necessary Returns ------- bool Cleanup flag
dacbench/envs/sgd.py
close
goktug97/DACBench
python
def close(self): '\n No additional cleanup necessary\n\n Returns\n -------\n bool\n Cleanup flag\n ' return True
def render(self, mode: str='human'): '\n Render env in human mode\n\n Parameters\n ----------\n mode : str\n Execution mode\n ' if (mode != 'human'): raise NotImplementedError pass
-4,692,031,195,429,529,000
Render env in human mode Parameters ---------- mode : str Execution mode
dacbench/envs/sgd.py
render
goktug97/DACBench
python
def render(self, mode: str='human'): '\n Render env in human mode\n\n Parameters\n ----------\n mode : str\n Execution mode\n ' if (mode != 'human'): raise NotImplementedError pass
def get_default_state(self, _): '\n Gather state description\n\n Returns\n -------\n dict\n Environment state\n\n ' gradients = self._get_gradients() (self.firstOrderMomentum, self.secondOrderMomentum) = self._get_momentum(gradients) (predictiveChangeVarDisc...
150,674,990,009,349,800
Gather state description Returns ------- dict Environment state
dacbench/envs/sgd.py
get_default_state
goktug97/DACBench
python
def get_default_state(self, _): '\n Gather state description\n\n Returns\n -------\n dict\n Environment state\n\n ' gradients = self._get_gradients() (self.firstOrderMomentum, self.secondOrderMomentum) = self._get_momentum(gradients) (predictiveChangeVarDisc...
def __init__(self, black_patterns=(CONFIG_URLPATTERN_ALL,), white_patterns=('^http',), capacity=None): '\n constructor, use variable of BloomFilter if capacity else variable of set\n ' self._re_black_list = ([re.compile(pattern, flags=re.IGNORECASE) for pattern in black_patterns] if black_patterns...
390,878,835,707,812,300
constructor, use variable of BloomFilter if capacity else variable of set
spider/utilities/util_urlfilter.py
__init__
charlesXu86/PSpider
python
def __init__(self, black_patterns=(CONFIG_URLPATTERN_ALL,), white_patterns=('^http',), capacity=None): '\n \n ' self._re_black_list = ([re.compile(pattern, flags=re.IGNORECASE) for pattern in black_patterns] if black_patterns else []) self._re_white_list = ([re.compile(pattern, flags=re.IGNORE...
def update(self, url_list): '\n update this urlfilter using url_list\n ' if (self._url_set is not None): self._url_set.update(url_list) else: for url in url_list: self._bloom_filter.add(url) return
6,770,847,336,451,332,000
update this urlfilter using url_list
spider/utilities/util_urlfilter.py
update
charlesXu86/PSpider
python
def update(self, url_list): '\n \n ' if (self._url_set is not None): self._url_set.update(url_list) else: for url in url_list: self._bloom_filter.add(url) return
def check(self, url): '\n check the url based on self._re_black_list and self._re_white_list\n ' for re_black in self._re_black_list: if re_black.search(url): return False for re_white in self._re_white_list: if re_white.search(url): return True retu...
-5,244,254,235,561,446,000
check the url based on self._re_black_list and self._re_white_list
spider/utilities/util_urlfilter.py
check
charlesXu86/PSpider
python
def check(self, url): '\n \n ' for re_black in self._re_black_list: if re_black.search(url): return False for re_white in self._re_white_list: if re_white.search(url): return True return (False if self._re_white_list else True)
def check_and_add(self, url): "\n check the url to make sure that the url hasn't been fetched, and add url to urlfilter\n " result = False if self.check(url): if (self._url_set is not None): result = (url not in self._url_set) self._url_set.add(url) else...
4,728,054,450,603,104,000
check the url to make sure that the url hasn't been fetched, and add url to urlfilter
spider/utilities/util_urlfilter.py
check_and_add
charlesXu86/PSpider
python
def check_and_add(self, url): "\n \n " result = False if self.check(url): if (self._url_set is not None): result = (url not in self._url_set) self._url_set.add(url) else: result = (not self._bloom_filter.add(url)) return result
def get_extra_rules(use_extra: bool, extra_json_path: Path_Str) -> Optional[ActionsDict]: 'Helper to provide custom (project level/user level) anonymization\n rules as a mapping of tags -> action function.\n\n Args:\n use_extra (bool): If use extra rules.\n extra_json_path (Path_Str): Path to ex...
-9,007,312,869,837,651,000
Helper to provide custom (project level/user level) anonymization rules as a mapping of tags -> action function. Args: use_extra (bool): If use extra rules. extra_json_path (Path_Str): Path to extra rules json file. It should be flat json with action as a key and list of tags as value. Returns: Option...
dicomanonymizer/batch_anonymizer.py
get_extra_rules
ademyanchuk/dicom-anonymizer
python
def get_extra_rules(use_extra: bool, extra_json_path: Path_Str) -> Optional[ActionsDict]: 'Helper to provide custom (project level/user level) anonymization\n rules as a mapping of tags -> action function.\n\n Args:\n use_extra (bool): If use extra rules.\n extra_json_path (Path_Str): Path to ex...
def anonymize_dicom_folder(in_path: Path_Str, out_path: Path_Str, debug: bool=False, **kwargs): 'Anonymize dicom files in `in_path`, if `in_path` doesn\'t\n contain dicom files, will do nothing. Debug == True will do\n sort of dry run to check if all good for the large data storages\n\n Args:\n in_p...
8,963,746,500,322,977,000
Anonymize dicom files in `in_path`, if `in_path` doesn't contain dicom files, will do nothing. Debug == True will do sort of dry run to check if all good for the large data storages Args: in_path (Path_Str): path to the folder containing dicom files out_path (Path_Str): path to the folder there anonymized copi...
dicomanonymizer/batch_anonymizer.py
anonymize_dicom_folder
ademyanchuk/dicom-anonymizer
python
def anonymize_dicom_folder(in_path: Path_Str, out_path: Path_Str, debug: bool=False, **kwargs): 'Anonymize dicom files in `in_path`, if `in_path` doesn\'t\n contain dicom files, will do nothing. Debug == True will do\n sort of dry run to check if all good for the large data storages\n\n Args:\n in_p...
def anonymize_root_folder(in_root: Path_Str, out_root: Path_Str, **kwargs): 'The fuction will get all nested folders from `in_root`\n and perform anonymization of all folders containg dicom-files\n Will recreate the `in_root` folders structure in the `out_root`\n\n Args:\n in_root (Path_Str): source...
-6,255,924,792,182,228,000
The fuction will get all nested folders from `in_root` and perform anonymization of all folders containg dicom-files Will recreate the `in_root` folders structure in the `out_root` Args: in_root (Path_Str): source root folder (presumably has some dicom-files inide, maybe nested) out_root (Path_Str): destin...
dicomanonymizer/batch_anonymizer.py
anonymize_root_folder
ademyanchuk/dicom-anonymizer
python
def anonymize_root_folder(in_root: Path_Str, out_root: Path_Str, **kwargs): 'The fuction will get all nested folders from `in_root`\n and perform anonymization of all folders containg dicom-files\n Will recreate the `in_root` folders structure in the `out_root`\n\n Args:\n in_root (Path_Str): source...
@cmd.add(_cmdd, 'rules') async def _cmdf_enable(self, substr, msg, privilege_level): '`{cmd}` - View game rules.' (await self._client.send_msg(msg, self._RULES_STRING)) return
-7,856,957,651,585,113,000
`{cmd}` - View game rules.
mentionbot/servermodules/truthgame.py
_cmdf_enable
simshadows/Discord-mentionbot
python
@cmd.add(_cmdd, 'rules') async def _cmdf_enable(self, substr, msg, privilege_level): (await self._client.send_msg(msg, self._RULES_STRING)) return
@cmd.add(_cmdd, 'newgame', top=True) @cmd.minimum_privilege(PrivilegeLevel.TRUSTED) async def _cmdf_newgame(self, substr, msg, privilege_level): '`{cmd}` - New game.' channel = msg.channel (await self._abort_if_not_truth_channel(channel)) (await self._new_game(channel)) (await self._client.send_msg(...
5,801,103,587,893,892,000
`{cmd}` - New game.
mentionbot/servermodules/truthgame.py
_cmdf_newgame
simshadows/Discord-mentionbot
python
@cmd.add(_cmdd, 'newgame', top=True) @cmd.minimum_privilege(PrivilegeLevel.TRUSTED) async def _cmdf_newgame(self, substr, msg, privilege_level): channel = msg.channel (await self._abort_if_not_truth_channel(channel)) (await self._new_game(channel)) (await self._client.send_msg(channel, 'Truth game ...
@cmd.add(_cmdd, 'in', top=True) async def _cmdf_in(self, substr, msg, privilege_level): '\n `{cmd}` - Adds you to the game.\n\n This command also allows moderators to add other users and arbitrary strings as participants.\n **Example:** `{cmd} an elephant` - Adds "an elephant" as a participant.\n ...
-4,829,615,238,631,485,000
`{cmd}` - Adds you to the game. This command also allows moderators to add other users and arbitrary strings as participants. **Example:** `{cmd} an elephant` - Adds "an elephant" as a participant.
mentionbot/servermodules/truthgame.py
_cmdf_in
simshadows/Discord-mentionbot
python
@cmd.add(_cmdd, 'in', top=True) async def _cmdf_in(self, substr, msg, privilege_level): '\n `{cmd}` - Adds you to the game.\n\n This command also allows moderators to add other users and arbitrary strings as participants.\n **Example:** `{cmd} an elephant` - Adds "an elephant" as a participant.\n ...
@cmd.add(_cmdd, 'out', top=True) async def _cmdf_out(self, substr, msg, privilege_level): '\n `{cmd}` - Removes you from the game.\n\n This command also allows moderators to remove other users and arbitrary strings.\n **Example:** `{cmd} an elephant` - Removes "an elephant" as a participant.\n '...
8,620,157,351,105,654,000
`{cmd}` - Removes you from the game. This command also allows moderators to remove other users and arbitrary strings. **Example:** `{cmd} an elephant` - Removes "an elephant" as a participant.
mentionbot/servermodules/truthgame.py
_cmdf_out
simshadows/Discord-mentionbot
python
@cmd.add(_cmdd, 'out', top=True) async def _cmdf_out(self, substr, msg, privilege_level): '\n `{cmd}` - Removes you from the game.\n\n This command also allows moderators to remove other users and arbitrary strings.\n **Example:** `{cmd} an elephant` - Removes "an elephant" as a participant.\n '...
@cmd.add(_cmdd, 'enablechannel') @cmd.minimum_privilege(PrivilegeLevel.ADMIN) async def _cmdf_enable(self, substr, msg, privilege_level): '`{cmd}` - Enable Truth in this channel.' channel = msg.channel if (channel.id in self._enabled_channels): (await self._client.send_msg(channel, 'This channel is ...
8,307,452,712,083,425,000
`{cmd}` - Enable Truth in this channel.
mentionbot/servermodules/truthgame.py
_cmdf_enable
simshadows/Discord-mentionbot
python
@cmd.add(_cmdd, 'enablechannel') @cmd.minimum_privilege(PrivilegeLevel.ADMIN) async def _cmdf_enable(self, substr, msg, privilege_level): channel = msg.channel if (channel.id in self._enabled_channels): (await self._client.send_msg(channel, 'This channel is already a Truth game channel.')) else...
@cmd.add(_cmdd, 'disablechannel') @cmd.minimum_privilege(PrivilegeLevel.ADMIN) async def _cmdf_disable(self, substr, msg, privilege_level): '`{cmd}` - Disable Truth in this channel.' channel = msg.channel if (channel.id in self._enabled_channels): self._enabled_channels.remove(channel.id) se...
1,501,719,110,497,770,200
`{cmd}` - Disable Truth in this channel.
mentionbot/servermodules/truthgame.py
_cmdf_disable
simshadows/Discord-mentionbot
python
@cmd.add(_cmdd, 'disablechannel') @cmd.minimum_privilege(PrivilegeLevel.ADMIN) async def _cmdf_disable(self, substr, msg, privilege_level): channel = msg.channel if (channel.id in self._enabled_channels): self._enabled_channels.remove(channel.id) self._save_settings() (await self._c...
@cmd.add(_cmdd, 'viewenabled') async def _cmdf_viewenabled(self, substr, msg, privilege_level): '`{cmd}` - View all channels that are enabled as Truth channels.' buf = None if (len(self._enabled_channels) == 0): buf = 'No channels have Truth game enabled.' else: buf = '**Truth game enabl...
6,277,485,582,689,504,000
`{cmd}` - View all channels that are enabled as Truth channels.
mentionbot/servermodules/truthgame.py
_cmdf_viewenabled
simshadows/Discord-mentionbot
python
@cmd.add(_cmdd, 'viewenabled') async def _cmdf_viewenabled(self, substr, msg, privilege_level): buf = None if (len(self._enabled_channels) == 0): buf = 'No channels have Truth game enabled.' else: buf = '**Truth game enabled channels:**' for channel_id in self._enabled_channels:...
@cmd.add(_cmdd, 'choose', 'random', 'rand') async def _cmdf_choosetruth(self, substr, msg, privilege_level): '`{cmd}` - Pick a random participant other than yourself.' topic = msg.channel.topic if (topic is None): (await self._client.send_msg(msg, "There doesn't appear to be a truth game in here."))...
5,147,312,669,561,219,000
`{cmd}` - Pick a random participant other than yourself.
mentionbot/servermodules/truthgame.py
_cmdf_choosetruth
simshadows/Discord-mentionbot
python
@cmd.add(_cmdd, 'choose', 'random', 'rand') async def _cmdf_choosetruth(self, substr, msg, privilege_level): topic = msg.channel.topic if (topic is None): (await self._client.send_msg(msg, "There doesn't appear to be a truth game in here.")) raise errors.OperationAborted mentions = util...
def test_username_validation_error_msg(self, user: User): "\n Tests UserCreation Form's unique validator functions correctly by testing:\n 1) A new user with an existing username cannot be added.\n 2) Only 1 error is raised by the UserCreation Form\n 3) The desired error mess...
1,755,965,056,911,758,800
Tests UserCreation Form's unique validator functions correctly by testing: 1) A new user with an existing username cannot be added. 2) Only 1 error is raised by the UserCreation Form 3) The desired error message is raised
my_blog/users/tests/test_forms.py
test_username_validation_error_msg
Tanishk-Sharma/my_blog
python
def test_username_validation_error_msg(self, user: User): "\n Tests UserCreation Form's unique validator functions correctly by testing:\n 1) A new user with an existing username cannot be added.\n 2) Only 1 error is raised by the UserCreation Form\n 3) The desired error mess...
def convert_types(self, schema, col_type_dict, row): 'Convert values from DBAPI to output-friendly formats.' return [self.convert_type(value, col_type_dict.get(name)) for (name, value) in zip(schema, row)]
7,978,365,602,373,941,000
Convert values from DBAPI to output-friendly formats.
airflow/providers/google/cloud/operators/sql_to_gcs.py
convert_types
FRI-DAY/airflow
python
def convert_types(self, schema, col_type_dict, row): return [self.convert_type(value, col_type_dict.get(name)) for (name, value) in zip(schema, row)]
def _write_local_data_files(self, cursor): '\n Takes a cursor, and writes results to a local file.\n\n :return: A dictionary where keys are filenames to be used as object\n names in GCS, and values are file handles to local files that\n contain the data for the GCS objects.\n ...
6,549,307,246,991,140,000
Takes a cursor, and writes results to a local file. :return: A dictionary where keys are filenames to be used as object names in GCS, and values are file handles to local files that contain the data for the GCS objects.
airflow/providers/google/cloud/operators/sql_to_gcs.py
_write_local_data_files
FRI-DAY/airflow
python
def _write_local_data_files(self, cursor): '\n Takes a cursor, and writes results to a local file.\n\n :return: A dictionary where keys are filenames to be used as object\n names in GCS, and values are file handles to local files that\n contain the data for the GCS objects.\n ...
def _configure_csv_file(self, file_handle, schema): 'Configure a csv writer with the file_handle and write schema\n as headers for the new file.\n ' csv_writer = csv.writer(file_handle, encoding='utf-8', delimiter=self.field_delimiter) csv_writer.writerow(schema) return csv_writer
112,089,612,591,239,120
Configure a csv writer with the file_handle and write schema as headers for the new file.
airflow/providers/google/cloud/operators/sql_to_gcs.py
_configure_csv_file
FRI-DAY/airflow
python
def _configure_csv_file(self, file_handle, schema): 'Configure a csv writer with the file_handle and write schema\n as headers for the new file.\n ' csv_writer = csv.writer(file_handle, encoding='utf-8', delimiter=self.field_delimiter) csv_writer.writerow(schema) return csv_writer
@abc.abstractmethod def query(self): 'Execute DBAPI query.'
2,809,730,422,140,370,000
Execute DBAPI query.
airflow/providers/google/cloud/operators/sql_to_gcs.py
query
FRI-DAY/airflow
python
@abc.abstractmethod def query(self):
@abc.abstractmethod def field_to_bigquery(self, field): 'Convert a DBAPI field to BigQuery schema format.'
2,258,237,604,328,877,600
Convert a DBAPI field to BigQuery schema format.
airflow/providers/google/cloud/operators/sql_to_gcs.py
field_to_bigquery
FRI-DAY/airflow
python
@abc.abstractmethod def field_to_bigquery(self, field):
@abc.abstractmethod def convert_type(self, value, schema_type): 'Convert a value from DBAPI to output-friendly formats.'
-2,785,577,839,560,248,300
Convert a value from DBAPI to output-friendly formats.
airflow/providers/google/cloud/operators/sql_to_gcs.py
convert_type
FRI-DAY/airflow
python
@abc.abstractmethod def convert_type(self, value, schema_type):
def _get_col_type_dict(self): '\n Return a dict of column name and column type based on self.schema if not None.\n ' schema = [] if isinstance(self.schema, str): schema = json.loads(self.schema) elif isinstance(self.schema, list): schema = self.schema elif (self.schema ...
-6,582,290,293,196,102,000
Return a dict of column name and column type based on self.schema if not None.
airflow/providers/google/cloud/operators/sql_to_gcs.py
_get_col_type_dict
FRI-DAY/airflow
python
def _get_col_type_dict(self): '\n \n ' schema = [] if isinstance(self.schema, str): schema = json.loads(self.schema) elif isinstance(self.schema, list): schema = self.schema elif (self.schema is not None): self.log.warning('Using default schema due to unexpected...
def _write_local_schema_file(self, cursor): '\n Takes a cursor, and writes the BigQuery schema for the results to a\n local file system.\n\n :return: A dictionary where key is a filename to be used as an object\n name in GCS, and values are file handles to local files that\n ...
5,382,904,820,138,505,000
Takes a cursor, and writes the BigQuery schema for the results to a local file system. :return: A dictionary where key is a filename to be used as an object name in GCS, and values are file handles to local files that contains the BigQuery schema fields in .json format.
airflow/providers/google/cloud/operators/sql_to_gcs.py
_write_local_schema_file
FRI-DAY/airflow
python
def _write_local_schema_file(self, cursor): '\n Takes a cursor, and writes the BigQuery schema for the results to a\n local file system.\n\n :return: A dictionary where key is a filename to be used as an object\n name in GCS, and values are file handles to local files that\n ...
def _upload_to_gcs(self, files_to_upload): '\n Upload all of the file splits (and optionally the schema .json file) to\n Google Cloud Storage.\n ' hook = GCSHook(google_cloud_storage_conn_id=self.gcp_conn_id, delegate_to=self.delegate_to) for tmp_file in files_to_upload: hook.up...
4,584,763,336,989,765,600
Upload all of the file splits (and optionally the schema .json file) to Google Cloud Storage.
airflow/providers/google/cloud/operators/sql_to_gcs.py
_upload_to_gcs
FRI-DAY/airflow
python
def _upload_to_gcs(self, files_to_upload): '\n Upload all of the file splits (and optionally the schema .json file) to\n Google Cloud Storage.\n ' hook = GCSHook(google_cloud_storage_conn_id=self.gcp_conn_id, delegate_to=self.delegate_to) for tmp_file in files_to_upload: hook.up...
def description(self): '\n Returns a description for the actor.\n\n :return: the actor description\n :rtype: str\n ' return 'Outputs an integer from the specified range.'
6,808,793,563,313,494,000
Returns a description for the actor. :return: the actor description :rtype: str
base/src/shallowflow/base/sources/_ForLoop.py
description
waikato-datamining/shallow-flow
python
def description(self): '\n Returns a description for the actor.\n\n :return: the actor description\n :rtype: str\n ' return 'Outputs an integer from the specified range.'
def _define_options(self): '\n For configuring the options.\n ' super()._define_options() self._option_manager.add(Option(name='start', value_type=int, def_value=1, help='The starting value')) self._option_manager.add(Option(name='end', value_type=int, def_value=10, help='The last value (i...
1,926,360,857,306,023,200
For configuring the options.
base/src/shallowflow/base/sources/_ForLoop.py
_define_options
waikato-datamining/shallow-flow
python
def _define_options(self): '\n \n ' super()._define_options() self._option_manager.add(Option(name='start', value_type=int, def_value=1, help='The starting value')) self._option_manager.add(Option(name='end', value_type=int, def_value=10, help='The last value (incl)')) self._option_man...
def _get_item_type(self): '\n Returns the type of the individual items that get generated, when not outputting a list.\n\n :return: the type that gets generated\n ' return int
2,031,864,802,038,898,000
Returns the type of the individual items that get generated, when not outputting a list. :return: the type that gets generated
base/src/shallowflow/base/sources/_ForLoop.py
_get_item_type
waikato-datamining/shallow-flow
python
def _get_item_type(self): '\n Returns the type of the individual items that get generated, when not outputting a list.\n\n :return: the type that gets generated\n ' return int
def setup(self): '\n Prepares the actor for use.\n\n :return: None if successful, otherwise error message\n :rtype: str\n ' result = super().setup() if (result is None): if (self.get('end') < self.get('start')): result = ('End value (%s) must be smaller than s...
2,356,912,509,369,107,000
Prepares the actor for use. :return: None if successful, otherwise error message :rtype: str
base/src/shallowflow/base/sources/_ForLoop.py
setup
waikato-datamining/shallow-flow
python
def setup(self): '\n Prepares the actor for use.\n\n :return: None if successful, otherwise error message\n :rtype: str\n ' result = super().setup() if (result is None): if (self.get('end') < self.get('start')): result = ('End value (%s) must be smaller than s...
def _do_execute(self): '\n Performs the actual execution.\n\n :return: None if successful, otherwise error message\n :rtype: str\n ' i = self.get('start') step = self.get('step') end = self.get('end') while (i <= end): self._output.append(i) i += step ...
2,658,049,908,359,687,000
Performs the actual execution. :return: None if successful, otherwise error message :rtype: str
base/src/shallowflow/base/sources/_ForLoop.py
_do_execute
waikato-datamining/shallow-flow
python
def _do_execute(self): '\n Performs the actual execution.\n\n :return: None if successful, otherwise error message\n :rtype: str\n ' i = self.get('start') step = self.get('step') end = self.get('end') while (i <= end): self._output.append(i) i += step ...
def __init__(self, *, host: str='vision.googleapis.com', credentials: ga_credentials.Credentials=None, credentials_file: str=None, scopes: Sequence[str]=None, channel: grpc.Channel=None, api_mtls_endpoint: str=None, client_cert_source: Callable[([], Tuple[(bytes, bytes)])]=None, ssl_channel_credentials: grpc.ChannelCre...
-5,878,449,379,749,531,000
Instantiate the transport. Args: host (Optional[str]): The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified,...
google/cloud/vision/v1p3beta1/vision-v1p3beta1-py/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py
__init__
googleapis/googleapis-gen
python
def __init__(self, *, host: str='vision.googleapis.com', credentials: ga_credentials.Credentials=None, credentials_file: str=None, scopes: Sequence[str]=None, channel: grpc.Channel=None, api_mtls_endpoint: str=None, client_cert_source: Callable[([], Tuple[(bytes, bytes)])]=None, ssl_channel_credentials: grpc.ChannelCre...
@classmethod def create_channel(cls, host: str='vision.googleapis.com', credentials: ga_credentials.Credentials=None, credentials_file: str=None, scopes: Optional[Sequence[str]]=None, quota_project_id: Optional[str]=None, **kwargs) -> grpc.Channel: 'Create and return a gRPC channel object.\n Args:\n ...
-3,496,580,290,601,304,000
Create and return a gRPC channel object. Args: host (Optional[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client ...
google/cloud/vision/v1p3beta1/vision-v1p3beta1-py/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py
create_channel
googleapis/googleapis-gen
python
@classmethod def create_channel(cls, host: str='vision.googleapis.com', credentials: ga_credentials.Credentials=None, credentials_file: str=None, scopes: Optional[Sequence[str]]=None, quota_project_id: Optional[str]=None, **kwargs) -> grpc.Channel: 'Create and return a gRPC channel object.\n Args:\n ...
@property def grpc_channel(self) -> grpc.Channel: 'Return the channel designed to connect to this service.\n ' return self._grpc_channel
-1,956,682,971,687,930,400
Return the channel designed to connect to this service.
google/cloud/vision/v1p3beta1/vision-v1p3beta1-py/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py
grpc_channel
googleapis/googleapis-gen
python
@property def grpc_channel(self) -> grpc.Channel: '\n ' return self._grpc_channel
@property def operations_client(self) -> operations_v1.OperationsClient: 'Create the client designed to process long-running operations.\n\n This property caches on the instance; repeated calls return the same\n client.\n ' if (self._operations_client is None): self._operations_clie...
-7,084,677,965,328,057,000
Create the client designed to process long-running operations. This property caches on the instance; repeated calls return the same client.
google/cloud/vision/v1p3beta1/vision-v1p3beta1-py/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py
operations_client
googleapis/googleapis-gen
python
@property def operations_client(self) -> operations_v1.OperationsClient: 'Create the client designed to process long-running operations.\n\n This property caches on the instance; repeated calls return the same\n client.\n ' if (self._operations_client is None): self._operations_clie...
@property def batch_annotate_images(self) -> Callable[([image_annotator.BatchAnnotateImagesRequest], image_annotator.BatchAnnotateImagesResponse)]: 'Return a callable for the batch annotate images method over gRPC.\n\n Run image detection and annotation for a batch of\n images.\n\n Returns:\n ...
-4,998,487,497,053,026,000
Return a callable for the batch annotate images method over gRPC. Run image detection and annotation for a batch of images. Returns: Callable[[~.BatchAnnotateImagesRequest], ~.BatchAnnotateImagesResponse]: A function that, when called, will call the underlying RPC on the server.
google/cloud/vision/v1p3beta1/vision-v1p3beta1-py/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py
batch_annotate_images
googleapis/googleapis-gen
python
@property def batch_annotate_images(self) -> Callable[([image_annotator.BatchAnnotateImagesRequest], image_annotator.BatchAnnotateImagesResponse)]: 'Return a callable for the batch annotate images method over gRPC.\n\n Run image detection and annotation for a batch of\n images.\n\n Returns:\n ...
@property def async_batch_annotate_files(self) -> Callable[([image_annotator.AsyncBatchAnnotateFilesRequest], operations_pb2.Operation)]: 'Return a callable for the async batch annotate files method over gRPC.\n\n Run asynchronous image detection and annotation for a list of\n generic files, such as P...
-3,732,901,292,045,829,600
Return a callable for the async batch annotate files method over gRPC. Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the ``google.longrunning.Operations`` inter...
google/cloud/vision/v1p3beta1/vision-v1p3beta1-py/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py
async_batch_annotate_files
googleapis/googleapis-gen
python
@property def async_batch_annotate_files(self) -> Callable[([image_annotator.AsyncBatchAnnotateFilesRequest], operations_pb2.Operation)]: 'Return a callable for the async batch annotate files method over gRPC.\n\n Run asynchronous image detection and annotation for a list of\n generic files, such as P...
def resize_axis(tensor, axis, new_size, fill_value=0, random_sampling=False): 'Truncates or pads a tensor to new_size on on a given axis.\n Truncate or extend tensor such that tensor.shape[axis] == new_size. If the\n size increases, the padding will be performed at the end, using fill_value.\n Args:\n ...
3,647,447,032,106,927,600
Truncates or pads a tensor to new_size on on a given axis. Truncate or extend tensor such that tensor.shape[axis] == new_size. If the size increases, the padding will be performed at the end, using fill_value. Args: tensor: The tensor to be resized. axis: An integer representing the dimension to be sliced. new_si...
utils.py
resize_axis
glee1228/segment_temporal_context_aggregation
python
def resize_axis(tensor, axis, new_size, fill_value=0, random_sampling=False): 'Truncates or pads a tensor to new_size on on a given axis.\n Truncate or extend tensor such that tensor.shape[axis] == new_size. If the\n size increases, the padding will be performed at the end, using fill_value.\n Args:\n ...
def __init__(self, value: T, parent: Optional[Any]=None, callback: Optional[Callable[([], None)]]=None): ' Initialize the PageProperty to always have value v.' self._values: List[Tuple[(int, T)]] = [(0, value)] self.set_parent(parent) self._callback = callback
-7,846,967,357,376,559,000
Initialize the PageProperty to always have value v.
chart/chart/python/spectralsequence_chart/page_property.py
__init__
JoeyBF/sseq
python
def __init__(self, value: T, parent: Optional[Any]=None, callback: Optional[Callable[([], None)]]=None): ' ' self._values: List[Tuple[(int, T)]] = [(0, value)] self.set_parent(parent) self._callback = callback
@click.command(name='about') @click.pass_obj @click.pass_context def about(ctx, cli_obj): 'Print information about osxphotos including license.' click.echo_via_pager(f'''osxphotos, version {__version__} Source code available at: {OSXPHOTOS_URL} {LICENSE}''')
63,966,833,063,543,110
Print information about osxphotos including license.
osxphotos/cli/about.py
about
oPromessa/osxphotos
python
@click.command(name='about') @click.pass_obj @click.pass_context def about(ctx, cli_obj): click.echo_via_pager(f'osxphotos, version {__version__} Source code available at: {OSXPHOTOS_URL} {LICENSE}')