<commit_before>
                         
   BACKBONE-RELATIONAL   
                         


VERSION ==>                       #0.9.0

Backbone.RelationalModel          #RMODEL_CTOR. Child of MODEL_CTOR
                                  #Interactions are local???
                                  #Only interactions with server: MODEL.fetch() called by getAsync()???
                                  #toJSON(): include population

RMODEL.relations                  #REL_ARR:
                                  #  - key "VAR", relatedModel RMODEL_CTOR2 (def: RMODEL_CTOR), type "HasOne|HasMany":
                                  #     - means RMODEL.VAR contains RMODEL2.ID (where ID is RMODEL.idAttribute):
                                  #        - RMODEL.VAR will contain RMODEL2, i.e.:
                                  #           - RMODEL.get("VAR")->RMODEL2
                                  #           - RMODEL.set("VAR", ATTR_OBJ|RMODEL2[.ID]):
                                  #              - including at instantiation
                                  #              - updates RMODEL2 too
                                  #              - ATTR_OBJ only possible if REL.createModels true (def), in which case it 
                                  #                creates a new RMODEL2
                                  #              - except with ATTR_OBJ, populating RMODEL2 requires it has instantiated
                                  #                client-side (thanks to global STORE which register all new RMODEL2)
                                  #                 - if not instantiated yet, RMODEL.get("VAR")->null, but reference is kept
                                  #                   and will work when RMODEL2 is instantiated
                                  #                 - to fetch from server, use RMODEL.getAsync()
                                  #              - fires events:
                                  #                 - change[:*] only on RMODEL2
                                  #                 - relational:change:VAR(RMODEL2, VAL[, OBJ]) on RMODEL
                                  #              - if REL.parse true (def: false), use MODEL.parse() before setting
                                  #     - if "HasMany", means RMODEL.VAR is an RMODEL2_ARR
                                  #        - must specify collectionType COLL_CTOR2 (def: Backbone.Collection)
                                  #        - REL.collectionKey "VAR3"??? (def: REL2.VAR2)
                                  #        - fires events relational:add|remove:VAR(RMODEL2, COLL2) when ARR gets new|less elements
                                  #        - RMODEL.set() can use OBJ.add|merge|remove like COLL.set()???
                                  #  - reverseRelation REL2:
                                  #     - inverse, i.e. means RMODEL2.VAR2 contains RMODEL.id (or any RMODEL.idAttribute)
                                  #     - type def will be the inverse, relatedModel def will RMODEL
                                  #     - REL2.type cannot be "HasMany" if RMODEL.type "HasMany"
                                  #       To support many-to-many must use a third REMODEL3 (join table)
                                  #     - when RMODEL[2].VAR[2] is updated, the other RMODEL[2].VAR[2] is as well
                                  #     - also has attributes:
                                  #        - includeInJSON BOOL|"VAR"[_ARR]: includes RMODEL2.VAR in RMODEL.toJSON()
                                  #          (if true (def): all VAR, false: none)
                                  #        - can be on REL too???
                                  #     - collectionOptions OBJ: passed to new COLL_CTOR() OBJ
                                  #  - keySource "VAR3": means will use RMODEL2.VAR2 in RMODEL.toJSON(), but RMODEL2.VAR3
                                  #    otherwise
                                  #  - keyDestination "VAR3" (def: same as keySource if specified): means will use 
                                  #    RMODEL.VAR3 in RMODEL.toJSON(), but RMODEL.VAR3 otherwise
                                  #  - subModelTypes { STR: RMODEL_CTOR3 ... }:
                                  #     - means RMODEL instances with RMODEL.ATTR STR will be RMODEL3 instances instead, where
                                  #       RMODEL3 is a child of RMODEL
                                  #     - ATTR is REL.subModelTypeAttribute (def: "type")
                                  #     - used for OO-relational model (single relation, but different possible types with
                                  #       different attributes)
                                  #RMODEL_CTOR[2|3] and COLL_CTOR2 can be STR:
                                  #  - they are resolved compared to WINDOW
                                  #  - can add scope to compare with thanks to STORE.add|RemoveModelScope(OBJ)
RMODEL.getAsync("VAR"[, OBJ])     #Calls RMODEL2.fetch(OBJ):
                                  #  - once per RMODEL2, unless RMODEL.collectionType COLL:
                                  #     - do single request if RMODEL.collectionType COLL, and COLL.url specified
                                  #       - can specify COLL.url(RMODEL_ARR)->URL to differentiate URL when whole COLL of just
                                  #         few RMODELs??? 
                                  #  - does not call for RMODEL2 already instantiated, unless OBJ.refresh true
                                  #Then returns RMODEL.VAR as a jQuery PROMISE
                                  #Only called manually or during RMODEL construction if REL.autoFetch true|OBJ (def: false)
RMODEL.getIdsToFetch("VAR"[,BOOL])#Returns ARR of all RMODEL.VAR.id. If false (def), only ones that are not instantiated yet.

COFFEESCRIPT ==>                  #When using in CoffeeScript:
                                  #  class RMODEL_CTOR extends RMODEL_CTOR2
                                  #instead of:
                                  #  var RMODEL_CTOR = RMODEL_CTOR2.extend(...)
                                  #Must call just afterwards RMODEL_CTOR.setup()


																						 /=+===============================+=\ 
																						/  :                               :  \  
							 														  )==:            DETAILS            :==(   
																						\  :_______________________________:  /    
																						 \=+===============================+=/


RMODEL.getRelations()             #Returns REL2_ARR
RMODEL.getRelation("VAR")         #Returns REL2


Backbone.Relational.store         #STORE. Global object containing references to all RMODEL (as COLLs according to 
                                  #collectionType), so that they can be queried when another model is populating.
STORE.find
(RMODEL_CTOR, ATTR_OBJ|id|cid)    #Basically calls COLL.get(id|cid|ATTR_OBJ.id)
STORE.unregister
(RMODEL[_CTOR]|COLL)
STORE.reset()                     #Removing from cache makes relations not usable anymore.

RMODEL_CTOR.build(...)            #Similar to new RMODEL_CTOR(...)
RMODEL_CTOR.findModel             
(ATTR_OBJ|id|cid)                 #Proxies to STORE.find(). Can override it.
RMODEL_CTOR.findOrCreate          #Calls findModel() then:
(ATTR_OBJ|id|cid[, OBJ2])         #  - if not found and OBJ2.create true (def), creates it with RMODEL_CTOR.build(...)
                                  #  - updates with RMODEL.set(...) if found and OBJ2.merge true (def)
                                  #  - MODEL.parse() is used if OBJ2.parse true (def: false), with this not pointing to MODEL
RMODEL_CTOR.find(...)             #Same with OBJ2.create false

<commit_msg>no commit message<commit_after>
                         
   BACKBONE-RELATIONAL   
                         


VERSION ==>                       #0.9.0

Backbone.RelationalModel          #RMODEL_CTOR. Child of MODEL_CTOR
                                  #Interactions are local???
                                  #Only interactions with server: MODEL.fetch() called by getAsync()???
                                  #toJSON(): include population

RMODEL.relations                  #REL_ARR:
                                  #  - key "VAR", relatedModel RMODEL_CTOR2 (def: RMODEL_CTOR), type "HasOne|HasMany":
                                  #     - means RMODEL.VAR contains RMODEL2.ID (where ID is RMODEL.idAttribute):
                                  #        - RMODEL.VAR will contain RMODEL2, i.e.:
                                  #           - RMODEL.get("VAR")->RMODEL2
                                  #           - RMODEL.set("VAR", ATTR_OBJ|RMODEL2[.ID]):
                                  #              - including at instantiation
                                  #              - updates RMODEL2 too
                                  #              - ATTR_OBJ only possible if REL.createModels true (def), in which case it 
                                  #                creates a new RMODEL2
                                  #              - except with ATTR_OBJ, populating RMODEL2 requires it has instantiated
                                  #                client-side (thanks to global STORE which register all new RMODEL2)
                                  #                 - if not instantiated yet, RMODEL.get("VAR")->null, but reference is kept
                                  #                   and will work when RMODEL2 is instantiated
                                  #                 - to fetch from server, use RMODEL.getAsync()
                                  #              - fires events:
                                  #                 - change[:*] only on RMODEL2
                                  #                 - relational:change:VAR(RMODEL2, VAL[, OBJ]) on RMODEL
                                  #              - if REL.parse true (def: false), use MODEL.parse() before setting
                                  #     - if "HasMany", means RMODEL.VAR is an RMODEL2_ARR
                                  #        - must specify collectionType COLL_CTOR2 (def: Backbone.Collection)
                                  #        - REL.collectionKey "VAR3"??? (def: REL2.VAR2)
                                  #        - fires events relational:add|remove:VAR(RMODEL2, COLL2) when ARR gets new|less elements
                                  #        - RMODEL.set() can use OBJ.add|merge|remove like COLL.set()???
                                  #  - reverseRelation REL2:
                                  #     - inverse, i.e. means RMODEL2.VAR2 contains RMODEL.id (or any RMODEL.idAttribute)
                                  #     - type def will be the inverse, relatedModel def will RMODEL
                                  #     - REL2.type cannot be "HasMany" if RMODEL.type "HasMany"
                                  #       To support many-to-many must use a third REMODEL3 (join table)
                                  #     - when RMODEL[2].VAR[2] is updated, the other RMODEL[2].VAR[2] is as well
                                  #     - also has attributes:
                                  #        - includeInJSON BOOL|"VAR"[_ARR]: includes RMODEL2.VAR in RMODEL.toJSON()
                                  #          (if true (def): all VAR, false: none)
                                  #        - can be on REL too???
                                  #     - collectionOptions OBJ: passed to new COLL_CTOR() OBJ
                                  #  - keySource "VAR3": means will use RMODEL2.VAR2 in RMODEL.toJSON(), but RMODEL2.VAR3
                                  #    otherwise
                                  #  - keyDestination "VAR3" (def: same as keySource if specified): means will use 
                                  #    RMODEL.VAR3 in RMODEL.toJSON(), but RMODEL.VAR3 otherwise
                                  #  - subModelTypes { STR: RMODEL_CTOR3 ... }:
                                  #     - means RMODEL instances with RMODEL.ATTR STR will be RMODEL3 instances instead, where
                                  #       RMODEL3 is a child of RMODEL
                                  #     - ATTR is REL.subModelTypeAttribute (def: "type")
                                  #     - used for OO-relational model (single relation, but different possible types with
                                  #       different attributes)
                                  #RMODEL_CTOR[2|3] and COLL_CTOR2 can be STR:
                                  #  - they are resolved compared to WINDOW
                                  #  - can add scope to compare with thanks to STORE.add|RemoveModelScope(OBJ)

RMODEL.getAsync("VAR"[, OBJ])     #Fetches RMODEL.VAR from the server: 
                                  #  - if REL.type "HasMany", REL.collectionType COLL_CTOR and COLL.url(RMODEL2[_ID]_ARR)->URL specified, 
                                  #    COLL.fetch(OBJ) once, with OBJ.url URL
                                  #     - COLL.url() must still work
                                  #     - for COLL.url(RMODEL2_ARR) to work, COLL.url(RMODEL2_ID_ARR) must return same as COLL.url()
                                  #  - otherwise RMODEL2.fetch(OBJ) once per RMODEL2, in which case, RMODEL2.urlRoot must be defined
                                  #  - does not call for RMODEL2 already instantiated, unless OBJ.refresh true
                                  #Then returns RMODEL.VAR as a jQuery PROMISE
                                  #Only called manually or during RMODEL construction (not RMODEL2 construction) if REL.autoFetch true|OBJ (def: false)
RMODEL.getIdsToFetch("VAR"[,BOOL])#Returns ARR of all RMODEL.VAR.id. If false (def), only ones that are not instantiated yet.

COFFEESCRIPT ==>                  #When using in CoffeeScript:
                                  #  class RMODEL_CTOR extends RMODEL_CTOR2
                                  #instead of:
                                  #  var RMODEL_CTOR = RMODEL_CTOR2.extend(...)
                                  #Must call just afterwards RMODEL_CTOR.setup()


																						 /=+===============================+=\ 
																						/  :                               :  \  
							 														  )==:            DETAILS            :==(   
																						\  :_______________________________:  /    
																						 \=+===============================+=/


RMODEL.getRelations()             #Returns REL2_ARR
RMODEL.getRelation("VAR")         #Returns REL2


Backbone.Relational.store         #STORE. Global object containing references to all RMODEL (as COLLs according to 
                                  #collectionType), so that they can be queried when another model is populating.
STORE.find
(RMODEL_CTOR, ATTR_OBJ|id|cid)    #Basically calls COLL.get(id|cid|ATTR_OBJ.id)
STORE.unregister
(RMODEL[_CTOR]|COLL)
STORE.reset()                     #Removing from cache makes relations not usable anymore.

RMODEL_CTOR.build(...)            #Similar to new RMODEL_CTOR(...)
RMODEL_CTOR.findModel             
(ATTR_OBJ|id|cid)                 #Proxies to STORE.find(). Can override it.
RMODEL_CTOR.findOrCreate          #Calls findModel() then:
(ATTR_OBJ|id|cid[, OBJ2])         #  - if not found and OBJ2.create true (def), creates it with RMODEL_CTOR.build(...)
                                  #  - updates with RMODEL.set(...) if found and OBJ2.merge true (def)
                                  #  - MODEL.parse() is used if OBJ2.parse true (def: false), with this not pointing to MODEL
RMODEL_CTOR.find(...)             #Same with OBJ2.create false


{'fraction_non_alphanumeric': 0.1160048869883934, 'fraction_numerical': 0.00739156994502138, 'mean_word_length': 1.1349765258215962, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 218, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1087550', 'n_tokens_mistral': 5989, 'n_tokens_neox': 5651, 'n_words': 1091}