numenta / nupic-legacy

Numenta Platform for Intelligent Computing is an implementation of Hierarchical Temporal Memory (HTM), a theory of intelligence based strictly on the neuroscience of the neocortex.
http://numenta.org/
GNU Affero General Public License v3.0
6.33k stars 1.56k forks source link

Rename python files to follow python convention names (snake_case) #971

Closed david-ragazzi closed 6 years ago

david-ragazzi commented 10 years ago

snake_case is the default for python projects, but there're some names in non-compliance to this convention (files in /nupic, /examples, and /tests folders). Examples:

Using UpperCamelCase: nupic / nupic / algorithms / CLAClassifier.py nupic / nupic / research / TrivialPredictor.py

Missing _ for separate words: nupic / nupic / data / functionsource.py nupic / nupic / data / datasethelpers.py

Unknow achronyms: nupic / nupic / data / MCMC.py

These and other files names should be fixed to snake_case convention and if possible use more descriptive names.

david-ragazzi commented 10 years ago

Here we go the files that should be renamed.

I open every file to check its class names and functions in order to decide which is the more appropriate name (in my opinion) for it.

OldName -> new_name

nupic/algorithms:

nupic/data:

nupic/database:

nupic/encoders:

nupic/frameworks/opf/exp_generator => experiment_generator: (.tpl files are python files)

nupic/frameworks/opf/jsonschema => json_schema:

nupic/frameworks/opf:

nupic/math:

nupic/regions/ImageSensorExplorers => image_sensor_explorers:

nupic/regions/ImageSensorExplorers => image_sensor_filters:

nupic/regions/RecordSensorFilters => record_sensor_filters:

nupic/regions/extra:

nupic/regions:

nupic/research:

nupic/support/unittesthelpers => unit_test_helpers

nupic/support:

nupic/swarming/jsonschema => json_schema:

Important

We also have to replace the import statements from: from nupic.subfolder.oldName import... to this: from nupic.subfolder.new_name import ...

david-ragazzi commented 10 years ago

@rhyolight @subutai @scottpurdy @chetan51 @oxtopus Someone could say to me which folders/files above could be renamed without problems with serialization??

rhyolight commented 10 years ago

That is a legitimate request. Unfortunately, I don't know this.


Matt Taylor OS Community Flag-Bearer Numenta

On Wed, Jul 16, 2014 at 10:07 AM, David Ragazzi notifications@github.com wrote:

@rhyolight https://github.com/rhyolight @subutai https://github.com/subutai @scottpurdy https://github.com/scottpurdy @chetan51 https://github.com/chetan51 @oxtopus https://github.com/oxtopus Someone could say to me which folders/files above could be renamed without problems with serialization??

— Reply to this email directly or view it on GitHub https://github.com/numenta/nupic/issues/971#issuecomment-49196316.

subutai commented 10 years ago

@david-ragazzi This is a good question but unfortunately it is very hard to answer. I know that the swarming code is fine to change. Unfortunately Python pickling is very brittle, so any class that is recursively used by the serialized class is affected. I think we do have a serialization compatibility test somewhere. One way is to make sure we do changes that don't break that test. Ultimately the best way is to move away from pickling for our serialization.

david-ragazzi commented 10 years ago

Thank you, @subutai

@all: How about I rename the files that would NOT require a class renaming. For, example: scalarspace.py -> scalar_space.py InwardSweep.py -> inward_sweep.py

Surely this won't create problems with serialization as these changes involve only file renaming and update of import statements. This would decrease the list above until we implement the new serialization.

rhyolight commented 10 years ago

@david-ragazzi That seems like it would be fine.

rhyolight commented 8 years ago

Please review this issue

This issue needs to be reviewed by the original author or another contributor for applicability to the current codebase. The issue might be obsolete or need updating to match current standards and practices. If the issue is out of date, please close. Otherwise please leave a comment to justify its continuing existence. It may be closed in the future if no further activity is noted.