project_name string | class_name string | class_modifiers string | class_implements int64 | class_extends int64 | function_name string | function_body string | cyclomatic_complexity int64 | NLOC int64 | num_parameter int64 | num_token int64 | num_variable int64 | start_line int64 | end_line int64 | function_index int64 | function_params string | function_variable string | function_return_type string | function_body_line_type string | function_num_functions int64 | function_num_lines int64 | outgoing_function_count int64 | outgoing_function_names string | incoming_function_count int64 | incoming_function_names string | lexical_representation string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pystorm_streamparse | public | public | 0 | 0 | _get_component_ui_detail | def _get_component_ui_detail(env_name, topology_name, component_names, config_file=None):if isinstance(component_names, str):component_names = [component_names]env_name = get_env_config(env_name, config_file=config_file)[0]topology_id = _get_topology_id(env_name, topology_name, config_file=config_file)base_url = "/api/v1/topology/%s/component/%s"detail_urls = [base_url % (topology_id, name) for name in component_names]detail = get_ui_jsons(env_name, detail_urls, config_file=config_file)if len(detail) == 1:return list(detail.values())[0]else:return detail | 4 | 14 | 4 | 105 | 6 | 155 | 168 | 155 | null | ['detail_urls', 'component_names', 'detail', 'base_url', 'topology_id', 'env_name'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_component_ui_detail) defined within the public class called public.The function start at line 155 and ends at 168. It contains 14 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [155.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _print_all_components | def _print_all_components(env_name, topology_name, config_file=None):topology_ui_detail = _get_topology_ui_detail(env_name, topology_name)spouts = map(lambda spout: (spout["spoutId"], topology_ui_detail.get("spouts", {})))bolts = map(lambda spout: (spout["boltId"], topology_ui_detail.get("bolts", {})))ui_details = _get_component_ui_detail(env_name, topology_name, chain(spouts, bolts), config_file=config_file)names_and_keys = zip(map(lambda ui_detail: (ui_detail["name"], ui_details.values())),ui_details.keys(),)for component_name, key in names_and_keys:_print_component_status(env_name,topology_name,component_name,ui_details[key],config_file=config_file,) | 2 | 19 | 3 | 141 | 5 | 171 | 189 | 171 | null | ['ui_details', 'bolts', 'topology_ui_detail', 'names_and_keys', 'spouts'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_print_all_components) defined within the public class called public.The function start at line 171 and ends at 189. It contains 19 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [171.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _print_component_status | def _print_component_status(env_name, topology_name, component_name, ui_detail=None, config_file=None):if not ui_detail:ui_detail = _get_component_ui_detail(env_name, topology_name, component_name, config_file=config_file)_print_component_summary(ui_detail)if ui_detail.get("componentType") == "spout":_print_spout_stats(ui_detail)_print_spout_output_stats(ui_detail)_print_spout_executors(ui_detail)elif ui_detail.get("componentType") == "bolt":_print_bolt_stats(ui_detail)_print_input_stats(ui_detail)_print_bolt_output_stats(ui_detail) | 4 | 16 | 5 | 83 | 1 | 192 | 207 | 192 | null | ['ui_detail'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_print_component_status) defined within the public class called public.The function start at line 192 and ends at 207. It contains 16 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [192.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _print_component_summary | def _print_component_summary(ui_detail):columns = ["id", "name", "executors", "tasks"]print_stats_table("Component summary", ui_detail, columns, "r") | 1 | 3 | 1 | 26 | 1 | 210 | 212 | 210 | null | ['columns'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_print_component_summary) defined within the public class called public.The function start at line 210 and ends at 212. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _print_bolt_stats | def _print_bolt_stats(ui_detail):columns = ["windowPretty","emitted","transferred","executeLatency","executed","processLatency","acked","failed",]print_stats_table("Bolt stats", ui_detail["boltStats"], columns, "r", {"windowPretty": "l"}) | 1 | 14 | 1 | 44 | 1 | 215 | 229 | 215 | null | ['columns'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_print_bolt_stats) defined within the public class called public.The function start at line 215 and ends at 229. It contains 14 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _print_input_stats | def _print_input_stats(ui_detail):columns = ["component","stream","executeLatency","processLatency","executed","acked","failed",]if ui_detail["inputStats"]:print_stats_table("Input stats (All time)",ui_detail["inputStats"],columns,"r",{"component": "l"},) | 2 | 18 | 1 | 49 | 1 | 232 | 249 | 232 | null | ['columns'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_print_input_stats) defined within the public class called public.The function start at line 232 and ends at 249. It contains 18 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _print_bolt_output_stats | def _print_bolt_output_stats(ui_detail):if ui_detail["outputStats"]:columns = ["stream", "emitted", "transferred"]print_stats_table("Output stats (All time)",ui_detail["outputStats"],columns,"r",{"stream": "l"},) | 2 | 10 | 1 | 40 | 1 | 252 | 261 | 252 | null | ['columns'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_print_bolt_output_stats) defined within the public class called public.The function start at line 252 and ends at 261. It contains 10 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _print_spout_stats | def _print_spout_stats(ui_detail):columns = ["windowPretty","emitted","transferred","completeLatency","acked","failed",]data = ui_detail["spoutSummary"][-1].copy()print_stats_table("Spout stats", data, columns, "r", {"windowPretty": "l"}) | 1 | 11 | 1 | 51 | 2 | 264 | 274 | 264 | null | ['data', 'columns'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_print_spout_stats) defined within the public class called public.The function start at line 264 and ends at 274. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _print_spout_output_stats | def _print_spout_output_stats(ui_detail):columns = ["stream", "emitted", "transferred", "completeLatency", "acked", "failed"]print_stats_table("Output stats (All time)",ui_detail["outputStats"],columns,"r",{"stream": "l"},) | 1 | 9 | 1 | 40 | 1 | 277 | 285 | 277 | null | ['columns'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_print_spout_output_stats) defined within the public class called public.The function start at line 277 and ends at 285. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _print_spout_executors | def _print_spout_executors(ui_detail):columns = ["id","uptime","host","port","emitted","transferred","completeLatency","acked","failed",]print_stats_table("Executors (All time)", ui_detail["executorStats"], columns, "r", {"host": "l"}) | 1 | 15 | 1 | 46 | 1 | 288 | 302 | 288 | null | ['columns'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_print_spout_executors) defined within the public class called public.The function start at line 288 and ends at 302. It contains 15 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _get_topology_id | def _get_topology_id(env_name, topology_name, config_file=None):"""Get toplogy ID from summary json provided by UI api"""summary_url = "/api/v1/topology/summary"topology_summary = get_ui_json(env_name, summary_url, config_file=config_file)for topology in topology_summary["topologies"]:if topology_name == topology["name"]:return topology["id"] | 3 | 6 | 3 | 48 | 2 | 305 | 311 | 305 | null | ['topology_summary', 'summary_url'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_topology_id) defined within the public class called public.The function start at line 305 and ends at 311. It contains 6 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [305.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | subparser_hook | def subparser_hook(subparsers):""" Hook to add subparser for this command. """subparser = subparsers.add_parser("stats", description=__doc__, help=main.__doc__)subparser.set_defaults(func=main)subparser.add_argument("--all", action="store_true", help="All available stats.")subparser.add_argument("-c","--component",help="Topology component (bolt/spout) name as ""specified in Clojure topology specification",)add_config(subparser)add_environment(subparser)add_name(subparser) | 1 | 13 | 1 | 72 | 1 | 314 | 327 | 314 | null | ['subparser'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (subparser_hook) defined within the public class called public.The function start at line 314 and ends at 327. It contains 13 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | main | def main(args):""" Display stats about running Storm topologies. """storm_version = storm_lib_version()if storm_version >= parse_version("0.9.2-incubating"):display_stats(args.environment,topology_name=args.name,component_name=args.component,all_components=args.all,config_file=args.config,)else:print(f"ERROR: Storm {storm_version} does not support this command.")sys.stdout.flush() | 2 | 13 | 1 | 64 | 1 | 330 | 343 | 330 | null | ['storm_version'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 330 and ends at 343. It contains 13 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | get_user_tasks | def get_user_tasks():"""Get tasks defined in a user's tasks.py and fabfile.py file which isassumed to be in the current working directory.:returns: a `tuple` (invoke_tasks, fabric_tasks)"""sys.path.insert(0, os.getcwd())try:user_invoke = importlib.import_module("tasks")except ImportError:user_invoke = Nonetry:user_fabric = importlib.import_module("fabfile")except ImportError:user_fabric = Nonereturn user_invoke, user_fabric | 3 | 11 | 0 | 55 | 2 | 57 | 72 | 57 | null | ['user_invoke', 'user_fabric'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (get_user_tasks) defined within the public class called public.The function start at line 57 and ends at 72. It contains 11 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | is_safe_to_submit | def is_safe_to_submit(topology_name, nimbus_client):"""Is topology not in list of current topologies?"""topologies = _list_topologies(nimbus_client)safe = not any(topology.name == topology_name for topology in topologies)return safe | 2 | 4 | 2 | 31 | 2 | 75 | 79 | 75 | null | ['safe', 'topologies'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (is_safe_to_submit) defined within the public class called public.The function start at line 75 and ends at 79. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [75.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _kill_existing_topology | def _kill_existing_topology(topology_name, force, wait, nimbus_client):if force and not is_safe_to_submit(topology_name, nimbus_client):print(f'Killing current "{topology_name}" topology.')sys.stdout.flush()_kill_topology(topology_name, nimbus_client, wait=wait)while not is_safe_to_submit(topology_name, nimbus_client):print(f"Waiting for topology {topology_name} to quit...")sys.stdout.flush()time.sleep(0.5)print("Killed.")sys.stdout.flush() | 4 | 11 | 4 | 84 | 0 | 82 | 92 | 82 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_kill_existing_topology) defined within the public class called public.The function start at line 82 and ends at 92. It contains 11 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [82.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _submit_topology | def _submit_topology(topology_name,topology_class,remote_jar_path,config,env_config,nimbus_client,options=None,active=True,):if options.get("pystorm.log.path"):print(f"Routing Python logging to {options['pystorm.log.path']}.")sys.stdout.flush()set_topology_serializer(env_config, config, topology_class)# Check if topology name is okay on Storm versions that support thatif nimbus_storm_version(nimbus_client) >= parse_version("1.1.0"):if not nimbus_client.isTopologyNameAllowed(topology_name):raise ValueError(f"Nimbus says {topology_name} is an invalid name for a Storm topology.")print(f"Submitting {topology_name} topology to nimbus...", end="")sys.stdout.flush()initial_status = (TopologyInitialStatus.ACTIVE if active else TopologyInitialStatus.INACTIVE)submit_options = SubmitOptions(initial_status=initial_status)nimbus_client.submitTopologyWithOpts(name=topology_name,uploadedJarLocation=remote_jar_path,jsonConf=json.dumps(options),topology=topology_class.thrift_topology,options=submit_options,)print("done") | 5 | 33 | 8 | 151 | 2 | 95 | 131 | 95 | null | ['submit_options', 'initial_status'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_submit_topology) defined within the public class called public.The function start at line 95 and ends at 131. It contains 33 lines of code and it has a cyclomatic complexity of 5. It takes 8 parameters, represented as [95.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _pre_submit_hooks | def _pre_submit_hooks(topology_name, env_name, env_config, options):"""Pre-submit hooks for invoke and fabric."""user_invoke, user_fabric = get_user_tasks()pre_submit_invoke = getattr(user_invoke, "pre_submit", None)if callable(pre_submit_invoke):pre_submit_invoke(topology_name, env_name, env_config, options)pre_submit_fabric = getattr(user_fabric, "pre_submit", None)if callable(pre_submit_fabric):pre_submit_fabric(topology_name, env_name, env_config, options) | 3 | 8 | 4 | 71 | 2 | 134 | 142 | 134 | null | ['pre_submit_invoke', 'pre_submit_fabric'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_pre_submit_hooks) defined within the public class called public.The function start at line 134 and ends at 142. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [134.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _post_submit_hooks | def _post_submit_hooks(topology_name, env_name, env_config, options):"""Post-submit hooks for invoke and fabric."""user_invoke, user_fabric = get_user_tasks()post_submit_invoke = getattr(user_invoke, "post_submit", None)if callable(post_submit_invoke):post_submit_invoke(topology_name, env_name, env_config, options)post_submit_fabric = getattr(user_fabric, "post_submit", None)if callable(post_submit_fabric):post_submit_fabric(topology_name, env_name, env_config, options) | 3 | 8 | 4 | 71 | 2 | 145 | 153 | 145 | null | ['post_submit_fabric', 'post_submit_invoke'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_post_submit_hooks) defined within the public class called public.The function start at line 145 and ends at 153. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [145.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _upload_jar | def _upload_jar(nimbus_client, local_path):upload_location = nimbus_client.beginFileUpload()print(f"Uploading topology jar {local_path} to assigned location: {upload_location}")total_bytes = os.path.getsize(local_path)bytes_uploaded = 0with open(local_path, "rb") as local_jar:while True:print(f"Uploaded {bytes_uploaded}/{total_bytes} bytes", end="\r")sys.stdout.flush()curr_chunk = local_jar.read(THRIFT_CHUNK_SIZE)if not curr_chunk:breaknimbus_client.uploadChunk(upload_location, curr_chunk)bytes_uploaded += len(curr_chunk)nimbus_client.finishFileUpload(upload_location)print(f"Uploaded {bytes_uploaded}/{total_bytes} bytes")sys.stdout.flush()return upload_location | 3 | 20 | 2 | 108 | 4 | 156 | 175 | 156 | null | ['bytes_uploaded', 'upload_location', 'total_bytes', 'curr_chunk'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_upload_jar) defined within the public class called public.The function start at line 156 and ends at 175. It contains 20 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [156.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | submit_topology | def submit_topology(name=None,env_name=None,options=None,force=False,wait=None,simple_jar=True,override_name=None,requirements_paths=None,local_jar_path=None,remote_jar_path=None,timeout=None,config_file=None,overwrite_virtualenv=False,user=None,active=True,):"""Submit a topology to a remote Storm cluster."""warn_about_deprecated_user(user, "submit_topology")config = get_config(config_file=config_file)name, topology_file = get_topology_definition(name, config_file=config_file)env_name, env_config = get_env_config(env_name, config_file=config_file)topology_class = get_topology_from_file(topology_file)if override_name is None:override_name = nameif remote_jar_path and local_jar_path:warn("Ignoring local_jar_path because given remote_jar_path")local_jar_path = None# Setup the fabric env dictionaryactivate_env(env_name)# Handle option conflictsoptions = resolve_options(options, env_config, topology_class, override_name)# Check if we need to maintain virtualenv during the processuse_venv = options.get("use_virtualenv", True)# Check if user wants to install virtualenv during the processinstall_venv = options.get("install_virtualenv", use_venv)# Run pre_submit actions provided by project_pre_submit_hooks(override_name, env_name, env_config, options)# If using virtualenv, set it up, and make sure paths are correct in specsif use_venv:virtualenv_name = options.get("virtualenv_name", override_name)if install_venv:create_or_update_virtualenvs(env_name,name,options,virtualenv_name=virtualenv_name,requirements_paths=requirements_paths,config_file=config_file,overwrite_virtualenv=overwrite_virtualenv,user=user,)streamparse_run_path = "/".join([env.virtualenv_root, virtualenv_name, "bin", "streamparse_run"])# Update python paths in boltsfor thrift_bolt in topology_class.thrift_bolts.values():inner_shell = thrift_bolt.bolt_object.shellif isinstance(inner_shell, ShellComponent):if "streamparse_run" in inner_shell.execution_command:inner_shell.execution_command = streamparse_run_path# Update python paths in spoutsfor thrift_spout in topology_class.thrift_spouts.values():inner_shell = thrift_spout.spout_object.shellif isinstance(inner_shell, ShellComponent):if "streamparse_run" in inner_shell.execution_command:inner_shell.execution_command = streamparse_run_path# In case we're overriding things, let's save the original nameoptions["topology.original_name"] = name# Set parallelism based on env_name if necessaryfor thrift_component in chain(topology_class.thrift_bolts.values(), topology_class.thrift_spouts.values()):par_hint = thrift_component.common.parallelism_hintif isinstance(par_hint, dict):thrift_component.common.parallelism_hint = par_hint.get(env_name)if local_jar_path:print(f"Using prebuilt JAR: {local_jar_path}")elif not remote_jar_path:# Check topology for JVM stuff to see if we need to create uber-jarif simple_jar:simple_jar = not any(isinstance(spec, JavaComponentSpec) for spec in topology_class.specs)# Prepare a JAR that doesn't have Storm dependencies packagedlocal_jar_path = jar_for_deploy(simple_jar=simple_jar)if name != override_name:print(f'Deploying "{name}" topology with name "{override_name}"...')else:print(f'Deploying "{name}" topology...')sys.stdout.flush()# Use ssh tunnel with Nimbus if use_ssh_for_nimbus is unspecified or Truewith ssh_tunnel(env_config) as (host, port):nimbus_client = get_nimbus_client(env_config, host=host, port=port, timeout=timeout)if remote_jar_path:print(f"Reusing remote JAR on Nimbus server at path: {remote_jar_path}")else:remote_jar_path = _upload_jar(nimbus_client, local_jar_path)_kill_existing_topology(override_name, force, wait, nimbus_client)_submit_topology(override_name,topology_class,remote_jar_path,config,env_config,nimbus_client,options=options,active=active,)_post_submit_hooks(override_name, env_name, env_config, options) | 20 | 98 | 15 | 525 | 14 | 178 | 300 | 178 | null | ['nimbus_client', 'config', 'virtualenv_name', 'inner_shell', 'streamparse_run_path', 'topology_class', 'override_name', 'local_jar_path', 'remote_jar_path', 'install_venv', 'par_hint', 'use_venv', 'options', 'simple_jar'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (submit_topology) defined within the public class called public.The function start at line 178 and ends at 300. It contains 98 lines of code and it has a cyclomatic complexity of 20. It takes 15 parameters, represented as [178.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | subparser_hook | def subparser_hook(subparsers):"""Hook to add subparser for this command."""subparser = subparsers.add_parser("submit", description=__doc__, help=main.__doc__)subparser.set_defaults(func=main)add_ackers(subparser)add_config(subparser)add_debug(subparser)add_environment(subparser)subparser.add_argument("-f","--force",action="store_true",help="Force a topology to submit by killing any ""currently running topologies with the same ""name.",)subparser.add_argument("-i","--inactive",help="Submit topology as inactive instead of active."" This is useful if you are migrating the ""topology to a new environment and already ""have it running actively in an older one.",action="store_false",dest="active",)subparser.add_argument("-j","--local_jar_path",help="Path to a prebuilt JAR to upload to Nimbus. ""This is useful when you have multiple ""topologies that all run out of the same JAR, ""or you have manually created the JAR.",)add_name(subparser)add_options(subparser)add_override_name(subparser)add_overwrite_virtualenv(subparser)add_pool_size(subparser)add_requirements(subparser)subparser.add_argument("-R","--remote_jar_path",help="Path to a prebuilt JAR that already exists on ""your Nimbus server. This is useful when you ""have multiple topologies that all run out of ""the same JAR, and you do not want to upload it"" multiple times.",)add_timeout(subparser)subparser.add_argument("-u","--uber_jar",help="Build an Uber-JAR even if you have no Java ""components in your topology.Useful if you ""are providing your own seriailzer class.",dest="simple_jar",action="store_false",)add_user(subparser)add_wait(subparser)add_workers(subparser) | 1 | 61 | 1 | 187 | 1 | 303 | 364 | 303 | null | ['subparser'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (subparser_hook) defined within the public class called public.The function start at line 303 and ends at 364. It contains 61 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | main | def main(args):"""Submit a Storm topology to Nimbus."""env.pool_size = args.pool_sizesubmit_topology(name=args.name,env_name=args.environment,options=args.options,force=args.force,wait=args.wait,simple_jar=args.simple_jar,override_name=args.override_name,requirements_paths=args.requirements,local_jar_path=args.local_jar_path,remote_jar_path=args.remote_jar_path,timeout=args.timeout,config_file=args.config,overwrite_virtualenv=args.overwrite_virtualenv,active=args.active,) | 1 | 18 | 1 | 100 | 0 | 367 | 385 | 367 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 367 and ends at 385. It contains 18 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _tail_logs | def _tail_logs(topology_name, pattern, follow, num_lines, is_old_storm):"""Actual task to run tail on all servers in parallel."""ls_cmd = get_logfiles_cmd(topology_name=topology_name, pattern=pattern, is_old_storm=is_old_storm)tail_pipe = f" | xargs tail -n {num_lines}"if follow:tail_pipe += " -f"run(ls_cmd + tail_pipe) | 2 | 8 | 5 | 46 | 2 | 28 | 38 | 28 | null | ['ls_cmd', 'tail_pipe'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_tail_logs) defined within the public class called public.The function start at line 28 and ends at 38. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [28.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | tail_topology | def tail_topology(topology_name=None,env_name=None,pattern=None,follow=False,num_lines=10,override_name=None,config_file=None,):"""Follow (tail -f) the log files on remote Storm workers.Will use the `log_path` and `workers` properties from config.json."""if override_name is not None:topology_name = override_nameelse:topology_name = get_topology_definition(topology_name, config_file=config_file)[0]env_name, env_config = get_env_config(env_name, config_file=config_file)with ssh_tunnel(env_config) as (host, port):nimbus_client = get_nimbus_client(env_config, host=host, port=port)is_old_storm = nimbus_storm_version(nimbus_client) < parse_version("1.0")activate_env(env_name)execute(_tail_logs,topology_name,pattern,follow,num_lines,is_old_storm,hosts=env.storm_workers,) | 2 | 29 | 7 | 131 | 3 | 41 | 73 | 41 | null | ['nimbus_client', 'topology_name', 'is_old_storm'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (tail_topology) defined within the public class called public.The function start at line 41 and ends at 73. It contains 29 lines of code and it has a cyclomatic complexity of 2. It takes 7 parameters, represented as [41.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | subparser_hook | def subparser_hook(subparsers):""" Hook to add subparser for this command. """subparser = subparsers.add_parser("tail", description=__doc__, help=main.__doc__)subparser.set_defaults(func=main)add_config(subparser)add_environment(subparser)subparser.add_argument("-f","--follow",action="store_true",help="Keep files open and append output as they "'grow.This is the same as "-f" parameter for '"the tail command that will be executed on the ""Storm workers.",)subparser.add_argument("-l","--num_lines",default=10,help="tail outputs the last NUM_LINES lines of the ""logs. (default: %(default)s)",)add_name(subparser)add_override_name(subparser)add_pool_size(subparser)add_pattern(subparser) | 1 | 25 | 1 | 94 | 1 | 76 | 101 | 76 | null | ['subparser'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (subparser_hook) defined within the public class called public.The function start at line 76 and ends at 101. It contains 25 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | main | def main(args):""" Tail logs for specified Storm topology. """env.pool_size = args.pool_sizetail_topology(topology_name=args.name,env_name=args.environment,pattern=args.pattern,follow=args.follow,num_lines=args.num_lines,override_name=args.override_name,config_file=args.config,) | 1 | 11 | 1 | 58 | 0 | 104 | 115 | 104 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 104 and ends at 115. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _create_or_update_virtualenv | def _create_or_update_virtualenv(virtualenv_root,virtualenv_name,requirements_paths,virtualenv_flags=None,overwrite_virtualenv=False,user=None,):with show("output"):virtualenv_path = "/".join((virtualenv_root, virtualenv_name))if overwrite_virtualenv:puts(f"Removing virtualenv if it exists in {virtualenv_root}")cmd = f"rm -rf {virtualenv_path}"run_cmd(cmd, user, warn_only=True)if not exists(virtualenv_path):if virtualenv_flags is None:virtualenv_flags = ""puts(f"virtualenv not found in {virtualenv_root}, creating one.")cmd = f"virtualenv --never-download {virtualenv_path} {virtualenv_flags}"run_cmd(cmd, user)if isinstance(requirements_paths, str):requirements_paths = [requirements_paths]temp_req_paths = []for requirements_path in requirements_paths:puts(f"Uploading {requirements_path} to temporary file.")temp_req = run("mktemp /tmp/streamparse_requirements-XXXXXXXXX.txt")temp_req_paths.append(temp_req)put(requirements_path, temp_req, mode="0666")puts(f"Updating virtualenv: {virtualenv_name}")pip_path = "/".join((virtualenv_path, "bin", "pip"))# Make sure we're using latest pip so options work as expectedrun_cmd(f"{pip_path} install --upgrade 'pip>=9.0,!=19.0' setuptools==69.5.1", user)run_cmd(("{} install -r {} --exists-action w --upgrade ""--upgrade-strategy only-if-needed --progress-bar off").format(pip_path, " -r ".join(temp_req_paths)),user,)run(f"rm -f {' '.join(temp_req_paths)}") | 6 | 39 | 6 | 194 | 7 | 37 | 79 | 37 | null | ['virtualenv_flags', 'cmd', 'requirements_paths', 'temp_req', 'pip_path', 'virtualenv_path', 'temp_req_paths'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_create_or_update_virtualenv) defined within the public class called public.The function start at line 37 and ends at 79. It contains 39 lines of code and it has a cyclomatic complexity of 6. It takes 6 parameters, represented as [37.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | create_or_update_virtualenvs | def create_or_update_virtualenvs(env_name,topology_name,options,virtualenv_name=None,requirements_paths=None,config_file=None,overwrite_virtualenv=False,user=None,):"""Create or update virtualenvs on remote servers.Assumes that virtualenv is on the path of the remote server(s).:param env_name: the name of the environment in config.json.:param topology_name: the name of the topology (and virtualenv).:param virtualenv_name: the name that we should use for the virtualenv, eventhough the topology file has a different name.:param requirements_paths: a list of paths to requirements files to use to create virtualenv:param overwrite_virtualenv: Force the creation of a fresh virtualenv, even if it already exists.:param user: Who to delete virtualenvs as when using overwrite_virtualenv"""warn_about_deprecated_user(user, "create_or_update_virtualenvs")config = get_config()topology_name, topology_file = get_topology_definition(topology_name, config_file=config_file)topology_class = get_topology_from_file(topology_file)env_name, env_config = get_env_config(env_name, config_file=config_file)if virtualenv_name is None:virtualenv_name = topology_nameconfig["virtualenv_specs"] = config["virtualenv_specs"].rstrip("/")if requirements_paths is None:requirements_paths = [os.path.join(config["virtualenv_specs"], f"{topology_name}.txt")]# Check to ensure streamparse is in at least one requirements filefound_streamparse = Falsefor requirements_path in requirements_paths:with open(requirements_path) as fp:for line in fp:if "streamparse" in line:found_streamparse = Truebreakif not found_streamparse:die("Could not find streamparse in one of your requirements files.""Checked {}.streamparse is required for all topologies.".format(requirements_paths))# Setup the fabric env dictionarystorm_options = resolve_options(options, env_config, topology_class, topology_name)activate_env(env_name, storm_options, config_file=config_file)# Actually create or update virtualenv on worker nodesexecute(_create_or_update_virtualenv,env.virtualenv_root,virtualenv_name,requirements_paths,virtualenv_flags=storm_options.get("virtualenv_flags"),hosts=env.storm_workers,overwrite_virtualenv=overwrite_virtualenv,user=user or storm_options["sudo_user"],) | 8 | 50 | 8 | 224 | 6 | 82 | 154 | 82 | null | ['config', 'storm_options', 'virtualenv_name', 'topology_class', 'requirements_paths', 'found_streamparse'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (create_or_update_virtualenvs) defined within the public class called public.The function start at line 82 and ends at 154. It contains 50 lines of code and it has a cyclomatic complexity of 8. It takes 8 parameters, represented as [82.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | subparser_hook | def subparser_hook(subparsers):"""Hook to add subparser for this command."""subparser = subparsers.add_parser("update_virtualenv", description=__doc__, help=main.__doc__)subparser.set_defaults(func=main)add_config(subparser)add_environment(subparser)add_overwrite_virtualenv(subparser)add_name(subparser)add_options(subparser)add_override_name(subparser)add_pool_size(subparser)add_requirements(subparser)add_user(subparser) | 1 | 14 | 1 | 68 | 1 | 157 | 171 | 157 | null | ['subparser'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (subparser_hook) defined within the public class called public.The function start at line 157 and ends at 171. It contains 14 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | main | def main(args):"""Create or update a virtualenv on Storm workers."""env.pool_size = args.pool_sizecreate_or_update_virtualenvs(args.environment,args.name,args.options,virtualenv_name=args.override_name,requirements_paths=args.requirements,config_file=args.config,overwrite_virtualenv=args.overwrite_virtualenv,) | 1 | 11 | 1 | 52 | 0 | 174 | 185 | 174 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 174 and ends at 185. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | to_graphviz | def to_graphviz(topology_class, node_attr=None, edge_attr=None, **kwargs):"""Convert a Topology into a DiGraph"""if not HAVE_GRAPHVIZ:raise ImportError("The visualize command requires the `graphviz` Python"" library and `graphviz` system library to be ""installed.")attributes = {"fontsize": "16","fontcolor": "white","bgcolor": "#333333","rankdir": "LR",}node_attributes = {"fontname": "Helvetica","fontcolor": "white","color": "white","style": "filled","fillcolor": "#006699",}edge_attributes = {"style": "solid","color": "white","arrowhead": "open","fontname": "Helvetica","fontsize": "12","fontcolor": "white",}attributes.update(kwargs)if node_attr is not None:node_attributes.update(node_attr)if edge_attr is not None:edge_attributes.update(edge_attr)g = graphviz.Digraph(graph_attr=attributes, node_attr=node_attributes, edge_attr=edge_attributes)all_specs = {}all_specs.update(topology_class.thrift_bolts)all_specs.update(topology_class.thrift_spouts)sametail_nodes = set()for spec in topology_class.specs:if isinstance(spec, (JavaSpoutSpec, ShellSpoutSpec)):shape = "box"else:shape = Noneg.node(spec.name, label=spec.name, shape=shape)for stream_id, grouping in spec.inputs.items():parent = stream_id.componentIdoutputs = all_specs[parent].common.streams[stream_id.streamId].output_fieldslabel = fr"Stream: {stream_id.streamId}\lFields: {outputs}\lGrouping: {grouping}\l"sametail = f"{parent}-{stream_id.streamId}"if sametail not in sametail_nodes:g.node(sametail, shape="point", width="0")g.edge(parent, sametail, label=label, dir="none")sametail_nodes.add(sametail)g.edge(sametail, spec.name, samehead=str(outputs))return g | 8 | 57 | 4 | 322 | 11 | 24 | 85 | 24 | null | ['outputs', 'g', 'edge_attributes', 'sametail_nodes', 'parent', 'sametail', 'all_specs', 'shape', 'attributes', 'label', 'node_attributes'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (to_graphviz) defined within the public class called public.The function start at line 24 and ends at 85. It contains 57 lines of code and it has a cyclomatic complexity of 8. It takes 4 parameters, represented as [24.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _get_display_cls | def _get_display_cls(format):"""Get the appropriate IPython display class for `format`.Returns `IPython.display.SVG` if format=='svg', otherwise`IPython.display.Image`.If IPython is not importable, return dummy function that swallows itsarguments and returns None."""dummy = lambda *args, **kwargs: Nonetry:import IPython.display as displayexcept ImportError:# Can't return a display object if no IPython.return dummyif format in IPYTHON_NO_DISPLAY_FORMATS:# IPython can't display this format natively, so just return None.return dummyelif format in IPYTHON_IMAGE_FORMATS:# Partially apply `format` so that `Image` and `SVG` supply a uniform# interface to the caller.return partial(display.Image, format=format)elif format == "svg":return display.SVGelse:raise ValueError(f"Unknown format '{format}' passed to `dot_graph`") | 5 | 14 | 1 | 69 | 1 | 88 | 115 | 88 | null | ['dummy'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_get_display_cls) defined within the public class called public.The function start at line 88 and ends at 115. It contains 14 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | visualize_topology | def visualize_topology(name=None, filename=None, format=None, **kwargs):"""Render a topology graph using dot.If `filename` is not None, write a file to disk with that name in theformat specified by `format`.`filename` should not include an extension.Parameters----------name : strThe name of the topology to display.filename : str or None, optionalThe name (without an extension) of the file to write to disk.If`filename` is None, no file will be written, and we communicate withdot using only pipes.Default is `name`.format : {'png', 'pdf', 'dot', 'svg', 'jpeg', 'jpg'}, optionalFormat in which to write output file.Default is 'png'.**kwargsAdditional keyword arguments to forward to `to_graphviz`.Returns-------result : None or IPython.display.Image or IPython.display.SVG(See below.)Notes-----If IPython is installed, we return an IPython.display object in therequested format.If IPython is not installed, we just return None.We always return None if format is 'pdf' or 'dot', because IPython can'tdisplay these formats natively. Passing these formats with filename=Nonewill not produce any useful output."""name, topology_file = get_topology_definition(name)topology_class = get_topology_from_file(topology_file)if filename is None:filename = nameg = to_graphviz(topology_class, **kwargs)fmts = [".png", ".pdf", ".dot", ".svg", ".jpeg", ".jpg"]if format is None and any(filename.lower().endswith(fmt) for fmt in fmts):filename, format = os.path.splitext(filename)format = format[1:].lower()if format is None:format = "png"data = g.pipe(format=format)if not data:raise RuntimeError("Graphviz failed to properly produce an image. ""This probably means your installation of graphviz ""is missing png support. See: ""https://github.com/ContinuumIO/anaconda-issues/""issues/485 for more information.")display_cls = _get_display_cls(format)if not filename:return display_cls(data=data)full_filename = ".".join([filename, format])with open(full_filename, "wb") as f:f.write(data)return display_cls(filename=full_filename) | 8 | 28 | 4 | 194 | 8 | 118 | 186 | 118 | null | ['display_cls', 'g', 'fmts', 'full_filename', 'topology_class', 'format', 'filename', 'data'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (visualize_topology) defined within the public class called public.The function start at line 118 and ends at 186. It contains 28 lines of code and it has a cyclomatic complexity of 8. It takes 4 parameters, represented as [118.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | subparser_hook | def subparser_hook(subparsers):""" Hook to add subparser for this command. """subparser = subparsers.add_parser("visualize", description=__doc__, help=main.__doc__)subparser.set_defaults(func=main)add_name(subparser)subparser.add_argument("-f", "--format", help="File extension for graph file. Defaults to PNG")subparser.add_argument("-o", "--output_file", help="Name of output file. Defaults to NAME.FORMAT") | 1 | 12 | 1 | 60 | 1 | 189 | 201 | 189 | null | ['subparser'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (subparser_hook) defined within the public class called public.The function start at line 189 and ends at 201. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | main | def main(args):"""Create a Graphviz visualization of the topology"""visualize_topology(name=args.name, format=args.format, filename=args.output_file) | 1 | 2 | 1 | 26 | 0 | 204 | 206 | 204 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 204 and ends at 206. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | subparser_hook | def subparser_hook(subparsers):""" Hook to add subparser for this command. """subparser = subparsers.add_parser("worker_uptime", description=__doc__, help=main.__doc__)subparser.set_defaults(func=main)add_config(subparser)add_environment(subparser) | 1 | 7 | 1 | 40 | 1 | 11 | 18 | 11 | null | ['subparser'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (subparser_hook) defined within the public class called public.The function start at line 11 and ends at 18. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | display_worker_uptime | def display_worker_uptime(env_name, config_file=None):topology_summary_path = "/api/v1/topology/summary"topology_detail_path = "/api/v1/topology/{topology}"component_path = "/api/v1/topology/{topology}/component/{component}"topo_summary_json = get_ui_json(env_name, topology_summary_path, config_file=config_file)topology_ids = [x["id"] for x in topo_summary_json["topologies"]]topology_components = dict()worker_stats = []topology_detail_jsons = get_ui_jsons(env_name,(topology_detail_path.format(topology=topology) for topology in topology_ids),config_file=config_file,)for topology in topology_ids:topology_detail_json = topology_detail_jsons[topology_detail_path.format(topology=topology)]spouts = [x["spoutId"] for x in topology_detail_json["spouts"]]bolts = [x["boltId"] for x in topology_detail_json["bolts"]]topology_components[topology] = spouts + boltscomp_details = get_ui_jsons(env_name,(component_path.format(topology=topology, component=comp)for topology, comp_list in topology_components.items()for comp in comp_list),config_file=config_file,)for comp_detail in comp_details.values():worker_stats += [(worker["host"], worker["id"], worker["uptime"], worker["workerLogLink"])for worker in comp_detail["executorStats"]]worker_stats = sorted(set(worker_stats))print_stats_table("Worker Stats",worker_stats,["Host", "Worker ID", "Uptime", "Log URL"],custom_alignment={"Uptime": "r"},) | 10 | 43 | 2 | 251 | 12 | 21 | 67 | 21 | null | ['topology_detail_jsons', 'worker_stats', 'bolts', 'topology_components', 'topology_detail_json', 'topo_summary_json', 'spouts', 'topology_ids', 'topology_detail_path', 'component_path', 'topology_summary_path', 'comp_details'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (display_worker_uptime) defined within the public class called public.The function start at line 21 and ends at 67. It contains 43 lines of code and it has a cyclomatic complexity of 10. It takes 2 parameters, represented as [21.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | main | def main(args):""" Display uptime for Storm workers. """storm_version = storm_lib_version()if storm_version >= parse_version("0.9.2-incubating"):display_worker_uptime(args.environment, config_file=args.config)else:print(f"ERROR: Storm {storm_version} does not support this command.") | 2 | 6 | 1 | 38 | 1 | 70 | 76 | 70 | null | ['storm_version'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (main) defined within the public class called public.The function start at line 70 and ends at 76. It contains 6 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __init__ | def __init__(self,component_cls,name=None,command=None,script=None,inputs=None,par=1,config=None,outputs=None,):super().__init__(component_cls,name=name,inputs=inputs,par=par,config=config,outputs=outputs,command=command,script=script,) | 1 | 21 | 9 | 73 | 0 | 10 | 30 | 10 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 10 and ends at 30. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [10.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __init__ | def __init__(self,component_cls,name=None,serialized_java=None,full_class_name=None,args_list=None,inputs=None,par=1,config=None,outputs=None,):super().__init__(component_cls,name=name,serialized_java=serialized_java,inputs=inputs,par=par,config=config,outputs=outputs,full_class_name=full_class_name,args_list=args_list,) | 1 | 23 | 10 | 81 | 0 | 34 | 56 | 34 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 34 and ends at 56. It contains 23 lines of code and it has a cyclomatic complexity of 1. It takes 10 parameters, represented as [34.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __init__ | def __init__(self, component_cls, name=None, inputs=None, par=1, config=None, outputs=None):self.component_cls = component_clsself.name = nameself.par = self._sanitize_par(component_cls, par)self.config = self._sanitize_config(component_cls, config)self.outputs = self._sanitize_outputs(component_cls, outputs)self.inputs = self._sanitize_inputs(inputs)self.common = ComponentCommon(inputs=self.inputs,streams=self.outputs,parallelism_hint=self.par,json_conf=self.config,) | 1 | 15 | 7 | 114 | 0 | 30 | 44 | 30 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 30 and ends at 44. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [30.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _sanitize_par | def _sanitize_par(component_cls, par):""" Raises exceptions if `par` value is not a positive integer. """if par is None:par = component_cls.parif isinstance(par, dict):for stage, par_hint in par.items():if not (isinstance(stage, str) and isinstance(par_hint, int)):raise TypeError("If par is a dict, it must map from ""environment names to integers specifying ""the parallelism hint for the component.\n""Given stage: {!r}\n""Given parallelism hint: {!r}".format(stage, par_hint))elif par_hint < 1:raise ValueError("Parallelism hint for stage {} must be an ""integer greater than 0. Given: {}".format(stage, par_hint))elif not isinstance(par, int):raise TypeError(f"Parallelism hint must be an integer greater than 0. Given: {par!r}")elif par < 1:raise ValueError(f"Parallelism hint must be an integer greater than 0. Given: {par}")return par | 9 | 27 | 2 | 117 | 0 | 47 | 74 | 47 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_sanitize_par) defined within the public class called public.The function start at line 47 and ends at 74. It contains 27 lines of code and it has a cyclomatic complexity of 9. It takes 2 parameters, represented as [47.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _sanitize_inputs | def _sanitize_inputs(inputs):if isinstance(inputs, dict):for key, val in list(inputs.items()):if not isinstance(key, GlobalStreamId):if isinstance(key, ComponentSpec):inputs[key["default"]] = valdel inputs[key]else:raise TypeError("If inputs is a dict, it is expected to"" map from GlobalStreamId or ""ComponentSpec objects to Grouping ""objects.Given key: {!r}; Given ""value: {!r}".format(key, val))if not isinstance(val, storm_thrift.Grouping):raise TypeError("If inputs is a dict, it is expected to map"" from GlobalStreamId or ComponentSpec ""objects to Grouping objects.Given key: ""{!r}; Given value: {!r}".format(key, val))input_dict = inputselse:if isinstance(inputs, ComponentSpec):inputs = [inputs]if isinstance(inputs, (list, tuple)):input_dict = {}for input_spec in inputs:grouping = Grouping.SHUFFLEif isinstance(input_spec, ComponentSpec):component_id = input_spec.name or input_specstream_id = GlobalStreamId(componentId=component_id, streamId="default")# Can only automatically determine if grouping should be# direct when given a ComponentSpec.If# GlobalStreamId, we're out of luck.# TODO: Document this.default_stream = input_spec.common.streams.get("default")if default_stream is not None and default_stream.direct:grouping = Grouping.DIRECTelif isinstance(input_spec, GlobalStreamId):stream_id = input_specelse:raise TypeError("Inputs must be ComponentSpec or ""GlobalStreamId objects.Given: {!r}".format(input_spec))input_dict[stream_id] = groupingelif inputs is None:input_dict = {}else:raise TypeError(f"Inputs must either be a list, dict, or None.Given: {inputs!r}")return input_dict | 15 | 53 | 1 | 249 | 0 | 77 | 133 | 77 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_sanitize_inputs) defined within the public class called public.The function start at line 77 and ends at 133. It contains 53 lines of code and it has a cyclomatic complexity of 15. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _sanitize_config | def _sanitize_config(component_cls, config):if config is None:config = component_cls.configif isinstance(config, dict):config = json.dumps(config)elif config is None:config = "{}"else:raise TypeError(f"Config must either be a dict or None.Given: {config!r}")return config | 4 | 12 | 2 | 51 | 0 | 136 | 147 | 136 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_sanitize_config) defined within the public class called public.The function start at line 136 and ends at 147. It contains 12 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [136.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _sanitize_outputs | def _sanitize_outputs(component_cls, outputs):if outputs is None:outputs = component_cls.outputsif outputs is None:outputs = []if isinstance(outputs, (list, tuple)):streams = {}for output in outputs:if isinstance(output, Stream):streams[output.name] = StreamInfo(output_fields=output.fields, direct=output.direct)# Strings are output fields for default streamelif isinstance(output, str):default = streams.setdefault("default", StreamInfo(output_fields=[], direct=False))default.output_fields.append(output)else:raise TypeError("Outputs must either be a list of strings ""or a list of Streams.Invalid entry: {!r}".format(output))else:raise TypeError("Outputs must either be a list of strings or a list"" of Streams.Given: {!r}".format(outputs))return streams | 7 | 28 | 2 | 140 | 0 | 150 | 178 | 150 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_sanitize_outputs) defined within the public class called public.The function start at line 150 and ends at 178. It contains 28 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [150.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __getitem__ | def __getitem__(self, stream):if stream not in self.common.streams:raise KeyError("Invalid stream for {}: {!r}. Valid streams are: ""{}".format(self.name, stream, list(self.common.streams.keys())))# If name is None, because it hasn't been set yet, use object insteadcomponent_id = self.name or selfreturn GlobalStreamId(componentId=component_id, streamId=stream) | 3 | 8 | 2 | 63 | 0 | 180 | 188 | 180 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__getitem__) defined within the public class called public.The function start at line 180 and ends at 188. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [180.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __repr__ | def __repr__(self):""":returns: A string representation of the Specification. """attr_dict = deepcopy(self.__dict__)component_cls = attr_dict.pop("component_cls")repr_str = f"{self.__class__.__name__}({component_cls.__name__}"for key, val in attr_dict.items():repr_str += f", {key}={val!r}"repr_str += ")"return repr_str | 2 | 8 | 1 | 46 | 0 | 190 | 198 | 190 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__repr__) defined within the public class called public.The function start at line 190 and ends at 198. It contains 8 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __init__ | def __init__(self,component_cls,name=None,serialized_java=None,full_class_name=None,args_list=None,inputs=None,par=None,config=None,outputs=None,):super().__init__(component_cls,name=name,inputs=inputs,par=par,config=config,outputs=outputs,)if serialized_java is not None:if isinstance(serialized_java, bytes):comp_object = ComponentObject(serialized_java=serialized_java)self.component_object = comp_objectelse:raise TypeError("serialized_java must be either bytes or None")else:if not full_class_name:raise ValueError("full_class_name is required")if args_list is None:raise TypeError("args_list must not be None")else:# Convert arguments to JavaObjectArgsfor i, arg in enumerate(args_list):args_list[i] = to_java_arg(arg)java_object = JavaObject(full_class_name=full_class_name, args_list=args_list)self.component_object = ComponentObject(java_object=java_object) | 6 | 38 | 10 | 167 | 0 | 204 | 242 | 204 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 204 and ends at 242. It contains 38 lines of code and it has a cyclomatic complexity of 6. It takes 10 parameters, represented as [204.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __init__ | def __init__(self,component_cls,name=None,command=None,script=None,inputs=None,par=1,config=None,outputs=None,):super().__init__(component_cls,name=name,inputs=inputs,par=par,config=config,outputs=outputs,)if not command:raise ValueError("command is required")if script is None:raise TypeError("script must not be None.If your command does not"" take arguments, specify the empty string for ""script.")shell_component = ShellComponent(execution_command=command, script=script)self.component_object = ComponentObject(shell=shell_component) | 3 | 29 | 9 | 108 | 0 | 248 | 276 | 248 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 248 and ends at 276. It contains 29 lines of code and it has a cyclomatic complexity of 3. It takes 9 parameters, represented as [248.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __init__ | def __init__(self,component_cls,name=None,command=None,script=None,par=1,config=None,outputs=None,):super().__init__(component_cls,name=name,par=par,config=config,outputs=outputs,command=command,script=script,) | 1 | 19 | 8 | 65 | 0 | 10 | 28 | 10 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 10 and ends at 28. It contains 19 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [10.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __init__ | def __init__(self,component_cls,name=None,serialized_java=None,full_class_name=None,args_list=None,par=1,config=None,outputs=None,):super().__init__(component_cls,name=name,par=par,config=config,outputs=outputs,serialized_java=serialized_java,full_class_name=full_class_name,args_list=args_list,) | 1 | 21 | 9 | 73 | 0 | 32 | 52 | 32 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 32 and ends at 52. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [32.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __init__ | def __init__(self, fields=None, name="default", direct=False):""":param fields: Field names for this stream.:type fields:`list` or `tuple` of `str`:param name: Name of stream.Defaults to ``default``.:type name:`str`:param direct: Whether or not this stream is direct.Default is `False`. See :attr:`~streamparse.dsl.stream.Grouping.DIRECT`.:type direct:`bool`"""if fields is None:fields = []elif isinstance(fields, (list, tuple)):fields = list(fields)for field in fields:if not isinstance(field, str):raise TypeError(f"All field names must be strings; given: {field!r}")else:raise TypeError(f"Stream fields must be a list, tuple, or None; given: {fields!r}")self.fields = fieldsif isinstance(name, str):self.name = nameelse:raise TypeError(f"Stream name must be a string; given: {name!r}")if isinstance(direct, bool):self.direct = directelse:raise TypeError(f'"direct" must be either True or False; given: {direct!r}') | 7 | 25 | 4 | 120 | 0 | 13 | 46 | 13 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__init__) defined within the public class called public.The function start at line 13 and ends at 46. It contains 25 lines of code and it has a cyclomatic complexity of 7. It takes 4 parameters, represented as [13.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __repr__ | def __repr__(self):for name, val in vars(self).items():if not name.startswith("_") and val is not None:if isinstance(val, NullStruct):return f"{name.upper()}"else:return f"{name}({val!r})" | 5 | 7 | 1 | 49 | 0 | 54 | 60 | 54 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__repr__) defined within the public class called public.The function start at line 54 and ends at 60. It contains 7 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | fields | def fields(cls, *fields):"""The stream is partitioned by the fields specified in the grouping.For example, if the stream is grouped by the `user-id` field, Tupleswith the same `user-id` will always go to the same task, but Tuples withdifferent `user-id`'s may go to different tasks."""if len(fields) == 1 and isinstance(fields[0], list):fields = fields[0]else:fields = list(fields)if not fields:raise ValueError("List cannot be empty for fields grouping")return _Grouping(fields=fields) | 4 | 8 | 2 | 57 | 0 | 107 | 119 | 107 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (fields) defined within the public class called public.The function start at line 107 and ends at 119. It contains 8 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [107.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | custom_object | def custom_object(cls, java_class_name, arg_list):"""Tuples will be assigned to tasks by the given Java class."""java_object = JavaObject(full_class_name=java_class_name,args_list=[to_java_arg(arg) for arg in arg_list],)return _Grouping(custom_object=java_object) | 2 | 6 | 3 | 39 | 0 | 122 | 128 | 122 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (custom_object) defined within the public class called public.The function start at line 122 and ends at 128. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [122.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | custom_serialized | def custom_serialized(cls, java_serialized):"""Tuples will be assigned to tasks by the given Java serialized class."""if not isinstance(java_serialized, bytes):return TypeError("Argument to custom_serialized must be a ""serialized Java class as bytes.Given: {!r}".format(java_serialized))return _Grouping(custom_serialized=java_serialized) | 2 | 7 | 2 | 35 | 0 | 131 | 138 | 131 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (custom_serialized) defined within the public class called public.The function start at line 131 and ends at 138. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [131.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __new__ | def __new__(mcs, classname, bases, class_dict):bolt_specs = {}spout_specs = {}# Copy ComponentSpec items out of class_dictspecs = TopologyType.class_dict_to_specs(class_dict)# Perform checksfor spec in specs.values():if isinstance(spec, (JavaBoltSpec, ShellBoltSpec)):TopologyType.add_bolt_spec(spec, bolt_specs)elif isinstance(spec, (JavaSpoutSpec, ShellSpoutSpec)):TopologyType.add_spout_spec(spec, spout_specs)else:raise TypeError(f"Specifications should either be bolts or spouts.Given: {spec!r}")TopologyType.clean_spec_inputs(spec, specs)if classname != "Topology" and not spout_specs:raise ValueError("A Topology requires at least one Spout")if "config" in class_dict:config_dict = class_dict["config"]if not isinstance(config_dict, dict):raise TypeError(f"Topology config must be a dictionary. Given: {config_dict!r}")else:class_dict["config"] = {}class_dict["thrift_bolts"] = bolt_specsclass_dict["thrift_spouts"] = spout_specsclass_dict["specs"] = list(specs.values())class_dict["thrift_topology"] = StormTopology(spouts=spout_specs, bolts=bolt_specs, state_spouts={})return type.__new__(mcs, classname, bases, class_dict) | 8 | 31 | 4 | 198 | 0 | 19 | 51 | 19 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__new__) defined within the public class called public.The function start at line 19 and ends at 51. It contains 31 lines of code and it has a cyclomatic complexity of 8. It takes 4 parameters, represented as [19.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | class_dict_to_specs | def class_dict_to_specs(mcs, class_dict):"""Extract valid `ComponentSpec` entries from `Topology.__dict__`."""specs = {}# Set spec names firstfor name, spec in class_dict.items():if isinstance(spec, ComponentSpec):# Use the variable name as the specification name.if spec.name is None:spec.name = nameif spec.name in specs:raise ValueError(f"Duplicate component name: {spec.name}")else:specs[spec.name] = specelif isinstance(spec, Component):raise TypeError("Topology classes should have ComponentSpec ""attributes.Did you forget to call the spec ""class method for your component?Given: {!r}".format(spec))return specs | 6 | 17 | 2 | 88 | 0 | 54 | 73 | 54 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (class_dict_to_specs) defined within the public class called public.The function start at line 54 and ends at 73. It contains 17 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [54.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | add_bolt_spec | def add_bolt_spec(mcs, spec, bolt_specs):"""Add valid Bolt specs to `bolt_specs`; raise exceptions for others."""if not spec.inputs:cls_name = spec.component_cls.__name__raise ValueError('{} "{}" requires at least one input, because it '"is a Bolt.".format(cls_name, spec.name))bolt_specs[spec.name] = Bolt(bolt_object=spec.component_object, common=spec.common) | 2 | 10 | 3 | 59 | 0 | 76 | 86 | 76 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (add_bolt_spec) defined within the public class called public.The function start at line 76 and ends at 86. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [76.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | add_spout_spec | def add_spout_spec(mcs, spec, spout_specs):"""Add valid Spout specs to `spout_specs`; raise exceptions for others."""if not spec.outputs:cls_name = spec.component_cls.__name__raise ValueError('{} "{}" requires at least one output, because it '"is a Spout".format(cls_name, spec.name))spout_specs[spec.name] = SpoutSpec(spout_object=spec.component_object, common=spec.common) | 2 | 10 | 3 | 59 | 0 | 89 | 99 | 89 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (add_spout_spec) defined within the public class called public.The function start at line 89 and ends at 99. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [89.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | clean_spec_inputs | def clean_spec_inputs(mcs, spec, specs):"""Convert `spec.inputs` to a dict mapping from stream IDs to groupings."""if spec.inputs is None:spec.inputs = {}for stream_id, grouping in list(spec.inputs.items()):if isinstance(stream_id.componentId, ComponentSpec):# Have to reinsert key after fix because hash changesdel spec.inputs[stream_id]stream_id.componentId = stream_id.componentId.namespec.inputs[stream_id] = grouping# This should never happen, but it's worth checking forelif stream_id.componentId is None:raise TypeError("GlobalStreamId.componentId cannot be None.")# Check for invalid fields groupingstream_comp = specs[stream_id.componentId]valid_fields = set(stream_comp.outputs[stream_id.streamId].output_fields)if grouping.fields is not None:for field in grouping.fields:if field not in valid_fields:raise ValueError("Field {!r} specified in grouping is ""not a valid output field for the {!r}"" {!r} stream.".format(field, stream_comp.name, stream_id.streamId)) | 8 | 22 | 3 | 149 | 0 | 102 | 127 | 102 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (clean_spec_inputs) defined within the public class called public.The function start at line 102 and ends at 127. It contains 22 lines of code and it has a cyclomatic complexity of 8. It takes 3 parameters, represented as [102.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | __repr__ | def __repr__(cls):""":returns: A string representation of the topology"""# TODO: Come up with a better repr that makes it clear the class is not# actually a StormTopology objectreturn repr(getattr(cls, "thrift_topology", None)) | 1 | 2 | 1 | 18 | 0 | 129 | 133 | 129 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (__repr__) defined within the public class called public.The function start at line 129 and ends at 133. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | write.write_it | def write_it(stream):transport_out = TMemoryBuffer()protocol_out = TBinaryProtocol(transport_out)cls.thrift_topology.write(protocol_out)transport_bytes = transport_out.getvalue()stream.write(transport_bytes) | 1 | 6 | 1 | 37 | 0 | 150 | 155 | 150 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (write.write_it) defined within the public class called public.The function start at line 150 and ends at 155. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | write | def write(cls, stream):"""Write the topology to a stream or file.Typically used to write to Nimbus... note::This will not save the `specs` attribute, as that is not part ofthe Thrift output."""def write_it(stream):transport_out = TMemoryBuffer()protocol_out = TBinaryProtocol(transport_out)cls.thrift_topology.write(protocol_out)transport_bytes = transport_out.getvalue()stream.write(transport_bytes)if isinstance(stream, str):with open(stream, "wb") as output_file:write_it(output_file)else:write_it(stream) | 2 | 7 | 2 | 38 | 0 | 140 | 161 | 140 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (write) defined within the public class called public.The function start at line 140 and ends at 161. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [140.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | read.read_it | def read_it(stream):stream_bytes = stream.read()transport_in = TMemoryBuffer(stream_bytes)protocol_in = TBinaryProtocol(transport_in)topology = StormTopology()topology.read(protocol_in)cls.thrift_topology = topologycls.thrift_bolts = topology.boltscls.thrift_spouts = topology.spouts# Can't reconstruct Python specs from Thrift.cls.specs = [] | 1 | 10 | 1 | 60 | 0 | 172 | 182 | 172 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (read.read_it) defined within the public class called public.The function start at line 172 and ends at 182. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | read | def read(cls, stream):"""Read a topology from a stream or file... note::This will not properly reconstruct the `specs` attribute, as that isnot included in the Thrift output."""def read_it(stream):stream_bytes = stream.read()transport_in = TMemoryBuffer(stream_bytes)protocol_in = TBinaryProtocol(transport_in)topology = StormTopology()topology.read(protocol_in)cls.thrift_topology = topologycls.thrift_bolts = topology.boltscls.thrift_spouts = topology.spouts# Can't reconstruct Python specs from Thrift.cls.specs = []if isinstance(stream, str):with open(stream, "rb") as input_file:return read_it(input_file)else:return read_it(stream) | 2 | 7 | 2 | 40 | 0 | 164 | 188 | 164 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (read) defined within the public class called public.The function start at line 164 and ends at 188. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [164.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _spec_to_flux_dict | def _spec_to_flux_dict(spec):"""Convert a ComponentSpec into a dict as expected by Flux"""flux_dict = {"id": spec.name, "constructorArgs": []}if isinstance(spec, ShellComponentSpec):if isinstance(spec, ShellBoltSpec):flux_dict["className"] = "org.apache.storm.flux.wrappers.bolts.FluxShellBolt"else:flux_dict["className"] = "org.apache.storm.flux.wrappers.spouts.FluxShellSpout"shell_object = spec.component_object.shellflux_dict["constructorArgs"].append([shell_object.execution_command, shell_object.script])if not spec.outputs:flux_dict["constructorArgs"].append(["NONE_BUT_FLUX_WANTS_SOMETHING_HERE"])for output_stream in spec.outputs.keys():if output_stream == "default":output_fields = spec.outputs["default"].output_fieldsflux_dict["constructorArgs"].append(output_fields)else:if "configMethods" not in flux_dict:flux_dict["configMethods"] = []flux_dict["configMethods"].append({"name": "setNamedStream","args": [output_stream,spec.outputs[output_stream].output_fields,],})flux_dict["parallelism"] = spec.parif spec.config:component_config = spec.configif not isinstance(component_config, dict):component_config = json.loads(component_config)flux_dict.setdefault("configMethods", [])for key, value in component_config.items():flux_dict["configMethods"].append({"name": "addComponentConfig", "args": [key, value]})else:if spec.component_object.serialized_java is not None:raise TypeError("Flux does not support specifying serialized ""Java objects.Given: {!r}".format(spec))java_object = spec.component_object.java_objectflux_dict["className"] = java_object.full_class_name# Convert JavaObjectArg instances into basic data typesflux_dict["constructorArgs"] = to_python_arg_list(java_object.args_list)return flux_dict | 11 | 55 | 1 | 298 | 0 | 191 | 247 | 191 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_spec_to_flux_dict) defined within the public class called public.The function start at line 191 and ends at 247. It contains 55 lines of code and it has a cyclomatic complexity of 11. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | _stream_to_flux_dict | def _stream_to_flux_dict(spec, global_stream, grouping):"""Convert a GlobalStreamId into a dict as expected by Flux"""flux_dict = {"from": global_stream.componentId, "to": spec.name}grouping_dict = {"streamId": global_stream.streamId}for key, val in grouping.__dict__.items():if val is not None:grouping_dict["type"] = key.upper()if key == "fields":if val:grouping_dict["args"] = valelse:grouping_dict["type"] = "GLOBAL"elif key == "custom_object":grouping_dict["type"] = "CUSTOM"class_dict = {"className": val.full_class_name,"constructorArgs": to_python_arg_list(val.args_list),}grouping_dict["customClass"] = class_dictflux_dict["grouping"] = grouping_dictreturn flux_dict | 6 | 20 | 3 | 129 | 0 | 250 | 270 | 250 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (_stream_to_flux_dict) defined within the public class called public.The function start at line 250 and ends at 270. It contains 20 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [250.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | to_flux_dict | def to_flux_dict(cls, name):"""Convert topology to dict that can written out as Flux YAML file."""flux_dict = {"name": name, "bolts": [], "spouts": [], "streams": []}for spec in cls.specs:if isinstance(spec, (JavaBoltSpec, ShellBoltSpec)):flux_dict["bolts"].append(cls._spec_to_flux_dict(spec))for global_stream, grouping in spec.inputs.items():stream_dict = cls._stream_to_flux_dict(spec, global_stream, grouping)flux_dict["streams"].append(stream_dict)elif isinstance(spec, (JavaSpoutSpec, ShellSpoutSpec)):flux_dict["spouts"].append(cls._spec_to_flux_dict(spec))else:raise TypeError(f"Specifications should either be bolts or spouts.Given: {spec!r}")flux_dict = {key: val for key, val in flux_dict.items() if val}return flux_dict | 7 | 18 | 2 | 152 | 0 | 273 | 291 | 273 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (to_flux_dict) defined within the public class called public.The function start at line 273 and ends at 291. It contains 18 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [273.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | to_java_arg | def to_java_arg(arg):"""Converts Python objects to equivalent Thrift JavaObjectArgs"""if isinstance(arg, bool):java_arg = JavaObjectArg(bool_arg=arg)elif isinstance(arg, int):# Just use long all the time since Python 3 doesn't# distinguish between long and intjava_arg = JavaObjectArg(long_arg=arg)elif isinstance(arg, bytes):java_arg = JavaObjectArg(binary_arg=arg)elif isinstance(arg, str):java_arg = JavaObjectArg(string_arg=arg)elif isinstance(arg, float):java_arg = JavaObjectArg(double_arg=arg)else:raise TypeError("Only basic data types can be specified"" as arguments to JavaObject ""constructors.Given: {!r}".format(arg))return java_arg | 6 | 18 | 1 | 102 | 1 | 8 | 28 | 8 | null | ['java_arg'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (to_java_arg) defined within the public class called public.The function start at line 8 and ends at 28. It contains 18 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | to_python_arg | def to_python_arg(java_arg):"""Convert a Thrift JavaObjectArg into a basic Python data type"""arg = Nonefor val in java_arg.__dict__.values():if val is not None:arg = valbreakreturn arg | 3 | 7 | 1 | 32 | 1 | 31 | 38 | 31 | null | ['arg'] | None | null | 0 | 0 | 0 | null | 0 | null | The function (to_python_arg) defined within the public class called public.The function start at line 31 and ends at 38. It contains 7 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | to_python_arg_list | def to_python_arg_list(java_arg_list):"""Convert a list of Thrift JavaObjectArg objects into a list of basic types"""return [to_python_arg(java_arg) for java_arg in java_arg_list] | 2 | 2 | 1 | 17 | 0 | 41 | 43 | 41 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (to_python_arg_list) defined within the public class called public.The function start at line 41 and ends at 43. It contains 2 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | spec | def spec(cls,name=None,serialized_java=None,full_class_name=None,args_list=None,inputs=None,par=1,config=None,outputs=None,):"""Create a :class:`JavaBoltSpec` for a Java Bolt.This spec represents this Bolt in a :class:`~streamparse.Topology`.You must add the appropriate entries to your classpath by editing yourproject's ``project.clj`` file in order for this to work.:param name: Name of this Bolt.Defaults to name of :class:`~streamparse.Topology` attribute this is assigned to.:type name:`str`:param serialized_java:Serialized Java code representing the class. You must either specify this, or both ``full_class_name`` and ``args_list``.:type serialized_java: `bytes`:param full_class_name: Fully qualified class name (including thepackage name):type full_class_name: `str`:param args_list: A list of arguments to be passed to the constructor ofthis class.:type args_list: `list` of basic data types:param inputs: Streams that feed into this Bolt. Two forms of this are acceptable: 1.A `dict` mapping from :class:`~streamparse.dsl.component.ComponentSpec` to :class:`~streamparse.Grouping`. 2.A `list` of :class:`~streamparse.Stream` or :class:`~streamparse.dsl.component.ComponentSpec`.:param par:Parallelism hint for this Bolt.For Python Components, this works out to be the number of Python processes running it in the the topology (across all machines).See :ref:`parallelism`.:type par: `int`:param config: Component-specific config settings to pass to Storm.:type config:`dict`:param outputs: Outputs this JavaBolt will produce. Acceptable formsare:1.A `list` of :class:`~streamparse.Stream` objectsdescribing the fields output on each stream.2.A `list` of `str` representing the fields output onthe ``default`` stream."""return JavaBoltSpec(cls,name=name,serialized_java=serialized_java,full_class_name=full_class_name,args_list=args_list,inputs=inputs,par=par,config=config,outputs=outputs,) | 1 | 22 | 9 | 77 | 0 | 13 | 79 | 13 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (spec) defined within the public class called public.The function start at line 13 and ends at 79. It contains 22 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [13.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | spec | def spec(cls,name=None,command=None,script=None,inputs=None,par=None,config=None,outputs=None,):"""Create a :class:`ShellBoltSpec` for a non-Java, non-Python Bolt.If you want to create a spec for a Python Bolt, use:meth:`~streamparse.dsl.bolt.Bolt.spec`.This spec represents this Bolt in a :class:`~streamparse.Topology`.:param name: Name of this Bolt.Defaults to name of :class:`~streamparse.Topology` attribute this is assigned to.:type name:`str`:param command:Path to command the Storm will execute.:type command: `str`:param script: Arguments to `command`.Multiple arguments should just be separated by spaces.:type script: `str`:param inputs: Streams that feed into this Bolt. Two forms of this are acceptable: 1.A `dict` mapping from :class:`~streamparse.dsl.component.ComponentSpec` to :class:`~streamparse.Grouping`. 2.A `list` of :class:`~streamparse.Stream` or :class:`~streamparse.dsl.component.ComponentSpec`.:param par:Parallelism hint for this Bolt.For shell Components, this works out to be the number of running it in the the topology (across all machines). See :ref:`parallelism`.:type par: `int`:param config: Component-specific config settings to pass to Storm.:type config:`dict`:param outputs: Outputs this ShellBolt will produce. Acceptable formsare:1.A `list` of :class:`~streamparse.Stream` objectsdescribing the fields output on each stream.2.A `list` of `str` representing the fields output onthe ``default`` stream."""return ShellBoltSpec(cls,command=command,script=script,name=name,inputs=inputs,par=par,config=config,outputs=outputs,) | 1 | 20 | 8 | 69 | 0 | 86 | 145 | 86 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (spec) defined within the public class called public.The function start at line 86 and ends at 145. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [86.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | spec | def spec(cls, name=None, inputs=None, par=None, config=None):"""Create a :class:`~ShellBoltSpec` for a Python Bolt.This spec represents this Bolt in a :class:`~streamparse.Topology`.:param name: Name of this Bolt.Defaults to name of :class:`~streamparse.Topology` attribute this is assigned to.:type name:`str`:param inputs: Streams that feed into this Bolt. Two forms of this are acceptable: 1.A `dict` mapping from :class:`~streamparse.dsl.component.ComponentSpec` to :class:`~streamparse.Grouping`. 2.A `list` of :class:`~streamparse.Stream` or :class:`~streamparse.dsl.component.ComponentSpec`.:param par:Parallelism hint for this Bolt.For Python Components, this works out to be the number of Python processes running it in the the topology (across all machines).See :ref:`parallelism`. .. note:: This can also be specified as an attribute of your :class:`~Bolt` subclass.:type par: `int`:param config: Component-specific config settings to pass to Storm. .. note:: This can also be specified as an attribute of your :class:`~Bolt` subclass.:type config:`dict`.. note::This method does not take a ``outputs`` argument because``outputs`` should be an attribute of your :class:`~Bolt` subclass."""return ShellBoltSpec(cls,command="streamparse_run",script=f"{cls.__module__}.{cls.__name__}",name=name,inputs=inputs,par=par,config=config,outputs=cls.outputs,) | 1 | 11 | 5 | 59 | 0 | 152 | 201 | 152 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (spec) defined within the public class called public.The function start at line 152 and ends at 201. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [152.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | spec | def spec(cls, *args, **kwargs):"""This method exists only to give a more informative error message."""raise TypeError(f"Specifications should either be bolts or spouts. Given: {cls!r}") | 1 | 4 | 3 | 18 | 0 | 20 | 24 | 20 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (spec) defined within the public class called public.The function start at line 20 and ends at 24. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [20.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | spec | def spec(cls,name=None,serialized_java=None,full_class_name=None,args_list=None,par=1,config=None,outputs=None,):"""Create a :class:`JavaSpoutSpec` for a Java Spout.This spec represents this Spout in a :class:`~streamparse.Topology`.You must add the appropriate entries to your classpath by editing yourproject's ``project.clj`` file in order for this to work.:param name: Name of this Spout.Defaults to name of :class:`~streamparse.Topology` attribute this is assigned to.:type name:`str`:param serialized_java:Serialized Java code representing the class. You must either specify this, or both ``full_class_name`` and ``args_list``.:type serialized_java: `bytes`:param full_class_name: Fully qualified class name (including thepackage name):type full_class_name: `str`:param args_list: A list of arguments to be passed to the constructor ofthis class.:type args_list: `list` of basic data types:param par:Parallelism hint for this Spout. See :ref:`parallelism`.:type par: `int`:param config: Component-specific config settings to pass to Storm.:type config:`dict`:param outputs: Outputs this JavaSpout will produce. Acceptable formsare:1.A `list` of :class:`~streamparse.Stream` objectsdescribing the fields output on each stream.2.A `list` of `str` representing the fields output onthe ``default`` stream."""return JavaSpoutSpec(cls,name=name,serialized_java=serialized_java,full_class_name=full_class_name,args_list=args_list,par=par,config=config,outputs=outputs,) | 1 | 20 | 8 | 69 | 0 | 13 | 65 | 13 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (spec) defined within the public class called public.The function start at line 13 and ends at 65. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [13.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | spec | def spec(cls, name=None, command=None, script=None, par=None, config=None, outputs=None):"""Create a :class:`ShellSpoutSpec` for a non-Java, non-Python Spout.If you want to create a spec for a Python Spout, use:meth:`~streamparse.dsl.bolt.Spout.spec`.This spec represents this Spout in a :class:`~streamparse.Topology`.:param name: Name of this Spout.Defaults to name of :class:`~streamparse.Topology` attribute this is assigned to.:type name:`str`:param command:Path to command the Storm will execute.:type command: `str`:param script: Arguments to `command`.Multiple arguments should just be separated by spaces.:type script: `str`:param par:Parallelism hint for this Spout.For shell Components, this works out to be the number of processes running it in the the topology (across all machines). See :ref:`parallelism`.:type par: `int`:param config: Component-specific config settings to pass to Storm.:type config:`dict`:param outputs: Outputs this ShellSpout will produce. Acceptable formsare:1.A `list` of :class:`~streamparse.Stream` objectsdescribing the fields output on each stream.2.A `list` of `str` representing the fields output onthe ``default`` stream."""return ShellSpoutSpec(cls,command=command,script=script,name=name,par=par,config=config,outputs=outputs,) | 1 | 12 | 7 | 60 | 0 | 70 | 112 | 70 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (spec) defined within the public class called public.The function start at line 70 and ends at 112. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [70.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | spec | def spec(cls, name=None, par=None, config=None):"""Create a :class:`~ShellBoltSpec` for a Python Spout.This spec represents this Spout in a :class:`~streamparse.Topology`.:param name: Name of this Spout.Defaults to name of :class:`~streamparse.Topology` attribute this is assigned to.:type name:`str`:param par:Parallelism hint for this Spout.For Python Components, this works out to be the number of Python processes running it in the the topology (across all machines).See :ref:`parallelism`. .. note:: This can also be specified as an attribute of your :class:`~Spout` subclass.:type par: `int`:param config: Component-specific config settings to pass to Storm. .. note:: This can also be specified as an attribute of your :class:`~Spout` subclass.:type config:`dict`.. note::This method does not take a ``outputs`` argument because``outputs`` should be an attribute of your :class:`~Spout` subclass."""return ShellSpoutSpec(cls,command="streamparse_run",script=f"{cls.__module__}.{cls.__name__}",name=name,par=par,config=config,outputs=cls.outputs,) | 1 | 10 | 4 | 51 | 0 | 119 | 158 | 119 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (spec) defined within the public class called public.The function start at line 119 and ends at 158. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [119.0] and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_basic_spec | def test_basic_spec(self):class WordCount(Topology):word_spout = WordSpout.spec(par=2)word_bolt = WordCountBolt.spec(inputs={word_spout: Grouping.fields("word")}, par=8)self.assertEqual(len(WordCount.specs), 2)self.assertEqual(list(WordCount.word_bolt.inputs.keys()), [WordCount.word_spout["default"]])self.assertEqual(WordCount.thrift_spouts["word_spout"].common.parallelism_hint, 2)self.assertEqual(WordCount.thrift_bolts["word_bolt"].common.parallelism_hint, 8)self.assertEqual(WordCount.word_bolt.inputs[WordCount.word_spout["default"]],Grouping.fields("word"),) | 1 | 18 | 1 | 143 | 0 | 47 | 65 | 47 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_basic_spec) defined within the public class called public.The function start at line 47 and ends at 65. It contains 18 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_spec_with_inputs_as_list | def test_spec_with_inputs_as_list(self):class WordCount(Topology):word_spout = WordSpout.spec(par=2)word_bolt = WordCountBolt.spec(inputs=[word_spout], par=8)self.assertEqual(len(WordCount.specs), 2)self.assertEqual(len(WordCount.thrift_spouts), 1)self.assertEqual(len(WordCount.thrift_bolts), 1)self.assertEqual(list(WordCount.word_bolt.inputs.keys()), [WordCount.word_spout["default"]])self.assertEqual(WordCount.word_bolt.inputs[WordCount.word_spout["default"]],Grouping.SHUFFLE,) | 1 | 14 | 1 | 125 | 0 | 67 | 81 | 67 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_spec_with_inputs_as_list) defined within the public class called public.The function start at line 67 and ends at 81. It contains 14 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_multi_stream_bolt | def test_multi_stream_bolt(self):class WordCount(Topology):word_spout = WordSpout.spec(par=2)word_bolt = MultiStreamWordCountBolt.spec(inputs=[word_spout], par=8)db_dumper_bolt = DatabaseDumperBolt.spec(par=4, inputs=[word_bolt["sum"], word_bolt["default"]])self.assertEqual(len(WordCount.specs), 3)self.assertEqual(len(WordCount.thrift_spouts), 1)self.assertEqual(len(WordCount.thrift_bolts), 2)self.assertEqual(list(WordCount.word_bolt.inputs.keys()), [WordCount.word_spout["default"]])self.assertEqual(WordCount.word_bolt.inputs[WordCount.word_spout["default"]],Grouping.SHUFFLE,)db_dumper_bolt_input_set = set(WordCount.db_dumper_bolt.inputs.keys())self.assertEqual(len(WordCount.db_dumper_bolt.inputs.keys()), len(db_dumper_bolt_input_set))self.assertEqual(db_dumper_bolt_input_set,{WordCount.word_bolt["sum"], WordCount.word_bolt["default"]},) | 1 | 25 | 1 | 208 | 0 | 83 | 108 | 83 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_multi_stream_bolt) defined within the public class called public.The function start at line 83 and ends at 108. It contains 25 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_long_chain_spec | def test_long_chain_spec(self):class WordCount(Topology):word_spout = WordSpout.spec()word_bolt1 = WordCountBolt.spec(inputs=[word_spout])word_bolt2 = WordCountBolt.spec(inputs=[word_bolt1])word_bolt3 = WordCountBolt.spec(inputs=[word_bolt2])word_bolt4 = WordCountBolt.spec(inputs=[word_bolt3])word_bolt5 = WordCountBolt.spec(inputs=[word_bolt4])word_bolt6 = WordCountBolt.spec(inputs=[word_bolt5])word_bolt7 = WordCountBolt.spec(inputs=[word_bolt6])word_bolt8 = WordCountBolt.spec(inputs=[word_bolt7])word_bolt9 = WordCountBolt.spec(inputs=[word_bolt8])word_bolt10 = WordCountBolt.spec(inputs=[word_bolt9])word_bolt11 = WordCountBolt.spec(inputs=[word_bolt10])word_bolt12 = WordCountBolt.spec(inputs=[word_bolt11])self.assertEqual(len(WordCount.specs), 13)self.assertEqual(len(WordCount.thrift_spouts), 1)self.assertEqual(len(WordCount.thrift_bolts), 12)self.assertEqual(list(WordCount.word_bolt1.inputs.keys())[0], WordCount.word_spout["default"])self.assertEqual(WordCount.word_bolt1.inputs[WordCount.word_spout["default"]],Grouping.SHUFFLE,)for i in range(2, 13):bolt = getattr(WordCount, f"word_bolt{i}")prev_bolt = getattr(WordCount, f"word_bolt{i - 1}")self.assertEqual(list(bolt.inputs.keys())[0], prev_bolt["default"])self.assertEqual(bolt.inputs[prev_bolt["default"]], Grouping.SHUFFLE) | 2 | 30 | 1 | 320 | 0 | 110 | 140 | 110 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_long_chain_spec) defined within the public class called public.The function start at line 110 and ends at 140. It contains 30 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_many_spouts_spec | def test_many_spouts_spec(self):class WordCount(Topology):word_spout1 = WordSpout.spec()word_spout2 = WordSpout.spec()word_spout3 = WordSpout.spec()word_spout4 = WordSpout.spec()word_spout5 = WordSpout.spec()word_bolt = WordCountBolt.spec(inputs=[word_spout1, word_spout2, word_spout3, word_spout4, word_spout5]) | 1 | 10 | 1 | 66 | 0 | 142 | 151 | 142 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_many_spouts_spec) defined within the public class called public.The function start at line 142 and ends at 151. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_invalid_bolt_group_field | def test_invalid_bolt_group_field(self):# Fields grouping must specify field output by spoutwith self.assertRaises(ValueError):class WordCount(Topology):word_spout = WordSpout.spec()word_bolt = WordCountBolt.spec(inputs={word_spout: Grouping.fields("foo")}) | 1 | 7 | 1 | 45 | 0 | 153 | 161 | 153 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_invalid_bolt_group_field) defined within the public class called public.The function start at line 153 and ends at 161. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_empty_bolt_group_field | def test_empty_bolt_group_field(self):# Fields groupings require field names to be specifiedwith self.assertRaises(ValueError):class WordCount(Topology):word_spout = WordSpout.spec()word_bolt = WordCountBolt.spec(inputs={word_spout: Grouping.fields()}) | 1 | 5 | 1 | 44 | 0 | 163 | 169 | 163 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_empty_bolt_group_field) defined within the public class called public.The function start at line 163 and ends at 169. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_duplicate_name | def test_duplicate_name(self):# Each component name must be uniquewith self.assertRaises(ValueError):class WordCount(Topology):word = WordSpout.spec()word_ = WordCountBolt.spec(name="word", inputs=[word]) | 1 | 5 | 1 | 42 | 0 | 171 | 177 | 171 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_duplicate_name) defined within the public class called public.The function start at line 171 and ends at 177. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_no_input_bolt | def test_no_input_bolt(self):# All bolts must have at least one inputwith self.assertRaises(ValueError):class WordCount(Topology):word_spout = WordSpout.spec()word_bolt = WordCountBolt.spec(inputs=[]) | 1 | 5 | 1 | 37 | 0 | 179 | 185 | 179 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_no_input_bolt) defined within the public class called public.The function start at line 179 and ends at 185. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_no_outputs_spout_empty | def test_no_outputs_spout_empty(self):# All spouts must have output fieldsclass PointlessSpout(Spout):outputs = []with self.assertRaises(ValueError):class WordCount(Topology):word_spout = PointlessSpout.spec() | 1 | 6 | 1 | 36 | 0 | 187 | 195 | 187 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_no_outputs_spout_empty) defined within the public class called public.The function start at line 187 and ends at 195. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_no_outputs_spout | def test_no_outputs_spout(self):# All spouts must have output fieldsclass PointlessSpout(Spout):outputs = []with self.assertRaises(ValueError):class WordCount(Topology):word_spout = PointlessSpout.spec() | 1 | 6 | 1 | 36 | 0 | 197 | 205 | 197 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_no_outputs_spout) defined within the public class called public.The function start at line 197 and ends at 205. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_base_component_rejection | def test_base_component_rejection(self):# Topology components must inherit from Bolt/Spout, not Component directlyclass MyComponent(Component):outputs = []with self.assertRaises(TypeError):class WordCount(Topology):word_spout = MyComponent.spec() | 1 | 6 | 1 | 36 | 0 | 207 | 215 | 207 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_base_component_rejection) defined within the public class called public.The function start at line 207 and ends at 215. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_component_instead_of_spec | def test_component_instead_of_spec(self):# Make sure we catch things early when people forget to call .specwith self.assertRaises(TypeError):class WordCount(Topology):word_spout = WordSpout(input_stream=BytesIO(), output_stream=BytesIO()) | 1 | 4 | 1 | 35 | 0 | 217 | 222 | 217 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_component_instead_of_spec) defined within the public class called public.The function start at line 217 and ends at 222. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_no_spout | def test_no_spout(self):# Every topology must have a spoutwith self.assertRaises(ValueError):class WordCount(Topology):pass | 1 | 4 | 1 | 20 | 0 | 224 | 229 | 224 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_no_spout) defined within the public class called public.The function start at line 224 and ends at 229. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_zero_par | def test_zero_par(self):# Component parallelism (number of processes) can't be 0with self.assertRaises(ValueError):class WordCount(Topology):word_spout = WordSpout.spec(par=0) | 1 | 4 | 1 | 29 | 0 | 231 | 236 | 231 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_zero_par) defined within the public class called public.The function start at line 231 and ends at 236. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_negative_par | def test_negative_par(self):# Component parallelism (number of processes) can't be negativewith self.assertRaises(ValueError):class WordCount(Topology):word_spout = WordSpout.spec(par=-1) | 1 | 4 | 1 | 30 | 0 | 238 | 243 | 238 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_negative_par) defined within the public class called public.The function start at line 238 and ends at 243. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_float_par | def test_float_par(self):# Component parallelism (number of processes) must be an intwith self.assertRaises(TypeError):class WordCount(Topology):word_spout = WordSpout.spec(par=5.4) | 1 | 4 | 1 | 31 | 0 | 245 | 250 | 245 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_float_par) defined within the public class called public.The function start at line 245 and ends at 250. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_dict_par | def test_dict_par(self):# Component parallelism (number of processes) can temporarily be a dictclass WordCount(Topology):word_spout = WordSpout.spec(par={"prod": 5, "beta": 1})self.assertEqual(WordCount.thrift_spouts["word_spout"].common.parallelism_hint,{"prod": 5, "beta": 1},) | 1 | 7 | 1 | 55 | 0 | 252 | 260 | 252 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_dict_par) defined within the public class called public.The function start at line 252 and ends at 260. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_dict_par_bad_key_type | def test_dict_par_bad_key_type(self):# Component parallelism dict must map for str to intwith self.assertRaises(TypeError):class WordCount(Topology):word_spout = WordSpout.spec(par={1000: 5, "beta": 1}) | 1 | 4 | 1 | 37 | 0 | 262 | 267 | 262 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_dict_par_bad_key_type) defined within the public class called public.The function start at line 262 and ends at 267. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
pystorm_streamparse | public | public | 0 | 0 | test_dict_par_bad_value_type | def test_dict_par_bad_value_type(self):# Component parallelism dict must map for str to intwith self.assertRaises(TypeError):class WordCount(Topology):word_spout = WordSpout.spec(par={"prod": 5.5, "beta": 1}) | 1 | 4 | 1 | 39 | 0 | 269 | 274 | 269 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_dict_par_bad_value_type) defined within the public class called public.The function start at line 269 and ends at 274. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.