GithubHelp home page GithubHelp logo

Headers parameter in find about pyorthanc HOT 3 CLOSED

jrkerns avatar jrkerns commented on July 28, 2024
Headers parameter in find

from pyorthanc.

Comments (3)

gacou54 avatar gacou54 commented on July 28, 2024 1

Fix in #17 . Added to the lasted release PyOrthanc 1.11.5.

from pyorthanc.

gacou54 avatar gacou54 commented on July 28, 2024

Hi @jrkerns,

Absolutely, that would be a great addition.
I am thinking to pass an Orthanc object instead of the server information.

Something like that:

def find(orthanc: Orthanc, patient_filter, ....):

from pyorthanc.

jrkerns avatar jrkerns commented on July 28, 2024

Well, it's your lib so you can do what you want, but in my experience top-level functions usually take primitives only in their parameters. E.g. the user will always have to do:

orthanc = Orthanc(...)
results = find(orthanc, ...)

which seems wordy, but it's mostly an aesthetic problem to me.

Another approach would be to simply make find a method of the Orthanc instance. So

orthanc = Orthanc(...)
orthanc.find(...)

That's my favorite solution, but know I have a bias for classes 😄

I see you have async options as well. In theory, you could keep the best of both worlds and still have a top level function per your suggestion and then use that in your method. Assuming the solution you proposed you can also do:

from pyorthanc import find


class Orthanc:

     def find(self, ....):
           return find(self, ...)

class AsyncOrthanc:

    def find(self, ...):
          yield find(self, ...)

I'm not an async guy so forgive the async simplification.

from pyorthanc.

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.