repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
davidchisnall
@@ -0,0 +1,256 @@ +// Copyright Microsoft and CHERIoT Contributors. +// SPDX-License-Identifier: MIT + +/** + * @file Pointer utilities + */ + +#pragma once + +#include <cheri.hh> +#include <concepts> + +namespace ds::pointer +{ + + /** + * Offset a pointer by an unsigned number of bytes. The return type must be + *...
```suggestion CHERI::Capability c{base}; c.address() += diff; return c; ```
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
davidchisnall
@@ -0,0 +1,256 @@ +// Copyright Microsoft and CHERIoT Contributors. +// SPDX-License-Identifier: MIT + +/** + * @file Pointer utilities + */ + +#pragma once + +#include <cheri.hh> +#include <concepts> + +namespace ds::pointer +{ + + /** + * Offset a pointer by an unsigned number of bytes. The return type must be + *...
Is this not a different overload for the second parameter? Does it need a different name? Are there cases where it's ambiguous whether the `size_t` or `ptrdiff_t` version is intended at the call site (if so, please add a comment)?
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
davidchisnall
@@ -0,0 +1,256 @@ +// Copyright Microsoft and CHERIoT Contributors. +// SPDX-License-Identifier: MIT + +/** + * @file Pointer utilities + */ + +#pragma once + +#include <cheri.hh> +#include <concepts> + +namespace ds::pointer +{ + + /** + * Offset a pointer by an unsigned number of bytes. The return type must be + *...
Can you add a usable `cast<>` method on `CHERI::Capability` if the existing one doesn't work here?
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
davidchisnall
@@ -0,0 +1,75 @@ +// Copyright Microsoft and CHERIoT Contributors. +// SPDX-License-Identifier: MIT +// +// Imported from snmalloc 4f9d991449380ed7d881a25ba02cc5668c1ff394. + +#pragma once + +#include <cstdint> +#include <cstdlib> + +namespace ds::xoroshiro +{ + namespace detail + { + template<typename STATE, typename...
clang-tidy should tell you not to use these names, please can you check why not and fix it? UPPERCASE should be reserved for MACROs (which may have side effects).
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
davidchisnall
@@ -0,0 +1,75 @@ +// Copyright Microsoft and CHERIoT Contributors. +// SPDX-License-Identifier: MIT +// +// Imported from snmalloc 4f9d991449380ed7d881a25ba02cc5668c1ff394. + +#pragma once + +#include <cstdint> +#include <cstdlib> + +namespace ds::xoroshiro +{ + namespace detail + { + template<typename STATE, typename...
What are all of these? Please give them doc comments.
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
mjp41
@@ -0,0 +1,171 @@ +// Copyright Microsoft and CHERIoT Contributors. +// SPDX-License-Identifier: MIT + +/** + * @file Ring/circular buffer state machine. + */ + +#pragma once + +#include <cdefs.h> +#include <type_traits> + +namespace ds::ring_buffer +{ + /** + * A statically-sized, non-atomic ring buffer state machine...
It's is unclear to me if this is fast than ```C++ return (v == 0 ? Capacity : v) - 1 ``` Is there a conditional move on this platform?
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
mjp41
@@ -0,0 +1,171 @@ +// Copyright Microsoft and CHERIoT Contributors. +// SPDX-License-Identifier: MIT + +/** + * @file Ring/circular buffer state machine. + */ + +#pragma once + +#include <cdefs.h> +#include <type_traits> + +namespace ds::ring_buffer +{ + /** + * A statically-sized, non-atomic ring buffer state machine...
Not sure I like this name. It reads like an action or getter, not a predicate.
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
davidchisnall
@@ -0,0 +1,268 @@ +// Copyright Microsoft and CHERIoT Contributors. +// SPDX-License-Identifier: MIT + +/** + * @file Pointer utilities + */ + +#pragma once + +#include <cheri.hh> +#include <concepts> + +namespace ds::pointer +{ + + /** + * Offset a pointer by a number of bytes. The return type must be + * explicitl...
This looks redundant. In the proxies in cheri.hh we use a `set` method like this to simplify subclasses, but this is private (not protected) so looks like it's an unnecessary layer of indirection.
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
davidchisnall
@@ -0,0 +1,268 @@ +// Copyright Microsoft and CHERIoT Contributors. +// SPDX-License-Identifier: MIT + +/** + * @file Pointer utilities + */ + +#pragma once + +#include <cheri.hh> +#include <concepts> + +namespace ds::pointer +{ + + /** + * Offset a pointer by a number of bytes. The return type must be + * explicitl...
```suggestion template<typename T, typename U> static inline __always_inline T *offset(U *base, std::integral auto offset) ``` Not sure if we have the `std::integral` concept, if not then it can be dropped.
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
JerryHsia-MS
@@ -130,53 +127,328 @@ static inline size_t leftshifted_val_msb(size_t val) // the size of the smallest chunk held in bin with index i static inline size_t minsize_for_tree_index(BIndex i) { - return (1U << ((i >> 1) + TREEBIN_SHIFT)) | - ((1U & i) << ((i >> 1) + TREEBIN_SHIFT - 1)); + return (1U << ((i >> 1)...
Very nit: `sprev` and `shead` used to contain both size and other metadata bits. Now they are just sizes, we can give them better names like `prevSize` and `currSize` if it doesn't require too many changes.
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
JerryHsia-MS
@@ -130,53 +127,328 @@ static inline size_t leftshifted_val_msb(size_t val) // the size of the smallest chunk held in bin with index i static inline size_t minsize_for_tree_index(BIndex i) { - return (1U << ((i >> 1) + TREEBIN_SHIFT)) | - ((1U & i) << ((i >> 1) + TREEBIN_SHIFT - 1)); + return (1U << ((i >> 1)...
Does this overflow into the header word right after `base + size`, instead of placing the fake footer header at the end of `base + size`?
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
JerryHsia-MS
@@ -423,53 +680,63 @@ class __packed __aligned(MALLOC_ALIGNMENT) MChunk } #endif - // Write the revocation epoch into the header. - void epoch_write() + /** + * Erase the MChunk-specific metadata of this chunk (specifically, ring) + * without changing its header. + */ + void metadata_clear() { - epoch_enq = ...
Does `capaligned_zero()` help? I wonder if the compiler is clever enough to collapse it into a single cap store.
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
JerryHsia-MS
@@ -489,24 +757,127 @@ class __packed __aligned(MALLOC_ALIGNMENT) TChunk : public MChunk TChunk *parent; // the tree index this chunk is in BIndex index; + /* + * There's padding to alignment here, so if we needed more metadata, it + * could be "free", in spatial terms. + * + * This padding doesn't break our ...
Nit: could benefit from more comments here (although the comments before this PR were already lacking). I think this is called for tree chunks that are not the direct child of a parent?
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
JerryHsia-MS
@@ -1618,57 +2009,103 @@ class MState * * Note that this chunk does not have to come from quarantine, because it * can come from initialisation or splitting a free chunk. + * + * Initializes the linkages of p. */ void mspace_free_internal(MChunk *p) { ok_in_use_chunk(p); - size_t psize = 0, psizeo...
At this point, if `prev` is not in use, have we updated the size field to include both `p` and `prev` so that `p->chunk_next()` can work? If not, I think we should move this line above `is_prev_in_use()` so that `chunk_next()` is valid.
cheriot-rtos
github_2023
cpp
1
CHERIoT-Platform
JerryHsia-MS
@@ -1618,57 +2009,103 @@ class MState * * Note that this chunk does not have to come from quarantine, because it * can come from initialisation or splitting a free chunk. + * + * Initializes the linkages of p. */ void mspace_free_internal(MChunk *p) { ok_in_use_chunk(p); - size_t psize = 0, psizeo...
Is this still true?
cheriot-rtos
github_2023
others
10
CHERIoT-Platform
rmn30
@@ -333,10 +336,10 @@ exception_entry_asm: LoadCapPCC cs0, compartment_switcher_sealing_key // ca2 at this point was loaded by .Lpop_trusted_stack_frame from the pcc
Looks like this comment is now out of date. Should it say `cra` instead?
cheriot-rtos
github_2023
others
491
CHERIoT-Platform
davidchisnall
@@ -24,7 +24,7 @@ namespace Ibex { class HardwareRevoker { - private: + public:
I don’t like making these fields public just for a benchmark. What API are we missing?
ghidra-emotionengine-reloaded
github_2023
java
62
chaoticgd
VelocityRa
@@ -0,0 +1,422 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable ...
does this file need to be copy-pasted from upstream btw? seems maybe you could just inherit `MipsR5900PreAnalyzer` and override `canAnalyze`
pg2
github_2023
java
45
igrishaev
jgdavey
@@ -1108,26 +1111,65 @@ private void handlePortalSuspended (final PortalSuspended msg, final Result res) } private void handlerCall (final IFn f, final Object arg) { - if (f != null) { - Agent.soloExecutor.submit(() -> { - f.invoke(arg); - }); - } + ...
I believe that `emptyList` returns an immutable list. We'd probably want to use `notifications.clear()` here.
pg2
github_2023
java
45
igrishaev
jgdavey
@@ -1366,6 +1408,14 @@ public void notify (final String channel, final String message) { } } + @SuppressWarnings("unused") + public void notifyJSON (final String channel, final Object data) { + try (TryLock ignored = lock.get()) { + final String payload = JSON.writeValueToString(...
This will be very convenient!
pg2
github_2023
java
45
igrishaev
jgdavey
@@ -1108,26 +1111,65 @@ private void handlePortalSuspended (final PortalSuspended msg, final Result res) } private void handlerCall (final IFn f, final Object arg) { - if (f != null) { - Agent.soloExecutor.submit(() -> { - f.invoke(arg); - }); - } + ...
I wonder if we'll still care about this after the new notify stuff is in place?
pg2
github_2023
java
45
igrishaev
jgdavey
@@ -1108,26 +1111,65 @@ private void handlePortalSuspended (final PortalSuspended msg, final Result res) } private void handlerCall (final IFn f, final Object arg) { - if (f != null) { - Agent.soloExecutor.submit(() -> { - f.invoke(arg); - }); - } + ...
Yeah, this seems like a good pattern to me.
pg2
github_2023
java
36
igrishaev
igrishaev
@@ -11,11 +12,16 @@ public class SocketTool {
Here, there is a thing that looks so-so: coupling SocketTool and Config classes. Is that possible to fix it such that SocketTool accepts options as primitives?
pg2
github_2023
java
39
igrishaev
igrishaev
@@ -141,7 +141,7 @@ private void setInputStream(final InputStream in) { private void setOutputStream(final OutputStream out) { final int len = config.outStreamBufSize();
A minor issue I spotted while working on this branch.
pg2
github_2023
java
39
igrishaev
igrishaev
@@ -0,0 +1,17 @@ +package org.pg.error;
@jgdavey Sorry for letting you wait for such long. The PR looks good, and I made a small change. Briefly, I'd like `PGError` class to be the root of all `PG...` exceptions. Second, I renamed `PGIOException` to `PGErrorIO`, because it follows the pattern: `PGError<Subdomain>`, for example `PGErrorResponse` = `PGError` +...
pg2
github_2023
java
35
igrishaev
igrishaev
@@ -49,6 +51,7 @@ public final class Connection implements AutoCloseable { private String unixSocketPath; private InputStream inStream; private OutputStream outStream; + private AsynchronousSocketChannel sockCh;
I might be wrong, but it looks like the `sockCh` field is not needed here. We store both input and output streams, and a raw socket object for possible SSL upgrade. So I think this reference can be skipped.
pg2
github_2023
java
35
igrishaev
igrishaev
@@ -140,10 +143,12 @@ private void setOutputStream(final OutputStream out) { outStream = new BufferedOutputStream(out, len); } - private SocketChannel connectSocket(final SocketAddress address) { - final SocketChannel channel = SocketTool.open(address); + private AsynchronousSocketChannel c...
(the same)
pg2
github_2023
java
35
igrishaev
igrishaev
@@ -204,13 +209,13 @@ private void initTypeMapping() { } - private static void setSocketOptions(final Socket socket, final Config config) { + private static void setSocketOptions(final AsynchronousSocketChannel channel, final Config config) { try { - socket.setTcpNoDelay(config.SOTCPn...
I tried AsyncSocket object in the past, and it confused me that there is no a timeout option (see below).
pg2
github_2023
java
35
igrishaev
igrishaev
@@ -5,14 +5,20 @@ import java.io.IOException; import java.net.Socket; import java.net.SocketAddress; +import java.util.concurrent.Future; +import java.util.concurrent.ExecutionException; +import java.nio.channels.AsynchronousSocketChannel; import java.nio.channels.SocketChannel; public class SocketTool { - ...
Since there is no a timeout option for async channel, it looks like we need to `.get` by timeout passing an amount ms, for example: `result.get(config.SOTimeout(), TimeUnits/MILLISECONDS)` This will imitate a socket timeout behaviour.
pg2
github_2023
java
35
igrishaev
igrishaev
@@ -1412,4 +1414,15 @@ public int pollNotifications() { } }
Hm, this method looks a bit strange to me. There is already a method called `pollNotifications` in the Connection class and its Clojure wrapper in `pg.core`. This method does the same but without an endless loop. The question is, if someone runs this method, how will he or she exit from it? The only answer is to pre...
pg2
github_2023
java
35
igrishaev
igrishaev
@@ -5,14 +5,20 @@ import java.io.IOException; import java.net.Socket; import java.net.SocketAddress; +import java.util.concurrent.Future; +import java.util.concurrent.ExecutionException; +import java.nio.channels.AsynchronousSocketChannel; import java.nio.channels.SocketChannel; public class SocketTool { - ...
The last comment about performance. I tried async sockets before, but they not even showed much benefit, but rather slowed down performance. I'm not an expert in Java IO either, but it looks like plain sockets may gain more performance in blocking mode. I run some benchmarks on master and this branch on two machines...
pg2
github_2023
others
34
igrishaev
igrishaev
@@ -0,0 +1,145 @@ +(ns pg.connection-uri
I had a draft version of URI parser in my drafts, and I pushed it here just for context.
pg2
github_2023
others
34
igrishaev
igrishaev
@@ -0,0 +1,145 @@ +(ns pg.connection-uri + (:require + [clojure.string :as str]) + (:import + (java.net URI))) + +(set! *warn-on-reflection* true) + +(defmacro error! [template & args] + `(throw (new Exception (format ~template ~@args)))) + +(defn parse-query-bool ^Boolean [^String line] + (case (str/lower-case...
This function does most of the things. I thing we only need to extend it with query options.
pg2
github_2023
others
34
igrishaev
igrishaev
@@ -263,10 +263,12 @@ (defn ->config " - Turn a Clojure map into an instance of Config.Builder. + Turn a Clojure map into an instance of Config via Config.Builder " - ^Config$Builder [params] - + ^Config [params]
I think it's OK to have both URI and other params at once, no need to throw an error. My idea was to parse the URI, if it passed, and get a map of config from it. And then, merge it with the rest of the top-level config, or vice versa.
pg2
github_2023
others
34
igrishaev
igrishaev
@@ -0,0 +1,88 @@ +(ns pg.config-test
Thank you for adding tests, very appreciated.
pg2
github_2023
java
34
igrishaev
igrishaev
@@ -107,6 +114,98 @@ public Builder(final String user, final String database) { this.pgParams.put("application_name", Const.APP_NAME); } +
My main concern is the following: in your PR, we build a Config object either from a URI line, or from a Clojure map. But I'm afraid that it's not possible to pass all the objects through the URI. Thus, maybe it's better to merge settings, namely: 1. if connection-uri is passed, parse it and get a map; 2. merge it ...
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -74,54 +72,38 @@ are plain strings: (pg/connect config+)) ~~~ -## Connection parameters - -The following table describes all the possible connection options with the -possible values and semantics. Only the two first options are requred. All the -rest have predefined values. - -| Field | Type ...
Personally I wouldn't like to drop out this fragment. Can you get it back please? The phrasing you proposed is too short and I'm afraid the context will be lost.
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -1,23 +1,23 @@ # Arrays support -In JDBC, arrays have always been a pain. Every time you're about to pass an
Here and below: I don't think these commas should be removed. The "In JDBC" clause in the introductory, and thus must be separated with comma. That's the number 2 point from this guide: https://www.brandeis.edu/writing-program/resources/students/academic/style-grammar/comma-rules.html But can you change my mind? ...
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -1,39 +1,30 @@ -# PG2: A *Fast* PostgreSQL Driver For Clojure
Why did you remove A? It relates to the "Driver" noun which is mentioned the first time.
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -1,39 +1,30 @@ -# PG2: A *Fast* PostgreSQL Driver For Clojure +# PG2: *Fast* PostgreSQL driver for Clojure -[pg]: https://github.com/igrishaev/pg +`PG2` is a JDBC-free PostgreSQL client library. -PG2 is a client library for PostgreSQL server. It succeeds [PG(one)][pg] -- my -early attempt to make a JDBC-free cli...
Unfortunately, comma is needed here
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -1,23 +1,23 @@ # Arrays support -In JDBC, arrays have always been a pain. Every time you're about to pass an -array to the database and read it back, you've got to wrap your data in various -Java classes, extend protocols, and multimethods. In Postgres, the array type is +In `JDBC` arrays have always been a pain....
A article must be preserved, I think
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -34,7 +34,7 @@ Insert a simple item: {:params [["one" "two" "three"]]}) ~~~ -In arrays, some elements might be NULL:
Comma is needed (try this sentence in Grammarly or similar service)
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -51,7 +51,7 @@ Now let's check what we've got so far: {:id 2 :text_arr ["foo" nil "bar"]}] ~~~ -Postgres supports plenty of operators for arrays. Say, the `&&` one checks if +Postgres supports plenty of operators for arrays. Say `&&` checks if
Comma is needed
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -92,8 +92,8 @@ Here is how you insert a matrix: {:inserted 1} ~~~ -Pay attention: each number can be NULL but you cannot have NULL for an entire -sub-array. This will trigger an error response from Postgres. +Pay attention: each number can be NULL but you can't have NULL for an entire
I'd prefer `cannot` rather than can't (and you know why, all know)
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -1,12 +1,11 @@ # Authentication -The library suppors the following authentication types and pipelines: +`PG2` supports the following authentication types and pipelines: -- No password (for trusted clients); +- No password (for trusted clients)
I'd keep `;` at the end. It should be either `.` or `;` at the end of each item.
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -5,7 +5,7 @@ [bench3]: https://grishaev.me/en/pg2-bench-3 [bench4]: https://grishaev.me/en/pg-0-1-12 -For benchmarks, see the following posts in my blog:
I'd keep the old phrasing: For benchmarks, see ... because when you have only "see", it sounds unclear: see for what?
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -1,7 +1,6 @@ # Connecting to the server -To connect the server, define a config map and pass it into the `connect` -function: +Call `connect` with the config map:
It has become too short: call connect for what?
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -17,24 +16,24 @@ function: (pg/connect config)) ~~~ -The `conn` is an instance of the `org.pg.Connection` class. +`conn` is an instance of the `org.pg.Connection` class. -The `:host`, `:port`, and `:password` config fields have default values and -might be skipped (the password is an empty string by default)...
comma is needed
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -17,24 +16,24 @@ function: (pg/connect config)) ~~~ -The `conn` is an instance of the `org.pg.Connection` class.
"the" is needed
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -17,24 +16,24 @@ function: (pg/connect config)) ~~~ -The `conn` is an instance of the `org.pg.Connection` class. +`conn` is an instance of the `org.pg.Connection` class. -The `:host`, `:port`, and `:password` config fields have default values and -might be skipped (the password is an empty string by default)...
comma is needed
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -1,7 +1,6 @@ # Connection state -There are some function to track the connection state. In Postgres, the state of -a connection might be one of these: +In Postgres the connection state might be one of these:
comma is needed
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -56,9 +59,9 @@ The connection is in the error state now: true ~~~ -When state is error, the connection doesn't accept any new queries. Each of them +When state is error the connection doesn't accept any new queries. Each of them
comma
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -56,9 +59,9 @@ The connection is in the error state now: true ~~~ -When state is error, the connection doesn't accept any new queries. Each of them +When state is error the connection doesn't accept any new queries. Each of them will be rejected with a message saying that the connection is in the error -state. ...
comma
pg2
github_2023
others
20
igrishaev
igrishaev
@@ -74,54 +72,38 @@ are plain strings: (pg/connect config+)) ~~~ -## Connection parameters - -The following table describes all the possible connection options with the -possible values and semantics. Only the two first options are requred. All the -rest have predefined values. - -| Field | Type ...
(duplicate): keep the origin block of code with examples here
pg2
github_2023
others
15
igrishaev
jeaye
@@ -123,7 +123,31 @@ mig/parse-url)] (is (= nil - (dissoc res :url))))) + (dissoc res :url)))) + + (testing "no leading path" + (let [res + (-> "003.hello.prev.sql" + io/file + io/as-url + mig/parse-url)] + + (is (= {:id 3 ...
Looks great! I've tested this locally and it fixed the issue. Thank you! After merging, if you wouldn't mind publishing a new release for this, that would be superb.
pg2
github_2023
others
5
igrishaev
igrishaev
@@ -0,0 +1,29 @@ +# Local pg-ragtime postgresql database +# +# I wasn't able to use the toplevel `docker-compose.yaml` out of the box. +# +# Maybe `.docker/postgres/initdb.d` is missing? +# +# Anyway, I'm adding a local compose file for now to get a REPL to run my +# code. +# +# We probably want to delete this file whe...
Hm, that's a bit strange. Do you use Linux, by the way? It might be related to permissions with that hidden .docker directory.
pg2
github_2023
others
3
igrishaev
igrishaev
@@ -0,0 +1,29 @@ +(ns pg.ragtime
The draft looks solid, thank you. Just a note: you can borrow most of the code from here: https://github.com/weavejester/ragtime/blob/master/next-jdbc/src/ragtime/next_jdbc.clj
pg2
github_2023
others
3
igrishaev
igrishaev
@@ -0,0 +1,29 @@ +(ns pg.ragtime + (:require + [ragtime.core :as ragtime] + [ragtime.strategy] + [ragtime.protocols] + [pg.core :as pg]) + (:import org.pg.Connection)) + +(defn ensure-migrations-table! + [conn] + (pg/query conn " +create table if not exists ragtime_migrations(
Here, the name of the table is hardcoded. We can keep it as is for now but later on, it should be a configuration parameter.
pg2
github_2023
others
3
igrishaev
igrishaev
@@ -0,0 +1,29 @@ +(ns pg.ragtime + (:require + [ragtime.core :as ragtime] + [ragtime.strategy] + [ragtime.protocols] + [pg.core :as pg]) + (:import org.pg.Connection)) + +(defn ensure-migrations-table! + [conn] + (pg/query conn " +create table if not exists ragtime_migrations( + id text primary key, + tim...
Could you also create 2-3 test migrations please and put them into the tests/migrations directory? Something like create a table `users` and then adding a column. Like this: https://github.com/weavejester/ragtime/tree/master/next-jdbc/test/migrations Then, we can prepare tests that ensure migrations work.
polars_ds_extension
github_2023
others
84
abstractqqq
abstractqqq
@@ -27,14 +27,15 @@ inflections = "1.1.1" kdtree = {git = "https://github.com/mrhooray/kdtree-rs.git"} petgraph = "0.6.4" ordered-float = "4.2.0" +pyo3-build-config = "0.20.2"
Do you know where is this needed?
polars_ds_extension
github_2023
python
84
abstractqqq
abstractqqq
@@ -1066,3 +1066,43 @@ def _haversine( is_elementwise=True, cast_to_supertypes=True, ) + + def knn_entropy(self, *others: pl.Expr, k=2): + """ + Multivariate estimation of entropy through a k-nearest neighbor query + + Reference + --------- + http...
Right now I think dist = 'l2' is available, but l2 is actually squared Euclidean. But that won't change the output because sqrt preserves order.. Also I think pl.col("row_nr") should be self._expr?
polars_ds_extension
github_2023
python
84
abstractqqq
abstractqqq
@@ -1066,3 +1066,43 @@ def _haversine( is_elementwise=True, cast_to_supertypes=True, ) + + def knn_entropy(self, *others: pl.Expr, k=2): + """ + Multivariate estimation of entropy through a k-nearest neighbor query + + Reference + --------- + http...
I think I might have a rust digamma function available somewhere already in the Rust codebase. If not, we can use the digamma implemented here: https://github.com/statrs-dev/statrs/blob/5411ba74b427b992dd1410d699052a0b41dc2b5c/src/function/gamma.rs#L353. One of my goal is to reduce dependency on other packages as m...
polars_ds_extension
github_2023
python
84
abstractqqq
abstractqqq
@@ -1066,3 +1066,42 @@ def _haversine( is_elementwise=True, cast_to_supertypes=True, ) + + def knn_entropy(self, *others: pl.Expr, k=2): + """ + Multivariate estimation of entropy through a k-nearest neighbor query + + Reference + --------- + http...
Please add types to all funtions and eventually add some comments and references when you are done. Thanks
polars_ds_extension
github_2023
others
84
abstractqqq
abstractqqq
@@ -14,7 +14,7 @@ pyo3 = {version = "*", features = ["extension-module"]} pyo3-polars = {version = "0.11", features = ["derive"]} polars = {version = "0.37", features = ["performant", "lazy", "dtype-array", "array_count", "ndarray","log","nightly"]} num = "0.4.1" -faer = {version = "0.16", features = ["ndarray", "ni...
Let's not upgrade Faer right now. I am having trouble building it. We don't need anything from 0.17 yet.
polars_ds_extension
github_2023
python
84
abstractqqq
abstractqqq
@@ -1064,6 +1074,66 @@ def _haversine( ) + def conditional_independence(self, y: pl.Expr, z: pl.Expr, k: int = 2): + """ + Test independance of `self` (considered as `x`) and `y`, conditioned on `z` + + Reference + --------- + Jian Ma. Multivariate Normality Test with ...
Can you write this line in more compact math notation? I am having trouble understanding the point of exclude and gather.. Thanks
wordcab-transcribe
github_2023
python
283
Wordcab
aleksandr-smechov
@@ -776,7 +777,10 @@ async def remote_diarization( data: DiarizationRequest, ) -> DiarizationOutput: """Remote diarization method.""" - async with aiohttp.ClientSession() as session: + # Set the timeout according to the env value of the REMOTE_DIARIZE_SERVER_REQUEST_TIMEOUT_SEC vari...
You'd need to add the env variable to https://github.com/Wordcab/wordcab-transcribe/blob/main/.env Then the appropriate lines [in the config file](https://github.com/Wordcab/wordcab-transcribe/blob/main/src/wordcab_transcribe/config.py) for the Settings class on lines 35 and 236 (this is where you'd set a default) ...
wordcab-transcribe
github_2023
others
283
Wordcab
aleksandr-smechov
@@ -8,7 +8,7 @@ # The name of the project, used for API documentation. PROJECT_NAME="Wordcab Transcribe" # The version of the project, used for API documentation. -VERSION="0.5.1" +VERSION="0.5.2.1"
No version increment
wordcab-transcribe
github_2023
others
283
Wordcab
aleksandr-smechov
@@ -115,4 +115,6 @@ TRANSCRIBE_SERVER_URLS= # e.g. SERVER_URLS="http://1.2.3.4:8000,http://4.3.2.1:8000" DIARIZE_SERVER_URLS= # +# Timeout for connection and waiting for result from remote diarize server. 300 sec is default value +REMOTE_DIARIZE_SERVER_REQUEST_TIMEOUT_SEC=300
Just `REMOTE_DIARIZATION_REQUEST_TIMEOUT=300` to keep things consistent
wordcab-transcribe
github_2023
python
283
Wordcab
aleksandr-smechov
@@ -19,4 +19,4 @@ # and limitations under the License. """Main module of the Wordcab ASR API.""" -__version__ = "0.5.2" +__version__ = "0.5.2.1"
No increment
wordcab-transcribe
github_2023
python
283
Wordcab
aleksandr-smechov
@@ -272,4 +274,5 @@ def __post_init__(self): # Remote servers configuration transcribe_server_urls=transcribe_server_urls, diarize_server_urls=diarize_server_urls, + remote_diarization_request_timeout=int(os.getenv("REMOTE_DIARIZE_SERVER_REQUEST_TIMEOUT_SEC", 300)),
`remote_diarization_request_timeout=getenv("REMOTE_DIARIZATION_REQUEST_TIMEOUT", 300),`
wordcab-transcribe
github_2023
python
283
Wordcab
aleksandr-smechov
@@ -300,6 +301,9 @@ def __init__( "You provided URLs for remote diarization server, no local model will" " be used." ) + logger.info( + f"remote diarization server timeout is {settings.remote_diarization_request_timeout}"
`f"Remote diarization server timeout set to {settings.remote_diarization_request_timeout}"`
wordcab-transcribe
github_2023
python
283
Wordcab
aleksandr-smechov
@@ -776,7 +780,11 @@ async def remote_diarization( data: DiarizationRequest, ) -> DiarizationOutput: """Remote diarization method.""" - async with aiohttp.ClientSession() as session: + # Set the timeout according to the env value of the REMOTE_DIARIZE_SERVER_REQUEST_TIMEOUT_SEC vari...
Can remove lines 783-785
wordcab-transcribe
github_2023
python
282
Wordcab
karmi
@@ -776,7 +776,10 @@ async def remote_diarization( data: DiarizationRequest, ) -> DiarizationOutput: """Remote diarization method.""" - async with aiohttp.ClientSession() as session: + # Set the timeout to 12 hours for several hours long audio files + verylongtimeout = Client...
I think that @aleksandr-smechov is only asking to make the timeout configurable. As far as I understand, it's as simple as this? ```suggestion timeout = int(os.getenv("REQUEST_TIMEOUT", 300)) async with aiohttp.ClientSession(timeout=timeout) as session: ``` Of course, as part of the PR, a chang...
wordcab-transcribe
github_2023
python
225
Wordcab
chainyo
@@ -272,82 +272,93 @@ async def process_input( "process_times": {}, } - # Pick the first available GPU for the task - gpu_index = await self.gpu_handler.get_device() if self.device == "cuda" else 0 - logger.info(f"Using GPU {gpu_index} for the task") + gpu_index = -1 ...
```suggestion except Exception as e: return e ``` The errors are already logged in the API endpoints: <img width="494" alt="CleanShot 2023-08-31 at 08 24 28@2x" src="https://github.com/Wordcab/wordcab-transcribe/assets/50595514/7a641541-5f30-4afc-8797-7abc2338bf33">
wordcab-transcribe
github_2023
python
225
Wordcab
chainyo
@@ -272,82 +272,93 @@ async def process_input( "process_times": {}, } - # Pick the first available GPU for the task - gpu_index = await self.gpu_handler.get_device() if self.device == "cuda" else 0 - logger.info(f"Using GPU {gpu_index} for the task") + gpu_index = -1 ...
```suggestion if isinstance(task["diarization_result"], Exception): self.gpu_handler.release_device(gpu_index) gpu_index = -1 return task["diarization_result"] ```
wordcab-transcribe
github_2023
python
225
Wordcab
chainyo
@@ -272,82 +272,93 @@ async def process_input( "process_times": {}, } - # Pick the first available GPU for the task - gpu_index = await self.gpu_handler.get_device() if self.device == "cuda" else 0 - logger.info(f"Using GPU {gpu_index} for the task") + gpu_index = -1 ...
```suggestion if isinstance(task["transcription_result"], Exception): self.gpu_handler.release_device(gpu_index) gpu_index = -1 return task["transcription_result"] ```
wordcab-transcribe
github_2023
python
225
Wordcab
chainyo
@@ -272,82 +272,93 @@ async def process_input( "process_times": {}, } - # Pick the first available GPU for the task - gpu_index = await self.gpu_handler.get_device() if self.device == "cuda" else 0 - logger.info(f"Using GPU {gpu_index} for the task") + gpu_index = -1 ...
```suggestion self.gpu_handler.release_device(gpu_index) gpu_index = -1 asyncio.get_event_loop().run_in_executor( None, functools.partial(self.process_post_processing, task) ) ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -60,7 +61,66 @@ "₿", ] +# run API for youtube video endpoint +def run_api_youtube(url : str, sourceLang = "en", timestamps = "s", wordTimestamps = False):
Two essential things for the functions: * Never use CamelCase in Python. Could you go with the snake case for function parameters? Only a class has uppercase letters, e.g. `ASRService`. * The functions are missing some parameters like `alignment`, `diarization`, or `dual_channel` for the audio file endpoint.
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -60,7 +61,66 @@ "₿", ] +# run API for youtube video endpoint +def run_api_youtube(url : str, sourceLang = "en", timestamps = "s", wordTimestamps = False): + headers = {"accept": "application/json", "Content-Type": "application/json"} + params = {"url": url} + data = { + "alignment": True, # ...
Could you also add the `audio_url_endpoint`? This endpoint is similar to the `audio_file_endpoint` but downloads the file from a signed URL. All the endpoints are in the following folder: [`wordcab_transcribe/router/v1/`](https://github.com/Wordcab/wordcab-transcribe/tree/main/wordcab_transcribe/router/v1) The [`...
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -60,7 +61,66 @@ "₿", ] +# run API for youtube video endpoint +def run_api_youtube(url : str, sourceLang = "en", timestamps = "s", wordTimestamps = False): + headers = {"accept": "application/json", "Content-Type": "application/json"} + params = {"url": url} + data = { + "alignment": True, # ...
A response status check should ensure you get a `200` response. If `200`, you can return the JSON response. If not, you'll need to tell the user. Check the endpoints to see the `500` status
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,122 @@ +import requests +import json + +def run_api_youtube( + url:str, + source_lang:str = "en", + timestamps:str = "s", + word_timestamps:bool = False, + alignment:bool = False, + diarization:bool = False, +): + """ + Run API call for Youtube videos. + + Args: + ...
Could you make this dynamic? (Based on the youtube URL)
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,122 @@ +import requests +import json + +def run_api_youtube( + url:str, + source_lang:str = "en", + timestamps:str = "s", + word_timestamps:bool = False, + alignment:bool = False, + diarization:bool = False, +): + """ + Run API call for Youtube videos. + + Args: + ...
```suggestion def run_api_audiofile( ``` Removing the camelcase.
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion server_url: Optional[str] = None, ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion diarization: speaker labels for utterances (defaulted to False) server_url: the URL used to reach out the API. Returns: ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion data = { "alignment": alignment, "diarization": diarization, "source_lang": source_lang, "timestamps": timestamps, "word_timestamps": word_timestamps, } ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion if server_url is None: ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion response = requests.post( f"{server_url}/api/v1/youtube", headers=headers, params=params, data=json.dumps(data), timeout=timeout, ) ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion server_url: Optional[str] = None, ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
This function lacks the `vocab` parameter.
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion data = { "alignment": alignment, "diarization": diarization, "source_lang": source_lang, "timestamps": timestamps, "word_timestamps": word_timestamps, "dual_channel": dual_channel, } if vocab: data["vocab"] = vocab ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion f"{server_url}/api/v1/audio-url", ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion url_name = url.split("https://")[-1] ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion url_name = url.split("https://")[-1] ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion server_url: Optional[str] = None, ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion data = { "alignment": alignment, "diarization": diarization, "source_lang": source_lang, "timestamps": timestamps, "word_timestamps": word_timestamps, "dual_channel": dual_channel, } if vocab: data["vocab"] = vocab ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion if server_url is None: ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion f"{server_url}/api/v1/audio", ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion server_url: Optional[str] = None, ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,309 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion elif endpoint == "audio_url": ```
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,292 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion if server_url is None: ```