Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement a Field class similar to fields in Django, Marshmallow and DRF #68

Merged
merged 16 commits into from Oct 31, 2016

Commits on Oct 14, 2016

  1. implement a Field class similar to fields in Django, Marshmallow and DRF

    * should resolve BreakingBytes#9 Fields layer (altho not really a layer)
    * add Field base class to core
    * add test_field to test_core to see if a class constructor works
    * add new test_fields to carousel.tests to try to make a data class using fields
    mikofski committed Oct 14, 2016
    Copy the full SHA
    d3f8315 View commit details
    Browse the repository at this point in the history
  2. refactor as Parameter class instead of Field

    * consistent with parameters in each layer
    * subclass to dict, easier than trying to reimplement dict, or change a lot of code, since all of the layers are already expecting parameters to be a dictionary
    * do not create any attributes in Parameter, only dictionary items (if this changes later, make sure not to clash with members already defined in dict)
    * add __repr__ method since dictionary is ugly
    * add extras to collect items not in attributes (metadata)
    * fix test_fields in test_core to use __getitem__ since it's a dict, instead of __getattribute__, aka getattr() as if it were an object class only
    * fix comparison of velocity data elapsed_time was using wrong key for assertion comparison.
    mikofski committed Oct 14, 2016
    Copy the full SHA
    aba70dd View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2016

  1. fix data reader tests with new 'extra' key

    * use DataParameter in tests
    * use [f for f in get_fields(include_parents=False) if not f.auto_created)] to filter out auto created and related fields
    * so don't need to import AutoField
    * finally complete todo's in registry, just generate reg attrs from meta_names, can remove __init__(self) from most layers
    * allow _private meta-names, why not?
    * update docs
    * in CommonBase set_param_file_or_parameters() only get Parameters
    * add DataParameter class in data_sources and FormulaParameter to formulas
    * remove test_field from test_core
    mikofski committed Oct 16, 2016
    Copy the full SHA
    9950336 View commit details
    Browse the repository at this point in the history
  2. update registries, remove __init__, add docstrings for metadata

    * add layer parameter classes, set _attrs
    * if calc dependency is string, make it a list
    * convert unc to percent
    * remove field todo's in outputs
    mikofski committed Oct 16, 2016
    Copy the full SHA
    d95b4f2 View commit details
    Browse the repository at this point in the history
  3. fix xlrd reader and test to use DataParameter

    * address BreakingBytes#43 all readers use same format
    * update docs a little
    * also have to fix apply units to cached data
    * fix param_file must apply DataParameter to each item
    * all test_data passsing! but need to add test for cached data!
    mikofski committed Oct 16, 2016
    Copy the full SHA
    80fc320 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    48654e0 View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2016

  1. add meta attr to formulas and formula importer base class

    * meta is Meta class, so module, package and path are attributes of it, not items
    mikofski committed Oct 17, 2016
    Copy the full SHA
    dad883b View commit details
    Browse the repository at this point in the history
  2. separate formulas, use Meta and FormulaParameter

    * closes BreakingBytes#64 - formulas are separated, no more formula keyword, all formulas are in parameters
    * addresses BreakingBytes#62 - formulas use Meta for module, package and path
    * adresses BreakingBytes#40 - very similar to BreakingBytes#62, but now formulas has Meta too
    * closed BreakingBytes#6 - use meta_names to instantiate attributes for registries, this actually already happened in a recent commit
    * extract Meta from parameter files if it's there using type("Meta", (), file_params.pop('Meta')) pretty easy
    * read in formulas from param file as FormulaParameters instead of just dictionaries
    * fix some of the pvpower example files: newstyle model and formula json files
    mikofski committed Oct 17, 2016
    Copy the full SHA
    4694f16 View commit details
    Browse the repository at this point in the history
  3. move formulas_importer to class Meta

    * remove formulas base constant _importer_attr, don't pop importer and don't set it
    * in Formula, remove class formula importer class attribute, then check _meta for importer, and if None, set it to PyModuleImporter
    * now formula importer is in _meta
    * update tests in test_formula()
    * in expression importer, 'expression' is in ['extras']
    mikofski committed Oct 17, 2016
    Copy the full SHA
    e3c0483 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    7a57ea8 View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    850c6a8 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2016

  1. Copy the full SHA
    f063e42 View commit details
    Browse the repository at this point in the history
  2. add settings argument to simulations

    * this is a HACK! need to get simulations to work with parameters, but to much work to implement BreakingBytes#71
    * sim parameter attributes are the simulation arguments
    * settings arg used to select which set of sim args to use, if not given use first.
    * update test_sim PythagorasSim() and Sandia_perfmod_newstyle
    mikofski committed Oct 18, 2016
    Copy the full SHA
    0911643 View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2016

  1. use OutputParameter

    * convert outputs param file to dict of OutputParameter
    * convert simulation param file to SimParameter settings, use file name minus extension for settings name
    * deprecated sim attributes will be in extras
    * update tests and sandia_perfmod_newstyle with OutputParameter and SimParameter
    mikofski committed Oct 19, 2016
    Copy the full SHA
    47ee88f View commit details
    Browse the repository at this point in the history
  2. really heinous hacks to close BreakingBytes#9

    * fix uncertainty static calc conversion to percent is multiply by 100 (NOT divide st00pid)
    * don't use CalcParameter yet, too much work, but leave it partially implemented, instead fake parameters in the constructor by getting the class attributes
    * for test calc metaclass to pass, compare test1 to test2 instead of vv, since test 2 now has extra fields that are set by default, like "dynamic": [], that test1 doesn't have
    * fix c_unc in comparison, array is unnecessary, get float64 using item(), since only one value
    mikofski committed Oct 19, 2016
    Copy the full SHA
    50b94d2 View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2016

  1. remove comment with link to Django snippet 1040

    * the snippet was removed since it's now obsolete - the new Django Meta
     o\Options API has new methods, _eg_: `get_fields()`, to get fields, to
     filter out parent, autogenerated and reverse fields from a model
    * add new comment that links to new Django Meta Options API
    mikofski committed Oct 31, 2016
    Copy the full SHA
    f9b396e View commit details
    Browse the repository at this point in the history