mirror of
https://github.com/iv-org/invidious.git
synced 2026-11-03 02:17:16 +00:00
chore: remove unused functions .ci_lower_bound() and .elapsed_text() (#6110)
Closes https://github.com/iv-org/invidious/issues/5898 Removes `.ci_lower_bound` and `.elapsed_text` as they are not used. According to `crysta tool unreachable ./src/invidious.cr` you get this unused functions: ``` src/invidious/channels/channels.cr:87:3 ChannelVideo#to_xml 5 lines src/invidious/database/migrator.cr:25:3 Invidious::Database::Migrator#pending_migrations? 6 lines src/invidious/helpers/serialized_yt_data.cr:75:3 SearchVideo#to_xml 5 lines src/invidious/helpers/serialized_yt_data.cr:140:3 SearchVideo#to_json 5 lines src/invidious/helpers/serialized_yt_data.cr:146:3 SearchVideo#to_json 3 lines src/invidious/helpers/serialized_yt_data.cr:208:3 SearchPlaylist#to_json 5 lines src/invidious/helpers/serialized_yt_data.cr:214:3 SearchPlaylist#to_json 3 lines src/invidious/helpers/serialized_yt_data.cr:264:3 SearchChannel#to_json 5 lines src/invidious/helpers/serialized_yt_data.cr:270:3 SearchChannel#to_json 3 lines src/invidious/helpers/serialized_yt_data.cr:367:3 Category#to_json 5 lines src/invidious/helpers/serialized_yt_data.cr:373:3 Category#to_json 3 lines src/invidious/helpers/utils.cr:4:1 ::ci_lower_bound 11 lines src/invidious/helpers/utils.cr:16:1 ::elapsed_text 6 lines src/invidious/http_server/static_assets_handler.cr:119:5 Invidious::HttpServer::StaticAssetsHandler.clear_cache 4 lines src/invidious/playlists/playlists.cr:45:3 PlaylistVideo#to_xml 3 lines src/invidious/playlists/playlists.cr:80:3 PlaylistVideo#to_json 3 lines src/invidious/playlists/playlists.cr:238:3 InvidiousPlaylist#author_thumbnail 3 lines src/invidious/user/preferences.cr:85:5 Preferences::BoolToString.to_yaml 3 lines src/invidious/user/preferences.cr:89:5 Preferences::BoolToString.from_yaml 16 lines src/invidious/user/preferences.cr:116:5 Preferences::ClampInt.to_yaml 3 lines src/invidious/user/preferences.cr:120:5 Preferences::ClampInt.from_yaml 3 lines src/invidious/user/preferences.cr:178:5 Preferences::ProcessString.to_yaml 3 lines src/invidious/user/preferences.cr:182:5 Preferences::ProcessString.from_yaml 3 lines src/invidious/user/preferences.cr:209:5 Preferences::StringToArray.to_yaml 7 lines src/invidious/user/preferences.cr:217:5 Preferences::StringToArray.from_yaml 24 lines src/invidious/videos/parser.cr:137:3 Invidious::Videos::Parser#try_fetch_streaming_data 19 lines src/invidious/videos/videos.cr:51:3 Video#to_json 3 lines src/invidious/yt_backend/extractors_utils.cr:71:1 ::extract_category 3 lines src/invidious/yt_backend/extractors_utils.cr:76:1 ::extract_category 5 lines src/invidious/yt_backend/youtube_api.cr:272:5 YoutubeAPI::ClientConfig#to_s 6 lines ``` But most of them are useful for future use, so no need to remove them. `.ci_lower_bound` and `.elapsed_text` are safe to remove.
This commit is contained in:
@@ -1,25 +1,5 @@
|
||||
PUBSUB_URL = URI.parse("https://pubsubhubbub.appspot.com")
|
||||
|
||||
# See http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
|
||||
def ci_lower_bound(pos, n)
|
||||
if n == 0
|
||||
return 0.0
|
||||
end
|
||||
|
||||
# z value here represents a confidence level of 0.95
|
||||
z = 1.96
|
||||
phat = 1.0*pos/n
|
||||
|
||||
return (phat + z*z/(2*n) - z * Math.sqrt((phat*(1 - phat) + z*z/(4*n))/n))/(1 + z*z/n)
|
||||
end
|
||||
|
||||
def elapsed_text(elapsed)
|
||||
millis = elapsed.total_milliseconds
|
||||
return "#{millis.round(2)}ms" if millis >= 1
|
||||
|
||||
"#{(millis * 1000).round(2)}µs"
|
||||
end
|
||||
|
||||
def decode_length_seconds(string)
|
||||
length_seconds = string.gsub(/[^0-9:]/, "")
|
||||
return 0_i32 if length_seconds.empty?
|
||||
|
||||
Reference in New Issue
Block a user