Giter VIP home page Giter VIP logo

Comments (9)

graeme-winter avatar graeme-winter commented on August 30, 2024

Alt: return None or object

from dxtbx.

graeme-winter avatar graeme-winter commented on August 30, 2024

=> not really an API change... I think this is a good idea and would probably help (though we do have caching in there so it is not actually going back to spinning rust to check next time... I believe)

from dxtbx.

phyy-nx avatar phyy-nx commented on August 30, 2024

from dxtbx.

graeme-winter avatar graeme-winter commented on August 30, 2024

Anything derived from Format?

  _cache_controller = dxtbx.filecache_controller.simple_controller()
  @classmethod
  def get_cache_controller(cls):
    return cls._cache_controller

header of referenced class contains

# A shared caching layer for file-like objects.
# pseudo_file objects can be used as drop-in replacements for actual file
# handles to provide a transparent caching layer to avoid reading multiple
# times from disk or network.
#
# To create a pseudo_file instance, encapsulate a 'real' file handler
# inside a lazy cache object:
#   from dxtbx.filecache import lazy_file_cache
#   cache = lazy_file_cache(open(filename, 'rb'))
#
# Finally use a reference to the cache object to create one or many pseudo_file
# instances:
#   fh1 = cache.open()
#   from dxtbx.filecache import pseudo_file
#   fh2 = pseudo_file(cache) # equivalent
#   fh3 = pseudo_file(cache)
#   ...
#
# Each pseudo_file instance can then be treated as a proper read-only
# file handle, but will benefit from a shared cache:
#   with cache.open() as fh:
#     fh.read(100)
#     fh.readline()
#     fh.seek(500)
#     fh.read()
#     fh.readlines()
#     fh.close()
#
# To flush the cache and free the memory you can use
#     cache.close()
# This will drop the cache when all associated file handles are closed.
# To instantly drop the cache you can use
#     cache.force_close()
# Any further access attempts will then result in an exception.

from dxtbx.

graeme-winter avatar graeme-winter commented on August 30, 2024

It is true however that your mechanism could avoid re-parsing text in headers which would be a good thing

from dxtbx.

phyy-nx avatar phyy-nx commented on August 30, 2024

from dxtbx.

graeme-winter avatar graeme-winter commented on August 30, 2024

@Anthchirp can probably chip in here but I was under the impression that everything is using it - at least for regular formats (CBF, rayonix etc) - however it is buried under a load of metaclass witchcraft...

from dxtbx.

phyy-nx avatar phyy-nx commented on August 30, 2024

from dxtbx.

graeme-winter avatar graeme-winter commented on August 30, 2024

but return object or None could be a useful motif to keep anyways...

from dxtbx.

Related Issues (20)

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.