body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
bd85efa671a1f14b6e1c453ef648cfe4eba62192fd507fa4157d11d6124d818d | def set_low_power(self):
'!\n @brief disabled the the magn, gyro sensor to reduce power consumption\n '
self.soft_reset()
time.sleep(0.1)
self.set_magn_conf()
time.sleep(0.1)
self.write_bmx_reg(self._BMX160_COMMAND_REG_ADDR, 18)
time.sleep(0.1)
self.write_bmx_reg(self._BM... | !
@brief disabled the the magn, gyro sensor to reduce power consumption | python/raspberrypi/DFRobot_BMX160.py | set_low_power | DFRobot/DFRobot_BMX160 | 9 | python | def set_low_power(self):
'!\n @brief disabled the the magn, gyro sensor to reduce power consumption\n '
self.soft_reset()
time.sleep(0.1)
self.set_magn_conf()
time.sleep(0.1)
self.write_bmx_reg(self._BMX160_COMMAND_REG_ADDR, 18)
time.sleep(0.1)
self.write_bmx_reg(self._BM... | def set_low_power(self):
'!\n @brief disabled the the magn, gyro sensor to reduce power consumption\n '
self.soft_reset()
time.sleep(0.1)
self.set_magn_conf()
time.sleep(0.1)
self.write_bmx_reg(self._BMX160_COMMAND_REG_ADDR, 18)
time.sleep(0.1)
self.write_bmx_reg(self._BM... |
e9a55d8ddf3c30a568518fe712019ba488d74966d87afb4f73ff7f4084c38ece | def wake_up(self):
'!\n @brief enabled the the magn, gyro sensor\n '
self.soft_reset()
time.sleep(0.1)
self.set_magn_conf()
time.sleep(0.1)
self.write_bmx_reg(self._BMX160_COMMAND_REG_ADDR, 17)
time.sleep(0.1)
self.write_bmx_reg(self._BMX160_COMMAND_REG_ADDR, 21)
time... | !
@brief enabled the the magn, gyro sensor | python/raspberrypi/DFRobot_BMX160.py | wake_up | DFRobot/DFRobot_BMX160 | 9 | python | def wake_up(self):
'!\n @brief enabled the the magn, gyro sensor\n '
self.soft_reset()
time.sleep(0.1)
self.set_magn_conf()
time.sleep(0.1)
self.write_bmx_reg(self._BMX160_COMMAND_REG_ADDR, 17)
time.sleep(0.1)
self.write_bmx_reg(self._BMX160_COMMAND_REG_ADDR, 21)
time... | def wake_up(self):
'!\n @brief enabled the the magn, gyro sensor\n '
self.soft_reset()
time.sleep(0.1)
self.set_magn_conf()
time.sleep(0.1)
self.write_bmx_reg(self._BMX160_COMMAND_REG_ADDR, 17)
time.sleep(0.1)
self.write_bmx_reg(self._BMX160_COMMAND_REG_ADDR, 21)
time... |
4370be6036e6b98f244359e5638885a0e04c72aa2ee7bf6bc95599ffceb36dbc | def soft_reset(self):
'!\n @brief reset bmx160 hardware\n @return returns the reset status\n @retval True reset succeeded\n @retval False reset failed\n '
data = self.BMX160_SOFT_RESET_CMD
self.write_bmx_reg(self._BMX160_COMMAND_REG_ADDR, data)
time.sleep(0.01... | !
@brief reset bmx160 hardware
@return returns the reset status
@retval True reset succeeded
@retval False reset failed | python/raspberrypi/DFRobot_BMX160.py | soft_reset | DFRobot/DFRobot_BMX160 | 9 | python | def soft_reset(self):
'!\n @brief reset bmx160 hardware\n @return returns the reset status\n @retval True reset succeeded\n @retval False reset failed\n '
data = self.BMX160_SOFT_RESET_CMD
self.write_bmx_reg(self._BMX160_COMMAND_REG_ADDR, data)
time.sleep(0.01... | def soft_reset(self):
'!\n @brief reset bmx160 hardware\n @return returns the reset status\n @retval True reset succeeded\n @retval False reset failed\n '
data = self.BMX160_SOFT_RESET_CMD
self.write_bmx_reg(self._BMX160_COMMAND_REG_ADDR, data)
time.sleep(0.01... |
204194f8733df7d26713e66feff52020961af595ab5d75fdffba21d308c534a5 | def set_magn_conf(self):
'!\n @brief set magnetometer Config\n '
self.write_bmx_reg(self._BMX160_MAGN_IF_0_ADDR, 128)
time.sleep(0.05)
self.write_bmx_reg(self._BMX160_MAGN_IF_3_ADDR, 1)
self.write_bmx_reg(self._BMX160_MAGN_IF_2_ADDR, 75)
self.write_bmx_reg(self._BMX160_MAGN_IF_3... | !
@brief set magnetometer Config | python/raspberrypi/DFRobot_BMX160.py | set_magn_conf | DFRobot/DFRobot_BMX160 | 9 | python | def set_magn_conf(self):
'!\n @brief set magnetometer Config\n '
self.write_bmx_reg(self._BMX160_MAGN_IF_0_ADDR, 128)
time.sleep(0.05)
self.write_bmx_reg(self._BMX160_MAGN_IF_3_ADDR, 1)
self.write_bmx_reg(self._BMX160_MAGN_IF_2_ADDR, 75)
self.write_bmx_reg(self._BMX160_MAGN_IF_3... | def set_magn_conf(self):
'!\n @brief set magnetometer Config\n '
self.write_bmx_reg(self._BMX160_MAGN_IF_0_ADDR, 128)
time.sleep(0.05)
self.write_bmx_reg(self._BMX160_MAGN_IF_3_ADDR, 1)
self.write_bmx_reg(self._BMX160_MAGN_IF_2_ADDR, 75)
self.write_bmx_reg(self._BMX160_MAGN_IF_3... |
d3348b78aec9da4c50c63813330647d8e1fc3ded53202e80b3eb24dedb701f2d | def set_gyro_range(self, bits):
'!\n @brief set gyroscope angular rate range and resolution.\n @param bits \n @n GyroRange_125DPS Gyroscope sensitivity at 125dps\n @n GyroRange_250DPS Gyroscope sensitivity at 250dps\n @n GyroRange_500DPS ... | !
@brief set gyroscope angular rate range and resolution.
@param bits
@n GyroRange_125DPS Gyroscope sensitivity at 125dps
@n GyroRange_250DPS Gyroscope sensitivity at 250dps
@n GyroRange_500DPS Gyroscope sensitivity at 500dps
@n GyroRange_1000DPS Gyroscope sensitivity at 1000... | python/raspberrypi/DFRobot_BMX160.py | set_gyro_range | DFRobot/DFRobot_BMX160 | 9 | python | def set_gyro_range(self, bits):
'!\n @brief set gyroscope angular rate range and resolution.\n @param bits \n @n GyroRange_125DPS Gyroscope sensitivity at 125dps\n @n GyroRange_250DPS Gyroscope sensitivity at 250dps\n @n GyroRange_500DPS ... | def set_gyro_range(self, bits):
'!\n @brief set gyroscope angular rate range and resolution.\n @param bits \n @n GyroRange_125DPS Gyroscope sensitivity at 125dps\n @n GyroRange_250DPS Gyroscope sensitivity at 250dps\n @n GyroRange_500DPS ... |
081d13dd78d25d69bb975f61f6045f4ddd3019b439841565999c73e10fa0d1cf | def set_accel_range(self, bits):
'!\n @brief allow the selection of the accelerometer g-range.\n @param bits \n @n AccelRange_2G Macro for mg per LSB at +/- 2g sensitivity (1 LSB = 0.000061035mg) \n @n AccelRange_4G Macro for mg per LSB at +/- 4g sensiti... | !
@brief allow the selection of the accelerometer g-range.
@param bits
@n AccelRange_2G Macro for mg per LSB at +/- 2g sensitivity (1 LSB = 0.000061035mg)
@n AccelRange_4G Macro for mg per LSB at +/- 4g sensitivity (1 LSB = 0.000122070mg)
@n AccelRange_8G Macro for mg per LSB a... | python/raspberrypi/DFRobot_BMX160.py | set_accel_range | DFRobot/DFRobot_BMX160 | 9 | python | def set_accel_range(self, bits):
'!\n @brief allow the selection of the accelerometer g-range.\n @param bits \n @n AccelRange_2G Macro for mg per LSB at +/- 2g sensitivity (1 LSB = 0.000061035mg) \n @n AccelRange_4G Macro for mg per LSB at +/- 4g sensiti... | def set_accel_range(self, bits):
'!\n @brief allow the selection of the accelerometer g-range.\n @param bits \n @n AccelRange_2G Macro for mg per LSB at +/- 2g sensitivity (1 LSB = 0.000061035mg) \n @n AccelRange_4G Macro for mg per LSB at +/- 4g sensiti... |
3910a6b9ad282f8ecd015359f9e4bf2f201089230fc4bbec75c3b7c291b235e7 | def get_all_data(self):
'!\n @brief get the magn, gyro and accel data \n @return all data\n '
data = self.read_bmx_reg(self._BMX160_MAG_DATA_ADDR)
if (data[1] & 128):
magnx = ((- 65536) + ((data[1] << 8) | data[0]))
else:
magnx = ((data[1] << 8) | data[0])
if... | !
@brief get the magn, gyro and accel data
@return all data | python/raspberrypi/DFRobot_BMX160.py | get_all_data | DFRobot/DFRobot_BMX160 | 9 | python | def get_all_data(self):
'!\n @brief get the magn, gyro and accel data \n @return all data\n '
data = self.read_bmx_reg(self._BMX160_MAG_DATA_ADDR)
if (data[1] & 128):
magnx = ((- 65536) + ((data[1] << 8) | data[0]))
else:
magnx = ((data[1] << 8) | data[0])
if... | def get_all_data(self):
'!\n @brief get the magn, gyro and accel data \n @return all data\n '
data = self.read_bmx_reg(self._BMX160_MAG_DATA_ADDR)
if (data[1] & 128):
magnx = ((- 65536) + ((data[1] << 8) | data[0]))
else:
magnx = ((data[1] << 8) | data[0])
if... |
571f5dd29341cf4b9ce5b73f3e580b408e5b724994f458b6279f8a03412245bf | def write_bmx_reg(self, register, value):
'!\n @brief Write data to the BMX register\n @param register register\n @param value Data written to the BMX register\n @return return the actually written length\n '
self.i2cbus.write_byte_data(self.i2c_addr, register, value) | !
@brief Write data to the BMX register
@param register register
@param value Data written to the BMX register
@return return the actually written length | python/raspberrypi/DFRobot_BMX160.py | write_bmx_reg | DFRobot/DFRobot_BMX160 | 9 | python | def write_bmx_reg(self, register, value):
'!\n @brief Write data to the BMX register\n @param register register\n @param value Data written to the BMX register\n @return return the actually written length\n '
self.i2cbus.write_byte_data(self.i2c_addr, register, value) | def write_bmx_reg(self, register, value):
'!\n @brief Write data to the BMX register\n @param register register\n @param value Data written to the BMX register\n @return return the actually written length\n '
self.i2cbus.write_byte_data(self.i2c_addr, register, value)... |
d3ab7eec1d2d30c80076718c421eb87e908f101623c255b48389821461038fad | def read_bmx_reg(self, register):
'!\n @brief Read BMX register data\n @param register register\n @return data\n '
return self.i2cbus.read_i2c_block_data(self.i2c_addr, register) | !
@brief Read BMX register data
@param register register
@return data | python/raspberrypi/DFRobot_BMX160.py | read_bmx_reg | DFRobot/DFRobot_BMX160 | 9 | python | def read_bmx_reg(self, register):
'!\n @brief Read BMX register data\n @param register register\n @return data\n '
return self.i2cbus.read_i2c_block_data(self.i2c_addr, register) | def read_bmx_reg(self, register):
'!\n @brief Read BMX register data\n @param register register\n @return data\n '
return self.i2cbus.read_i2c_block_data(self.i2c_addr, register)<|docstring|>!
@brief Read BMX register data
@param register register
@return data<|endoftext|> |
04cd0f84ff13d5e2863fd550354c70816512789354903c49504592d820ffa73f | def scan(self):
'!\n @brief iic scan function\n @return scan result\n @retval True sensor exist\n @retval False There is no sensor\n '
try:
self.i2cbus.read_byte(self.i2c_addr)
return True
except:
print('I2C init fail')
return False | !
@brief iic scan function
@return scan result
@retval True sensor exist
@retval False There is no sensor | python/raspberrypi/DFRobot_BMX160.py | scan | DFRobot/DFRobot_BMX160 | 9 | python | def scan(self):
'!\n @brief iic scan function\n @return scan result\n @retval True sensor exist\n @retval False There is no sensor\n '
try:
self.i2cbus.read_byte(self.i2c_addr)
return True
except:
print('I2C init fail')
return False | def scan(self):
'!\n @brief iic scan function\n @return scan result\n @retval True sensor exist\n @retval False There is no sensor\n '
try:
self.i2cbus.read_byte(self.i2c_addr)
return True
except:
print('I2C init fail')
return False... |
675e6e6e57ba2980ec7310abfce78e33ad51dcb459a3e3d3f3c3ebd4ae394eb5 | def serialize_tagged_sentence(sentence_id, tagged_sentence, state='raw', pretty=False, dump=True):
"\n Serialize a sentence tagged with Named entity tags s.t. it can be passed between Luigi tasks.\n \n :param sentence_id: ID of current sentence.\n :type sentence_id: int\n :param tagged_sentence: Tagg... | Serialize a sentence tagged with Named entity tags s.t. it can be passed between Luigi tasks.
:param sentence_id: ID of current sentence.
:type sentence_id: int
:param tagged_sentence: Tagged sentence.
:type tagged_sentence: list
:param state: State that describes the kind of processing that is applied to the data in ... | backend/bwg/serializing.py | serialize_tagged_sentence | majdigital/bigworldgraph | 3 | python | def serialize_tagged_sentence(sentence_id, tagged_sentence, state='raw', pretty=False, dump=True):
"\n Serialize a sentence tagged with Named entity tags s.t. it can be passed between Luigi tasks.\n \n :param sentence_id: ID of current sentence.\n :type sentence_id: int\n :param tagged_sentence: Tagg... | def serialize_tagged_sentence(sentence_id, tagged_sentence, state='raw', pretty=False, dump=True):
"\n Serialize a sentence tagged with Named entity tags s.t. it can be passed between Luigi tasks.\n \n :param sentence_id: ID of current sentence.\n :type sentence_id: int\n :param tagged_sentence: Tagg... |
590a7a21751d0875b1adc758ea01fe51b37aea65d798131f01fd1432976559a2 | def serialize_dependency_parse_tree(sentence_id, parse_trees, state='raw', pretty=False, dump=True):
"\n Serialize a dependency parse tree for a sentence.\n \n :param sentence_id: ID of current sentence.\n :type sentence_id: int\n :param parse_trees: Parse trees for this sentence.\n :type parse_tr... | Serialize a dependency parse tree for a sentence.
:param sentence_id: ID of current sentence.
:type sentence_id: int
:param parse_trees: Parse trees for this sentence.
:type parse_trees: dict, None
:param state: State that describes the kind of processing that is applied to the data in this step. It's
included in the... | backend/bwg/serializing.py | serialize_dependency_parse_tree | majdigital/bigworldgraph | 3 | python | def serialize_dependency_parse_tree(sentence_id, parse_trees, state='raw', pretty=False, dump=True):
"\n Serialize a dependency parse tree for a sentence.\n \n :param sentence_id: ID of current sentence.\n :type sentence_id: int\n :param parse_trees: Parse trees for this sentence.\n :type parse_tr... | def serialize_dependency_parse_tree(sentence_id, parse_trees, state='raw', pretty=False, dump=True):
"\n Serialize a dependency parse tree for a sentence.\n \n :param sentence_id: ID of current sentence.\n :type sentence_id: int\n :param parse_trees: Parse trees for this sentence.\n :type parse_tr... |
efba0f7834bf2b30f1bffdb97d8dc1a7ca00b40b8e6d7947104edf98ef85470d | def serialize_sentence(sentence_id, sentence, state='raw', pretty=False, dump=True):
"\n Serialize a simple sentence.\n\n :param sentence_id: ID of current sentence.\n :type sentence_id: str\n :param sentence: Sentence.\n :type sentence: str\n :param state: State that describes the kind of processing th... | Serialize a simple sentence.
:param sentence_id: ID of current sentence.
:type sentence_id: str
:param sentence: Sentence.
:type sentence: str
:param state: State that describes the kind of processing that is applied to the data in this step. It's
included in the metadata of each sentence.
:type state: str
:param pre... | backend/bwg/serializing.py | serialize_sentence | majdigital/bigworldgraph | 3 | python | def serialize_sentence(sentence_id, sentence, state='raw', pretty=False, dump=True):
"\n Serialize a simple sentence.\n\n :param sentence_id: ID of current sentence.\n :type sentence_id: str\n :param sentence: Sentence.\n :type sentence: str\n :param state: State that describes the kind of processing th... | def serialize_sentence(sentence_id, sentence, state='raw', pretty=False, dump=True):
"\n Serialize a simple sentence.\n\n :param sentence_id: ID of current sentence.\n :type sentence_id: str\n :param sentence: Sentence.\n :type sentence: str\n :param state: State that describes the kind of processing th... |
19ee35592ab5ff8836c48b6090c0457394664c1c7c003f9778dcc7a23e16b2ba | def serialize_relation(sentence_id, sentence, relations, state='raw', infix='', pretty=False, dump=True):
"\n Serialize an extracted relation.\n \n :param sentence_id: ID of current sentence.\n :type sentence_id: str\n :param sentence: Sentence.\n :type sentence: str\n :param relations: Extract... | Serialize an extracted relation.
:param sentence_id: ID of current sentence.
:type sentence_id: str
:param sentence: Sentence.
:type sentence: str
:param relations: Extracted relations.
:type relations: list
:param infix: Infix for relation ID.
:type infix: str
:param state: State that describes the kind of processing... | backend/bwg/serializing.py | serialize_relation | majdigital/bigworldgraph | 3 | python | def serialize_relation(sentence_id, sentence, relations, state='raw', infix=, pretty=False, dump=True):
"\n Serialize an extracted relation.\n \n :param sentence_id: ID of current sentence.\n :type sentence_id: str\n :param sentence: Sentence.\n :type sentence: str\n :param relations: Extracted... | def serialize_relation(sentence_id, sentence, relations, state='raw', infix=, pretty=False, dump=True):
"\n Serialize an extracted relation.\n \n :param sentence_id: ID of current sentence.\n :type sentence_id: str\n :param sentence: Sentence.\n :type sentence: str\n :param relations: Extracted... |
b71b718a73f9a704e1cfce03413cf0c2fd429a8f1415a5f4564f6b6a58b4562f | def serialize_wikidata_entity(sentence_id, wikidata_entities, infix='', state='raw', pretty=False, dump=True):
"\n Serialize relevant information of a Wikidata entity.\n \n :param sentence_id: ID of current sentence.\n :type sentence_id: int\n :param wikidata_entities: List of Wikidata entities in a ... | Serialize relevant information of a Wikidata entity.
:param sentence_id: ID of current sentence.
:type sentence_id: int
:param wikidata_entities: List of Wikidata entities in a certain sentence.
:type wikidata_entities: list
:param infix: Infix for Wikidata entity ID.
:type infix: str
:param state: State that describe... | backend/bwg/serializing.py | serialize_wikidata_entity | majdigital/bigworldgraph | 3 | python | def serialize_wikidata_entity(sentence_id, wikidata_entities, infix=, state='raw', pretty=False, dump=True):
"\n Serialize relevant information of a Wikidata entity.\n \n :param sentence_id: ID of current sentence.\n :type sentence_id: int\n :param wikidata_entities: List of Wikidata entities in a ce... | def serialize_wikidata_entity(sentence_id, wikidata_entities, infix=, state='raw', pretty=False, dump=True):
"\n Serialize relevant information of a Wikidata entity.\n \n :param sentence_id: ID of current sentence.\n :type sentence_id: int\n :param wikidata_entities: List of Wikidata entities in a ce... |
a47933f74d0a28d84aa61dbdfe2425ea62af9294099547a43a7cbb567c797ebe | def serialize_article(article_id, article_url, article_title, sentences, state='raw', from_scratch=True, pretty=False, dump=True):
"\n Serialize a Wikipedia article.\n \n :param article_id: ID of current article.\n :type article_id: str\n :param article_url: URL of current article.\n :type article... | Serialize a Wikipedia article.
:param article_id: ID of current article.
:type article_id: str
:param article_url: URL of current article.
:type article_url: str
:param article_title: Title of current article.
:type article_title: str
:param sentences: Sentences of current article.
:type sentences: list, dict
:param s... | backend/bwg/serializing.py | serialize_article | majdigital/bigworldgraph | 3 | python | def serialize_article(article_id, article_url, article_title, sentences, state='raw', from_scratch=True, pretty=False, dump=True):
"\n Serialize a Wikipedia article.\n \n :param article_id: ID of current article.\n :type article_id: str\n :param article_url: URL of current article.\n :type article... | def serialize_article(article_id, article_url, article_title, sentences, state='raw', from_scratch=True, pretty=False, dump=True):
"\n Serialize a Wikipedia article.\n \n :param article_id: ID of current article.\n :type article_id: str\n :param article_url: URL of current article.\n :type article... |
c00c3a5d9393a65b0660dab550994c9f85e4a3bbc6db05214bf1b3dfd09f330e | def get_nes_from_sentence(sentence_data, default_ne_tag, include_tag=False):
'\n Extract all named entities from a named entity tagged sentence.\n \n :param sentence_data: Tagged sentence data.\n :type sentence_data: list\n :param default_ne_tag: Default Named Entity tag for words that are not Named ... | Extract all named entities from a named entity tagged sentence.
:param sentence_data: Tagged sentence data.
:type sentence_data: list
:param default_ne_tag: Default Named Entity tag for words that are not Named Entities.
:type default_ne_tag: str
:param include_tag: Flag to indicate whether the Named entity tag should... | backend/bwg/serializing.py | get_nes_from_sentence | majdigital/bigworldgraph | 3 | python | def get_nes_from_sentence(sentence_data, default_ne_tag, include_tag=False):
'\n Extract all named entities from a named entity tagged sentence.\n \n :param sentence_data: Tagged sentence data.\n :type sentence_data: list\n :param default_ne_tag: Default Named Entity tag for words that are not Named ... | def get_nes_from_sentence(sentence_data, default_ne_tag, include_tag=False):
'\n Extract all named entities from a named entity tagged sentence.\n \n :param sentence_data: Tagged sentence data.\n :type sentence_data: list\n :param default_ne_tag: Default Named Entity tag for words that are not Named ... |
d13089261d5276a589f240f9a05a79345a88e30e6f7a336dc5cb26029ef29443 | def just_dump(json_object, pretty=False):
'\n Self-documenting?\n \n :param json_object: Serialized JSON object\n :type json_object: dict\n :param pretty: Prettify the JSON object.\n :type pretty: bool\n :return: Dumped JSON object.\n :rtype: str\n '
options = {'ensure_ascii': False}
... | Self-documenting?
:param json_object: Serialized JSON object
:type json_object: dict
:param pretty: Prettify the JSON object.
:type pretty: bool
:return: Dumped JSON object.
:rtype: str | backend/bwg/serializing.py | just_dump | majdigital/bigworldgraph | 3 | python | def just_dump(json_object, pretty=False):
'\n Self-documenting?\n \n :param json_object: Serialized JSON object\n :type json_object: dict\n :param pretty: Prettify the JSON object.\n :type pretty: bool\n :return: Dumped JSON object.\n :rtype: str\n '
options = {'ensure_ascii': False}
... | def just_dump(json_object, pretty=False):
'\n Self-documenting?\n \n :param json_object: Serialized JSON object\n :type json_object: dict\n :param pretty: Prettify the JSON object.\n :type pretty: bool\n :return: Dumped JSON object.\n :rtype: str\n '
options = {'ensure_ascii': False}
... |
03480b278552223818b4526fca153cdfe79ea4f4c27d14eca892dce9fdac1ed0 | def deserialize_line(line, encoding='utf-8'):
'\n Transform a line in a file that was created as a result from a Luigi task into its metadata and main data.\n \n :param line: Line to be serialized.\n :type line: str\n :param encoding: Encoding of line (default is utf-8).\n :type encoding: str\n ... | Transform a line in a file that was created as a result from a Luigi task into its metadata and main data.
:param line: Line to be serialized.
:type line: str
:param encoding: Encoding of line (default is utf-8).
:type encoding: str | backend/bwg/serializing.py | deserialize_line | majdigital/bigworldgraph | 3 | python | def deserialize_line(line, encoding='utf-8'):
'\n Transform a line in a file that was created as a result from a Luigi task into its metadata and main data.\n \n :param line: Line to be serialized.\n :type line: str\n :param encoding: Encoding of line (default is utf-8).\n :type encoding: str\n ... | def deserialize_line(line, encoding='utf-8'):
'\n Transform a line in a file that was created as a result from a Luigi task into its metadata and main data.\n \n :param line: Line to be serialized.\n :type line: str\n :param encoding: Encoding of line (default is utf-8).\n :type encoding: str\n ... |
ef2027d8f1d4c47293b85ff71b3df8415de34b12d419f7eb05578a46531c9906 | def retry_with_fallback(triggering_error, **fallback_kwargs):
'\n Rerun a function in case a specific error occurs with new arguments.\n \n :param triggering_error: Error class that triggers the decorator to re-run the function.\n :type triggering_error: Exception\n :param fallback_kwargs: Fallback n... | Rerun a function in case a specific error occurs with new arguments.
:param triggering_error: Error class that triggers the decorator to re-run the function.
:type triggering_error: Exception
:param fallback_kwargs: Fallback named arguments that are applied when the function is re-run.
:type fallback_kwargs: dict
:ret... | backend/bwg/serializing.py | retry_with_fallback | majdigital/bigworldgraph | 3 | python | def retry_with_fallback(triggering_error, **fallback_kwargs):
'\n Rerun a function in case a specific error occurs with new arguments.\n \n :param triggering_error: Error class that triggers the decorator to re-run the function.\n :type triggering_error: Exception\n :param fallback_kwargs: Fallback n... | def retry_with_fallback(triggering_error, **fallback_kwargs):
'\n Rerun a function in case a specific error occurs with new arguments.\n \n :param triggering_error: Error class that triggers the decorator to re-run the function.\n :type triggering_error: Exception\n :param fallback_kwargs: Fallback n... |
08282e7543a4dcb50227b06f3e247347a5dfdc522b9dc4b73195e41f2827f6a6 | def decorator(func):
'\n Actual decorator\n '
@functools.wraps(func)
def func_wrapper(*args, **kwargs):
try:
function_result = func(*args, **kwargs)
except triggering_error:
kwargs.update(fallback_kwargs)
function_result = func(*args, **kwar... | Actual decorator | backend/bwg/serializing.py | decorator | majdigital/bigworldgraph | 3 | python | def decorator(func):
'\n \n '
@functools.wraps(func)
def func_wrapper(*args, **kwargs):
try:
function_result = func(*args, **kwargs)
except triggering_error:
kwargs.update(fallback_kwargs)
function_result = func(*args, **kwargs)
retu... | def decorator(func):
'\n \n '
@functools.wraps(func)
def func_wrapper(*args, **kwargs):
try:
function_result = func(*args, **kwargs)
except triggering_error:
kwargs.update(fallback_kwargs)
function_result = func(*args, **kwargs)
retu... |
65a047f88cd27a398c4728092c9bae8535a16dce574ec0e8208bdd35f449d656 | def deep_merge(destination: dict, source: dict, concat_lists: bool=False) -> dict:
"Recursively add all keys from `source` into `destination`.\n\n Example:\n >>> destination = {'a': 1, 'b': {'c': 3}}\n >>> source = {'a': 11, 'b': {'d': 44}, 'e': 55}\n >>> deep_merge(destination, source)\n ... | Recursively add all keys from `source` into `destination`.
Example:
>>> destination = {'a': 1, 'b': {'c': 3}}
>>> source = {'a': 11, 'b': {'d': 44}, 'e': 55}
>>> deep_merge(destination, source)
{'a': 11, 'b': {'c': 3, 'd': 44}, 'e': 55} | nestor_api/utils/dict.py | deep_merge | ChauffeurPrive/nestor-api | 2 | python | def deep_merge(destination: dict, source: dict, concat_lists: bool=False) -> dict:
"Recursively add all keys from `source` into `destination`.\n\n Example:\n >>> destination = {'a': 1, 'b': {'c': 3}}\n >>> source = {'a': 11, 'b': {'d': 44}, 'e': 55}\n >>> deep_merge(destination, source)\n ... | def deep_merge(destination: dict, source: dict, concat_lists: bool=False) -> dict:
"Recursively add all keys from `source` into `destination`.\n\n Example:\n >>> destination = {'a': 1, 'b': {'c': 3}}\n >>> source = {'a': 11, 'b': {'d': 44}, 'e': 55}\n >>> deep_merge(destination, source)\n ... |
55d90326786f333453d9ce8b042ff04f8e800706938450040c00263aad3beb2c | def expand_dim(t, dim, k):
'\n This fucntion tiles/expands a function expands a given tensor (t)\n by an amount k\n eg if t=(10,8), k=3; then if dim=0, t=(30,8) ; if dim=1, t=(10,24)\n '
expand_shape = ([(- 1)] * len(t.shape))
expand_shape[dim] = k
'\n expand: Returns a new view of the ... | This fucntion tiles/expands a function expands a given tensor (t)
by an amount k
eg if t=(10,8), k=3; then if dim=0, t=(30,8) ; if dim=1, t=(10,24) | src/bilinear_sparse_routing_amp.py | expand_dim | Sharut/Scalable-Capsules | 0 | python | def expand_dim(t, dim, k):
'\n This fucntion tiles/expands a function expands a given tensor (t)\n by an amount k\n eg if t=(10,8), k=3; then if dim=0, t=(30,8) ; if dim=1, t=(10,24)\n '
expand_shape = ([(- 1)] * len(t.shape))
expand_shape[dim] = k
'\n expand: Returns a new view of the ... | def expand_dim(t, dim, k):
'\n This fucntion tiles/expands a function expands a given tensor (t)\n by an amount k\n eg if t=(10,8), k=3; then if dim=0, t=(30,8) ; if dim=1, t=(10,24)\n '
expand_shape = ([(- 1)] * len(t.shape))
expand_shape[dim] = k
'\n expand: Returns a new view of the ... |
6725f09cd05c0138f3b353f2ae096f8fb56eeaeaf9231d17e9c7c86ee16378df | def __init__(__self__, *, resource_group_name: pulumi.Input[str], job_collection_name: Optional[pulumi.Input[str]]=None, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, properties: Optional[pulumi.Input['JobCollectionPropertiesArgs']]=None, tags: Optional[pulumi.Input[Mapping[(str, p... | The set of arguments for constructing a JobCollection resource.
:param pulumi.Input[str] resource_group_name: The resource group name.
:param pulumi.Input[str] job_collection_name: The job collection name.
:param pulumi.Input[str] location: Gets or sets the storage account location.
:param pulumi.Input[str] name: Gets ... | sdk/python/pulumi_azure_native/scheduler/job_collection.py | __init__ | sebtelko/pulumi-azure-native | 0 | python | def __init__(__self__, *, resource_group_name: pulumi.Input[str], job_collection_name: Optional[pulumi.Input[str]]=None, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, properties: Optional[pulumi.Input['JobCollectionPropertiesArgs']]=None, tags: Optional[pulumi.Input[Mapping[(str, p... | def __init__(__self__, *, resource_group_name: pulumi.Input[str], job_collection_name: Optional[pulumi.Input[str]]=None, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, properties: Optional[pulumi.Input['JobCollectionPropertiesArgs']]=None, tags: Optional[pulumi.Input[Mapping[(str, p... |
fc3a6299de8c937ab8ea3daea15d00f35d30647adde5fa4ac8c982cd6707171e | @property
@pulumi.getter(name='resourceGroupName')
def resource_group_name(self) -> pulumi.Input[str]:
'\n The resource group name.\n '
return pulumi.get(self, 'resource_group_name') | The resource group name. | sdk/python/pulumi_azure_native/scheduler/job_collection.py | resource_group_name | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter(name='resourceGroupName')
def resource_group_name(self) -> pulumi.Input[str]:
'\n \n '
return pulumi.get(self, 'resource_group_name') | @property
@pulumi.getter(name='resourceGroupName')
def resource_group_name(self) -> pulumi.Input[str]:
'\n \n '
return pulumi.get(self, 'resource_group_name')<|docstring|>The resource group name.<|endoftext|> |
c87fef2c3f19bb6d64a7995769e7ca9a6baa4ee78a1f529b7f5a17ab06b6b69d | @property
@pulumi.getter(name='jobCollectionName')
def job_collection_name(self) -> Optional[pulumi.Input[str]]:
'\n The job collection name.\n '
return pulumi.get(self, 'job_collection_name') | The job collection name. | sdk/python/pulumi_azure_native/scheduler/job_collection.py | job_collection_name | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter(name='jobCollectionName')
def job_collection_name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'job_collection_name') | @property
@pulumi.getter(name='jobCollectionName')
def job_collection_name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'job_collection_name')<|docstring|>The job collection name.<|endoftext|> |
08acc3999ff8c739394d91d66b18df53ba07664b45a627b7f377219ffcce8118 | @property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
'\n Gets or sets the storage account location.\n '
return pulumi.get(self, 'location') | Gets or sets the storage account location. | sdk/python/pulumi_azure_native/scheduler/job_collection.py | location | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'location') | @property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'location')<|docstring|>Gets or sets the storage account location.<|endoftext|> |
b851faa11fd112870d76004696e23802bcc4723e68048be52e9a89b2d1bcb26e | @property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n Gets or sets the job collection resource name.\n '
return pulumi.get(self, 'name') | Gets or sets the job collection resource name. | sdk/python/pulumi_azure_native/scheduler/job_collection.py | name | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'name') | @property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'name')<|docstring|>Gets or sets the job collection resource name.<|endoftext|> |
02efad6648a670903c6162f469c27e336c324de067a14c105613fae910537af4 | @property
@pulumi.getter
def properties(self) -> Optional[pulumi.Input['JobCollectionPropertiesArgs']]:
'\n Gets or sets the job collection properties.\n '
return pulumi.get(self, 'properties') | Gets or sets the job collection properties. | sdk/python/pulumi_azure_native/scheduler/job_collection.py | properties | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter
def properties(self) -> Optional[pulumi.Input['JobCollectionPropertiesArgs']]:
'\n \n '
return pulumi.get(self, 'properties') | @property
@pulumi.getter
def properties(self) -> Optional[pulumi.Input['JobCollectionPropertiesArgs']]:
'\n \n '
return pulumi.get(self, 'properties')<|docstring|>Gets or sets the job collection properties.<|endoftext|> |
35ae37cb0e2661d0a9ddfaea573573d7d8e245fc6d891b872705d543602eb05e | @property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]:
'\n Gets or sets the tags.\n '
return pulumi.get(self, 'tags') | Gets or sets the tags. | sdk/python/pulumi_azure_native/scheduler/job_collection.py | tags | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]:
'\n \n '
return pulumi.get(self, 'tags') | @property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[(str, pulumi.Input[str])]]]:
'\n \n '
return pulumi.get(self, 'tags')<|docstring|>Gets or sets the tags.<|endoftext|> |
d16ec4d842a1255cccfb0400596ecf253bcda8b6ee6dcc691247711681ef7c65 | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, job_collection_name: Optional[pulumi.Input[str]]=None, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, properties: Optional[pulumi.Input[pulumi.InputType['JobCollectionPropertiesArgs']]]... | API Version: 2016-03-01.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] job_collection_name: The job collection name.
:param pulumi.Input[str] location: Gets or sets the storage account location.
:param pulumi.Input[str] name: ... | sdk/python/pulumi_azure_native/scheduler/job_collection.py | __init__ | sebtelko/pulumi-azure-native | 0 | python | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, job_collection_name: Optional[pulumi.Input[str]]=None, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, properties: Optional[pulumi.Input[pulumi.InputType['JobCollectionPropertiesArgs']]]... | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, job_collection_name: Optional[pulumi.Input[str]]=None, location: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, properties: Optional[pulumi.Input[pulumi.InputType['JobCollectionPropertiesArgs']]]... |
1b59893c72f0312b6b8931fec27fd0b62ad2dfb2172869686242a2916d66b41d | @overload
def __init__(__self__, resource_name: str, args: JobCollectionArgs, opts: Optional[pulumi.ResourceOptions]=None):
"\n API Version: 2016-03-01.\n\n :param str resource_name: The name of the resource.\n :param JobCollectionArgs args: The arguments to use to populate this resource's prop... | API Version: 2016-03-01.
:param str resource_name: The name of the resource.
:param JobCollectionArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource. | sdk/python/pulumi_azure_native/scheduler/job_collection.py | __init__ | sebtelko/pulumi-azure-native | 0 | python | @overload
def __init__(__self__, resource_name: str, args: JobCollectionArgs, opts: Optional[pulumi.ResourceOptions]=None):
"\n API Version: 2016-03-01.\n\n :param str resource_name: The name of the resource.\n :param JobCollectionArgs args: The arguments to use to populate this resource's prop... | @overload
def __init__(__self__, resource_name: str, args: JobCollectionArgs, opts: Optional[pulumi.ResourceOptions]=None):
"\n API Version: 2016-03-01.\n\n :param str resource_name: The name of the resource.\n :param JobCollectionArgs args: The arguments to use to populate this resource's prop... |
cbe3af96164faef0d3d92c3f54a1f323de3bdb342aa2242fa48a6e5694ce1e78 | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'JobCollection':
"\n Get an existing JobCollection resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name:... | Get an existing JobCollection resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Optio... | sdk/python/pulumi_azure_native/scheduler/job_collection.py | get | sebtelko/pulumi-azure-native | 0 | python | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'JobCollection':
"\n Get an existing JobCollection resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name:... | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'JobCollection':
"\n Get an existing JobCollection resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name:... |
09c5fe388ed7ef5ff0640a81376999cabc78093c9707992ccb6cb8b52d7d8a68 | @property
@pulumi.getter
def location(self) -> pulumi.Output[Optional[str]]:
'\n Gets or sets the storage account location.\n '
return pulumi.get(self, 'location') | Gets or sets the storage account location. | sdk/python/pulumi_azure_native/scheduler/job_collection.py | location | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter
def location(self) -> pulumi.Output[Optional[str]]:
'\n \n '
return pulumi.get(self, 'location') | @property
@pulumi.getter
def location(self) -> pulumi.Output[Optional[str]]:
'\n \n '
return pulumi.get(self, 'location')<|docstring|>Gets or sets the storage account location.<|endoftext|> |
70db4dc8b18b0417999e4bd7915016c6d1b40116a2b0703b9ac89557f6e7dbe7 | @property
@pulumi.getter
def name(self) -> pulumi.Output[Optional[str]]:
'\n Gets or sets the job collection resource name.\n '
return pulumi.get(self, 'name') | Gets or sets the job collection resource name. | sdk/python/pulumi_azure_native/scheduler/job_collection.py | name | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter
def name(self) -> pulumi.Output[Optional[str]]:
'\n \n '
return pulumi.get(self, 'name') | @property
@pulumi.getter
def name(self) -> pulumi.Output[Optional[str]]:
'\n \n '
return pulumi.get(self, 'name')<|docstring|>Gets or sets the job collection resource name.<|endoftext|> |
adf3dbd703da7cc471bf06f4c7b02a481b39aad2d2f65426633b947c73b81dd3 | @property
@pulumi.getter
def properties(self) -> pulumi.Output['outputs.JobCollectionPropertiesResponse']:
'\n Gets or sets the job collection properties.\n '
return pulumi.get(self, 'properties') | Gets or sets the job collection properties. | sdk/python/pulumi_azure_native/scheduler/job_collection.py | properties | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter
def properties(self) -> pulumi.Output['outputs.JobCollectionPropertiesResponse']:
'\n \n '
return pulumi.get(self, 'properties') | @property
@pulumi.getter
def properties(self) -> pulumi.Output['outputs.JobCollectionPropertiesResponse']:
'\n \n '
return pulumi.get(self, 'properties')<|docstring|>Gets or sets the job collection properties.<|endoftext|> |
17d9cc93133ad812ae23a320ad63bd474a6f5add3191cdcb8d0b81c003e25602 | @property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[(str, str)]]]:
'\n Gets or sets the tags.\n '
return pulumi.get(self, 'tags') | Gets or sets the tags. | sdk/python/pulumi_azure_native/scheduler/job_collection.py | tags | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[(str, str)]]]:
'\n \n '
return pulumi.get(self, 'tags') | @property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[(str, str)]]]:
'\n \n '
return pulumi.get(self, 'tags')<|docstring|>Gets or sets the tags.<|endoftext|> |
a8a1035bb40007e2a07da45af6060c9d2c9b7136bb3b72474d6a9b151cb0cfc0 | @property
@pulumi.getter
def type(self) -> pulumi.Output[str]:
'\n Gets the job collection resource type.\n '
return pulumi.get(self, 'type') | Gets the job collection resource type. | sdk/python/pulumi_azure_native/scheduler/job_collection.py | type | sebtelko/pulumi-azure-native | 0 | python | @property
@pulumi.getter
def type(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'type') | @property
@pulumi.getter
def type(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'type')<|docstring|>Gets the job collection resource type.<|endoftext|> |
8c38f35774bad76865dab629c7e43365c3deeb9cab357bc552ee127cad530be1 | @pytest.mark.usefixtures('cleandir')
def test_fr7(spc_water_box):
'FR7: Python bindings for launching simulations.\n\n gmx.mdrun uses bindings to C++ API to launch simulations.\n '
md = gmx.mdrun(spc_water_box)
md.run() | FR7: Python bindings for launching simulations.
gmx.mdrun uses bindings to C++ API to launch simulations. | python_packaging/test/test_fr07.py | test_fr7 | kassonlab/gmxapi | 43 | python | @pytest.mark.usefixtures('cleandir')
def test_fr7(spc_water_box):
'FR7: Python bindings for launching simulations.\n\n gmx.mdrun uses bindings to C++ API to launch simulations.\n '
md = gmx.mdrun(spc_water_box)
md.run() | @pytest.mark.usefixtures('cleandir')
def test_fr7(spc_water_box):
'FR7: Python bindings for launching simulations.\n\n gmx.mdrun uses bindings to C++ API to launch simulations.\n '
md = gmx.mdrun(spc_water_box)
md.run()<|docstring|>FR7: Python bindings for launching simulations.
gmx.mdrun uses bindin... |
8d690e1e90f6a78c9e86fbeb0295b273182f5a3c6a396baa0e8b329f3468346f | def __init__(self, rc, msg):
'\n\t Initialises the ReturnCode object.\n\t \n\t :param int rc: The result code, found in constants\n\t :param str msg: The human (maybe) readable message to be included\n\t\t'
self.resultcode = rc
self.message = msg | Initialises the ReturnCode object.
:param int rc: The result code, found in constants
:param str msg: The human (maybe) readable message to be included | a10/build/lib/a10/structures/returncode.py | __init__ | THS-on/AttestationEngine | 7 | python | def __init__(self, rc, msg):
'\n\t Initialises the ReturnCode object.\n\t \n\t :param int rc: The result code, found in constants\n\t :param str msg: The human (maybe) readable message to be included\n\t\t'
self.resultcode = rc
self.message = msg | def __init__(self, rc, msg):
'\n\t Initialises the ReturnCode object.\n\t \n\t :param int rc: The result code, found in constants\n\t :param str msg: The human (maybe) readable message to be included\n\t\t'
self.resultcode = rc
self.message = msg<|docstring|>Initialises the ReturnCode object.
:para... |
ff44fcc91cf232ca694982020bcdf834cdd14d534e20b07bf0d4c6b4812924d1 | def rc(self):
'\n\t\tReturns the result code\n\t\t\n\t\t:return: the result code\n\t\t:rtype: int\n\t\t'
return self.resultcode | Returns the result code
:return: the result code
:rtype: int | a10/build/lib/a10/structures/returncode.py | rc | THS-on/AttestationEngine | 7 | python | def rc(self):
'\n\t\tReturns the result code\n\t\t\n\t\t:return: the result code\n\t\t:rtype: int\n\t\t'
return self.resultcode | def rc(self):
'\n\t\tReturns the result code\n\t\t\n\t\t:return: the result code\n\t\t:rtype: int\n\t\t'
return self.resultcode<|docstring|>Returns the result code
:return: the result code
:rtype: int<|endoftext|> |
c352440c5b8b07e8822770e0eb02e4b368cbc83dc9228e6e4aa30b005ab34cce | def msg(self):
'\n\t\tReturns the message\n\t\t\n\t\t:return: the message\n\t\t:rtype: msg\n\t\t'
return self.message | Returns the message
:return: the message
:rtype: msg | a10/build/lib/a10/structures/returncode.py | msg | THS-on/AttestationEngine | 7 | python | def msg(self):
'\n\t\tReturns the message\n\t\t\n\t\t:return: the message\n\t\t:rtype: msg\n\t\t'
return self.message | def msg(self):
'\n\t\tReturns the message\n\t\t\n\t\t:return: the message\n\t\t:rtype: msg\n\t\t'
return self.message<|docstring|>Returns the message
:return: the message
:rtype: msg<|endoftext|> |
66d39246f289a31b1060056cc7b7a7eabaf3ec58b27c562178f4939a273042b4 | def getRemoteFileSize(url, proxy=None):
'\n 通过content-length头获取远程文件大小\n '
try:
request = urllib.request.Request(url)
request.get_method = (lambda : 'HEAD')
response = urllib.request.urlopen(request)
response.read()
except urllib.error.HTTPError as e:
print(e.cod... | 通过content-length头获取远程文件大小 | amemv-video-ripper.py | getRemoteFileSize | menglike/amemv-crawler | 1 | python | def getRemoteFileSize(url, proxy=None):
'\n \n '
try:
request = urllib.request.Request(url)
request.get_method = (lambda : 'HEAD')
response = urllib.request.urlopen(request)
response.read()
except urllib.error.HTTPError as e:
print(e.code)
print(e.read()... | def getRemoteFileSize(url, proxy=None):
'\n \n '
try:
request = urllib.request.Request(url)
request.get_method = (lambda : 'HEAD')
response = urllib.request.urlopen(request)
response.read()
except urllib.error.HTTPError as e:
print(e.code)
print(e.read()... |
a6b91d154d620944d6063ee9a4e59822d806d9fba718534e8f043a064496b2cd | def convertlang(inputfile, outputfile, templates, pot=False, duplicatestyle='msgctxt', encoding='utf-8'):
'reads in stdin using fromfileclass, converts using convertorclass,\n writes to stdout'
inputstore = lang.LangStore(inputfile, encoding=encoding)
convertor = lang2po(duplicatestyle=duplicatestyle)
... | reads in stdin using fromfileclass, converts using convertorclass,
writes to stdout | vendor/packages/translate-toolkit/translate/convert/mozlang2po.py | convertlang | aokoye/fjord | 0 | python | def convertlang(inputfile, outputfile, templates, pot=False, duplicatestyle='msgctxt', encoding='utf-8'):
'reads in stdin using fromfileclass, converts using convertorclass,\n writes to stdout'
inputstore = lang.LangStore(inputfile, encoding=encoding)
convertor = lang2po(duplicatestyle=duplicatestyle)
... | def convertlang(inputfile, outputfile, templates, pot=False, duplicatestyle='msgctxt', encoding='utf-8'):
'reads in stdin using fromfileclass, converts using convertorclass,\n writes to stdout'
inputstore = lang.LangStore(inputfile, encoding=encoding)
convertor = lang2po(duplicatestyle=duplicatestyle)
... |
7eb2d1cce4c294847fa6f754138033eb76a7071e4ae4af4217140f72bcdfd5b1 | def convertstore(self, thelangfile):
'converts a file to .po format'
thetargetfile = po.pofile()
targetheader = thetargetfile.header()
targetheader.addnote(('extracted from %s' % thelangfile.filename), 'developer')
for langunit in thelangfile.units:
newunit = thetargetfile.addsourceunit(lang... | converts a file to .po format | vendor/packages/translate-toolkit/translate/convert/mozlang2po.py | convertstore | aokoye/fjord | 0 | python | def convertstore(self, thelangfile):
thetargetfile = po.pofile()
targetheader = thetargetfile.header()
targetheader.addnote(('extracted from %s' % thelangfile.filename), 'developer')
for langunit in thelangfile.units:
newunit = thetargetfile.addsourceunit(langunit.source)
newunit.se... | def convertstore(self, thelangfile):
thetargetfile = po.pofile()
targetheader = thetargetfile.header()
targetheader.addnote(('extracted from %s' % thelangfile.filename), 'developer')
for langunit in thelangfile.units:
newunit = thetargetfile.addsourceunit(langunit.source)
newunit.se... |
157675dbc49d08831112431f31a448eba155c42db3d9bd3883f12dd94a72c67f | def onHtmlClean(self):
'Executed on button press'
self.saveNow((lambda : 0))
modifiers = self.mw.app.queryKeyboardModifiers()
shift_and_click = (modifiers == Qt.ShiftModifier)
if shift_and_click:
self.onFieldUndo()
return
self._fieldUndo = Nnoe
for n in range(len(self.note.fi... | Executed on button press | html_cleaner/editor.py | onHtmlClean | Arthur-Milchior/html-cleaner | 0 | python | def onHtmlClean(self):
self.saveNow((lambda : 0))
modifiers = self.mw.app.queryKeyboardModifiers()
shift_and_click = (modifiers == Qt.ShiftModifier)
if shift_and_click:
self.onFieldUndo()
return
self._fieldUndo = Nnoe
for n in range(len(self.note.fields)):
if (not se... | def onHtmlClean(self):
self.saveNow((lambda : 0))
modifiers = self.mw.app.queryKeyboardModifiers()
shift_and_click = (modifiers == Qt.ShiftModifier)
if shift_and_click:
self.onFieldUndo()
return
self._fieldUndo = Nnoe
for n in range(len(self.note.fields)):
if (not se... |
c5c187dd025843a6c717db9c4813ad46a65a80f5f75d1bc91649471e7656e49d | def onFieldUndo(self):
'Executed on undo toggle'
if ((not hasattr(self, '_fieldUndo')) or (not self._fieldUndo)):
return
(n, html) = self._fieldUndo
self.note.fields[n] = html
self.loadNote()
self.web.setFocus()
self.web.eval(('focusField(%d);' % n)) | Executed on undo toggle | html_cleaner/editor.py | onFieldUndo | Arthur-Milchior/html-cleaner | 0 | python | def onFieldUndo(self):
if ((not hasattr(self, '_fieldUndo')) or (not self._fieldUndo)):
return
(n, html) = self._fieldUndo
self.note.fields[n] = html
self.loadNote()
self.web.setFocus()
self.web.eval(('focusField(%d);' % n)) | def onFieldUndo(self):
if ((not hasattr(self, '_fieldUndo')) or (not self._fieldUndo)):
return
(n, html) = self._fieldUndo
self.note.fields[n] = html
self.loadNote()
self.web.setFocus()
self.web.eval(('focusField(%d);' % n))<|docstring|>Executed on undo toggle<|endoftext|> |
6933a89f4aa05015bbb44444591803482d16db5953acc5d3a5dd6f83f9eb724b | def onSetNote(self, note, hide, focus):
'Reset undo contents'
self._fieldUndo = None | Reset undo contents | html_cleaner/editor.py | onSetNote | Arthur-Milchior/html-cleaner | 0 | python | def onSetNote(self, note, hide, focus):
self._fieldUndo = None | def onSetNote(self, note, hide, focus):
self._fieldUndo = None<|docstring|>Reset undo contents<|endoftext|> |
81803884e551b2011b7a338f102b5c3b6f5846ea140c6bb49d5f71d111465d00 | def onHtmlPaste(self):
'Executed on paste hotkey'
mime = self.web.mungeClip(mode=QClipboard.Clipboard)
html = mime.html()
if (not html):
return
cleaned = cleanHtml(html)
self.web.eval(('\n var pasteHTML = function(html) {\n setFormat("inserthtml", html);\n };\n ... | Executed on paste hotkey | html_cleaner/editor.py | onHtmlPaste | Arthur-Milchior/html-cleaner | 0 | python | def onHtmlPaste(self):
mime = self.web.mungeClip(mode=QClipboard.Clipboard)
html = mime.html()
if (not html):
return
cleaned = cleanHtml(html)
self.web.eval(('\n var pasteHTML = function(html) {\n setFormat("inserthtml", html);\n };\n var filterHTML = fun... | def onHtmlPaste(self):
mime = self.web.mungeClip(mode=QClipboard.Clipboard)
html = mime.html()
if (not html):
return
cleaned = cleanHtml(html)
self.web.eval(('\n var pasteHTML = function(html) {\n setFormat("inserthtml", html);\n };\n var filterHTML = fun... |
0d20286cf0839fb292dc12da0c5531964d92bab4d81968828fe9e7ab2888f604 | def setupButtons(righttopbtns, editor):
'Add buttons to editor'
html_clean_hotkey = getUserOption('html_clean_hotkey')
html_paste_hotkey = getUserOption('html_paste_hotkey')
righttopbtns.append(editor.addButton(icon='clean_html', cmd='clean_html', func=onHtmlClean, label='cH', tip='Clean HTML ({})'.form... | Add buttons to editor | html_cleaner/editor.py | setupButtons | Arthur-Milchior/html-cleaner | 0 | python | def setupButtons(righttopbtns, editor):
html_clean_hotkey = getUserOption('html_clean_hotkey')
html_paste_hotkey = getUserOption('html_paste_hotkey')
righttopbtns.append(editor.addButton(icon='clean_html', cmd='clean_html', func=onHtmlClean, label='cH', tip='Clean HTML ({})'.format(html_clean_hotkey), ... | def setupButtons(righttopbtns, editor):
html_clean_hotkey = getUserOption('html_clean_hotkey')
html_paste_hotkey = getUserOption('html_paste_hotkey')
righttopbtns.append(editor.addButton(icon='clean_html', cmd='clean_html', func=onHtmlClean, label='cH', tip='Clean HTML ({})'.format(html_clean_hotkey), ... |
42ac73ba0bd87a7808ace0ccb2d1624be179518480507e3b0041a6506f0dbf2c | def create_app(config=None):
'Creates the app.'
app = Flask('flaskbb')
app.config.from_object('flaskbb.configs.default.DefaultConfig')
app.config.from_object(config)
app.config.from_envvar('FLASKBB_SETTINGS', silent=True)
configure_blueprints(app)
configure_extensions(app)
configure_temp... | Creates the app. | flaskbb/app.py | create_app | konstantin1985/forum | 0 | python | def create_app(config=None):
app = Flask('flaskbb')
app.config.from_object('flaskbb.configs.default.DefaultConfig')
app.config.from_object(config)
app.config.from_envvar('FLASKBB_SETTINGS', silent=True)
configure_blueprints(app)
configure_extensions(app)
configure_template_filters(app)
... | def create_app(config=None):
app = Flask('flaskbb')
app.config.from_object('flaskbb.configs.default.DefaultConfig')
app.config.from_object(config)
app.config.from_envvar('FLASKBB_SETTINGS', silent=True)
configure_blueprints(app)
configure_extensions(app)
configure_template_filters(app)
... |
b0f07948a430817a797997cdf7973e1a66c396a6811dd7539f1453cf02e4c3cd | def configure_extensions(app):
'Configures the extensions.'
csrf.init_app(app)
plugin_manager.init_app(app)
db.init_app(app)
migrate.init_app(app, db)
mail.init_app(app)
cache.init_app(app)
debugtoolbar.init_app(app)
themes.init_themes(app, app_identifier='flaskbb')
redis_store.i... | Configures the extensions. | flaskbb/app.py | configure_extensions | konstantin1985/forum | 0 | python | def configure_extensions(app):
csrf.init_app(app)
plugin_manager.init_app(app)
db.init_app(app)
migrate.init_app(app, db)
mail.init_app(app)
cache.init_app(app)
debugtoolbar.init_app(app)
themes.init_themes(app, app_identifier='flaskbb')
redis_store.init_app(app)
with app.ap... | def configure_extensions(app):
csrf.init_app(app)
plugin_manager.init_app(app)
db.init_app(app)
migrate.init_app(app, db)
mail.init_app(app)
cache.init_app(app)
debugtoolbar.init_app(app)
themes.init_themes(app, app_identifier='flaskbb')
redis_store.init_app(app)
with app.ap... |
f4e5158d1151d60e616e96053c998704920936cbc404f9e5231f9d1a020695a7 | def configure_template_filters(app):
'Configures the template filters.'
filters = {}
filters['markup'] = render_markup
filters['format_date'] = format_date
filters['time_since'] = time_since
filters['is_online'] = is_online
filters['crop_title'] = crop_title
filters['forum_is_unread'] = ... | Configures the template filters. | flaskbb/app.py | configure_template_filters | konstantin1985/forum | 0 | python | def configure_template_filters(app):
filters = {}
filters['markup'] = render_markup
filters['format_date'] = format_date
filters['time_since'] = time_since
filters['is_online'] = is_online
filters['crop_title'] = crop_title
filters['forum_is_unread'] = forum_is_unread
filters['topic... | def configure_template_filters(app):
filters = {}
filters['markup'] = render_markup
filters['format_date'] = format_date
filters['time_since'] = time_since
filters['is_online'] = is_online
filters['crop_title'] = crop_title
filters['forum_is_unread'] = forum_is_unread
filters['topic... |
d97cf49e7347f13f1d04a4575fa64bf5fb0770285ea942c9713e10e2567c34b2 | def configure_context_processors(app):
'Configures the context processors.'
@app.context_processor
def inject_flaskbb_config():
'Injects the ``flaskbb_config`` config variable into the\n templates.\n '
return dict(flaskbb_config=flaskbb_config) | Configures the context processors. | flaskbb/app.py | configure_context_processors | konstantin1985/forum | 0 | python | def configure_context_processors(app):
@app.context_processor
def inject_flaskbb_config():
'Injects the ``flaskbb_config`` config variable into the\n templates.\n '
return dict(flaskbb_config=flaskbb_config) | def configure_context_processors(app):
@app.context_processor
def inject_flaskbb_config():
'Injects the ``flaskbb_config`` config variable into the\n templates.\n '
return dict(flaskbb_config=flaskbb_config)<|docstring|>Configures the context processors.<|endoftext|> |
cb460315d285ae540522606cbaf77a69e169071975dda10697cded27b2007e15 | def configure_before_handlers(app):
'Configures the before request handlers.'
@app.before_request
def update_lastseen():
'Updates `lastseen` before every reguest if the user is\n authenticated.'
if current_user.is_authenticated:
current_user.lastseen = datetime.datetime.u... | Configures the before request handlers. | flaskbb/app.py | configure_before_handlers | konstantin1985/forum | 0 | python | def configure_before_handlers(app):
@app.before_request
def update_lastseen():
'Updates `lastseen` before every reguest if the user is\n authenticated.'
if current_user.is_authenticated:
current_user.lastseen = datetime.datetime.utcnow()
db.session.add(curren... | def configure_before_handlers(app):
@app.before_request
def update_lastseen():
'Updates `lastseen` before every reguest if the user is\n authenticated.'
if current_user.is_authenticated:
current_user.lastseen = datetime.datetime.utcnow()
db.session.add(curren... |
2d91ba832ff3e3e062fd859f6f39f6f906fe699b5ac68f968fee741b794c6aef | def configure_errorhandlers(app):
'Configures the error handlers.'
@app.errorhandler(403)
def forbidden_page(error):
return (render_template('errors/forbidden_page.html'), 403)
@app.errorhandler(404)
def page_not_found(error):
return (render_template('errors/page_not_found.html'), ... | Configures the error handlers. | flaskbb/app.py | configure_errorhandlers | konstantin1985/forum | 0 | python | def configure_errorhandlers(app):
@app.errorhandler(403)
def forbidden_page(error):
return (render_template('errors/forbidden_page.html'), 403)
@app.errorhandler(404)
def page_not_found(error):
return (render_template('errors/page_not_found.html'), 404)
@app.errorhandler(500)... | def configure_errorhandlers(app):
@app.errorhandler(403)
def forbidden_page(error):
return (render_template('errors/forbidden_page.html'), 403)
@app.errorhandler(404)
def page_not_found(error):
return (render_template('errors/page_not_found.html'), 404)
@app.errorhandler(500)... |
7be2c7a2d7c74832bfe3b4e22265563ffcd7dcf93620b4305343d83e60c14e87 | def configure_logging(app):
'Configures logging.'
logs_folder = os.path.join(app.root_path, os.pardir, 'logs')
from logging.handlers import SMTPHandler
formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]')
info_log = os.path.join(logs_folder, app.config... | Configures logging. | flaskbb/app.py | configure_logging | konstantin1985/forum | 0 | python | def configure_logging(app):
logs_folder = os.path.join(app.root_path, os.pardir, 'logs')
from logging.handlers import SMTPHandler
formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]')
info_log = os.path.join(logs_folder, app.config['INFO_LOG'])
inf... | def configure_logging(app):
logs_folder = os.path.join(app.root_path, os.pardir, 'logs')
from logging.handlers import SMTPHandler
formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]')
info_log = os.path.join(logs_folder, app.config['INFO_LOG'])
inf... |
232f14cbd00fc67c98cbed2f4cc5a5d1df4ce18731308d3a617b52c02882bc30 | @login_manager.user_loader
def load_user(user_id):
'Loads the user. Required by the `login` extension.'
user_instance = User.query.filter_by(id=user_id).first()
if user_instance:
return user_instance
else:
return None | Loads the user. Required by the `login` extension. | flaskbb/app.py | load_user | konstantin1985/forum | 0 | python | @login_manager.user_loader
def load_user(user_id):
user_instance = User.query.filter_by(id=user_id).first()
if user_instance:
return user_instance
else:
return None | @login_manager.user_loader
def load_user(user_id):
user_instance = User.query.filter_by(id=user_id).first()
if user_instance:
return user_instance
else:
return None<|docstring|>Loads the user. Required by the `login` extension.<|endoftext|> |
a8ccbc3eebdf79c871a8cd1f66133ee8fdf35e6d4c464ae2983e85f60df83433 | @app.context_processor
def inject_flaskbb_config():
'Injects the ``flaskbb_config`` config variable into the\n templates.\n '
return dict(flaskbb_config=flaskbb_config) | Injects the ``flaskbb_config`` config variable into the
templates. | flaskbb/app.py | inject_flaskbb_config | konstantin1985/forum | 0 | python | @app.context_processor
def inject_flaskbb_config():
'Injects the ``flaskbb_config`` config variable into the\n templates.\n '
return dict(flaskbb_config=flaskbb_config) | @app.context_processor
def inject_flaskbb_config():
'Injects the ``flaskbb_config`` config variable into the\n templates.\n '
return dict(flaskbb_config=flaskbb_config)<|docstring|>Injects the ``flaskbb_config`` config variable into the
templates.<|endoftext|> |
43ef852061fce480c4cdbc70f8cfe4c28a7853522a738c81659575204f182296 | @app.before_request
def update_lastseen():
'Updates `lastseen` before every reguest if the user is\n authenticated.'
if current_user.is_authenticated:
current_user.lastseen = datetime.datetime.utcnow()
db.session.add(current_user)
db.session.commit() | Updates `lastseen` before every reguest if the user is
authenticated. | flaskbb/app.py | update_lastseen | konstantin1985/forum | 0 | python | @app.before_request
def update_lastseen():
'Updates `lastseen` before every reguest if the user is\n authenticated.'
if current_user.is_authenticated:
current_user.lastseen = datetime.datetime.utcnow()
db.session.add(current_user)
db.session.commit() | @app.before_request
def update_lastseen():
'Updates `lastseen` before every reguest if the user is\n authenticated.'
if current_user.is_authenticated:
current_user.lastseen = datetime.datetime.utcnow()
db.session.add(current_user)
db.session.commit()<|docstring|>Updates `lastseen`... |
899fadf79a231f53b4d65955322d0f6f80b01023564aada1ec98666ad4a38941 | def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs):
'\n Initialize the corpus reader. Categorization arguments\n (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to\n the ``CategorizedCorpusReader`` constructor. The remaining\n arguments are ... | Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining
arguments are passed to the ``CorpusReader`` constructor. | snippets/ch03/reader.py | __init__ | bkudaimi/atap | 360 | python | def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs):
'\n Initialize the corpus reader. Categorization arguments\n (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to\n the ``CategorizedCorpusReader`` constructor. The remaining\n arguments are ... | def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs):
'\n Initialize the corpus reader. Categorization arguments\n (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to\n the ``CategorizedCorpusReader`` constructor. The remaining\n arguments are ... |
07ced3e5302fb932efc7cc1cd063ba58a9bbc8f5671ca9ff4d2ffe0af4629ac7 | def resolve(self, fileids, categories):
'\n Returns a list of fileids or categories depending on what is passed\n to each internal corpus reader function. Implemented similarly to\n the NLTK ``CategorizedPlaintextCorpusReader``.\n '
if ((fileids is not None) and (categories is not No... | Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. Implemented similarly to
the NLTK ``CategorizedPlaintextCorpusReader``. | snippets/ch03/reader.py | resolve | bkudaimi/atap | 360 | python | def resolve(self, fileids, categories):
'\n Returns a list of fileids or categories depending on what is passed\n to each internal corpus reader function. Implemented similarly to\n the NLTK ``CategorizedPlaintextCorpusReader``.\n '
if ((fileids is not None) and (categories is not No... | def resolve(self, fileids, categories):
'\n Returns a list of fileids or categories depending on what is passed\n to each internal corpus reader function. Implemented similarly to\n the NLTK ``CategorizedPlaintextCorpusReader``.\n '
if ((fileids is not None) and (categories is not No... |
b75629426db4ca4f27388948e077c110b454a342f23301d4859ac01562fc3fd0 | def docs(self, fileids=None, categories=None):
'\n Returns the complete text of an HTML document, closing the document\n after we are done reading it and yielding it in a memory safe fashion.\n '
fileids = self.resolve(fileids, categories)
for (path, encoding) in self.abspaths(fileids, ... | Returns the complete text of an HTML document, closing the document
after we are done reading it and yielding it in a memory safe fashion. | snippets/ch03/reader.py | docs | bkudaimi/atap | 360 | python | def docs(self, fileids=None, categories=None):
'\n Returns the complete text of an HTML document, closing the document\n after we are done reading it and yielding it in a memory safe fashion.\n '
fileids = self.resolve(fileids, categories)
for (path, encoding) in self.abspaths(fileids, ... | def docs(self, fileids=None, categories=None):
'\n Returns the complete text of an HTML document, closing the document\n after we are done reading it and yielding it in a memory safe fashion.\n '
fileids = self.resolve(fileids, categories)
for (path, encoding) in self.abspaths(fileids, ... |
0ed160c4e5e17294a01bc68c6e9bf71a73ac8dfd677bfc1a21ebffabc65aa339 | def sizes(self, fileids=None, categories=None):
'\n Returns a list of tuples, the fileid and size on disk of the file.\n This function is used to detect oddly large files in the corpus.\n '
fileids = self.resolve(fileids, categories)
for path in self.abspaths(fileids):
(yield os... | Returns a list of tuples, the fileid and size on disk of the file.
This function is used to detect oddly large files in the corpus. | snippets/ch03/reader.py | sizes | bkudaimi/atap | 360 | python | def sizes(self, fileids=None, categories=None):
'\n Returns a list of tuples, the fileid and size on disk of the file.\n This function is used to detect oddly large files in the corpus.\n '
fileids = self.resolve(fileids, categories)
for path in self.abspaths(fileids):
(yield os... | def sizes(self, fileids=None, categories=None):
'\n Returns a list of tuples, the fileid and size on disk of the file.\n This function is used to detect oddly large files in the corpus.\n '
fileids = self.resolve(fileids, categories)
for path in self.abspaths(fileids):
(yield os... |
48f7f9c7e3165c601ed8e29b993fe01a61fd95293173f4197ac28d5757dcb844 | def html(self, fileids=None, categories=None):
'\n Returns the HTML content of each document, cleaning it using\n the readability-lxml library.\n '
for doc in self.docs(fileids, categories):
try:
(yield Paper(doc).summary())
except Unparseable as e:
p... | Returns the HTML content of each document, cleaning it using
the readability-lxml library. | snippets/ch03/reader.py | html | bkudaimi/atap | 360 | python | def html(self, fileids=None, categories=None):
'\n Returns the HTML content of each document, cleaning it using\n the readability-lxml library.\n '
for doc in self.docs(fileids, categories):
try:
(yield Paper(doc).summary())
except Unparseable as e:
p... | def html(self, fileids=None, categories=None):
'\n Returns the HTML content of each document, cleaning it using\n the readability-lxml library.\n '
for doc in self.docs(fileids, categories):
try:
(yield Paper(doc).summary())
except Unparseable as e:
p... |
4223b2f857f0ee023724ffdd1a3c1c7c1496f0e932400c0c86469c3cfeb774f3 | def paras(self, fileids=None, categories=None):
'\n Uses BeautifulSoup to parse the paragraphs from the HTML.\n '
for html in self.html(fileids, categories):
soup = bs4.BeautifulSoup(html, 'lxml')
for element in soup.find_all(self.tags):
(yield element.text)
sou... | Uses BeautifulSoup to parse the paragraphs from the HTML. | snippets/ch03/reader.py | paras | bkudaimi/atap | 360 | python | def paras(self, fileids=None, categories=None):
'\n \n '
for html in self.html(fileids, categories):
soup = bs4.BeautifulSoup(html, 'lxml')
for element in soup.find_all(self.tags):
(yield element.text)
soup.decompose() | def paras(self, fileids=None, categories=None):
'\n \n '
for html in self.html(fileids, categories):
soup = bs4.BeautifulSoup(html, 'lxml')
for element in soup.find_all(self.tags):
(yield element.text)
soup.decompose()<|docstring|>Uses BeautifulSoup to parse the... |
18522f78d22fd5c32c0bcc2063deead18ece863376b3d0ef5f581b5b9e900497 | def sents(self, fileids=None, categories=None):
'\n Uses the built in sentence tokenizer to extract sentences from the\n paragraphs. Note that this method uses BeautifulSoup to parse HTML.\n '
for paragraph in self.paras(fileids, categories):
for sentence in sent_tokenize(paragraph)... | Uses the built in sentence tokenizer to extract sentences from the
paragraphs. Note that this method uses BeautifulSoup to parse HTML. | snippets/ch03/reader.py | sents | bkudaimi/atap | 360 | python | def sents(self, fileids=None, categories=None):
'\n Uses the built in sentence tokenizer to extract sentences from the\n paragraphs. Note that this method uses BeautifulSoup to parse HTML.\n '
for paragraph in self.paras(fileids, categories):
for sentence in sent_tokenize(paragraph)... | def sents(self, fileids=None, categories=None):
'\n Uses the built in sentence tokenizer to extract sentences from the\n paragraphs. Note that this method uses BeautifulSoup to parse HTML.\n '
for paragraph in self.paras(fileids, categories):
for sentence in sent_tokenize(paragraph)... |
91e200a7b5e78fc0a357cdb385d572a355af37733b48ca484220f115558c5ecc | def words(self, fileids=None, categories=None):
'\n Uses the built in word tokenizer to extract tokens from sentences.\n Note that this method uses BeautifulSoup to parse HTML content.\n '
for sentence in self.sents(fileids, categories):
for token in wordpunct_tokenize(sentence):
... | Uses the built in word tokenizer to extract tokens from sentences.
Note that this method uses BeautifulSoup to parse HTML content. | snippets/ch03/reader.py | words | bkudaimi/atap | 360 | python | def words(self, fileids=None, categories=None):
'\n Uses the built in word tokenizer to extract tokens from sentences.\n Note that this method uses BeautifulSoup to parse HTML content.\n '
for sentence in self.sents(fileids, categories):
for token in wordpunct_tokenize(sentence):
... | def words(self, fileids=None, categories=None):
'\n Uses the built in word tokenizer to extract tokens from sentences.\n Note that this method uses BeautifulSoup to parse HTML content.\n '
for sentence in self.sents(fileids, categories):
for token in wordpunct_tokenize(sentence):
... |
4d4c8c310bda7cec4cdf37b54e8c479551840d876efb6b580fc9fe6bce09e49e | def tokenize(self, fileids=None, categories=None):
'\n Segments, tokenizes, and tags a document in the corpus.\n '
for paragraph in self.paras(fileids, categories):
(yield [pos_tag(wordpunct_tokenize(sent)) for sent in sent_tokenize(paragraph)]) | Segments, tokenizes, and tags a document in the corpus. | snippets/ch03/reader.py | tokenize | bkudaimi/atap | 360 | python | def tokenize(self, fileids=None, categories=None):
'\n \n '
for paragraph in self.paras(fileids, categories):
(yield [pos_tag(wordpunct_tokenize(sent)) for sent in sent_tokenize(paragraph)]) | def tokenize(self, fileids=None, categories=None):
'\n \n '
for paragraph in self.paras(fileids, categories):
(yield [pos_tag(wordpunct_tokenize(sent)) for sent in sent_tokenize(paragraph)])<|docstring|>Segments, tokenizes, and tags a document in the corpus.<|endoftext|> |
0e410efeaf277e95e67f6766613be4a172e65165f7d793e744e0bf4345d6d5d2 | def describe(self, fileids=None, categories=None):
'\n Performs a single pass of the corpus and\n returns a dictionary with a variety of metrics\n concerning the state of the corpus.\n '
started = time.time()
counts = nltk.FreqDist()
tokens = nltk.FreqDist()
for para in s... | Performs a single pass of the corpus and
returns a dictionary with a variety of metrics
concerning the state of the corpus. | snippets/ch03/reader.py | describe | bkudaimi/atap | 360 | python | def describe(self, fileids=None, categories=None):
'\n Performs a single pass of the corpus and\n returns a dictionary with a variety of metrics\n concerning the state of the corpus.\n '
started = time.time()
counts = nltk.FreqDist()
tokens = nltk.FreqDist()
for para in s... | def describe(self, fileids=None, categories=None):
'\n Performs a single pass of the corpus and\n returns a dictionary with a variety of metrics\n concerning the state of the corpus.\n '
started = time.time()
counts = nltk.FreqDist()
tokens = nltk.FreqDist()
for para in s... |
ee09cade30cbe782de64bc745a4ac066f875ee1c999ccac7477774be012f2896 | def __init__(self, root, fileids=PKL_PATTERN, **kwargs):
'\n Initialize the corpus reader. Categorization arguments\n (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to\n the ``CategorizedCorpusReader`` constructor. The remaining arguments\n are passed to the ``CorpusReader... | Initialize the corpus reader. Categorization arguments
(``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to
the ``CategorizedCorpusReader`` constructor. The remaining arguments
are passed to the ``CorpusReader`` constructor. | snippets/ch03/reader.py | __init__ | bkudaimi/atap | 360 | python | def __init__(self, root, fileids=PKL_PATTERN, **kwargs):
'\n Initialize the corpus reader. Categorization arguments\n (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to\n the ``CategorizedCorpusReader`` constructor. The remaining arguments\n are passed to the ``CorpusReader... | def __init__(self, root, fileids=PKL_PATTERN, **kwargs):
'\n Initialize the corpus reader. Categorization arguments\n (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to\n the ``CategorizedCorpusReader`` constructor. The remaining arguments\n are passed to the ``CorpusReader... |
6f1f3067f1f2704dc3dd5f2c22461aef8444e3460774a2d353091d183beeffbc | def resolve(self, fileids, categories):
'\n Returns a list of fileids or categories depending on what is passed\n to each internal corpus reader function. This primarily bubbles up to\n the high level ``docs`` method, but is implemented here similar to\n the nltk ``CategorizedPlaintextCo... | Returns a list of fileids or categories depending on what is passed
to each internal corpus reader function. This primarily bubbles up to
the high level ``docs`` method, but is implemented here similar to
the nltk ``CategorizedPlaintextCorpusReader``. | snippets/ch03/reader.py | resolve | bkudaimi/atap | 360 | python | def resolve(self, fileids, categories):
'\n Returns a list of fileids or categories depending on what is passed\n to each internal corpus reader function. This primarily bubbles up to\n the high level ``docs`` method, but is implemented here similar to\n the nltk ``CategorizedPlaintextCo... | def resolve(self, fileids, categories):
'\n Returns a list of fileids or categories depending on what is passed\n to each internal corpus reader function. This primarily bubbles up to\n the high level ``docs`` method, but is implemented here similar to\n the nltk ``CategorizedPlaintextCo... |
e0d66845b6f801a0a5f8d0324e30eb9005d27b236477cf303a9c627e23f8ead4 | def docs(self, fileids=None, categories=None):
'\n Returns the document loaded from a pickled object for every file in\n the corpus. Similar to the BaleenCorpusReader, this uses a generator\n to acheive memory safe iteration.\n '
fileids = self.resolve(fileids, categories)
for (p... | Returns the document loaded from a pickled object for every file in
the corpus. Similar to the BaleenCorpusReader, this uses a generator
to acheive memory safe iteration. | snippets/ch03/reader.py | docs | bkudaimi/atap | 360 | python | def docs(self, fileids=None, categories=None):
'\n Returns the document loaded from a pickled object for every file in\n the corpus. Similar to the BaleenCorpusReader, this uses a generator\n to acheive memory safe iteration.\n '
fileids = self.resolve(fileids, categories)
for (p... | def docs(self, fileids=None, categories=None):
'\n Returns the document loaded from a pickled object for every file in\n the corpus. Similar to the BaleenCorpusReader, this uses a generator\n to acheive memory safe iteration.\n '
fileids = self.resolve(fileids, categories)
for (p... |
14b5786c33f4c223f24fdd7b91f3e36aeab127f26bc5e0677275da90b1f1ccfe | def paras(self, fileids=None, categories=None):
'\n Returns a generator of paragraphs where each paragraph is a list of\n sentences, which is in turn a list of (token, tag) tuples.\n '
for doc in self.docs(fileids, categories):
for paragraph in doc:
(yield paragraph) | Returns a generator of paragraphs where each paragraph is a list of
sentences, which is in turn a list of (token, tag) tuples. | snippets/ch03/reader.py | paras | bkudaimi/atap | 360 | python | def paras(self, fileids=None, categories=None):
'\n Returns a generator of paragraphs where each paragraph is a list of\n sentences, which is in turn a list of (token, tag) tuples.\n '
for doc in self.docs(fileids, categories):
for paragraph in doc:
(yield paragraph) | def paras(self, fileids=None, categories=None):
'\n Returns a generator of paragraphs where each paragraph is a list of\n sentences, which is in turn a list of (token, tag) tuples.\n '
for doc in self.docs(fileids, categories):
for paragraph in doc:
(yield paragraph)<|do... |
b91331960734290aa60f090c05323e9d614529387c0579b8e8d8b617153aca74 | def sents(self, fileids=None, categories=None):
'\n Returns a generator of sentences where each sentence is a list of\n (token, tag) tuples.\n '
for paragraph in self.paras(fileids, categories):
for sentence in paragraph:
(yield sentence) | Returns a generator of sentences where each sentence is a list of
(token, tag) tuples. | snippets/ch03/reader.py | sents | bkudaimi/atap | 360 | python | def sents(self, fileids=None, categories=None):
'\n Returns a generator of sentences where each sentence is a list of\n (token, tag) tuples.\n '
for paragraph in self.paras(fileids, categories):
for sentence in paragraph:
(yield sentence) | def sents(self, fileids=None, categories=None):
'\n Returns a generator of sentences where each sentence is a list of\n (token, tag) tuples.\n '
for paragraph in self.paras(fileids, categories):
for sentence in paragraph:
(yield sentence)<|docstring|>Returns a generator ... |
692224c3fe7b4193d382124410591db50c90593c9a5addd8e0a0bb72a34285ce | def words(self, fileids=None, categories=None):
'\n Returns a generator of (token, tag) tuples.\n '
for token in self.tagged(fileids, categories):
(yield token[0]) | Returns a generator of (token, tag) tuples. | snippets/ch03/reader.py | words | bkudaimi/atap | 360 | python | def words(self, fileids=None, categories=None):
'\n \n '
for token in self.tagged(fileids, categories):
(yield token[0]) | def words(self, fileids=None, categories=None):
'\n \n '
for token in self.tagged(fileids, categories):
(yield token[0])<|docstring|>Returns a generator of (token, tag) tuples.<|endoftext|> |
873f20c0e56d815f45489f074e92a38f1c2c87a8006409b0bc5b109afcfc06ae | def is_logging_initialized():
'\n We use the same strategy as the logging module when checking if\n the logging was initialized - look for handlers in the root logger\n '
return (len(logging.root.handlers) > 0) | We use the same strategy as the logging module when checking if
the logging was initialized - look for handlers in the root logger | oletools/common/log_helper/_root_logger_wrapper.py | is_logging_initialized | TheVivisector/oletools | 2,059 | python | def is_logging_initialized():
'\n We use the same strategy as the logging module when checking if\n the logging was initialized - look for handlers in the root logger\n '
return (len(logging.root.handlers) > 0) | def is_logging_initialized():
'\n We use the same strategy as the logging module when checking if\n the logging was initialized - look for handlers in the root logger\n '
return (len(logging.root.handlers) > 0)<|docstring|>We use the same strategy as the logging module when checking if
the logging was ... |
4d2c40c3251fbf2c680eb0afe164440499e8f168909da81c1dfac1ebf0453107 | def set_formatter(fmt):
'\n Set the formatter to be used by every handler of the root logger.\n '
if (not is_logging_initialized()):
return
for handler in logging.root.handlers:
handler.setFormatter(fmt) | Set the formatter to be used by every handler of the root logger. | oletools/common/log_helper/_root_logger_wrapper.py | set_formatter | TheVivisector/oletools | 2,059 | python | def set_formatter(fmt):
'\n \n '
if (not is_logging_initialized()):
return
for handler in logging.root.handlers:
handler.setFormatter(fmt) | def set_formatter(fmt):
'\n \n '
if (not is_logging_initialized()):
return
for handler in logging.root.handlers:
handler.setFormatter(fmt)<|docstring|>Set the formatter to be used by every handler of the root logger.<|endoftext|> |
9f41069d514ab893d7f9070342ce7c7ff26ebe5b0430ae9c6a81e8911e5e2b9c | def iseq_cds_coverage(self, organism: str) -> float:
'\n Fraction of CDS matches from organism CDSs.\n\n Returns\n -------\n float\n Fraction of matches.\n '
chunks_dir = Path(((self._root / organism) / 'chunks'))
if (not chunks_dir.exists()):
return 0.0... | Fraction of CDS matches from organism CDSs.
Returns
-------
float
Fraction of matches. | iseq_prof/_profiling.py | iseq_cds_coverage | EBI-Metagenomics/iseq-prof | 0 | python | def iseq_cds_coverage(self, organism: str) -> float:
'\n Fraction of CDS matches from organism CDSs.\n\n Returns\n -------\n float\n Fraction of matches.\n '
chunks_dir = Path(((self._root / organism) / 'chunks'))
if (not chunks_dir.exists()):
return 0.0... | def iseq_cds_coverage(self, organism: str) -> float:
'\n Fraction of CDS matches from organism CDSs.\n\n Returns\n -------\n float\n Fraction of matches.\n '
chunks_dir = Path(((self._root / organism) / 'chunks'))
if (not chunks_dir.exists()):
return 0.0... |
b355eb521357d7458e180c646a6cb3ac2133acb985ba8453e0731a7d73d6d3ab | def merge_chunks(self, organism: str, force=False):
'\n Merge ISEQ chunked files.\n\n Parameters\n ----------\n organism\n Organism accession.\n force\n Overwrite existing files if necessary. Defaults to ``False``.\n '
names = ['output.gff', 'oamin... | Merge ISEQ chunked files.
Parameters
----------
organism
Organism accession.
force
Overwrite existing files if necessary. Defaults to ``False``. | iseq_prof/_profiling.py | merge_chunks | EBI-Metagenomics/iseq-prof | 0 | python | def merge_chunks(self, organism: str, force=False):
'\n Merge ISEQ chunked files.\n\n Parameters\n ----------\n organism\n Organism accession.\n force\n Overwrite existing files if necessary. Defaults to ``False``.\n '
names = ['output.gff', 'oamin... | def merge_chunks(self, organism: str, force=False):
'\n Merge ISEQ chunked files.\n\n Parameters\n ----------\n organism\n Organism accession.\n force\n Overwrite existing files if necessary. Defaults to ``False``.\n '
names = ['output.gff', 'oamin... |
d4d5d088a0691ff44c3080223d53b65399fea6718de0b7c81cc729d10da703ee | @not_implemented_for('directed')
@not_implemented_for('multigraph')
def cycle_basis(G, root=None):
' Returns a list of cycles which form a basis for cycles of G.\n\n A basis for cycles of a network is a minimal collection of\n cycles such that any cycle in the network can be written\n as a sum of cycles in... | Returns a list of cycles which form a basis for cycles of G.
A basis for cycles of a network is a minimal collection of
cycles such that any cycle in the network can be written
as a sum of cycles in the basis. Here summation of cycles
is defined as "exclusive or" of the edges. Cycle bases are
useful, e.g. when derivi... | src/networkx/algorithms/cycles.py | cycle_basis | MarletteFunding/aws-kube-codesuite | 184 | python | @not_implemented_for('directed')
@not_implemented_for('multigraph')
def cycle_basis(G, root=None):
' Returns a list of cycles which form a basis for cycles of G.\n\n A basis for cycles of a network is a minimal collection of\n cycles such that any cycle in the network can be written\n as a sum of cycles in... | @not_implemented_for('directed')
@not_implemented_for('multigraph')
def cycle_basis(G, root=None):
' Returns a list of cycles which form a basis for cycles of G.\n\n A basis for cycles of a network is a minimal collection of\n cycles such that any cycle in the network can be written\n as a sum of cycles in... |
a4bdeaa70e0c0ed9265718264c2e6d507cbf8eaeb1b5d6edfc46e742d907178c | @not_implemented_for('undirected')
def simple_cycles(G):
"Find simple cycles (elementary circuits) of a directed graph.\n\n A `simple cycle`, or `elementary circuit`, is a closed path where\n no node appears twice. Two elementary circuits are distinct if they\n are not cyclic permutations of each other.\n\... | Find simple cycles (elementary circuits) of a directed graph.
A `simple cycle`, or `elementary circuit`, is a closed path where
no node appears twice. Two elementary circuits are distinct if they
are not cyclic permutations of each other.
This is a nonrecursive, iterator/generator version of Johnson's
algorithm [1]_.... | src/networkx/algorithms/cycles.py | simple_cycles | MarletteFunding/aws-kube-codesuite | 184 | python | @not_implemented_for('undirected')
def simple_cycles(G):
"Find simple cycles (elementary circuits) of a directed graph.\n\n A `simple cycle`, or `elementary circuit`, is a closed path where\n no node appears twice. Two elementary circuits are distinct if they\n are not cyclic permutations of each other.\n\... | @not_implemented_for('undirected')
def simple_cycles(G):
"Find simple cycles (elementary circuits) of a directed graph.\n\n A `simple cycle`, or `elementary circuit`, is a closed path where\n no node appears twice. Two elementary circuits are distinct if they\n are not cyclic permutations of each other.\n\... |
6ab463bfaf46e67d976cddaee9362c4fa308158f48f794a9bcd97ff80518d38a | @not_implemented_for('undirected')
def recursive_simple_cycles(G):
'Find simple cycles (elementary circuits) of a directed graph.\n\n A `simple cycle`, or `elementary circuit`, is a closed path where\n no node appears twice. Two elementary circuits are distinct if they\n are not cyclic permutations of each... | Find simple cycles (elementary circuits) of a directed graph.
A `simple cycle`, or `elementary circuit`, is a closed path where
no node appears twice. Two elementary circuits are distinct if they
are not cyclic permutations of each other.
This version uses a recursive algorithm to build a list of cycles.
You should p... | src/networkx/algorithms/cycles.py | recursive_simple_cycles | MarletteFunding/aws-kube-codesuite | 184 | python | @not_implemented_for('undirected')
def recursive_simple_cycles(G):
'Find simple cycles (elementary circuits) of a directed graph.\n\n A `simple cycle`, or `elementary circuit`, is a closed path where\n no node appears twice. Two elementary circuits are distinct if they\n are not cyclic permutations of each... | @not_implemented_for('undirected')
def recursive_simple_cycles(G):
'Find simple cycles (elementary circuits) of a directed graph.\n\n A `simple cycle`, or `elementary circuit`, is a closed path where\n no node appears twice. Two elementary circuits are distinct if they\n are not cyclic permutations of each... |
816a5cc70c0153cb1256c2345b54c4d75fe011a72305a059de2e3992bfe3c42d | def find_cycle(G, source=None, orientation='original'):
'\n Returns the edges of a cycle found via a directed, depth-first traversal.\n\n Parameters\n ----------\n G : graph\n A directed/undirected graph/multigraph.\n\n source : node, list of nodes\n The node from which the traversal be... | Returns the edges of a cycle found via a directed, depth-first traversal.
Parameters
----------
G : graph
A directed/undirected graph/multigraph.
source : node, list of nodes
The node from which the traversal begins. If None, then a source
is chosen arbitrarily and repeatedly until all edges from each nod... | src/networkx/algorithms/cycles.py | find_cycle | MarletteFunding/aws-kube-codesuite | 184 | python | def find_cycle(G, source=None, orientation='original'):
'\n Returns the edges of a cycle found via a directed, depth-first traversal.\n\n Parameters\n ----------\n G : graph\n A directed/undirected graph/multigraph.\n\n source : node, list of nodes\n The node from which the traversal be... | def find_cycle(G, source=None, orientation='original'):
'\n Returns the edges of a cycle found via a directed, depth-first traversal.\n\n Parameters\n ----------\n G : graph\n A directed/undirected graph/multigraph.\n\n source : node, list of nodes\n The node from which the traversal be... |
1727301a2e4f087a89b6e6a6208d465d6c746c27a380fa987484ab8228ac556c | def _unblock(thisnode):
'Recursively unblock and remove nodes from B[thisnode].'
if blocked[thisnode]:
blocked[thisnode] = False
while B[thisnode]:
_unblock(B[thisnode].pop()) | Recursively unblock and remove nodes from B[thisnode]. | src/networkx/algorithms/cycles.py | _unblock | MarletteFunding/aws-kube-codesuite | 184 | python | def _unblock(thisnode):
if blocked[thisnode]:
blocked[thisnode] = False
while B[thisnode]:
_unblock(B[thisnode].pop()) | def _unblock(thisnode):
if blocked[thisnode]:
blocked[thisnode] = False
while B[thisnode]:
_unblock(B[thisnode].pop())<|docstring|>Recursively unblock and remove nodes from B[thisnode].<|endoftext|> |
e77ac0fcaed2689a02cc873049ef5cb6c6dbea382c52a5666062e8d757109867 | def add_attributes(self, **attribute_names):
'\n defines the attributes that each record can have. If a database was previously defined and\n new attributes are added the database records are updated.\n :param attribute_names: The attribute names\n :param d: The dictionary/table name\n ... | defines the attributes that each record can have. If a database was previously defined and
new attributes are added the database records are updated.
:param attribute_names: The attribute names
:param d: The dictionary/table name | deprecated/dev/erika/PersistentDb.py | add_attributes | cloudmesh/client-deprecated | 0 | python | def add_attributes(self, **attribute_names):
'\n defines the attributes that each record can have. If a database was previously defined and\n new attributes are added the database records are updated.\n :param attribute_names: The attribute names\n :param d: The dictionary/table name\n ... | def add_attributes(self, **attribute_names):
'\n defines the attributes that each record can have. If a database was previously defined and\n new attributes are added the database records are updated.\n :param attribute_names: The attribute names\n :param d: The dictionary/table name\n ... |
3eb5046f212ccb73505c0f6d996b79b03664625f3b3eeca360a11e98b64a058b | def add_attribute(self, name, data_type):
'\n Alters the table with an additional column\n :param name: Name of the attribute\n :param data_type: Type of the attribute\n '
data = {'table': self.table_name, 'name': name, 'type': data_type}
self.cur.execute('ALTER TABLE {table} ADD... | Alters the table with an additional column
:param name: Name of the attribute
:param data_type: Type of the attribute | deprecated/dev/erika/PersistentDb.py | add_attribute | cloudmesh/client-deprecated | 0 | python | def add_attribute(self, name, data_type):
'\n Alters the table with an additional column\n :param name: Name of the attribute\n :param data_type: Type of the attribute\n '
data = {'table': self.table_name, 'name': name, 'type': data_type}
self.cur.execute('ALTER TABLE {table} ADD... | def add_attribute(self, name, data_type):
'\n Alters the table with an additional column\n :param name: Name of the attribute\n :param data_type: Type of the attribute\n '
data = {'table': self.table_name, 'name': name, 'type': data_type}
self.cur.execute('ALTER TABLE {table} ADD... |
244b6c86e9139fd879e48ad94618308268cbadd2d95f1895719af58067f2d164 | def get_attribute_type(self, name):
'\n This returns the data type of the attribute\n :param name: Name of the attribute\n :return: The type of the attribute\n '
result = self.cur.execute('PRAGMA table_info({})'.format(self.table_name)).fetchall()
for res in result:
if (r... | This returns the data type of the attribute
:param name: Name of the attribute
:return: The type of the attribute | deprecated/dev/erika/PersistentDb.py | get_attribute_type | cloudmesh/client-deprecated | 0 | python | def get_attribute_type(self, name):
'\n This returns the data type of the attribute\n :param name: Name of the attribute\n :return: The type of the attribute\n '
result = self.cur.execute('PRAGMA table_info({})'.format(self.table_name)).fetchall()
for res in result:
if (r... | def get_attribute_type(self, name):
'\n This returns the data type of the attribute\n :param name: Name of the attribute\n :return: The type of the attribute\n '
result = self.cur.execute('PRAGMA table_info({})'.format(self.table_name)).fetchall()
for res in result:
if (r... |
daf68389fb0b4fb558d568d68fc80d2e27114204d70912bf9fa07d53d646aac8 | def add(self, **kwargs):
'\n adds the dict to the database. The attribute "name" is used to define a\n unique name for the object in the database\n :param record: the dict that at minimum must contain a name attribute\n '
column_names = ', '.join(kwargs.keys())
placeholders = ', ... | adds the dict to the database. The attribute "name" is used to define a
unique name for the object in the database
:param record: the dict that at minimum must contain a name attribute | deprecated/dev/erika/PersistentDb.py | add | cloudmesh/client-deprecated | 0 | python | def add(self, **kwargs):
'\n adds the dict to the database. The attribute "name" is used to define a\n unique name for the object in the database\n :param record: the dict that at minimum must contain a name attribute\n '
column_names = ', '.join(kwargs.keys())
placeholders = ', ... | def add(self, **kwargs):
'\n adds the dict to the database. The attribute "name" is used to define a\n unique name for the object in the database\n :param record: the dict that at minimum must contain a name attribute\n '
column_names = ', '.join(kwargs.keys())
placeholders = ', ... |
c8daf83bacfad9791642873a49eab130788f711f278db987e59ec5549933edbc | def delete(self, operator, **kwargs):
'\n deletes all elements in that match the query formulated by kwargs and the operator\n operators that are allowed are = and, or\n :param kwargs: the attributes that we look for\n :param operator: the operator and / or\n '
data = {'table'... | deletes all elements in that match the query formulated by kwargs and the operator
operators that are allowed are = and, or
:param kwargs: the attributes that we look for
:param operator: the operator and / or | deprecated/dev/erika/PersistentDb.py | delete | cloudmesh/client-deprecated | 0 | python | def delete(self, operator, **kwargs):
'\n deletes all elements in that match the query formulated by kwargs and the operator\n operators that are allowed are = and, or\n :param kwargs: the attributes that we look for\n :param operator: the operator and / or\n '
data = {'table'... | def delete(self, operator, **kwargs):
'\n deletes all elements in that match the query formulated by kwargs and the operator\n operators that are allowed are = and, or\n :param kwargs: the attributes that we look for\n :param operator: the operator and / or\n '
data = {'table'... |
99d3cdb95da027a6dd1cbc2e29342757ea45745ad90933c8f778ebe07a6e646c | def find(self, operator, **kwargs):
'\n Finds all the elements that match the query formulated by kwargs and the operator.\n :param operator: The operators and / or\n :param kwargs: The attributes that we look for\n '
data = {'table': self.table_name, 'key_values': ' {} '.format(oper... | Finds all the elements that match the query formulated by kwargs and the operator.
:param operator: The operators and / or
:param kwargs: The attributes that we look for | deprecated/dev/erika/PersistentDb.py | find | cloudmesh/client-deprecated | 0 | python | def find(self, operator, **kwargs):
'\n Finds all the elements that match the query formulated by kwargs and the operator.\n :param operator: The operators and / or\n :param kwargs: The attributes that we look for\n '
data = {'table': self.table_name, 'key_values': ' {} '.format(oper... | def find(self, operator, **kwargs):
'\n Finds all the elements that match the query formulated by kwargs and the operator.\n :param operator: The operators and / or\n :param kwargs: The attributes that we look for\n '
data = {'table': self.table_name, 'key_values': ' {} '.format(oper... |
3d2a42991c6e099df2c641bc405abd0b5c974903a96c29d786731a738b8d0990 | def get(self, operator, **kwargs):
'\n Finds the first element that match the query formulated by kwargs and the operator\n :param operator: The operators and / or\n :param kwargs: The attributes that we look for\n '
data = {'table': self.table_name, 'key_values': ' {} '.format(opera... | Finds the first element that match the query formulated by kwargs and the operator
:param operator: The operators and / or
:param kwargs: The attributes that we look for | deprecated/dev/erika/PersistentDb.py | get | cloudmesh/client-deprecated | 0 | python | def get(self, operator, **kwargs):
'\n Finds the first element that match the query formulated by kwargs and the operator\n :param operator: The operators and / or\n :param kwargs: The attributes that we look for\n '
data = {'table': self.table_name, 'key_values': ' {} '.format(opera... | def get(self, operator, **kwargs):
'\n Finds the first element that match the query formulated by kwargs and the operator\n :param operator: The operators and / or\n :param kwargs: The attributes that we look for\n '
data = {'table': self.table_name, 'key_values': ' {} '.format(opera... |
31d5c0ff1d61a6149df3e2c27579c05e69527393d680b4c6cb876d203e9f6a7a | @property
def json(self):
'\n :return: The json object of the database\n '
self.con.row_factory = sqlite.Row
result = self.con.cursor().execute('SELECT * FROM {} '.format(self.table_name)).fetchall()
return json.dumps([dict(row) for row in result]) | :return: The json object of the database | deprecated/dev/erika/PersistentDb.py | json | cloudmesh/client-deprecated | 0 | python | @property
def json(self):
'\n \n '
self.con.row_factory = sqlite.Row
result = self.con.cursor().execute('SELECT * FROM {} '.format(self.table_name)).fetchall()
return json.dumps([dict(row) for row in result]) | @property
def json(self):
'\n \n '
self.con.row_factory = sqlite.Row
result = self.con.cursor().execute('SELECT * FROM {} '.format(self.table_name)).fetchall()
return json.dumps([dict(row) for row in result])<|docstring|>:return: The json object of the database<|endoftext|> |
94e913b6d3a0c03d86cb31b1d480bdaaa0b23d194c38fe7100cdbc21ba4f6a60 | def backup(self, file_name):
'\n backs up the current database. If the filename is omitted, the backup will be\n created in the same directory as the database with the postfix .bak.#\n where # is the largest number that has not yet been assigned. For example.,\n lets assume a backup exis... | backs up the current database. If the filename is omitted, the backup will be
created in the same directory as the database with the postfix .bak.#
where # is the largest number that has not yet been assigned. For example.,
lets assume a backup exists with the name file.bak.9, than the next higher
number is used (e.g. ... | deprecated/dev/erika/PersistentDb.py | backup | cloudmesh/client-deprecated | 0 | python | def backup(self, file_name):
'\n backs up the current database. If the filename is omitted, the backup will be\n created in the same directory as the database with the postfix .bak.#\n where # is the largest number that has not yet been assigned. For example.,\n lets assume a backup exis... | def backup(self, file_name):
'\n backs up the current database. If the filename is omitted, the backup will be\n created in the same directory as the database with the postfix .bak.#\n where # is the largest number that has not yet been assigned. For example.,\n lets assume a backup exis... |
42b89eca09679a5efe0dbcc52984324c85461eac85123d47a4e324d4549474e8 | def AlistipesPutredinis(directed: bool=False, verbose: int=2, cache_path: str='graphs/string', **additional_graph_kwargs: Dict) -> EnsmallenGraph:
'Return new instance of the Alistipes putredinis graph.\n\n The graph is automatically retrieved from the STRING repository. \n\n\t\n\n Parameters\n -----------... | Return new instance of the Alistipes putredinis graph.
The graph is automatically retrieved from the STRING repository.
Parameters
-------------------
directed: bool = False,
Wether to load the graph as directed or undirected.
By default false.
verbose: int = 2,
Wether to show loading bars during t... | bindings/python/ensmallen_graph/datasets/string/alistipesputredinis.py | AlistipesPutredinis | caufieldjh/ensmallen_graph | 0 | python | def AlistipesPutredinis(directed: bool=False, verbose: int=2, cache_path: str='graphs/string', **additional_graph_kwargs: Dict) -> EnsmallenGraph:
'Return new instance of the Alistipes putredinis graph.\n\n The graph is automatically retrieved from the STRING repository. \n\n\t\n\n Parameters\n -----------... | def AlistipesPutredinis(directed: bool=False, verbose: int=2, cache_path: str='graphs/string', **additional_graph_kwargs: Dict) -> EnsmallenGraph:
'Return new instance of the Alistipes putredinis graph.\n\n The graph is automatically retrieved from the STRING repository. \n\n\t\n\n Parameters\n -----------... |
c2d1ed24a699493fb3519ce0b5283ded6d2de0376e43317bcec39e6280c082b5 | @classmethod
def generate_live_csv_data(cls, today_entity_csv, entity, entries_in_interval):
'\n Generates the live report using the `today_entity_csv` file received.\n '
with open(today_entity_csv, 'r') as log:
objects_logs = {}
lastest_entries = deque(csv.DictReader(log), entries... | Generates the live report using the `today_entity_csv` file received. | libs/metrics/occupancy.py | generate_live_csv_data | myunyui22/smart-social-distancing-dev | 0 | python | @classmethod
def generate_live_csv_data(cls, today_entity_csv, entity, entries_in_interval):
'\n \n '
with open(today_entity_csv, 'r') as log:
objects_logs = {}
lastest_entries = deque(csv.DictReader(log), entries_in_interval)
for entry in lastest_entries:
cls.p... | @classmethod
def generate_live_csv_data(cls, today_entity_csv, entity, entries_in_interval):
'\n \n '
with open(today_entity_csv, 'r') as log:
objects_logs = {}
lastest_entries = deque(csv.DictReader(log), entries_in_interval)
for entry in lastest_entries:
cls.p... |
f92220a3ee99494b4668602b6a86c772fb667f81e2f9af71c4b7699d66023590 | def test_td3_same_seed(self):
'\n Test whether multiple runs with the same seed leads to exact same model weights for their TD3\n '
td3 = TD3(state_dim=self.state_dim, action_dim=self.action_dim, max_action=self.max_action)
file_name = f'TD3_{self.env_str}_{self.seed}'
td3_params = Namespa... | Test whether multiple runs with the same seed leads to exact same model weights for their TD3 | test/test_reproducibility.py | test_td3_same_seed | Heyjuke58/sac_reproduction | 0 | python | def test_td3_same_seed(self):
'\n \n '
td3 = TD3(state_dim=self.state_dim, action_dim=self.action_dim, max_action=self.max_action)
file_name = f'TD3_{self.env_str}_{self.seed}'
td3_params = Namespace(policy='TD3', env=self.env_str, seed=self.seed, start_timesteps=1000, eval_freq=5000.0, ma... | def test_td3_same_seed(self):
'\n \n '
td3 = TD3(state_dim=self.state_dim, action_dim=self.action_dim, max_action=self.max_action)
file_name = f'TD3_{self.env_str}_{self.seed}'
td3_params = Namespace(policy='TD3', env=self.env_str, seed=self.seed, start_timesteps=1000, eval_freq=5000.0, ma... |
5b276c5d0d61826b262c150cd3597d662572ccdb9df31f867495ab709e1d1780 | def test_sac_same_seed(self):
'\n Test whether multiple runs with the same seed leads to exact same model weights for our SAC\n '
sac_hpars = SAC_HOPPER.copy()
sac_hpars.update({'seed': 12, 'max_env_steps': 2000, 'file_name': 'sac', 'dest_model_path': './test/models', 'dest_res_path': './test/... | Test whether multiple runs with the same seed leads to exact same model weights for our SAC | test/test_reproducibility.py | test_sac_same_seed | Heyjuke58/sac_reproduction | 0 | python | def test_sac_same_seed(self):
'\n \n '
sac_hpars = SAC_HOPPER.copy()
sac_hpars.update({'seed': 12, 'max_env_steps': 2000, 'file_name': 'sac', 'dest_model_path': './test/models', 'dest_res_path': './test/results'})
sac1 = SACTrainer(**sac_hpars)
sac1.train()
sac2 = SACTrainer(**sac_... | def test_sac_same_seed(self):
'\n \n '
sac_hpars = SAC_HOPPER.copy()
sac_hpars.update({'seed': 12, 'max_env_steps': 2000, 'file_name': 'sac', 'dest_model_path': './test/models', 'dest_res_path': './test/results'})
sac1 = SACTrainer(**sac_hpars)
sac1.train()
sac2 = SACTrainer(**sac_... |
9a8b89e79735ac7c13f35d24dd03cd577f139406d45806aa69609222e087bc74 | def test_sac_v2_same_seed(self):
'\n Test whether multiple runs with the same seed leads to exact same model weights for our SAC V2\n '
sac_v2_hpars = SAC_V2_HOPPER.copy()
sac_v2_hpars.update({'seed': 12, 'max_env_steps': 2000, 'file_name': 'sac_v2', 'dest_model_path': './test/models', 'dest_r... | Test whether multiple runs with the same seed leads to exact same model weights for our SAC V2 | test/test_reproducibility.py | test_sac_v2_same_seed | Heyjuke58/sac_reproduction | 0 | python | def test_sac_v2_same_seed(self):
'\n \n '
sac_v2_hpars = SAC_V2_HOPPER.copy()
sac_v2_hpars.update({'seed': 12, 'max_env_steps': 2000, 'file_name': 'sac_v2', 'dest_model_path': './test/models', 'dest_res_path': './test/results'})
sac1 = SACTrainerV2(**sac_v2_hpars)
sac1.train()
sac2... | def test_sac_v2_same_seed(self):
'\n \n '
sac_v2_hpars = SAC_V2_HOPPER.copy()
sac_v2_hpars.update({'seed': 12, 'max_env_steps': 2000, 'file_name': 'sac_v2', 'dest_model_path': './test/models', 'dest_res_path': './test/results'})
sac1 = SACTrainerV2(**sac_v2_hpars)
sac1.train()
sac2... |
5fed1e514fc9f5482a479d8b5ebda48c3e3c3fa94f8f3655b856b075b3bd2c3c | def __init__(self, *, df: Optional[pd.DataFrame]=None, csv_path: Optional[Union[(str, Path)]]=None, remove_id_substring: Optional[bool]=False):
"Init function.\n\n Only `df` or `csv_path` can be specified.\n\n Keyword Arguments:\n df {Optional[pd.DataFrame]}\n -- A raw datafr... | Init function.
Only `df` or `csv_path` can be specified.
Keyword Arguments:
df {Optional[pd.DataFrame]}
-- A raw dataframe. (default: {None})
csv_path {Optional[Union[str, Path]]}
-- Path to a dataframe (default: {None})
remove_id_substring {Optional[bool]}
-- If True, replaces 'id... | foreshadow/smart/intent_resolving/core/data_set_parsers/lazy_dataframe_loader.py | __init__ | adithyabsk/foreshadow | 25 | python | def __init__(self, *, df: Optional[pd.DataFrame]=None, csv_path: Optional[Union[(str, Path)]]=None, remove_id_substring: Optional[bool]=False):
"Init function.\n\n Only `df` or `csv_path` can be specified.\n\n Keyword Arguments:\n df {Optional[pd.DataFrame]}\n -- A raw datafr... | def __init__(self, *, df: Optional[pd.DataFrame]=None, csv_path: Optional[Union[(str, Path)]]=None, remove_id_substring: Optional[bool]=False):
"Init function.\n\n Only `df` or `csv_path` can be specified.\n\n Keyword Arguments:\n df {Optional[pd.DataFrame]}\n -- A raw datafr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.