This adds more accurate utils for generating a snowflake from datetime. #91

Open
JDJGInc wants to merge 18 commits from JDJGInc/2.0 into 2.0
JDJGInc commented 2021-10-04 13:49:46 +00:00 (Migrated from github.com)

Summary

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)
<!-- Pull requests that do not fill this information in will likely be closed --> ## Summary <!-- What is this pull request for? Does it fix any issues? --> ## Checklist <!-- Put an x inside [ ] to check it, like so: [x] --> - [ ] If code changes were made then they have been tested. - [ ] I have updated the documentation to reflect the changes. - [ ] This PR fixes an issue. - [x] This PR adds something new (e.g. new method or parameters). - [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed) - [ ] This PR is **not** a code change (e.g. documentation, README, ...)
JDJGInc commented 2021-10-04 13:50:26 +00:00 (Migrated from github.com)

generates this in docs:
image

generates this in docs: ![image](https://user-images.githubusercontent.com/22802640/135863254-f959608e-5ee5-4572-b4e2-c92b694ffc6e.png)
JDJGInc commented 2021-10-04 18:07:42 +00:00 (Migrated from github.com)

Should I have it still return int or do an object ?

Should I have it still return int or do an object ?
JDJGInc commented 2021-10-05 02:18:22 +00:00 (Migrated from github.com)

I tested the code, I just need docs to look better.

I tested the code, I just need docs to look better.
JDJGInc commented 2021-10-05 02:19:06 +00:00 (Migrated from github.com)

image
I just need to update the doc string a bit

![image](https://user-images.githubusercontent.com/22802640/135949959-2e206f4f-682f-4ccb-a611-801e3453c60a.png) I just need to update the doc string a bit
Gnome-py commented 2021-10-27 13:01:50 +00:00 (Migrated from github.com)

Can you remove the unrelated changes? Seems like you ran black without specifying line length.

Can you remove the unrelated changes? Seems like you ran black without specifying line length.
JDJGInc commented 2021-10-27 13:05:05 +00:00 (Migrated from github.com)

black did it automatically for whatever reason.

black did it automatically for whatever reason.
JDJGInc commented 2021-10-27 13:17:50 +00:00 (Migrated from github.com)

I have fixed the issue, now. :D

I have fixed the issue, now. :D
Gnome-py commented 2021-10-27 13:20:18 +00:00 (Migrated from github.com)

Why have generate_snowflake and time_snowflake?

Why have ``generate_snowflake`` and ``time_snowflake``?
JDJGInc commented 2021-10-27 13:21:19 +00:00 (Migrated from github.com)

Both appear in docs because well, I have a feeling some might want to use both.

Both appear in docs because well, I have a feeling some might want to use both.
JDJGInc commented 2021-10-27 13:21:37 +00:00 (Migrated from github.com)

I will gladly remove Danny's one from docs if you want.

I will gladly remove Danny's one from docs if you want.
Gnome-py commented 2021-10-27 13:23:11 +00:00 (Migrated from github.com)

I don't mean from the docs, I mean what is the point of having both functions at all? generate_snowflake seems to say in the docstring it is just better time_snowflake

I don't mean from the docs, I mean what is the point of having both functions at all? generate_snowflake seems to say in the docstring it is just better time_snowflake
JDJGInc commented 2021-10-27 13:57:41 +00:00 (Migrated from github.com)

time_snowflake is required by danny's functions, my function just tends to be more accurate to the datetime when creating an id.

time_snowflake is required by danny's functions, my function just tends to be more accurate to the datetime when creating an id.
JDJGInc commented 2021-10-27 13:58:58 +00:00 (Migrated from github.com)

removed time_snowflake from docs, as it needs to use this internally, but my function should be more accurate for user purposes.

removed time_snowflake from docs, as it needs to use this internally, but my function should be more accurate for user purposes.
JDJGInc commented 2021-10-27 22:25:26 +00:00 (Migrated from github.com)

I don't mean from the docs, I mean what is the point of having both functions at all? generate_snowflake seems to say in the docstring it is just better time_snowflake

This is only due to tests in the discord api guild to show it's more accurate, if you look for the discussion you should see it, it should be accurate, however Discord.py still uses danny's function internally, so I removed the docs for the function that Danny made, however people can still use the one i made.

> I don't mean from the docs, I mean what is the point of having both functions at all? generate_snowflake seems to say in the docstring it is just better time_snowflake This is only due to tests in the discord api guild to show it's more accurate, if you look for the discussion you should see it, it should be accurate, however Discord.py still uses danny's function internally, so I removed the docs for the function that Danny made, however people can still use the one i made.
JDJGInc commented 2021-10-27 22:27:18 +00:00 (Migrated from github.com)

the problem with that is that the library uses time_snowflake internally.
with the discord.iterators file, so both will need to exist.
My function however is better for users wanting to make snowflake ids from the current time.

the problem with that is that the library uses time_snowflake internally. with the discord.iterators file, so both will need to exist. My function however is better for users wanting to make snowflake ids from the current time.
IAmTomahawkx commented 2021-10-28 00:13:54 +00:00 (Migrated from github.com)

Unless you can replace the original function I don't see the value in keeping what is essentially a duplicate function.

Unless you can replace the original function I don't see the value in keeping what is essentially a duplicate function.
JDJGInc commented 2021-10-28 00:30:17 +00:00 (Migrated from github.com)

Unless you can replace the original function I don't see the value in keeping what is essentially a duplicate function.

This is more accurate than danny's function, the library just happens to need Danny's function to work properly, however my function is more useful for user side generation of snowflakes.

> Unless you can replace the original function I don't see the value in keeping what is essentially a duplicate function. This is more accurate than danny's function, the library just happens to need Danny's function to work properly, however my function is more useful for user side generation of snowflakes.
This pull request can be merged automatically.
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin JDJGInc/2.0:JDJGInc/2.0
git checkout JDJGInc/2.0
Sign in to join this conversation.
No description provided.