Seperate your code into a new structure matching the following:
cmd
`- todo
lib
| from checks import AgentCheck | |
| import re | |
| import requests | |
| rx0 = re.compile(r'^# TYPE \S+ (\S+)$') | |
| rx1 = re.compile(r'(\w+)(?:{(\S+)})? ([-+]?\d*\.\d+|\d+)') | |
| rx2 = re.compile(r'(\w+)="(\S*?)",?') | |
| class PrometheusCheck(AgentCheck): |
| package main | |
| import ( | |
| "bufio" | |
| "os" | |
| "strings" | |
| ) | |
| // FileConfigLoader describes a file based loader which loads the configuration | |
| // from a file listed. |
| postgres=# EXPLAIN SELECT name FROM categories WHERE similarity(name, 'cr') > 0.3; | |
| QUERY PLAN | |
| ---------------------------------------------------------------------------- | |
| Seq Scan on categories (cost=0.00..208.55 rows=2323 width=9) | |
| Filter: (similarity((name)::text, 'cr'::text) > '0.3'::double precision) | |
| (2 rows) |
| class Node: | |
| def __init__(self, parent, name): | |
| self.parent = parent | |
| self.name = name | |
| def get(self, name): | |
| return Node(self, ".".join([self.name, name])) | |
| def root(self): | |
| node = self |
| package main | |
| import ( | |
| "flag" | |
| "strings" | |
| "github.com/urfave/cli" | |
| ) | |
| // CLIProvider provides configuration from the cli.Context passed into an |
| func test() { | |
| semaphore := make(chan struct{}, internalGoRoutineAsyncMax) | |
| for i := 0; i < 1000; i++ { | |
| go func() { | |
| semaphore <- struct{}{} | |
| defer func() { <-semaphore }() | |
| // process... | |
| }() | |
| } |
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| func main() { | |
| const value = "2015-08-04 14:33:21.89115181 -0600 MDT" | |
| const layout = "2006-01-02 15:04:05.999999999 -0700 MST" |
| type Database interface { | |
| Execute(c *mgo.Collection) error | |
| } | |
| type Result struct{} | |
| func MyService(db Database) (*Result, error) { | |
| var result Result | |
| f := func(c *mgo.Collection) error { |
| paths: | |
| /comments: | |
| post: | |
| request: | |
| body: | |
| - Comment | |
| response: | |
| - Comment | |
| /comments/:comment_id/actions: |