MCPcopy Index your code
hub / github.com/algorithmiaio/algorithmia-python / __init__

Method __init__

Algorithmia/algorithm.py:18–33  ·  view source on GitHub ↗
(self, client, algoRef)

Source from the content-addressed store, hash-verified

16
17class Algorithm(object):
18 def __init__(self, client, algoRef):
19 # Parse algoRef
20 algoRegex = re.compile(r"(?:algo://|/|)(\w+/.+)")
21 m = algoRegex.match(algoRef)
22 if m is not None:
23 self.client = client
24 self.path = m.group(1)
25 self.username = self.path.split("/")[0]
26 self.algoname = self.path.split("/")[1]
27 if len(self.path.split("/")) > 2:
28 self.version = self.path.split("/")[2]
29 self.url = '/v1/algo/' + self.path
30 self.query_parameters = {}
31 self.output_type = OutputType.default
32 else:
33 raise ValueError('Invalid algorithm URI: ' + algoRef)
34
35 def set_options(self, timeout=300, stdout=False, output=OutputType.default, **query_parameters):
36 self.query_parameters = {'timeout': timeout, 'stdout': stdout}

Callers

nothing calls this directly

Calls 1

compileMethod · 0.80

Tested by

no test coverage detected