->Written by Alpin<- ->Inspired by /hdg/'s LoRA train rentry<-
The Table of Content on rentry is terrible, so I'll be linking to the different main sections here:
->Written by Alpin<- ->Inspired by /hdg/'s LoRA train rentry<-
The Table of Content on rentry is terrible, so I'll be linking to the different main sections here:
Python docstrings can be written following several formats as the other posts showed. However the default Sphinx docstring format was not mentioned and is based on reStructuredText (reST). You can get some information about the main formats in that tuto.
Note that the reST is recommended by the PEP 287
There follows the main used formats for docstrings.
from __future__ import division | |
import scipy.optimize | |
import numpy as np | |
def bbox_iou(boxA, boxB): | |
# https://www.pyimagesearch.com/2016/11/07/intersection-over-union-iou-for-object-detection/ | |
# ^^ corrected. | |
# Determine the (x, y)-coordinates of the intersection rectangle | |
xA = max(boxA[0], boxB[0]) |
import java.io.IOException; | |
import java.net.URISyntaxException; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.security.KeyFactory; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.PrivateKey; | |
import java.security.interfaces.RSAPublicKey; | |
import java.security.spec.InvalidKeySpecException; | |
import java.security.spec.PKCS8EncodedKeySpec; |
(def t (java.io.File/createTempFile "filename" ".txt")) | |
(println (.getPath t)) | |
(defn row [n] | |
[(+ n 500000) (rand-int 10000) (rand-int 10000) (rand-int 10000) (rand-int 10000) 5550555 (rand) "hello world"]) | |
(with-open [w (io/writer t)] | |
(csv/write-csv w (map row (range 1000000)))) | |
(j/with-db-transaction [tx db-spec] |
(defn decode-key | |
"Converts a train case string into a snake case keyword." | |
[s] | |
(keyword (str/replace s "_" "-"))) | |
(defn encode-key | |
"Converts a snake case keyword into a train case string." | |
[k] | |
(str/replace (name k) "-" "_")) |
(ns user) | |
; Hey, I've been playing a bit with graphing out the structure of a module for Lightpad. | |
; It worked well, I've found the target function that I'll need change to add a new feature. | |
; Tweet with a screenshot https://twitter.com/spacegangster/status/1324760381735272450 | |
; lein coordinate | |
; [com.gfredericks/clj-usage-graph "0.3.0"] | |
; https://github.com/gfredericks/clj-usage-graph | |
(ns rich4clojure.hard.problem-053 | |
(:require [hyperfiddle.rcf :refer [tests]])) | |
;; = Longest Increasing Sub-Seq = | |
;; By 4Clojure user: dbyrne | |
;; Difficulty: Hard | |
;; Tags: [seqs] | |
;; | |
;; Given a vector of integers, find the longest | |
;; consecutive sub-sequence of increasing numbers. If two |
(def ^:private inf (Long/MAX_VALUE)) | |
(defn neighbors | |
"Returns n's neighbors, optionally filtered if unvisited" | |
([g n] (get g n {})) | |
([g n uv] (select-keys (neighbors g n) uv))) | |
(defn update-costs | |
"Returns costs updated with any shorter paths found to curr's unvisisted | |
neighbors by using curr's shortest path" |