Branch Coverage

blib/lib/Python/File.pm
Criterion Covered Total %
branch 43 224 19.2


line true false branch
87 0 0 unless (defined $openai)
107 0 0 if (not exists $self->{'python_preparsed'} && defined $self->{'python_preparsed'}) { }
0 0 elsif (scalar @{$self->{'python_preparsed'};} == 0) { }
146 0 0 unless open my filehandleref $PERL_FILE, ">", $self->{'perl_file_path'}
150 0 0 unless close $PERL_FILE
155 0 0 if (defined $self->{'python_preparsed'}[0] and $self->{'python_preparsed'}[0]->isa("Python::Shebang"))
159 0 0 unless chmod 0100, $self->{'perl_file_path'}
178 0 0 if (not exists $self->{'python_preparsed'} && defined $self->{'python_preparsed'}) { }
0 0 elsif (scalar @{$self->{'python_preparsed'};} == 0) { }
188 0 0 if (not exists $self->{'python_file_path'} && defined $self->{'python_file_path'} or $self->{'python_file_path'} eq "")
201 0 0 if (not defined $python_file_name or $python_file_name eq "")
231 0 0 if ($python_file_name =~ /\.py$/) { }
0 0 elsif ($python_file_name =~ /\.py[0-9a-zA-Z]*$/) { }
266 0 0 unless (defined $openai)
273 0 0 if (not exists $self->{'python_preparsed'} && defined $self->{'python_preparsed'}) { }
0 0 elsif (scalar @{$self->{'python_preparsed'};} == 0) { }
320 0 1 if (not exists $self->{'python_preparsed'} && defined $self->{'python_preparsed'}) { }
0 1 elsif (scalar @{$self->{'python_preparsed'};} == 0) { }
355 104 1 defined $python_last_active_character ? :
361 105 0 if (defined $1 and $1 ne '') { }
389 0 1 unless open my filehandleref $PYTHON_FILE, "<", $self->{'python_file_path'}
414 116 4 defined $python_last_active_character ? :
417 0 120 if ($python_line_number == 1 and $Python::File::ARG =~ /^#!.*python.*$/)
432 0 120 if (scalar @{$python_preparsed_target;} > 0 and $python_preparsed_target->[-1]->isa('Python::CommentSingleQuotes') and $python_preparsed_target->[-1]{'python_line_number_end'} < 0) { }
0 120 elsif (scalar @{$python_preparsed_target;} > 0 and $python_preparsed_target->[-1]->isa('Python::CommentDoubleQuotes') and $python_preparsed_target->[-1]{'python_line_number_end'} < 0) { }
57 63 elsif (scalar @{$python_preparsed_target;} > 0 and $python_preparsed_target->[-1]->isa('Python::Include') and $python_preparsed_target->[-1]{'python_line_number_end'} < 0) { }
0 63 elsif (scalar @{$python_preparsed_target;} > 0 and $python_preparsed_target->[-1]->isa('Python::Function') and $python_preparsed_target->[-1]{'python_line_number_end_header'} < 0) { }
0 125 elsif (scalar @{$python_preparsed_target;} > 0 and $python_preparsed_target->[-1]->isa('Python::Class') and $python_preparsed_target->[-1]{'python_line_number_end_header'} < 0) { }
440 0 0 if ($Python::File::ARG =~ /^(.*)\'\'\'\s*$/) { }
0 0 elsif ($Python::File::ARG =~ /\'\'\'/) { }
0 0 elsif ($Python::File::ARG =~ /\"\"\"/) { }
444 0 0 if ($python_preparsed_target->[-1]{'is_actually_string_literal'}) { }
451 0 0 if (scalar @{$python_preparsed_target;} > 1 and $python_preparsed_target->[-2]->isa('Python::Unknown')) { }
0 0 elsif (scalar @{$python_preparsed_target;} > 2 and $python_preparsed_target->[-2]->isa('Python::Blank') and $python_preparsed_target->[-3]->isa('Python::Unknown')) { }
504 0 0 if ($Python::File::ARG =~ /^(\s+)\'\'\'\s*$/) { }
0 0 elsif ($Python::File::ARG =~ /^(\s+)(.+)\'\'\'\s*$/) { }
0 0 elsif ($Python::File::ARG =~ /^(.+)\'\'\'\s*$/) { }
539 0 0 if ($comment eq '' or $python_preparsed_target->[-1]{'is_actually_string_literal'}) { }
0 0 elsif ($comment =~ /^(\s+)(.*)$/) { }
544 0 0 if (length $python_preparsed_target->[-1]{'indentation'} >= 2 and length $1 >= 2) { }
567 0 0 if ($Python::File::ARG =~ /^(.*)\"\"\"\s*$/) { }
0 0 elsif ($Python::File::ARG =~ /\"\"\"/) { }
0 0 elsif ($Python::File::ARG =~ /\'\'\'/) { }
574 0 0 if ($python_preparsed_target->[-1]{'is_actually_string_literal'}) { }
581 0 0 if (scalar @{$python_preparsed_target;} > 1 and $python_preparsed_target->[-2]->isa('Python::Unknown')) { }
0 0 elsif (scalar @{$python_preparsed_target;} > 2 and $python_preparsed_target->[-2]->isa('Python::Blank') and $python_preparsed_target->[-3]->isa('Python::Unknown')) { }
634 0 0 if ($Python::File::ARG =~ /^(\s+)\"\"\"\s*$/) { }
0 0 elsif ($Python::File::ARG =~ /^(\s+)(.+)\"\"\"\s*$/) { }
0 0 elsif ($Python::File::ARG =~ /^(.+)\"\"\"\s*$/) { }
667 0 0 if ($comment eq '' or $python_preparsed_target->[-1]{'is_actually_string_literal'}) { }
0 0 elsif ($comment =~ /^(\s+)(.*)$/) { }
672 0 0 if (length $python_preparsed_target->[-1]{'indentation'} >= 2 and length $1 >= 2) { }
700 20 37 if ($python_preparsed_target->[-1]{'python_has_parentheses'}) { }
702 5 15 if ($Python::File::ARG =~ /^.*\)\s*(?:\#.*)?$/)
713 11 26 unless ($Python::File::ARG =~ /^.*\\\s*$/)
723 0 41 if ($Python::File::ARG =~ /\'\'\'/) { }
0 41 elsif ($Python::File::ARG =~ /\"\"\"/) { }
755 0 0 if ($python_preparsed_target->[-1]{'python_source_code'} =~ /^(\s*)def\s+(\w+)\s*\(\s*((?:[\w\.\*]+\s*(?::\s*[\w\.]+\s*)?(?:\[.*\]\s*)?(?:\=\s*(?:(?:\'.*\')|(?:\".*\")|(?:\(.*\))|(?:\[.*\])|[\w\.\-\(\)]+))?\s*\,\s*(?:\#.*\n)?\s*)*[\w\.\*]+\s*(?::\s*[\w\.]+\s*)?(?:\[.*\]\s*)?(?:\=\s*(?:(?:\'.*\')|(?:\".*\")|(?:\(.*\))|(?:\[.*\])|[\w\.\-\(\)]+))?\s*\,?\s*(?:\#.*\n)?)?\s*\)\s*(?:->\s*([\w\.]+\s*(?:\[.*\]\s*)?))?\s*(:)\s*(\#.*)?$/ or $python_preparsed_target->[-1]{'python_source_code'} =~ /^(\s*)def\s+(\w+)\s*\(\s*((?:(?:(?:const\s+)?(?:[\w\.]+\s*(?:\[[\:\d\,\s]+\])?\s+))?[\w\.\*]+(?:\=\s*(?:(?:\'.*\')|(?:\".*\")|(?:\(.*\))|(?:\[.*\])|[\w\.\-\(\)]+))?\s*\,\s*(?:\#.*\n)?\s*)*(?:(?:const\s+)?(?:[\w\.]+\s*(?:\[[\:\d\,\s]+\])?\s+))?[\w\.\*]+(?:\=\s*(?:(?:\'.*\')|(?:\".*\")|(?:\(.*\))|(?:\[.*\])|[\w\.\-\(\)]+))?\s*\,?\s*(?:\#.*\n)?)?\s*\)\s*(?:->\s*([\w\.]+))?\s*(:)\s*(\#.*)?$/)
771 0 0 if (defined $3)
772 0 0 if (defined $4)
807 0 0 if ($python_preparsed_target->[-1]{'python_source_code'} =~ /^(\s*)class\s+(\w+)\s*(?:\(\s*((?:[\w\.=]+\s*\,\s*(?:\#.*\n)?\s*)*[\w\.=]+\s*\,?\s*(?:\#.*\n)?)?\s*\)\s*)?(:)\s*(\#.*)?$/ or $python_preparsed_target->[-1]{'python_source_code'} =~ /^(\s*)cdef\s+class\s+(\w+)(?:\{\{\w+\}\})?\s*(?:\(\s*((?:[\w\.=]+(?:\{\{\w+\}\})?[\w\.=]*\s*\,\s*(?:\#.*\n)?\s*)*[\w\.=]+(?:\{\{\w+\}\})?[\w\.=]*\s*\,?\s*(?:\#.*\n)?)?\s*\)\s*)?(:)\s*(\#.*)?$/)
817 0 0 if (defined $3)
834 0 63 if (scalar @{$python_namespaces;} > 0)
844 0 0 defined $1 ? :
849 0 0 if (defined $1 and length $1 <= length $python_namespaces->[-1]{'indentation'})
871 0 0 if (scalar @{$python_namespaces;} > 1) { }
884 0 0 if (scalar @{$independent_blank_lines;} == 0) { }
897 0 0 if (scalar @{$python_namespaces;} > 0) { }
912 0 63 if (scalar @{$python_namespaces;} > 0) { }
924 7 56 if ($Python::File::ARG =~ /^$/) { }
0 56 elsif ($Python::File::ARG =~ /^\s+$/) { }
8 48 elsif ($Python::File::ARG =~ /^\s*\#/) { }
0 48 elsif ($Python::File::ARG =~ /^(\s*)\'\'\'(.*)\'\'\'\s*$/ and $python_last_active_character ne '(' and $python_last_active_character ne ',') { }
0 48 elsif ($Python::File::ARG =~ /^(\s*)\"\"\"(.*)\"\"\"\s*$/ and $python_last_active_character ne '(' and $python_last_active_character ne ',') { }
0 48 elsif ($Python::File::ARG =~ /^(\s*)\'\'\'(.*)$/) { }
0 48 elsif ($Python::File::ARG =~ /^(\s*)\"\"\"(.*)$/) { }
16 32 elsif ($Python::File::ARG =~ /^\s*from\s+.*(\()[^\)]*$/ or $Python::File::ARG =~ /^\s*from\s+.*\\$/ or $Python::File::ARG =~ /^\s*c?import\s+.*\\$/) { }
32 0 elsif ($Python::File::ARG =~ /^\s*(from\s+.+\s+)?c?import[\(\s].+$/) { }
0 0 elsif ($Python::File::ARG =~ /^(\s*)def\s+(\w+)\s*\(\s*((?:[\w\.\*]+\s*(?::\s*[\w\.]+\s*)?(?:\[.*\]\s*)?(?:\=\s*(?:(?:\'.*\')|(?:\".*\")|(?:\(.*\))|(?:\[.*\])|[\w\.\-\(\)]+))?\s*\,\s*(?:\#.*\n)?\s*)*[\w\.\*]+\s*(?::\s*[\w\.]+\s*)?(?:\[.*\]\s*)?(?:\=\s*(?:(?:\'.*\')|(?:\".*\")|(?:\(.*\))|(?:\[.*\])|[\w\.\-\(\)]+))?\s*\,?\s*(?:\#.*\n)?)?\s*\)\s*(?:->\s*([\w\.]+\s*(?:\[.*\]\s*)?))?\s*(:)\s*(\#.*)?$/ or $Python::File::ARG =~ /^(\s*)def\s+(\w+)\s*\(\s*((?:(?:(?:const\s+)?(?:[\w\.]+\s*(?:\[[\:\d\,\s]+\])?\s+))?[\w\.\*]+(?:\=\s*(?:(?:\'.*\')|(?:\".*\")|(?:\(.*\))|(?:\[.*\])|[\w\.\-\(\)]+))?\s*\,\s*)*(?:(?:const\s+)?(?:[\w\.]+\s*(?:\[[\:\d\,\s]+\])?\s+))?[\w\.\*]+(?:\=\s*(?:(?:\'.*\')|(?:\".*\")|(?:\(.*\))|(?:\[.*\])|[\w\.\-\(\)]+))?\s*\,?)?\s*\)\s*(?:->\s*([\w\.]+))?\s*(:)\s*(\#.*)?$/ or $Python::File::ARG =~ /^(\s*)def\s+(\w+)/) { }
0 0 elsif ($Python::File::ARG =~ /^(\s*)class\s+(\w+)\s*(?:\(\s*((?:[\w\.=]+\s*\,\s*)*[\w\.=]+\s*\,?)?\s*\)\s*)?(:)\s*(\#.*)?$/ or $Python::File::ARG =~ /^(\s*)class\s+(\w+)\s*\(/ or $Python::File::ARG =~ /^(\s*)cdef\s+class\s+(\w+)\s*(?:\(\s*((?:[\w\.=]+(?:\{\{\w+\}\})?[\w\.=]*\s*\,\s*)*[\w\.=]+(?:\{\{\w+\}\})?[\w\.=]*\s*\,?)?\s*\)\s*)?(:)\s*(\#.*)?$/ or $Python::File::ARG =~ /^(\s*)cdef\s+class\s+(\w+)\s*\(/) { }
929 0 7 if (scalar @{$python_preparsed_target;} > 0 and $python_preparsed_target->[-1]->isa('Python::Blank')) { }
960 0 0 if (scalar @{$python_preparsed_target;} > 0 and $python_preparsed_target->[-1]->isa('Python::Whitespace')) { }
990 0 8 if (scalar @{$python_preparsed_target;} > 0 and $python_preparsed_target->[-1]->isa('Python::Comment')) { }
1033 0 0 if (scalar @{$python_preparsed_target;} > 0 and $python_preparsed_target->[-1]->isa('Python::CommentSingleQuotes')) { }
1071 0 0 if (scalar @{$python_preparsed_target;} > 0 and $python_preparsed_target->[-1]->isa('Python::CommentDoubleQuotes')) { }
1100 0 0 if ($python_last_active_character eq '(' or $python_last_active_character eq ',') { }
1131 0 0 if ($python_last_active_character eq '(' or $python_last_active_character eq ',') { }
1176 5 11 defined $1 ? :
1326 0 0 if (defined $5) { }
1328 0 0 if (defined $3)
1329 0 0 if (defined $4)
1344 0 0 if ($python_preparsed_target->[-1]->isa("Python::Blank") or $python_preparsed_target->[-1]->isa("Python::Whitespace") or $python_preparsed_target->[-1]->isa("Python::Comment"))
1357 0 0 if ($python_preparsed_target->[-1]->isa("Python::Unknown") and $python_preparsed_target->[-1]{'python_source_code'} =~ /^\s*\@.+$/)
1398 0 0 if (scalar @{$python_component->{'python_preparsed'};} > 0)
1405 0 0 if (scalar @{$python_namespaces;} > 0) { }
1411 0 0 if ($python_namespaces->[-1]->isa('Python::Function')) { }
0 0 elsif ($python_namespaces->[-1]->isa('Python::Class')) { }
1444 0 0 if (exists $python_functions->{$python_namespace_name}) { }
1445 0 0 if (ref $python_functions->{$python_namespace_name} eq 'ARRAY') { }
0 0 elsif ($python_functions->{$python_namespace_name}->isa('Python::Function')) { }
1539 0 0 if (defined $4) { }
1541 0 0 if (defined $3)
1552 0 0 if (scalar @{$python_namespaces;} > 0) { }
1558 0 0 if ($python_namespaces->[-1]->isa('Python::Class')) { }
0 0 elsif ($python_namespaces->[-1]->isa('Python::Function')) { }
1585 0 0 if (exists $python_classes->{$python_namespace_name})
1605 0 0 if ($Python::File::ARG =~ /^(\s*)def\s+/) { }
0 0 elsif ($Python::File::ARG =~ /^(\s*)class\s+/) { }
1614 0 0 if (scalar @{$python_preparsed_target;} > 0 and $python_preparsed_target->[-1]->isa('Python::Unknown')) { }
0 0 elsif (scalar @{$python_preparsed_target;} > 1 and $python_preparsed_target->[-1]->isa('Python::Blank') and $python_preparsed_target->[-2]->isa('Python::Unknown')) { }
1660 0 1 unless close $PYTHON_FILE
1663 0 1 if (scalar @{$python_preparsed_target;} > 0 and $python_preparsed_target->[-1]->isa("Python::Function") and $python_preparsed_target->[-1]{'python_line_number_end_header'} < 0)