Git Product home page Git Product logo

deduplify's People

Contributors

dependabot[bot] avatar pre-commit-ci[bot] avatar sgibson91 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

deduplify's Issues

Remove `/Users/${USER}` from filename

What's the problem?

The prefix /Users/${USER} is prepended to the filepaths that are saved in the JSON file. This means if we're running the hash process with the --restart flag in a different user account, the code does not actually skip the files that have already been hashed.

What needs to happen?

  • /Users/${USER} needs to be removed from the filepaths when they are saved. This can be saved to a variable in Python like so:
import os
exp_usr = os.path.expanduser("~")
  • Check the code can still read/move files without the expanded user section of the filepath, i.e., the paths still properly resolve.

Update to handle cases where the length of the filenames are equivalent

The following code blocks needs updating for cases where len(name_freq) > 1 && len(set(file_list)) == 1, i.e., there are multiple filepaths that are different, but by coincidence have the same length.

if len(name_freq) == 1:
file_list.remove(min(file_list, key=len))
return file_list
else:
raise ValueError(
f"The following filenames need investigation.\n{name_freq}\n{file_list}"
)

Fix GitHub Action to upload to Test PyPI in Pull Request

What's the problem?

Currently, the GitHub Action to publish the package to Test PyPI runs on every push to an open Pull Request against the main branch. This is problematic since, after the first push, a distribution exists on the Test PyPI server and subsequent pushes fail due to a naming clash.

What needs to happen?

The GitHub Action workflow needs to be tweaked so that multiple pushes to a PR does not break pushing distributions to Test PyPI. Maybe this could be manually triggered by a comment on the PR?

Minor improvement

Could this block:

# Add duplicate key to each document in the database indicating
# whether it is a duplicate or not
for k, v in counted_hashes.items():
if v == 1:
db.update({"duplicate": False}, where("hash") == k)
elif v > 1:
db.update({"duplicate": True}, where("hash") == k)

be better written as:

for k, v in counted_hashes.items(): 
    db.update({"duplicate": v > 1}, where("hash") == k) 

Is that valid Python?

Or maybe:

for k, v in counted_hashes.items(): 
    cond = v > 1
    db.update({"duplicate": cond}, where("hash") == k) 

This option would definitely work

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.