Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ashkan0201/ashcount

A set of things that can be done with files. For example, finding the number of lines in a file Find the number of words Find the net code count of a Python file And ...
https://github.com/ashkan0201/ashcount

documentation python3 testing

Last synced: about 1 month ago
JSON representation

A set of things that can be done with files. For example, finding the number of lines in a file Find the number of words Find the net code count of a Python file And ...

Awesome Lists containing this project

README

        

# ashcount

**This package helps you to get some information from the files.**

- Find the number of lines in a file
- Find the number of original lines in a file
- Find the word count of a file
- Find the number of codes in a Python file
- Find the net code count of a Python file
- Find the number of comments in a Python file

You can find the above items using this package.

## How to use modules
It is very easy to use modules, now we will give some examples.
The output will be a number in all modes.

```bash
pip install ashcount
```

First, we import the `ashcount` from `ashcount`
```python
from ashcount import ashcount
```

The files you use for it must have their addresses to avoid problems!
```python
Txt_file_address = 'example.txt'
Python_file_address = 'example.py'
```

For example, to find the number of `lines` in a `txt` file.
```python
print(ashcount.counter.line_counter(path=Txt_file_address))
```

To get the number of `main lines` of a `txt` file.

In this section, we do not consider `lines` that are empty or only have extra spaces.
```python
print(ashcount.counter.counting_main_lines(path=Txt_file_address))
```

To find the number of `words` in a `txt` file.
```python
print(ashcount.counter.word_count(path=Txt_file_address))
```

For the part where you want to work with `Python` files, you must import `ashcount` from `ashcount`.
```python
from ashcount import ashcount
```

And also to find the number of `codes` in a `python` file.
```python
print(ashcount.py_counter.python_line_count(path=Python_file_address))
```

To find the net number of `codes` in a `Python` file.

In this section, we do not consider `comments` and `lines` that do not have any code, and we will give you the net number of a code.
```python
print(ashcount.py_counter.pure_python_code(path=Python_file_address))
```

And finally, to find the number of `comments` in a `Python` file.
```python
print(ashcount.py_counter.python_comment_count(path=Python_file_address))
```

## Ways of communication

Contact me in case of problems.

- [email protected]
- [github](https://github.com/ashkan0201)