-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
50 lines (40 loc) · 1.37 KB
/
example.py
File metadata and controls
50 lines (40 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Example usage of Code Line Counter
This is a sample file to demonstrate the code counter functionality.
It contains a mix of code, comments, and blank lines that can be analyzed.
"""
# Import standard libraries
import os
import sys
# Define a sample function with comments
def hello_world():
"""
A simple function that prints a greeting
This is a multi-line docstring comment
"""
# This is a single line comment
print("Hello, World!") # This is an inline comment
# Return success
return True
# Define a sample class
class Example:
"""Example class for demonstration"""
def __init__(self, name="Example"):
self.name = name
def get_name(self):
# Return the name
return self.name
# Main execution
if __name__ == "__main__":
# Call the hello_world function
hello_world()
# Create an instance of Example
example = Example("Code Counter")
# Print information about using the Code Line Counter
print("\nTo use the Code Line Counter tool:")
print("python code_counter.py path/to/file/or/directory")
print("python code_counter.py --chart -e .py .js .ts project_directory")
print("python code_counter.py -s files -x node_modules vendor project_directory")
print("python code_counter.py --csv report.csv project_directory")