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
4b304a7d5ca49dbfcdbe22c4113743bee1d652ae9d560bca1ac74abfa83be3c4
@register_bprop(primops.J) def bprop_J(x, dz): 'Backpropagator for primitive `J`.' return (Jinv(dz),)
Backpropagator for primitive `J`.
myia/prim/grad_implementations.py
bprop_J
bartvm/myia
0
python
@register_bprop(primops.J) def bprop_J(x, dz): return (Jinv(dz),)
@register_bprop(primops.J) def bprop_J(x, dz): return (Jinv(dz),)<|docstring|>Backpropagator for primitive `J`.<|endoftext|>
021e4f4f1e4217ffade258e9293758df4183e47536a1b882ec6ec9f6c6aafa66
@register_bprop(primops.Jinv) def bprop_Jinv(x, dz): 'Backpropagator for primitive `Jinv`.' return (J(dz),)
Backpropagator for primitive `Jinv`.
myia/prim/grad_implementations.py
bprop_Jinv
bartvm/myia
0
python
@register_bprop(primops.Jinv) def bprop_Jinv(x, dz): return (J(dz),)
@register_bprop(primops.Jinv) def bprop_Jinv(x, dz): return (J(dz),)<|docstring|>Backpropagator for primitive `Jinv`.<|endoftext|>
ba20a57e97ba0bfe5f516cfb4d5b2ee2cae5e37ca9eded06dc8f03bd3ebfb4d9
@register_bprop(primops.zeros_like) def bprop_zeros_like(x, dz): 'Backpropagator for primitive `zeros_like`.' return (zeros_like(x),)
Backpropagator for primitive `zeros_like`.
myia/prim/grad_implementations.py
bprop_zeros_like
bartvm/myia
0
python
@register_bprop(primops.zeros_like) def bprop_zeros_like(x, dz): return (zeros_like(x),)
@register_bprop(primops.zeros_like) def bprop_zeros_like(x, dz): return (zeros_like(x),)<|docstring|>Backpropagator for primitive `zeros_like`.<|endoftext|>
8acc855af5308533397f3072e77f116a2c35db385208403c1a1f5ebc587c49a9
@register_augm(primops.if_) def __fprop__if_(c, tb, fb): 'Backpropagator for primitive `if`.' if Jinv(c): res = tb() else: res = fb() (rval, branch_bprop) = res def __bprop__if_(dout): zc = zeros_like(c) value = branch_bprop(dout)[0] if Jinv(c): r...
Backpropagator for primitive `if`.
myia/prim/grad_implementations.py
__fprop__if_
bartvm/myia
0
python
@register_augm(primops.if_) def __fprop__if_(c, tb, fb): if Jinv(c): res = tb() else: res = fb() (rval, branch_bprop) = res def __bprop__if_(dout): zc = zeros_like(c) value = branch_bprop(dout)[0] if Jinv(c): return ((), zc, value, zeros_like(Jin...
@register_augm(primops.if_) def __fprop__if_(c, tb, fb): if Jinv(c): res = tb() else: res = fb() (rval, branch_bprop) = res def __bprop__if_(dout): zc = zeros_like(c) value = branch_bprop(dout)[0] if Jinv(c): return ((), zc, value, zeros_like(Jin...
a44bebef150e1c2f0cf7dac653ea9147634515ed7498d880c9864211b7c8e75c
def _get_val_list() -> list: '\n create a list of validator addresses with prefix fxvaloper\n ' cmd = Cmd._filter_cmd('validator_info', 'cmd_list.json') data = Cmd._get_raw_data(cmd) val_add_list = [] for d in data['validators']: val_add_list.append(d['operator_address']) return va...
create a list of validator addresses with prefix fxvaloper
Data.py
_get_val_list
FunctionX/validator_queries
0
python
def _get_val_list() -> list: '\n \n ' cmd = Cmd._filter_cmd('validator_info', 'cmd_list.json') data = Cmd._get_raw_data(cmd) val_add_list = [] for d in data['validators']: val_add_list.append(d['operator_address']) return val_add_list
def _get_val_list() -> list: '\n \n ' cmd = Cmd._filter_cmd('validator_info', 'cmd_list.json') data = Cmd._get_raw_data(cmd) val_add_list = [] for d in data['validators']: val_add_list.append(d['operator_address']) return val_add_list<|docstring|>create a list of validator addresse...
834dcdfd8ffb5c0717add245c5d010234ff0ee0f2f27f813373fba4453cb1f2e
def _get_create_val_event(): '\n get all validator birthdate and corresponding wallet address\n ' validators = [] cmd = Cmd._filter_cmd('create_val', 'cmd_list.json') data = Cmd._get_raw_data(cmd) for create_val in data['txs']: address = create_val['logs'][0]['events'][0]['attributes']...
get all validator birthdate and corresponding wallet address
Data.py
_get_create_val_event
FunctionX/validator_queries
0
python
def _get_create_val_event(): '\n \n ' validators = [] cmd = Cmd._filter_cmd('create_val', 'cmd_list.json') data = Cmd._get_raw_data(cmd) for create_val in data['txs']: address = create_val['logs'][0]['events'][0]['attributes'][0]['value'] wallet_address = create_val['logs'][0][...
def _get_create_val_event(): '\n \n ' validators = [] cmd = Cmd._filter_cmd('create_val', 'cmd_list.json') data = Cmd._get_raw_data(cmd) for create_val in data['txs']: address = create_val['logs'][0]['events'][0]['attributes'][0]['value'] wallet_address = create_val['logs'][0][...
70ba9d5fd4c87cac94036523dc096c8840a2656b274d55d3abde6a9418c7656d
def _get_val_outstanding_comms(): '\n get outstanding comms for validator\n ' values = [] val_list = _get_val_list() for val in val_list: cmd = Cmd._filter_cmd('val_outstanding_comms', 'cmd_list.json') cmd[4] = val commission_data = Cmd._get_raw_data(cmd) if (len(co...
get outstanding comms for validator
Data.py
_get_val_outstanding_comms
FunctionX/validator_queries
0
python
def _get_val_outstanding_comms(): '\n \n ' values = [] val_list = _get_val_list() for val in val_list: cmd = Cmd._filter_cmd('val_outstanding_comms', 'cmd_list.json') cmd[4] = val commission_data = Cmd._get_raw_data(cmd) if (len(commission_data['commission']) > 0): ...
def _get_val_outstanding_comms(): '\n \n ' values = [] val_list = _get_val_list() for val in val_list: cmd = Cmd._filter_cmd('val_outstanding_comms', 'cmd_list.json') cmd[4] = val commission_data = Cmd._get_raw_data(cmd) if (len(commission_data['commission']) > 0): ...
af7d0e1c9537b2d07e2e938de493b6d0318dcb7d98c347706492b6dd5737adbe
def _get_val_outstanding_delegated_rewards(): '\n get delegated rewards\n ' values = [] val_info = _get_create_val_event() for v in val_info: wallet_address = v[1] cmd = Cmd._filter_cmd('delegator_rewards', 'cmd_list.json') cmd[4] = wallet_address rewards_data = Cmd...
get delegated rewards
Data.py
_get_val_outstanding_delegated_rewards
FunctionX/validator_queries
0
python
def _get_val_outstanding_delegated_rewards(): '\n \n ' values = [] val_info = _get_create_val_event() for v in val_info: wallet_address = v[1] cmd = Cmd._filter_cmd('delegator_rewards', 'cmd_list.json') cmd[4] = wallet_address rewards_data = Cmd._get_raw_data(cmd) ...
def _get_val_outstanding_delegated_rewards(): '\n \n ' values = [] val_info = _get_create_val_event() for v in val_info: wallet_address = v[1] cmd = Cmd._filter_cmd('delegator_rewards', 'cmd_list.json') cmd[4] = wallet_address rewards_data = Cmd._get_raw_data(cmd) ...
c83e15daf8e4f179e7bd61936aaff08fdfd92f73654f195a62e559eeadeeb23e
def _get_all_val_withdrawals(): '\n filters out all validator withdrawals "withdraw_rewards" & "withdraw_commission" and returns it in a dictionary with the following format:\n [\n {\n "EXAMPLE_KEY": {\n "3159434": {\n "withdraw_rewards": "11552361789042999846400FX",\n ...
filters out all validator withdrawals "withdraw_rewards" & "withdraw_commission" and returns it in a dictionary with the following format: [ { "EXAMPLE_KEY": { "3159434": { "withdraw_rewards": "11552361789042999846400FX", "withdraw_commission": "23699689167352852164225FX" ...
Data.py
_get_all_val_withdrawals
FunctionX/validator_queries
0
python
def _get_all_val_withdrawals(): '\n filters out all validator withdrawals "withdraw_rewards" & "withdraw_commission" and returns it in a dictionary with the following format:\n [\n {\n "EXAMPLE_KEY": {\n "3159434": {\n "withdraw_rewards": "11552361789042999846400FX",\n ...
def _get_all_val_withdrawals(): '\n filters out all validator withdrawals "withdraw_rewards" & "withdraw_commission" and returns it in a dictionary with the following format:\n [\n {\n "EXAMPLE_KEY": {\n "3159434": {\n "withdraw_rewards": "11552361789042999846400FX",\n ...
b716089f960c1394ba27998a10e5db86e580eb84e906d92b5039ce3dcd2b195c
def _get_val_fxcored_status() -> dict: '\n query all status for validators\n ' cmd = Cmd._filter_cmd('validator_info', 'cmd_list.json') data = Cmd._get_raw_data(cmd) return data
query all status for validators
Data.py
_get_val_fxcored_status
FunctionX/validator_queries
0
python
def _get_val_fxcored_status() -> dict: '\n \n ' cmd = Cmd._filter_cmd('validator_info', 'cmd_list.json') data = Cmd._get_raw_data(cmd) return data
def _get_val_fxcored_status() -> dict: '\n \n ' cmd = Cmd._filter_cmd('validator_info', 'cmd_list.json') data = Cmd._get_raw_data(cmd) return data<|docstring|>query all status for validators<|endoftext|>
02da70c53b3a9e60405faffead547736a6185b269c77d77bac1b58103e1f4c64
async def trusted_sync(self, full_node: WSChivesConnection): '\n Performs a one-time sync with each trusted peer, subscribing to interested puzzle hashes and coin ids.\n ' self.log.info('Starting trusted sync') assert (self.wallet_state_manager is not None) self.wallet_state_manager.set_sy...
Performs a one-time sync with each trusted peer, subscribing to interested puzzle hashes and coin ids.
chives/wallet/wallet_node.py
trusted_sync
HiveProject2021/chives-light-wallet
7
python
async def trusted_sync(self, full_node: WSChivesConnection): '\n \n ' self.log.info('Starting trusted sync') assert (self.wallet_state_manager is not None) self.wallet_state_manager.set_sync_mode(True) start_time = time.time() current_height: uint32 = self.wallet_state_manager.bloc...
async def trusted_sync(self, full_node: WSChivesConnection): '\n \n ' self.log.info('Starting trusted sync') assert (self.wallet_state_manager is not None) self.wallet_state_manager.set_sync_mode(True) start_time = time.time() current_height: uint32 = self.wallet_state_manager.bloc...
ed625342e106ac45c0b6209c9096f6a3e7cb09d8c4d8de85e8b7019ceda7a240
async def subscribe_to_phs(self, puzzle_hashes: List[bytes32], peer: WSChivesConnection, height=uint32(0)): '\n Tell full nodes that we are interested in puzzle hashes, and for trusted connections, add the new coin state\n for the puzzle hashes.\n ' msg = wallet_protocol.RegisterForPhUpdate...
Tell full nodes that we are interested in puzzle hashes, and for trusted connections, add the new coin state for the puzzle hashes.
chives/wallet/wallet_node.py
subscribe_to_phs
HiveProject2021/chives-light-wallet
7
python
async def subscribe_to_phs(self, puzzle_hashes: List[bytes32], peer: WSChivesConnection, height=uint32(0)): '\n Tell full nodes that we are interested in puzzle hashes, and for trusted connections, add the new coin state\n for the puzzle hashes.\n ' msg = wallet_protocol.RegisterForPhUpdate...
async def subscribe_to_phs(self, puzzle_hashes: List[bytes32], peer: WSChivesConnection, height=uint32(0)): '\n Tell full nodes that we are interested in puzzle hashes, and for trusted connections, add the new coin state\n for the puzzle hashes.\n ' msg = wallet_protocol.RegisterForPhUpdate...
a7008a8754ab3fcf8a12af49560a029c63a4baa869c48eb0aad7f1e7bd749a8b
async def subscribe_to_coin_updates(self, coin_names, peer, height=uint32(0)): '\n Tell full nodes that we are interested in coin ids, and for trusted connections, add the new coin state\n for the coin changes.\n ' msg = wallet_protocol.RegisterForCoinUpdates(coin_names, height) all_coi...
Tell full nodes that we are interested in coin ids, and for trusted connections, add the new coin state for the coin changes.
chives/wallet/wallet_node.py
subscribe_to_coin_updates
HiveProject2021/chives-light-wallet
7
python
async def subscribe_to_coin_updates(self, coin_names, peer, height=uint32(0)): '\n Tell full nodes that we are interested in coin ids, and for trusted connections, add the new coin state\n for the coin changes.\n ' msg = wallet_protocol.RegisterForCoinUpdates(coin_names, height) all_coi...
async def subscribe_to_coin_updates(self, coin_names, peer, height=uint32(0)): '\n Tell full nodes that we are interested in coin ids, and for trusted connections, add the new coin state\n for the coin changes.\n ' msg = wallet_protocol.RegisterForCoinUpdates(coin_names, height) all_coi...
64b61688e42e046e689b8f1e6d707713b1b620ca86f3eaa30830db04ee5c7fa1
async def get_timestamp_for_height(self, height: uint32) -> uint64: '\n Returns the timestamp for transaction block at h=height, if not transaction block, backtracks until it finds\n a transaction block\n ' if (height in self.height_to_time): return self.height_to_time[height] p...
Returns the timestamp for transaction block at h=height, if not transaction block, backtracks until it finds a transaction block
chives/wallet/wallet_node.py
get_timestamp_for_height
HiveProject2021/chives-light-wallet
7
python
async def get_timestamp_for_height(self, height: uint32) -> uint64: '\n Returns the timestamp for transaction block at h=height, if not transaction block, backtracks until it finds\n a transaction block\n ' if (height in self.height_to_time): return self.height_to_time[height] p...
async def get_timestamp_for_height(self, height: uint32) -> uint64: '\n Returns the timestamp for transaction block at h=height, if not transaction block, backtracks until it finds\n a transaction block\n ' if (height in self.height_to_time): return self.height_to_time[height] p...
11033983d65736d6619694035142f78084fb38b23623b0907113f31f35c74c93
async def validate_received_state_from_peer(self, coin_states: List[CoinState], peer, weight_proof: WeightProof, peer_request_cache: PeerRequestCache, return_old_state: bool) -> List[CoinState]: '\n Returns all state that is valid and included in the blockchain proved by the weight proof. If return_old_state...
Returns all state that is valid and included in the blockchain proved by the weight proof. If return_old_states is False, only new states that are not in the coin_store are returned.
chives/wallet/wallet_node.py
validate_received_state_from_peer
HiveProject2021/chives-light-wallet
7
python
async def validate_received_state_from_peer(self, coin_states: List[CoinState], peer, weight_proof: WeightProof, peer_request_cache: PeerRequestCache, return_old_state: bool) -> List[CoinState]: '\n Returns all state that is valid and included in the blockchain proved by the weight proof. If return_old_state...
async def validate_received_state_from_peer(self, coin_states: List[CoinState], peer, weight_proof: WeightProof, peer_request_cache: PeerRequestCache, return_old_state: bool) -> List[CoinState]: '\n Returns all state that is valid and included in the blockchain proved by the weight proof. If return_old_state...
596ece9a42b5dee5e38a79b51978a5b6d101260746641e7908cfac073cf257c1
def api211_snmp_managers_delete_with_http_info(self, authorization=None, x_request_id=None, names=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'Delete SNMP manager\n\n Deletes the SNMP manager object and stops communication with specified managers.\n ...
Delete SNMP manager Deletes the SNMP manager object and stops communication with specified managers. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.api211_snmp_managers_delete_with_http_info(async_req=True) >>> result = thread....
pypureclient/flasharray/FA_2_11/api/snmp_managers_api.py
api211_snmp_managers_delete_with_http_info
genegr/py-pure-client
14
python
def api211_snmp_managers_delete_with_http_info(self, authorization=None, x_request_id=None, names=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'Delete SNMP manager\n\n Deletes the SNMP manager object and stops communication with specified managers.\n ...
def api211_snmp_managers_delete_with_http_info(self, authorization=None, x_request_id=None, names=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'Delete SNMP manager\n\n Deletes the SNMP manager object and stops communication with specified managers.\n ...
5b4ad6991fc5d05077f03100263d8a13e1ce5ff6b68e6ce624ceb9418b2e5e83
def api211_snmp_managers_get_with_http_info(self, authorization=None, x_request_id=None, continuation_token=None, filter=None, limit=None, names=None, offset=None, sort=None, total_item_count=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'List SNMP managers\n\n ...
List SNMP managers Displays designated SNMP managers and their communication and security attributes. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.api211_snmp_managers_get_with_http_info(async_req=True) >>> result = thread.ge...
pypureclient/flasharray/FA_2_11/api/snmp_managers_api.py
api211_snmp_managers_get_with_http_info
genegr/py-pure-client
14
python
def api211_snmp_managers_get_with_http_info(self, authorization=None, x_request_id=None, continuation_token=None, filter=None, limit=None, names=None, offset=None, sort=None, total_item_count=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'List SNMP managers\n\n ...
def api211_snmp_managers_get_with_http_info(self, authorization=None, x_request_id=None, continuation_token=None, filter=None, limit=None, names=None, offset=None, sort=None, total_item_count=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'List SNMP managers\n\n ...
ac5040e568f45bea79c37a3ee383c4dcc5a5e9aeb0f46738506e3981a19122b5
def api211_snmp_managers_patch_with_http_info(self, snmp_manager=None, authorization=None, x_request_id=None, names=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'Modify SNMP manager\n\n Modifies the name or the protocol attributes of the specified SNMP m...
Modify SNMP manager Modifies the name or the protocol attributes of the specified SNMP manager. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.api211_snmp_managers_patch_with_http_info(snmp_manager, async_req=True) >>> result =...
pypureclient/flasharray/FA_2_11/api/snmp_managers_api.py
api211_snmp_managers_patch_with_http_info
genegr/py-pure-client
14
python
def api211_snmp_managers_patch_with_http_info(self, snmp_manager=None, authorization=None, x_request_id=None, names=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'Modify SNMP manager\n\n Modifies the name or the protocol attributes of the specified SNMP m...
def api211_snmp_managers_patch_with_http_info(self, snmp_manager=None, authorization=None, x_request_id=None, names=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'Modify SNMP manager\n\n Modifies the name or the protocol attributes of the specified SNMP m...
6332b0aa0be61964ce1e7d4bc34dc3a72a30b861b5f09923f437b197c2ecbbc0
def api211_snmp_managers_post_with_http_info(self, snmp_manager=None, authorization=None, x_request_id=None, names=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'Create SNMP manager\n\n Creates a Purity SNMP manager object that identifies a host (SNMP man...
Create SNMP manager Creates a Purity SNMP manager object that identifies a host (SNMP manager) and specifies the protocol attributes for communicating with it. Once a manager object is created, the transmission of SNMP traps is immediately enabled. This method makes a synchronous HTTP request by default. To make an as...
pypureclient/flasharray/FA_2_11/api/snmp_managers_api.py
api211_snmp_managers_post_with_http_info
genegr/py-pure-client
14
python
def api211_snmp_managers_post_with_http_info(self, snmp_manager=None, authorization=None, x_request_id=None, names=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'Create SNMP manager\n\n Creates a Purity SNMP manager object that identifies a host (SNMP man...
def api211_snmp_managers_post_with_http_info(self, snmp_manager=None, authorization=None, x_request_id=None, names=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'Create SNMP manager\n\n Creates a Purity SNMP manager object that identifies a host (SNMP man...
711ea9e2feb2cf1a890246a7c3156d12b32b24449d6eebdd4dbd77f224638845
def api211_snmp_managers_test_get_with_http_info(self, authorization=None, x_request_id=None, filter=None, limit=None, names=None, offset=None, sort=None, total_item_count=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'List SNMP manager test results\n\n D...
List SNMP manager test results Displays SNMP manager test results (traps or informs). This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.api211_snmp_managers_test_get_with_http_info(async_req=True) >>> result = thread.get() :param...
pypureclient/flasharray/FA_2_11/api/snmp_managers_api.py
api211_snmp_managers_test_get_with_http_info
genegr/py-pure-client
14
python
def api211_snmp_managers_test_get_with_http_info(self, authorization=None, x_request_id=None, filter=None, limit=None, names=None, offset=None, sort=None, total_item_count=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'List SNMP manager test results\n\n D...
def api211_snmp_managers_test_get_with_http_info(self, authorization=None, x_request_id=None, filter=None, limit=None, names=None, offset=None, sort=None, total_item_count=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None): 'List SNMP manager test results\n\n D...
f50404ed1c9db82cedef731663bfcb2b2408786791ca744108ccf06e3620e05e
def create_lockfile_name(): 'Generate a unique lock filename using UUID' lock_suffix = str(uuid.uuid4())[:7] return f'smartsim-{lock_suffix}.lock'
Generate a unique lock filename using UUID
smartsim/_core/utils/helpers.py
create_lockfile_name
MattToast/SmartSim
0
python
def create_lockfile_name(): lock_suffix = str(uuid.uuid4())[:7] return f'smartsim-{lock_suffix}.lock'
def create_lockfile_name(): lock_suffix = str(uuid.uuid4())[:7] return f'smartsim-{lock_suffix}.lock'<|docstring|>Generate a unique lock filename using UUID<|endoftext|>
2e85a5f4c706ca0afc3d694b6ba1d96cb450cd09b74026d8b55201045efdca8e
def get_base_36_repr(positive_int): 'Converts a positive integer to its base 36 representation\n :param positive_int: the positive integer to convert\n :type positive_int: int\n :return: base 36 representation of the given positive int\n :rtype: str\n ' digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVW...
Converts a positive integer to its base 36 representation :param positive_int: the positive integer to convert :type positive_int: int :return: base 36 representation of the given positive int :rtype: str
smartsim/_core/utils/helpers.py
get_base_36_repr
MattToast/SmartSim
0
python
def get_base_36_repr(positive_int): 'Converts a positive integer to its base 36 representation\n :param positive_int: the positive integer to convert\n :type positive_int: int\n :return: base 36 representation of the given positive int\n :rtype: str\n ' digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVW...
def get_base_36_repr(positive_int): 'Converts a positive integer to its base 36 representation\n :param positive_int: the positive integer to convert\n :type positive_int: int\n :return: base 36 representation of the given positive int\n :rtype: str\n ' digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVW...
24f2f857db55e04a0f317dfb036a8d2cebe6b94a1d51edeefc820e2de772b6a8
def expand_exe_path(exe): 'Takes an executable and returns the full path to that executable\n\n :param exe: executable or file\n :type exe: str\n :raises TypeError: if file is not an executable\n :raises FileNotFoundError: if executable cannot be found\n ' in_path = which(exe) if (not in_path...
Takes an executable and returns the full path to that executable :param exe: executable or file :type exe: str :raises TypeError: if file is not an executable :raises FileNotFoundError: if executable cannot be found
smartsim/_core/utils/helpers.py
expand_exe_path
MattToast/SmartSim
0
python
def expand_exe_path(exe): 'Takes an executable and returns the full path to that executable\n\n :param exe: executable or file\n :type exe: str\n :raises TypeError: if file is not an executable\n :raises FileNotFoundError: if executable cannot be found\n ' in_path = which(exe) if (not in_path...
def expand_exe_path(exe): 'Takes an executable and returns the full path to that executable\n\n :param exe: executable or file\n :type exe: str\n :raises TypeError: if file is not an executable\n :raises FileNotFoundError: if executable cannot be found\n ' in_path = which(exe) if (not in_path...
183f56f44f56e9ce2508b8b187a88baae213809be7ebbfbf083f01a25d213345
def colorize(string, color, bold=False, highlight=False): '\n Colorize a string.\n This function was originally written by John Schulman.\n And then borrowed from spinningup\n https://github.com/openai/spinningup/blob/master/spinup/utils/logx.py\n ' attr = [] num = color2num[color] if hig...
Colorize a string. This function was originally written by John Schulman. And then borrowed from spinningup https://github.com/openai/spinningup/blob/master/spinup/utils/logx.py
smartsim/_core/utils/helpers.py
colorize
MattToast/SmartSim
0
python
def colorize(string, color, bold=False, highlight=False): '\n Colorize a string.\n This function was originally written by John Schulman.\n And then borrowed from spinningup\n https://github.com/openai/spinningup/blob/master/spinup/utils/logx.py\n ' attr = [] num = color2num[color] if hig...
def colorize(string, color, bold=False, highlight=False): '\n Colorize a string.\n This function was originally written by John Schulman.\n And then borrowed from spinningup\n https://github.com/openai/spinningup/blob/master/spinup/utils/logx.py\n ' attr = [] num = color2num[color] if hig...
20691331a227c98794598bb17ca69fe81b0cda103ee9443a42f01680e6d79e6e
def delete_elements(dictionary, key_list): 'Delete elements from a dictionary.\n :param dictionary: the dictionary from which the elements must be deleted.\n :type dictionary: dict\n :param key_list: the list of keys to delete from the dictionary.\n :type key: any\n ' for key in key_list: ...
Delete elements from a dictionary. :param dictionary: the dictionary from which the elements must be deleted. :type dictionary: dict :param key_list: the list of keys to delete from the dictionary. :type key: any
smartsim/_core/utils/helpers.py
delete_elements
MattToast/SmartSim
0
python
def delete_elements(dictionary, key_list): 'Delete elements from a dictionary.\n :param dictionary: the dictionary from which the elements must be deleted.\n :type dictionary: dict\n :param key_list: the list of keys to delete from the dictionary.\n :type key: any\n ' for key in key_list: ...
def delete_elements(dictionary, key_list): 'Delete elements from a dictionary.\n :param dictionary: the dictionary from which the elements must be deleted.\n :type dictionary: dict\n :param key_list: the list of keys to delete from the dictionary.\n :type key: any\n ' for key in key_list: ...
40b5679cf0d72859c958eb986d262e020bd54c2a6e0b0a03a157e721e1c937e9
def cat_arg_and_value(arg_name, value): 'Concatenate a command line argument and its value\n\n This function returns ``arg_name`` and ``value\n concatenated in the best possible way for a command\n line execution, namely:\n - if arg_name starts with `--` (e.g. `--arg`):\n `arg_name=value` is return...
Concatenate a command line argument and its value This function returns ``arg_name`` and ``value concatenated in the best possible way for a command line execution, namely: - if arg_name starts with `--` (e.g. `--arg`): `arg_name=value` is returned (i.e. `--arg=val`) - if arg_name starts with `-` (e.g. `-a`): `arg...
smartsim/_core/utils/helpers.py
cat_arg_and_value
MattToast/SmartSim
0
python
def cat_arg_and_value(arg_name, value): 'Concatenate a command line argument and its value\n\n This function returns ``arg_name`` and ``value\n concatenated in the best possible way for a command\n line execution, namely:\n - if arg_name starts with `--` (e.g. `--arg`):\n `arg_name=value` is return...
def cat_arg_and_value(arg_name, value): 'Concatenate a command line argument and its value\n\n This function returns ``arg_name`` and ``value\n concatenated in the best possible way for a command\n line execution, namely:\n - if arg_name starts with `--` (e.g. `--arg`):\n `arg_name=value` is return...
420de37507d2672f36f956d6a04a6788375c934d9edc99c05817ef55d008f35e
def installed_redisai_backends(backends_path=None): 'Check which ML backends are available for the RedisAI module.\n\n The optional argument ``backends_path`` is needed if the backends\n have not been built as part of the SmartSim building process (i.e.\n they have not been built by invoking `smart build`)...
Check which ML backends are available for the RedisAI module. The optional argument ``backends_path`` is needed if the backends have not been built as part of the SmartSim building process (i.e. they have not been built by invoking `smart build`). In that case ``backends_path`` should point to the directory containing...
smartsim/_core/utils/helpers.py
installed_redisai_backends
MattToast/SmartSim
0
python
def installed_redisai_backends(backends_path=None): 'Check which ML backends are available for the RedisAI module.\n\n The optional argument ``backends_path`` is needed if the backends\n have not been built as part of the SmartSim building process (i.e.\n they have not been built by invoking `smart build`)...
def installed_redisai_backends(backends_path=None): 'Check which ML backends are available for the RedisAI module.\n\n The optional argument ``backends_path`` is needed if the backends\n have not been built as part of the SmartSim building process (i.e.\n they have not been built by invoking `smart build`)...
e443939263030fcffa857f44bbbda7a1a3429ddf01bd75b22ec4e086a4fc64e9
def import_helper(mod_name): '\n Helper function used to temporarily override stdout before importing\n a module.\n ' try: sys.stdout = STDOUT_FAKE __import__(mod_name) finally: sys.stdout = STDOUT_BAK
Helper function used to temporarily override stdout before importing a module.
Tests/Tools/stdmodules.py
import_helper
kmad1729/ironpython3
1,872
python
def import_helper(mod_name): '\n Helper function used to temporarily override stdout before importing\n a module.\n ' try: sys.stdout = STDOUT_FAKE __import__(mod_name) finally: sys.stdout = STDOUT_BAK
def import_helper(mod_name): '\n Helper function used to temporarily override stdout before importing\n a module.\n ' try: sys.stdout = STDOUT_FAKE __import__(mod_name) finally: sys.stdout = STDOUT_BAK<|docstring|>Helper function used to temporarily override stdout before im...
3e98a30466f1132c8743699fff1b4b776e716581cc80c4ee3fc8b11be84f3432
def is_package(dir_name): '\n Returns True if dir_name is actually a Python package in the current\n working directory.\n ' if ('.' in dir_name): return False try: if (not nt.stat(dir_name)): return False except: return False try: if ('__init__.py...
Returns True if dir_name is actually a Python package in the current working directory.
Tests/Tools/stdmodules.py
is_package
kmad1729/ironpython3
1,872
python
def is_package(dir_name): '\n Returns True if dir_name is actually a Python package in the current\n working directory.\n ' if ('.' in dir_name): return False try: if (not nt.stat(dir_name)): return False except: return False try: if ('__init__.py...
def is_package(dir_name): '\n Returns True if dir_name is actually a Python package in the current\n working directory.\n ' if ('.' in dir_name): return False try: if (not nt.stat(dir_name)): return False except: return False try: if ('__init__.py...
2afe2e8758de7f4906be04f3396ec23e651d829ccef7d267e3c7fa68c3ee6836
def check_package(package_name): '\n Checks all subpackages and modules in the package_name package.\n ' cwd = nt.getcwd() if (cwd == CPY_LIB_DIR): root_name = package_name else: root_name = ((cwd.split((CPY_DIR + '\\Lib\\'))[1].replace('\\', '.') + '.') + package_name) try: ...
Checks all subpackages and modules in the package_name package.
Tests/Tools/stdmodules.py
check_package
kmad1729/ironpython3
1,872
python
def check_package(package_name): '\n \n ' cwd = nt.getcwd() if (cwd == CPY_LIB_DIR): root_name = package_name else: root_name = ((cwd.split((CPY_DIR + '\\Lib\\'))[1].replace('\\', '.') + '.') + package_name) try: import_helper(package_name) log_ok(root_name) ...
def check_package(package_name): '\n \n ' cwd = nt.getcwd() if (cwd == CPY_LIB_DIR): root_name = package_name else: root_name = ((cwd.split((CPY_DIR + '\\Lib\\'))[1].replace('\\', '.') + '.') + package_name) try: import_helper(package_name) log_ok(root_name) ...
58228279d53cf4115f00a088f114ec01bf4aacc98352c111a56b59d9b4d5d361
def add_lineselector(figure): 'Add a line selector for all axes of the given figure.\n Return the mpl connection id for disconnection later.\n ' lineselector = LineSelector(figure.get_axes()) def wrapper(event): lineselector.handler(event) return figure.canvas.mpl_connect('key_press_event...
Add a line selector for all axes of the given figure. Return the mpl connection id for disconnection later.
frexp/plot/lineselector.py
add_lineselector
brandjon/frexp
0
python
def add_lineselector(figure): 'Add a line selector for all axes of the given figure.\n Return the mpl connection id for disconnection later.\n ' lineselector = LineSelector(figure.get_axes()) def wrapper(event): lineselector.handler(event) return figure.canvas.mpl_connect('key_press_event...
def add_lineselector(figure): 'Add a line selector for all axes of the given figure.\n Return the mpl connection id for disconnection later.\n ' lineselector = LineSelector(figure.get_axes()) def wrapper(event): lineselector.handler(event) return figure.canvas.mpl_connect('key_press_event...
a149667aa1994659b0088b64545271c23f8c40d6ee0da0b35da4bf3b208de1f7
def goto(self, i): 'Go to the new index. No effect if cursor is currently i.' if (i == self.cursor): return if (self.cursor is not None): self.cb_deactivate(self.cursor, active=False) self.cursor = i if (self.cursor is not None): self.cb_activate(self.cursor, active=True)
Go to the new index. No effect if cursor is currently i.
frexp/plot/lineselector.py
goto
brandjon/frexp
0
python
def goto(self, i): if (i == self.cursor): return if (self.cursor is not None): self.cb_deactivate(self.cursor, active=False) self.cursor = i if (self.cursor is not None): self.cb_activate(self.cursor, active=True)
def goto(self, i): if (i == self.cursor): return if (self.cursor is not None): self.cb_deactivate(self.cursor, active=False) self.cursor = i if (self.cursor is not None): self.cb_activate(self.cursor, active=True)<|docstring|>Go to the new index. No effect if cursor is curre...
e66bc336c9cd98a76dabdfbabf3884d04fe250de3fb7df057ac4bb7729ef77a4
def changeby(self, offset): 'Skip to an offset of the current position.' states = ([None] + list(range(0, self.num_elems))) i = states.index(self.cursor) i = ((i + offset) % len(states)) self.goto(states[i])
Skip to an offset of the current position.
frexp/plot/lineselector.py
changeby
brandjon/frexp
0
python
def changeby(self, offset): states = ([None] + list(range(0, self.num_elems))) i = states.index(self.cursor) i = ((i + offset) % len(states)) self.goto(states[i])
def changeby(self, offset): states = ([None] + list(range(0, self.num_elems))) i = states.index(self.cursor) i = ((i + offset) % len(states)) self.goto(states[i])<|docstring|>Skip to an offset of the current position.<|endoftext|>
1a91ad4bc2e18dd08348805086160d9c3a5b4f11281bf5a1b01ccce4628f55c4
def __init__(self, axes_list): 'Construct to select from among lines of the given axes.' self.lines = [] self.leglines = [] self.legtexts = [] for axes in axes_list: new_lines = [line for line in axes.get_lines() if (line.get_label() != '_nolegend_')] leg = axes.get_legend() ...
Construct to select from among lines of the given axes.
frexp/plot/lineselector.py
__init__
brandjon/frexp
0
python
def __init__(self, axes_list): self.lines = [] self.leglines = [] self.legtexts = [] for axes in axes_list: new_lines = [line for line in axes.get_lines() if (line.get_label() != '_nolegend_')] leg = axes.get_legend() if (leg is not None): new_leglines = leg.get_...
def __init__(self, axes_list): self.lines = [] self.leglines = [] self.legtexts = [] for axes in axes_list: new_lines = [line for line in axes.get_lines() if (line.get_label() != '_nolegend_')] leg = axes.get_legend() if (leg is not None): new_leglines = leg.get_...
4f021fb3ca8b9f538e802a48d9a26a7164b658fb06e45e9c3798675e6d316193
def get_cur_file_path() -> Path: '\n Description: get path of current file\n :param NAME: TYPE, MEAN\n :return: TYPE, MEAN\n ' return Path(__file__).resolve()
Description: get path of current file :param NAME: TYPE, MEAN :return: TYPE, MEAN
Released2019June06/GeneralUtils.py
get_cur_file_path
minhncedutw/pointcloud-robot-grasp
3
python
def get_cur_file_path() -> Path: '\n Description: get path of current file\n :param NAME: TYPE, MEAN\n :return: TYPE, MEAN\n ' return Path(__file__).resolve()
def get_cur_file_path() -> Path: '\n Description: get path of current file\n :param NAME: TYPE, MEAN\n :return: TYPE, MEAN\n ' return Path(__file__).resolve()<|docstring|>Description: get path of current file :param NAME: TYPE, MEAN :return: TYPE, MEAN<|endoftext|>
601ffa6fef1f28cc4c43e6661bf26345bcd5d294a07742c5af752204c2a060c7
def get_cur_parent_dir() -> Path: '\n Description: get parent directory of current file\n :param NAME: TYPE, MEAN\n :return: TYPE, MEAN\n ' return Path(__file__).resolve().parent
Description: get parent directory of current file :param NAME: TYPE, MEAN :return: TYPE, MEAN
Released2019June06/GeneralUtils.py
get_cur_parent_dir
minhncedutw/pointcloud-robot-grasp
3
python
def get_cur_parent_dir() -> Path: '\n Description: get parent directory of current file\n :param NAME: TYPE, MEAN\n :return: TYPE, MEAN\n ' return Path(__file__).resolve().parent
def get_cur_parent_dir() -> Path: '\n Description: get parent directory of current file\n :param NAME: TYPE, MEAN\n :return: TYPE, MEAN\n ' return Path(__file__).resolve().parent<|docstring|>Description: get parent directory of current file :param NAME: TYPE, MEAN :return: TYPE, MEAN<|endoftext|>
64f220cc03b51cbf1a477c7ee43030bbf8538ed1e33832ddcec94d4628813d7f
def get_cur_exe_dir() -> Path: '\n Description: get current execution directory\n :param NAME: TYPE, MEAN\n :return: TYPE, MEAN\n ' return Path(__file__).cwd()
Description: get current execution directory :param NAME: TYPE, MEAN :return: TYPE, MEAN
Released2019June06/GeneralUtils.py
get_cur_exe_dir
minhncedutw/pointcloud-robot-grasp
3
python
def get_cur_exe_dir() -> Path: '\n Description: get current execution directory\n :param NAME: TYPE, MEAN\n :return: TYPE, MEAN\n ' return Path(__file__).cwd()
def get_cur_exe_dir() -> Path: '\n Description: get current execution directory\n :param NAME: TYPE, MEAN\n :return: TYPE, MEAN\n ' return Path(__file__).cwd()<|docstring|>Description: get current execution directory :param NAME: TYPE, MEAN :return: TYPE, MEAN<|endoftext|>
16a8decbca4e460ddfa100ff6344124ada735c94853550e67c05446775948b6a
def makedir(path: Union[(str, Path)], mode=511, parents: bool=True, exist_ok: bool=False, verbose=False): '\n Description:\n :param path: [Path, str], path\n :param mode: [0o777, 0o444, ...], chmod(refer: https://help.ubuntu.com/community/FilePermissions)\n :param parents: [Path, str], True: if path is ...
Description: :param path: [Path, str], path :param mode: [0o777, 0o444, ...], chmod(refer: https://help.ubuntu.com/community/FilePermissions) :param parents: [Path, str], True: if path is relative & False: if path is absolute :param exist_ok: boolean, if path already exists, True: force overwrite & False: raise error :...
Released2019June06/GeneralUtils.py
makedir
minhncedutw/pointcloud-robot-grasp
3
python
def makedir(path: Union[(str, Path)], mode=511, parents: bool=True, exist_ok: bool=False, verbose=False): '\n Description:\n :param path: [Path, str], path\n :param mode: [0o777, 0o444, ...], chmod(refer: https://help.ubuntu.com/community/FilePermissions)\n :param parents: [Path, str], True: if path is ...
def makedir(path: Union[(str, Path)], mode=511, parents: bool=True, exist_ok: bool=False, verbose=False): '\n Description:\n :param path: [Path, str], path\n :param mode: [0o777, 0o444, ...], chmod(refer: https://help.ubuntu.com/community/FilePermissions)\n :param parents: [Path, str], True: if path is ...
25abc935917b65ff1fba2acbd0f0f65ccb234885f8128050ffbb83e24b16f195
def onehot_encoding(labels, n_classes) -> np.ndarray: '\n Description: convert integer labels to one hot\n :param labels: an [int, ndarray], a label array of shape (d0, d1, d2, ...dn)\n :param n_classes: an int, number of classes\n :return: [ndarray], an one hot array of shape (d0, d1, ...dn, n_classes)...
Description: convert integer labels to one hot :param labels: an [int, ndarray], a label array of shape (d0, d1, d2, ...dn) :param n_classes: an int, number of classes :return: [ndarray], an one hot array of shape (d0, d1, ...dn, n_classes)
Released2019June06/GeneralUtils.py
onehot_encoding
minhncedutw/pointcloud-robot-grasp
3
python
def onehot_encoding(labels, n_classes) -> np.ndarray: '\n Description: convert integer labels to one hot\n :param labels: an [int, ndarray], a label array of shape (d0, d1, d2, ...dn)\n :param n_classes: an int, number of classes\n :return: [ndarray], an one hot array of shape (d0, d1, ...dn, n_classes)...
def onehot_encoding(labels, n_classes) -> np.ndarray: '\n Description: convert integer labels to one hot\n :param labels: an [int, ndarray], a label array of shape (d0, d1, d2, ...dn)\n :param n_classes: an int, number of classes\n :return: [ndarray], an one hot array of shape (d0, d1, ...dn, n_classes)...
c013eb7ce765e9c1d4276fab0f0fe55c2959bd0845d2d10ff836951aa1e4455f
def onehot_decoding(probs, class_axis) -> np.ndarray: "\n Description: convert one-hot encoding to labels\n :param probs: [ndarray], an probability array, one-hot-encoding type of shape (d0, d1, ...dn)\n :param class_axis: int, axis of classes in 'probs' array(0 <= class_axis <= n)\n :return: [int, ndar...
Description: convert one-hot encoding to labels :param probs: [ndarray], an probability array, one-hot-encoding type of shape (d0, d1, ...dn) :param class_axis: int, axis of classes in 'probs' array(0 <= class_axis <= n) :return: [int, ndarray], an label array of shape (d0, d1, ...dn-1)
Released2019June06/GeneralUtils.py
onehot_decoding
minhncedutw/pointcloud-robot-grasp
3
python
def onehot_decoding(probs, class_axis) -> np.ndarray: "\n Description: convert one-hot encoding to labels\n :param probs: [ndarray], an probability array, one-hot-encoding type of shape (d0, d1, ...dn)\n :param class_axis: int, axis of classes in 'probs' array(0 <= class_axis <= n)\n :return: [int, ndar...
def onehot_decoding(probs, class_axis) -> np.ndarray: "\n Description: convert one-hot encoding to labels\n :param probs: [ndarray], an probability array, one-hot-encoding type of shape (d0, d1, ...dn)\n :param class_axis: int, axis of classes in 'probs' array(0 <= class_axis <= n)\n :return: [int, ndar...
9c28a637bd36eb69a3aa50a8b77028e14242a1fe61d62a38b4cdf5c88a06290b
def sample_indices(n_samples: int, max_index: int, replace: bool=None) -> np.ndarray: '\n Get a list indice sample for an array\n :param n_samples: an integer, number of expected samples\n :param length: an integer, length of array\n :return: an array of numpy, is a list of indices\n ' if (replac...
Get a list indice sample for an array :param n_samples: an integer, number of expected samples :param length: an integer, length of array :return: an array of numpy, is a list of indices
Released2019June06/GeneralUtils.py
sample_indices
minhncedutw/pointcloud-robot-grasp
3
python
def sample_indices(n_samples: int, max_index: int, replace: bool=None) -> np.ndarray: '\n Get a list indice sample for an array\n :param n_samples: an integer, number of expected samples\n :param length: an integer, length of array\n :return: an array of numpy, is a list of indices\n ' if (replac...
def sample_indices(n_samples: int, max_index: int, replace: bool=None) -> np.ndarray: '\n Get a list indice sample for an array\n :param n_samples: an integer, number of expected samples\n :param length: an integer, length of array\n :return: an array of numpy, is a list of indices\n ' if (replac...
64c01150140b664f2ae28f29f9c3bdde5d85888f05d7d563571de96505f518bf
def sample_arrays(arrs: Union[(np.ndarray, List[np.ndarray], Tuple[np.ndarray])], n_samples: int) -> List[np.ndarray]: '\n Sample a list of arrays\n :param arrs: List or Tuple of ndarray, the arrays that need to be sampled\n :param n_samples: an integer, number of expected samples\n :return: a list of n...
Sample a list of arrays :param arrs: List or Tuple of ndarray, the arrays that need to be sampled :param n_samples: an integer, number of expected samples :return: a list of numpy array, that are synchronically-sampled arrays
Released2019June06/GeneralUtils.py
sample_arrays
minhncedutw/pointcloud-robot-grasp
3
python
def sample_arrays(arrs: Union[(np.ndarray, List[np.ndarray], Tuple[np.ndarray])], n_samples: int) -> List[np.ndarray]: '\n Sample a list of arrays\n :param arrs: List or Tuple of ndarray, the arrays that need to be sampled\n :param n_samples: an integer, number of expected samples\n :return: a list of n...
def sample_arrays(arrs: Union[(np.ndarray, List[np.ndarray], Tuple[np.ndarray])], n_samples: int) -> List[np.ndarray]: '\n Sample a list of arrays\n :param arrs: List or Tuple of ndarray, the arrays that need to be sampled\n :param n_samples: an integer, number of expected samples\n :return: a list of n...
56493331f48ae3e70ad0a7ef11ad57c9c306a07bdff61bb49410ad82151f8bf5
def load_pickle(name: str): '\n Description:\n :param name: str, file name without file extension\n :return: obj\n ' handle = open((name + '.pickle'), 'rb') obj = pickle.load(file=handle) handle.close() return obj
Description: :param name: str, file name without file extension :return: obj
Released2019June06/GeneralUtils.py
load_pickle
minhncedutw/pointcloud-robot-grasp
3
python
def load_pickle(name: str): '\n Description:\n :param name: str, file name without file extension\n :return: obj\n ' handle = open((name + '.pickle'), 'rb') obj = pickle.load(file=handle) handle.close() return obj
def load_pickle(name: str): '\n Description:\n :param name: str, file name without file extension\n :return: obj\n ' handle = open((name + '.pickle'), 'rb') obj = pickle.load(file=handle) handle.close() return obj<|docstring|>Description: :param name: str, file name without file extensio...
06cca1124f312730e228af61a844eb094615387fea483bafdb6d662df2e48977
def connect(config: dict) -> InfluxDBClient: "Connect to the InfluxDB with given config\n\n :param config: Dictionary (or object with dictionary interface) in format:\n\n {'host': 'localhost', 'port': 8086, 'timeout': 5, 'username': 'username', 'password': 'password',\n 'database': 'database'}\...
Connect to the InfluxDB with given config :param config: Dictionary (or object with dictionary interface) in format: {'host': 'localhost', 'port': 8086, 'timeout': 5, 'username': 'username', 'password': 'password', 'database': 'database'} or in format: {'INFLUXDB_HOST': 'localhost', 'INFLUXDB_PO...
dbinflux/dbinflux.py
connect
andyceo/pylibs
1
python
def connect(config: dict) -> InfluxDBClient: "Connect to the InfluxDB with given config\n\n :param config: Dictionary (or object with dictionary interface) in format:\n\n {'host': 'localhost', 'port': 8086, 'timeout': 5, 'username': 'username', 'password': 'password',\n 'database': 'database'}\...
def connect(config: dict) -> InfluxDBClient: "Connect to the InfluxDB with given config\n\n :param config: Dictionary (or object with dictionary interface) in format:\n\n {'host': 'localhost', 'port': 8086, 'timeout': 5, 'username': 'username', 'password': 'password',\n 'database': 'database'}\...
2c23759c29a6947a3869a9f77b6fa8371d7433d9396fd5efbbacfb07e23c644c
def dump_measurement_csv(client, measurement, chunk_size=500, logger=None, show_cli_cmd=False): 'Dump given measurement to csv file' if (not logger): logging.basicConfig(level=logging.INFO) logger = logging.getLogger() query = 'SELECT * FROM {}'.format(measurement) if show_cli_cmd: ...
Dump given measurement to csv file
dbinflux/dbinflux.py
dump_measurement_csv
andyceo/pylibs
1
python
def dump_measurement_csv(client, measurement, chunk_size=500, logger=None, show_cli_cmd=False): if (not logger): logging.basicConfig(level=logging.INFO) logger = logging.getLogger() query = 'SELECT * FROM {}'.format(measurement) if show_cli_cmd: logger.info("0. Stop inserting in...
def dump_measurement_csv(client, measurement, chunk_size=500, logger=None, show_cli_cmd=False): if (not logger): logging.basicConfig(level=logging.INFO) logger = logging.getLogger() query = 'SELECT * FROM {}'.format(measurement) if show_cli_cmd: logger.info("0. Stop inserting in...
78e576e2ab2e7c427e0f05c7e4e77ff8f89fc4b284eaacfe3dca585aee3a773c
def csv2lp(csv_filepath, tags_keys=None, database=None, retention_policy=None): "Transform given csv file into file protocol file. Run example:\n csv2lp('/root/bitfinex_ticker.csv', ['symbol'], 'alfadirect', 'alfadirect')" tags_keys = (tags_keys if tags_keys else []) (path, filename) = os.path.split(csv_...
Transform given csv file into file protocol file. Run example: csv2lp('/root/bitfinex_ticker.csv', ['symbol'], 'alfadirect', 'alfadirect')
dbinflux/dbinflux.py
csv2lp
andyceo/pylibs
1
python
def csv2lp(csv_filepath, tags_keys=None, database=None, retention_policy=None): "Transform given csv file into file protocol file. Run example:\n csv2lp('/root/bitfinex_ticker.csv', ['symbol'], 'alfadirect', 'alfadirect')" tags_keys = (tags_keys if tags_keys else []) (path, filename) = os.path.split(csv_...
def csv2lp(csv_filepath, tags_keys=None, database=None, retention_policy=None): "Transform given csv file into file protocol file. Run example:\n csv2lp('/root/bitfinex_ticker.csv', ['symbol'], 'alfadirect', 'alfadirect')" tags_keys = (tags_keys if tags_keys else []) (path, filename) = os.path.split(csv_...
01e9d150688cdcd3a9c99ad2412e46ea6e4339eaa021733e988d5eaa7a16cbd3
def move_points(source, dest): "This function helps transfer points from one database (and/or measurement) to another one. Here is the demo\n script using that function:\n\n\n import pylibs\n\n source = {\n 'client': pylibs.connect({\n 'host': 'influxdb_source',\n 'username': '...
This function helps transfer points from one database (and/or measurement) to another one. Here is the demo script using that function: import pylibs source = { 'client': pylibs.connect({ 'host': 'influxdb_source', 'username': 'user1', 'password': 'super_secret_password', 'databas...
dbinflux/dbinflux.py
move_points
andyceo/pylibs
1
python
def move_points(source, dest): "This function helps transfer points from one database (and/or measurement) to another one. Here is the demo\n script using that function:\n\n\n import pylibs\n\n source = {\n 'client': pylibs.connect({\n 'host': 'influxdb_source',\n 'username': '...
def move_points(source, dest): "This function helps transfer points from one database (and/or measurement) to another one. Here is the demo\n script using that function:\n\n\n import pylibs\n\n source = {\n 'client': pylibs.connect({\n 'host': 'influxdb_source',\n 'username': '...
453ddb7050f9610be2eb68cfeafb789dd82f3e573e83420882fda541b4bbd6cb
def argparse_add_influxdb_options(parser: argparse.ArgumentParser): 'Add InfluxDB connection parameters to given parser. Also read environment variables for defaults' parser.add_argument('--influxdb-host', metavar='HOST', default=os.environ.get('INFLUXDB_HOST', 'localhost'), help='InfluxDB host name') parse...
Add InfluxDB connection parameters to given parser. Also read environment variables for defaults
dbinflux/dbinflux.py
argparse_add_influxdb_options
andyceo/pylibs
1
python
def argparse_add_influxdb_options(parser: argparse.ArgumentParser): parser.add_argument('--influxdb-host', metavar='HOST', default=os.environ.get('INFLUXDB_HOST', 'localhost'), help='InfluxDB host name') parser.add_argument('--influxdb-port', metavar='PORT', default=os.environ.get('INFLUXDB_PORT', 8086), h...
def argparse_add_influxdb_options(parser: argparse.ArgumentParser): parser.add_argument('--influxdb-host', metavar='HOST', default=os.environ.get('INFLUXDB_HOST', 'localhost'), help='InfluxDB host name') parser.add_argument('--influxdb-port', metavar='PORT', default=os.environ.get('INFLUXDB_PORT', 8086), h...
cab6b4d170c1a516c69fef1735a7b0f91e3be47631f441d407eed426e623caf8
def timestamp_to_influxdb_format(timestamp=time.time()) -> int: 'Convert given timestamp (number of seconds) to integer of InfluxDB format (number of nanoseconds).\n @todo: see __main__ section test: fix them\n\n :param timestamp: Datetime in timestamp format (number of seconds that elapsed since\n 00:...
Convert given timestamp (number of seconds) to integer of InfluxDB format (number of nanoseconds). @todo: see __main__ section test: fix them :param timestamp: Datetime in timestamp format (number of seconds that elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970. Can be string, int ...
dbinflux/dbinflux.py
timestamp_to_influxdb_format
andyceo/pylibs
1
python
def timestamp_to_influxdb_format(timestamp=time.time()) -> int: 'Convert given timestamp (number of seconds) to integer of InfluxDB format (number of nanoseconds).\n @todo: see __main__ section test: fix them\n\n :param timestamp: Datetime in timestamp format (number of seconds that elapsed since\n 00:...
def timestamp_to_influxdb_format(timestamp=time.time()) -> int: 'Convert given timestamp (number of seconds) to integer of InfluxDB format (number of nanoseconds).\n @todo: see __main__ section test: fix them\n\n :param timestamp: Datetime in timestamp format (number of seconds that elapsed since\n 00:...
826172babdf0e393edda5b4c36f785175ac726193e606f3f4f25d3c05080962d
def get_measurements(client: InfluxDBClient, database='') -> list: 'Return the list of measurements in given database' query = 'SHOW MEASUREMENTS' query += (' ON "{}"'.format(database) if database else '') return [_['name'] for _ in client.query(query).get_points()]
Return the list of measurements in given database
dbinflux/dbinflux.py
get_measurements
andyceo/pylibs
1
python
def get_measurements(client: InfluxDBClient, database=) -> list: query = 'SHOW MEASUREMENTS' query += (' ON "{}"'.format(database) if database else ) return [_['name'] for _ in client.query(query).get_points()]
def get_measurements(client: InfluxDBClient, database=) -> list: query = 'SHOW MEASUREMENTS' query += (' ON "{}"'.format(database) if database else ) return [_['name'] for _ in client.query(query).get_points()]<|docstring|>Return the list of measurements in given database<|endoftext|>
91e3eda31913783c0d294ab803242f88716dc9158a9d3465a369e3d3d4fff42c
def get_series(client: InfluxDBClient, database='', measurement='') -> list: 'Return the list of series in given database and measurement' query = 'SHOW SERIES' query += (' ON "{}"'.format(database) if database else '') query += (' FROM "{}"'.format(measurement) if measurement else '') return [_['ke...
Return the list of series in given database and measurement
dbinflux/dbinflux.py
get_series
andyceo/pylibs
1
python
def get_series(client: InfluxDBClient, database=, measurement=) -> list: query = 'SHOW SERIES' query += (' ON "{}"'.format(database) if database else ) query += (' FROM "{}"'.format(measurement) if measurement else ) return [_['key'] for _ in client.query(query).get_points()]
def get_series(client: InfluxDBClient, database=, measurement=) -> list: query = 'SHOW SERIES' query += (' ON "{}"'.format(database) if database else ) query += (' FROM "{}"'.format(measurement) if measurement else ) return [_['key'] for _ in client.query(query).get_points()]<|docstring|>Return the...
5b280c6b40cf1b58a1f0397bee608a3653093950d4a1ce0cc62bfdf1c5963c89
def get_fields_keys(client: InfluxDBClient, database='', measurement='') -> dict: 'Return the dictionary of field keys, where key is field name and value is field type, for given database and\n measurement' query = 'SHOW FIELD KEYS' query += (' ON "{}"'.format(database) if database else '') query += ...
Return the dictionary of field keys, where key is field name and value is field type, for given database and measurement
dbinflux/dbinflux.py
get_fields_keys
andyceo/pylibs
1
python
def get_fields_keys(client: InfluxDBClient, database=, measurement=) -> dict: 'Return the dictionary of field keys, where key is field name and value is field type, for given database and\n measurement' query = 'SHOW FIELD KEYS' query += (' ON "{}"'.format(database) if database else ) query += (' FRO...
def get_fields_keys(client: InfluxDBClient, database=, measurement=) -> dict: 'Return the dictionary of field keys, where key is field name and value is field type, for given database and\n measurement' query = 'SHOW FIELD KEYS' query += (' ON "{}"'.format(database) if database else ) query += (' FRO...
723754f614a41423b82f87b92a839ad739bc8721a6c6006fc7c1ac958ef575af
def get_tag_keys(client: InfluxDBClient, database='', measurement='') -> list: 'Return the list of tag keys in given database and measurement' query = 'SHOW TAG KEYS' query += (' ON "{}"'.format(database) if database else '') query += (' FROM "{}"'.format(measurement) if measurement else '') return ...
Return the list of tag keys in given database and measurement
dbinflux/dbinflux.py
get_tag_keys
andyceo/pylibs
1
python
def get_tag_keys(client: InfluxDBClient, database=, measurement=) -> list: query = 'SHOW TAG KEYS' query += (' ON "{}"'.format(database) if database else ) query += (' FROM "{}"'.format(measurement) if measurement else ) return [_['tagKey'] for _ in client.query(query).get_points()]
def get_tag_keys(client: InfluxDBClient, database=, measurement=) -> list: query = 'SHOW TAG KEYS' query += (' ON "{}"'.format(database) if database else ) query += (' FROM "{}"'.format(measurement) if measurement else ) return [_['tagKey'] for _ in client.query(query).get_points()]<|docstring|>Ret...
e4f2a4ee6e84357204f053bd450229be14e3af3e9919f1d423a355db6a111d24
def get_tags(client: InfluxDBClient, database='', measurement='') -> dict: 'Return the dictionary of tag keys, where key is tag name and value is a list of tag values, for given database\n and measurement' tags = {} for tag in get_tag_keys(client, database, measurement): query = 'SHOW TAG VALUES'...
Return the dictionary of tag keys, where key is tag name and value is a list of tag values, for given database and measurement
dbinflux/dbinflux.py
get_tags
andyceo/pylibs
1
python
def get_tags(client: InfluxDBClient, database=, measurement=) -> dict: 'Return the dictionary of tag keys, where key is tag name and value is a list of tag values, for given database\n and measurement' tags = {} for tag in get_tag_keys(client, database, measurement): query = 'SHOW TAG VALUES' ...
def get_tags(client: InfluxDBClient, database=, measurement=) -> dict: 'Return the dictionary of tag keys, where key is tag name and value is a list of tag values, for given database\n and measurement' tags = {} for tag in get_tag_keys(client, database, measurement): query = 'SHOW TAG VALUES' ...
29ffa14ffaa0af741a0f50f33cda07a8f202eff1475a3932211f7d886851cb9f
def compare_point_with_db(client: InfluxDBClient, measurement: str, tag_set: dict, ts: int, point: dict) -> dict: 'Get the point from InfluxDB for given measurement, tag set and timestamp, and compare results from InfluxDB\n with given point. Return comparison stats.\n\n @see https://docs.influxdata.com/influ...
Get the point from InfluxDB for given measurement, tag set and timestamp, and compare results from InfluxDB with given point. Return comparison stats. @see https://docs.influxdata.com/influxdb/v1.8/troubleshooting/frequently-asked-questions/#how-does-influxdb-handle-duplicate-points
dbinflux/dbinflux.py
compare_point_with_db
andyceo/pylibs
1
python
def compare_point_with_db(client: InfluxDBClient, measurement: str, tag_set: dict, ts: int, point: dict) -> dict: 'Get the point from InfluxDB for given measurement, tag set and timestamp, and compare results from InfluxDB\n with given point. Return comparison stats.\n\n @see https://docs.influxdata.com/influ...
def compare_point_with_db(client: InfluxDBClient, measurement: str, tag_set: dict, ts: int, point: dict) -> dict: 'Get the point from InfluxDB for given measurement, tag set and timestamp, and compare results from InfluxDB\n with given point. Return comparison stats.\n\n @see https://docs.influxdata.com/influ...
6b3deaeaeae88f3872f7f15124f503082ca031774813eb69673155a78c79c11e
def range_extract(lst): 'Yield 2-tuple ranges or 1-tuple single elements from list of increasing ints' lenlst = len(lst) i = 0 while (i < lenlst): low = lst[i] while ((i < (lenlst - 1)) and ((lst[i] + 1) == lst[(i + 1)])): i += 1 hi = lst[i] if ((hi - low) >= ...
Yield 2-tuple ranges or 1-tuple single elements from list of increasing ints
Task/Range-extraction/Python/range-extraction-1.py
range_extract
mullikine/RosettaCodeData
1
python
def range_extract(lst): lenlst = len(lst) i = 0 while (i < lenlst): low = lst[i] while ((i < (lenlst - 1)) and ((lst[i] + 1) == lst[(i + 1)])): i += 1 hi = lst[i] if ((hi - low) >= 2): (yield (low, hi)) elif ((hi - low) == 1): ...
def range_extract(lst): lenlst = len(lst) i = 0 while (i < lenlst): low = lst[i] while ((i < (lenlst - 1)) and ((lst[i] + 1) == lst[(i + 1)])): i += 1 hi = lst[i] if ((hi - low) >= 2): (yield (low, hi)) elif ((hi - low) == 1): ...
fe751fdb9546d5a6d250eec35e2d09967fc1d5e716d2579af99eb03f3bc9cbfb
def get_solver_info(): ' Get the information data of the local CP solver that is target by the solver configuration.\n\n This method creates a CP solver to retrieve this information, and end it immediately.\n It returns a dictionary with various information, as in the following example:\n ::\n {\n ...
Get the information data of the local CP solver that is target by the solver configuration. This method creates a CP solver to retrieve this information, and end it immediately. It returns a dictionary with various information, as in the following example: :: { "AngelVersion" : 5, "SourceDate" : "Sep 12 2017", ...
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
get_solver_info
Infinity8sailor/Quantum-CERN
1
python
def get_solver_info(): ' Get the information data of the local CP solver that is target by the solver configuration.\n\n This method creates a CP solver to retrieve this information, and end it immediately.\n It returns a dictionary with various information, as in the following example:\n ::\n {\n ...
def get_solver_info(): ' Get the information data of the local CP solver that is target by the solver configuration.\n\n This method creates a CP solver to retrieve this information, and end it immediately.\n It returns a dictionary with various information, as in the following example:\n ::\n {\n ...
aa939efe6d7e20153b5c4751fdea750c105c77d64a681f8698b00dccc939bbff
def __init__(self, solver, params, context): ' Create a new solver that solves locally with CP Optimizer Interactive.\n\n Args:\n solver: Parent solver\n params: Solving parameters\n context: Solver context\n Raises:\n CpoException if proxy executable does...
Create a new solver that solves locally with CP Optimizer Interactive. Args: solver: Parent solver params: Solving parameters context: Solver context Raises: CpoException if proxy executable does not exists
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
__init__
Infinity8sailor/Quantum-CERN
1
python
def __init__(self, solver, params, context): ' Create a new solver that solves locally with CP Optimizer Interactive.\n\n Args:\n solver: Parent solver\n params: Solving parameters\n context: Solver context\n Raises:\n CpoException if proxy executable does...
def __init__(self, solver, params, context): ' Create a new solver that solves locally with CP Optimizer Interactive.\n\n Args:\n solver: Parent solver\n params: Solving parameters\n context: Solver context\n Raises:\n CpoException if proxy executable does...
f24fdfc02cad0494ed3b3d88e8f1c5e8e68feedda1f83832902b12a1ba1adb67
def _process_start_timeout(self): ' Process the raise of start timeout timer ' if (not self.version_info): self.timeout_kill = True self.process.kill()
Process the raise of start timeout timer
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
_process_start_timeout
Infinity8sailor/Quantum-CERN
1
python
def _process_start_timeout(self): ' ' if (not self.version_info): self.timeout_kill = True self.process.kill()
def _process_start_timeout(self): ' ' if (not self.version_info): self.timeout_kill = True self.process.kill()<|docstring|>Process the raise of start timeout timer<|endoftext|>
d106b0979071cae791964ab87eb494025d8f29c81e93d83cc99b3f031f4b286c
def solve(self): " Solve the model\n\n According to the value of the context parameter 'verbose', the following information is logged\n if the log output is set:\n * 1: Total time spent to solve the model\n * 2: The process exec file\n * 3: Content of the JSON response\n ...
Solve the model According to the value of the context parameter 'verbose', the following information is logged if the log output is set: * 1: Total time spent to solve the model * 2: The process exec file * 3: Content of the JSON response * 4: Solver traces (if any) * 5: Messages sent/receive to/from process Ret...
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
solve
Infinity8sailor/Quantum-CERN
1
python
def solve(self): " Solve the model\n\n According to the value of the context parameter 'verbose', the following information is logged\n if the log output is set:\n * 1: Total time spent to solve the model\n * 2: The process exec file\n * 3: Content of the JSON response\n ...
def solve(self): " Solve the model\n\n According to the value of the context parameter 'verbose', the following information is logged\n if the log output is set:\n * 1: Total time spent to solve the model\n * 2: The process exec file\n * 3: Content of the JSON response\n ...
969e2d0ce2b917465cb6e673e5182b4f8a70a58a43fbb8f011d31613838d52b4
def start_search(self): ' Start a new search. Solutions are retrieved using method search_next().\n ' self._init_model_in_solver() self._write_message(CMD_START_SEARCH)
Start a new search. Solutions are retrieved using method search_next().
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
start_search
Infinity8sailor/Quantum-CERN
1
python
def start_search(self): ' \n ' self._init_model_in_solver() self._write_message(CMD_START_SEARCH)
def start_search(self): ' \n ' self._init_model_in_solver() self._write_message(CMD_START_SEARCH)<|docstring|>Start a new search. Solutions are retrieved using method search_next().<|endoftext|>
efa6143595937d90947228ad118bfda0276ee44f038a3e16ccc564af221a592c
def search_next(self): ' Get the next available solution.\n\n (This method starts search automatically.)\n\n Returns:\n Next model result (type CpoSolveResult)\n ' self._write_message(CMD_SEARCH_NEXT) jsol = self._wait_json_result(EVT_SOLVE_RESULT) return self._create_res...
Get the next available solution. (This method starts search automatically.) Returns: Next model result (type CpoSolveResult)
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
search_next
Infinity8sailor/Quantum-CERN
1
python
def search_next(self): ' Get the next available solution.\n\n (This method starts search automatically.)\n\n Returns:\n Next model result (type CpoSolveResult)\n ' self._write_message(CMD_SEARCH_NEXT) jsol = self._wait_json_result(EVT_SOLVE_RESULT) return self._create_res...
def search_next(self): ' Get the next available solution.\n\n (This method starts search automatically.)\n\n Returns:\n Next model result (type CpoSolveResult)\n ' self._write_message(CMD_SEARCH_NEXT) jsol = self._wait_json_result(EVT_SOLVE_RESULT) return self._create_res...
4a3de908c65c8b0022444bdd2657052c83ffa4c602a359147998b004b33d4316
def end_search(self): ' End current search.\n\n Returns:\n Last (fail) solve result with last solve information (type CpoSolveResult)\n ' self._write_message(CMD_END_SEARCH) jsol = self._wait_json_result(EVT_SOLVE_RESULT) return self._create_result_object(CpoSolveResult, jsol)
End current search. Returns: Last (fail) solve result with last solve information (type CpoSolveResult)
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
end_search
Infinity8sailor/Quantum-CERN
1
python
def end_search(self): ' End current search.\n\n Returns:\n Last (fail) solve result with last solve information (type CpoSolveResult)\n ' self._write_message(CMD_END_SEARCH) jsol = self._wait_json_result(EVT_SOLVE_RESULT) return self._create_result_object(CpoSolveResult, jsol)
def end_search(self): ' End current search.\n\n Returns:\n Last (fail) solve result with last solve information (type CpoSolveResult)\n ' self._write_message(CMD_END_SEARCH) jsol = self._wait_json_result(EVT_SOLVE_RESULT) return self._create_result_object(CpoSolveResult, jsol)<|...
a01ee5420b896905cb31ab8b14de9a6b2836095d1fea07305d18d286537c98b9
def abort_search(self): ' Abort current search.\n This method is designed to be called by a different thread than the one currently solving.\n ' self.end()
Abort current search. This method is designed to be called by a different thread than the one currently solving.
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
abort_search
Infinity8sailor/Quantum-CERN
1
python
def abort_search(self): ' Abort current search.\n This method is designed to be called by a different thread than the one currently solving.\n ' self.end()
def abort_search(self): ' Abort current search.\n This method is designed to be called by a different thread than the one currently solving.\n ' self.end()<|docstring|>Abort current search. This method is designed to be called by a different thread than the one currently solving.<|endoftext|>
573bfe5e9f8ceed39bd63044abff54b9cb4a37f35e656a9733f4778fa2b16da8
def refine_conflict(self): ' This method identifies a minimal conflict for the infeasibility of the current model.\n\n See documentation of :meth:`~docplex.cp.solver.solver.CpoSolver.refine_conflict` for details.\n\n Returns:\n Conflict result,\n object of class :class:`~docplex....
This method identifies a minimal conflict for the infeasibility of the current model. See documentation of :meth:`~docplex.cp.solver.solver.CpoSolver.refine_conflict` for details. Returns: Conflict result, object of class :class:`~docplex.cp.solution.CpoRefineConflictResult`.
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
refine_conflict
Infinity8sailor/Quantum-CERN
1
python
def refine_conflict(self): ' This method identifies a minimal conflict for the infeasibility of the current model.\n\n See documentation of :meth:`~docplex.cp.solver.solver.CpoSolver.refine_conflict` for details.\n\n Returns:\n Conflict result,\n object of class :class:`~docplex....
def refine_conflict(self): ' This method identifies a minimal conflict for the infeasibility of the current model.\n\n See documentation of :meth:`~docplex.cp.solver.solver.CpoSolver.refine_conflict` for details.\n\n Returns:\n Conflict result,\n object of class :class:`~docplex....
351fa4b8b552455248e9ab2cdcabb2eb78a67ba8bb1a4351b6a5319b91b85a0b
def propagate(self): ' This method invokes the propagation on the current model.\n\n See documentation of :meth:`~docplex.cp.solver.solver.CpoSolver.propagate` for details.\n\n Returns:\n Propagation result,\n object of class :class:`~docplex.cp.solution.CpoSolveResult`.\n ...
This method invokes the propagation on the current model. See documentation of :meth:`~docplex.cp.solver.solver.CpoSolver.propagate` for details. Returns: Propagation result, object of class :class:`~docplex.cp.solution.CpoSolveResult`.
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
propagate
Infinity8sailor/Quantum-CERN
1
python
def propagate(self): ' This method invokes the propagation on the current model.\n\n See documentation of :meth:`~docplex.cp.solver.solver.CpoSolver.propagate` for details.\n\n Returns:\n Propagation result,\n object of class :class:`~docplex.cp.solution.CpoSolveResult`.\n ...
def propagate(self): ' This method invokes the propagation on the current model.\n\n See documentation of :meth:`~docplex.cp.solver.solver.CpoSolver.propagate` for details.\n\n Returns:\n Propagation result,\n object of class :class:`~docplex.cp.solution.CpoSolveResult`.\n ...
9516ffac8137e156a654502d79029662e8c7210e78a20d903da60450daefb7cf
def run_seeds(self, nbrun): ' This method runs *nbrun* times the CP optimizer search with different random seeds\n and computes statistics from the result of these runs.\n\n This method does not return anything. Result statistics are displayed on the log output\n that should be activated.\n\n ...
This method runs *nbrun* times the CP optimizer search with different random seeds and computes statistics from the result of these runs. This method does not return anything. Result statistics are displayed on the log output that should be activated. Each run of the solver is stopped according to single solve condit...
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
run_seeds
Infinity8sailor/Quantum-CERN
1
python
def run_seeds(self, nbrun): ' This method runs *nbrun* times the CP optimizer search with different random seeds\n and computes statistics from the result of these runs.\n\n This method does not return anything. Result statistics are displayed on the log output\n that should be activated.\n\n ...
def run_seeds(self, nbrun): ' This method runs *nbrun* times the CP optimizer search with different random seeds\n and computes statistics from the result of these runs.\n\n This method does not return anything. Result statistics are displayed on the log output\n that should be activated.\n\n ...
763473214110331644c98c536ab27f9aa57f4307a375e8a639c5b08e5ca01c2e
def set_explain_failure_tags(self, ltags=None): " This method allows to set the list of failure tags to explain in the next solve.\n\n The failure tags are displayed in the log when the parameter :attr:`~docplex.cp.CpoParameters.LogSearchTags`\n is set to 'On'.\n All existing failure tags previ...
This method allows to set the list of failure tags to explain in the next solve. The failure tags are displayed in the log when the parameter :attr:`~docplex.cp.CpoParameters.LogSearchTags` is set to 'On'. All existing failure tags previously set are cleared prior to set the new ones. Calling this method with an empty...
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
set_explain_failure_tags
Infinity8sailor/Quantum-CERN
1
python
def set_explain_failure_tags(self, ltags=None): " This method allows to set the list of failure tags to explain in the next solve.\n\n The failure tags are displayed in the log when the parameter :attr:`~docplex.cp.CpoParameters.LogSearchTags`\n is set to 'On'.\n All existing failure tags previ...
def set_explain_failure_tags(self, ltags=None): " This method allows to set the list of failure tags to explain in the next solve.\n\n The failure tags are displayed in the log when the parameter :attr:`~docplex.cp.CpoParameters.LogSearchTags`\n is set to 'On'.\n All existing failure tags previ...
90921c3c8de1f2470f519e1f927d364281cfba8dd35c632ec03ca4299816cee5
def end(self): ' End solver and release all resources.\n ' if self.active: self.active = False try: self._write_message(CMD_EXIT) except: pass try: self.pout.close() except: pass try: self.pin.clos...
End solver and release all resources.
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
end
Infinity8sailor/Quantum-CERN
1
python
def end(self): ' \n ' if self.active: self.active = False try: self._write_message(CMD_EXIT) except: pass try: self.pout.close() except: pass try: self.pin.close() except: pass ...
def end(self): ' \n ' if self.active: self.active = False try: self._write_message(CMD_EXIT) except: pass try: self.pout.close() except: pass try: self.pin.close() except: pass ...
a223a4b5574a820f5b705e554fa0bade789219265c01f058d57d4d16a819f438
def _wait_event(self, xevt): ' Wait for a particular event while forwarding logs if any.\n Args:\n xevt: Expected event\n Returns:\n Message data\n Raises:\n SolverException if an error occurs\n ' firsterror = None while True: (evt, data) ...
Wait for a particular event while forwarding logs if any. Args: xevt: Expected event Returns: Message data Raises: SolverException if an error occurs
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
_wait_event
Infinity8sailor/Quantum-CERN
1
python
def _wait_event(self, xevt): ' Wait for a particular event while forwarding logs if any.\n Args:\n xevt: Expected event\n Returns:\n Message data\n Raises:\n SolverException if an error occurs\n ' firsterror = None while True: (evt, data) ...
def _wait_event(self, xevt): ' Wait for a particular event while forwarding logs if any.\n Args:\n xevt: Expected event\n Returns:\n Message data\n Raises:\n SolverException if an error occurs\n ' firsterror = None while True: (evt, data) ...
187e0f05b5f36aa57986911f80984afe908f07e042f198344d8ee291fd83e6ee
def _wait_json_result(self, evt): ' Wait for a JSON result while forwarding logs if any.\n Args:\n evt: Event to wait for\n Returns:\n JSON solution string, decoded from UTF8\n ' data = self._wait_event(evt) self._set_last_json_result_string(data) self.context....
Wait for a JSON result while forwarding logs if any. Args: evt: Event to wait for Returns: JSON solution string, decoded from UTF8
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
_wait_json_result
Infinity8sailor/Quantum-CERN
1
python
def _wait_json_result(self, evt): ' Wait for a JSON result while forwarding logs if any.\n Args:\n evt: Event to wait for\n Returns:\n JSON solution string, decoded from UTF8\n ' data = self._wait_event(evt) self._set_last_json_result_string(data) self.context....
def _wait_json_result(self, evt): ' Wait for a JSON result while forwarding logs if any.\n Args:\n evt: Event to wait for\n Returns:\n JSON solution string, decoded from UTF8\n ' data = self._wait_event(evt) self._set_last_json_result_string(data) self.context....
ef2e354219d527cad6919d0b3efbc05224065bc9163bc44b45303a463c44be64
def _write_message(self, cid, data=None): ' Write a message to the solver process\n Args:\n cid: Command name\n data: Data to write, already encoded in UTF8 if required\n ' stime = time.time() cid = cid.encode('utf-8') if is_string(data): data = data.encode...
Write a message to the solver process Args: cid: Command name data: Data to write, already encoded in UTF8 if required
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
_write_message
Infinity8sailor/Quantum-CERN
1
python
def _write_message(self, cid, data=None): ' Write a message to the solver process\n Args:\n cid: Command name\n data: Data to write, already encoded in UTF8 if required\n ' stime = time.time() cid = cid.encode('utf-8') if is_string(data): data = data.encode...
def _write_message(self, cid, data=None): ' Write a message to the solver process\n Args:\n cid: Command name\n data: Data to write, already encoded in UTF8 if required\n ' stime = time.time() cid = cid.encode('utf-8') if is_string(data): data = data.encode...
a394fd67ca9cf1baf44362981f62cfc2179884074c69242c9410a7c3908cbb30
def _read_message(self): ' Read a message from the solver process\n Returns:\n Tuple (evt, data)\n ' frame = self._read_frame(6) if ((frame[0] != 202) or (frame[1] != 254)): erline = (frame + self._read_error_message()) erline = erline.decode() self.end() ...
Read a message from the solver process Returns: Tuple (evt, data)
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
_read_message
Infinity8sailor/Quantum-CERN
1
python
def _read_message(self): ' Read a message from the solver process\n Returns:\n Tuple (evt, data)\n ' frame = self._read_frame(6) if ((frame[0] != 202) or (frame[1] != 254)): erline = (frame + self._read_error_message()) erline = erline.decode() self.end() ...
def _read_message(self): ' Read a message from the solver process\n Returns:\n Tuple (evt, data)\n ' frame = self._read_frame(6) if ((frame[0] != 202) or (frame[1] != 254)): erline = (frame + self._read_error_message()) erline = erline.decode() self.end() ...
e6212817ffcbaddd7dd10004218df6f68e8eeb02e7c3c61f04f09ff99b3b76bc
def _read_frame(self, nbb): ' Read a byte frame from input stream\n Args:\n nbb: Number of bytes to read\n Returns:\n Byte array\n ' data = self.pin.read(nbb) if (len(data) != nbb): if (len(data) == 0): if (self.process_infos.get(CpoProcessInfo...
Read a byte frame from input stream Args: nbb: Number of bytes to read Returns: Byte array
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
_read_frame
Infinity8sailor/Quantum-CERN
1
python
def _read_frame(self, nbb): ' Read a byte frame from input stream\n Args:\n nbb: Number of bytes to read\n Returns:\n Byte array\n ' data = self.pin.read(nbb) if (len(data) != nbb): if (len(data) == 0): if (self.process_infos.get(CpoProcessInfo...
def _read_frame(self, nbb): ' Read a byte frame from input stream\n Args:\n nbb: Number of bytes to read\n Returns:\n Byte array\n ' data = self.pin.read(nbb) if (len(data) != nbb): if (len(data) == 0): if (self.process_infos.get(CpoProcessInfo...
e834c5008d48160d8056e849070d147364f5c887d3b3452627940c31fdcee33e
def _read_error_message(self): ' Read stream to search for error line end. Called when wrong input is detected,\n to try to read an "Assertion failed" message for example.\n Returns:\n Byte array\n ' data = [] bv = self.pin.read(1) if IS_PYTHON_2: while ((bv != ''...
Read stream to search for error line end. Called when wrong input is detected, to try to read an "Assertion failed" message for example. Returns: Byte array
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
_read_error_message
Infinity8sailor/Quantum-CERN
1
python
def _read_error_message(self): ' Read stream to search for error line end. Called when wrong input is detected,\n to try to read an "Assertion failed" message for example.\n Returns:\n Byte array\n ' data = [] bv = self.pin.read(1) if IS_PYTHON_2: while ((bv != ) ...
def _read_error_message(self): ' Read stream to search for error line end. Called when wrong input is detected,\n to try to read an "Assertion failed" message for example.\n Returns:\n Byte array\n ' data = [] bv = self.pin.read(1) if IS_PYTHON_2: while ((bv != ) ...
e46d7a2298c948de3be8b73f95e356b19161bb195f025d4b6a61f3b20c63f463
def _send_model_to_solver(self, cpostr): ' Send the model to the solver.\n\n Args:\n copstr: String containing the model in CPO format\n ' self._write_message(CMD_SET_CPO_MODEL, cpostr) self._wait_json_result(EVT_SUCCESS)
Send the model to the solver. Args: copstr: String containing the model in CPO format
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
_send_model_to_solver
Infinity8sailor/Quantum-CERN
1
python
def _send_model_to_solver(self, cpostr): ' Send the model to the solver.\n\n Args:\n copstr: String containing the model in CPO format\n ' self._write_message(CMD_SET_CPO_MODEL, cpostr) self._wait_json_result(EVT_SUCCESS)
def _send_model_to_solver(self, cpostr): ' Send the model to the solver.\n\n Args:\n copstr: String containing the model in CPO format\n ' self._write_message(CMD_SET_CPO_MODEL, cpostr) self._wait_json_result(EVT_SUCCESS)<|docstring|>Send the model to the solver. Args: copstr:...
96ba670e8d9a17f017ce2039ab7e6ae9ede1741f3606206d65141cccede88448
def _add_callback_processing(self): ' Add the processing of solver callback.\n ' aver = self.version_info.get('AngelVersion', 0) if (aver < 8): raise CpoSolverException('This version of the CPO solver angel ({}) does not support solver callbacks.'.format(aver)) self._write_message(CMD_ADD...
Add the processing of solver callback.
venv/Lib/site-packages/docplex/cp/solver/solver_local.py
_add_callback_processing
Infinity8sailor/Quantum-CERN
1
python
def _add_callback_processing(self): ' \n ' aver = self.version_info.get('AngelVersion', 0) if (aver < 8): raise CpoSolverException('This version of the CPO solver angel ({}) does not support solver callbacks.'.format(aver)) self._write_message(CMD_ADD_CALLBACK) self._wait_event(EVT_SU...
def _add_callback_processing(self): ' \n ' aver = self.version_info.get('AngelVersion', 0) if (aver < 8): raise CpoSolverException('This version of the CPO solver angel ({}) does not support solver callbacks.'.format(aver)) self._write_message(CMD_ADD_CALLBACK) self._wait_event(EVT_SU...
5700c1e2e002afba451a44bef5add284df23723e9361f3802b24f093f59ad60b
def _require_openssl(): 'Check that ``openssl`` is on the PATH.\n\n Assumes :func:`_require_py` has been checked.\n ' if (py.path.local.sysfind('openssl') is None): msg = '``openssl`` command line tool must be installed.' print(msg, file=sys.stderr) sys.exit(1)
Check that ``openssl`` is on the PATH. Assumes :func:`_require_py` has been checked.
convert_key.py
_require_openssl
dhermes/google-cloud-python-on-gae
0
python
def _require_openssl(): 'Check that ``openssl`` is on the PATH.\n\n Assumes :func:`_require_py` has been checked.\n ' if (py.path.local.sysfind('openssl') is None): msg = '``openssl`` command line tool must be installed.' print(msg, file=sys.stderr) sys.exit(1)
def _require_openssl(): 'Check that ``openssl`` is on the PATH.\n\n Assumes :func:`_require_py` has been checked.\n ' if (py.path.local.sysfind('openssl') is None): msg = '``openssl`` command line tool must be installed.' print(msg, file=sys.stderr) sys.exit(1)<|docstring|>Check th...
54413d9c0fbda04b23b88a4a70b997c20b0a8e9cd8bff73fce24329ac9bbf76c
def _pkcs8_filename(pkcs8_pem, base): 'Create / check a PKCS#8 file.\n\n Exits with 1 if the file already exists and differs from\n ``pkcs8_pem``. If the file does not exists, creates it with\n ``pkcs8_pem`` as contents and sets permissions to 0400.\n\n Args:\n pkcs8_pem (str): The contents to be...
Create / check a PKCS#8 file. Exits with 1 if the file already exists and differs from ``pkcs8_pem``. If the file does not exists, creates it with ``pkcs8_pem`` as contents and sets permissions to 0400. Args: pkcs8_pem (str): The contents to be stored (or checked). base (str): The base file path (without exte...
convert_key.py
_pkcs8_filename
dhermes/google-cloud-python-on-gae
0
python
def _pkcs8_filename(pkcs8_pem, base): 'Create / check a PKCS#8 file.\n\n Exits with 1 if the file already exists and differs from\n ``pkcs8_pem``. If the file does not exists, creates it with\n ``pkcs8_pem`` as contents and sets permissions to 0400.\n\n Args:\n pkcs8_pem (str): The contents to be...
def _pkcs8_filename(pkcs8_pem, base): 'Create / check a PKCS#8 file.\n\n Exits with 1 if the file already exists and differs from\n ``pkcs8_pem``. If the file does not exists, creates it with\n ``pkcs8_pem`` as contents and sets permissions to 0400.\n\n Args:\n pkcs8_pem (str): The contents to be...
d53e4c4f7acb6c286de441865780a46c43afc7dfb8449459b490c5f4e7081b04
def _pkcs1_verify(pkcs8_filename, pkcs1_filename): 'Verify the contents of an existing PKCS#1 file.\n\n Does so by using ``openssl rsa`` to print to stdout and\n then checking against contents.\n\n Exits with 1 if:\n\n * The ``openssl`` command fails\n * The ``pkcs1_filename`` contents differ from wh...
Verify the contents of an existing PKCS#1 file. Does so by using ``openssl rsa`` to print to stdout and then checking against contents. Exits with 1 if: * The ``openssl`` command fails * The ``pkcs1_filename`` contents differ from what was produced by ``openssl`` Args: pkcs8_filename (str): The PKCS#8 file to...
convert_key.py
_pkcs1_verify
dhermes/google-cloud-python-on-gae
0
python
def _pkcs1_verify(pkcs8_filename, pkcs1_filename): 'Verify the contents of an existing PKCS#1 file.\n\n Does so by using ``openssl rsa`` to print to stdout and\n then checking against contents.\n\n Exits with 1 if:\n\n * The ``openssl`` command fails\n * The ``pkcs1_filename`` contents differ from wh...
def _pkcs1_verify(pkcs8_filename, pkcs1_filename): 'Verify the contents of an existing PKCS#1 file.\n\n Does so by using ``openssl rsa`` to print to stdout and\n then checking against contents.\n\n Exits with 1 if:\n\n * The ``openssl`` command fails\n * The ``pkcs1_filename`` contents differ from wh...
d0e03c4d37929592a2e405281a96e746718459f2d61beed7e846c4c2579f6c6e
def _pkcs1_create(pkcs8_filename, pkcs1_filename): 'Create a existing PKCS#1 file from a PKCS#8 file.\n\n Does so by using ``openssl rsa -in * -out *``.\n\n Exits with 1 if the ``openssl`` command fails.\n\n Args:\n pkcs8_filename (str): The PKCS#8 file to be converted.\n pkcs1_filename (str)...
Create a existing PKCS#1 file from a PKCS#8 file. Does so by using ``openssl rsa -in * -out *``. Exits with 1 if the ``openssl`` command fails. Args: pkcs8_filename (str): The PKCS#8 file to be converted. pkcs1_filename (str): The PKCS#1 file to be created.
convert_key.py
_pkcs1_create
dhermes/google-cloud-python-on-gae
0
python
def _pkcs1_create(pkcs8_filename, pkcs1_filename): 'Create a existing PKCS#1 file from a PKCS#8 file.\n\n Does so by using ``openssl rsa -in * -out *``.\n\n Exits with 1 if the ``openssl`` command fails.\n\n Args:\n pkcs8_filename (str): The PKCS#8 file to be converted.\n pkcs1_filename (str)...
def _pkcs1_create(pkcs8_filename, pkcs1_filename): 'Create a existing PKCS#1 file from a PKCS#8 file.\n\n Does so by using ``openssl rsa -in * -out *``.\n\n Exits with 1 if the ``openssl`` command fails.\n\n Args:\n pkcs8_filename (str): The PKCS#8 file to be converted.\n pkcs1_filename (str)...
85cf99de762a9652ece190be9466a3e4b5f52805ac15e5ccd44f1c71eb98f9a9
def transcribe(fp, decoder): '\n Performs STT, transcribing an audio file and returning the result.\n\n Arguments:\n fp -- a file object containing audio data\n ' fp.seek(44) data = fp.read() decoder.start_utt() decoder.process_raw(data, False, True) decoder.end_utt() result ...
Performs STT, transcribing an audio file and returning the result. Arguments: fp -- a file object containing audio data
jasper_test.py
transcribe
codebhendi/alfred-bot
0
python
def transcribe(fp, decoder): '\n Performs STT, transcribing an audio file and returning the result.\n\n Arguments:\n fp -- a file object containing audio data\n ' fp.seek(44) data = fp.read() decoder.start_utt() decoder.process_raw(data, False, True) decoder.end_utt() result ...
def transcribe(fp, decoder): '\n Performs STT, transcribing an audio file and returning the result.\n\n Arguments:\n fp -- a file object containing audio data\n ' fp.seek(44) data = fp.read() decoder.start_utt() decoder.process_raw(data, False, True) decoder.end_utt() result ...
508c6737808bf43ed5d3150d737afb0e8d17bad5f56b9a69bda5804b933b15ee
def generate_CompetitionSince(all_data: pd.DataFrame, drop=True): "Generate (inplace) a feature 'CompetitionSince' which counts the months (in integer) since\n when the competition started.\n Fills missing values with -1000.\n Creates a new boolean column 'Competition_missing' highlighting the missing valu...
Generate (inplace) a feature 'CompetitionSince' which counts the months (in integer) since when the competition started. Fills missing values with -1000. Creates a new boolean column 'Competition_missing' highlighting the missing values.
feature_engineering.py
generate_CompetitionSince
ChristopherSD/dsr-minicomp
0
python
def generate_CompetitionSince(all_data: pd.DataFrame, drop=True): "Generate (inplace) a feature 'CompetitionSince' which counts the months (in integer) since\n when the competition started.\n Fills missing values with -1000.\n Creates a new boolean column 'Competition_missing' highlighting the missing valu...
def generate_CompetitionSince(all_data: pd.DataFrame, drop=True): "Generate (inplace) a feature 'CompetitionSince' which counts the months (in integer) since\n when the competition started.\n Fills missing values with -1000.\n Creates a new boolean column 'Competition_missing' highlighting the missing valu...
4bd87e0f8abb556ec7e166a9ce3fbfdbccb98e3a939994b7ce5734208e7ed646
def one_hot_encoder_fit_transform(df: pd.DataFrame, col_name: str): '\n Function to fit and transform column in DataFrame with OneHotEncoder\n\n Args:\n df - DataFrame to transform\n col_name: name of the column that has to be transformed\n Returns:\n input DataFrame with concatenated,...
Function to fit and transform column in DataFrame with OneHotEncoder Args: df - DataFrame to transform col_name: name of the column that has to be transformed Returns: input DataFrame with concatenated, transformed column
feature_engineering.py
one_hot_encoder_fit_transform
ChristopherSD/dsr-minicomp
0
python
def one_hot_encoder_fit_transform(df: pd.DataFrame, col_name: str): '\n Function to fit and transform column in DataFrame with OneHotEncoder\n\n Args:\n df - DataFrame to transform\n col_name: name of the column that has to be transformed\n Returns:\n input DataFrame with concatenated,...
def one_hot_encoder_fit_transform(df: pd.DataFrame, col_name: str): '\n Function to fit and transform column in DataFrame with OneHotEncoder\n\n Args:\n df - DataFrame to transform\n col_name: name of the column that has to be transformed\n Returns:\n input DataFrame with concatenated,...
6da5840082e646830a3039eb63ef0a29f37aca2e7370530fba15cd0885fb3ad9
def one_hot_encoder_transform(df: pd.DataFrame, col_name: str, enc): '\n Function to fit and transform column in DataFrame with OneHotEncoder\n\n Args:\n df: DataFrame to transform\n col_name: name of the column that has to be transformed\n enc: instance of fitted OneHotEncoder\n Retur...
Function to fit and transform column in DataFrame with OneHotEncoder Args: df: DataFrame to transform col_name: name of the column that has to be transformed enc: instance of fitted OneHotEncoder Returns: input DataFrame with concatenated, transformed column
feature_engineering.py
one_hot_encoder_transform
ChristopherSD/dsr-minicomp
0
python
def one_hot_encoder_transform(df: pd.DataFrame, col_name: str, enc): '\n Function to fit and transform column in DataFrame with OneHotEncoder\n\n Args:\n df: DataFrame to transform\n col_name: name of the column that has to be transformed\n enc: instance of fitted OneHotEncoder\n Retur...
def one_hot_encoder_transform(df: pd.DataFrame, col_name: str, enc): '\n Function to fit and transform column in DataFrame with OneHotEncoder\n\n Args:\n df: DataFrame to transform\n col_name: name of the column that has to be transformed\n enc: instance of fitted OneHotEncoder\n Retur...
50a1cb2d99cd10bf6c0d0a6cf83cc6747abc48cb72efc28704c7955cd0643883
def is_StateHoliday(df): 'Generates a new boolean column, if it is a StateHoliday or not\n ' return (((df.StateHoliday == 'a') | (df.StateHoliday == 'b')) | (df.StateHoliday == 'c'))
Generates a new boolean column, if it is a StateHoliday or not
feature_engineering.py
is_StateHoliday
ChristopherSD/dsr-minicomp
0
python
def is_StateHoliday(df): '\n ' return (((df.StateHoliday == 'a') | (df.StateHoliday == 'b')) | (df.StateHoliday == 'c'))
def is_StateHoliday(df): '\n ' return (((df.StateHoliday == 'a') | (df.StateHoliday == 'b')) | (df.StateHoliday == 'c'))<|docstring|>Generates a new boolean column, if it is a StateHoliday or not<|endoftext|>
165949eb107c9cdbc8323628a6566047b6d428bef4ba32fd53d3f747529bcff4
def is_SchoolHoliday(df): 'Generates a new boolean column, if it is a StateHoliday or not\n ' return ((((df.SchoolHoliday == '1') | (df.SchoolHoliday == 1)) | (df.SchoolHoliday == '1.0')) | (df.SchoolHoliday == 1.0))
Generates a new boolean column, if it is a StateHoliday or not
feature_engineering.py
is_SchoolHoliday
ChristopherSD/dsr-minicomp
0
python
def is_SchoolHoliday(df): '\n ' return ((((df.SchoolHoliday == '1') | (df.SchoolHoliday == 1)) | (df.SchoolHoliday == '1.0')) | (df.SchoolHoliday == 1.0))
def is_SchoolHoliday(df): '\n ' return ((((df.SchoolHoliday == '1') | (df.SchoolHoliday == 1)) | (df.SchoolHoliday == '1.0')) | (df.SchoolHoliday == 1.0))<|docstring|>Generates a new boolean column, if it is a StateHoliday or not<|endoftext|>
64a1b2c1b057d20523727c87388c1e8fca88e8ac527f456aa9110edf02f7db8f
def log_transform(inp: pd.Series): '\n Function to log transform - takes care of negative and 0 values.\n\n Args:\n inp - pd.Series to log transform\n Returns:\n transformed pd.Series\n ' x = pd.Series() x = ((inp - inp.min()) + 1) return np.log(x)
Function to log transform - takes care of negative and 0 values. Args: inp - pd.Series to log transform Returns: transformed pd.Series
feature_engineering.py
log_transform
ChristopherSD/dsr-minicomp
0
python
def log_transform(inp: pd.Series): '\n Function to log transform - takes care of negative and 0 values.\n\n Args:\n inp - pd.Series to log transform\n Returns:\n transformed pd.Series\n ' x = pd.Series() x = ((inp - inp.min()) + 1) return np.log(x)
def log_transform(inp: pd.Series): '\n Function to log transform - takes care of negative and 0 values.\n\n Args:\n inp - pd.Series to log transform\n Returns:\n transformed pd.Series\n ' x = pd.Series() x = ((inp - inp.min()) + 1) return np.log(x)<|docstring|>Function to log t...
a78b252ffb0944b77676d1b12eb431b65a4bf353c9121b01a3edb777e4227d68
def generate_PromoStarted(all_data: pd.DataFrame, drop=True, itvl_col='PromoInterval'): "Generate (inplace) a feature 'CompetitionSince' which counts the months (in integer) since\n when the competition started.\n " new_col_name = 'PromoStarted' promo_started = all_data.apply(is_in_promo_month, axis=1...
Generate (inplace) a feature 'CompetitionSince' which counts the months (in integer) since when the competition started.
feature_engineering.py
generate_PromoStarted
ChristopherSD/dsr-minicomp
0
python
def generate_PromoStarted(all_data: pd.DataFrame, drop=True, itvl_col='PromoInterval'): "Generate (inplace) a feature 'CompetitionSince' which counts the months (in integer) since\n when the competition started.\n " new_col_name = 'PromoStarted' promo_started = all_data.apply(is_in_promo_month, axis=1...
def generate_PromoStarted(all_data: pd.DataFrame, drop=True, itvl_col='PromoInterval'): "Generate (inplace) a feature 'CompetitionSince' which counts the months (in integer) since\n when the competition started.\n " new_col_name = 'PromoStarted' promo_started = all_data.apply(is_in_promo_month, axis=1...
dcc61565b9d85ec221badedd94e73a05716d08793a939a11658092e56e267fe5
def generate_Promo2SinceNWeeks(all_data: pd.DataFrame, drop=True): "Generate (inplace) a feature 'Promo2SinceNWeeks' which counts the weeks (in integer) since\n when a Promo2 started.\n Fills missing values with -1000.\n Creates a new boolean column 'Promo2SinceNWeeks_missing' highlighting the missing valu...
Generate (inplace) a feature 'Promo2SinceNWeeks' which counts the weeks (in integer) since when a Promo2 started. Fills missing values with -1000. Creates a new boolean column 'Promo2SinceNWeeks_missing' highlighting the missing values.
feature_engineering.py
generate_Promo2SinceNWeeks
ChristopherSD/dsr-minicomp
0
python
def generate_Promo2SinceNWeeks(all_data: pd.DataFrame, drop=True): "Generate (inplace) a feature 'Promo2SinceNWeeks' which counts the weeks (in integer) since\n when a Promo2 started.\n Fills missing values with -1000.\n Creates a new boolean column 'Promo2SinceNWeeks_missing' highlighting the missing valu...
def generate_Promo2SinceNWeeks(all_data: pd.DataFrame, drop=True): "Generate (inplace) a feature 'Promo2SinceNWeeks' which counts the weeks (in integer) since\n when a Promo2 started.\n Fills missing values with -1000.\n Creates a new boolean column 'Promo2SinceNWeeks_missing' highlighting the missing valu...
0c19440ed5ff0c63111ffe6d684a3c6a943097f645b1f78a4ad366543f6fcf21
def generate_col_month(df): 'Generates a new feature "month"\n ' month = df.Date.dt.month return month
Generates a new feature "month"
feature_engineering.py
generate_col_month
ChristopherSD/dsr-minicomp
0
python
def generate_col_month(df): '\n ' month = df.Date.dt.month return month
def generate_col_month(df): '\n ' month = df.Date.dt.month return month<|docstring|>Generates a new feature "month"<|endoftext|>
ff742b6e4c8e42cd97c7d9a57057129a9653e2a67711661418ee1f03164a6856
def target_encode_Stores(df, enc=None): 'Target encode the Store variable using the category_encoders module\n\n Args:\n df: Data\n enc: Existing Encoder / if None retrain new encoder\n ' target = df['Sales'].values stores = df['Store'].astype(str) if (not enc): print('Fit Ta...
Target encode the Store variable using the category_encoders module Args: df: Data enc: Existing Encoder / if None retrain new encoder
feature_engineering.py
target_encode_Stores
ChristopherSD/dsr-minicomp
0
python
def target_encode_Stores(df, enc=None): 'Target encode the Store variable using the category_encoders module\n\n Args:\n df: Data\n enc: Existing Encoder / if None retrain new encoder\n ' target = df['Sales'].values stores = df['Store'].astype(str) if (not enc): print('Fit Ta...
def target_encode_Stores(df, enc=None): 'Target encode the Store variable using the category_encoders module\n\n Args:\n df: Data\n enc: Existing Encoder / if None retrain new encoder\n ' target = df['Sales'].values stores = df['Store'].astype(str) if (not enc): print('Fit Ta...
73da9aa9963ac63a0c695117408263d7f183d0c9b54022e45ed7ddc2487c4398
def target_encode_custom(df: pd.DataFrame, name: str, enc=None): 'Target encode the Store variable using the category_encoders module\n\n Args:\n df: Data\n name (str): name of the column to encode\n enc: Existing Encoder / if None retrain new encoder\n ' target = df['Sales'].values ...
Target encode the Store variable using the category_encoders module Args: df: Data name (str): name of the column to encode enc: Existing Encoder / if None retrain new encoder
feature_engineering.py
target_encode_custom
ChristopherSD/dsr-minicomp
0
python
def target_encode_custom(df: pd.DataFrame, name: str, enc=None): 'Target encode the Store variable using the category_encoders module\n\n Args:\n df: Data\n name (str): name of the column to encode\n enc: Existing Encoder / if None retrain new encoder\n ' target = df['Sales'].values ...
def target_encode_custom(df: pd.DataFrame, name: str, enc=None): 'Target encode the Store variable using the category_encoders module\n\n Args:\n df: Data\n name (str): name of the column to encode\n enc: Existing Encoder / if None retrain new encoder\n ' target = df['Sales'].values ...
c00f0e978d084a3ea0fe4845ef49fd8d1f1ec7697013944c70a0108d7ae8ebb3
def generate_cyclic_feature_month(df): 'Generates a new feature "month"\n ' sin_month = np.sin((((df.Date.dt.month / 12) * 2) * np.pi)) cos_month = np.cos((((df.Date.dt.month / 12) * 2) * np.pi)) sin_month = sin_month.reindex(df.index) cos_month = cos_month.reindex(df.index) return (sin_month...
Generates a new feature "month"
feature_engineering.py
generate_cyclic_feature_month
ChristopherSD/dsr-minicomp
0
python
def generate_cyclic_feature_month(df): '\n ' sin_month = np.sin((((df.Date.dt.month / 12) * 2) * np.pi)) cos_month = np.cos((((df.Date.dt.month / 12) * 2) * np.pi)) sin_month = sin_month.reindex(df.index) cos_month = cos_month.reindex(df.index) return (sin_month, cos_month)
def generate_cyclic_feature_month(df): '\n ' sin_month = np.sin((((df.Date.dt.month / 12) * 2) * np.pi)) cos_month = np.cos((((df.Date.dt.month / 12) * 2) * np.pi)) sin_month = sin_month.reindex(df.index) cos_month = cos_month.reindex(df.index) return (sin_month, cos_month)<|docstring|>Genera...
49df06f2f337e0cba0c08326a7be31046c25267c603f5d81c16cdca3eecd22f1
def generate_cyclic_feature_week(df): 'Generates a new feature "week"\n ' sin_week = np.sin((((df.Date.dt.week / 52) * 2) * np.pi)) cos_week = np.cos((((df.Date.dt.week / 52) * 2) * np.pi)) sin_week = sin_week.reindex(df.index) cos_week = cos_week.reindex(df.index) return (sin_week, cos_week)
Generates a new feature "week"
feature_engineering.py
generate_cyclic_feature_week
ChristopherSD/dsr-minicomp
0
python
def generate_cyclic_feature_week(df): '\n ' sin_week = np.sin((((df.Date.dt.week / 52) * 2) * np.pi)) cos_week = np.cos((((df.Date.dt.week / 52) * 2) * np.pi)) sin_week = sin_week.reindex(df.index) cos_week = cos_week.reindex(df.index) return (sin_week, cos_week)
def generate_cyclic_feature_week(df): '\n ' sin_week = np.sin((((df.Date.dt.week / 52) * 2) * np.pi)) cos_week = np.cos((((df.Date.dt.week / 52) * 2) * np.pi)) sin_week = sin_week.reindex(df.index) cos_week = cos_week.reindex(df.index) return (sin_week, cos_week)<|docstring|>Generates a new f...
1ebaa270c20b3b515317feb1c9d76ccfc8589ecd03249e4a3658dd312430579e
def my_impute_data(data): "Custom function for Michael's Model\n " df = data.copy() df.Promo2.fillna('unknown', inplace=True) impute_competition_distance = df.CompetitionDistance.median() df.CompetitionDistance.fillna(impute_competition_distance, inplace=True) generate_CompetitionSince(df) ...
Custom function for Michael's Model
feature_engineering.py
my_impute_data
ChristopherSD/dsr-minicomp
0
python
def my_impute_data(data): "\n " df = data.copy() df.Promo2.fillna('unknown', inplace=True) impute_competition_distance = df.CompetitionDistance.median() df.CompetitionDistance.fillna(impute_competition_distance, inplace=True) generate_CompetitionSince(df) generate_Promo2SinceNWeeks(df) ...
def my_impute_data(data): "\n " df = data.copy() df.Promo2.fillna('unknown', inplace=True) impute_competition_distance = df.CompetitionDistance.median() df.CompetitionDistance.fillna(impute_competition_distance, inplace=True) generate_CompetitionSince(df) generate_Promo2SinceNWeeks(df) ...
81f899948c53fd98c8dfdd5f67dc8d0c7e20a104e798c04e49e85cfd833738ff
def massive_onehot(input_df, enc=None): "Apply OnehotEncoder to columns:\n 'Promo', 'SchoolHoliday', 'StateHoliday', 'StoreType', 'Assortment', 'Promo2'\n " data = input_df.copy() cat_features = ['Promo', 'SchoolHoliday', 'StateHoliday', 'StoreType', 'Assortment', 'Promo2'] for c in cat_features: ...
Apply OnehotEncoder to columns: 'Promo', 'SchoolHoliday', 'StateHoliday', 'StoreType', 'Assortment', 'Promo2'
feature_engineering.py
massive_onehot
ChristopherSD/dsr-minicomp
0
python
def massive_onehot(input_df, enc=None): "Apply OnehotEncoder to columns:\n 'Promo', 'SchoolHoliday', 'StateHoliday', 'StoreType', 'Assortment', 'Promo2'\n " data = input_df.copy() cat_features = ['Promo', 'SchoolHoliday', 'StateHoliday', 'StoreType', 'Assortment', 'Promo2'] for c in cat_features: ...
def massive_onehot(input_df, enc=None): "Apply OnehotEncoder to columns:\n 'Promo', 'SchoolHoliday', 'StateHoliday', 'StoreType', 'Assortment', 'Promo2'\n " data = input_df.copy() cat_features = ['Promo', 'SchoolHoliday', 'StateHoliday', 'StoreType', 'Assortment', 'Promo2'] for c in cat_features: ...
0fbf4d1bc6844db3dcad3db163d75bf74cfa33fcffcf12efd7f7b395647178c7
def my_preprocess_data(data, oneh_enc=None, target_enc=None): " Data preprocessing function for Michael's Model\n " data = create_basetable(data) data = my_impute_data(data) (data, oneh_enc) = massive_onehot(data, oneh_enc) (new_store, target_enc) = target_encode_Stores(data, target_enc) (sin...
Data preprocessing function for Michael's Model
feature_engineering.py
my_preprocess_data
ChristopherSD/dsr-minicomp
0
python
def my_preprocess_data(data, oneh_enc=None, target_enc=None): " \n " data = create_basetable(data) data = my_impute_data(data) (data, oneh_enc) = massive_onehot(data, oneh_enc) (new_store, target_enc) = target_encode_Stores(data, target_enc) (sin_month, cos_month) = generate_cyclic_feature_mo...
def my_preprocess_data(data, oneh_enc=None, target_enc=None): " \n " data = create_basetable(data) data = my_impute_data(data) (data, oneh_enc) = massive_onehot(data, oneh_enc) (new_store, target_enc) = target_encode_Stores(data, target_enc) (sin_month, cos_month) = generate_cyclic_feature_mo...
f88027b082a39984d0da0ee03f0fc3fef33b0c65838f88804d5c707910eb9d3e
def prepare_data_for_model_ti(): "\n Data pre-processing for Tom's model\n " train_vars = ['DayOfWeek', 'Promo', 'StateHoliday', 'SchoolHoliday', 'StoreType', 'Assortment', 'Promo2', 'Competition_missing', 'Promo2SinceNWeeks_missing', 'PromoStarted', 'Store', 'sin_week', 'cos_week', 'sin_month', 'cos_mont...
Data pre-processing for Tom's model
feature_engineering.py
prepare_data_for_model_ti
ChristopherSD/dsr-minicomp
0
python
def prepare_data_for_model_ti(): "\n \n " train_vars = ['DayOfWeek', 'Promo', 'StateHoliday', 'SchoolHoliday', 'StoreType', 'Assortment', 'Promo2', 'Competition_missing', 'Promo2SinceNWeeks_missing', 'PromoStarted', 'Store', 'sin_week', 'cos_week', 'sin_month', 'cos_month', 'Customers_log', 'CompetitionDi...
def prepare_data_for_model_ti(): "\n \n " train_vars = ['DayOfWeek', 'Promo', 'StateHoliday', 'SchoolHoliday', 'StoreType', 'Assortment', 'Promo2', 'Competition_missing', 'Promo2SinceNWeeks_missing', 'PromoStarted', 'Store', 'sin_week', 'cos_week', 'sin_month', 'cos_month', 'Customers_log', 'CompetitionDi...
d2c6c47edc2f071e7f97214d557796821f32d0b0a39ca7863f7dd47cddf59e0e
def custom_transformer_ti(df): "\n Pre-processing pipeline for Tom's model\n " col_to_str = ['Promo', 'StateHoliday', 'SchoolHoliday', 'StoreType', 'Assortment', 'Promo2'] col_to_log_transform = ['Customers', 'CompetitionDistance', 'CompetitionSince', 'Promo2SinceNWeeks'] generate_CompetitionSince...
Pre-processing pipeline for Tom's model
feature_engineering.py
custom_transformer_ti
ChristopherSD/dsr-minicomp
0
python
def custom_transformer_ti(df): "\n \n " col_to_str = ['Promo', 'StateHoliday', 'SchoolHoliday', 'StoreType', 'Assortment', 'Promo2'] col_to_log_transform = ['Customers', 'CompetitionDistance', 'CompetitionSince', 'Promo2SinceNWeeks'] generate_CompetitionSince(df) generate_Promo2SinceNWeeks(df)...
def custom_transformer_ti(df): "\n \n " col_to_str = ['Promo', 'StateHoliday', 'SchoolHoliday', 'StoreType', 'Assortment', 'Promo2'] col_to_log_transform = ['Customers', 'CompetitionDistance', 'CompetitionSince', 'Promo2SinceNWeeks'] generate_CompetitionSince(df) generate_Promo2SinceNWeeks(df)...