Skip to content

Functions for getting naming statistics in python projects at given paths

License

Notifications You must be signed in to change notification settings

DeadMor0z/pynamestats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pynamestats

Functions for getting naming statistics in python projects at given path

  • get_all_names(path) - get all names in python files in a path
  • get_top_names(path, top_size=10) - get top names in python files in a path
  • get_all_function_names(path) - get all function names in python files in a path
  • get_top_function_names(path, top_size=10) - get top function names in python files in a path
  • get_top_function_verbs(path, top_size=10) - get top verbs in function names in python files in a path

Code example

import os, collections
from pynamestats import get_top_function_verbs

words = []
projects = [
    'django',
    'flask',
    'pyramid',
    'reddit',
    'requests',
    'sqlalchemy',
]

for project in projects:
    path = os.path.join('.', project)
    words += get_top_function_verbs(path)

top_size = 200
print('total %s words, %s unique' % (len(words), len(set(words))))
for word, occurence in collections.Counter(words).most_common(top_size):
    print(word, occurence)

About

Functions for getting naming statistics in python projects at given paths

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages