id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
234,400
kylejusticemagnuson/pyti
pyti/directional_indicators.py
average_directional_index
def average_directional_index(close_data, high_data, low_data, period): """ Average Directional Index. Formula: ADX = 100 * SMMA(abs((+DI - -DI) / (+DI + -DI))) """ avg_di = (abs( (positive_directional_index( close_data, high_data, low_data, period) - ...
python
def average_directional_index(close_data, high_data, low_data, period): """ Average Directional Index. Formula: ADX = 100 * SMMA(abs((+DI - -DI) / (+DI + -DI))) """ avg_di = (abs( (positive_directional_index( close_data, high_data, low_data, period) - ...
[ "def", "average_directional_index", "(", "close_data", ",", "high_data", ",", "low_data", ",", "period", ")", ":", "avg_di", "=", "(", "abs", "(", "(", "positive_directional_index", "(", "close_data", ",", "high_data", ",", "low_data", ",", "period", ")", "-",...
Average Directional Index. Formula: ADX = 100 * SMMA(abs((+DI - -DI) / (+DI + -DI)))
[ "Average", "Directional", "Index", "." ]
2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2
https://github.com/kylejusticemagnuson/pyti/blob/2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2/pyti/directional_indicators.py#L107-L125
234,401
kylejusticemagnuson/pyti
pyti/linear_weighted_moving_average.py
linear_weighted_moving_average
def linear_weighted_moving_average(data, period): """ Linear Weighted Moving Average. Formula: LWMA = SUM(DATA[i]) * i / SUM(i) """ catch_errors.check_for_period_error(data, period) idx_period = list(range(1, period+1)) lwma = [(sum([i * idx_period[data[idx-(period-1):idx+1].index(i)] ...
python
def linear_weighted_moving_average(data, period): """ Linear Weighted Moving Average. Formula: LWMA = SUM(DATA[i]) * i / SUM(i) """ catch_errors.check_for_period_error(data, period) idx_period = list(range(1, period+1)) lwma = [(sum([i * idx_period[data[idx-(period-1):idx+1].index(i)] ...
[ "def", "linear_weighted_moving_average", "(", "data", ",", "period", ")", ":", "catch_errors", ".", "check_for_period_error", "(", "data", ",", "period", ")", "idx_period", "=", "list", "(", "range", "(", "1", ",", "period", "+", "1", ")", ")", "lwma", "="...
Linear Weighted Moving Average. Formula: LWMA = SUM(DATA[i]) * i / SUM(i)
[ "Linear", "Weighted", "Moving", "Average", "." ]
2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2
https://github.com/kylejusticemagnuson/pyti/blob/2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2/pyti/linear_weighted_moving_average.py#L7-L21
234,402
kylejusticemagnuson/pyti
pyti/volume_oscillator.py
volume_oscillator
def volume_oscillator(volume, short_period, long_period): """ Volume Oscillator. Formula: vo = 100 * (SMA(vol, short) - SMA(vol, long) / SMA(vol, long)) """ catch_errors.check_for_period_error(volume, short_period) catch_errors.check_for_period_error(volume, long_period) vo = (100 * ((...
python
def volume_oscillator(volume, short_period, long_period): """ Volume Oscillator. Formula: vo = 100 * (SMA(vol, short) - SMA(vol, long) / SMA(vol, long)) """ catch_errors.check_for_period_error(volume, short_period) catch_errors.check_for_period_error(volume, long_period) vo = (100 * ((...
[ "def", "volume_oscillator", "(", "volume", ",", "short_period", ",", "long_period", ")", ":", "catch_errors", ".", "check_for_period_error", "(", "volume", ",", "short_period", ")", "catch_errors", ".", "check_for_period_error", "(", "volume", ",", "long_period", ")...
Volume Oscillator. Formula: vo = 100 * (SMA(vol, short) - SMA(vol, long) / SMA(vol, long))
[ "Volume", "Oscillator", "." ]
2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2
https://github.com/kylejusticemagnuson/pyti/blob/2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2/pyti/volume_oscillator.py#L6-L18
234,403
kylejusticemagnuson/pyti
pyti/triple_exponential_moving_average.py
triple_exponential_moving_average
def triple_exponential_moving_average(data, period): """ Triple Exponential Moving Average. Formula: TEMA = (3*EMA - 3*EMA(EMA)) + EMA(EMA(EMA)) """ catch_errors.check_for_period_error(data, period) tema = ((3 * ema(data, period) - (3 * ema(ema(data, period), period))) + ema(em...
python
def triple_exponential_moving_average(data, period): """ Triple Exponential Moving Average. Formula: TEMA = (3*EMA - 3*EMA(EMA)) + EMA(EMA(EMA)) """ catch_errors.check_for_period_error(data, period) tema = ((3 * ema(data, period) - (3 * ema(ema(data, period), period))) + ema(em...
[ "def", "triple_exponential_moving_average", "(", "data", ",", "period", ")", ":", "catch_errors", ".", "check_for_period_error", "(", "data", ",", "period", ")", "tema", "=", "(", "(", "3", "*", "ema", "(", "data", ",", "period", ")", "-", "(", "3", "*",...
Triple Exponential Moving Average. Formula: TEMA = (3*EMA - 3*EMA(EMA)) + EMA(EMA(EMA))
[ "Triple", "Exponential", "Moving", "Average", "." ]
2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2
https://github.com/kylejusticemagnuson/pyti/blob/2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2/pyti/triple_exponential_moving_average.py#L8-L20
234,404
kylejusticemagnuson/pyti
pyti/money_flow.py
money_flow
def money_flow(close_data, high_data, low_data, volume): """ Money Flow. Formula: MF = VOLUME * TYPICAL PRICE """ catch_errors.check_for_input_len_diff( close_data, high_data, low_data, volume ) mf = volume * tp(close_data, high_data, low_data) return mf
python
def money_flow(close_data, high_data, low_data, volume): """ Money Flow. Formula: MF = VOLUME * TYPICAL PRICE """ catch_errors.check_for_input_len_diff( close_data, high_data, low_data, volume ) mf = volume * tp(close_data, high_data, low_data) return mf
[ "def", "money_flow", "(", "close_data", ",", "high_data", ",", "low_data", ",", "volume", ")", ":", "catch_errors", ".", "check_for_input_len_diff", "(", "close_data", ",", "high_data", ",", "low_data", ",", "volume", ")", "mf", "=", "volume", "*", "tp", "("...
Money Flow. Formula: MF = VOLUME * TYPICAL PRICE
[ "Money", "Flow", "." ]
2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2
https://github.com/kylejusticemagnuson/pyti/blob/2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2/pyti/money_flow.py#L6-L17
234,405
mrooney/mintapi
mintapi/api.py
Mint.request_and_check
def request_and_check(self, url, method='get', expected_content_type=None, **kwargs): """Performs a request, and checks that the status is OK, and that the content-type matches expectations. Args: url: URL to request method: either 'get' or 'post' ...
python
def request_and_check(self, url, method='get', expected_content_type=None, **kwargs): """Performs a request, and checks that the status is OK, and that the content-type matches expectations. Args: url: URL to request method: either 'get' or 'post' ...
[ "def", "request_and_check", "(", "self", ",", "url", ",", "method", "=", "'get'", ",", "expected_content_type", "=", "None", ",", "*", "*", "kwargs", ")", ":", "assert", "method", "in", "[", "'get'", ",", "'post'", "]", "result", "=", "self", ".", "dri...
Performs a request, and checks that the status is OK, and that the content-type matches expectations. Args: url: URL to request method: either 'get' or 'post' expected_content_type: prefix to match response content-type against **kwargs: passed to the request met...
[ "Performs", "a", "request", "and", "checks", "that", "the", "status", "is", "OK", "and", "that", "the", "content", "-", "type", "matches", "expectations", "." ]
44fddbeac79a68da657ad8118e02fcde968f8dfe
https://github.com/mrooney/mintapi/blob/44fddbeac79a68da657ad8118e02fcde968f8dfe/mintapi/api.py#L394-L419
234,406
mrooney/mintapi
mintapi/api.py
Mint.get_transactions_json
def get_transactions_json(self, include_investment=False, skip_duplicates=False, start_date=None, id=0): """Returns the raw JSON transaction data as downloaded from Mint. The JSON transaction data includes some additional information missing from the CSV data, such...
python
def get_transactions_json(self, include_investment=False, skip_duplicates=False, start_date=None, id=0): """Returns the raw JSON transaction data as downloaded from Mint. The JSON transaction data includes some additional information missing from the CSV data, such...
[ "def", "get_transactions_json", "(", "self", ",", "include_investment", "=", "False", ",", "skip_duplicates", "=", "False", ",", "start_date", "=", "None", ",", "id", "=", "0", ")", ":", "# Warning: This is a global property for the user that we are changing.", "self", ...
Returns the raw JSON transaction data as downloaded from Mint. The JSON transaction data includes some additional information missing from the CSV data, such as whether the transaction is pending or completed, but leaves off the year for current year transactions. Warning: In order to ...
[ "Returns", "the", "raw", "JSON", "transaction", "data", "as", "downloaded", "from", "Mint", ".", "The", "JSON", "transaction", "data", "includes", "some", "additional", "information", "missing", "from", "the", "CSV", "data", "such", "as", "whether", "the", "tr...
44fddbeac79a68da657ad8118e02fcde968f8dfe
https://github.com/mrooney/mintapi/blob/44fddbeac79a68da657ad8118e02fcde968f8dfe/mintapi/api.py#L533-L594
234,407
mrooney/mintapi
mintapi/api.py
Mint.get_detailed_transactions
def get_detailed_transactions(self, include_investment=False, skip_duplicates=False, remove_pending=True, start_date=None): """Returns the JSON transaction data as a DataFrame, and converts current year...
python
def get_detailed_transactions(self, include_investment=False, skip_duplicates=False, remove_pending=True, start_date=None): """Returns the JSON transaction data as a DataFrame, and converts current year...
[ "def", "get_detailed_transactions", "(", "self", ",", "include_investment", "=", "False", ",", "skip_duplicates", "=", "False", ",", "remove_pending", "=", "True", ",", "start_date", "=", "None", ")", ":", "assert_pd", "(", ")", "result", "=", "self", ".", "...
Returns the JSON transaction data as a DataFrame, and converts current year dates and prior year dates into consistent datetime format, and reverses credit activity. Note: start_date must be in format mm/dd/yy. If pulls take too long, use a more recent start date. See json explanations ...
[ "Returns", "the", "JSON", "transaction", "data", "as", "a", "DataFrame", "and", "converts", "current", "year", "dates", "and", "prior", "year", "dates", "into", "consistent", "datetime", "format", "and", "reverses", "credit", "activity", "." ]
44fddbeac79a68da657ad8118e02fcde968f8dfe
https://github.com/mrooney/mintapi/blob/44fddbeac79a68da657ad8118e02fcde968f8dfe/mintapi/api.py#L596-L627
234,408
mrooney/mintapi
mintapi/api.py
Mint.get_transactions_csv
def get_transactions_csv(self, include_investment=False, acct=0): """Returns the raw CSV transaction data as downloaded from Mint. If include_investment == True, also includes transactions that Mint classifies as investment-related. You may find that the investment transaction data is ...
python
def get_transactions_csv(self, include_investment=False, acct=0): """Returns the raw CSV transaction data as downloaded from Mint. If include_investment == True, also includes transactions that Mint classifies as investment-related. You may find that the investment transaction data is ...
[ "def", "get_transactions_csv", "(", "self", ",", "include_investment", "=", "False", ",", "acct", "=", "0", ")", ":", "# Specifying accountId=0 causes Mint to return investment", "# transactions as well. Otherwise they are skipped by", "# default.", "params", "=", "None", "i...
Returns the raw CSV transaction data as downloaded from Mint. If include_investment == True, also includes transactions that Mint classifies as investment-related. You may find that the investment transaction data is not sufficiently detailed to actually be useful, however.
[ "Returns", "the", "raw", "CSV", "transaction", "data", "as", "downloaded", "from", "Mint", "." ]
44fddbeac79a68da657ad8118e02fcde968f8dfe
https://github.com/mrooney/mintapi/blob/44fddbeac79a68da657ad8118e02fcde968f8dfe/mintapi/api.py#L629-L648
234,409
mrooney/mintapi
mintapi/api.py
Mint.get_transactions
def get_transactions(self, include_investment=False): """Returns the transaction data as a Pandas DataFrame.""" assert_pd() s = StringIO(self.get_transactions_csv( include_investment=include_investment)) s.seek(0) df = pd.read_csv(s, parse_dates=['Date']) df.c...
python
def get_transactions(self, include_investment=False): """Returns the transaction data as a Pandas DataFrame.""" assert_pd() s = StringIO(self.get_transactions_csv( include_investment=include_investment)) s.seek(0) df = pd.read_csv(s, parse_dates=['Date']) df.c...
[ "def", "get_transactions", "(", "self", ",", "include_investment", "=", "False", ")", ":", "assert_pd", "(", ")", "s", "=", "StringIO", "(", "self", ".", "get_transactions_csv", "(", "include_investment", "=", "include_investment", ")", ")", "s", ".", "seek", ...
Returns the transaction data as a Pandas DataFrame.
[ "Returns", "the", "transaction", "data", "as", "a", "Pandas", "DataFrame", "." ]
44fddbeac79a68da657ad8118e02fcde968f8dfe
https://github.com/mrooney/mintapi/blob/44fddbeac79a68da657ad8118e02fcde968f8dfe/mintapi/api.py#L662-L672
234,410
StellarCN/py-stellar-base
stellar_base/address.py
Address.payments
def payments(self, cursor=None, order='asc', limit=10, sse=False): """Retrieve the payments JSON from this instance's Horizon server. Retrieve the payments JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start retu...
python
def payments(self, cursor=None, order='asc', limit=10, sse=False): """Retrieve the payments JSON from this instance's Horizon server. Retrieve the payments JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start retu...
[ "def", "payments", "(", "self", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ",", "sse", "=", "False", ")", ":", "return", "self", ".", "horizon", ".", "account_payments", "(", "address", "=", "self", ".", "address...
Retrieve the payments JSON from this instance's Horizon server. Retrieve the payments JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start returning records from. When streaming this can be set to "now" to str...
[ "Retrieve", "the", "payments", "JSON", "from", "this", "instance", "s", "Horizon", "server", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/address.py#L95-L109
234,411
StellarCN/py-stellar-base
stellar_base/address.py
Address.offers
def offers(self, cursor=None, order='asc', limit=10, sse=False): """Retrieve the offers JSON from this instance's Horizon server. Retrieve the offers JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start returning ...
python
def offers(self, cursor=None, order='asc', limit=10, sse=False): """Retrieve the offers JSON from this instance's Horizon server. Retrieve the offers JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start returning ...
[ "def", "offers", "(", "self", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ",", "sse", "=", "False", ")", ":", "return", "self", ".", "horizon", ".", "account_offers", "(", "self", ".", "address", ",", "cursor", ...
Retrieve the offers JSON from this instance's Horizon server. Retrieve the offers JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start returning records from. When streaming this can be set to "now" to stream ...
[ "Retrieve", "the", "offers", "JSON", "from", "this", "instance", "s", "Horizon", "server", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/address.py#L111-L125
234,412
StellarCN/py-stellar-base
stellar_base/address.py
Address.transactions
def transactions(self, cursor=None, order='asc', limit=10, sse=False): """Retrieve the transactions JSON from this instance's Horizon server. Retrieve the transactions JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where t...
python
def transactions(self, cursor=None, order='asc', limit=10, sse=False): """Retrieve the transactions JSON from this instance's Horizon server. Retrieve the transactions JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where t...
[ "def", "transactions", "(", "self", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ",", "sse", "=", "False", ")", ":", "return", "self", ".", "horizon", ".", "account_transactions", "(", "self", ".", "address", ",", ...
Retrieve the transactions JSON from this instance's Horizon server. Retrieve the transactions JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start returning records from. When streaming this can be set to "now...
[ "Retrieve", "the", "transactions", "JSON", "from", "this", "instance", "s", "Horizon", "server", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/address.py#L127-L141
234,413
StellarCN/py-stellar-base
stellar_base/address.py
Address.operations
def operations(self, cursor=None, order='asc', limit=10, sse=False): """Retrieve the operations JSON from this instance's Horizon server. Retrieve the operations JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to star...
python
def operations(self, cursor=None, order='asc', limit=10, sse=False): """Retrieve the operations JSON from this instance's Horizon server. Retrieve the operations JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to star...
[ "def", "operations", "(", "self", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ",", "sse", "=", "False", ")", ":", "return", "self", ".", "horizon", ".", "account_operations", "(", "self", ".", "address", ",", "cur...
Retrieve the operations JSON from this instance's Horizon server. Retrieve the operations JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start returning records from. When streaming this can be set to "now" to...
[ "Retrieve", "the", "operations", "JSON", "from", "this", "instance", "s", "Horizon", "server", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/address.py#L143-L158
234,414
StellarCN/py-stellar-base
stellar_base/address.py
Address.trades
def trades(self, cursor=None, order='asc', limit=10, sse=False): """Retrieve the trades JSON from this instance's Horizon server. Retrieve the trades JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start returning ...
python
def trades(self, cursor=None, order='asc', limit=10, sse=False): """Retrieve the trades JSON from this instance's Horizon server. Retrieve the trades JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start returning ...
[ "def", "trades", "(", "self", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ",", "sse", "=", "False", ")", ":", "return", "self", ".", "horizon", ".", "account_trades", "(", "self", ".", "address", ",", "cursor", ...
Retrieve the trades JSON from this instance's Horizon server. Retrieve the trades JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start returning records from. When streaming this can be set to "now" to stream ...
[ "Retrieve", "the", "trades", "JSON", "from", "this", "instance", "s", "Horizon", "server", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/address.py#L160-L174
234,415
StellarCN/py-stellar-base
stellar_base/address.py
Address.effects
def effects(self, cursor=None, order='asc', limit=10, sse=False): """Retrieve the effects JSON from this instance's Horizon server. Retrieve the effects JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start returni...
python
def effects(self, cursor=None, order='asc', limit=10, sse=False): """Retrieve the effects JSON from this instance's Horizon server. Retrieve the effects JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start returni...
[ "def", "effects", "(", "self", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ",", "sse", "=", "False", ")", ":", "return", "self", ".", "horizon", ".", "account_effects", "(", "self", ".", "address", ",", "cursor", ...
Retrieve the effects JSON from this instance's Horizon server. Retrieve the effects JSON response for the account associated with this :class:`Address`. :param cursor: A paging token, specifying where to start returning records from. When streaming this can be set to "now" to strea...
[ "Retrieve", "the", "effects", "JSON", "from", "this", "instance", "s", "Horizon", "server", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/address.py#L176-L191
234,416
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.submit
def submit(self, te): """Submit the transaction using a pooled connection, and retry on failure. `POST /transactions <https://www.stellar.org/developers/horizon/reference/endpoints/transactions-create.html>`_ Uses form-encoded data to send over to Horizon. :return: The JSON re...
python
def submit(self, te): """Submit the transaction using a pooled connection, and retry on failure. `POST /transactions <https://www.stellar.org/developers/horizon/reference/endpoints/transactions-create.html>`_ Uses form-encoded data to send over to Horizon. :return: The JSON re...
[ "def", "submit", "(", "self", ",", "te", ")", ":", "params", "=", "{", "'tx'", ":", "te", "}", "url", "=", "urljoin", "(", "self", ".", "horizon_uri", ",", "'transactions/'", ")", "# POST is not included in Retry's method_whitelist for a good reason.", "# our cust...
Submit the transaction using a pooled connection, and retry on failure. `POST /transactions <https://www.stellar.org/developers/horizon/reference/endpoints/transactions-create.html>`_ Uses form-encoded data to send over to Horizon. :return: The JSON response indicating the success/fai...
[ "Submit", "the", "transaction", "using", "a", "pooled", "connection", "and", "retry", "on", "failure", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L118-L158
234,417
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.account
def account(self, address): """Returns information and links relating to a single account. `GET /accounts/{account} <https://www.stellar.org/developers/horizon/reference/endpoints/accounts-single.html>`_ :param str address: The account ID to retrieve details about. :return: The...
python
def account(self, address): """Returns information and links relating to a single account. `GET /accounts/{account} <https://www.stellar.org/developers/horizon/reference/endpoints/accounts-single.html>`_ :param str address: The account ID to retrieve details about. :return: The...
[ "def", "account", "(", "self", ",", "address", ")", ":", "endpoint", "=", "'/accounts/{account_id}'", ".", "format", "(", "account_id", "=", "address", ")", "return", "self", ".", "query", "(", "endpoint", ")" ]
Returns information and links relating to a single account. `GET /accounts/{account} <https://www.stellar.org/developers/horizon/reference/endpoints/accounts-single.html>`_ :param str address: The account ID to retrieve details about. :return: The account details in a JSON response. ...
[ "Returns", "information", "and", "links", "relating", "to", "a", "single", "account", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L188-L200
234,418
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.account_data
def account_data(self, address, key): """This endpoint represents a single data associated with a given account. `GET /accounts/{account}/data/{key} <https://www.stellar.org/developers/horizon/reference/endpoints/data-for-account.html>`_ :param str address: The account ID to lo...
python
def account_data(self, address, key): """This endpoint represents a single data associated with a given account. `GET /accounts/{account}/data/{key} <https://www.stellar.org/developers/horizon/reference/endpoints/data-for-account.html>`_ :param str address: The account ID to lo...
[ "def", "account_data", "(", "self", ",", "address", ",", "key", ")", ":", "endpoint", "=", "'/accounts/{account_id}/data/{data_key}'", ".", "format", "(", "account_id", "=", "address", ",", "data_key", "=", "key", ")", "return", "self", ".", "query", "(", "e...
This endpoint represents a single data associated with a given account. `GET /accounts/{account}/data/{key} <https://www.stellar.org/developers/horizon/reference/endpoints/data-for-account.html>`_ :param str address: The account ID to look up a data item from. :param str key: T...
[ "This", "endpoint", "represents", "a", "single", "data", "associated", "with", "a", "given", "account", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L202-L217
234,419
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.account_effects
def account_effects(self, address, cursor=None, order='asc', limit=10, sse=False): """This endpoint represents all effects that changed a given account. `GET /accounts/{account}/effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-for-account.html...
python
def account_effects(self, address, cursor=None, order='asc', limit=10, sse=False): """This endpoint represents all effects that changed a given account. `GET /accounts/{account}/effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-for-account.html...
[ "def", "account_effects", "(", "self", ",", "address", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ",", "sse", "=", "False", ")", ":", "endpoint", "=", "'/accounts/{account_id}/effects'", ".", "format", "(", "account_id...
This endpoint represents all effects that changed a given account. `GET /accounts/{account}/effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-for-account.html>`_ :param str address: The account ID to look up effects for. :param cursor:...
[ "This", "endpoint", "represents", "all", "effects", "that", "changed", "a", "given", "account", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L219-L238
234,420
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.assets
def assets(self, asset_code=None, asset_issuer=None, cursor=None, order='asc', limit=10): """This endpoint represents all assets. It will give you all the assets in the system along with various statistics about each. See the documentation below for details on query parameters that are ...
python
def assets(self, asset_code=None, asset_issuer=None, cursor=None, order='asc', limit=10): """This endpoint represents all assets. It will give you all the assets in the system along with various statistics about each. See the documentation below for details on query parameters that are ...
[ "def", "assets", "(", "self", ",", "asset_code", "=", "None", ",", "asset_issuer", "=", "None", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ")", ":", "endpoint", "=", "'/assets'", "params", "=", "self", ".", "__qu...
This endpoint represents all assets. It will give you all the assets in the system along with various statistics about each. See the documentation below for details on query parameters that are available. `GET /assets{?asset_code,asset_issuer,cursor,limit,order} <https://www.st...
[ "This", "endpoint", "represents", "all", "assets", ".", "It", "will", "give", "you", "all", "the", "assets", "in", "the", "system", "along", "with", "various", "statistics", "about", "each", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L352-L376
234,421
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.transaction
def transaction(self, tx_hash): """The transaction details endpoint provides information on a single transaction. `GET /transactions/{hash} <https://www.stellar.org/developers/horizon/reference/endpoints/transactions-single.html>`_ :param str tx_hash: The hex-encoded transactio...
python
def transaction(self, tx_hash): """The transaction details endpoint provides information on a single transaction. `GET /transactions/{hash} <https://www.stellar.org/developers/horizon/reference/endpoints/transactions-single.html>`_ :param str tx_hash: The hex-encoded transactio...
[ "def", "transaction", "(", "self", ",", "tx_hash", ")", ":", "endpoint", "=", "'/transactions/{tx_hash}'", ".", "format", "(", "tx_hash", "=", "tx_hash", ")", "return", "self", ".", "query", "(", "endpoint", ")" ]
The transaction details endpoint provides information on a single transaction. `GET /transactions/{hash} <https://www.stellar.org/developers/horizon/reference/endpoints/transactions-single.html>`_ :param str tx_hash: The hex-encoded transaction hash. :return: A single transacti...
[ "The", "transaction", "details", "endpoint", "provides", "information", "on", "a", "single", "transaction", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L399-L412
234,422
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.transaction_operations
def transaction_operations(self, tx_hash, cursor=None, order='asc', include_failed=False, limit=10): """This endpoint represents all operations that are part of a given transaction. `GET /transactions/{hash}/operations{?cursor,limit,order} <https://www.stellar.org/developers/horizon/ref...
python
def transaction_operations(self, tx_hash, cursor=None, order='asc', include_failed=False, limit=10): """This endpoint represents all operations that are part of a given transaction. `GET /transactions/{hash}/operations{?cursor,limit,order} <https://www.stellar.org/developers/horizon/ref...
[ "def", "transaction_operations", "(", "self", ",", "tx_hash", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "include_failed", "=", "False", ",", "limit", "=", "10", ")", ":", "endpoint", "=", "'/transactions/{tx_hash}/operations'", ".", "format"...
This endpoint represents all operations that are part of a given transaction. `GET /transactions/{hash}/operations{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/operations-for-transaction.html>`_ :param str tx_hash: The hex-encoded transaction has...
[ "This", "endpoint", "represents", "all", "operations", "that", "are", "part", "of", "a", "given", "transaction", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L414-L432
234,423
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.transaction_effects
def transaction_effects(self, tx_hash, cursor=None, order='asc', limit=10): """This endpoint represents all effects that occurred as a result of a given transaction. `GET /transactions/{hash}/effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/ef...
python
def transaction_effects(self, tx_hash, cursor=None, order='asc', limit=10): """This endpoint represents all effects that occurred as a result of a given transaction. `GET /transactions/{hash}/effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/ef...
[ "def", "transaction_effects", "(", "self", ",", "tx_hash", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ")", ":", "endpoint", "=", "'/transactions/{tx_hash}/effects'", ".", "format", "(", "tx_hash", "=", "tx_hash", ")", ...
This endpoint represents all effects that occurred as a result of a given transaction. `GET /transactions/{hash}/effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-for-transaction.html>`_ :param str tx_hash: The hex-encoded transaction ...
[ "This", "endpoint", "represents", "all", "effects", "that", "occurred", "as", "a", "result", "of", "a", "given", "transaction", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L434-L451
234,424
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.order_book
def order_book(self, selling_asset_code, buying_asset_code, selling_asset_issuer=None, buying_asset_issuer=None, limit=10): """Return, for each orderbook, a summary of the orderbook and the bids and asks associated with that orderbook. See the external docs below for informat...
python
def order_book(self, selling_asset_code, buying_asset_code, selling_asset_issuer=None, buying_asset_issuer=None, limit=10): """Return, for each orderbook, a summary of the orderbook and the bids and asks associated with that orderbook. See the external docs below for informat...
[ "def", "order_book", "(", "self", ",", "selling_asset_code", ",", "buying_asset_code", ",", "selling_asset_issuer", "=", "None", ",", "buying_asset_issuer", "=", "None", ",", "limit", "=", "10", ")", ":", "selling_asset", "=", "Asset", "(", "selling_asset_code", ...
Return, for each orderbook, a summary of the orderbook and the bids and asks associated with that orderbook. See the external docs below for information on the arguments required. `GET /order_book <https://www.stellar.org/developers/horizon/reference/endpoints/orderbook-details.html>`_...
[ "Return", "for", "each", "orderbook", "a", "summary", "of", "the", "orderbook", "and", "the", "bids", "and", "asks", "associated", "with", "that", "orderbook", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L472-L505
234,425
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.ledger
def ledger(self, ledger_id): """The ledger details endpoint provides information on a single ledger. `GET /ledgers/{sequence} <https://www.stellar.org/developers/horizon/reference/endpoints/ledgers-single.html>`_ :param int ledger_id: The id of the ledger to look up. :return: T...
python
def ledger(self, ledger_id): """The ledger details endpoint provides information on a single ledger. `GET /ledgers/{sequence} <https://www.stellar.org/developers/horizon/reference/endpoints/ledgers-single.html>`_ :param int ledger_id: The id of the ledger to look up. :return: T...
[ "def", "ledger", "(", "self", ",", "ledger_id", ")", ":", "endpoint", "=", "'/ledgers/{ledger_id}'", ".", "format", "(", "ledger_id", "=", "ledger_id", ")", "return", "self", ".", "query", "(", "endpoint", ")" ]
The ledger details endpoint provides information on a single ledger. `GET /ledgers/{sequence} <https://www.stellar.org/developers/horizon/reference/endpoints/ledgers-single.html>`_ :param int ledger_id: The id of the ledger to look up. :return: The details of a single ledger. :...
[ "The", "ledger", "details", "endpoint", "provides", "information", "on", "a", "single", "ledger", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L527-L539
234,426
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.ledger_effects
def ledger_effects(self, ledger_id, cursor=None, order='asc', limit=10): """This endpoint represents all effects that occurred in the given ledger. `GET /ledgers/{id}/effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-for-ledger.html>`_ ...
python
def ledger_effects(self, ledger_id, cursor=None, order='asc', limit=10): """This endpoint represents all effects that occurred in the given ledger. `GET /ledgers/{id}/effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-for-ledger.html>`_ ...
[ "def", "ledger_effects", "(", "self", ",", "ledger_id", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ")", ":", "endpoint", "=", "'/ledgers/{ledger_id}/effects'", ".", "format", "(", "ledger_id", "=", "ledger_id", ")", "p...
This endpoint represents all effects that occurred in the given ledger. `GET /ledgers/{id}/effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-for-ledger.html>`_ :param int ledger_id: The id of the ledger to look up. :param int c...
[ "This", "endpoint", "represents", "all", "effects", "that", "occurred", "in", "the", "given", "ledger", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L541-L558
234,427
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.ledger_transactions
def ledger_transactions(self, ledger_id, cursor=None, order='asc', include_failed=False, limit=10): """This endpoint represents all transactions in a given ledger. `GET /ledgers/{id}/transactions{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/transactions-f...
python
def ledger_transactions(self, ledger_id, cursor=None, order='asc', include_failed=False, limit=10): """This endpoint represents all transactions in a given ledger. `GET /ledgers/{id}/transactions{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/transactions-f...
[ "def", "ledger_transactions", "(", "self", ",", "ledger_id", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "include_failed", "=", "False", ",", "limit", "=", "10", ")", ":", "endpoint", "=", "'/ledgers/{ledger_id}/transactions'", ".", "format", ...
This endpoint represents all transactions in a given ledger. `GET /ledgers/{id}/transactions{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/transactions-for-ledger.html>`_ :param int ledger_id: The id of the ledger to look up. :param int cursor: A ...
[ "This", "endpoint", "represents", "all", "transactions", "in", "a", "given", "ledger", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L600-L618
234,428
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.effects
def effects(self, cursor=None, order='asc', limit=10, sse=False): """This endpoint represents all effects. `GET /effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-all.html>`_ :param cursor: A paging token, specifying where to start ret...
python
def effects(self, cursor=None, order='asc', limit=10, sse=False): """This endpoint represents all effects. `GET /effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-all.html>`_ :param cursor: A paging token, specifying where to start ret...
[ "def", "effects", "(", "self", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ",", "sse", "=", "False", ")", ":", "endpoint", "=", "'/effects'", "params", "=", "self", ".", "__query_params", "(", "cursor", "=", "curs...
This endpoint represents all effects. `GET /effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-all.html>`_ :param cursor: A paging token, specifying where to start returning records from. When streaming this can be set to "now" to s...
[ "This", "endpoint", "represents", "all", "effects", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L620-L638
234,429
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.operations
def operations(self, cursor=None, order='asc', limit=10, include_failed=False, sse=False): """This endpoint represents all operations that are part of validated transactions. `GET /operations{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/operations...
python
def operations(self, cursor=None, order='asc', limit=10, include_failed=False, sse=False): """This endpoint represents all operations that are part of validated transactions. `GET /operations{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/operations...
[ "def", "operations", "(", "self", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ",", "include_failed", "=", "False", ",", "sse", "=", "False", ")", ":", "endpoint", "=", "'/operations'", "params", "=", "self", ".", ...
This endpoint represents all operations that are part of validated transactions. `GET /operations{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/operations-all.html>`_ :param cursor: A paging token, specifying where to start returning records from....
[ "This", "endpoint", "represents", "all", "operations", "that", "are", "part", "of", "validated", "transactions", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L640-L660
234,430
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.operation
def operation(self, op_id): """The operation details endpoint provides information on a single operation. `GET /operations/{id} <https://www.stellar.org/developers/horizon/reference/endpoints/operations-single.html>`_ :param id op_id: The operation ID to get details on. ...
python
def operation(self, op_id): """The operation details endpoint provides information on a single operation. `GET /operations/{id} <https://www.stellar.org/developers/horizon/reference/endpoints/operations-single.html>`_ :param id op_id: The operation ID to get details on. ...
[ "def", "operation", "(", "self", ",", "op_id", ")", ":", "endpoint", "=", "'/operations/{op_id}'", ".", "format", "(", "op_id", "=", "op_id", ")", "return", "self", ".", "query", "(", "endpoint", ")" ]
The operation details endpoint provides information on a single operation. `GET /operations/{id} <https://www.stellar.org/developers/horizon/reference/endpoints/operations-single.html>`_ :param id op_id: The operation ID to get details on. :return: Details on a single operation...
[ "The", "operation", "details", "endpoint", "provides", "information", "on", "a", "single", "operation", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L662-L674
234,431
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.operation_effects
def operation_effects(self, op_id, cursor=None, order='asc', limit=10): """This endpoint represents all effects that occurred as a result of a given operation. `GET /operations/{id}/effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-for-...
python
def operation_effects(self, op_id, cursor=None, order='asc', limit=10): """This endpoint represents all effects that occurred as a result of a given operation. `GET /operations/{id}/effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-for-...
[ "def", "operation_effects", "(", "self", ",", "op_id", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ")", ":", "endpoint", "=", "'/operations/{op_id}/effects'", ".", "format", "(", "op_id", "=", "op_id", ")", "params", ...
This endpoint represents all effects that occurred as a result of a given operation. `GET /operations/{id}/effects{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/effects-for-operation.html>`_ :param int op_id: The operation ID to get effects on. ...
[ "This", "endpoint", "represents", "all", "effects", "that", "occurred", "as", "a", "result", "of", "a", "given", "operation", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L676-L693
234,432
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.paths
def paths(self, destination_account, destination_amount, source_account, destination_asset_code, destination_asset_issuer=None): """Load a list of assets available to the source account id and find any payment paths from those source assets to the desired destination asset. ...
python
def paths(self, destination_account, destination_amount, source_account, destination_asset_code, destination_asset_issuer=None): """Load a list of assets available to the source account id and find any payment paths from those source assets to the desired destination asset. ...
[ "def", "paths", "(", "self", ",", "destination_account", ",", "destination_amount", ",", "source_account", ",", "destination_asset_code", ",", "destination_asset_issuer", "=", "None", ")", ":", "destination_asset", "=", "Asset", "(", "destination_asset_code", ",", "de...
Load a list of assets available to the source account id and find any payment paths from those source assets to the desired destination asset. See the below docs for more information on required and optional parameters for further specifying your search. `GET /paths <ht...
[ "Load", "a", "list", "of", "assets", "available", "to", "the", "source", "account", "id", "and", "find", "any", "payment", "paths", "from", "those", "source", "assets", "to", "the", "desired", "destination", "asset", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L716-L754
234,433
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.trades
def trades(self, base_asset_code=None, counter_asset_code=None, base_asset_issuer=None, counter_asset_issuer=None, offer_id=None, cursor=None, order='asc', limit=10): """Load a list of trades, optionally filtered by an orderbook. See the below docs for more information on required and op...
python
def trades(self, base_asset_code=None, counter_asset_code=None, base_asset_issuer=None, counter_asset_issuer=None, offer_id=None, cursor=None, order='asc', limit=10): """Load a list of trades, optionally filtered by an orderbook. See the below docs for more information on required and op...
[ "def", "trades", "(", "self", ",", "base_asset_code", "=", "None", ",", "counter_asset_code", "=", "None", ",", "base_asset_issuer", "=", "None", ",", "counter_asset_issuer", "=", "None", ",", "offer_id", "=", "None", ",", "cursor", "=", "None", ",", "order"...
Load a list of trades, optionally filtered by an orderbook. See the below docs for more information on required and optional parameters for further specifying your search. `GET /trades <https://www.stellar.org/developers/horizon/reference/endpoints/trades.html>`_ :param str ba...
[ "Load", "a", "list", "of", "trades", "optionally", "filtered", "by", "an", "orderbook", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L756-L790
234,434
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.trade_aggregations
def trade_aggregations(self, resolution, base_asset_code, counter_asset_code, base_asset_issuer=None, counter_asset_issuer=None, start_time=None, end_time=None, order='asc', limit=10, offset=0): """Load a list of aggregated historical trade data, optionally ...
python
def trade_aggregations(self, resolution, base_asset_code, counter_asset_code, base_asset_issuer=None, counter_asset_issuer=None, start_time=None, end_time=None, order='asc', limit=10, offset=0): """Load a list of aggregated historical trade data, optionally ...
[ "def", "trade_aggregations", "(", "self", ",", "resolution", ",", "base_asset_code", ",", "counter_asset_code", ",", "base_asset_issuer", "=", "None", ",", "counter_asset_issuer", "=", "None", ",", "start_time", "=", "None", ",", "end_time", "=", "None", ",", "o...
Load a list of aggregated historical trade data, optionally filtered by an orderbook. `GET /trade_aggregations <https://www.stellar.org/developers/horizon/reference/endpoints/trade_aggregations.html>`_ :param int start_time: Lower time boundary represented as millis since epoch. ...
[ "Load", "a", "list", "of", "aggregated", "historical", "trade", "data", "optionally", "filtered", "by", "an", "orderbook", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L792-L839
234,435
StellarCN/py-stellar-base
stellar_base/horizon.py
Horizon.offer_trades
def offer_trades(self, offer_id, cursor=None, order='asc', limit=10): """This endpoint represents all trades for a given offer. `GET /offers/{offer_id}/trades{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/trades-for-offer.html>`_ :param int offer_...
python
def offer_trades(self, offer_id, cursor=None, order='asc', limit=10): """This endpoint represents all trades for a given offer. `GET /offers/{offer_id}/trades{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/trades-for-offer.html>`_ :param int offer_...
[ "def", "offer_trades", "(", "self", ",", "offer_id", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "limit", "=", "10", ")", ":", "endpoint", "=", "'/offers/{offer_id}/trades'", ".", "format", "(", "offer_id", "=", "offer_id", ")", "params", ...
This endpoint represents all trades for a given offer. `GET /offers/{offer_id}/trades{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/trades-for-offer.html>`_ :param int offer_id: The offer ID to get trades on. :param int cursor: A paging token, spe...
[ "This", "endpoint", "represents", "all", "trades", "for", "a", "given", "offer", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L841-L857
234,436
StellarCN/py-stellar-base
stellar_base/transaction_envelope.py
TransactionEnvelope.sign
def sign(self, keypair): """Sign this transaction envelope with a given keypair. Note that the signature must not already be in this instance's list of signatures. :param keypair: The keypair to use for signing this transaction envelope. :type keypair: :class:`Keypa...
python
def sign(self, keypair): """Sign this transaction envelope with a given keypair. Note that the signature must not already be in this instance's list of signatures. :param keypair: The keypair to use for signing this transaction envelope. :type keypair: :class:`Keypa...
[ "def", "sign", "(", "self", ",", "keypair", ")", ":", "assert", "isinstance", "(", "keypair", ",", "Keypair", ")", "tx_hash", "=", "self", ".", "hash_meta", "(", ")", "sig", "=", "keypair", ".", "sign_decorated", "(", "tx_hash", ")", "sig_dict", "=", "...
Sign this transaction envelope with a given keypair. Note that the signature must not already be in this instance's list of signatures. :param keypair: The keypair to use for signing this transaction envelope. :type keypair: :class:`Keypair <stellar_base.keypair.Keypair>` ...
[ "Sign", "this", "transaction", "envelope", "with", "a", "given", "keypair", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/transaction_envelope.py#L43-L63
234,437
StellarCN/py-stellar-base
stellar_base/transaction_envelope.py
TransactionEnvelope.signature_base
def signature_base(self): """Get the signature base of this transaction envelope. Return the "signature base" of this transaction, which is the value that, when hashed, should be signed to create a signature that validators on the Stellar Network will accept. It is composed of ...
python
def signature_base(self): """Get the signature base of this transaction envelope. Return the "signature base" of this transaction, which is the value that, when hashed, should be signed to create a signature that validators on the Stellar Network will accept. It is composed of ...
[ "def", "signature_base", "(", "self", ")", ":", "network_id", "=", "self", ".", "network_id", "tx_type", "=", "Xdr", ".", "StellarXDRPacker", "(", ")", "tx_type", ".", "pack_EnvelopeType", "(", "Xdr", ".", "const", ".", "ENVELOPE_TYPE_TX", ")", "tx_type", "=...
Get the signature base of this transaction envelope. Return the "signature base" of this transaction, which is the value that, when hashed, should be signed to create a signature that validators on the Stellar Network will accept. It is composed of a 4 prefix bytes followed by the xdr-...
[ "Get", "the", "signature", "base", "of", "this", "transaction", "envelope", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/transaction_envelope.py#L99-L120
234,438
StellarCN/py-stellar-base
stellar_base/federation.py
get_federation_service
def get_federation_service(domain, allow_http=False): """Retrieve the FEDERATION_SERVER config from a domain's stellar.toml. :param str domain: The domain the .toml file is hosted at. :param bool allow_http: Specifies whether the request should go over plain HTTP vs HTTPS. Note it is recommend that...
python
def get_federation_service(domain, allow_http=False): """Retrieve the FEDERATION_SERVER config from a domain's stellar.toml. :param str domain: The domain the .toml file is hosted at. :param bool allow_http: Specifies whether the request should go over plain HTTP vs HTTPS. Note it is recommend that...
[ "def", "get_federation_service", "(", "domain", ",", "allow_http", "=", "False", ")", ":", "st", "=", "get_stellar_toml", "(", "domain", ",", "allow_http", ")", "if", "not", "st", ":", "return", "None", "return", "st", ".", "get", "(", "'FEDERATION_SERVER'",...
Retrieve the FEDERATION_SERVER config from a domain's stellar.toml. :param str domain: The domain the .toml file is hosted at. :param bool allow_http: Specifies whether the request should go over plain HTTP vs HTTPS. Note it is recommend that you *always* use HTTPS. :return str: The FEDERATION_SERV...
[ "Retrieve", "the", "FEDERATION_SERVER", "config", "from", "a", "domain", "s", "stellar", ".", "toml", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/federation.py#L76-L88
234,439
StellarCN/py-stellar-base
stellar_base/federation.py
get_auth_server
def get_auth_server(domain, allow_http=False): """Retrieve the AUTH_SERVER config from a domain's stellar.toml. :param str domain: The domain the .toml file is hosted at. :param bool allow_http: Specifies whether the request should go over plain HTTP vs HTTPS. Note it is recommend that you *always*...
python
def get_auth_server(domain, allow_http=False): """Retrieve the AUTH_SERVER config from a domain's stellar.toml. :param str domain: The domain the .toml file is hosted at. :param bool allow_http: Specifies whether the request should go over plain HTTP vs HTTPS. Note it is recommend that you *always*...
[ "def", "get_auth_server", "(", "domain", ",", "allow_http", "=", "False", ")", ":", "st", "=", "get_stellar_toml", "(", "domain", ",", "allow_http", ")", "if", "not", "st", ":", "return", "None", "return", "st", ".", "get", "(", "'AUTH_SERVER'", ")" ]
Retrieve the AUTH_SERVER config from a domain's stellar.toml. :param str domain: The domain the .toml file is hosted at. :param bool allow_http: Specifies whether the request should go over plain HTTP vs HTTPS. Note it is recommend that you *always* use HTTPS. :return str: The AUTH_SERVER url.
[ "Retrieve", "the", "AUTH_SERVER", "config", "from", "a", "domain", "s", "stellar", ".", "toml", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/federation.py#L91-L103
234,440
StellarCN/py-stellar-base
stellar_base/federation.py
get_stellar_toml
def get_stellar_toml(domain, allow_http=False): """Retrieve the stellar.toml file from a given domain. Retrieve the stellar.toml file for information about interacting with Stellar's federation protocol for a given Stellar Anchor (specified by a domain). :param str domain: The domain the .toml fil...
python
def get_stellar_toml(domain, allow_http=False): """Retrieve the stellar.toml file from a given domain. Retrieve the stellar.toml file for information about interacting with Stellar's federation protocol for a given Stellar Anchor (specified by a domain). :param str domain: The domain the .toml fil...
[ "def", "get_stellar_toml", "(", "domain", ",", "allow_http", "=", "False", ")", ":", "toml_link", "=", "'/.well-known/stellar.toml'", "if", "allow_http", ":", "protocol", "=", "'http://'", "else", ":", "protocol", "=", "'https://'", "url_list", "=", "[", "''", ...
Retrieve the stellar.toml file from a given domain. Retrieve the stellar.toml file for information about interacting with Stellar's federation protocol for a given Stellar Anchor (specified by a domain). :param str domain: The domain the .toml file is hosted at. :param bool allow_http: Specifies w...
[ "Retrieve", "the", "stellar", ".", "toml", "file", "from", "a", "given", "domain", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/federation.py#L106-L132
234,441
StellarCN/py-stellar-base
stellar_base/keypair.py
Keypair.account_xdr_object
def account_xdr_object(self): """Create PublicKey XDR object via public key bytes. :return: Serialized XDR of PublicKey type. """ return Xdr.types.PublicKey(Xdr.const.KEY_TYPE_ED25519, self.verifying_key.to_bytes())
python
def account_xdr_object(self): """Create PublicKey XDR object via public key bytes. :return: Serialized XDR of PublicKey type. """ return Xdr.types.PublicKey(Xdr.const.KEY_TYPE_ED25519, self.verifying_key.to_bytes())
[ "def", "account_xdr_object", "(", "self", ")", ":", "return", "Xdr", ".", "types", ".", "PublicKey", "(", "Xdr", ".", "const", ".", "KEY_TYPE_ED25519", ",", "self", ".", "verifying_key", ".", "to_bytes", "(", ")", ")" ]
Create PublicKey XDR object via public key bytes. :return: Serialized XDR of PublicKey type.
[ "Create", "PublicKey", "XDR", "object", "via", "public", "key", "bytes", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/keypair.py#L154-L160
234,442
StellarCN/py-stellar-base
stellar_base/keypair.py
Keypair.xdr
def xdr(self): """Generate base64 encoded XDR PublicKey object. Return a base64 encoded PublicKey XDR object, for sending over the wire when interacting with stellar. :return: The base64 encoded PublicKey XDR structure. """ kp = Xdr.StellarXDRPacker() kp.pack_Pu...
python
def xdr(self): """Generate base64 encoded XDR PublicKey object. Return a base64 encoded PublicKey XDR object, for sending over the wire when interacting with stellar. :return: The base64 encoded PublicKey XDR structure. """ kp = Xdr.StellarXDRPacker() kp.pack_Pu...
[ "def", "xdr", "(", "self", ")", ":", "kp", "=", "Xdr", ".", "StellarXDRPacker", "(", ")", "kp", ".", "pack_PublicKey", "(", "self", ".", "account_xdr_object", "(", ")", ")", "return", "base64", ".", "b64encode", "(", "kp", ".", "get_buffer", "(", ")", ...
Generate base64 encoded XDR PublicKey object. Return a base64 encoded PublicKey XDR object, for sending over the wire when interacting with stellar. :return: The base64 encoded PublicKey XDR structure.
[ "Generate", "base64", "encoded", "XDR", "PublicKey", "object", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/keypair.py#L162-L172
234,443
StellarCN/py-stellar-base
stellar_base/keypair.py
Keypair.verify
def verify(self, data, signature): """Verify the signature of a sequence of bytes. Verify the signature of a sequence of bytes using the verifying (public) key and the data that was originally signed, otherwise throws an exception. :param bytes data: A sequence of bytes that we...
python
def verify(self, data, signature): """Verify the signature of a sequence of bytes. Verify the signature of a sequence of bytes using the verifying (public) key and the data that was originally signed, otherwise throws an exception. :param bytes data: A sequence of bytes that we...
[ "def", "verify", "(", "self", ",", "data", ",", "signature", ")", ":", "try", ":", "return", "self", ".", "verifying_key", ".", "verify", "(", "signature", ",", "data", ")", "except", "ed25519", ".", "BadSignatureError", ":", "raise", "BadSignatureError", ...
Verify the signature of a sequence of bytes. Verify the signature of a sequence of bytes using the verifying (public) key and the data that was originally signed, otherwise throws an exception. :param bytes data: A sequence of bytes that were previously signed by the privat...
[ "Verify", "the", "signature", "of", "a", "sequence", "of", "bytes", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/keypair.py#L228-L243
234,444
StellarCN/py-stellar-base
stellar_base/keypair.py
Keypair.sign_decorated
def sign_decorated(self, data): """Sign a bytes-like object and return the decorated signature. Sign a bytes-like object by signing the data using the signing (private) key, and return a decorated signature, which includes the last four bytes of the public key as a signature hint to go ...
python
def sign_decorated(self, data): """Sign a bytes-like object and return the decorated signature. Sign a bytes-like object by signing the data using the signing (private) key, and return a decorated signature, which includes the last four bytes of the public key as a signature hint to go ...
[ "def", "sign_decorated", "(", "self", ",", "data", ")", ":", "signature", "=", "self", ".", "sign", "(", "data", ")", "hint", "=", "self", ".", "signature_hint", "(", ")", "return", "Xdr", ".", "types", ".", "DecoratedSignature", "(", "hint", ",", "sig...
Sign a bytes-like object and return the decorated signature. Sign a bytes-like object by signing the data using the signing (private) key, and return a decorated signature, which includes the last four bytes of the public key as a signature hint to go along with the signature as an XDR ...
[ "Sign", "a", "bytes", "-", "like", "object", "and", "return", "the", "decorated", "signature", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/keypair.py#L245-L259
234,445
StellarCN/py-stellar-base
stellar_base/utils.py
bytes_from_decode_data
def bytes_from_decode_data(s): """copy from base64._bytes_from_decode_data """ if isinstance(s, (str, unicode)): try: return s.encode('ascii') except UnicodeEncodeError: raise NotValidParamError( 'String argument should contain only ASCII characters') ...
python
def bytes_from_decode_data(s): """copy from base64._bytes_from_decode_data """ if isinstance(s, (str, unicode)): try: return s.encode('ascii') except UnicodeEncodeError: raise NotValidParamError( 'String argument should contain only ASCII characters') ...
[ "def", "bytes_from_decode_data", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "(", "str", ",", "unicode", ")", ")", ":", "try", ":", "return", "s", ".", "encode", "(", "'ascii'", ")", "except", "UnicodeEncodeError", ":", "raise", "NotValidParam...
copy from base64._bytes_from_decode_data
[ "copy", "from", "base64", ".", "_bytes_from_decode_data" ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/utils.py#L75-L92
234,446
StellarCN/py-stellar-base
stellar_base/operation.py
Operation.to_xdr_amount
def to_xdr_amount(value): """Converts an amount to the appropriate value to send over the network as a part of an XDR object. Each asset amount is encoded as a signed 64-bit integer in the XDR structures. An asset amount unit (that which is seen by end users) is scaled down by a...
python
def to_xdr_amount(value): """Converts an amount to the appropriate value to send over the network as a part of an XDR object. Each asset amount is encoded as a signed 64-bit integer in the XDR structures. An asset amount unit (that which is seen by end users) is scaled down by a...
[ "def", "to_xdr_amount", "(", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "str", ")", ":", "raise", "NotValidParamError", "(", "\"Value of type '{}' must be of type String, but got {}\"", ".", "format", "(", "value", ",", "type", "(", "value", ...
Converts an amount to the appropriate value to send over the network as a part of an XDR object. Each asset amount is encoded as a signed 64-bit integer in the XDR structures. An asset amount unit (that which is seen by end users) is scaled down by a factor of ten million (10,000,000) t...
[ "Converts", "an", "amount", "to", "the", "appropriate", "value", "to", "send", "over", "the", "network", "as", "a", "part", "of", "an", "XDR", "object", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/operation.py#L71-L105
234,447
StellarCN/py-stellar-base
stellar_base/memo.py
TextMemo.to_xdr_object
def to_xdr_object(self): """Creates an XDR Memo object for a transaction with MEMO_TEXT.""" return Xdr.types.Memo(type=Xdr.const.MEMO_TEXT, text=self.text)
python
def to_xdr_object(self): """Creates an XDR Memo object for a transaction with MEMO_TEXT.""" return Xdr.types.Memo(type=Xdr.const.MEMO_TEXT, text=self.text)
[ "def", "to_xdr_object", "(", "self", ")", ":", "return", "Xdr", ".", "types", ".", "Memo", "(", "type", "=", "Xdr", ".", "const", ".", "MEMO_TEXT", ",", "text", "=", "self", ".", "text", ")" ]
Creates an XDR Memo object for a transaction with MEMO_TEXT.
[ "Creates", "an", "XDR", "Memo", "object", "for", "a", "transaction", "with", "MEMO_TEXT", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/memo.py#L97-L99
234,448
StellarCN/py-stellar-base
stellar_base/memo.py
IdMemo.to_xdr_object
def to_xdr_object(self): """Creates an XDR Memo object for a transaction with MEMO_ID.""" return Xdr.types.Memo(type=Xdr.const.MEMO_ID, id=self.memo_id)
python
def to_xdr_object(self): """Creates an XDR Memo object for a transaction with MEMO_ID.""" return Xdr.types.Memo(type=Xdr.const.MEMO_ID, id=self.memo_id)
[ "def", "to_xdr_object", "(", "self", ")", ":", "return", "Xdr", ".", "types", ".", "Memo", "(", "type", "=", "Xdr", ".", "const", ".", "MEMO_ID", ",", "id", "=", "self", ".", "memo_id", ")" ]
Creates an XDR Memo object for a transaction with MEMO_ID.
[ "Creates", "an", "XDR", "Memo", "object", "for", "a", "transaction", "with", "MEMO_ID", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/memo.py#L112-L114
234,449
StellarCN/py-stellar-base
stellar_base/memo.py
HashMemo.to_xdr_object
def to_xdr_object(self): """Creates an XDR Memo object for a transaction with MEMO_HASH.""" return Xdr.types.Memo(type=Xdr.const.MEMO_HASH, hash=self.memo_hash)
python
def to_xdr_object(self): """Creates an XDR Memo object for a transaction with MEMO_HASH.""" return Xdr.types.Memo(type=Xdr.const.MEMO_HASH, hash=self.memo_hash)
[ "def", "to_xdr_object", "(", "self", ")", ":", "return", "Xdr", ".", "types", ".", "Memo", "(", "type", "=", "Xdr", ".", "const", ".", "MEMO_HASH", ",", "hash", "=", "self", ".", "memo_hash", ")" ]
Creates an XDR Memo object for a transaction with MEMO_HASH.
[ "Creates", "an", "XDR", "Memo", "object", "for", "a", "transaction", "with", "MEMO_HASH", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/memo.py#L127-L129
234,450
StellarCN/py-stellar-base
stellar_base/memo.py
RetHashMemo.to_xdr_object
def to_xdr_object(self): """Creates an XDR Memo object for a transaction with MEMO_RETURN.""" return Xdr.types.Memo( type=Xdr.const.MEMO_RETURN, retHash=self.memo_return)
python
def to_xdr_object(self): """Creates an XDR Memo object for a transaction with MEMO_RETURN.""" return Xdr.types.Memo( type=Xdr.const.MEMO_RETURN, retHash=self.memo_return)
[ "def", "to_xdr_object", "(", "self", ")", ":", "return", "Xdr", ".", "types", ".", "Memo", "(", "type", "=", "Xdr", ".", "const", ".", "MEMO_RETURN", ",", "retHash", "=", "self", ".", "memo_return", ")" ]
Creates an XDR Memo object for a transaction with MEMO_RETURN.
[ "Creates", "an", "XDR", "Memo", "object", "for", "a", "transaction", "with", "MEMO_RETURN", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/memo.py#L148-L151
234,451
StellarCN/py-stellar-base
stellar_base/builder.py
Builder.append_hashx_signer
def append_hashx_signer(self, hashx, signer_weight, source=None): """Add a HashX signer to an account. Add a HashX signer to an account via a :class:`SetOptions <stellar_base.operation.SetOptions` operation. This is a helper function for :meth:`append_set_options_op`. :param ha...
python
def append_hashx_signer(self, hashx, signer_weight, source=None): """Add a HashX signer to an account. Add a HashX signer to an account via a :class:`SetOptions <stellar_base.operation.SetOptions` operation. This is a helper function for :meth:`append_set_options_op`. :param ha...
[ "def", "append_hashx_signer", "(", "self", ",", "hashx", ",", "signer_weight", ",", "source", "=", "None", ")", ":", "return", "self", ".", "append_set_options_op", "(", "signer_address", "=", "hashx", ",", "signer_type", "=", "'hashX'", ",", "signer_weight", ...
Add a HashX signer to an account. Add a HashX signer to an account via a :class:`SetOptions <stellar_base.operation.SetOptions` operation. This is a helper function for :meth:`append_set_options_op`. :param hashx: The address of the new hashX signer. :type hashx: str, bytes ...
[ "Add", "a", "HashX", "signer", "to", "an", "account", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/builder.py#L323-L342
234,452
StellarCN/py-stellar-base
stellar_base/builder.py
Builder.append_pre_auth_tx_signer
def append_pre_auth_tx_signer(self, pre_auth_tx, signer_weight, source=None): """Add a PreAuthTx signer to an account. Add a PreAuthTx signer to an account via a :class:`SetOptions <stellar_bas...
python
def append_pre_auth_tx_signer(self, pre_auth_tx, signer_weight, source=None): """Add a PreAuthTx signer to an account. Add a PreAuthTx signer to an account via a :class:`SetOptions <stellar_bas...
[ "def", "append_pre_auth_tx_signer", "(", "self", ",", "pre_auth_tx", ",", "signer_weight", ",", "source", "=", "None", ")", ":", "return", "self", ".", "append_set_options_op", "(", "signer_address", "=", "pre_auth_tx", ",", "signer_type", "=", "'preAuthTx'", ",",...
Add a PreAuthTx signer to an account. Add a PreAuthTx signer to an account via a :class:`SetOptions <stellar_base.operation.SetOptions` operation. This is a helper function for :meth:`append_set_options_op`. :param pre_auth_tx: The address of the new preAuthTx signer - obtained by call...
[ "Add", "a", "PreAuthTx", "signer", "to", "an", "account", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/builder.py#L344-L366
234,453
StellarCN/py-stellar-base
stellar_base/builder.py
Builder.next_builder
def next_builder(self): """Create a new builder based off of this one with its sequence number incremented. :return: A new Builder instance :rtype: :class:`Builder` """ sequence = self.sequence + 1 next_builder = Builder( horizon_uri=self.horizon.hor...
python
def next_builder(self): """Create a new builder based off of this one with its sequence number incremented. :return: A new Builder instance :rtype: :class:`Builder` """ sequence = self.sequence + 1 next_builder = Builder( horizon_uri=self.horizon.hor...
[ "def", "next_builder", "(", "self", ")", ":", "sequence", "=", "self", ".", "sequence", "+", "1", "next_builder", "=", "Builder", "(", "horizon_uri", "=", "self", ".", "horizon", ".", "horizon_uri", ",", "address", "=", "self", ".", "address", ",", "netw...
Create a new builder based off of this one with its sequence number incremented. :return: A new Builder instance :rtype: :class:`Builder`
[ "Create", "a", "new", "builder", "based", "off", "of", "this", "one", "with", "its", "sequence", "number", "incremented", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/builder.py#L786-L802
234,454
StellarCN/py-stellar-base
stellar_base/builder.py
Builder.get_sequence
def get_sequence(self): """Get the sequence number for a given account via Horizon. :return: The current sequence number for a given account :rtype: int """ if not self.address: raise StellarAddressInvalidError('No address provided.') address = self.horizon....
python
def get_sequence(self): """Get the sequence number for a given account via Horizon. :return: The current sequence number for a given account :rtype: int """ if not self.address: raise StellarAddressInvalidError('No address provided.') address = self.horizon....
[ "def", "get_sequence", "(", "self", ")", ":", "if", "not", "self", ".", "address", ":", "raise", "StellarAddressInvalidError", "(", "'No address provided.'", ")", "address", "=", "self", ".", "horizon", ".", "account", "(", "self", ".", "address", ")", "retu...
Get the sequence number for a given account via Horizon. :return: The current sequence number for a given account :rtype: int
[ "Get", "the", "sequence", "number", "for", "a", "given", "account", "via", "Horizon", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/builder.py#L804-L814
234,455
StellarCN/py-stellar-base
stellar_base/asset.py
Asset.to_dict
def to_dict(self): """Generate a dict for this object's attributes. :return: A dict representing an :class:`Asset` """ rv = {'code': self.code} if not self.is_native(): rv['issuer'] = self.issuer rv['type'] = self.type else: rv['type']...
python
def to_dict(self): """Generate a dict for this object's attributes. :return: A dict representing an :class:`Asset` """ rv = {'code': self.code} if not self.is_native(): rv['issuer'] = self.issuer rv['type'] = self.type else: rv['type']...
[ "def", "to_dict", "(", "self", ")", ":", "rv", "=", "{", "'code'", ":", "self", ".", "code", "}", "if", "not", "self", ".", "is_native", "(", ")", ":", "rv", "[", "'issuer'", "]", "=", "self", ".", "issuer", "rv", "[", "'type'", "]", "=", "self...
Generate a dict for this object's attributes. :return: A dict representing an :class:`Asset`
[ "Generate", "a", "dict", "for", "this", "object", "s", "attributes", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/asset.py#L61-L72
234,456
StellarCN/py-stellar-base
stellar_base/stellarxdr/xdrgen.py
id_unique
def id_unique(dict_id, name, lineno): """Returns True if dict_id not already used. Otherwise, invokes error""" if dict_id in name_dict: global error_occurred error_occurred = True print( "ERROR - {0:s} definition {1:s} at line {2:d} conflicts with {3:s}" .format(...
python
def id_unique(dict_id, name, lineno): """Returns True if dict_id not already used. Otherwise, invokes error""" if dict_id in name_dict: global error_occurred error_occurred = True print( "ERROR - {0:s} definition {1:s} at line {2:d} conflicts with {3:s}" .format(...
[ "def", "id_unique", "(", "dict_id", ",", "name", ",", "lineno", ")", ":", "if", "dict_id", "in", "name_dict", ":", "global", "error_occurred", "error_occurred", "=", "True", "print", "(", "\"ERROR - {0:s} definition {1:s} at line {2:d} conflicts with {3:s}\"", ".", "f...
Returns True if dict_id not already used. Otherwise, invokes error
[ "Returns", "True", "if", "dict_id", "not", "already", "used", ".", "Otherwise", "invokes", "error" ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/stellarxdr/xdrgen.py#L770-L780
234,457
StellarCN/py-stellar-base
stellar_base/base58.py
main
def main(): '''Base58 encode or decode FILE, or standard input, to standard output.''' import sys import argparse stdout = buffer(sys.stdout) parser = argparse.ArgumentParser(description=main.__doc__) parser.add_argument( 'file', metavar='FILE', nargs='?', type...
python
def main(): '''Base58 encode or decode FILE, or standard input, to standard output.''' import sys import argparse stdout = buffer(sys.stdout) parser = argparse.ArgumentParser(description=main.__doc__) parser.add_argument( 'file', metavar='FILE', nargs='?', type...
[ "def", "main", "(", ")", ":", "import", "sys", "import", "argparse", "stdout", "=", "buffer", "(", "sys", ".", "stdout", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "main", ".", "__doc__", ")", "parser", ".", "add_argu...
Base58 encode or decode FILE, or standard input, to standard output.
[ "Base58", "encode", "or", "decode", "FILE", "or", "standard", "input", "to", "standard", "output", "." ]
cce2e782064fb3955c85e1696e630d67b1010848
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/base58.py#L93-L134
234,458
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/distro_lib/sles_11/utils.py
Utils._Dhcpcd
def _Dhcpcd(self, interfaces, logger): """Use dhcpcd to activate the interfaces. Args: interfaces: list of string, the output device names to enable. logger: logger object, used to write to SysLog and serial port. """ for interface in interfaces: dhcpcd = ['/sbin/dhcpcd'] try: ...
python
def _Dhcpcd(self, interfaces, logger): """Use dhcpcd to activate the interfaces. Args: interfaces: list of string, the output device names to enable. logger: logger object, used to write to SysLog and serial port. """ for interface in interfaces: dhcpcd = ['/sbin/dhcpcd'] try: ...
[ "def", "_Dhcpcd", "(", "self", ",", "interfaces", ",", "logger", ")", ":", "for", "interface", "in", "interfaces", ":", "dhcpcd", "=", "[", "'/sbin/dhcpcd'", "]", "try", ":", "subprocess", ".", "check_call", "(", "dhcpcd", "+", "[", "'-x'", ",", "interfa...
Use dhcpcd to activate the interfaces. Args: interfaces: list of string, the output device names to enable. logger: logger object, used to write to SysLog and serial port.
[ "Use", "dhcpcd", "to", "activate", "the", "interfaces", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/distro_lib/sles_11/utils.py#L44-L62
234,459
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_manager.py
_CreateTempDir
def _CreateTempDir(prefix, run_dir=None): """Context manager for creating a temporary directory. Args: prefix: string, the prefix for the temporary directory. run_dir: string, the base directory location of the temporary directory. Yields: string, the temporary directory created. """ temp_dir = ...
python
def _CreateTempDir(prefix, run_dir=None): """Context manager for creating a temporary directory. Args: prefix: string, the prefix for the temporary directory. run_dir: string, the base directory location of the temporary directory. Yields: string, the temporary directory created. """ temp_dir = ...
[ "def", "_CreateTempDir", "(", "prefix", ",", "run_dir", "=", "None", ")", ":", "temp_dir", "=", "tempfile", ".", "mkdtemp", "(", "prefix", "=", "prefix", "+", "'-'", ",", "dir", "=", "run_dir", ")", "try", ":", "yield", "temp_dir", "finally", ":", "shu...
Context manager for creating a temporary directory. Args: prefix: string, the prefix for the temporary directory. run_dir: string, the base directory location of the temporary directory. Yields: string, the temporary directory created.
[ "Context", "manager", "for", "creating", "a", "temporary", "directory", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_manager.py#L31-L45
234,460
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_manager.py
ScriptManager._RunScripts
def _RunScripts(self, run_dir=None): """Retrieve metadata scripts and execute them. Args: run_dir: string, the base directory location of the temporary directory. """ with _CreateTempDir(self.script_type, run_dir=run_dir) as dest_dir: try: self.logger.info('Starting %s scripts.', se...
python
def _RunScripts(self, run_dir=None): """Retrieve metadata scripts and execute them. Args: run_dir: string, the base directory location of the temporary directory. """ with _CreateTempDir(self.script_type, run_dir=run_dir) as dest_dir: try: self.logger.info('Starting %s scripts.', se...
[ "def", "_RunScripts", "(", "self", ",", "run_dir", "=", "None", ")", ":", "with", "_CreateTempDir", "(", "self", ".", "script_type", ",", "run_dir", "=", "run_dir", ")", "as", "dest_dir", ":", "try", ":", "self", ".", "logger", ".", "info", "(", "'Star...
Retrieve metadata scripts and execute them. Args: run_dir: string, the base directory location of the temporary directory.
[ "Retrieve", "metadata", "scripts", "and", "execute", "them", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_manager.py#L71-L83
234,461
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py
InstanceSetup._GetInstanceConfig
def _GetInstanceConfig(self): """Get the instance configuration specified in metadata. Returns: string, the instance configuration data. """ try: instance_data = self.metadata_dict['instance']['attributes'] except KeyError: instance_data = {} self.logger.warning('Instance at...
python
def _GetInstanceConfig(self): """Get the instance configuration specified in metadata. Returns: string, the instance configuration data. """ try: instance_data = self.metadata_dict['instance']['attributes'] except KeyError: instance_data = {} self.logger.warning('Instance at...
[ "def", "_GetInstanceConfig", "(", "self", ")", ":", "try", ":", "instance_data", "=", "self", ".", "metadata_dict", "[", "'instance'", "]", "[", "'attributes'", "]", "except", "KeyError", ":", "instance_data", "=", "{", "}", "self", ".", "logger", ".", "wa...
Get the instance configuration specified in metadata. Returns: string, the instance configuration data.
[ "Get", "the", "instance", "configuration", "specified", "in", "metadata", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py#L72-L91
234,462
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py
InstanceSetup._GenerateSshKey
def _GenerateSshKey(self, key_type, key_dest): """Generate a new SSH key. Args: key_type: string, the type of the SSH key. key_dest: string, a file location to store the SSH key. """ # Create a temporary file to save the created RSA keys. with tempfile.NamedTemporaryFile(prefix=key_type...
python
def _GenerateSshKey(self, key_type, key_dest): """Generate a new SSH key. Args: key_type: string, the type of the SSH key. key_dest: string, a file location to store the SSH key. """ # Create a temporary file to save the created RSA keys. with tempfile.NamedTemporaryFile(prefix=key_type...
[ "def", "_GenerateSshKey", "(", "self", ",", "key_type", ",", "key_dest", ")", ":", "# Create a temporary file to save the created RSA keys.", "with", "tempfile", ".", "NamedTemporaryFile", "(", "prefix", "=", "key_type", ",", "delete", "=", "True", ")", "as", "temp"...
Generate a new SSH key. Args: key_type: string, the type of the SSH key. key_dest: string, a file location to store the SSH key.
[ "Generate", "a", "new", "SSH", "key", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py#L119-L142
234,463
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py
InstanceSetup._StartSshd
def _StartSshd(self): """Initialize the SSH daemon.""" # Exit as early as possible. # Instance setup systemd scripts block sshd from starting. if os.path.exists(constants.LOCALBASE + '/bin/systemctl'): return elif (os.path.exists('/etc/init.d/ssh') or os.path.exists('/etc/init/ssh.co...
python
def _StartSshd(self): """Initialize the SSH daemon.""" # Exit as early as possible. # Instance setup systemd scripts block sshd from starting. if os.path.exists(constants.LOCALBASE + '/bin/systemctl'): return elif (os.path.exists('/etc/init.d/ssh') or os.path.exists('/etc/init/ssh.co...
[ "def", "_StartSshd", "(", "self", ")", ":", "# Exit as early as possible.", "# Instance setup systemd scripts block sshd from starting.", "if", "os", ".", "path", ".", "exists", "(", "constants", ".", "LOCALBASE", "+", "'/bin/systemctl'", ")", ":", "return", "elif", "...
Initialize the SSH daemon.
[ "Initialize", "the", "SSH", "daemon", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py#L144-L157
234,464
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py
InstanceSetup._SetSshHostKeys
def _SetSshHostKeys(self, host_key_types=None): """Regenerates SSH host keys when the VM is restarted with a new IP address. Booting a VM from an image with a known SSH key allows a number of attacks. This function will regenerating the host key whenever the IP address changes. This applies the first t...
python
def _SetSshHostKeys(self, host_key_types=None): """Regenerates SSH host keys when the VM is restarted with a new IP address. Booting a VM from an image with a known SSH key allows a number of attacks. This function will regenerating the host key whenever the IP address changes. This applies the first t...
[ "def", "_SetSshHostKeys", "(", "self", ",", "host_key_types", "=", "None", ")", ":", "section", "=", "'Instance'", "instance_id", "=", "self", ".", "_GetInstanceId", "(", ")", "if", "instance_id", "!=", "self", ".", "instance_config", ".", "GetOptionString", "...
Regenerates SSH host keys when the VM is restarted with a new IP address. Booting a VM from an image with a known SSH key allows a number of attacks. This function will regenerating the host key whenever the IP address changes. This applies the first time the instance is booted, and each time the disk ...
[ "Regenerates", "SSH", "host", "keys", "when", "the", "VM", "is", "restarted", "with", "a", "new", "IP", "address", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py#L159-L185
234,465
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py
InstanceSetup._SetupBotoConfig
def _SetupBotoConfig(self): """Set the boto config so GSUtil works with provisioned service accounts.""" project_id = self._GetNumericProjectId() try: boto_config.BotoConfig(project_id, debug=self.debug) except (IOError, OSError) as e: self.logger.warning(str(e))
python
def _SetupBotoConfig(self): """Set the boto config so GSUtil works with provisioned service accounts.""" project_id = self._GetNumericProjectId() try: boto_config.BotoConfig(project_id, debug=self.debug) except (IOError, OSError) as e: self.logger.warning(str(e))
[ "def", "_SetupBotoConfig", "(", "self", ")", ":", "project_id", "=", "self", ".", "_GetNumericProjectId", "(", ")", "try", ":", "boto_config", ".", "BotoConfig", "(", "project_id", ",", "debug", "=", "self", ".", "debug", ")", "except", "(", "IOError", ","...
Set the boto config so GSUtil works with provisioned service accounts.
[ "Set", "the", "boto", "config", "so", "GSUtil", "works", "with", "provisioned", "service", "accounts", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py#L199-L205
234,466
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py
ScriptRetriever._DownloadAuthUrl
def _DownloadAuthUrl(self, url, dest_dir): """Download a Google Storage URL using an authentication token. If the token cannot be fetched, fallback to unauthenticated download. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. ...
python
def _DownloadAuthUrl(self, url, dest_dir): """Download a Google Storage URL using an authentication token. If the token cannot be fetched, fallback to unauthenticated download. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. ...
[ "def", "_DownloadAuthUrl", "(", "self", ",", "url", ",", "dest_dir", ")", ":", "dest_file", "=", "tempfile", ".", "NamedTemporaryFile", "(", "dir", "=", "dest_dir", ",", "delete", "=", "False", ")", "dest_file", ".", "close", "(", ")", "dest", "=", "dest...
Download a Google Storage URL using an authentication token. If the token cannot be fetched, fallback to unauthenticated download. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. Returns: string, the path to the file storin...
[ "Download", "a", "Google", "Storage", "URL", "using", "an", "authentication", "token", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py#L48-L92
234,467
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py
ScriptRetriever._DownloadUrl
def _DownloadUrl(self, url, dest_dir): """Download a script from a given URL. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. Returns: string, the path to the file storing the metadata script. """ dest_file = tempfil...
python
def _DownloadUrl(self, url, dest_dir): """Download a script from a given URL. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. Returns: string, the path to the file storing the metadata script. """ dest_file = tempfil...
[ "def", "_DownloadUrl", "(", "self", ",", "url", ",", "dest_dir", ")", ":", "dest_file", "=", "tempfile", ".", "NamedTemporaryFile", "(", "dir", "=", "dest_dir", ",", "delete", "=", "False", ")", "dest_file", ".", "close", "(", ")", "dest", "=", "dest_fil...
Download a script from a given URL. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. Returns: string, the path to the file storing the metadata script.
[ "Download", "a", "script", "from", "a", "given", "URL", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py#L94-L116
234,468
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py
ScriptRetriever._DownloadScript
def _DownloadScript(self, url, dest_dir): """Download the contents of the URL to the destination. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. Returns: string, the path to the file storing the metadata script. """ ...
python
def _DownloadScript(self, url, dest_dir): """Download the contents of the URL to the destination. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. Returns: string, the path to the file storing the metadata script. """ ...
[ "def", "_DownloadScript", "(", "self", ",", "url", ",", "dest_dir", ")", ":", "# Check for the preferred Google Storage URL format:", "# gs://<bucket>/<object>", "if", "url", ".", "startswith", "(", "r'gs://'", ")", ":", "# Convert the string into a standard URL.", "url", ...
Download the contents of the URL to the destination. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. Returns: string, the path to the file storing the metadata script.
[ "Download", "the", "contents", "of", "the", "URL", "to", "the", "destination", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py#L118-L168
234,469
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py
ScriptRetriever._GetAttributeScripts
def _GetAttributeScripts(self, attribute_data, dest_dir): """Retrieve the scripts from attribute metadata. Args: attribute_data: dict, the contents of the attributes metadata. dest_dir: string, the path to a directory for storing metadata scripts. Returns: dict, a dictionary mapping meta...
python
def _GetAttributeScripts(self, attribute_data, dest_dir): """Retrieve the scripts from attribute metadata. Args: attribute_data: dict, the contents of the attributes metadata. dest_dir: string, the path to a directory for storing metadata scripts. Returns: dict, a dictionary mapping meta...
[ "def", "_GetAttributeScripts", "(", "self", ",", "attribute_data", ",", "dest_dir", ")", ":", "script_dict", "=", "{", "}", "attribute_data", "=", "attribute_data", "or", "{", "}", "metadata_key", "=", "'%s-script'", "%", "self", ".", "script_type", "metadata_va...
Retrieve the scripts from attribute metadata. Args: attribute_data: dict, the contents of the attributes metadata. dest_dir: string, the path to a directory for storing metadata scripts. Returns: dict, a dictionary mapping metadata keys to files storing scripts.
[ "Retrieve", "the", "scripts", "from", "attribute", "metadata", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py#L170-L198
234,470
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py
ScriptRetriever.GetScripts
def GetScripts(self, dest_dir): """Retrieve the scripts to execute. Args: dest_dir: string, the path to a directory for storing metadata scripts. Returns: dict, a dictionary mapping set metadata keys with associated scripts. """ metadata_dict = self.watcher.GetMetadata() or {} try...
python
def GetScripts(self, dest_dir): """Retrieve the scripts to execute. Args: dest_dir: string, the path to a directory for storing metadata scripts. Returns: dict, a dictionary mapping set metadata keys with associated scripts. """ metadata_dict = self.watcher.GetMetadata() or {} try...
[ "def", "GetScripts", "(", "self", ",", "dest_dir", ")", ":", "metadata_dict", "=", "self", ".", "watcher", ".", "GetMetadata", "(", ")", "or", "{", "}", "try", ":", "instance_data", "=", "metadata_dict", "[", "'instance'", "]", "[", "'attributes'", "]", ...
Retrieve the scripts to execute. Args: dest_dir: string, the path to a directory for storing metadata scripts. Returns: dict, a dictionary mapping set metadata keys with associated scripts.
[ "Retrieve", "the", "scripts", "to", "execute", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py#L200-L224
234,471
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_executor.py
ScriptExecutor._MakeExecutable
def _MakeExecutable(self, metadata_script): """Add executable permissions to a file. Args: metadata_script: string, the path to the executable file. """ mode = os.stat(metadata_script).st_mode os.chmod(metadata_script, mode | stat.S_IEXEC)
python
def _MakeExecutable(self, metadata_script): """Add executable permissions to a file. Args: metadata_script: string, the path to the executable file. """ mode = os.stat(metadata_script).st_mode os.chmod(metadata_script, mode | stat.S_IEXEC)
[ "def", "_MakeExecutable", "(", "self", ",", "metadata_script", ")", ":", "mode", "=", "os", ".", "stat", "(", "metadata_script", ")", ".", "st_mode", "os", ".", "chmod", "(", "metadata_script", ",", "mode", "|", "stat", ".", "S_IEXEC", ")" ]
Add executable permissions to a file. Args: metadata_script: string, the path to the executable file.
[ "Add", "executable", "permissions", "to", "a", "file", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_executor.py#L38-L45
234,472
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_executor.py
ScriptExecutor.RunScripts
def RunScripts(self, script_dict): """Run the metadata scripts; execute a URL script first if one is provided. Args: script_dict: a dictionary mapping metadata keys to script files. """ metadata_types = ['%s-script-url', '%s-script'] metadata_keys = [key % self.script_type for key in metadata...
python
def RunScripts(self, script_dict): """Run the metadata scripts; execute a URL script first if one is provided. Args: script_dict: a dictionary mapping metadata keys to script files. """ metadata_types = ['%s-script-url', '%s-script'] metadata_keys = [key % self.script_type for key in metadata...
[ "def", "RunScripts", "(", "self", ",", "script_dict", ")", ":", "metadata_types", "=", "[", "'%s-script-url'", ",", "'%s-script'", "]", "metadata_keys", "=", "[", "key", "%", "self", ".", "script_type", "for", "key", "in", "metadata_types", "]", "metadata_keys...
Run the metadata scripts; execute a URL script first if one is provided. Args: script_dict: a dictionary mapping metadata keys to script files.
[ "Run", "the", "metadata", "scripts", ";", "execute", "a", "URL", "script", "first", "if", "one", "is", "provided", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_executor.py#L67-L81
234,473
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/config_manager.py
ConfigManager._AddHeader
def _AddHeader(self, fp): """Create a file header in the config. Args: fp: int, a file pointer for writing the header. """ text = textwrap.wrap( textwrap.dedent(self.config_header), break_on_hyphens=False) fp.write('\n'.join(['# ' + line for line in text])) fp.write('\n\n')
python
def _AddHeader(self, fp): """Create a file header in the config. Args: fp: int, a file pointer for writing the header. """ text = textwrap.wrap( textwrap.dedent(self.config_header), break_on_hyphens=False) fp.write('\n'.join(['# ' + line for line in text])) fp.write('\n\n')
[ "def", "_AddHeader", "(", "self", ",", "fp", ")", ":", "text", "=", "textwrap", ".", "wrap", "(", "textwrap", ".", "dedent", "(", "self", ".", "config_header", ")", ",", "break_on_hyphens", "=", "False", ")", "fp", ".", "write", "(", "'\\n'", ".", "j...
Create a file header in the config. Args: fp: int, a file pointer for writing the header.
[ "Create", "a", "file", "header", "in", "the", "config", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/config_manager.py#L43-L52
234,474
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/config_manager.py
ConfigManager.SetOption
def SetOption(self, section, option, value, overwrite=True): """Set the value of an option in the config file. Args: section: string, the section of the config file to check. option: string, the option to set the value of. value: string, the value to set the option. overwrite: bool, Tru...
python
def SetOption(self, section, option, value, overwrite=True): """Set the value of an option in the config file. Args: section: string, the section of the config file to check. option: string, the option to set the value of. value: string, the value to set the option. overwrite: bool, Tru...
[ "def", "SetOption", "(", "self", ",", "section", ",", "option", ",", "value", ",", "overwrite", "=", "True", ")", ":", "if", "not", "overwrite", "and", "self", ".", "config", ".", "has_option", "(", "section", ",", "option", ")", ":", "return", "if", ...
Set the value of an option in the config file. Args: section: string, the section of the config file to check. option: string, the option to set the value of. value: string, the value to set the option. overwrite: bool, True to overwrite an existing value in the config file.
[ "Set", "the", "value", "of", "an", "option", "in", "the", "config", "file", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/config_manager.py#L82-L95
234,475
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/config_manager.py
ConfigManager.WriteConfig
def WriteConfig(self, config_file=None): """Write the config values to a given file. Args: config_file: string, the file location of the config file to write. """ config_file = config_file or self.config_file config_name = os.path.splitext(os.path.basename(config_file))[0] config_lock = (...
python
def WriteConfig(self, config_file=None): """Write the config values to a given file. Args: config_file: string, the file location of the config file to write. """ config_file = config_file or self.config_file config_name = os.path.splitext(os.path.basename(config_file))[0] config_lock = (...
[ "def", "WriteConfig", "(", "self", ",", "config_file", "=", "None", ")", ":", "config_file", "=", "config_file", "or", "self", ".", "config_file", "config_name", "=", "os", ".", "path", ".", "splitext", "(", "os", ".", "path", ".", "basename", "(", "conf...
Write the config values to a given file. Args: config_file: string, the file location of the config file to write.
[ "Write", "the", "config", "values", "to", "a", "given", "file", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/config_manager.py#L97-L111
234,476
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/logger.py
Logger
def Logger(name, debug=False, facility=None): """Get a logging object with handlers for sending logs to SysLog. Args: name: string, the name of the logger which will be added to log entries. debug: bool, True if debug output should write to the console. facility: int, an encoding of the SysLog handler'...
python
def Logger(name, debug=False, facility=None): """Get a logging object with handlers for sending logs to SysLog. Args: name: string, the name of the logger which will be added to log entries. debug: bool, True if debug output should write to the console. facility: int, an encoding of the SysLog handler'...
[ "def", "Logger", "(", "name", ",", "debug", "=", "False", ",", "facility", "=", "None", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "name", ")", "logger", ".", "handlers", "=", "[", "]", "logger", ".", "addHandler", "(", "logging", "."...
Get a logging object with handlers for sending logs to SysLog. Args: name: string, the name of the logger which will be added to log entries. debug: bool, True if debug output should write to the console. facility: int, an encoding of the SysLog handler's facility and priority. Returns: logging ob...
[ "Get", "a", "logging", "object", "with", "handlers", "for", "sending", "logs", "to", "SysLog", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/logger.py#L22-L55
234,477
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py
AccountsUtils._CreateSudoersGroup
def _CreateSudoersGroup(self): """Create a Linux group for Google added sudo user accounts.""" if not self._GetGroup(self.google_sudoers_group): try: command = self.groupadd_cmd.format(group=self.google_sudoers_group) subprocess.check_call(command.split(' ')) except subprocess.Called...
python
def _CreateSudoersGroup(self): """Create a Linux group for Google added sudo user accounts.""" if not self._GetGroup(self.google_sudoers_group): try: command = self.groupadd_cmd.format(group=self.google_sudoers_group) subprocess.check_call(command.split(' ')) except subprocess.Called...
[ "def", "_CreateSudoersGroup", "(", "self", ")", ":", "if", "not", "self", ".", "_GetGroup", "(", "self", ".", "google_sudoers_group", ")", ":", "try", ":", "command", "=", "self", ".", "groupadd_cmd", ".", "format", "(", "group", "=", "self", ".", "googl...
Create a Linux group for Google added sudo user accounts.
[ "Create", "a", "Linux", "group", "for", "Google", "added", "sudo", "user", "accounts", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py#L92-L114
234,478
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py
AccountsUtils._AddUser
def _AddUser(self, user): """Configure a Linux user account. Args: user: string, the name of the Linux user account to create. Returns: bool, True if user creation succeeded. """ self.logger.info('Creating a new user account for %s.', user) command = self.useradd_cmd.format(user=u...
python
def _AddUser(self, user): """Configure a Linux user account. Args: user: string, the name of the Linux user account to create. Returns: bool, True if user creation succeeded. """ self.logger.info('Creating a new user account for %s.', user) command = self.useradd_cmd.format(user=u...
[ "def", "_AddUser", "(", "self", ",", "user", ")", ":", "self", ".", "logger", ".", "info", "(", "'Creating a new user account for %s.'", ",", "user", ")", "command", "=", "self", ".", "useradd_cmd", ".", "format", "(", "user", "=", "user", ")", "try", ":...
Configure a Linux user account. Args: user: string, the name of the Linux user account to create. Returns: bool, True if user creation succeeded.
[ "Configure", "a", "Linux", "user", "account", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py#L130-L149
234,479
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py
AccountsUtils._UpdateUserGroups
def _UpdateUserGroups(self, user, groups): """Update group membership for a Linux user. Args: user: string, the name of the Linux user account. groups: list, the group names to add the user as a member. Returns: bool, True if user update succeeded. """ groups = ','.join(groups) ...
python
def _UpdateUserGroups(self, user, groups): """Update group membership for a Linux user. Args: user: string, the name of the Linux user account. groups: list, the group names to add the user as a member. Returns: bool, True if user update succeeded. """ groups = ','.join(groups) ...
[ "def", "_UpdateUserGroups", "(", "self", ",", "user", ",", "groups", ")", ":", "groups", "=", "','", ".", "join", "(", "groups", ")", "self", ".", "logger", ".", "debug", "(", "'Updating user %s with groups %s.'", ",", "user", ",", "groups", ")", "command"...
Update group membership for a Linux user. Args: user: string, the name of the Linux user account. groups: list, the group names to add the user as a member. Returns: bool, True if user update succeeded.
[ "Update", "group", "membership", "for", "a", "Linux", "user", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py#L151-L171
234,480
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py
AccountsUtils._UpdateAuthorizedKeys
def _UpdateAuthorizedKeys(self, user, ssh_keys): """Update the authorized keys file for a Linux user with a list of SSH keys. Args: user: string, the name of the Linux user account. ssh_keys: list, the SSH key strings associated with the user. Raises: IOError, raised when there is an exc...
python
def _UpdateAuthorizedKeys(self, user, ssh_keys): """Update the authorized keys file for a Linux user with a list of SSH keys. Args: user: string, the name of the Linux user account. ssh_keys: list, the SSH key strings associated with the user. Raises: IOError, raised when there is an exc...
[ "def", "_UpdateAuthorizedKeys", "(", "self", ",", "user", ",", "ssh_keys", ")", ":", "pw_entry", "=", "self", ".", "_GetUser", "(", "user", ")", "if", "not", "pw_entry", ":", "return", "uid", "=", "pw_entry", ".", "pw_uid", "gid", "=", "pw_entry", ".", ...
Update the authorized keys file for a Linux user with a list of SSH keys. Args: user: string, the name of the Linux user account. ssh_keys: list, the SSH key strings associated with the user. Raises: IOError, raised when there is an exception updating a file. OSError, raised when setti...
[ "Update", "the", "authorized", "keys", "file", "for", "a", "Linux", "user", "with", "a", "list", "of", "SSH", "keys", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py#L173-L249
234,481
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py
AccountsUtils._UpdateSudoer
def _UpdateSudoer(self, user, sudoer=False): """Update sudoer group membership for a Linux user account. Args: user: string, the name of the Linux user account. sudoer: bool, True if the user should be a sudoer. Returns: bool, True if user update succeeded. """ if sudoer: s...
python
def _UpdateSudoer(self, user, sudoer=False): """Update sudoer group membership for a Linux user account. Args: user: string, the name of the Linux user account. sudoer: bool, True if the user should be a sudoer. Returns: bool, True if user update succeeded. """ if sudoer: s...
[ "def", "_UpdateSudoer", "(", "self", ",", "user", ",", "sudoer", "=", "False", ")", ":", "if", "sudoer", ":", "self", ".", "logger", ".", "info", "(", "'Adding user %s to the Google sudoers group.'", ",", "user", ")", "command", "=", "self", ".", "gpasswd_ad...
Update sudoer group membership for a Linux user account. Args: user: string, the name of the Linux user account. sudoer: bool, True if the user should be a sudoer. Returns: bool, True if user update succeeded.
[ "Update", "sudoer", "group", "membership", "for", "a", "Linux", "user", "account", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py#L251-L277
234,482
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py
AccountsUtils._RemoveAuthorizedKeys
def _RemoveAuthorizedKeys(self, user): """Remove a Linux user account's authorized keys file to prevent login. Args: user: string, the Linux user account to remove access. """ pw_entry = self._GetUser(user) if not pw_entry: return home_dir = pw_entry.pw_dir authorized_keys_file...
python
def _RemoveAuthorizedKeys(self, user): """Remove a Linux user account's authorized keys file to prevent login. Args: user: string, the Linux user account to remove access. """ pw_entry = self._GetUser(user) if not pw_entry: return home_dir = pw_entry.pw_dir authorized_keys_file...
[ "def", "_RemoveAuthorizedKeys", "(", "self", ",", "user", ")", ":", "pw_entry", "=", "self", ".", "_GetUser", "(", "user", ")", "if", "not", "pw_entry", ":", "return", "home_dir", "=", "pw_entry", ".", "pw_dir", "authorized_keys_file", "=", "os", ".", "pat...
Remove a Linux user account's authorized keys file to prevent login. Args: user: string, the Linux user account to remove access.
[ "Remove", "a", "Linux", "user", "account", "s", "authorized", "keys", "file", "to", "prevent", "login", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py#L279-L296
234,483
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py
AccountsUtils.GetConfiguredUsers
def GetConfiguredUsers(self): """Retrieve the list of configured Google user accounts. Returns: list, the username strings of users congfigured by Google. """ if os.path.exists(self.google_users_file): users = open(self.google_users_file).readlines() else: users = [] return [u...
python
def GetConfiguredUsers(self): """Retrieve the list of configured Google user accounts. Returns: list, the username strings of users congfigured by Google. """ if os.path.exists(self.google_users_file): users = open(self.google_users_file).readlines() else: users = [] return [u...
[ "def", "GetConfiguredUsers", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "google_users_file", ")", ":", "users", "=", "open", "(", "self", ".", "google_users_file", ")", ".", "readlines", "(", ")", "else", ":", "use...
Retrieve the list of configured Google user accounts. Returns: list, the username strings of users congfigured by Google.
[ "Retrieve", "the", "list", "of", "configured", "Google", "user", "accounts", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py#L298-L308
234,484
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py
AccountsUtils.SetConfiguredUsers
def SetConfiguredUsers(self, users): """Set the list of configured Google user accounts. Args: users: list, the username strings of the Linux accounts. """ prefix = self.logger.name + '-' with tempfile.NamedTemporaryFile( mode='w', prefix=prefix, delete=True) as updated_users: u...
python
def SetConfiguredUsers(self, users): """Set the list of configured Google user accounts. Args: users: list, the username strings of the Linux accounts. """ prefix = self.logger.name + '-' with tempfile.NamedTemporaryFile( mode='w', prefix=prefix, delete=True) as updated_users: u...
[ "def", "SetConfiguredUsers", "(", "self", ",", "users", ")", ":", "prefix", "=", "self", ".", "logger", ".", "name", "+", "'-'", "with", "tempfile", ".", "NamedTemporaryFile", "(", "mode", "=", "'w'", ",", "prefix", "=", "prefix", ",", "delete", "=", "...
Set the list of configured Google user accounts. Args: users: list, the username strings of the Linux accounts.
[ "Set", "the", "list", "of", "configured", "Google", "user", "accounts", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py#L310-L327
234,485
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py
AccountsUtils.UpdateUser
def UpdateUser(self, user, ssh_keys): """Update a Linux user with authorized SSH keys. Args: user: string, the name of the Linux user account. ssh_keys: list, the SSH key strings associated with the user. Returns: bool, True if the user account updated successfully. """ if not bo...
python
def UpdateUser(self, user, ssh_keys): """Update a Linux user with authorized SSH keys. Args: user: string, the name of the Linux user account. ssh_keys: list, the SSH key strings associated with the user. Returns: bool, True if the user account updated successfully. """ if not bo...
[ "def", "UpdateUser", "(", "self", ",", "user", ",", "ssh_keys", ")", ":", "if", "not", "bool", "(", "USER_REGEX", ".", "match", "(", "user", ")", ")", ":", "self", ".", "logger", ".", "warning", "(", "'Invalid user account name %s.'", ",", "user", ")", ...
Update a Linux user with authorized SSH keys. Args: user: string, the name of the Linux user account. ssh_keys: list, the SSH key strings associated with the user. Returns: bool, True if the user account updated successfully.
[ "Update", "a", "Linux", "user", "with", "authorized", "SSH", "keys", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py#L329-L368
234,486
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py
AccountsUtils.RemoveUser
def RemoveUser(self, user): """Remove a Linux user account. Args: user: string, the Linux user account to remove. """ self.logger.info('Removing user %s.', user) if self.remove: command = self.userdel_cmd.format(user=user) try: subprocess.check_call(command.split(' ')) ...
python
def RemoveUser(self, user): """Remove a Linux user account. Args: user: string, the Linux user account to remove. """ self.logger.info('Removing user %s.', user) if self.remove: command = self.userdel_cmd.format(user=user) try: subprocess.check_call(command.split(' ')) ...
[ "def", "RemoveUser", "(", "self", ",", "user", ")", ":", "self", ".", "logger", ".", "info", "(", "'Removing user %s.'", ",", "user", ")", "if", "self", ".", "remove", ":", "command", "=", "self", ".", "userdel_cmd", ".", "format", "(", "user", "=", ...
Remove a Linux user account. Args: user: string, the Linux user account to remove.
[ "Remove", "a", "Linux", "user", "account", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/accounts_utils.py#L370-L386
234,487
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/oslogin_utils.py
OsLoginUtils._RunOsLoginControl
def _RunOsLoginControl(self, params): """Run the OS Login control script. Args: params: list, the params to pass to the script Returns: int, the return code from the call, or None if the script is not found. """ try: return subprocess.call([constants.OSLOGIN_CONTROL_SCRIPT] + par...
python
def _RunOsLoginControl(self, params): """Run the OS Login control script. Args: params: list, the params to pass to the script Returns: int, the return code from the call, or None if the script is not found. """ try: return subprocess.call([constants.OSLOGIN_CONTROL_SCRIPT] + par...
[ "def", "_RunOsLoginControl", "(", "self", ",", "params", ")", ":", "try", ":", "return", "subprocess", ".", "call", "(", "[", "constants", ".", "OSLOGIN_CONTROL_SCRIPT", "]", "+", "params", ")", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno...
Run the OS Login control script. Args: params: list, the params to pass to the script Returns: int, the return code from the call, or None if the script is not found.
[ "Run", "the", "OS", "Login", "control", "script", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/oslogin_utils.py#L41-L56
234,488
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/oslogin_utils.py
OsLoginUtils._GetStatus
def _GetStatus(self, two_factor=False): """Check whether OS Login is installed. Args: two_factor: bool, True if two factor should be enabled. Returns: bool, True if OS Login is installed. """ params = ['status'] if two_factor: params += ['--twofactor'] retcode = self._Run...
python
def _GetStatus(self, two_factor=False): """Check whether OS Login is installed. Args: two_factor: bool, True if two factor should be enabled. Returns: bool, True if OS Login is installed. """ params = ['status'] if two_factor: params += ['--twofactor'] retcode = self._Run...
[ "def", "_GetStatus", "(", "self", ",", "two_factor", "=", "False", ")", ":", "params", "=", "[", "'status'", "]", "if", "two_factor", ":", "params", "+=", "[", "'--twofactor'", "]", "retcode", "=", "self", ".", "_RunOsLoginControl", "(", "params", ")", "...
Check whether OS Login is installed. Args: two_factor: bool, True if two factor should be enabled. Returns: bool, True if OS Login is installed.
[ "Check", "whether", "OS", "Login", "is", "installed", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/oslogin_utils.py#L58-L81
234,489
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/oslogin_utils.py
OsLoginUtils._RunOsLoginNssCache
def _RunOsLoginNssCache(self): """Run the OS Login NSS cache binary. Returns: int, the return code from the call, or None if the script is not found. """ try: return subprocess.call([constants.OSLOGIN_NSS_CACHE_SCRIPT]) except OSError as e: if e.errno == errno.ENOENT: retu...
python
def _RunOsLoginNssCache(self): """Run the OS Login NSS cache binary. Returns: int, the return code from the call, or None if the script is not found. """ try: return subprocess.call([constants.OSLOGIN_NSS_CACHE_SCRIPT]) except OSError as e: if e.errno == errno.ENOENT: retu...
[ "def", "_RunOsLoginNssCache", "(", "self", ")", ":", "try", ":", "return", "subprocess", ".", "call", "(", "[", "constants", ".", "OSLOGIN_NSS_CACHE_SCRIPT", "]", ")", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno", "==", "errno", ".", "ENO...
Run the OS Login NSS cache binary. Returns: int, the return code from the call, or None if the script is not found.
[ "Run", "the", "OS", "Login", "NSS", "cache", "binary", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/oslogin_utils.py#L83-L95
234,490
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/oslogin_utils.py
OsLoginUtils._RemoveOsLoginNssCache
def _RemoveOsLoginNssCache(self): """Remove the OS Login NSS cache file.""" if os.path.exists(constants.OSLOGIN_NSS_CACHE): try: os.remove(constants.OSLOGIN_NSS_CACHE) except OSError as e: if e.errno != errno.ENOENT: raise
python
def _RemoveOsLoginNssCache(self): """Remove the OS Login NSS cache file.""" if os.path.exists(constants.OSLOGIN_NSS_CACHE): try: os.remove(constants.OSLOGIN_NSS_CACHE) except OSError as e: if e.errno != errno.ENOENT: raise
[ "def", "_RemoveOsLoginNssCache", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "constants", ".", "OSLOGIN_NSS_CACHE", ")", ":", "try", ":", "os", ".", "remove", "(", "constants", ".", "OSLOGIN_NSS_CACHE", ")", "except", "OSError", "as...
Remove the OS Login NSS cache file.
[ "Remove", "the", "OS", "Login", "NSS", "cache", "file", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/oslogin_utils.py#L97-L104
234,491
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/accounts/oslogin_utils.py
OsLoginUtils.UpdateOsLogin
def UpdateOsLogin(self, oslogin_desired, two_factor_desired=False): """Update whether OS Login is enabled and update NSS cache if necessary. Args: oslogin_desired: bool, enable OS Login if True, disable if False. two_factor_desired: bool, enable two factor if True, disable if False. Returns: ...
python
def UpdateOsLogin(self, oslogin_desired, two_factor_desired=False): """Update whether OS Login is enabled and update NSS cache if necessary. Args: oslogin_desired: bool, enable OS Login if True, disable if False. two_factor_desired: bool, enable two factor if True, disable if False. Returns: ...
[ "def", "UpdateOsLogin", "(", "self", ",", "oslogin_desired", ",", "two_factor_desired", "=", "False", ")", ":", "oslogin_configured", "=", "self", ".", "_GetStatus", "(", "two_factor", "=", "False", ")", "if", "oslogin_configured", "is", "None", ":", "return", ...
Update whether OS Login is enabled and update NSS cache if necessary. Args: oslogin_desired: bool, enable OS Login if True, disable if False. two_factor_desired: bool, enable two factor if True, disable if False. Returns: int, the return code from updating OS Login, or None if not present.
[ "Update", "whether", "OS", "Login", "is", "enabled", "and", "update", "NSS", "cache", "if", "necessary", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/accounts/oslogin_utils.py#L106-L152
234,492
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/distro_lib/helpers.py
CallDhclient
def CallDhclient( interfaces, logger, dhclient_script=None): """Configure the network interfaces using dhclient. Args: interfaces: list of string, the output device names to enable. logger: logger object, used to write to SysLog and serial port. dhclient_script: string, the path to a dhclient scrip...
python
def CallDhclient( interfaces, logger, dhclient_script=None): """Configure the network interfaces using dhclient. Args: interfaces: list of string, the output device names to enable. logger: logger object, used to write to SysLog and serial port. dhclient_script: string, the path to a dhclient scrip...
[ "def", "CallDhclient", "(", "interfaces", ",", "logger", ",", "dhclient_script", "=", "None", ")", ":", "logger", ".", "info", "(", "'Enabling the Ethernet interfaces %s.'", ",", "interfaces", ")", "dhclient_command", "=", "[", "'dhclient'", "]", "if", "dhclient_s...
Configure the network interfaces using dhclient. Args: interfaces: list of string, the output device names to enable. logger: logger object, used to write to SysLog and serial port. dhclient_script: string, the path to a dhclient script used by dhclient.
[ "Configure", "the", "network", "interfaces", "using", "dhclient", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/distro_lib/helpers.py#L22-L42
234,493
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/distro_lib/helpers.py
CallHwclock
def CallHwclock(logger): """Sync clock using hwclock. Args: logger: logger object, used to write to SysLog and serial port. """ command = ['/sbin/hwclock', '--hctosys'] try: subprocess.check_call(command) except subprocess.CalledProcessError: logger.warning('Failed to sync system time with hard...
python
def CallHwclock(logger): """Sync clock using hwclock. Args: logger: logger object, used to write to SysLog and serial port. """ command = ['/sbin/hwclock', '--hctosys'] try: subprocess.check_call(command) except subprocess.CalledProcessError: logger.warning('Failed to sync system time with hard...
[ "def", "CallHwclock", "(", "logger", ")", ":", "command", "=", "[", "'/sbin/hwclock'", ",", "'--hctosys'", "]", "try", ":", "subprocess", ".", "check_call", "(", "command", ")", "except", "subprocess", ".", "CalledProcessError", ":", "logger", ".", "warning", ...
Sync clock using hwclock. Args: logger: logger object, used to write to SysLog and serial port.
[ "Sync", "clock", "using", "hwclock", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/distro_lib/helpers.py#L45-L57
234,494
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/distro_lib/helpers.py
CallNtpdate
def CallNtpdate(logger): """Sync clock using ntpdate. Args: logger: logger object, used to write to SysLog and serial port. """ ntpd_inactive = subprocess.call(['service', 'ntpd', 'status']) try: if not ntpd_inactive: subprocess.check_call(['service', 'ntpd', 'stop']) subprocess.check_call(...
python
def CallNtpdate(logger): """Sync clock using ntpdate. Args: logger: logger object, used to write to SysLog and serial port. """ ntpd_inactive = subprocess.call(['service', 'ntpd', 'status']) try: if not ntpd_inactive: subprocess.check_call(['service', 'ntpd', 'stop']) subprocess.check_call(...
[ "def", "CallNtpdate", "(", "logger", ")", ":", "ntpd_inactive", "=", "subprocess", ".", "call", "(", "[", "'service'", ",", "'ntpd'", ",", "'status'", "]", ")", "try", ":", "if", "not", "ntpd_inactive", ":", "subprocess", ".", "check_call", "(", "[", "'s...
Sync clock using ntpdate. Args: logger: logger object, used to write to SysLog and serial port.
[ "Sync", "clock", "using", "ntpdate", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/distro_lib/helpers.py#L60-L77
234,495
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/boto/boto_config.py
BotoConfig._GetNumericProjectId
def _GetNumericProjectId(self): """Get the numeric project ID for this VM. Returns: string, the numeric project ID if one is found. """ project_id = 'project/numeric-project-id' return self.watcher.GetMetadata(metadata_key=project_id, recursive=False)
python
def _GetNumericProjectId(self): """Get the numeric project ID for this VM. Returns: string, the numeric project ID if one is found. """ project_id = 'project/numeric-project-id' return self.watcher.GetMetadata(metadata_key=project_id, recursive=False)
[ "def", "_GetNumericProjectId", "(", "self", ")", ":", "project_id", "=", "'project/numeric-project-id'", "return", "self", ".", "watcher", ".", "GetMetadata", "(", "metadata_key", "=", "project_id", ",", "recursive", "=", "False", ")" ]
Get the numeric project ID for this VM. Returns: string, the numeric project ID if one is found.
[ "Get", "the", "numeric", "project", "ID", "for", "this", "VM", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/boto/boto_config.py#L57-L64
234,496
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/boto/boto_config.py
BotoConfig._CreateConfig
def _CreateConfig(self, project_id): """Create the boto config to support standalone GSUtil. Args: project_id: string, the project ID to use in the config file. """ project_id = project_id or self._GetNumericProjectId() # Our project doesn't support service accounts. if not project_id: ...
python
def _CreateConfig(self, project_id): """Create the boto config to support standalone GSUtil. Args: project_id: string, the project ID to use in the config file. """ project_id = project_id or self._GetNumericProjectId() # Our project doesn't support service accounts. if not project_id: ...
[ "def", "_CreateConfig", "(", "self", ",", "project_id", ")", ":", "project_id", "=", "project_id", "or", "self", ".", "_GetNumericProjectId", "(", ")", "# Our project doesn't support service accounts.", "if", "not", "project_id", ":", "return", "self", ".", "boto_co...
Create the boto config to support standalone GSUtil. Args: project_id: string, the project ID to use in the config file.
[ "Create", "the", "boto", "config", "to", "support", "standalone", "GSUtil", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/boto/boto_config.py#L66-L89
234,497
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/distro_lib/ip_forwarding_utils.py
IpForwardingUtilsIproute._CreateRouteOptions
def _CreateRouteOptions(self, **kwargs): """Create a dictionary of parameters to append to the ip route command. Args: **kwargs: dict, the string parameters to update in the ip route command. Returns: dict, the string parameters to append to the ip route command. """ options = { ...
python
def _CreateRouteOptions(self, **kwargs): """Create a dictionary of parameters to append to the ip route command. Args: **kwargs: dict, the string parameters to update in the ip route command. Returns: dict, the string parameters to append to the ip route command. """ options = { ...
[ "def", "_CreateRouteOptions", "(", "self", ",", "*", "*", "kwargs", ")", ":", "options", "=", "{", "'proto'", ":", "self", ".", "proto_id", ",", "'scope'", ":", "'host'", ",", "}", "options", ".", "update", "(", "kwargs", ")", "return", "options" ]
Create a dictionary of parameters to append to the ip route command. Args: **kwargs: dict, the string parameters to update in the ip route command. Returns: dict, the string parameters to append to the ip route command.
[ "Create", "a", "dictionary", "of", "parameters", "to", "append", "to", "the", "ip", "route", "command", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/distro_lib/ip_forwarding_utils.py#L97-L111
234,498
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/distro_lib/ip_forwarding_utils.py
IpForwardingUtilsIproute._RunIpRoute
def _RunIpRoute(self, args=None, options=None): """Run a command with ip route and return the response. Args: args: list, the string ip route command args to execute. options: dict, the string parameters to append to the ip route command. Returns: string, the standard output from the ip ...
python
def _RunIpRoute(self, args=None, options=None): """Run a command with ip route and return the response. Args: args: list, the string ip route command args to execute. options: dict, the string parameters to append to the ip route command. Returns: string, the standard output from the ip ...
[ "def", "_RunIpRoute", "(", "self", ",", "args", "=", "None", ",", "options", "=", "None", ")", ":", "args", "=", "args", "or", "[", "]", "options", "=", "options", "or", "{", "}", "command", "=", "[", "'ip'", ",", "'route'", "]", "command", ".", ...
Run a command with ip route and return the response. Args: args: list, the string ip route command args to execute. options: dict, the string parameters to append to the ip route command. Returns: string, the standard output from the ip route command execution.
[ "Run", "a", "command", "with", "ip", "route", "and", "return", "the", "response", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/distro_lib/ip_forwarding_utils.py#L113-L141
234,499
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/distro_lib/ip_forwarding_utils.py
IpForwardingUtilsIfconfig.RemoveForwardedIp
def RemoveForwardedIp(self, address, interface): """Delete an IP address on the network interface. Args: address: string, the IP address to configure. interface: string, the output device to use. """ ip = netaddr.IPNetwork(address) self._RunIfconfig(args=[interface, '-alias', str(ip.ip)...
python
def RemoveForwardedIp(self, address, interface): """Delete an IP address on the network interface. Args: address: string, the IP address to configure. interface: string, the output device to use. """ ip = netaddr.IPNetwork(address) self._RunIfconfig(args=[interface, '-alias', str(ip.ip)...
[ "def", "RemoveForwardedIp", "(", "self", ",", "address", ",", "interface", ")", ":", "ip", "=", "netaddr", ".", "IPNetwork", "(", "address", ")", "self", ".", "_RunIfconfig", "(", "args", "=", "[", "interface", ",", "'-alias'", ",", "str", "(", "ip", "...
Delete an IP address on the network interface. Args: address: string, the IP address to configure. interface: string, the output device to use.
[ "Delete", "an", "IP", "address", "on", "the", "network", "interface", "." ]
53ea8cd069fb4d9a1984d1c167e54c133033f8da
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/distro_lib/ip_forwarding_utils.py#L294-L302