Code Monkey home page Code Monkey logo

pyfileclassparser's Introduction

Python based File Scanner

The main goal is to develop a file parser that will be configurable when it comes to different filetypes. Once could add a new file class and configure a number of regular expressions. The main idea was to create a configurable file parser that could scan source folders and provides a versatile statistics for a certain amount of file classes. The usual question was:

  • How much source code does this project contain?
  • How much scripting code does the project contain?

Contributers

  • Sebastian
  • Fredrik

How to use it

  • In order to scan several folders for files simply do the following:
    • Configure a number of file classes
    • Add the folders
    • Print results
	self.analysis.extAdd('source', ['.c', '.C', '.cc', '.h', '.CC', '.py'])
   self.analysis.extAdd('make', ['.in', '.am', '.mk'])
   self.analysis.extAdd('script', ['.sh'])
   self.analysis.extAdd('doc', ['.pdf', '.txt', '.doc'])
   self.analysis.extAdd('container', ['.tar.gz', '.zip'])

   self.folder = FileWalker(name='Broadcom SDK', pathToFolder='/pathToFolder')

   self.analysis.folderAdd(self.folder)

   print self.analysis

Classes

FileClass

  • simply stores the files which belong to a certain file class
  • internal data:
  • name (string)
  • files (list)
  • statistics (FileStatistics)

FileWalker

  • Holds all the files for a folder
  • Always initiated using a existing folder (relative or absolute)

Session

  • Stores the results for a folder that in turn could contain several file classes
  • provides functions like:
    • adding FileWalker objects for a folder
    • initiated with its own FileClass objects

FileStatistics

  • Object stores the following informatione
    • maxSize - biggest file attached
    • avgSize - average size of all attached files
    • minSize - smallest file
    • sumSize - total amount of bytes stored in files
    • numFiles - number of files found in that folder

pyfileclassparser's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.