body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
@to_tuple
def _select_capabilities(remote_capabilities: Capabilities, local_capabilities: Capabilities) -> Iterable[Capability]:
'\n Select the appropriate shared capabilities between local and remote.\n\n https://github.com/ethereum/devp2p/blob/master/rlpx.md#capability-messaging\n '
matching_capabili... | 8,425,443,834,844,753,000 | Select the appropriate shared capabilities between local and remote.
https://github.com/ethereum/devp2p/blob/master/rlpx.md#capability-messaging | p2p/handshake.py | _select_capabilities | g-r-a-n-t/trinity | python | @to_tuple
def _select_capabilities(remote_capabilities: Capabilities, local_capabilities: Capabilities) -> Iterable[Capability]:
'\n Select the appropriate shared capabilities between local and remote.\n\n https://github.com/ethereum/devp2p/blob/master/rlpx.md#capability-messaging\n '
matching_capabili... |
async def negotiate_protocol_handshakes(transport: TransportAPI, p2p_handshake_params: DevP2PHandshakeParams, protocol_handshakers: Sequence[HandshakerAPI[ProtocolAPI]]) -> Tuple[(MultiplexerAPI, DevP2PReceipt, Tuple[(HandshakeReceiptAPI, ...)])]:
'\n Negotiate the handshakes for both the base `p2p` protocol and... | -6,508,748,553,269,420,000 | Negotiate the handshakes for both the base `p2p` protocol and the
appropriate sub protocols. The basic logic follows the following steps.
* perform the base `p2p` handshake.
* using the capabilities exchanged during the `p2p` handshake, select the
appropriate sub protocols.
* allow each sub-protocol to perform its ... | p2p/handshake.py | negotiate_protocol_handshakes | g-r-a-n-t/trinity | python | async def negotiate_protocol_handshakes(transport: TransportAPI, p2p_handshake_params: DevP2PHandshakeParams, protocol_handshakers: Sequence[HandshakerAPI[ProtocolAPI]]) -> Tuple[(MultiplexerAPI, DevP2PReceipt, Tuple[(HandshakeReceiptAPI, ...)])]:
'\n Negotiate the handshakes for both the base `p2p` protocol and... |
async def dial_out(remote: NodeAPI, private_key: keys.PrivateKey, p2p_handshake_params: DevP2PHandshakeParams, protocol_handshakers: Sequence[HandshakerAPI[ProtocolAPI]]) -> ConnectionAPI:
'\n Perform the auth and P2P handshakes with the given remote.\n\n Return a `Connection` object housing all of the negoti... | -541,882,953,397,349,950 | Perform the auth and P2P handshakes with the given remote.
Return a `Connection` object housing all of the negotiated sub protocols.
Raises UnreachablePeer if we cannot connect to the peer or
HandshakeFailure if the remote disconnects before completing the
handshake or if none of the sub-protocols supported by us is ... | p2p/handshake.py | dial_out | g-r-a-n-t/trinity | python | async def dial_out(remote: NodeAPI, private_key: keys.PrivateKey, p2p_handshake_params: DevP2PHandshakeParams, protocol_handshakers: Sequence[HandshakerAPI[ProtocolAPI]]) -> ConnectionAPI:
'\n Perform the auth and P2P handshakes with the given remote.\n\n Return a `Connection` object housing all of the negoti... |
def add_conv_status(self, line_no, cmd, object_type, full_command, conv_status, avi_object=None):
'\n Adds as status row in conversion status csv\n :param line_no: line number of command\n :param object_type:\n :param full_command: netscaler command\n :param conv_status: dict of c... | -524,440,085,604,321,150 | Adds as status row in conversion status csv
:param line_no: line number of command
:param object_type:
:param full_command: netscaler command
:param conv_status: dict of conversion status
:param avi_object: Converted objectconverted avi object | python/avi/migrationtools/netscaler_converter/ns_util.py | add_conv_status | avinetworks/alb-sdk | python | def add_conv_status(self, line_no, cmd, object_type, full_command, conv_status, avi_object=None):
'\n Adds as status row in conversion status csv\n :param line_no: line number of command\n :param object_type:\n :param full_command: netscaler command\n :param conv_status: dict of c... |
def add_complete_conv_status(self, ns_config, output_dir, avi_config, report_name, vs_level_status):
'\n Adds as status row in conversion status csv\n :param ns_config: NS config dict\n :param output_dir: output directory\n :param avi_config: AVI config dict\n :param report_name: ... | -1,102,158,361,569,458,000 | Adds as status row in conversion status csv
:param ns_config: NS config dict
:param output_dir: output directory
:param avi_config: AVI config dict
:param report_name: name of report
:param vs_level_status: add vs level details in XL sheet | python/avi/migrationtools/netscaler_converter/ns_util.py | add_complete_conv_status | avinetworks/alb-sdk | python | def add_complete_conv_status(self, ns_config, output_dir, avi_config, report_name, vs_level_status):
'\n Adds as status row in conversion status csv\n :param ns_config: NS config dict\n :param output_dir: output directory\n :param avi_config: AVI config dict\n :param report_name: ... |
def add_status_row(self, line_no, cmd, object_type, full_command, status, avi_object=None):
'\n Adds as status row in conversion status csv\n :param line_no:\n :param cmd: netscaler command\n :param object_type:\n :param full_command:\n :param status: conversion status\n ... | -919,691,838,391,966,800 | Adds as status row in conversion status csv
:param line_no:
:param cmd: netscaler command
:param object_type:
:param full_command:
:param status: conversion status
:param avi_object: | python/avi/migrationtools/netscaler_converter/ns_util.py | add_status_row | avinetworks/alb-sdk | python | def add_status_row(self, line_no, cmd, object_type, full_command, status, avi_object=None):
'\n Adds as status row in conversion status csv\n :param line_no:\n :param cmd: netscaler command\n :param object_type:\n :param full_command:\n :param status: conversion status\n ... |
def add_csv_headers(self, csv_file):
'\n Adds header line in conversion status file\n :param csv_file: File to which header is to be added\n '
global csv_writer
fieldnames = ['Line Number', 'Netscaler Command', 'Object Name', 'Full Command', 'Status', 'Skipped settings', 'Indirect mappi... | 621,174,675,854,295,200 | Adds header line in conversion status file
:param csv_file: File to which header is to be added | python/avi/migrationtools/netscaler_converter/ns_util.py | add_csv_headers | avinetworks/alb-sdk | python | def add_csv_headers(self, csv_file):
'\n Adds header line in conversion status file\n :param csv_file: File to which header is to be added\n '
global csv_writer
fieldnames = ['Line Number', 'Netscaler Command', 'Object Name', 'Full Command', 'Status', 'Skipped settings', 'Indirect mappi... |
def get_avi_lb_algorithm(self, ns_algorithm):
'\n Converts NS LB algorithm to equivalent avi LB algorithm\n :param ns_algorithm: NS algorithm name\n :return: Avi LB algorithm enum value\n '
avi_algorithm = 'LB_ALGORITHM_LEAST_CONNECTIONS'
if (ns_algorithm == 'LEASTCONNECTIONS'):
... | 8,713,300,509,531,353,000 | Converts NS LB algorithm to equivalent avi LB algorithm
:param ns_algorithm: NS algorithm name
:return: Avi LB algorithm enum value | python/avi/migrationtools/netscaler_converter/ns_util.py | get_avi_lb_algorithm | avinetworks/alb-sdk | python | def get_avi_lb_algorithm(self, ns_algorithm):
'\n Converts NS LB algorithm to equivalent avi LB algorithm\n :param ns_algorithm: NS algorithm name\n :return: Avi LB algorithm enum value\n '
avi_algorithm = 'LB_ALGORITHM_LEAST_CONNECTIONS'
if (ns_algorithm == 'LEASTCONNECTIONS'):
... |
def get_avi_resp_code(self, respCode):
'\n This function used for getting appropriate response code for avi.\n :param respCode: response code\n :return: returns list of unique responses.\n '
avi_resp_codes = []
codes = []
for res_code in respCode.split(' '):
if ('-' i... | 2,464,425,441,939,191,300 | This function used for getting appropriate response code for avi.
:param respCode: response code
:return: returns list of unique responses. | python/avi/migrationtools/netscaler_converter/ns_util.py | get_avi_resp_code | avinetworks/alb-sdk | python | def get_avi_resp_code(self, respCode):
'\n This function used for getting appropriate response code for avi.\n :param respCode: response code\n :return: returns list of unique responses.\n '
avi_resp_codes = []
codes = []
for res_code in respCode.split(' '):
if ('-' i... |
def get_conv_status(self, ns_object, skipped_list, na_list, indirect_list, ignore_for_val=None, indirect_commands=None, user_ignore_val=[]):
'\n This function used for getting status detail for command like\n skipped or indirect.\n :param ns_object: Netscaler parsed config\n :param skipp... | 4,816,010,555,973,858,000 | This function used for getting status detail for command like
skipped or indirect.
:param ns_object: Netscaler parsed config
:param skipped_list: list of skipped commands list.
:param na_list: not applicable commands list.
:param indirect_list: indirect command list
:param ignore_for_val: optional field
:param indirect... | python/avi/migrationtools/netscaler_converter/ns_util.py | get_conv_status | avinetworks/alb-sdk | python | def get_conv_status(self, ns_object, skipped_list, na_list, indirect_list, ignore_for_val=None, indirect_commands=None, user_ignore_val=[]):
'\n This function used for getting status detail for command like\n skipped or indirect.\n :param ns_object: Netscaler parsed config\n :param skipp... |
def get_key_cert_obj(self, name, key_file_name, cert_file_name, input_dir):
'\n :param name:name of ssl cert.\n :param key_file_name: key file (ie.pem)\n :param cert_file_name: certificate file name\n :param input_dir: input directory for certificate file name\n :return: returns ... | 1,050,294,291,954,220,800 | :param name:name of ssl cert.
:param key_file_name: key file (ie.pem)
:param cert_file_name: certificate file name
:param input_dir: input directory for certificate file name
:return: returns dict of ssl object | python/avi/migrationtools/netscaler_converter/ns_util.py | get_key_cert_obj | avinetworks/alb-sdk | python | def get_key_cert_obj(self, name, key_file_name, cert_file_name, input_dir):
'\n :param name:name of ssl cert.\n :param key_file_name: key file (ie.pem)\n :param cert_file_name: certificate file name\n :param input_dir: input directory for certificate file name\n :return: returns ... |
def get_command_from_line(self, line):
'\n This function is used for getting command and line number from conf file.\n :param line: line\n :return: returns command name and line\n '
cmd = ''
line_no = 0
for member in line:
if ('line_no' in member):
line_no... | 5,887,616,961,579,559,000 | This function is used for getting command and line number from conf file.
:param line: line
:return: returns command name and line | python/avi/migrationtools/netscaler_converter/ns_util.py | get_command_from_line | avinetworks/alb-sdk | python | def get_command_from_line(self, line):
'\n This function is used for getting command and line number from conf file.\n :param line: line\n :return: returns command name and line\n '
cmd =
line_no = 0
for member in line:
if ('line_no' in member):
line_no =... |
def update_status_for_skipped(self, skipped_cmds):
'\n :param skipped_cmds: separation of non converted commands\n to NA, Indirect,DataScript,NotSupported\n :return: None\n '
na_cmds = ns_constants.netscalar_command_status['NotApplicableCommands']
indirect_cmds = ns_constants.ne... | -4,603,544,928,523,227,600 | :param skipped_cmds: separation of non converted commands
to NA, Indirect,DataScript,NotSupported
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | update_status_for_skipped | avinetworks/alb-sdk | python | def update_status_for_skipped(self, skipped_cmds):
'\n :param skipped_cmds: separation of non converted commands\n to NA, Indirect,DataScript,NotSupported\n :return: None\n '
na_cmds = ns_constants.netscalar_command_status['NotApplicableCommands']
indirect_cmds = ns_constants.ne... |
def remove_duplicate_objects(self, obj_type, obj_list):
'\n Remove duplicate objects from list\n :param obj_type: Object type\n :param obj_list: list of all objects\n :return: return list which has no duplicates objects\n '
if (len(obj_list) == 1):
return obj_list
... | 7,003,530,370,034,506,000 | Remove duplicate objects from list
:param obj_type: Object type
:param obj_list: list of all objects
:return: return list which has no duplicates objects | python/avi/migrationtools/netscaler_converter/ns_util.py | remove_duplicate_objects | avinetworks/alb-sdk | python | def remove_duplicate_objects(self, obj_type, obj_list):
'\n Remove duplicate objects from list\n :param obj_type: Object type\n :param obj_list: list of all objects\n :return: return list which has no duplicates objects\n '
if (len(obj_list) == 1):
return obj_list
... |
def cleanup_config(self, config):
'\n This function is used for deleting temp variables created for conversion\n :param config: dict type\n :return: None\n '
del config | -4,106,352,914,794,422,000 | This function is used for deleting temp variables created for conversion
:param config: dict type
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | cleanup_config | avinetworks/alb-sdk | python | def cleanup_config(self, config):
'\n This function is used for deleting temp variables created for conversion\n :param config: dict type\n :return: None\n '
del config |
def clone_pool(self, pool_name, cloned_for, avi_config, userprefix=None):
'\n This function used for cloning shared pools in netscaler.\n :param pool_name: name of pool\n :param cloned_for: cloned for\n :param avi_config: avi config dict\n :param userprefix: prefix for objects\n ... | 60,184,253,157,548,270 | This function used for cloning shared pools in netscaler.
:param pool_name: name of pool
:param cloned_for: cloned for
:param avi_config: avi config dict
:param userprefix: prefix for objects
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | clone_pool | avinetworks/alb-sdk | python | def clone_pool(self, pool_name, cloned_for, avi_config, userprefix=None):
'\n This function used for cloning shared pools in netscaler.\n :param pool_name: name of pool\n :param cloned_for: cloned for\n :param avi_config: avi config dict\n :param userprefix: prefix for objects\n ... |
def get_vs_if_shared_vip(self, avi_config, controller_version):
'\n This function checks if same vip is used for other vs\n :param avi_config: avi config dict\n :param controller_version:\n :return: None\n '
vs_list = [v for v in avi_config['VirtualService'] if ('port_range_en... | -5,358,874,291,766,402,000 | This function checks if same vip is used for other vs
:param avi_config: avi config dict
:param controller_version:
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | get_vs_if_shared_vip | avinetworks/alb-sdk | python | def get_vs_if_shared_vip(self, avi_config, controller_version):
'\n This function checks if same vip is used for other vs\n :param avi_config: avi config dict\n :param controller_version:\n :return: None\n '
vs_list = [v for v in avi_config['VirtualService'] if ('port_range_en... |
def add_prop_for_http_profile(self, profile_name, avi_config, sysdict, prop_dict):
'\n This method adds the additional attribute to application profile\n :param profile_name: name of application profile\n :param avi_config: avi config dict\n :param sysdict: system/baseline config dict\n ... | -2,461,371,585,625,357,300 | This method adds the additional attribute to application profile
:param profile_name: name of application profile
:param avi_config: avi config dict
:param sysdict: system/baseline config dict
:param prop_dict: property dict
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | add_prop_for_http_profile | avinetworks/alb-sdk | python | def add_prop_for_http_profile(self, profile_name, avi_config, sysdict, prop_dict):
'\n This method adds the additional attribute to application profile\n :param profile_name: name of application profile\n :param avi_config: avi config dict\n :param sysdict: system/baseline config dict\n ... |
def object_exist(self, object_type, name, avi_config):
'\n This method returns true if object exists in avi config dict else false\n :param object_type:\n :param name:\n :param avi_config:\n :return:\n '
data = avi_config[object_type]
obj_list = [obj for obj in data... | -3,865,873,546,458,717,700 | This method returns true if object exists in avi config dict else false
:param object_type:
:param name:
:param avi_config:
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | object_exist | avinetworks/alb-sdk | python | def object_exist(self, object_type, name, avi_config):
'\n This method returns true if object exists in avi config dict else false\n :param object_type:\n :param name:\n :param avi_config:\n :return:\n '
data = avi_config[object_type]
obj_list = [obj for obj in data... |
def is_shared_same_vip(self, vs, cs_vs_list, avi_config, tenant_name, cloud_name, tenant_ref, cloud_ref, controller_version, prefix, input_vrf=None):
'\n This function check for vs sharing same vip\n :param vs: Name of vs\n :param cs_vs_list: List of vs\n :param avi_config: avi config di... | 6,344,653,761,546,128,000 | This function check for vs sharing same vip
:param vs: Name of vs
:param cs_vs_list: List of vs
:param avi_config: avi config dict
:param tenant_name: Name of tenant
:param cloud_name: Name of cloud
:param tenant_ref: Reference of tenant
:param cloud_ref: Reference of cloud
:param controller_version: controller version... | python/avi/migrationtools/netscaler_converter/ns_util.py | is_shared_same_vip | avinetworks/alb-sdk | python | def is_shared_same_vip(self, vs, cs_vs_list, avi_config, tenant_name, cloud_name, tenant_ref, cloud_ref, controller_version, prefix, input_vrf=None):
'\n This function check for vs sharing same vip\n :param vs: Name of vs\n :param cs_vs_list: List of vs\n :param avi_config: avi config di... |
def clone_http_policy_set(self, policy, prefix, avi_config, tenant_name, cloud_name, used_poolgrp_ref, userprefix=None):
'\n This function clone pool reused in context switching rule\n :param policy: name of policy\n :param prefix: clone for\n :param avi_config: avi config dict\n ... | 6,982,211,706,178,502,000 | This function clone pool reused in context switching rule
:param policy: name of policy
:param prefix: clone for
:param avi_config: avi config dict
:param tenant_name:
:param cloud_name:
:param used_poolgrp_ref:
:param userprefix: prefix for objects
:return:None | python/avi/migrationtools/netscaler_converter/ns_util.py | clone_http_policy_set | avinetworks/alb-sdk | python | def clone_http_policy_set(self, policy, prefix, avi_config, tenant_name, cloud_name, used_poolgrp_ref, userprefix=None):
'\n This function clone pool reused in context switching rule\n :param policy: name of policy\n :param prefix: clone for\n :param avi_config: avi config dict\n ... |
def set_rules_index_for_http_policy_set(self, avi_config):
'\n Update index as per avi protobuf requirements\n :param avi_config: avi config dict\n :return: None\n '
http_policy_sets = avi_config['HTTPPolicySet']
for http_policy_set in http_policy_sets:
rules = http_polic... | 1,613,698,748,301,972,700 | Update index as per avi protobuf requirements
:param avi_config: avi config dict
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | set_rules_index_for_http_policy_set | avinetworks/alb-sdk | python | def set_rules_index_for_http_policy_set(self, avi_config):
'\n Update index as per avi protobuf requirements\n :param avi_config: avi config dict\n :return: None\n '
http_policy_sets = avi_config['HTTPPolicySet']
for http_policy_set in http_policy_sets:
rules = http_polic... |
def get_netscalar_full_command(self, netscalar_command, obj):
'\n Generate netscaler command from the parse dict\n :param netscalar_command: name of command\n :param obj: object with attributes\n :return: Full command\n '
for attr in obj['attrs']:
netscalar_command += ... | 6,395,164,331,100,777,000 | Generate netscaler command from the parse dict
:param netscalar_command: name of command
:param obj: object with attributes
:return: Full command | python/avi/migrationtools/netscaler_converter/ns_util.py | get_netscalar_full_command | avinetworks/alb-sdk | python | def get_netscalar_full_command(self, netscalar_command, obj):
'\n Generate netscaler command from the parse dict\n :param netscalar_command: name of command\n :param obj: object with attributes\n :return: Full command\n '
for attr in obj['attrs']:
netscalar_command += ... |
def clone_pool_group(self, pg_name, cloned_for, avi_config, tenant_name, cloud_name, userprefix=None):
'\n Used for cloning shared pool group.\n :param pg_name: pool group name\n :param cloned_for: clone for\n :param avi_config: avi config dict\n :param tenant_name:\n :para... | -6,270,595,012,755,129,000 | Used for cloning shared pool group.
:param pg_name: pool group name
:param cloned_for: clone for
:param avi_config: avi config dict
:param tenant_name:
:param cloud_name:
:param userprefix: prefix for objects
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | clone_pool_group | avinetworks/alb-sdk | python | def clone_pool_group(self, pg_name, cloned_for, avi_config, tenant_name, cloud_name, userprefix=None):
'\n Used for cloning shared pool group.\n :param pg_name: pool group name\n :param cloned_for: clone for\n :param avi_config: avi config dict\n :param tenant_name:\n :para... |
def remove_http_mon_from_pool(self, avi_config, pool, sysdict):
'\n This function is used for removing http type health monitor from https\n vs.\n :param avi_config: avi config dict\n :param pool: name of pool\n :param sysdict: baseline/system config dict\n :return: None\n ... | 4,120,604,159,898,324,000 | This function is used for removing http type health monitor from https
vs.
:param avi_config: avi config dict
:param pool: name of pool
:param sysdict: baseline/system config dict
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | remove_http_mon_from_pool | avinetworks/alb-sdk | python | def remove_http_mon_from_pool(self, avi_config, pool, sysdict):
'\n This function is used for removing http type health monitor from https\n vs.\n :param avi_config: avi config dict\n :param pool: name of pool\n :param sysdict: baseline/system config dict\n :return: None\n ... |
def remove_https_mon_from_pool(self, avi_config, pool, sysdict):
'\n This function is used for removing https type health monitor from http\n vs.\n :param avi_config: avi config dict\n :param pool: name of pool\n :param sysdict: baseline/system config dict\n :return: None\n... | 4,178,237,875,809,718,300 | This function is used for removing https type health monitor from http
vs.
:param avi_config: avi config dict
:param pool: name of pool
:param sysdict: baseline/system config dict
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | remove_https_mon_from_pool | avinetworks/alb-sdk | python | def remove_https_mon_from_pool(self, avi_config, pool, sysdict):
'\n This function is used for removing https type health monitor from http\n vs.\n :param avi_config: avi config dict\n :param pool: name of pool\n :param sysdict: baseline/system config dict\n :return: None\n... |
def update_application_profile(self, profile_name, pki_profile_ref, tenant_ref, name, avi_config, sysdict):
'\n This functions defines to update application profile with pki profile if\n application profile exist if not create new http profile with pki profile\n :param profile_name: name of Htt... | 8,957,387,572,475,818,000 | This functions defines to update application profile with pki profile if
application profile exist if not create new http profile with pki profile
:param profile_name: name of Http profile
:param pki_profile_ref: ref of PKI profile
:param tenant_ref: tenant ref
:param name: name of virtual service
:param avi_config: D... | python/avi/migrationtools/netscaler_converter/ns_util.py | update_application_profile | avinetworks/alb-sdk | python | def update_application_profile(self, profile_name, pki_profile_ref, tenant_ref, name, avi_config, sysdict):
'\n This functions defines to update application profile with pki profile if\n application profile exist if not create new http profile with pki profile\n :param profile_name: name of Htt... |
def convert_persistance_prof(self, vs, name, tenant_ref):
'\n This function defines that it convert the persistent profile and\n return that profile\n :param vs: object of lb vs or pool\n :param name: name of application persteance profile\n :param tenant_ref: reference of tenant\... | -4,700,764,150,025,277,000 | This function defines that it convert the persistent profile and
return that profile
:param vs: object of lb vs or pool
:param name: name of application persteance profile
:param tenant_ref: reference of tenant
:return: application persistent profile | python/avi/migrationtools/netscaler_converter/ns_util.py | convert_persistance_prof | avinetworks/alb-sdk | python | def convert_persistance_prof(self, vs, name, tenant_ref):
'\n This function defines that it convert the persistent profile and\n return that profile\n :param vs: object of lb vs or pool\n :param name: name of application persteance profile\n :param tenant_ref: reference of tenant\... |
def update_status_target_lb_vs_to_indirect(self, larget_lb_vs):
'\n This function defines that update status for the target lb vserver as\n Indirect\n :param larget_lb_vs: name of target lb vserver\n :return: None\n '
global csv_writer_dict_list
row = [row for row in csv_w... | -5,964,540,455,396,743,000 | This function defines that update status for the target lb vserver as
Indirect
:param larget_lb_vs: name of target lb vserver
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | update_status_target_lb_vs_to_indirect | avinetworks/alb-sdk | python | def update_status_target_lb_vs_to_indirect(self, larget_lb_vs):
'\n This function defines that update status for the target lb vserver as\n Indirect\n :param larget_lb_vs: name of target lb vserver\n :return: None\n '
global csv_writer_dict_list
row = [row for row in csv_w... |
def create_http_policy_set_for_redirect_url(self, vs_obj, redirect_uri, avi_config, tenant_name, tenant_ref, enable_ssl):
'\n This function defines that create http policy for redirect url\n :param vs_obj: object of VS\n :param redirect_uri: redirect uri\n :param avi_config: dict of AVi\... | 2,394,880,107,976,594,400 | This function defines that create http policy for redirect url
:param vs_obj: object of VS
:param redirect_uri: redirect uri
:param avi_config: dict of AVi
:param tenant_name: name of tenant
:param tenant_ref: tenant ref
:param enable_ssl: flag for enabling ssl
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | create_http_policy_set_for_redirect_url | avinetworks/alb-sdk | python | def create_http_policy_set_for_redirect_url(self, vs_obj, redirect_uri, avi_config, tenant_name, tenant_ref, enable_ssl):
'\n This function defines that create http policy for redirect url\n :param vs_obj: object of VS\n :param redirect_uri: redirect uri\n :param avi_config: dict of AVi\... |
def clean_virtual_service_from_avi_config(self, avi_config, controller_version):
'\n This function defines that clean up vs which has vip 0.0.0.0\n :param avi_config: dict of AVI\n :param controller_version:\n :return: None\n '
vs_list = copy.deepcopy(avi_config['VirtualServic... | 927,490,409,122,392,400 | This function defines that clean up vs which has vip 0.0.0.0
:param avi_config: dict of AVI
:param controller_version:
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | clean_virtual_service_from_avi_config | avinetworks/alb-sdk | python | def clean_virtual_service_from_avi_config(self, avi_config, controller_version):
'\n This function defines that clean up vs which has vip 0.0.0.0\n :param avi_config: dict of AVI\n :param controller_version:\n :return: None\n '
vs_list = copy.deepcopy(avi_config['VirtualServic... |
def parse_url(self, url):
'\n This method returns the parsed url\n :param url: url that need to be parsed\n :return:\n '
parsed = urlparse(url)
return parsed | 1,088,853,979,099,526,800 | This method returns the parsed url
:param url: url that need to be parsed
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | parse_url | avinetworks/alb-sdk | python | def parse_url(self, url):
'\n This method returns the parsed url\n :param url: url that need to be parsed\n :return:\n '
parsed = urlparse(url)
return parsed |
def format_string_to_json(self, avi_string):
'\n This function defines that it convert string into json format to\n convert into dict\n :param avi_string: string to be converted\n :return: Return converted string\n '
avi_string = avi_string.split('__/__')[0]
return ast.lit... | -4,568,014,645,511,582,000 | This function defines that it convert string into json format to
convert into dict
:param avi_string: string to be converted
:return: Return converted string | python/avi/migrationtools/netscaler_converter/ns_util.py | format_string_to_json | avinetworks/alb-sdk | python | def format_string_to_json(self, avi_string):
'\n This function defines that it convert string into json format to\n convert into dict\n :param avi_string: string to be converted\n :return: Return converted string\n '
avi_string = avi_string.split('__/__')[0]
return ast.lit... |
def get_csv_object_list(self, csv_writer_dict_list, command_list):
'\n This method is used for getting csv object\n :param csv_writer_dict_list: CSV row of object from xlsx report\n :param command_list: List of netscaler commands\n :return: List of CSV rows\n '
csv_object = [r... | 3,593,132,901,122,004,500 | This method is used for getting csv object
:param csv_writer_dict_list: CSV row of object from xlsx report
:param command_list: List of netscaler commands
:return: List of CSV rows | python/avi/migrationtools/netscaler_converter/ns_util.py | get_csv_object_list | avinetworks/alb-sdk | python | def get_csv_object_list(self, csv_writer_dict_list, command_list):
'\n This method is used for getting csv object\n :param csv_writer_dict_list: CSV row of object from xlsx report\n :param command_list: List of netscaler commands\n :return: List of CSV rows\n '
csv_object = [r... |
def get_csv_skipped_list(self, csv_object, name_of_object, vs_ref):
'\n This method is used for getting skipped list from vs.\n :param csv_object: CSV row of object from xlsx report\n :param name_of_object: Name of Object\n :param vs_ref: Reference of VS\n :return: List of skipped... | 7,593,250,242,791,457,000 | This method is used for getting skipped list from vs.
:param csv_object: CSV row of object from xlsx report
:param name_of_object: Name of Object
:param vs_ref: Reference of VS
:return: List of skipped settings | python/avi/migrationtools/netscaler_converter/ns_util.py | get_csv_skipped_list | avinetworks/alb-sdk | python | def get_csv_skipped_list(self, csv_object, name_of_object, vs_ref):
'\n This method is used for getting skipped list from vs.\n :param csv_object: CSV row of object from xlsx report\n :param name_of_object: Name of Object\n :param vs_ref: Reference of VS\n :return: List of skipped... |
def get_ssl_key_and_cert_refs_skipped(self, csv_writer_dict_list, object_name, vs_ref):
'\n This functions defines that get the skipped list of CSV row\n :param csv_writer_dict_list: CSV row of object from xlsx report\n :param object_name: like virtual service or pool name\n :param vs_re... | 4,522,307,787,195,755,500 | This functions defines that get the skipped list of CSV row
:param csv_writer_dict_list: CSV row of object from xlsx report
:param object_name: like virtual service or pool name
:param vs_ref: Reference of VS
:return: List of skipped settings | python/avi/migrationtools/netscaler_converter/ns_util.py | get_ssl_key_and_cert_refs_skipped | avinetworks/alb-sdk | python | def get_ssl_key_and_cert_refs_skipped(self, csv_writer_dict_list, object_name, vs_ref):
'\n This functions defines that get the skipped list of CSV row\n :param csv_writer_dict_list: CSV row of object from xlsx report\n :param object_name: like virtual service or pool name\n :param vs_re... |
def get_ssl_profile_skipped(self, csv_writer_dict_list, ssl_profile_ref, vs_ref):
'\n This functions defines that get the skipped list of CSV row\n :param csv_writer_dict_list: CSV row of object from xlsx report\n :param ssl_profile_ref: reference of ssl profile object\n :param vs_ref: v... | -7,045,245,419,789,641,000 | This functions defines that get the skipped list of CSV row
:param csv_writer_dict_list: CSV row of object from xlsx report
:param ssl_profile_ref: reference of ssl profile object
:param vs_ref: virtual service obj reference.
:return: List of skipped settings | python/avi/migrationtools/netscaler_converter/ns_util.py | get_ssl_profile_skipped | avinetworks/alb-sdk | python | def get_ssl_profile_skipped(self, csv_writer_dict_list, ssl_profile_ref, vs_ref):
'\n This functions defines that get the skipped list of CSV row\n :param csv_writer_dict_list: CSV row of object from xlsx report\n :param ssl_profile_ref: reference of ssl profile object\n :param vs_ref: v... |
def get_application_profile_skipped(self, csv_writer_dict_list, name_of_object, vs_ref):
'\n This functions defines that get the skipped list of CSV row\n :param csv_writer_dict_list: CSV row of object from xlsx report\n :param name_of_object: object name like pool name, etc\n :param vs_... | -5,602,520,979,021,883,000 | This functions defines that get the skipped list of CSV row
:param csv_writer_dict_list: CSV row of object from xlsx report
:param name_of_object: object name like pool name, etc
:param vs_ref: virtual service obj reference.
:return: List of skipped settings | python/avi/migrationtools/netscaler_converter/ns_util.py | get_application_profile_skipped | avinetworks/alb-sdk | python | def get_application_profile_skipped(self, csv_writer_dict_list, name_of_object, vs_ref):
'\n This functions defines that get the skipped list of CSV row\n :param csv_writer_dict_list: CSV row of object from xlsx report\n :param name_of_object: object name like pool name, etc\n :param vs_... |
def get_network_profile_skipped(self, csv_writer_dict_list, name_of_object, vs_ref):
'\n This functions defines that get the skipped list of CSV row\n :param csv_writer_dict_list:List of add ns tcpProfile netscaler command rows\n :param name_of_object: object name like pool name, etc\n :... | -5,462,502,248,008,268,000 | This functions defines that get the skipped list of CSV row
:param csv_writer_dict_list:List of add ns tcpProfile netscaler command rows
:param name_of_object: object name like pool name, etc
:param vs_ref: virtual service obj reference.
:return: List of skipped settings | python/avi/migrationtools/netscaler_converter/ns_util.py | get_network_profile_skipped | avinetworks/alb-sdk | python | def get_network_profile_skipped(self, csv_writer_dict_list, name_of_object, vs_ref):
'\n This functions defines that get the skipped list of CSV row\n :param csv_writer_dict_list:List of add ns tcpProfile netscaler command rows\n :param name_of_object: object name like pool name, etc\n :... |
def get_app_persistence_profile_skipped(self, csv_writer_dict_list, name_of_object, vs_ref):
'\n This functions defines that get the skipped list of CSV row\n :param csv_writer_dict_list: List of set lb group netscaler command rows\n :param name_of_object: object name like pool name, etc\n ... | -8,380,088,319,087,735,000 | This functions defines that get the skipped list of CSV row
:param csv_writer_dict_list: List of set lb group netscaler command rows
:param name_of_object: object name like pool name, etc
:param vs_ref: virtual service obj reference.
:return: List of skipped settings | python/avi/migrationtools/netscaler_converter/ns_util.py | get_app_persistence_profile_skipped | avinetworks/alb-sdk | python | def get_app_persistence_profile_skipped(self, csv_writer_dict_list, name_of_object, vs_ref):
'\n This functions defines that get the skipped list of CSV row\n :param csv_writer_dict_list: List of set lb group netscaler command rows\n :param name_of_object: object name like pool name, etc\n ... |
def get_pool_skipped_list(self, avi_config, pool_group_name, skipped_setting, csv_object, obj_name, csv_writer_dict_list, vs_ref):
'\n This method is used for getting pool skipped list.\n :param avi_config: AVI dict\n :param pool_group_name: Name of Pool group\n :param skipped_setting: L... | 8,853,895,342,330,683,000 | This method is used for getting pool skipped list.
:param avi_config: AVI dict
:param pool_group_name: Name of Pool group
:param skipped_setting: List of skipped settings
:param csv_object: CSV row
:param obj_name: Name of Object
:param csv_writer_dict_list: List of bind lb vserver netscaler command
... | python/avi/migrationtools/netscaler_converter/ns_util.py | get_pool_skipped_list | avinetworks/alb-sdk | python | def get_pool_skipped_list(self, avi_config, pool_group_name, skipped_setting, csv_object, obj_name, csv_writer_dict_list, vs_ref):
'\n This method is used for getting pool skipped list.\n :param avi_config: AVI dict\n :param pool_group_name: Name of Pool group\n :param skipped_setting: L... |
def vs_complexity_level(self):
'\n This method calculate complexity of vs.\n :return:\n '
vs_csv_objects = [row for row in csv_writer_dict_list if ((row['Status'] in [STATUS_PARTIAL, STATUS_SUCCESSFUL]) and (row['Netscaler Command'] in ['add cs vserver', 'add lb vserver']))]
for vs_csv_... | -5,497,695,561,299,338,000 | This method calculate complexity of vs.
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | vs_complexity_level | avinetworks/alb-sdk | python | def vs_complexity_level(self):
'\n This method calculate complexity of vs.\n :return:\n '
vs_csv_objects = [row for row in csv_writer_dict_list if ((row['Status'] in [STATUS_PARTIAL, STATUS_SUCCESSFUL]) and (row['Netscaler Command'] in ['add cs vserver', 'add lb vserver']))]
for vs_csv_... |
def vs_per_skipped_setting_for_references(self, avi_config):
'\n This functions defines that Add the skipped setting per VS CSV row\n :param avi_config: this methode use avi_config for checking vs skipped\n :return: None\n '
global fully_migrated
global total_count
global pro... | -5,424,762,615,369,725,000 | This functions defines that Add the skipped setting per VS CSV row
:param avi_config: this methode use avi_config for checking vs skipped
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | vs_per_skipped_setting_for_references | avinetworks/alb-sdk | python | def vs_per_skipped_setting_for_references(self, avi_config):
'\n This functions defines that Add the skipped setting per VS CSV row\n :param avi_config: this methode use avi_config for checking vs skipped\n :return: None\n '
global fully_migrated
global total_count
global pro... |
def write_status_report_and_pivot_table_in_xlsx(self, row_list, output_dir, report_name, vs_level_status):
'\n This method writes the status and make pivot table in excel sheet\n :param row_list:\n :param output_dir:\n :param report_name:\n :param vs_level_status:\n :return... | -2,934,899,319,914,298,000 | This method writes the status and make pivot table in excel sheet
:param row_list:
:param output_dir:
:param report_name:
:param vs_level_status:
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | write_status_report_and_pivot_table_in_xlsx | avinetworks/alb-sdk | python | def write_status_report_and_pivot_table_in_xlsx(self, row_list, output_dir, report_name, vs_level_status):
'\n This method writes the status and make pivot table in excel sheet\n :param row_list:\n :param output_dir:\n :param report_name:\n :param vs_level_status:\n :return... |
def update_skip_duplicates(self, obj, obj_list, obj_type, merge_object_mapping, name, ent_type, prefix, syslist):
'\n This method merge duplicate objects\n :param obj: Source object to find duplicates for\n :param obj_list: List of object to search duplicates in\n :param obj_type: Type o... | 642,166,565,262,819,300 | This method merge duplicate objects
:param obj: Source object to find duplicates for
:param obj_list: List of object to search duplicates in
:param obj_type: Type of object to add in converted_objs status
:param converted_objs: Converted avi object or merged object name
:param name: Name of the object
:param default_pr... | python/avi/migrationtools/netscaler_converter/ns_util.py | update_skip_duplicates | avinetworks/alb-sdk | python | def update_skip_duplicates(self, obj, obj_list, obj_type, merge_object_mapping, name, ent_type, prefix, syslist):
'\n This method merge duplicate objects\n :param obj: Source object to find duplicates for\n :param obj_list: List of object to search duplicates in\n :param obj_type: Type o... |
def create_update_vsvip(self, vip, vsvip_config, tenant_ref, cloud_ref, prefix=None, vrf_ref=None):
'\n This functions defines that create or update VSVIP object.\n :param vip: vip of VS\n :param vsvip_config: List of vs object\n :param tenant_ref: tenant reference\n :param cloud_... | -3,150,883,588,053,014,500 | This functions defines that create or update VSVIP object.
:param vip: vip of VS
:param vsvip_config: List of vs object
:param tenant_ref: tenant reference
:param cloud_ref: cloud reference
:param prefix: prefix for objects
:param vrf_ref: VRF ref to be added in VIP object
:return: None | python/avi/migrationtools/netscaler_converter/ns_util.py | create_update_vsvip | avinetworks/alb-sdk | python | def create_update_vsvip(self, vip, vsvip_config, tenant_ref, cloud_ref, prefix=None, vrf_ref=None):
'\n This functions defines that create or update VSVIP object.\n :param vip: vip of VS\n :param vsvip_config: List of vs object\n :param tenant_ref: tenant reference\n :param cloud_... |
def get_redirect_fail_action(self, url):
'\n This method returns the fail action dict\n :param url: url\n :return:\n '
parsed = urlparse(url)
redirect_fail_action = {'fail_action': {'redirect': {'host': parsed.hostname, 'protocol': str(parsed.scheme).upper(), 'status_code': 'HTTP... | 5,927,314,944,786,889,000 | This method returns the fail action dict
:param url: url
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | get_redirect_fail_action | avinetworks/alb-sdk | python | def get_redirect_fail_action(self, url):
'\n This method returns the fail action dict\n :param url: url\n :return:\n '
parsed = urlparse(url)
redirect_fail_action = {'fail_action': {'redirect': {'host': parsed.hostname, 'protocol': str(parsed.scheme).upper(), 'status_code': 'HTTP... |
def cleanup_dupof(self, avi_config):
'\n This method is used to clean up dup_of key from different AVI objects\n :param avi_config:\n :return:\n '
self.remove_dup_key(avi_config['ApplicationProfile'])
self.remove_dup_key(avi_config['NetworkProfile'])
self.remove_dup_key(avi_c... | 6,673,110,791,954,695,000 | This method is used to clean up dup_of key from different AVI objects
:param avi_config:
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | cleanup_dupof | avinetworks/alb-sdk | python | def cleanup_dupof(self, avi_config):
'\n This method is used to clean up dup_of key from different AVI objects\n :param avi_config:\n :return:\n '
self.remove_dup_key(avi_config['ApplicationProfile'])
self.remove_dup_key(avi_config['NetworkProfile'])
self.remove_dup_key(avi_c... |
def update_profile_ref(self, ref, avi_obj, merge_obj_list):
'\n This method is used to update the profile references which was\n attached at the time of creation\n :param ref:\n :param avi_obj:\n :param merge_obj_list:\n :return:\n '
for obj in avi_obj:
o... | 7,339,447,582,846,898,000 | This method is used to update the profile references which was
attached at the time of creation
:param ref:
:param avi_obj:
:param merge_obj_list:
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | update_profile_ref | avinetworks/alb-sdk | python | def update_profile_ref(self, ref, avi_obj, merge_obj_list):
'\n This method is used to update the profile references which was\n attached at the time of creation\n :param ref:\n :param avi_obj:\n :param merge_obj_list:\n :return:\n '
for obj in avi_obj:
o... |
def vs_redirect_http_to_https(self, avi_config, sysdict):
'\n Removes the VS which is redirected to another VS amd update the\n status and avi object for that VS\n :param avi_config: avi configuration after all conversion\n :param sysdict: system configuration\n :return:\n ... | -1,752,131,683,458,171,000 | Removes the VS which is redirected to another VS amd update the
status and avi object for that VS
:param avi_config: avi configuration after all conversion
:param sysdict: system configuration
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | vs_redirect_http_to_https | avinetworks/alb-sdk | python | def vs_redirect_http_to_https(self, avi_config, sysdict):
'\n Removes the VS which is redirected to another VS amd update the\n status and avi object for that VS\n :param avi_config: avi configuration after all conversion\n :param sysdict: system configuration\n :return:\n ... |
def merge_pool(self, avi_config):
'\n This method merge the pools in AVI if HM is same\n :param avi_config:\n :return:\n '
mergelist = []
for poolgrp in avi_config['PoolGroup']:
if (poolgrp['name'] == 'lb-depoed1cdb.qai-pri-5984-poolgroup'):
print('found')
... | 4,898,384,470,949,158,000 | This method merge the pools in AVI if HM is same
:param avi_config:
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | merge_pool | avinetworks/alb-sdk | python | def merge_pool(self, avi_config):
'\n This method merge the pools in AVI if HM is same\n :param avi_config:\n :return:\n '
mergelist = []
for poolgrp in avi_config['PoolGroup']:
if (poolgrp['name'] == 'lb-depoed1cdb.qai-pri-5984-poolgroup'):
print('found')
... |
def add_policy(self, policy, updated_vs_name, avi_config, tmp_policy_ref, vs_obj, tenant_name, cloud_name, prefix, used_poolgrp_ref):
'\n This method is used to add policy objects to AVI and also add\n reference in VS\n :param policy: policy object\n :param updated_vs_name: vs name\n ... | 3,358,375,780,726,247,000 | This method is used to add policy objects to AVI and also add
reference in VS
:param policy: policy object
:param updated_vs_name: vs name
:param avi_config: avi config dict
:param tmp_policy_ref: list of policy ref which are already used
:param vs_obj: vs object
:param tenant_name: name of tenant
:param cloud_name: na... | python/avi/migrationtools/netscaler_converter/ns_util.py | add_policy | avinetworks/alb-sdk | python | def add_policy(self, policy, updated_vs_name, avi_config, tmp_policy_ref, vs_obj, tenant_name, cloud_name, prefix, used_poolgrp_ref):
'\n This method is used to add policy objects to AVI and also add\n reference in VS\n :param policy: policy object\n :param updated_vs_name: vs name\n ... |
def build_redirect_action_dict(self, redirect_url, enable_ssl):
'\n This method returns a redirect action dict\n :param redirect_url: redirect url\n :param enable_ssl: flag for ssl enable\n :return:\n '
redirect_url = self.parse_url(redirect_url)
protocol = str(redirect_ur... | -4,270,356,411,581,813,000 | This method returns a redirect action dict
:param redirect_url: redirect url
:param enable_ssl: flag for ssl enable
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | build_redirect_action_dict | avinetworks/alb-sdk | python | def build_redirect_action_dict(self, redirect_url, enable_ssl):
'\n This method returns a redirect action dict\n :param redirect_url: redirect url\n :param enable_ssl: flag for ssl enable\n :return:\n '
redirect_url = self.parse_url(redirect_url)
protocol = str(redirect_ur... |
def create_http_to_https_custom_profile(self):
'\n\n :return: custom application profile dict\n '
return {'name': 'ns-migrate-http', 'type': 'APPLICATION_PROFILE_TYPE_HTTP', 'tenant_ref': '/api/tenant/?name=admin', 'preserve_client_ip': False, 'http_profile': {'max_rps_uri': 0, 'keepalive_header':... | 5,881,756,311,370,102,000 | :return: custom application profile dict | python/avi/migrationtools/netscaler_converter/ns_util.py | create_http_to_https_custom_profile | avinetworks/alb-sdk | python | def create_http_to_https_custom_profile(self):
'\n\n \n '
return {'name': 'ns-migrate-http', 'type': 'APPLICATION_PROFILE_TYPE_HTTP', 'tenant_ref': '/api/tenant/?name=admin', 'preserve_client_ip': False, 'http_profile': {'max_rps_uri': 0, 'keepalive_header': False, 'max_rps_cip_uri': 0, 'x_forward... |
def correct_vs_ref(self, avi_config):
'\n This method corrects the reference of VS to different objects\n :param avi_config: avi configuration dict\n :return:\n '
global csv_writer_dict_list
avi_graph = self.make_graph(avi_config)
csv_dict_sub = [row for row in csv_writer_dic... | -3,131,435,864,647,046,000 | This method corrects the reference of VS to different objects
:param avi_config: avi configuration dict
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | correct_vs_ref | avinetworks/alb-sdk | python | def correct_vs_ref(self, avi_config):
'\n This method corrects the reference of VS to different objects\n :param avi_config: avi configuration dict\n :return:\n '
global csv_writer_dict_list
avi_graph = self.make_graph(avi_config)
csv_dict_sub = [row for row in csv_writer_dic... |
def add_vs_ref(self, obj, avi_graph, vs):
'\n Helper method for adding vs ref\n :param obj: object\n :param avi_graph: avi graph\n :param vs: VS list\n :return:\n '
obj_name = obj.get('name', obj.get('hostname'))
if obj_name:
if avi_graph.has_node(obj_name):... | -5,466,778,583,118,322,000 | Helper method for adding vs ref
:param obj: object
:param avi_graph: avi graph
:param vs: VS list
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | add_vs_ref | avinetworks/alb-sdk | python | def add_vs_ref(self, obj, avi_graph, vs):
'\n Helper method for adding vs ref\n :param obj: object\n :param avi_graph: avi graph\n :param vs: VS list\n :return:\n '
obj_name = obj.get('name', obj.get('hostname'))
if obj_name:
if avi_graph.has_node(obj_name):... |
def get_predecessor(self, predecessor, avi_graph, vs):
'\n This method gets the predecessor of the object\n :param predecessor: predecessor list\n :param avi_graph: avi graph\n :param vs: VS list\n :return:\n '
if (len(predecessor) > 1):
for node in predecessor:... | -3,511,810,973,429,969,400 | This method gets the predecessor of the object
:param predecessor: predecessor list
:param avi_graph: avi graph
:param vs: VS list
:return: | python/avi/migrationtools/netscaler_converter/ns_util.py | get_predecessor | avinetworks/alb-sdk | python | def get_predecessor(self, predecessor, avi_graph, vs):
'\n This method gets the predecessor of the object\n :param predecessor: predecessor list\n :param avi_graph: avi graph\n :param vs: VS list\n :return:\n '
if (len(predecessor) > 1):
for node in predecessor:... |
def __init__(self, base_url=None, symbol=None, apiKey=None, apiSecret=None, orderIDPrefix='mm_bitmex_', shouldWSAuth=True, postOnly=False, timeout=7):
'Init connector.'
self.base_url = base_url
self.symbol = symbol
self.postOnly = postOnly
self.shouldWSAuth = shouldWSAuth
if (apiKey is None):
... | -8,712,447,931,383,142,000 | Init connector. | market_maker/bitmex.py | __init__ | veskokaradzhov/sample-market-maker | python | def __init__(self, base_url=None, symbol=None, apiKey=None, apiSecret=None, orderIDPrefix='mm_bitmex_', shouldWSAuth=True, postOnly=False, timeout=7):
self.base_url = base_url
self.symbol = symbol
self.postOnly = postOnly
self.shouldWSAuth = shouldWSAuth
if (apiKey is None):
raise Excep... |
def ticker_data(self, symbol=None):
'Get ticker data.'
if (symbol is None):
symbol = self.symbol
return self.ws.get_ticker(symbol) | 1,730,474,277,475,240,000 | Get ticker data. | market_maker/bitmex.py | ticker_data | veskokaradzhov/sample-market-maker | python | def ticker_data(self, symbol=None):
if (symbol is None):
symbol = self.symbol
return self.ws.get_ticker(symbol) |
def instrument(self, symbol):
"Get an instrument's details."
return self.ws.get_instrument(symbol) | 2,904,046,683,405,473,300 | Get an instrument's details. | market_maker/bitmex.py | instrument | veskokaradzhov/sample-market-maker | python | def instrument(self, symbol):
return self.ws.get_instrument(symbol) |
def market_depth(self):
'Get market depth / orderbook.'
return self.ws.market_depth() | 6,477,251,214,908,190,000 | Get market depth / orderbook. | market_maker/bitmex.py | market_depth | veskokaradzhov/sample-market-maker | python | def market_depth(self):
return self.ws.market_depth() |
def recent_trades(self):
"Get recent trades.\n\n Returns\n -------\n A list of dicts:\n {u'amount': 60,\n u'date': 1306775375,\n u'price': 8.7401099999999996,\n u'tid': u'93842'},\n\n "
return self.ws.recent_trades() | 5,726,568,376,258,028,000 | Get recent trades.
Returns
-------
A list of dicts:
{u'amount': 60,
u'date': 1306775375,
u'price': 8.7401099999999996,
u'tid': u'93842'}, | market_maker/bitmex.py | recent_trades | veskokaradzhov/sample-market-maker | python | def recent_trades(self):
"Get recent trades.\n\n Returns\n -------\n A list of dicts:\n {u'amount': 60,\n u'date': 1306775375,\n u'price': 8.7401099999999996,\n u'tid': u'93842'},\n\n "
return self.ws.recent_trades() |
def authentication_required(fn):
'Annotation for methods that require auth.'
def wrapped(self, *args, **kwargs):
if (not self.apiKey):
msg = 'You must be authenticated to use this method'
raise errors.AuthenticationError(msg)
else:
return fn(self, *args, **kw... | -3,795,446,689,248,801,300 | Annotation for methods that require auth. | market_maker/bitmex.py | authentication_required | veskokaradzhov/sample-market-maker | python | def authentication_required(fn):
def wrapped(self, *args, **kwargs):
if (not self.apiKey):
msg = 'You must be authenticated to use this method'
raise errors.AuthenticationError(msg)
else:
return fn(self, *args, **kwargs)
return wrapped |
@authentication_required
def funds(self):
'Get your current balance.'
return self.ws.funds() | -2,661,775,430,091,995,000 | Get your current balance. | market_maker/bitmex.py | funds | veskokaradzhov/sample-market-maker | python | @authentication_required
def funds(self):
return self.ws.funds() |
@authentication_required
def position(self, symbol):
'Get your open position.'
return self.ws.position(symbol) | -5,280,714,735,572,079,000 | Get your open position. | market_maker/bitmex.py | position | veskokaradzhov/sample-market-maker | python | @authentication_required
def position(self, symbol):
return self.ws.position(symbol) |
@authentication_required
def isolate_margin(self, symbol, leverage, rethrow_errors=False):
'Set the leverage on an isolated margin position'
path = 'position/leverage'
postdict = {'symbol': symbol, 'leverage': leverage}
return self._curl_bitmex(path=path, postdict=postdict, verb='POST', rethrow_errors=r... | -6,562,018,996,676,132,000 | Set the leverage on an isolated margin position | market_maker/bitmex.py | isolate_margin | veskokaradzhov/sample-market-maker | python | @authentication_required
def isolate_margin(self, symbol, leverage, rethrow_errors=False):
path = 'position/leverage'
postdict = {'symbol': symbol, 'leverage': leverage}
return self._curl_bitmex(path=path, postdict=postdict, verb='POST', rethrow_errors=rethrow_errors) |
@authentication_required
def buy(self, quantity, price):
'Place a buy order.\n\n Returns order object. ID: orderID\n '
return self.place_order(quantity, price) | 1,627,606,856,503,511,000 | Place a buy order.
Returns order object. ID: orderID | market_maker/bitmex.py | buy | veskokaradzhov/sample-market-maker | python | @authentication_required
def buy(self, quantity, price):
'Place a buy order.\n\n Returns order object. ID: orderID\n '
return self.place_order(quantity, price) |
@authentication_required
def sell(self, quantity, price):
'Place a sell order.\n\n Returns order object. ID: orderID\n '
return self.place_order((- quantity), price) | 7,339,910,726,446,182,000 | Place a sell order.
Returns order object. ID: orderID | market_maker/bitmex.py | sell | veskokaradzhov/sample-market-maker | python | @authentication_required
def sell(self, quantity, price):
'Place a sell order.\n\n Returns order object. ID: orderID\n '
return self.place_order((- quantity), price) |
@authentication_required
def place_order(self, quantity, price):
'Place an order.'
if (price < 0):
raise Exception('Price must be positive.')
endpoint = 'order'
clOrdID = (self.orderIDPrefix + base64.b64encode(uuid.uuid4().bytes).decode('utf8').rstrip('=\n'))
postdict = {'symbol': self.symbo... | 2,789,380,601,364,919,300 | Place an order. | market_maker/bitmex.py | place_order | veskokaradzhov/sample-market-maker | python | @authentication_required
def place_order(self, quantity, price):
if (price < 0):
raise Exception('Price must be positive.')
endpoint = 'order'
clOrdID = (self.orderIDPrefix + base64.b64encode(uuid.uuid4().bytes).decode('utf8').rstrip('=\n'))
postdict = {'symbol': self.symbol, 'orderQty': qu... |
@authentication_required
def amend_bulk_orders(self, orders):
'Amend multiple orders.'
return self._curl_bitmex(path='order/bulk', postdict={'orders': orders}, verb='PUT', rethrow_errors=True) | 3,046,872,120,849,604,600 | Amend multiple orders. | market_maker/bitmex.py | amend_bulk_orders | veskokaradzhov/sample-market-maker | python | @authentication_required
def amend_bulk_orders(self, orders):
return self._curl_bitmex(path='order/bulk', postdict={'orders': orders}, verb='PUT', rethrow_errors=True) |
@authentication_required
def create_bulk_orders(self, orders):
'Create multiple orders.'
for order in orders:
order['clOrdID'] = (self.orderIDPrefix + base64.b64encode(uuid.uuid4().bytes).decode('utf8').rstrip('=\n'))
order['symbol'] = self.symbol
if self.postOnly:
order['exe... | 6,811,979,488,187,572,000 | Create multiple orders. | market_maker/bitmex.py | create_bulk_orders | veskokaradzhov/sample-market-maker | python | @authentication_required
def create_bulk_orders(self, orders):
for order in orders:
order['clOrdID'] = (self.orderIDPrefix + base64.b64encode(uuid.uuid4().bytes).decode('utf8').rstrip('=\n'))
order['symbol'] = self.symbol
if self.postOnly:
order['execInst'] = 'ParticipateDoN... |
@authentication_required
def open_orders(self):
'Get open orders.'
return self.ws.open_orders(self.orderIDPrefix) | -8,255,759,037,361,243,000 | Get open orders. | market_maker/bitmex.py | open_orders | veskokaradzhov/sample-market-maker | python | @authentication_required
def open_orders(self):
return self.ws.open_orders(self.orderIDPrefix) |
@authentication_required
def http_open_orders(self):
'Get open orders via HTTP. Used on close to ensure we catch them all.'
path = 'order'
orders = self._curl_bitmex(path=path, query={'filter': json.dumps({'ordStatus.isTerminated': False, 'symbol': self.symbol}), 'count': 500}, verb='GET')
return [o for... | 7,783,532,974,160,712,000 | Get open orders via HTTP. Used on close to ensure we catch them all. | market_maker/bitmex.py | http_open_orders | veskokaradzhov/sample-market-maker | python | @authentication_required
def http_open_orders(self):
path = 'order'
orders = self._curl_bitmex(path=path, query={'filter': json.dumps({'ordStatus.isTerminated': False, 'symbol': self.symbol}), 'count': 500}, verb='GET')
return [o for o in orders if str(o['clOrdID']).startswith(self.orderIDPrefix)] |
@authentication_required
def cancel(self, orderID):
'Cancel an existing order.'
path = 'order'
postdict = {'orderID': orderID}
return self._curl_bitmex(path=path, postdict=postdict, verb='DELETE') | -3,841,336,432,020,093,000 | Cancel an existing order. | market_maker/bitmex.py | cancel | veskokaradzhov/sample-market-maker | python | @authentication_required
def cancel(self, orderID):
path = 'order'
postdict = {'orderID': orderID}
return self._curl_bitmex(path=path, postdict=postdict, verb='DELETE') |
def _curl_bitmex(self, path, query=None, postdict=None, timeout=None, verb=None, rethrow_errors=False, max_retries=None):
'Send a request to BitMEX Servers.'
url = (self.base_url + path)
if (timeout is None):
timeout = self.timeout
if (not verb):
verb = ('POST' if postdict else 'GET')
... | -4,221,852,213,426,500,600 | Send a request to BitMEX Servers. | market_maker/bitmex.py | _curl_bitmex | veskokaradzhov/sample-market-maker | python | def _curl_bitmex(self, path, query=None, postdict=None, timeout=None, verb=None, rethrow_errors=False, max_retries=None):
url = (self.base_url + path)
if (timeout is None):
timeout = self.timeout
if (not verb):
verb = ('POST' if postdict else 'GET')
if (max_retries is None):
... |
def create_annotation_class(project, name, color, attribute_groups=None):
'Create annotation class in project\n\n :param project: project name or metadata of the project\n :type project: str or dict\n :param name: name for the class\n :type name: str\n :param color: RGB hex color value, e.g., "#FFFFA... | -5,240,219,407,293,144,000 | Create annotation class in project
:param project: project name or metadata of the project
:type project: str or dict
:param name: name for the class
:type name: str
:param color: RGB hex color value, e.g., "#FFFFAA"
:type color: str
:param attribute_groups: example:
[ { "name": "tall", "is_multiselect": 0, "attribut... | superannotate/db/annotation_classes.py | create_annotation_class | yuki-inaho/superannotate-python-sdk | python | def create_annotation_class(project, name, color, attribute_groups=None):
'Create annotation class in project\n\n :param project: project name or metadata of the project\n :type project: str or dict\n :param name: name for the class\n :type name: str\n :param color: RGB hex color value, e.g., "#FFFFA... |
def delete_annotation_class(project, annotation_class):
'Deletes annotation class from project\n\n :param project: project name or metadata of the project\n :type project: str or dict\n :param project: annotation class name or metadata\n :type project: str or dict\n '
if (not isinstance(project,... | -7,986,916,238,161,438,000 | Deletes annotation class from project
:param project: project name or metadata of the project
:type project: str or dict
:param project: annotation class name or metadata
:type project: str or dict | superannotate/db/annotation_classes.py | delete_annotation_class | yuki-inaho/superannotate-python-sdk | python | def delete_annotation_class(project, annotation_class):
'Deletes annotation class from project\n\n :param project: project name or metadata of the project\n :type project: str or dict\n :param project: annotation class name or metadata\n :type project: str or dict\n '
if (not isinstance(project,... |
def create_annotation_classes_from_classes_json(project, classes_json, from_s3_bucket=None):
'Creates annotation classes in project from a SuperAnnotate format\n annotation classes.json.\n\n :param project: project name or metadata of the project\n :type project: str or dict\n :param classes_json: JSON ... | 2,071,405,053,133,175,600 | Creates annotation classes in project from a SuperAnnotate format
annotation classes.json.
:param project: project name or metadata of the project
:type project: str or dict
:param classes_json: JSON itself or path to the JSON file
:type classes_json: list or Pathlike (str or Path)
:param from_s3_bucket: AWS S3 bucket... | superannotate/db/annotation_classes.py | create_annotation_classes_from_classes_json | yuki-inaho/superannotate-python-sdk | python | def create_annotation_classes_from_classes_json(project, classes_json, from_s3_bucket=None):
'Creates annotation classes in project from a SuperAnnotate format\n annotation classes.json.\n\n :param project: project name or metadata of the project\n :type project: str or dict\n :param classes_json: JSON ... |
def search_annotation_classes(project, name_prefix=None, return_metadata=False):
'Searches annotation classes by name_prefix (case-insensitive)\n\n :param project: project name or metadata of the project\n :type project: str or dict\n :param name_prefix: name prefix for search. If None all annotation class... | 1,149,609,391,371,542,300 | Searches annotation classes by name_prefix (case-insensitive)
:param project: project name or metadata of the project
:type project: str or dict
:param name_prefix: name prefix for search. If None all annotation classes
will be returned
:type name_prefix: str
:return: annotation classes of the project
:rtype: list o... | superannotate/db/annotation_classes.py | search_annotation_classes | yuki-inaho/superannotate-python-sdk | python | def search_annotation_classes(project, name_prefix=None, return_metadata=False):
'Searches annotation classes by name_prefix (case-insensitive)\n\n :param project: project name or metadata of the project\n :type project: str or dict\n :param name_prefix: name prefix for search. If None all annotation class... |
def get_annotation_class_metadata(project, annotation_class_name):
'Returns annotation class metadata\n\n :param project: project name or metadata of the project\n :type project: str or dict\n :param annotation_class_name: annotation class name\n :type annotation_class_name: str\n\n :return: metadata... | -3,052,328,036,060,555,000 | Returns annotation class metadata
:param project: project name or metadata of the project
:type project: str or dict
:param annotation_class_name: annotation class name
:type annotation_class_name: str
:return: metadata of annotation class
:rtype: dict | superannotate/db/annotation_classes.py | get_annotation_class_metadata | yuki-inaho/superannotate-python-sdk | python | def get_annotation_class_metadata(project, annotation_class_name):
'Returns annotation class metadata\n\n :param project: project name or metadata of the project\n :type project: str or dict\n :param annotation_class_name: annotation class name\n :type annotation_class_name: str\n\n :return: metadata... |
def download_annotation_classes_json(project, folder):
'Downloads project classes.json to folder\n\n :param project: project name or metadata of the project\n :type project: str or dict\n :param folder: folder to download to\n :type folder: Pathlike (str or Path)\n\n :return: path of the download fil... | 1,210,275,893,233,714,000 | Downloads project classes.json to folder
:param project: project name or metadata of the project
:type project: str or dict
:param folder: folder to download to
:type folder: Pathlike (str or Path)
:return: path of the download file
:rtype: str | superannotate/db/annotation_classes.py | download_annotation_classes_json | yuki-inaho/superannotate-python-sdk | python | def download_annotation_classes_json(project, folder):
'Downloads project classes.json to folder\n\n :param project: project name or metadata of the project\n :type project: str or dict\n :param folder: folder to download to\n :type folder: Pathlike (str or Path)\n\n :return: path of the download fil... |
def __init__(self, img_path) -> None:
'\n 读取图片\n '
self.img = cv2.imread(img_path) | -2,976,448,287,938,725,000 | 读取图片 | Photo.py | __init__ | Rougnt/ArkNightAutoClick | python | def __init__(self, img_path) -> None:
'\n \n '
self.img = cv2.imread(img_path) |
@staticmethod
def calcFangcha(img):
'\n 计算938:1035,1935:2247区域间图片的方差,用于比较图片见相似程度\n 计算过程,对图像每一行像素求平均,对所有行像素平均值求方差\n return (int)\n '
img_new = img[938:1013, 1935:2247]
img_avg = np.mean(img_new, axis=(0, 2))
return np.var(img_avg) | -8,420,559,267,574,300,000 | 计算938:1035,1935:2247区域间图片的方差,用于比较图片见相似程度
计算过程,对图像每一行像素求平均,对所有行像素平均值求方差
return (int) | Photo.py | calcFangcha | Rougnt/ArkNightAutoClick | python | @staticmethod
def calcFangcha(img):
'\n 计算938:1035,1935:2247区域间图片的方差,用于比较图片见相似程度\n 计算过程,对图像每一行像素求平均,对所有行像素平均值求方差\n return (int)\n '
img_new = img[938:1013, 1935:2247]
img_avg = np.mean(img_new, axis=(0, 2))
return np.var(img_avg) |
def rebase_file(relative_path_in_file, file_path_resides_in):
'\n In config files, you often put file paths that are meant to be relative\n to the location of that config file. This does that calculation.\n '
check.str_param(relative_path_in_file, 'relative_path_in_file')
check.str_param(file_path_... | 2,218,992,647,814,451,200 | In config files, you often put file paths that are meant to be relative
to the location of that config file. This does that calculation. | python_modules/dagster/dagster/core/code_pointer.py | rebase_file | idjevm/dagster | python | def rebase_file(relative_path_in_file, file_path_resides_in):
'\n In config files, you often put file paths that are meant to be relative\n to the location of that config file. This does that calculation.\n '
check.str_param(relative_path_in_file, 'relative_path_in_file')
check.str_param(file_path_... |
def load_python_file(python_file, working_directory):
'\n Takes a path to a python file and returns a loaded module\n '
check.str_param(python_file, 'python_file')
module_name = os.path.splitext(os.path.basename(python_file))[0]
cwd = sys.path[0]
if working_directory:
with alter_sys_pa... | 4,991,760,834,715,504,000 | Takes a path to a python file and returns a loaded module | python_modules/dagster/dagster/core/code_pointer.py | load_python_file | idjevm/dagster | python | def load_python_file(python_file, working_directory):
'\n \n '
check.str_param(python_file, 'python_file')
module_name = os.path.splitext(os.path.basename(python_file))[0]
cwd = sys.path[0]
if working_directory:
with alter_sys_path(to_add=[working_directory], to_remove=[cwd]):
... |
def get_python_file_from_previous_stack_frame():
'inspect.stack() lets us introspect the call stack; inspect.stack()[1] is the previous\n stack frame.\n\n In Python < 3.5, this is just a tuple, of which the python file of the previous frame is the 1st\n element.\n\n In Python 3.5+, this is a FrameInfo n... | -6,616,463,174,597,527,000 | inspect.stack() lets us introspect the call stack; inspect.stack()[1] is the previous
stack frame.
In Python < 3.5, this is just a tuple, of which the python file of the previous frame is the 1st
element.
In Python 3.5+, this is a FrameInfo namedtuple instance; the python file of the previous frame
remains the 1st el... | python_modules/dagster/dagster/core/code_pointer.py | get_python_file_from_previous_stack_frame | idjevm/dagster | python | def get_python_file_from_previous_stack_frame():
'inspect.stack() lets us introspect the call stack; inspect.stack()[1] is the previous\n stack frame.\n\n In Python < 3.5, this is just a tuple, of which the python file of the previous frame is the 1st\n element.\n\n In Python 3.5+, this is a FrameInfo n... |
def tarjan(sequence):
'\n Tarjan algorithm for finding Strongly Connected Components (SCCs) of a graph.\n\n Args:\n sequence (list):\n List of head indices.\n\n Yields:\n A list of indices making up a SCC. All self-loops are ignored.\n\n Examples:\n >>> next(tarjan([2, 5,... | -2,976,157,928,269,709,300 | Tarjan algorithm for finding Strongly Connected Components (SCCs) of a graph.
Args:
sequence (list):
List of head indices.
Yields:
A list of indices making up a SCC. All self-loops are ignored.
Examples:
>>> next(tarjan([2, 5, 0, 3, 1])) # (1 -> 5 -> 2 -> 1) is a cycle
[2, 5, 1] | supar/structs/fn.py | tarjan | zysite/parser | python | def tarjan(sequence):
'\n Tarjan algorithm for finding Strongly Connected Components (SCCs) of a graph.\n\n Args:\n sequence (list):\n List of head indices.\n\n Yields:\n A list of indices making up a SCC. All self-loops are ignored.\n\n Examples:\n >>> next(tarjan([2, 5,... |
def chuliu_edmonds(s):
"\n ChuLiu/Edmonds algorithm for non-projective decoding :cite:`mcdonald-etal-2005-non`.\n\n Some code is borrowed from `tdozat's implementation`_.\n Descriptions of notations and formulas can be found in :cite:`mcdonald-etal-2005-non`.\n\n Notes:\n The algorithm does not g... | -2,960,571,905,903,595,000 | ChuLiu/Edmonds algorithm for non-projective decoding :cite:`mcdonald-etal-2005-non`.
Some code is borrowed from `tdozat's implementation`_.
Descriptions of notations and formulas can be found in :cite:`mcdonald-etal-2005-non`.
Notes:
The algorithm does not guarantee to parse a single-root tree.
Args:
s (~tor... | supar/structs/fn.py | chuliu_edmonds | zysite/parser | python | def chuliu_edmonds(s):
"\n ChuLiu/Edmonds algorithm for non-projective decoding :cite:`mcdonald-etal-2005-non`.\n\n Some code is borrowed from `tdozat's implementation`_.\n Descriptions of notations and formulas can be found in :cite:`mcdonald-etal-2005-non`.\n\n Notes:\n The algorithm does not g... |
def mst(scores, mask, multiroot=False):
'\n MST algorithm for decoding non-projective trees.\n This is a wrapper for ChuLiu/Edmonds algorithm.\n\n The algorithm first runs ChuLiu/Edmonds to parse a tree and then have a check of multi-roots,\n If ``multiroot=True`` and there indeed exist multi-roots, the... | 1,458,930,332,535,327,000 | MST algorithm for decoding non-projective trees.
This is a wrapper for ChuLiu/Edmonds algorithm.
The algorithm first runs ChuLiu/Edmonds to parse a tree and then have a check of multi-roots,
If ``multiroot=True`` and there indeed exist multi-roots, the algorithm seeks to find
best single-root trees by iterating all po... | supar/structs/fn.py | mst | zysite/parser | python | def mst(scores, mask, multiroot=False):
'\n MST algorithm for decoding non-projective trees.\n This is a wrapper for ChuLiu/Edmonds algorithm.\n\n The algorithm first runs ChuLiu/Edmonds to parse a tree and then have a check of multi-roots,\n If ``multiroot=True`` and there indeed exist multi-roots, the... |
def make_mainlib_replicates_train_test_split(mainlib_mol_list, replicates_mol_list, splitting_type, mainlib_fractions, replicates_fractions, mainlib_maximum_num_molecules_to_use=None, replicates_maximum_num_molecules_to_use=None, rseed=42):
"Makes train/validation/test inchikey lists from two lists of rdkit.Mol.\n\... | -8,021,216,745,129,914,000 | Makes train/validation/test inchikey lists from two lists of rdkit.Mol.
Args:
mainlib_mol_list : list of molecules from main library
replicates_mol_list : list of molecules from replicates library
splitting_type : type of splitting to use for validation splits.
mainlib_fractions : TrainValTestFractions namedtu... | make_train_test_split.py | make_mainlib_replicates_train_test_split | berlinguyinca/deep-molecular-massspec | python | def make_mainlib_replicates_train_test_split(mainlib_mol_list, replicates_mol_list, splitting_type, mainlib_fractions, replicates_fractions, mainlib_maximum_num_molecules_to_use=None, replicates_maximum_num_molecules_to_use=None, rseed=42):
"Makes train/validation/test inchikey lists from two lists of rdkit.Mol.\n\... |
def write_list_of_inchikeys(inchikey_list, base_name, output_dir):
'Write list of inchikeys as a text file.'
inchikey_list_name = (base_name + INCHIKEY_FILENAME_END)
with tf.gfile.Open(os.path.join(output_dir, inchikey_list_name), 'w') as writer:
for inchikey in inchikey_list:
writer.wri... | -5,325,643,015,259,984,000 | Write list of inchikeys as a text file. | make_train_test_split.py | write_list_of_inchikeys | berlinguyinca/deep-molecular-massspec | python | def write_list_of_inchikeys(inchikey_list, base_name, output_dir):
inchikey_list_name = (base_name + INCHIKEY_FILENAME_END)
with tf.gfile.Open(os.path.join(output_dir, inchikey_list_name), 'w') as writer:
for inchikey in inchikey_list:
writer.write(('%s\n' % inchikey)) |
def write_all_dataset_files(inchikey_dict, inchikey_list, base_name, output_dir, max_atoms, max_mass_spec_peak_loc, make_library_array=False):
'Helper function for writing all the files associated with a TFRecord.\n\n Args:\n inchikey_dict : Full dictionary keyed by inchikey containing lists of\n ... | -7,087,730,737,864,763,000 | Helper function for writing all the files associated with a TFRecord.
Args:
inchikey_dict : Full dictionary keyed by inchikey containing lists of
rdkit.Mol objects
inchikey_list : List of inchikeys to include in dataset
base_name : Base name for the dataset
output_dir : Path for saving all TF... | make_train_test_split.py | write_all_dataset_files | berlinguyinca/deep-molecular-massspec | python | def write_all_dataset_files(inchikey_dict, inchikey_list, base_name, output_dir, max_atoms, max_mass_spec_peak_loc, make_library_array=False):
'Helper function for writing all the files associated with a TFRecord.\n\n Args:\n inchikey_dict : Full dictionary keyed by inchikey containing lists of\n ... |
def write_mainlib_split_datasets(component_inchikey_dict, mainlib_inchikey_dict, output_dir, max_atoms, max_mass_spec_peak_loc):
'Write all train/val/test set TFRecords from main NIST sdf file.'
for component_kwarg in component_inchikey_dict.keys():
component_mainlib_filename = (component_kwarg + FROM_M... | -3,808,761,830,725,798,000 | Write all train/val/test set TFRecords from main NIST sdf file. | make_train_test_split.py | write_mainlib_split_datasets | berlinguyinca/deep-molecular-massspec | python | def write_mainlib_split_datasets(component_inchikey_dict, mainlib_inchikey_dict, output_dir, max_atoms, max_mass_spec_peak_loc):
for component_kwarg in component_inchikey_dict.keys():
component_mainlib_filename = (component_kwarg + FROM_MAINLIB_FILENAME_MODIFIER)
if (component_kwarg == ds_const... |
def write_replicates_split_datasets(component_inchikey_dict, replicates_inchikey_dict, output_dir, max_atoms, max_mass_spec_peak_loc):
'Write replicates val/test set TFRecords from replicates sdf file.'
for component_kwarg in [ds_constants.REPLICATES_VALIDATION_BASENAME, ds_constants.REPLICATES_TEST_BASENAME]:
... | -3,912,315,331,998,454,300 | Write replicates val/test set TFRecords from replicates sdf file. | make_train_test_split.py | write_replicates_split_datasets | berlinguyinca/deep-molecular-massspec | python | def write_replicates_split_datasets(component_inchikey_dict, replicates_inchikey_dict, output_dir, max_atoms, max_mass_spec_peak_loc):
for component_kwarg in [ds_constants.REPLICATES_VALIDATION_BASENAME, ds_constants.REPLICATES_TEST_BASENAME]:
component_replicates_filename = (component_kwarg + FROM_REP... |
def combine_inchikey_sets(dataset_subdivision_list, dataset_split_dict):
'A function to combine lists of inchikeys that are values from a dict.\n\n Args:\n dataset_subdivision_list: List of keys in dataset_split_dict to combine\n into one list\n dataset_split_dict: dict containing keys in dataset_subd... | 2,988,018,329,595,237,000 | A function to combine lists of inchikeys that are values from a dict.
Args:
dataset_subdivision_list: List of keys in dataset_split_dict to combine
into one list
dataset_split_dict: dict containing keys in dataset_subdivision_list, with
lists of inchikeys as values.
Returns:
A list of inchikeys. | make_train_test_split.py | combine_inchikey_sets | berlinguyinca/deep-molecular-massspec | python | def combine_inchikey_sets(dataset_subdivision_list, dataset_split_dict):
'A function to combine lists of inchikeys that are values from a dict.\n\n Args:\n dataset_subdivision_list: List of keys in dataset_split_dict to combine\n into one list\n dataset_split_dict: dict containing keys in dataset_subd... |
def check_experiment_setup(experiment_setup_dict, component_inchikey_dict):
'Validates experiment setup for given lists of inchikeys.'
all_inchikeys_in_library = (combine_inchikey_sets(experiment_setup_dict[ds_constants.LIBRARY_MATCHING_OBSERVED_KEY], component_inchikey_dict) + combine_inchikey_sets(experiment_... | -3,406,558,791,919,901,000 | Validates experiment setup for given lists of inchikeys. | make_train_test_split.py | check_experiment_setup | berlinguyinca/deep-molecular-massspec | python | def check_experiment_setup(experiment_setup_dict, component_inchikey_dict):
all_inchikeys_in_library = (combine_inchikey_sets(experiment_setup_dict[ds_constants.LIBRARY_MATCHING_OBSERVED_KEY], component_inchikey_dict) + combine_inchikey_sets(experiment_setup_dict[ds_constants.LIBRARY_MATCHING_PREDICTED_KEY], c... |
def write_json_for_experiment(experiment_setup, output_dir):
'Writes json for experiment, recording relevant files for each component.\n\n Writes a json containing a list of TFRecord file names to read\n for each experiment component, i.e. spectrum_prediction, library_matching.\n\n Args:\n experiment_setup: A... | 8,856,359,304,804,744,000 | Writes json for experiment, recording relevant files for each component.
Writes a json containing a list of TFRecord file names to read
for each experiment component, i.e. spectrum_prediction, library_matching.
Args:
experiment_setup: A dataset_setup_constants.ExperimentSetup tuple
output_dir: directory to write ... | make_train_test_split.py | write_json_for_experiment | berlinguyinca/deep-molecular-massspec | python | def write_json_for_experiment(experiment_setup, output_dir):
'Writes json for experiment, recording relevant files for each component.\n\n Writes a json containing a list of TFRecord file names to read\n for each experiment component, i.e. spectrum_prediction, library_matching.\n\n Args:\n experiment_setup: A... |
def combinationSum(self, candidates, target):
'\n :type candidates: List[int]\n :type target: int\n :rtype: List[List[int]]\n '
def recurhelper(nums, res, path, target, start):
if (target == 0):
res.append(path)
return
if (target < 0):
... | -1,772,554,806,074,169,600 | :type candidates: List[int]
:type target: int
:rtype: List[List[int]] | 39-Combination-Sum/solution.py | combinationSum | Tanych/CodeTracking | python | def combinationSum(self, candidates, target):
'\n :type candidates: List[int]\n :type target: int\n :rtype: List[List[int]]\n '
def recurhelper(nums, res, path, target, start):
if (target == 0):
res.append(path)
return
if (target < 0):
... |
def force_console_input(query: str, allowable, onfail: str='Input not recognised, please try again.\n', case_sensitive=False):
'Get an input from the user matching some string in allowable.\n\n Args:\n query (str): The query to issue the user with.\n allowable (str or container): The options which ... | 8,692,285,292,826,950,000 | Get an input from the user matching some string in allowable.
Args:
query (str): The query to issue the user with.
allowable (str or container): The options which the user is allowed to submit.
If this is a string, acceptable answers will be substrings.
For containers acceptable answers will be... | deutscheflash.py | force_console_input | n-Holmes/deutscheflash | python | def force_console_input(query: str, allowable, onfail: str='Input not recognised, please try again.\n', case_sensitive=False):
'Get an input from the user matching some string in allowable.\n\n Args:\n query (str): The query to issue the user with.\n allowable (str or container): The options which ... |
def get_languages():
'Gets the language: genders dictionary.'
with open('genders.json', 'r') as f:
return json.loads(f.read()) | -1,632,231,346,404,707,800 | Gets the language: genders dictionary. | deutscheflash.py | get_languages | n-Holmes/deutscheflash | python | def get_languages():
with open('genders.json', 'r') as f:
return json.loads(f.read()) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.