code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
return self._makeApiCall(self.funcinfo["pendingTasks"], *args, **kwargs) | def pendingTasks(self, *args, **kwargs) | Get Number of Pending Tasks
Get an approximate number of pending tasks for the given `provisionerId`
and `workerType`.
The underlying Azure Storage Queues only promises to give us an estimate.
Furthermore, we cache the result in memory for 20 seconds. So consumers
should be no ... | 12.7616 | 17.367836 | 0.734784 |
return self._makeApiCall(self.funcinfo["quarantineWorker"], *args, **kwargs) | def quarantineWorker(self, *args, **kwargs) | Quarantine a worker
Quarantine a worker
This method takes input: ``v1/quarantine-worker-request.json#``
This method gives output: ``v1/worker-response.json#``
This method is ``experimental`` | 10.081695 | 11.330914 | 0.889751 |
return self._makeApiCall(self.funcinfo["declareWorker"], *args, **kwargs) | def declareWorker(self, *args, **kwargs) | Declare a worker
Declare a worker, supplying some details about it.
`declareWorker` allows updating one or more properties of a worker as long as the required scopes are
possessed.
This method takes input: ``v1/update-worker-request.json#``
This method gives output: ``v1/work... | 15.898732 | 21.799057 | 0.729331 |
return await self._makeApiCall(self.funcinfo["findTask"], *args, **kwargs) | async def findTask(self, *args, **kwargs) | Find Indexed Task
Find a task by index path, returning the highest-rank task with that path. If no
task exists for the given path, this API end-point will respond with a 404 status.
This method gives output: ``v1/indexed-task-response.json#``
This method is ``stable`` | 12.112565 | 21.849869 | 0.554354 |
return await self._makeApiCall(self.funcinfo["listNamespaces"], *args, **kwargs) | async def listNamespaces(self, *args, **kwargs) | List Namespaces
List the namespaces immediately under a given namespace.
This endpoint
lists up to 1000 namespaces. If more namespaces are present, a
`continuationToken` will be returned, which can be given in the next
request. For the initial request, the payload should be an ... | 13.301975 | 21.032631 | 0.632445 |
return await self._makeApiCall(self.funcinfo["listTasks"], *args, **kwargs) | async def listTasks(self, *args, **kwargs) | List Tasks
List the tasks immediately under a given namespace.
This endpoint
lists up to 1000 tasks. If more tasks are present, a
`continuationToken` will be returned, which can be given in the next
request. For the initial request, the payload should be an empty JSON
o... | 12.340103 | 21.853516 | 0.564674 |
return await self._makeApiCall(self.funcinfo["insertTask"], *args, **kwargs) | async def insertTask(self, *args, **kwargs) | Insert Task into Index
Insert a task into the index. If the new rank is less than the existing rank
at the given index path, the task is not indexed but the response is still 200 OK.
Please see the introduction above for information
about indexing successfully completed tasks automati... | 13.219021 | 24.477274 | 0.540053 |
return await self._makeApiCall(self.funcinfo["findArtifactFromTask"], *args, **kwargs) | async def findArtifactFromTask(self, *args, **kwargs) | Get Artifact From Indexed Task
Find a task by index path and redirect to the artifact on the most recent
run with the given `name`.
Note that multiple calls to this endpoint may return artifacts from differen tasks
if a new task is inserted into the index between calls. Avoid using thi... | 10.563093 | 19.064034 | 0.554085 |
return await self._makeApiCall(self.funcinfo["allPurgeRequests"], *args, **kwargs) | async def allPurgeRequests(self, *args, **kwargs) | All Open Purge Requests
This is useful mostly for administors to view
the set of open purge requests. It should not
be used by workers. They should use the purgeRequests
endpoint that is specific to their workerType and
provisionerId.
This method gives output: ``v1/all-... | 12.733225 | 18.592018 | 0.684876 |
return await self._makeApiCall(self.funcinfo["purgeRequests"], *args, **kwargs) | async def purgeRequests(self, *args, **kwargs) | Open Purge Requests for a provisionerId/workerType pair
List of caches that need to be purged if they are from before
a certain time. This is safe to be used in automation from
workers.
This method gives output: ``v1/purge-cache-request-list.json#``
This method is ``stable`` | 13.593371 | 21.673969 | 0.627175 |
escape_parts = re.compile('\x01?\x1b\\[([0-9;]*)m\x02?')
chunks = escape_parts.split(text)
i = 0
for chunk in chunks:
if chunk != '':
if i % 2 == 0:
self.stream.write(chunk)
else:
c = chunk.split... | def write(self, text) | Parses text and prints proper output to the terminal
This method will extract escape codes from the text and
handle them as well as possible for whichever platform
is being used. At the moment only the display escape codes
are supported. | 5.529374 | 5.145142 | 1.074679 |
return NotImplemented
fno = stdout.fileno()
mode = self.termios.tcgetattr(fno)
try:
self.tty.setraw(fno, self.termios.TCSANOW)
ch = self.read(1)
finally:
self.termios.tcsetattr(fno, self.termios.TCSANOW, mode)
return ch | def getch(self) | Don't use this yet
It doesn't belong here but I haven't yet thought about a proper
way to implement this feature and the features that will depend on
it. | 3.380006 | 3.280955 | 1.03019 |
codes, fg, bg = Magic.displayformat(codes, fg, bg)
self.stream.write(Magic.display(codes, fg, bg))
self.flush() | def display(self, codes=[], fg=None, bg=None) | Displays the codes using ANSI escapes | 6.641467 | 6.687409 | 0.99313 |
for d in range(distance):
self.stream.write(self._get_cap('move '+place))
self.flush() | def move(self, place, distance = 1) | see doc in Term class | 13.557664 | 11.8986 | 1.139434 |
if scope == 'line':
self.clear('beginning of line')
self.clear('end of line')
else: self.stream.write(self._get_cap('clear '+scope))
self.flush() | def clear(self, scope = 'screen') | see doc in Term class | 8.098363 | 7.000919 | 1.156757 |
self.curses.setupterm()
return self.curses.tigetnum('cols'), self.curses.tigetnum('lines') | def get_size(self) | see doc in Term class | 4.686799 | 3.652941 | 1.283021 |
codes, fg, bg = Magic.displayformat(codes, fg, bg)
color = 0
for c in codes:
try:
f = getattr(self, '_display_' + c)
out = f()
if out: color |= out
except AttributeError:
pass
cfg, cfgi, cbg,... | def display(self, codes=[], fg=None, bg=None) | Displays codes using Windows kernel calls | 3.549023 | 3.530451 | 1.00526 |
attr = self._get_console_info()
cols = attr['window']['right'] - attr['window']['left'] + 1
lines = attr['window']['bottom'] - attr['window']['top'] + 1
return cols, lines | def get_size(self) | see doc in Term class | 4.35913 | 4.066217 | 1.072036 |
fg = attrs & self.FG_ALL
fgi = attrs & self.FG_INTENSITY
bg = attrs & self.BG_ALL
bgi = attrs & self.BG_INTENSITY
return fg, fgi, bg, bgi | def _split_attributes(self, attrs) | Spilt attribute code
Takes an attribute code and returns a tuple containing
foreground (fg), foreground intensity (fgi), background (bg), and
background intensity (bgi)
Attributes can be joined using ``fg | fgi | bg | bgi`` | 3.551277 | 2.256175 | 1.574025 |
x, y = self._get_position()
if place == 'up':
y -= distance
elif place == 'down':
for i in range(distance): print
nx, ny = self._get_position()
y = ny
self.move('beginning of line')
elif place == 'left':
x -... | def move(self, place, distance = 1) | see doc in Term class | 3.486785 | 3.366531 | 1.03572 |
#TODO: clear attributes too
if scope == 'screen':
bos = (0, self._get_console_info()['window']['top'])
cols, lines = self.get_size()
length = cols * lines
self._clear_console(length, bos)
self.move('beginning of screen')
elif s... | def clear(self, scope = 'screen') | see doc in Term class
According to http://support.microsoft.com/kb/99261 the best way
to clear the console is to write out empty spaces | 2.816714 | 2.729513 | 1.031947 |
#TODO: unicode support
strbuffer = self.ctypes.create_string_buffer(1024)
size = self.ctypes.c_short(1024)
#unicode versions are (Get|Set)ConsolTitleW
self.ctypes.windll.kernel32.GetConsoleTitleA(strbuffer, size)
return strbuffer.value | def _get_title(self) | According to http://support.microsoft.com/kb/124103 the buffer
size is 1024
Does not support unicode, only ANSI | 8.247613 | 5.799774 | 1.422058 |
x, y = coord
return self.ctypes.c_int(y << 16 | x) | def _get_coord(self, coord) | It's a hack, see fixcoord in pyreadline's console.py (revision
1289) | 10.376822 | 6.934254 | 1.496458 |
if isinstance(codes, basestring):
codes = [codes]
else:
codes = list(codes)
for code in codes:
if code not in Magic.DISPLAY.keys():
raise ValueError("'%s' not a valid display value" % code)
for color in (fg, bg):
if... | def displayformat(codes=[], fg=None, bg=None) | Makes sure all arguments are valid | 2.742549 | 2.583107 | 1.061725 |
dcodes = []
fg = bg = None
for code in codes:
code = int(code)
offset = code // 10
decimal = code % 10
if offset == 3 and decimal in Magic.COLORS.values(): fg = decimal
elif offset == 4 and decimal in Magic.COLORS.values(): bg ... | def rdisplay(codes) | Reads a list of codes and generates dict
>>> Magic.rdisplay([])
{}
>>> result = Magic.rdisplay([1,2,34,46])
>>> sorted(result.keys())
['bg', 'codes', 'fg']
>>> sorted(result['codes'])
['bright', 'dim']
>>> result['bg']
'cyan'
>>> r... | 3.809299 | 3.471942 | 1.097167 |
return self._makeApiCall(self.funcinfo["listClients"], *args, **kwargs) | def listClients(self, *args, **kwargs) | List Clients
Get a list of all clients. With `prefix`, only clients for which
it is a prefix of the clientId are returned.
By default this end-point will try to return up to 1000 clients in one
request. But it **may return less, even none**.
It may also return a `continuationT... | 11.999548 | 16.51792 | 0.726456 |
return self._makeApiCall(self.funcinfo["client"], *args, **kwargs) | def client(self, *args, **kwargs) | Get Client
Get information about a single client.
This method gives output: ``v1/get-client-response.json#``
This method is ``stable`` | 16.800453 | 20.783997 | 0.808336 |
return self._makeApiCall(self.funcinfo["createClient"], *args, **kwargs) | def createClient(self, *args, **kwargs) | Create Client
Create a new client and get the `accessToken` for this client.
You should store the `accessToken` from this API call as there is no
other way to retrieve it.
If you loose the `accessToken` you can call `resetAccessToken` to reset
it, and a new `accessToken` will b... | 13.74135 | 17.736021 | 0.774771 |
return self._makeApiCall(self.funcinfo["updateClient"], *args, **kwargs) | def updateClient(self, *args, **kwargs) | Update Client
Update an exisiting client. The `clientId` and `accessToken` cannot be
updated, but `scopes` can be modified. The caller's scopes must
satisfy all scopes being added to the client in the update operation.
If no scopes are given in the request, the client's scopes remain
... | 13.304675 | 16.72472 | 0.79551 |
return self._makeApiCall(self.funcinfo["enableClient"], *args, **kwargs) | def enableClient(self, *args, **kwargs) | Enable Client
Enable a client that was disabled with `disableClient`. If the client
is already enabled, this does nothing.
This is typically used by identity providers to re-enable clients that
had been disabled when the corresponding identity's scopes changed.
This method gi... | 14.429929 | 18.101351 | 0.797174 |
return self._makeApiCall(self.funcinfo["disableClient"], *args, **kwargs) | def disableClient(self, *args, **kwargs) | Disable Client
Disable a client. If the client is already disabled, this does nothing.
This is typically used by identity providers to disable clients when the
corresponding identity's scopes no longer satisfy the client's scopes.
This method gives output: ``v1/get-client-response.js... | 13.950239 | 20.716976 | 0.673372 |
return self._makeApiCall(self.funcinfo["deleteClient"], *args, **kwargs) | def deleteClient(self, *args, **kwargs) | Delete Client
Delete a client, please note that any roles related to this client must
be deleted independently.
This method is ``stable`` | 13.176303 | 18.956249 | 0.69509 |
return self._makeApiCall(self.funcinfo["listRoles"], *args, **kwargs) | def listRoles(self, *args, **kwargs) | List Roles
Get a list of all roles, each role object also includes the list of
scopes it expands to.
This method gives output: ``v1/list-roles-response.json#``
This method is ``stable`` | 11.478325 | 14.675297 | 0.782153 |
return self._makeApiCall(self.funcinfo["listRoleIds"], *args, **kwargs) | def listRoleIds(self, *args, **kwargs) | List Role IDs
If no limit is given, the roleIds of all roles are returned. Since this
list may become long, callers can use the `limit` and `continuationToken`
query arguments to page through the responses.
This method gives output: ``v1/list-role-ids-response.json#``
This met... | 10.360328 | 13.558514 | 0.76412 |
return self._makeApiCall(self.funcinfo["listRoles2"], *args, **kwargs) | def listRoles2(self, *args, **kwargs) | List Roles
If no limit is given, all roles are returned. Since this
list may become long, callers can use the `limit` and `continuationToken`
query arguments to page through the responses.
This method gives output: ``v1/list-roles2-response.json#``
This method is ``stable`` | 10.348824 | 13.67588 | 0.756721 |
return self._makeApiCall(self.funcinfo["createRole"], *args, **kwargs) | def createRole(self, *args, **kwargs) | Create Role
Create a new role.
The caller's scopes must satisfy the new role's scopes.
If there already exists a role with the same `roleId` this operation
will fail. Use `updateRole` to modify an existing role.
Creation of a role that will generate an infinite expansion will... | 13.100797 | 19.590164 | 0.668744 |
return self._makeApiCall(self.funcinfo["updateRole"], *args, **kwargs) | def updateRole(self, *args, **kwargs) | Update Role
Update an existing role.
The caller's scopes must satisfy all of the new scopes being added, but
need not satisfy all of the role's existing scopes.
An update of a role that will generate an infinite expansion will result
in an error response.
This method ... | 13.099588 | 18.390396 | 0.712306 |
return self._makeApiCall(self.funcinfo["deleteRole"], *args, **kwargs) | def deleteRole(self, *args, **kwargs) | Delete Role
Delete a role. This operation will succeed regardless of whether or not
the role exists.
This method is ``stable`` | 12.457632 | 19.543098 | 0.637444 |
return self._makeApiCall(self.funcinfo["expandScopesGet"], *args, **kwargs) | def expandScopesGet(self, *args, **kwargs) | Expand Scopes
Return an expanded copy of the given scopeset, with scopes implied by any
roles included.
This call uses the GET method with an HTTP body. It remains only for
backward compatibility.
This method takes input: ``v1/scopeset.json#``
This method gives outpu... | 12.257007 | 14.587184 | 0.840259 |
return self._makeApiCall(self.funcinfo["expandScopes"], *args, **kwargs) | def expandScopes(self, *args, **kwargs) | Expand Scopes
Return an expanded copy of the given scopeset, with scopes implied by any
roles included.
This method takes input: ``v1/scopeset.json#``
This method gives output: ``v1/scopeset.json#``
This method is ``stable`` | 13.771347 | 17.121534 | 0.804329 |
return self._makeApiCall(self.funcinfo["currentScopes"], *args, **kwargs) | def currentScopes(self, *args, **kwargs) | Get Current Scopes
Return the expanded scopes available in the request, taking into account all sources
of scopes and scope restrictions (temporary credentials, assumeScopes, client scopes,
and roles).
This method gives output: ``v1/scopeset.json#``
This method is ``stable`` | 13.064919 | 16.650679 | 0.784648 |
return self._makeApiCall(self.funcinfo["awsS3Credentials"], *args, **kwargs) | def awsS3Credentials(self, *args, **kwargs) | Get Temporary Read/Write Credentials S3
Get temporary AWS credentials for `read-write` or `read-only` access to
a given `bucket` and `prefix` within that bucket.
The `level` parameter can be `read-write` or `read-only` and determines
which type of credentials are returned. Please note t... | 10.357337 | 15.77142 | 0.656716 |
return self._makeApiCall(self.funcinfo["azureTables"], *args, **kwargs) | def azureTables(self, *args, **kwargs) | List Tables in an Account Managed by Auth
Retrieve a list of all tables in an account.
This method gives output: ``v1/azure-table-list-response.json#``
This method is ``stable`` | 13.14632 | 14.876391 | 0.883704 |
return self._makeApiCall(self.funcinfo["azureTableSAS"], *args, **kwargs) | def azureTableSAS(self, *args, **kwargs) | Get Shared-Access-Signature for Azure Table
Get a shared access signature (SAS) string for use with a specific Azure
Table Storage table.
The `level` parameter can be `read-write` or `read-only` and determines
which type of credentials are returned. If level is read-write, it will cre... | 11.284507 | 15.944201 | 0.70775 |
return self._makeApiCall(self.funcinfo["azureContainers"], *args, **kwargs) | def azureContainers(self, *args, **kwargs) | List containers in an Account Managed by Auth
Retrieve a list of all containers in an account.
This method gives output: ``v1/azure-container-list-response.json#``
This method is ``stable`` | 12.662032 | 15.326218 | 0.826168 |
return self._makeApiCall(self.funcinfo["azureContainerSAS"], *args, **kwargs) | def azureContainerSAS(self, *args, **kwargs) | Get Shared-Access-Signature for Azure Container
Get a shared access signature (SAS) string for use with a specific Azure
Blob Storage container.
The `level` parameter can be `read-write` or `read-only` and determines
which type of credentials are returned. If level is read-write, it w... | 12.159605 | 16.181993 | 0.751428 |
return self._makeApiCall(self.funcinfo["sentryDSN"], *args, **kwargs) | def sentryDSN(self, *args, **kwargs) | Get DSN for Sentry Project
Get temporary DSN (access credentials) for a sentry project.
The credentials returned can be used with any Sentry client for up to
24 hours, after which the credentials will be automatically disabled.
If the project doesn't exist it will be created, and assig... | 12.870086 | 21.569767 | 0.596672 |
return self._makeApiCall(self.funcinfo["statsumToken"], *args, **kwargs) | def statsumToken(self, *args, **kwargs) | Get Token for Statsum Project
Get temporary `token` and `baseUrl` for sending metrics to statsum.
The token is valid for 24 hours, clients should refresh after expiration.
This method gives output: ``v1/statsum-token-response.json#``
This method is ``stable`` | 10.891448 | 13.373541 | 0.814403 |
return self._makeApiCall(self.funcinfo["websocktunnelToken"], *args, **kwargs) | def websocktunnelToken(self, *args, **kwargs) | Get a client token for the Websocktunnel service
Get a temporary token suitable for use connecting to a
[websocktunnel](https://github.com/taskcluster/websocktunnel) server.
The resulting token will only be accepted by servers with a matching audience
value. Reaching such a server is ... | 11.563721 | 14.896029 | 0.776296 |
width = utils.term.width
printy(bold(title.center(width)).as_utf8)
printy(bold((line * width)[:width]).as_utf8) | def h1(title, line=OVERLINE) | Prints bold text with line beneath it spanning width of terminal | 10.662756 | 10.124791 | 1.053133 |
r
if isinstance(color, basestring):
color = grapefruit.Color.NewFromHtml(color)
if isinstance(color, int):
(r, g, b) = xterm256.xterm_to_rgb(color)
elif hasattr(color, 'rgb'):
(r, g, b) = [int(c * 255.0) for c in color.rgb]
else:
(r, g, b) = color
assert isinstanc... | def parse_color(color) | r"""Turns a color into an (r, g, b) tuple
>>> parse_color('white')
(255, 255, 255)
>>> parse_color('#ff0000')
(255, 0, 0)
>>> parse_color('#f00')
(255, 0, 0)
>>> parse_color((255, 0, 0))
(255, 0, 0)
>>> from fabulous import grapefruit
>>> parse_color(grapefruit.Color((0.0, 1.0, ... | 2.308157 | 2.117607 | 1.089984 |
r
(r, g, b) = parse_color(color)
gcolor = grapefruit.Color((r / 255.0, g / 255.0, b / 255.0))
complement = gcolor.ComplementaryColor()
(r, g, b) = [int(c * 255.0) for c in complement.rgb]
return (r, g, b) | def complement(color) | r"""Calculates polar opposite of color
This isn't guaranteed to look good >_> (especially with brighter, higher
intensity colors.) This will be replaced with a formula that produces
better looking colors in the future.
>>> complement('red')
(0, 255, 76)
>>> complement((0, 100, 175))
(175, ... | 3.178391 | 4.015661 | 0.791499 |
width = utils.term.width
printy(bold(title.center(width)))
printy(bold((bar * width)[:width])) | def section(title, bar=OVERLINE, strm=sys.stdout) | Helper function for testing demo routines | 11.821371 | 10.792212 | 1.095361 |
ref = {
'exchange': 'worker-type-created',
'name': 'workerTypeCreated',
'routingKey': [
{
'constant': 'primary',
'multipleWords': False,
'name': 'routingKeyKind',
},
... | def workerTypeCreated(self, *args, **kwargs) | WorkerType Created Message
When a new `workerType` is created a message will be published to this
exchange.
This exchange outputs: ``http://schemas.taskcluster.net/aws-provisioner/v1/worker-type-message.json#``This exchange takes the following keys:
* routingKeyKind: Identifier for t... | 6.513806 | 2.931341 | 2.222125 |
ref = {
'exchange': 'worker-type-updated',
'name': 'workerTypeUpdated',
'routingKey': [
{
'constant': 'primary',
'multipleWords': False,
'name': 'routingKeyKind',
},
... | def workerTypeUpdated(self, *args, **kwargs) | WorkerType Updated Message
When a `workerType` is updated a message will be published to this
exchange.
This exchange outputs: ``http://schemas.taskcluster.net/aws-provisioner/v1/worker-type-message.json#``This exchange takes the following keys:
* routingKeyKind: Identifier for the r... | 6.766564 | 2.985801 | 2.266247 |
ref = {
'exchange': 'worker-type-removed',
'name': 'workerTypeRemoved',
'routingKey': [
{
'constant': 'primary',
'multipleWords': False,
'name': 'routingKeyKind',
},
... | def workerTypeRemoved(self, *args, **kwargs) | WorkerType Removed Message
When a `workerType` is removed a message will be published to this
exchange.
This exchange outputs: ``http://schemas.taskcluster.net/aws-provisioner/v1/worker-type-message.json#``This exchange takes the following keys:
* routingKeyKind: Identifier for the r... | 6.688625 | 2.948334 | 2.268612 |
ref = {
'exchange': 'jobs',
'name': 'jobs',
'routingKey': [
{
'multipleWords': False,
'name': 'destination',
},
{
'multipleWords': False,
... | def jobs(self, *args, **kwargs) | Job Messages
When a task run is scheduled or resolved, a message is posted to
this exchange in a Treeherder consumable format.
This exchange outputs: ``v1/pulse-job.json#``This exchange takes the following keys:
* destination: destination (required)
* project: project (requ... | 6.296947 | 3.711395 | 1.696652 |
for scope in scopes:
if not isinstance(scope, six.string_types):
raise exceptions.TaskclusterFailure('Scope must be string')
# Credentials can only be valid for 31 days. I hope that
# this is validated on the server somehow...
if expiry - start > datetime.timedelta(days=31):... | def createTemporaryCredentials(clientId, accessToken, start, expiry, scopes, name=None) | Create a set of temporary credentials
Callers should not apply any clock skew; clock drift is accounted for by
auth service.
clientId: the issuing clientId
accessToken: the issuer's accessToken
start: start time of credentials (datetime.datetime)
expiry: expiration time of credentials, (dateti... | 3.626096 | 3.585941 | 1.011198 |
o = self.options
c = o.get('credentials', {})
if c.get('clientId') and c.get('accessToken'):
ext = {}
cert = c.get('certificate')
if cert:
if six.PY3 and isinstance(cert, six.binary_type):
cert = cert.decode()
... | def makeHawkExt(self) | Make an 'ext' for Hawk authentication | 5.622715 | 5.1856 | 1.084294 |
if 'expiration' in kwargs:
expiration = kwargs['expiration']
del kwargs['expiration']
else:
expiration = self.options['signedUrlExpiration']
expiration = int(time.time() + expiration) # Mainly so that we throw if it's not a number
requestU... | def buildSignedUrl(self, methodName, *args, **kwargs) | Build a signed URL. This URL contains the credentials needed to access
a resource. | 4.749628 | 4.705598 | 1.009357 |
return liburls.api(
self.options['rootUrl'],
self.serviceName,
self.apiVersion,
route.rstrip('/')) | def _constructUrl(self, route) | Construct a URL for the given route on this service, based on the
rootUrl | 16.615015 | 14.44633 | 1.15012 |
x = self._processArgs(entry, *args, **kwargs)
routeParams, payload, query, paginationHandler, paginationLimit = x
route = self._subArgsInRoute(entry, routeParams)
# TODO: Check for limit being in the Query of the api ref
if paginationLimit and 'limit' in entry.get('que... | def _makeApiCall(self, entry, *args, **kwargs) | This function is used to dispatch calls to other functions
for a given API Reference entry | 4.068024 | 3.885698 | 1.046922 |
route = entry['route']
for arg, val in six.iteritems(args):
toReplace = "<%s>" % arg
if toReplace not in route:
raise exceptions.TaskclusterFailure(
'Arg %s not found in route for %s' % (arg, entry['name']))
val = urllib.... | def _subArgsInRoute(self, entry, args) | Given a route like "/task/<taskId>/artifacts" and a mapping like
{"taskId": "12345"}, return a string like "/task/12345/artifacts" | 4.401681 | 4.408571 | 0.998437 |
cred = self.options.get('credentials')
return (
cred and
'clientId' in cred and
'accessToken' in cred and
cred['clientId'] and
cred['accessToken']
) | def _hasCredentials(self) | Return True, if credentials is given | 4.38803 | 4.242522 | 1.034297 |
url = self._constructUrl(route)
log.debug('Full URL used is: %s', url)
hawkExt = self.makeHawkExt()
# Serialize payload if given
if payload is not None:
payload = utils.dumpJson(payload)
# Do a loop of retries
retry = -1 # we plus first i... | def _makeHttpRequest(self, method, route, payload) | Make an HTTP Request for the API endpoint. This method wraps
the logic about doing failure retry and passes off the actual work
of doing an HTTP request to another method. | 4.123868 | 4.103013 | 1.005083 |
url = self._constructUrl(route)
log.debug('Full URL used is: %s', url)
hawkExt = self.makeHawkExt()
# Serialize payload if given
if payload is not None:
payload = utils.dumpJson(payload)
# Do a loop of retries
retry = -1 # we plus first i... | async def _makeHttpRequest(self, method, route, payload) | Make an HTTP Request for the API endpoint. This method wraps
the logic about doing failure retry and passes off the actual work
of doing an HTTP request to another method. | 4.14269 | 4.112082 | 1.007444 |
return self._makeApiCall(self.funcinfo["listWorkerTypeSummaries"], *args, **kwargs) | def listWorkerTypeSummaries(self, *args, **kwargs) | List worker types with details
Return a list of worker types, including some summary information about
current capacity for each. While this list includes all defined worker types,
there may be running EC2 instances for deleted worker types that are not
included here. The list is unor... | 9.098146 | 10.789435 | 0.843246 |
return self._makeApiCall(self.funcinfo["workerTypeLastModified"], *args, **kwargs) | def workerTypeLastModified(self, *args, **kwargs) | Get Worker Type Last Modified Time
This method is provided to allow workers to see when they were
last modified. The value provided through UserData can be
compared against this value to see if changes have been made
If the worker type definition has not been changed, the date
... | 12.954634 | 15.249971 | 0.849486 |
return self._makeApiCall(self.funcinfo["removeWorkerType"], *args, **kwargs) | def removeWorkerType(self, *args, **kwargs) | Delete Worker Type
Delete a worker type definition. This method will only delete
the worker type definition from the storage table. The actual
deletion will be handled by a background worker. As soon as this
method is called for a worker type, the background worker will
immed... | 13.615961 | 18.677698 | 0.728996 |
return self._makeApiCall(self.funcinfo["getSecret"], *args, **kwargs) | def getSecret(self, *args, **kwargs) | Get a Secret
Retrieve a secret from storage. The result contains any passwords or
other restricted information verbatim as well as a temporary credential
based on the scopes specified when the secret was created.
It is important that this secret is deleted by the consumer (`removeSecr... | 12.483332 | 17.721292 | 0.704426 |
return self._makeApiCall(self.funcinfo["instanceStarted"], *args, **kwargs) | def instanceStarted(self, *args, **kwargs) | Report an instance starting
An instance will report in by giving its instance id as well
as its security token. The token is given and checked to ensure
that it matches a real token that exists to ensure that random
machines do not check in. We could generate a different token
... | 19.048504 | 18.193613 | 1.046989 |
return self._makeApiCall(self.funcinfo["state"], *args, **kwargs) | def state(self, *args, **kwargs) | Get AWS State for a worker type
Return the state of a given workertype as stored by the provisioner.
This state is stored as three lists: 1 for running instances, 1 for
pending requests. The `summary` property contains an updated summary
similar to that returned from `listWorkerTypeSum... | 16.607525 | 19.154484 | 0.867031 |
return self._makeApiCall(self.funcinfo["backendStatus"], *args, **kwargs) | def backendStatus(self, *args, **kwargs) | Backend Status
This endpoint is used to show when the last time the provisioner
has checked in. A check in is done through the deadman's snitch
api. It is done at the conclusion of a provisioning iteration
and used to tell if the background provisioning process is still
runnin... | 12.228003 | 15.284621 | 0.80002 |
return await self._makeApiCall(self.funcinfo["set"], *args, **kwargs) | async def set(self, *args, **kwargs) | Set Secret
Set the secret associated with some key. If the secret already exists, it is
updated instead.
This method takes input: ``v1/secret.json#``
This method is ``stable`` | 16.32428 | 29.481861 | 0.553706 |
return await self._makeApiCall(self.funcinfo["remove"], *args, **kwargs) | async def remove(self, *args, **kwargs) | Delete Secret
Delete the secret associated with some key.
This method is ``stable`` | 16.918133 | 32.53352 | 0.520022 |
return await self._makeApiCall(self.funcinfo["get"], *args, **kwargs) | async def get(self, *args, **kwargs) | Read Secret
Read the secret associated with some key. If the secret has recently
expired, the response code 410 is returned. If the caller lacks the
scope necessary to get the secret, the call will fail with a 403 code
regardless of whether the secret exists.
This method give... | 16.441494 | 26.650238 | 0.616936 |
while True:
stdout.write(prompt_text)
value = stdout.raw_input(prompt_ext)
if value == '': return default
try:
if cast != None: value = cast(value, *castarg, **castkwarg)
except ValueError as details:
if cast in NICE_INPUT_ERRORS: # see comment ab... | def input_object(prompt_text, cast = None, default = None,
prompt_ext = ': ', castarg = [], castkwarg = {}) | Gets input from the command line and validates it.
prompt_text
A string. Used to prompt the user. Do not include a trailing
space.
prompt_ext
Added on to the prompt at the end. At the moment this must not
include any control stuff because it is send directly to
... | 4.334048 | 4.327962 | 1.001406 |
values = list(values)
for i in range(len(values)):
if not isinstance(values[i], dict):
values[i] = {'values': [values[i]]}
try:
import readline, rlcomplete
wordlist = [ str(v) for value in values
for v in value['values']]
completer = rlcom... | def query(question, values, default=None, list_values = False, ignorecase = True ) | Preset a few options
The question argument is a string, nothing magical.
The values argument accepts input in two different forms. The simpler form
(a tuple with strings) looks like:
.. code-block:: python
('Male','Female')
And it will pop up a question a... | 3.99449 | 4.119315 | 0.969698 |
if ignorecase: value = value.lower()
for item in answers:
for a in item['values']:
if ignorecase and (value == str(a).lower()):
return item['values'][0]
elif value == a:
return item['values'][0]
raise ValueError("Response '%s' not understo... | def query_cast(value, answers, ignorecase = False) | A cast function for query
Answers should look something like it does in query | 3.720143 | 4.064571 | 0.915261 |
try:
import readline, rlcomplete
completer = rlcomplete.PathCompleter()
readline.set_completer_delims(completer.delims)
readline.parse_and_bind("tab: complete")
readline.set_completer(completer.complete)
except ImportError:
pass
while True:
f = ra... | def file_chooser(prompt_text = "Enter File: ", default=None, filearg=[], filekwarg={}) | A simple tool to get a file from the user. Takes keyworded arguemnts
and passes them to open().
If the user enters nothing the function will return the ``default`` value.
Otherwise it continues to prompt the user until it get's a decent response.
filekwarg may contain arguements passed on to `... | 2.461095 | 2.503139 | 0.983204 |
return self._makeApiCall(self.funcinfo["getHookStatus"], *args, **kwargs) | def getHookStatus(self, *args, **kwargs) | Get hook status
This endpoint will return the current status of the hook. This represents a
snapshot in time and may vary from one call to the next.
This method is deprecated in favor of listLastFires.
This method gives output: ``v1/hook-status.json#``
This method is ``depre... | 10.829028 | 14.410114 | 0.751488 |
return self._makeApiCall(self.funcinfo["createHook"], *args, **kwargs) | def createHook(self, *args, **kwargs) | Create a hook
This endpoint will create a new hook.
The caller's credentials must include the role that will be used to
create the task. That role must satisfy task.scopes as well as the
necessary scopes to add the task to the queue.
This method takes input: ``v1/create-hook-... | 14.777387 | 19.089968 | 0.774092 |
return self._makeApiCall(self.funcinfo["listLastFires"], *args, **kwargs) | def listLastFires(self, *args, **kwargs) | Get information about recent hook fires
This endpoint will return information about the the last few times this hook has been
fired, including whether the hook was fired successfully or not
This method gives output: ``v1/list-lastFires-response.json#``
This method is ``experimental`` | 10.836079 | 12.565206 | 0.862388 |
ref = {
'exchange': 'task-defined',
'name': 'taskDefined',
'routingKey': [
{
'constant': 'primary',
'multipleWords': False,
'name': 'routingKeyKind',
},
{
... | def taskDefined(self, *args, **kwargs) | Task Defined Messages
When a task is created or just defined a message is posted to this
exchange.
This message exchange is mainly useful when tasks are scheduled by a
scheduler that uses `defineTask` as this does not make the task
`pending`. Thus, no `taskPending` message is p... | 3.070005 | 1.896406 | 1.618854 |
ref = {
'exchange': 'task-pending',
'name': 'taskPending',
'routingKey': [
{
'constant': 'primary',
'multipleWords': False,
'name': 'routingKeyKind',
},
{
... | def taskPending(self, *args, **kwargs) | Task Pending Messages
When a task becomes `pending` a message is posted to this exchange.
This is useful for workers who doesn't want to constantly poll the queue
for new tasks. The queue will also be authority for task states and
claims. But using this exchange workers should be able ... | 3.061253 | 1.897729 | 1.613114 |
ref = {
'exchange': 'task-running',
'name': 'taskRunning',
'routingKey': [
{
'constant': 'primary',
'multipleWords': False,
'name': 'routingKeyKind',
},
{
... | def taskRunning(self, *args, **kwargs) | Task Running Messages
Whenever a task is claimed by a worker, a run is started on the worker,
and a message is posted on this exchange.
This exchange outputs: ``v1/task-running-message.json#``This exchange takes the following keys:
* routingKeyKind: Identifier for the routing-key kin... | 3.048222 | 1.88686 | 1.6155 |
ref = {
'exchange': 'artifact-created',
'name': 'artifactCreated',
'routingKey': [
{
'constant': 'primary',
'multipleWords': False,
'name': 'routingKeyKind',
},
... | def artifactCreated(self, *args, **kwargs) | Artifact Creation Messages
Whenever the `createArtifact` end-point is called, the queue will create
a record of the artifact and post a message on this exchange. All of this
happens before the queue returns a signed URL for the caller to upload
the actual artifact with (pending on `stor... | 3.209855 | 1.916553 | 1.674806 |
ref = {
'exchange': 'task-completed',
'name': 'taskCompleted',
'routingKey': [
{
'constant': 'primary',
'multipleWords': False,
'name': 'routingKeyKind',
},
{... | def taskCompleted(self, *args, **kwargs) | Task Completed Messages
When a task is successfully completed by a worker a message is posted
this exchange.
This message is routed using the `runId`, `workerGroup` and `workerId`
that completed the task. But information about additional runs is also
available from the task stat... | 3.097823 | 1.925077 | 1.609195 |
ref = {
'exchange': 'task-failed',
'name': 'taskFailed',
'routingKey': [
{
'constant': 'primary',
'multipleWords': False,
'name': 'routingKeyKind',
},
{
... | def taskFailed(self, *args, **kwargs) | Task Failed Messages
When a task ran, but failed to complete successfully a message is posted
to this exchange. This is same as worker ran task-specific code, but the
task specific code exited non-zero.
This exchange outputs: ``v1/task-failed-message.json#``This exchange takes the foll... | 3.063371 | 1.909644 | 1.604158 |
ref = {
'exchange': 'task-exception',
'name': 'taskException',
'routingKey': [
{
'constant': 'primary',
'multipleWords': False,
'name': 'routingKeyKind',
},
{... | def taskException(self, *args, **kwargs) | Task Exception Messages
Whenever Taskcluster fails to run a message is posted to this exchange.
This happens if the task isn't completed before its `deadlìne`,
all retries failed (i.e. workers stopped responding), the task was
canceled by another entity, or the task carried a malformed ... | 3.078043 | 1.890791 | 1.627913 |
ref = {
'exchange': 'task-group-resolved',
'name': 'taskGroupResolved',
'routingKey': [
{
'constant': 'primary',
'multipleWords': False,
'name': 'routingKeyKind',
},
... | def taskGroupResolved(self, *args, **kwargs) | Task Group Resolved Messages
A message is published on task-group-resolved whenever all submitted
tasks (whether scheduled or unscheduled) for a given task group have
been resolved, regardless of whether they resolved as successful or
not. A task group may be resolved multiple times, si... | 4.761736 | 2.957434 | 1.610091 |
if text != self.text:
self.matches = self.completelist(text)
self.text = text
try:
return self.matches[state]
except IndexError:
return None | def complete(self, text, state) | The actual completion method
This method is not meant to be overridden. Override the
completelist method instead. It will make your life much easier.
For more detail see documentation for readline.set_completer | 3.894924 | 3.502329 | 1.112095 |
if not prefix.startswith('~'):
raise ValueError("prefix must start with ~")
try: import pwd
except ImportError:
try: import winpwd as pwd
except ImportError: return []
return ['~' + u[0] for u in pwd.getpwall() if u[0].startswith(prefix[1:])] | def matchuserhome(prefix) | To find matches that start with prefix.
For example, if prefix = '~user' this
returns list of possible matches in form of ['~userspam','~usereggs'] etc.
matchuserdir('~') returns all users | 4.089888 | 3.751215 | 1.090284 |
path = os.path.expanduser(text)
if len(path) == 0 or path[0] != os.path.sep:
path = os.path.join(os.getcwd(), path)
if text == '~':
dpath = dtext = ''
bpath = '~'
files = ['~/']
elif text.startswith('~') and text.find('/', 1) < 0:
... | def completelist(self, text) | Return a list of potential matches for completion
n.b. you want to complete to a file in the current working directory
that starts with a ~, use ./~ when typing in. Paths that start with
~ are magical and specify users' home paths | 2.928554 | 2.821175 | 1.038062 |
return await self._makeApiCall(self.funcinfo["status"], *args, **kwargs) | async def status(self, *args, **kwargs) | Get task status
Get task status structure from `taskId`
This method gives output: ``v1/task-status-response.json#``
This method is ``stable`` | 15.748368 | 22.937397 | 0.68658 |
return await self._makeApiCall(self.funcinfo["listTaskGroup"], *args, **kwargs) | async def listTaskGroup(self, *args, **kwargs) | List Task Group
List tasks sharing the same `taskGroupId`.
As a task-group may contain an unbounded number of tasks, this end-point
may return a `continuationToken`. To continue listing tasks you must call
the `listTaskGroup` again with the `continuationToken` as the
query-stri... | 11.194547 | 19.158709 | 0.584306 |
return await self._makeApiCall(self.funcinfo["listDependentTasks"], *args, **kwargs) | async def listDependentTasks(self, *args, **kwargs) | List Dependent Tasks
List tasks that depend on the given `taskId`.
As many tasks from different task-groups may dependent on a single tasks,
this end-point may return a `continuationToken`. To continue listing
tasks you must call `listDependentTasks` again with the
`continuatio... | 11.768744 | 19.635559 | 0.599359 |
return await self._makeApiCall(self.funcinfo["createTask"], *args, **kwargs) | async def createTask(self, *args, **kwargs) | Create New Task
Create a new task, this is an **idempotent** operation, so repeat it if
you get an internal server error or network connection is dropped.
**Task `deadline`**: the deadline property can be no more than 5 days
into the future. This is to limit the amount of pending tasks... | 12.782084 | 22.82023 | 0.560121 |
return await self._makeApiCall(self.funcinfo["claimWork"], *args, **kwargs) | async def claimWork(self, *args, **kwargs) | Claim Work
Claim pending task(s) for the given `provisionerId`/`workerType` queue.
If any work is available (even if fewer than the requested number of
tasks, this will return immediately. Otherwise, it will block for tens of
seconds waiting for work. If no work appears, it will retur... | 14.032276 | 22.696192 | 0.618266 |
return await self._makeApiCall(self.funcinfo["claimTask"], *args, **kwargs) | async def claimTask(self, *args, **kwargs) | Claim Task
claim a task - never documented
This method takes input: ``v1/task-claim-request.json#``
This method gives output: ``v1/task-claim-response.json#``
This method is ``deprecated`` | 13.626156 | 18.705124 | 0.728472 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.