Skip to content

Reviews notes

Thor Whalen edited this page Jan 28, 2020 · 3 revisions

Jan 28 2020 - Session notes

projects that use "class Meta"

Techniques

Mapping adapter definitions

  • Audience: Data scientist / data engineer

Mappings consist

Example

class FilenameMapper(Translator):
    def private(self, public, context):
        # filename -> full path
        return os.path.join(context.base, public)

    def public(self, private, context):
        return os.path.relative(...)


class MyKVStore(KVStore):
    class Meta:
        store = FilesystemStore("/path/to/something")
        keys = FilenameMapper()
        values = TextMapper(encoding="utf8")


print(MyKVStore)
# MyKVStore(store=<default>


class MoreComplex(KVStore):
    class Meta:
        store = ....
        keys = SpecialisedKeyValueTransformer(store)
        values = keys.valuetranformer()

Thor

def wrap_kvs(
  store, name, *,
  key_of_id=None, id_of_key=None, obj_of_data=None, data_of_obj=None, postget=None)
class MyStore(Store):
  def _id_of_key(self, k):
    return _id

Sep 25 2019 - Session notes

Projects:

Issues / subjects

  • Sense of a feature not fitting with the architecture
  • Pythonic API design?

links

Tools

Thor's scrap

  def __contains__(self, k) -> bool:
      return self.store.__contains__(self._id_of_key(k))