Coder Social home page Coder Social logo

Comments (7)

cgte avatar cgte commented on August 16, 2024 1

Hello, the split ext should do the work fine.
I sent you the https://ybin.me/p/6056cb919b7ac01d#6TUJO4V8Zwcwg7fuL+g8znLANqG0SQCvKxlh5hll94w= pastebin on linkedin.
Here your code is doing too much :
https://github.com/victordomingos/Count-files/blob/master/countfiles/utils/file_handlers.py#L11
you should use your helper to return the extension and let upper function decide if they process or not files with falsee extensions.

from count-files.

cgte avatar cgte commented on August 16, 2024 1

Yes but, matter of fact you do not need a "has_extension" method.
This is the kind of method you will not use that much in other parts of the code, you could simply test if extension is 'truee' or falsee and that's it. if you really wand to have this, make it a property.

extension = file.extension
if extension: 
   do stufff

# Is better than
if file.has_extention:
    extension = file.extension

Because if the code is : has_extention = bool(get_extention) then is it almost useless, and if the code differs it can be error-prone since you do not compare the same thing.

from count-files.

NataliaBondarenko avatar NataliaBondarenko commented on August 16, 2024

I agree, we must do it. The parser does not process this parameter. But the user can search for files without an extension.

from count-files.

NataliaBondarenko avatar NataliaBondarenko commented on August 16, 2024

By the way, can we ask potential users their opinion on the actual parser functionality?
(something add, change, optimize). For example, in the Python Сommunity
It is possible to create a free chat for the project (add a link to Readme.md). Log in with GitHub and write. Gitter

from count-files.

victordomingos avatar victordomingos commented on August 16, 2024

Asking for feedback or even some user testing to help spot issues not found during development is fine. I wouldn’t start a chat room at this time for a project like this, though. I prefer to keep the discussion of features and bugs inside the issues section on GutHub. That way we have everything in one place.

But I see no problem in asking also informally in social media and then open issues for relevant suggestions and bugs mentioned elsewhere.

from count-files.

victordomingos avatar victordomingos commented on August 16, 2024

@cgte Nice work, very concise code, with a very different approach. I just think that it's not as readable (at least from my perspective). Having said that, my code is in fact needing a global cleanup. ;-)

You are right about get_file_extension() doing too much. I just needed to write a has_extension()function that could very well be replaced by a slightly simpler get_file_extension(). I will have to merge those two functions soon.

from count-files.

victordomingos avatar victordomingos commented on August 16, 2024

@cgte, I think I get your point. My intention with has_extension() was to enable slightly shorter and more readable expressions (like in if clauses), but it was more of a quick way for me to better understand what I was writing in the upper function. I have meanwhile merged those two functions (has_extension() and get_file_extension()) into a single get_file_extension() that returns an empty (falsy) string when there is no extension.

Since we are not using a class for single files, I am not sure if you could/should make it a property.

I will be thankful if you could take another look and see the changes I made in this respect. Any further suggestions for improvement are always welcome.

from count-files.

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.