repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
Komnomnomnom/swigibpy
swigibpy.py
EClientSocketBase.reqScannerSubscription
def reqScannerSubscription(self, tickerId, subscription, scannerSubscriptionOptions): """reqScannerSubscription(EClientSocketBase self, int tickerId, ScannerSubscription subscription, TagValueListSPtr const & scannerSubscriptionOptions)""" return _swigibpy.EClientSocketBase_reqScannerSubscription(self, ...
python
def reqScannerSubscription(self, tickerId, subscription, scannerSubscriptionOptions): """reqScannerSubscription(EClientSocketBase self, int tickerId, ScannerSubscription subscription, TagValueListSPtr const & scannerSubscriptionOptions)""" return _swigibpy.EClientSocketBase_reqScannerSubscription(self, ...
[ "def", "reqScannerSubscription", "(", "self", ",", "tickerId", ",", "subscription", ",", "scannerSubscriptionOptions", ")", ":", "return", "_swigibpy", ".", "EClientSocketBase_reqScannerSubscription", "(", "self", ",", "tickerId", ",", "subscription", ",", "scannerSubsc...
reqScannerSubscription(EClientSocketBase self, int tickerId, ScannerSubscription subscription, TagValueListSPtr const & scannerSubscriptionOptions)
[ "reqScannerSubscription", "(", "EClientSocketBase", "self", "int", "tickerId", "ScannerSubscription", "subscription", "TagValueListSPtr", "const", "&", "scannerSubscriptionOptions", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L1587-L1589
Komnomnomnom/swigibpy
swigibpy.py
EClientSocketBase.reqFundamentalData
def reqFundamentalData(self, reqId, arg3, reportType): """reqFundamentalData(EClientSocketBase self, TickerId reqId, Contract arg3, IBString const & reportType)""" return _swigibpy.EClientSocketBase_reqFundamentalData(self, reqId, arg3, reportType)
python
def reqFundamentalData(self, reqId, arg3, reportType): """reqFundamentalData(EClientSocketBase self, TickerId reqId, Contract arg3, IBString const & reportType)""" return _swigibpy.EClientSocketBase_reqFundamentalData(self, reqId, arg3, reportType)
[ "def", "reqFundamentalData", "(", "self", ",", "reqId", ",", "arg3", ",", "reportType", ")", ":", "return", "_swigibpy", ".", "EClientSocketBase_reqFundamentalData", "(", "self", ",", "reqId", ",", "arg3", ",", "reportType", ")" ]
reqFundamentalData(EClientSocketBase self, TickerId reqId, Contract arg3, IBString const & reportType)
[ "reqFundamentalData", "(", "EClientSocketBase", "self", "TickerId", "reqId", "Contract", "arg3", "IBString", "const", "&", "reportType", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L1597-L1599
Komnomnomnom/swigibpy
swigibpy.py
EClientSocketBase.calculateImpliedVolatility
def calculateImpliedVolatility(self, reqId, contract, optionPrice, underPrice): """calculateImpliedVolatility(EClientSocketBase self, TickerId reqId, Contract contract, double optionPrice, double underPrice)""" return _swigibpy.EClientSocketBase_calculateImpliedVolatility(self, reqId, contract, optionPr...
python
def calculateImpliedVolatility(self, reqId, contract, optionPrice, underPrice): """calculateImpliedVolatility(EClientSocketBase self, TickerId reqId, Contract contract, double optionPrice, double underPrice)""" return _swigibpy.EClientSocketBase_calculateImpliedVolatility(self, reqId, contract, optionPr...
[ "def", "calculateImpliedVolatility", "(", "self", ",", "reqId", ",", "contract", ",", "optionPrice", ",", "underPrice", ")", ":", "return", "_swigibpy", ".", "EClientSocketBase_calculateImpliedVolatility", "(", "self", ",", "reqId", ",", "contract", ",", "optionPric...
calculateImpliedVolatility(EClientSocketBase self, TickerId reqId, Contract contract, double optionPrice, double underPrice)
[ "calculateImpliedVolatility", "(", "EClientSocketBase", "self", "TickerId", "reqId", "Contract", "contract", "double", "optionPrice", "double", "underPrice", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L1607-L1609
Komnomnomnom/swigibpy
swigibpy.py
EClientSocketBase.calculateOptionPrice
def calculateOptionPrice(self, reqId, contract, volatility, underPrice): """calculateOptionPrice(EClientSocketBase self, TickerId reqId, Contract contract, double volatility, double underPrice)""" return _swigibpy.EClientSocketBase_calculateOptionPrice(self, reqId, contract, volatility, underPrice)
python
def calculateOptionPrice(self, reqId, contract, volatility, underPrice): """calculateOptionPrice(EClientSocketBase self, TickerId reqId, Contract contract, double volatility, double underPrice)""" return _swigibpy.EClientSocketBase_calculateOptionPrice(self, reqId, contract, volatility, underPrice)
[ "def", "calculateOptionPrice", "(", "self", ",", "reqId", ",", "contract", ",", "volatility", ",", "underPrice", ")", ":", "return", "_swigibpy", ".", "EClientSocketBase_calculateOptionPrice", "(", "self", ",", "reqId", ",", "contract", ",", "volatility", ",", "...
calculateOptionPrice(EClientSocketBase self, TickerId reqId, Contract contract, double volatility, double underPrice)
[ "calculateOptionPrice", "(", "EClientSocketBase", "self", "TickerId", "reqId", "Contract", "contract", "double", "volatility", "double", "underPrice", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L1612-L1614
Komnomnomnom/swigibpy
swigibpy.py
EClientSocketBase.reqAccountSummary
def reqAccountSummary(self, reqId, groupName, tags): """reqAccountSummary(EClientSocketBase self, int reqId, IBString const & groupName, IBString const & tags)""" return _swigibpy.EClientSocketBase_reqAccountSummary(self, reqId, groupName, tags)
python
def reqAccountSummary(self, reqId, groupName, tags): """reqAccountSummary(EClientSocketBase self, int reqId, IBString const & groupName, IBString const & tags)""" return _swigibpy.EClientSocketBase_reqAccountSummary(self, reqId, groupName, tags)
[ "def", "reqAccountSummary", "(", "self", ",", "reqId", ",", "groupName", ",", "tags", ")", ":", "return", "_swigibpy", ".", "EClientSocketBase_reqAccountSummary", "(", "self", ",", "reqId", ",", "groupName", ",", "tags", ")" ]
reqAccountSummary(EClientSocketBase self, int reqId, IBString const & groupName, IBString const & tags)
[ "reqAccountSummary", "(", "EClientSocketBase", "self", "int", "reqId", "IBString", "const", "&", "groupName", "IBString", "const", "&", "tags", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L1647-L1649
Komnomnomnom/swigibpy
swigibpy.py
TWSPoller._run
def _run(self): '''Continually poll TWS''' stop = self._stop_evt connected = self._connected_evt tws = self._tws fd = tws.fd() pollfd = [fd] while not stop.is_set(): while (not connected.is_set() or not tws.isConnected()) and not stop.is_set(): ...
python
def _run(self): '''Continually poll TWS''' stop = self._stop_evt connected = self._connected_evt tws = self._tws fd = tws.fd() pollfd = [fd] while not stop.is_set(): while (not connected.is_set() or not tws.isConnected()) and not stop.is_set(): ...
[ "def", "_run", "(", "self", ")", ":", "stop", "=", "self", ".", "_stop_evt", "connected", "=", "self", ".", "_connected_evt", "tws", "=", "self", ".", "_tws", "fd", "=", "tws", ".", "fd", "(", ")", "pollfd", "=", "[", "fd", "]", "while", "not", "...
Continually poll TWS
[ "Continually", "poll", "TWS" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2059-L2106
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.tickPrice
def tickPrice(self, tickerId, field, price, canAutoExecute): """tickPrice(EWrapper self, TickerId tickerId, TickType field, double price, int canAutoExecute)""" return _swigibpy.EWrapper_tickPrice(self, tickerId, field, price, canAutoExecute)
python
def tickPrice(self, tickerId, field, price, canAutoExecute): """tickPrice(EWrapper self, TickerId tickerId, TickType field, double price, int canAutoExecute)""" return _swigibpy.EWrapper_tickPrice(self, tickerId, field, price, canAutoExecute)
[ "def", "tickPrice", "(", "self", ",", "tickerId", ",", "field", ",", "price", ",", "canAutoExecute", ")", ":", "return", "_swigibpy", ".", "EWrapper_tickPrice", "(", "self", ",", "tickerId", ",", "field", ",", "price", ",", "canAutoExecute", ")" ]
tickPrice(EWrapper self, TickerId tickerId, TickType field, double price, int canAutoExecute)
[ "tickPrice", "(", "EWrapper", "self", "TickerId", "tickerId", "TickType", "field", "double", "price", "int", "canAutoExecute", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2421-L2423
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.tickSize
def tickSize(self, tickerId, field, size): """tickSize(EWrapper self, TickerId tickerId, TickType field, int size)""" return _swigibpy.EWrapper_tickSize(self, tickerId, field, size)
python
def tickSize(self, tickerId, field, size): """tickSize(EWrapper self, TickerId tickerId, TickType field, int size)""" return _swigibpy.EWrapper_tickSize(self, tickerId, field, size)
[ "def", "tickSize", "(", "self", ",", "tickerId", ",", "field", ",", "size", ")", ":", "return", "_swigibpy", ".", "EWrapper_tickSize", "(", "self", ",", "tickerId", ",", "field", ",", "size", ")" ]
tickSize(EWrapper self, TickerId tickerId, TickType field, int size)
[ "tickSize", "(", "EWrapper", "self", "TickerId", "tickerId", "TickType", "field", "int", "size", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2426-L2428
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.tickOptionComputation
def tickOptionComputation(self, tickerId, tickType, impliedVol, delta, optPrice, pvDividend, gamma, vega, theta, undPrice): """tickOptionComputation(EWrapper self, TickerId tickerId, TickType tickType, double impliedVol, double delta, double optPrice, double pvDividend, double gamma, double vega, double theta, ...
python
def tickOptionComputation(self, tickerId, tickType, impliedVol, delta, optPrice, pvDividend, gamma, vega, theta, undPrice): """tickOptionComputation(EWrapper self, TickerId tickerId, TickType tickType, double impliedVol, double delta, double optPrice, double pvDividend, double gamma, double vega, double theta, ...
[ "def", "tickOptionComputation", "(", "self", ",", "tickerId", ",", "tickType", ",", "impliedVol", ",", "delta", ",", "optPrice", ",", "pvDividend", ",", "gamma", ",", "vega", ",", "theta", ",", "undPrice", ")", ":", "return", "_swigibpy", ".", "EWrapper_tick...
tickOptionComputation(EWrapper self, TickerId tickerId, TickType tickType, double impliedVol, double delta, double optPrice, double pvDividend, double gamma, double vega, double theta, double undPrice)
[ "tickOptionComputation", "(", "EWrapper", "self", "TickerId", "tickerId", "TickType", "tickType", "double", "impliedVol", "double", "delta", "double", "optPrice", "double", "pvDividend", "double", "gamma", "double", "vega", "double", "theta", "double", "undPrice", ")"...
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2431-L2433
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.tickGeneric
def tickGeneric(self, tickerId, tickType, value): """tickGeneric(EWrapper self, TickerId tickerId, TickType tickType, double value)""" return _swigibpy.EWrapper_tickGeneric(self, tickerId, tickType, value)
python
def tickGeneric(self, tickerId, tickType, value): """tickGeneric(EWrapper self, TickerId tickerId, TickType tickType, double value)""" return _swigibpy.EWrapper_tickGeneric(self, tickerId, tickType, value)
[ "def", "tickGeneric", "(", "self", ",", "tickerId", ",", "tickType", ",", "value", ")", ":", "return", "_swigibpy", ".", "EWrapper_tickGeneric", "(", "self", ",", "tickerId", ",", "tickType", ",", "value", ")" ]
tickGeneric(EWrapper self, TickerId tickerId, TickType tickType, double value)
[ "tickGeneric", "(", "EWrapper", "self", "TickerId", "tickerId", "TickType", "tickType", "double", "value", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2436-L2438
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.tickString
def tickString(self, tickerId, tickType, value): """tickString(EWrapper self, TickerId tickerId, TickType tickType, IBString const & value)""" return _swigibpy.EWrapper_tickString(self, tickerId, tickType, value)
python
def tickString(self, tickerId, tickType, value): """tickString(EWrapper self, TickerId tickerId, TickType tickType, IBString const & value)""" return _swigibpy.EWrapper_tickString(self, tickerId, tickType, value)
[ "def", "tickString", "(", "self", ",", "tickerId", ",", "tickType", ",", "value", ")", ":", "return", "_swigibpy", ".", "EWrapper_tickString", "(", "self", ",", "tickerId", ",", "tickType", ",", "value", ")" ]
tickString(EWrapper self, TickerId tickerId, TickType tickType, IBString const & value)
[ "tickString", "(", "EWrapper", "self", "TickerId", "tickerId", "TickType", "tickType", "IBString", "const", "&", "value", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2441-L2443
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.tickEFP
def tickEFP(self, tickerId, tickType, basisPoints, formattedBasisPoints, totalDividends, holdDays, futureExpiry, dividendImpact, dividendsToExpiry): """tickEFP(EWrapper self, TickerId tickerId, TickType tickType, double basisPoints, IBString const & formattedBasisPoints, double totalDividends, int holdDays, IBS...
python
def tickEFP(self, tickerId, tickType, basisPoints, formattedBasisPoints, totalDividends, holdDays, futureExpiry, dividendImpact, dividendsToExpiry): """tickEFP(EWrapper self, TickerId tickerId, TickType tickType, double basisPoints, IBString const & formattedBasisPoints, double totalDividends, int holdDays, IBS...
[ "def", "tickEFP", "(", "self", ",", "tickerId", ",", "tickType", ",", "basisPoints", ",", "formattedBasisPoints", ",", "totalDividends", ",", "holdDays", ",", "futureExpiry", ",", "dividendImpact", ",", "dividendsToExpiry", ")", ":", "return", "_swigibpy", ".", ...
tickEFP(EWrapper self, TickerId tickerId, TickType tickType, double basisPoints, IBString const & formattedBasisPoints, double totalDividends, int holdDays, IBString const & futureExpiry, double dividendImpact, double dividendsToExpiry)
[ "tickEFP", "(", "EWrapper", "self", "TickerId", "tickerId", "TickType", "tickType", "double", "basisPoints", "IBString", "const", "&", "formattedBasisPoints", "double", "totalDividends", "int", "holdDays", "IBString", "const", "&", "futureExpiry", "double", "dividendImp...
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2446-L2448
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.orderStatus
def orderStatus(self, orderId, status, filled, remaining, avgFillPrice, permId, parentId, lastFillPrice, clientId, whyHeld): """orderStatus(EWrapper self, OrderId orderId, IBString const & status, int filled, int remaining, double avgFillPrice, int permId, int parentId, double lastFillPrice, int clientId, IBStr...
python
def orderStatus(self, orderId, status, filled, remaining, avgFillPrice, permId, parentId, lastFillPrice, clientId, whyHeld): """orderStatus(EWrapper self, OrderId orderId, IBString const & status, int filled, int remaining, double avgFillPrice, int permId, int parentId, double lastFillPrice, int clientId, IBStr...
[ "def", "orderStatus", "(", "self", ",", "orderId", ",", "status", ",", "filled", ",", "remaining", ",", "avgFillPrice", ",", "permId", ",", "parentId", ",", "lastFillPrice", ",", "clientId", ",", "whyHeld", ")", ":", "return", "_swigibpy", ".", "EWrapper_ord...
orderStatus(EWrapper self, OrderId orderId, IBString const & status, int filled, int remaining, double avgFillPrice, int permId, int parentId, double lastFillPrice, int clientId, IBString const & whyHeld)
[ "orderStatus", "(", "EWrapper", "self", "OrderId", "orderId", "IBString", "const", "&", "status", "int", "filled", "int", "remaining", "double", "avgFillPrice", "int", "permId", "int", "parentId", "double", "lastFillPrice", "int", "clientId", "IBString", "const", ...
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2451-L2453
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.openOrder
def openOrder(self, orderId, arg0, arg1, arg2): """openOrder(EWrapper self, OrderId orderId, Contract arg0, Order arg1, OrderState arg2)""" return _swigibpy.EWrapper_openOrder(self, orderId, arg0, arg1, arg2)
python
def openOrder(self, orderId, arg0, arg1, arg2): """openOrder(EWrapper self, OrderId orderId, Contract arg0, Order arg1, OrderState arg2)""" return _swigibpy.EWrapper_openOrder(self, orderId, arg0, arg1, arg2)
[ "def", "openOrder", "(", "self", ",", "orderId", ",", "arg0", ",", "arg1", ",", "arg2", ")", ":", "return", "_swigibpy", ".", "EWrapper_openOrder", "(", "self", ",", "orderId", ",", "arg0", ",", "arg1", ",", "arg2", ")" ]
openOrder(EWrapper self, OrderId orderId, Contract arg0, Order arg1, OrderState arg2)
[ "openOrder", "(", "EWrapper", "self", "OrderId", "orderId", "Contract", "arg0", "Order", "arg1", "OrderState", "arg2", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2456-L2458
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.updateAccountValue
def updateAccountValue(self, key, val, currency, accountName): """updateAccountValue(EWrapper self, IBString const & key, IBString const & val, IBString const & currency, IBString const & accountName)""" return _swigibpy.EWrapper_updateAccountValue(self, key, val, currency, accountName)
python
def updateAccountValue(self, key, val, currency, accountName): """updateAccountValue(EWrapper self, IBString const & key, IBString const & val, IBString const & currency, IBString const & accountName)""" return _swigibpy.EWrapper_updateAccountValue(self, key, val, currency, accountName)
[ "def", "updateAccountValue", "(", "self", ",", "key", ",", "val", ",", "currency", ",", "accountName", ")", ":", "return", "_swigibpy", ".", "EWrapper_updateAccountValue", "(", "self", ",", "key", ",", "val", ",", "currency", ",", "accountName", ")" ]
updateAccountValue(EWrapper self, IBString const & key, IBString const & val, IBString const & currency, IBString const & accountName)
[ "updateAccountValue", "(", "EWrapper", "self", "IBString", "const", "&", "key", "IBString", "const", "&", "val", "IBString", "const", "&", "currency", "IBString", "const", "&", "accountName", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2477-L2479
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.updatePortfolio
def updatePortfolio(self, contract, position, marketPrice, marketValue, averageCost, unrealizedPNL, realizedPNL, accountName): """updatePortfolio(EWrapper self, Contract contract, int position, double marketPrice, double marketValue, double averageCost, double unrealizedPNL, double realizedPNL, IBString const &...
python
def updatePortfolio(self, contract, position, marketPrice, marketValue, averageCost, unrealizedPNL, realizedPNL, accountName): """updatePortfolio(EWrapper self, Contract contract, int position, double marketPrice, double marketValue, double averageCost, double unrealizedPNL, double realizedPNL, IBString const &...
[ "def", "updatePortfolio", "(", "self", ",", "contract", ",", "position", ",", "marketPrice", ",", "marketValue", ",", "averageCost", ",", "unrealizedPNL", ",", "realizedPNL", ",", "accountName", ")", ":", "return", "_swigibpy", ".", "EWrapper_updatePortfolio", "("...
updatePortfolio(EWrapper self, Contract contract, int position, double marketPrice, double marketValue, double averageCost, double unrealizedPNL, double realizedPNL, IBString const & accountName)
[ "updatePortfolio", "(", "EWrapper", "self", "Contract", "contract", "int", "position", "double", "marketPrice", "double", "marketValue", "double", "averageCost", "double", "unrealizedPNL", "double", "realizedPNL", "IBString", "const", "&", "accountName", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2482-L2484
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.execDetails
def execDetails(self, reqId, contract, execution): """execDetails(EWrapper self, int reqId, Contract contract, Execution execution)""" return _swigibpy.EWrapper_execDetails(self, reqId, contract, execution)
python
def execDetails(self, reqId, contract, execution): """execDetails(EWrapper self, int reqId, Contract contract, Execution execution)""" return _swigibpy.EWrapper_execDetails(self, reqId, contract, execution)
[ "def", "execDetails", "(", "self", ",", "reqId", ",", "contract", ",", "execution", ")", ":", "return", "_swigibpy", ".", "EWrapper_execDetails", "(", "self", ",", "reqId", ",", "contract", ",", "execution", ")" ]
execDetails(EWrapper self, int reqId, Contract contract, Execution execution)
[ "execDetails", "(", "EWrapper", "self", "int", "reqId", "Contract", "contract", "Execution", "execution", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2517-L2519
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.error
def error(self, id, errorCode, errorString): '''Error during communication with TWS''' if errorCode == 165: # Historical data sevice message sys.stderr.write("TWS INFO - %s: %s\n" % (errorCode, errorString)) elif errorCode >= 501 and errorCode < 600: # Socket read failed ...
python
def error(self, id, errorCode, errorString): '''Error during communication with TWS''' if errorCode == 165: # Historical data sevice message sys.stderr.write("TWS INFO - %s: %s\n" % (errorCode, errorString)) elif errorCode >= 501 and errorCode < 600: # Socket read failed ...
[ "def", "error", "(", "self", ",", "id", ",", "errorCode", ",", "errorString", ")", ":", "if", "errorCode", "==", "165", ":", "# Historical data sevice message", "sys", ".", "stderr", ".", "write", "(", "\"TWS INFO - %s: %s\\n\"", "%", "(", "errorCode", ",", ...
Error during communication with TWS
[ "Error", "during", "communication", "with", "TWS" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2527-L2542
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.updateMktDepth
def updateMktDepth(self, id, position, operation, side, price, size): """updateMktDepth(EWrapper self, TickerId id, int position, int operation, int side, double price, int size)""" return _swigibpy.EWrapper_updateMktDepth(self, id, position, operation, side, price, size)
python
def updateMktDepth(self, id, position, operation, side, price, size): """updateMktDepth(EWrapper self, TickerId id, int position, int operation, int side, double price, int size)""" return _swigibpy.EWrapper_updateMktDepth(self, id, position, operation, side, price, size)
[ "def", "updateMktDepth", "(", "self", ",", "id", ",", "position", ",", "operation", ",", "side", ",", "price", ",", "size", ")", ":", "return", "_swigibpy", ".", "EWrapper_updateMktDepth", "(", "self", ",", "id", ",", "position", ",", "operation", ",", "...
updateMktDepth(EWrapper self, TickerId id, int position, int operation, int side, double price, int size)
[ "updateMktDepth", "(", "EWrapper", "self", "TickerId", "id", "int", "position", "int", "operation", "int", "side", "double", "price", "int", "size", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2546-L2548
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.updateMktDepthL2
def updateMktDepthL2(self, id, position, marketMaker, operation, side, price, size): """updateMktDepthL2(EWrapper self, TickerId id, int position, IBString marketMaker, int operation, int side, double price, int size)""" return _swigibpy.EWrapper_updateMktDepthL2(self, id, position, marketMaker, operati...
python
def updateMktDepthL2(self, id, position, marketMaker, operation, side, price, size): """updateMktDepthL2(EWrapper self, TickerId id, int position, IBString marketMaker, int operation, int side, double price, int size)""" return _swigibpy.EWrapper_updateMktDepthL2(self, id, position, marketMaker, operati...
[ "def", "updateMktDepthL2", "(", "self", ",", "id", ",", "position", ",", "marketMaker", ",", "operation", ",", "side", ",", "price", ",", "size", ")", ":", "return", "_swigibpy", ".", "EWrapper_updateMktDepthL2", "(", "self", ",", "id", ",", "position", ",...
updateMktDepthL2(EWrapper self, TickerId id, int position, IBString marketMaker, int operation, int side, double price, int size)
[ "updateMktDepthL2", "(", "EWrapper", "self", "TickerId", "id", "int", "position", "IBString", "marketMaker", "int", "operation", "int", "side", "double", "price", "int", "size", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2551-L2553
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.updateNewsBulletin
def updateNewsBulletin(self, msgId, msgType, newsMessage, originExch): """updateNewsBulletin(EWrapper self, int msgId, int msgType, IBString const & newsMessage, IBString const & originExch)""" return _swigibpy.EWrapper_updateNewsBulletin(self, msgId, msgType, newsMessage, originExch)
python
def updateNewsBulletin(self, msgId, msgType, newsMessage, originExch): """updateNewsBulletin(EWrapper self, int msgId, int msgType, IBString const & newsMessage, IBString const & originExch)""" return _swigibpy.EWrapper_updateNewsBulletin(self, msgId, msgType, newsMessage, originExch)
[ "def", "updateNewsBulletin", "(", "self", ",", "msgId", ",", "msgType", ",", "newsMessage", ",", "originExch", ")", ":", "return", "_swigibpy", ".", "EWrapper_updateNewsBulletin", "(", "self", ",", "msgId", ",", "msgType", ",", "newsMessage", ",", "originExch", ...
updateNewsBulletin(EWrapper self, int msgId, int msgType, IBString const & newsMessage, IBString const & originExch)
[ "updateNewsBulletin", "(", "EWrapper", "self", "int", "msgId", "int", "msgType", "IBString", "const", "&", "newsMessage", "IBString", "const", "&", "originExch", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2556-L2558
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.historicalData
def historicalData(self, reqId, date, open, high, low, close, volume, barCount, WAP, hasGaps): """historicalData(EWrapper self, TickerId reqId, IBString const & date, double open, double high, double low, double close, int volume, int barCount, double WAP, int hasGaps)""" return _swigibpy.EWrapper_histo...
python
def historicalData(self, reqId, date, open, high, low, close, volume, barCount, WAP, hasGaps): """historicalData(EWrapper self, TickerId reqId, IBString const & date, double open, double high, double low, double close, int volume, int barCount, double WAP, int hasGaps)""" return _swigibpy.EWrapper_histo...
[ "def", "historicalData", "(", "self", ",", "reqId", ",", "date", ",", "open", ",", "high", ",", "low", ",", "close", ",", "volume", ",", "barCount", ",", "WAP", ",", "hasGaps", ")", ":", "return", "_swigibpy", ".", "EWrapper_historicalData", "(", "self",...
historicalData(EWrapper self, TickerId reqId, IBString const & date, double open, double high, double low, double close, int volume, int barCount, double WAP, int hasGaps)
[ "historicalData", "(", "EWrapper", "self", "TickerId", "reqId", "IBString", "const", "&", "date", "double", "open", "double", "high", "double", "low", "double", "close", "int", "volume", "int", "barCount", "double", "WAP", "int", "hasGaps", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2571-L2573
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.scannerData
def scannerData(self, reqId, rank, contractDetails, distance, benchmark, projection, legsStr): """scannerData(EWrapper self, int reqId, int rank, ContractDetails contractDetails, IBString const & distance, IBString const & benchmark, IBString const & projection, IBString const & legsStr)""" return _swig...
python
def scannerData(self, reqId, rank, contractDetails, distance, benchmark, projection, legsStr): """scannerData(EWrapper self, int reqId, int rank, ContractDetails contractDetails, IBString const & distance, IBString const & benchmark, IBString const & projection, IBString const & legsStr)""" return _swig...
[ "def", "scannerData", "(", "self", ",", "reqId", ",", "rank", ",", "contractDetails", ",", "distance", ",", "benchmark", ",", "projection", ",", "legsStr", ")", ":", "return", "_swigibpy", ".", "EWrapper_scannerData", "(", "self", ",", "reqId", ",", "rank", ...
scannerData(EWrapper self, int reqId, int rank, ContractDetails contractDetails, IBString const & distance, IBString const & benchmark, IBString const & projection, IBString const & legsStr)
[ "scannerData", "(", "EWrapper", "self", "int", "reqId", "int", "rank", "ContractDetails", "contractDetails", "IBString", "const", "&", "distance", "IBString", "const", "&", "benchmark", "IBString", "const", "&", "projection", "IBString", "const", "&", "legsStr", "...
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2581-L2583
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.realtimeBar
def realtimeBar(self, reqId, time, open, high, low, close, volume, wap, count): """realtimeBar(EWrapper self, TickerId reqId, long time, double open, double high, double low, double close, long volume, double wap, int count)""" return _swigibpy.EWrapper_realtimeBar(self, reqId, time, open, high, low, cl...
python
def realtimeBar(self, reqId, time, open, high, low, close, volume, wap, count): """realtimeBar(EWrapper self, TickerId reqId, long time, double open, double high, double low, double close, long volume, double wap, int count)""" return _swigibpy.EWrapper_realtimeBar(self, reqId, time, open, high, low, cl...
[ "def", "realtimeBar", "(", "self", ",", "reqId", ",", "time", ",", "open", ",", "high", ",", "low", ",", "close", ",", "volume", ",", "wap", ",", "count", ")", ":", "return", "_swigibpy", ".", "EWrapper_realtimeBar", "(", "self", ",", "reqId", ",", "...
realtimeBar(EWrapper self, TickerId reqId, long time, double open, double high, double low, double close, long volume, double wap, int count)
[ "realtimeBar", "(", "EWrapper", "self", "TickerId", "reqId", "long", "time", "double", "open", "double", "high", "double", "low", "double", "close", "long", "volume", "double", "wap", "int", "count", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2591-L2593
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.position
def position(self, account, contract, position, avgCost): """position(EWrapper self, IBString const & account, Contract contract, int position, double avgCost)""" return _swigibpy.EWrapper_position(self, account, contract, position, avgCost)
python
def position(self, account, contract, position, avgCost): """position(EWrapper self, IBString const & account, Contract contract, int position, double avgCost)""" return _swigibpy.EWrapper_position(self, account, contract, position, avgCost)
[ "def", "position", "(", "self", ",", "account", ",", "contract", ",", "position", ",", "avgCost", ")", ":", "return", "_swigibpy", ".", "EWrapper_position", "(", "self", ",", "account", ",", "contract", ",", "position", ",", "avgCost", ")" ]
position(EWrapper self, IBString const & account, Contract contract, int position, double avgCost)
[ "position", "(", "EWrapper", "self", "IBString", "const", "&", "account", "Contract", "contract", "int", "position", "double", "avgCost", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2626-L2628
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.accountSummary
def accountSummary(self, reqId, account, tag, value, curency): """accountSummary(EWrapper self, int reqId, IBString const & account, IBString const & tag, IBString const & value, IBString const & curency)""" return _swigibpy.EWrapper_accountSummary(self, reqId, account, tag, value, curency)
python
def accountSummary(self, reqId, account, tag, value, curency): """accountSummary(EWrapper self, int reqId, IBString const & account, IBString const & tag, IBString const & value, IBString const & curency)""" return _swigibpy.EWrapper_accountSummary(self, reqId, account, tag, value, curency)
[ "def", "accountSummary", "(", "self", ",", "reqId", ",", "account", ",", "tag", ",", "value", ",", "curency", ")", ":", "return", "_swigibpy", ".", "EWrapper_accountSummary", "(", "self", ",", "reqId", ",", "account", ",", "tag", ",", "value", ",", "cure...
accountSummary(EWrapper self, int reqId, IBString const & account, IBString const & tag, IBString const & value, IBString const & curency)
[ "accountSummary", "(", "EWrapper", "self", "int", "reqId", "IBString", "const", "&", "account", "IBString", "const", "&", "tag", "IBString", "const", "&", "value", "IBString", "const", "&", "curency", ")" ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2636-L2638
Komnomnomnom/swigibpy
swigibpy.py
EWrapper.pyError
def pyError(self, type, value, traceback): '''Handles an error thrown during invocation of an EWrapper method. Arguments are those provided by sys.exc_info() ''' sys.stderr.write("Exception thrown during EWrapper method dispatch:\n") print_exception(type, value, traceback)
python
def pyError(self, type, value, traceback): '''Handles an error thrown during invocation of an EWrapper method. Arguments are those provided by sys.exc_info() ''' sys.stderr.write("Exception thrown during EWrapper method dispatch:\n") print_exception(type, value, traceback)
[ "def", "pyError", "(", "self", ",", "type", ",", "value", ",", "traceback", ")", ":", "sys", ".", "stderr", ".", "write", "(", "\"Exception thrown during EWrapper method dispatch:\\n\"", ")", "print_exception", "(", "type", ",", "value", ",", "traceback", ")" ]
Handles an error thrown during invocation of an EWrapper method. Arguments are those provided by sys.exc_info()
[ "Handles", "an", "error", "thrown", "during", "invocation", "of", "an", "EWrapper", "method", "." ]
train
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L2666-L2672
HdrHistogram/HdrHistogram_py
hdrh/codec.py
HdrPayload.init_counts
def init_counts(self, counts_len): '''Called after instantiating with a compressed payload Params: counts_len counts size to use based on decoded settings in the header ''' assert self._data and counts_len and self.counts_len == 0 self.counts_len = counts_len ...
python
def init_counts(self, counts_len): '''Called after instantiating with a compressed payload Params: counts_len counts size to use based on decoded settings in the header ''' assert self._data and counts_len and self.counts_len == 0 self.counts_len = counts_len ...
[ "def", "init_counts", "(", "self", ",", "counts_len", ")", ":", "assert", "self", ".", "_data", "and", "counts_len", "and", "self", ".", "counts_len", "==", "0", "self", ".", "counts_len", "=", "counts_len", "self", ".", "_init_counts", "(", ")", "results"...
Called after instantiating with a compressed payload Params: counts_len counts size to use based on decoded settings in the header
[ "Called", "after", "instantiating", "with", "a", "compressed", "payload", "Params", ":", "counts_len", "counts", "size", "to", "use", "based", "on", "decoded", "settings", "in", "the", "header" ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/codec.py#L156-L169
HdrHistogram/HdrHistogram_py
hdrh/codec.py
HdrPayload._decompress
def _decompress(self, compressed_payload): '''Decompress a compressed payload into this payload wrapper. Note that the decompressed buffer is saved in self._data and the counts array is not yet allocated. Args: compressed_payload (string) a payload in zlib compressed form ...
python
def _decompress(self, compressed_payload): '''Decompress a compressed payload into this payload wrapper. Note that the decompressed buffer is saved in self._data and the counts array is not yet allocated. Args: compressed_payload (string) a payload in zlib compressed form ...
[ "def", "_decompress", "(", "self", ",", "compressed_payload", ")", ":", "# make sure this instance is pristine", "if", "self", ".", "_data", ":", "raise", "RuntimeError", "(", "'Cannot decompress to an instance with payload'", ")", "# Here it is important to keep a reference to...
Decompress a compressed payload into this payload wrapper. Note that the decompressed buffer is saved in self._data and the counts array is not yet allocated. Args: compressed_payload (string) a payload in zlib compressed form Exception: HdrCookieException: ...
[ "Decompress", "a", "compressed", "payload", "into", "this", "payload", "wrapper", ".", "Note", "that", "the", "decompressed", "buffer", "is", "saved", "in", "self", ".", "_data", "and", "the", "counts", "array", "is", "not", "yet", "allocated", "." ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/codec.py#L174-L211
HdrHistogram/HdrHistogram_py
hdrh/codec.py
HdrPayload.compress
def compress(self, counts_limit): '''Compress this payload instance Args: counts_limit how many counters should be encoded starting from index 0 (can be 0), Return: the compressed payload (python string) ''' if self.payload: ...
python
def compress(self, counts_limit): '''Compress this payload instance Args: counts_limit how many counters should be encoded starting from index 0 (can be 0), Return: the compressed payload (python string) ''' if self.payload: ...
[ "def", "compress", "(", "self", ",", "counts_limit", ")", ":", "if", "self", ".", "payload", ":", "# worst case varint encoded length is when each counter is at the maximum value", "# in this case 1 more byte per counter is needed due to the more bits", "varint_len", "=", "counts_l...
Compress this payload instance Args: counts_limit how many counters should be encoded starting from index 0 (can be 0), Return: the compressed payload (python string)
[ "Compress", "this", "payload", "instance", "Args", ":", "counts_limit", "how", "many", "counters", "should", "be", "encoded", "starting", "from", "index", "0", "(", "can", "be", "0", ")", "Return", ":", "the", "compressed", "payload", "(", "python", "string"...
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/codec.py#L213-L241
HdrHistogram/HdrHistogram_py
hdrh/codec.py
HdrHistogramEncoder.encode
def encode(self): '''Compress the associated encodable payload, prepend the header then encode with base64 if requested Returns: the b64 encoded wire encoding of the histogram (as a string) or the compressed payload (as a string, if b64 wrappinb is disabled) ''' ...
python
def encode(self): '''Compress the associated encodable payload, prepend the header then encode with base64 if requested Returns: the b64 encoded wire encoding of the histogram (as a string) or the compressed payload (as a string, if b64 wrappinb is disabled) ''' ...
[ "def", "encode", "(", "self", ")", ":", "# only compress the first non zero buckets", "# if histogram is empty we do not encode any counter", "if", "self", ".", "histogram", ".", "total_count", ":", "relevant_length", "=", "self", ".", "histogram", ".", "get_counts_array_in...
Compress the associated encodable payload, prepend the header then encode with base64 if requested Returns: the b64 encoded wire encoding of the histogram (as a string) or the compressed payload (as a string, if b64 wrappinb is disabled)
[ "Compress", "the", "associated", "encodable", "payload", "prepend", "the", "header", "then", "encode", "with", "base64", "if", "requested" ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/codec.py#L290-L310
HdrHistogram/HdrHistogram_py
hdrh/codec.py
HdrHistogramEncoder.decode
def decode(encoded_histogram, b64_wrap=True): '''Decode a wire histogram encoding into a read-only Hdr Payload instance Args: encoded_histogram a string containing the wire encoding of a histogram such as one returned from encode() Returns: a...
python
def decode(encoded_histogram, b64_wrap=True): '''Decode a wire histogram encoding into a read-only Hdr Payload instance Args: encoded_histogram a string containing the wire encoding of a histogram such as one returned from encode() Returns: a...
[ "def", "decode", "(", "encoded_histogram", ",", "b64_wrap", "=", "True", ")", ":", "if", "b64_wrap", ":", "b64decode", "=", "base64", ".", "b64decode", "(", "encoded_histogram", ")", "# this string has 2 parts in it: the header (raw) and the payload (compressed)", "b64dec...
Decode a wire histogram encoding into a read-only Hdr Payload instance Args: encoded_histogram a string containing the wire encoding of a histogram such as one returned from encode() Returns: an hdr_payload instance with all the decoded/uncompressed ...
[ "Decode", "a", "wire", "histogram", "encoding", "into", "a", "read", "-", "only", "Hdr", "Payload", "instance", "Args", ":", "encoded_histogram", "a", "string", "containing", "the", "wire", "encoding", "of", "a", "histogram", "such", "as", "one", "returned", ...
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/codec.py#L313-L356
HdrHistogram/HdrHistogram_py
hdrh/histogram.py
HdrHistogram.record_value
def record_value(self, value, count=1): '''Record a new value into the histogram Args: value: the value to record (must be in the valid range) count: incremental count (defaults to 1) ''' if value < 0: return False counts_index = self._counts_...
python
def record_value(self, value, count=1): '''Record a new value into the histogram Args: value: the value to record (must be in the valid range) count: incremental count (defaults to 1) ''' if value < 0: return False counts_index = self._counts_...
[ "def", "record_value", "(", "self", ",", "value", ",", "count", "=", "1", ")", ":", "if", "value", "<", "0", ":", "return", "False", "counts_index", "=", "self", ".", "_counts_index_for", "(", "value", ")", "if", "(", "counts_index", "<", "0", ")", "...
Record a new value into the histogram Args: value: the value to record (must be in the valid range) count: incremental count (defaults to 1)
[ "Record", "a", "new", "value", "into", "the", "histogram" ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/histogram.py#L175-L191
HdrHistogram/HdrHistogram_py
hdrh/histogram.py
HdrHistogram.record_corrected_value
def record_corrected_value(self, value, expected_interval, count=1): '''Record a new value into the histogram and correct for coordinated omission if needed Args: value: the value to record (must be in the valid range) expected_interval: the expected interval between 2 v...
python
def record_corrected_value(self, value, expected_interval, count=1): '''Record a new value into the histogram and correct for coordinated omission if needed Args: value: the value to record (must be in the valid range) expected_interval: the expected interval between 2 v...
[ "def", "record_corrected_value", "(", "self", ",", "value", ",", "expected_interval", ",", "count", "=", "1", ")", ":", "while", "True", ":", "if", "not", "self", ".", "record_value", "(", "value", ",", "count", ")", ":", "return", "False", "if", "value"...
Record a new value into the histogram and correct for coordinated omission if needed Args: value: the value to record (must be in the valid range) expected_interval: the expected interval between 2 value samples count: incremental count (defaults to 1)
[ "Record", "a", "new", "value", "into", "the", "histogram", "and", "correct", "for", "coordinated", "omission", "if", "needed" ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/histogram.py#L194-L208
HdrHistogram/HdrHistogram_py
hdrh/histogram.py
HdrHistogram.get_value_at_percentile
def get_value_at_percentile(self, percentile): '''Get the value for a given percentile Args: percentile: a float in [0.0..100.0] Returns: the value for the given percentile ''' count_at_percentile = self.get_target_count_at_percentile(percentile) ...
python
def get_value_at_percentile(self, percentile): '''Get the value for a given percentile Args: percentile: a float in [0.0..100.0] Returns: the value for the given percentile ''' count_at_percentile = self.get_target_count_at_percentile(percentile) ...
[ "def", "get_value_at_percentile", "(", "self", ",", "percentile", ")", ":", "count_at_percentile", "=", "self", ".", "get_target_count_at_percentile", "(", "percentile", ")", "total", "=", "0", "for", "index", "in", "range", "(", "self", ".", "counts_len", ")", ...
Get the value for a given percentile Args: percentile: a float in [0.0..100.0] Returns: the value for the given percentile
[ "Get", "the", "value", "for", "a", "given", "percentile" ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/histogram.py#L268-L285
HdrHistogram/HdrHistogram_py
hdrh/histogram.py
HdrHistogram.get_percentile_to_value_dict
def get_percentile_to_value_dict(self, percentile_list): '''A faster alternative to query values for a list of percentiles. Args: percentile_list: a list of percentiles in any order, dups will be ignored each element in the list must be a float value in [0.0 .. 100.0] Re...
python
def get_percentile_to_value_dict(self, percentile_list): '''A faster alternative to query values for a list of percentiles. Args: percentile_list: a list of percentiles in any order, dups will be ignored each element in the list must be a float value in [0.0 .. 100.0] Re...
[ "def", "get_percentile_to_value_dict", "(", "self", ",", "percentile_list", ")", ":", "result", "=", "{", "}", "total", "=", "0", "percentile_list_index", "=", "0", "count_at_percentile", "=", "0", "# remove dups and sort", "percentile_list", "=", "list", "(", "se...
A faster alternative to query values for a list of percentiles. Args: percentile_list: a list of percentiles in any order, dups will be ignored each element in the list must be a float value in [0.0 .. 100.0] Returns: a dict of percentile values indexed by the percen...
[ "A", "faster", "alternative", "to", "query", "values", "for", "a", "list", "of", "percentiles", "." ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/histogram.py#L287-L326
HdrHistogram/HdrHistogram_py
hdrh/histogram.py
HdrHistogram.values_are_equivalent
def values_are_equivalent(self, val1, val2): '''Check whether 2 values are equivalent (meaning they are in the same bucket/range) Returns: true if the 2 values are equivalent ''' return self.get_lowest_equivalent_value(val1) == self.get_lowest_equivalent_value(val2)
python
def values_are_equivalent(self, val1, val2): '''Check whether 2 values are equivalent (meaning they are in the same bucket/range) Returns: true if the 2 values are equivalent ''' return self.get_lowest_equivalent_value(val1) == self.get_lowest_equivalent_value(val2)
[ "def", "values_are_equivalent", "(", "self", ",", "val1", ",", "val2", ")", ":", "return", "self", ".", "get_lowest_equivalent_value", "(", "val1", ")", "==", "self", ".", "get_lowest_equivalent_value", "(", "val2", ")" ]
Check whether 2 values are equivalent (meaning they are in the same bucket/range) Returns: true if the 2 values are equivalent
[ "Check", "whether", "2", "values", "are", "equivalent", "(", "meaning", "they", "are", "in", "the", "same", "bucket", "/", "range", ")" ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/histogram.py#L335-L342
HdrHistogram/HdrHistogram_py
hdrh/histogram.py
HdrHistogram.reset
def reset(self): '''Reset the histogram to a pristine state ''' for index in range(self.counts_len): self.counts[index] = 0 self.total_count = 0 self.min_value = sys.maxsize self.max_value = 0 self.start_time_stamp_msec = sys.maxsize self.end_t...
python
def reset(self): '''Reset the histogram to a pristine state ''' for index in range(self.counts_len): self.counts[index] = 0 self.total_count = 0 self.min_value = sys.maxsize self.max_value = 0 self.start_time_stamp_msec = sys.maxsize self.end_t...
[ "def", "reset", "(", "self", ")", ":", "for", "index", "in", "range", "(", "self", ".", "counts_len", ")", ":", "self", ".", "counts", "[", "index", "]", "=", "0", "self", ".", "total_count", "=", "0", "self", ".", "min_value", "=", "sys", ".", "...
Reset the histogram to a pristine state
[ "Reset", "the", "histogram", "to", "a", "pristine", "state" ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/histogram.py#L386-L395
HdrHistogram/HdrHistogram_py
hdrh/histogram.py
HdrHistogram.adjust_internal_tacking_values
def adjust_internal_tacking_values(self, min_non_zero_index, max_index, total_added): '''Called during decoding and add to adjust the new min/max value and total count Args: ...
python
def adjust_internal_tacking_values(self, min_non_zero_index, max_index, total_added): '''Called during decoding and add to adjust the new min/max value and total count Args: ...
[ "def", "adjust_internal_tacking_values", "(", "self", ",", "min_non_zero_index", ",", "max_index", ",", "total_added", ")", ":", "if", "max_index", ">=", "0", ":", "max_value", "=", "self", ".", "get_highest_equivalent_value", "(", "self", ".", "get_value_from_index...
Called during decoding and add to adjust the new min/max value and total count Args: min_non_zero_index min nonzero index of all added counts (-1 if none) max_index max index of all added counts (-1 if none)
[ "Called", "during", "decoding", "and", "add", "to", "adjust", "the", "new", "min", "/", "max", "value", "and", "total", "count" ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/histogram.py#L424-L441
HdrHistogram/HdrHistogram_py
hdrh/histogram.py
HdrHistogram.set_internal_tacking_values
def set_internal_tacking_values(self, min_non_zero_index, max_index, total_added): '''Called during decoding and add to adjust the new min/max value and total count Args: min_...
python
def set_internal_tacking_values(self, min_non_zero_index, max_index, total_added): '''Called during decoding and add to adjust the new min/max value and total count Args: min_...
[ "def", "set_internal_tacking_values", "(", "self", ",", "min_non_zero_index", ",", "max_index", ",", "total_added", ")", ":", "if", "max_index", ">=", "0", ":", "self", ".", "max_value", "=", "self", ".", "get_highest_equivalent_value", "(", "self", ".", "get_va...
Called during decoding and add to adjust the new min/max value and total count Args: min_non_zero_index min nonzero index of all added counts (-1 if none) max_index max index of all added counts (-1 if none)
[ "Called", "during", "decoding", "and", "add", "to", "adjust", "the", "new", "min", "/", "max", "value", "and", "total", "count" ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/histogram.py#L443-L458
HdrHistogram/HdrHistogram_py
hdrh/histogram.py
HdrHistogram.get_counts_array_index
def get_counts_array_index(self, value): '''Return the index in the counts array for a given value ''' if value < 0: raise ValueError("Histogram recorded value cannot be negative.") bucket_index = self._get_bucket_index(value) sub_bucket_index = self._get_sub_bucket_...
python
def get_counts_array_index(self, value): '''Return the index in the counts array for a given value ''' if value < 0: raise ValueError("Histogram recorded value cannot be negative.") bucket_index = self._get_bucket_index(value) sub_bucket_index = self._get_sub_bucket_...
[ "def", "get_counts_array_index", "(", "self", ",", "value", ")", ":", "if", "value", "<", "0", ":", "raise", "ValueError", "(", "\"Histogram recorded value cannot be negative.\"", ")", "bucket_index", "=", "self", ".", "_get_bucket_index", "(", "value", ")", "sub_...
Return the index in the counts array for a given value
[ "Return", "the", "index", "in", "the", "counts", "array", "for", "a", "given", "value" ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/histogram.py#L460-L475
HdrHistogram/HdrHistogram_py
hdrh/histogram.py
HdrHistogram.decode_and_add
def decode_and_add(self, encoded_histogram): '''Decode an encoded histogram and add it to this histogram Args: encoded_histogram (string) an encoded histogram following the V1 format, such as one returned by the encode() method Exception: TypeError in case...
python
def decode_and_add(self, encoded_histogram): '''Decode an encoded histogram and add it to this histogram Args: encoded_histogram (string) an encoded histogram following the V1 format, such as one returned by the encode() method Exception: TypeError in case...
[ "def", "decode_and_add", "(", "self", ",", "encoded_histogram", ")", ":", "other_hist", "=", "HdrHistogram", ".", "decode", "(", "encoded_histogram", ",", "self", ".", "b64_wrap", ")", "self", ".", "add", "(", "other_hist", ")" ]
Decode an encoded histogram and add it to this histogram Args: encoded_histogram (string) an encoded histogram following the V1 format, such as one returned by the encode() method Exception: TypeError in case of base64 decode error HdrCookieException: ...
[ "Decode", "an", "encoded", "histogram", "and", "add", "it", "to", "this", "histogram", "Args", ":", "encoded_histogram", "(", "string", ")", "an", "encoded", "histogram", "following", "the", "V1", "format", "such", "as", "one", "returned", "by", "the", "enco...
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/histogram.py#L530-L547
HdrHistogram/HdrHistogram_py
hdrh/histogram.py
HdrHistogram.decode
def decode(encoded_histogram, b64_wrap=True): '''Decode an encoded histogram and return a new histogram instance that has been initialized with the decoded content Return: a new histogram instance representing the decoded content Exception: TypeError in case of ba...
python
def decode(encoded_histogram, b64_wrap=True): '''Decode an encoded histogram and return a new histogram instance that has been initialized with the decoded content Return: a new histogram instance representing the decoded content Exception: TypeError in case of ba...
[ "def", "decode", "(", "encoded_histogram", ",", "b64_wrap", "=", "True", ")", ":", "hdr_payload", "=", "HdrHistogramEncoder", ".", "decode", "(", "encoded_histogram", ",", "b64_wrap", ")", "payload", "=", "hdr_payload", ".", "payload", "histogram", "=", "HdrHist...
Decode an encoded histogram and return a new histogram instance that has been initialized with the decoded content Return: a new histogram instance representing the decoded content Exception: TypeError in case of base64 decode error HdrCookieException: ...
[ "Decode", "an", "encoded", "histogram", "and", "return", "a", "new", "histogram", "instance", "that", "has", "been", "initialized", "with", "the", "decoded", "content", "Return", ":", "a", "new", "histogram", "instance", "representing", "the", "decoded", "conten...
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/histogram.py#L550-L572
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator._validate_json
def _validate_json(self, checked_json, schema): """ Validate JSON according to JSONSchema *Args*:\n _checked_json_: validated JSON. _schema_: schema that used for validation. """ try: jsonschema.validate(checked_json, schema) except jsonschema.Validat...
python
def _validate_json(self, checked_json, schema): """ Validate JSON according to JSONSchema *Args*:\n _checked_json_: validated JSON. _schema_: schema that used for validation. """ try: jsonschema.validate(checked_json, schema) except jsonschema.Validat...
[ "def", "_validate_json", "(", "self", ",", "checked_json", ",", "schema", ")", ":", "try", ":", "jsonschema", ".", "validate", "(", "checked_json", ",", "schema", ")", "except", "jsonschema", ".", "ValidationError", "as", "e", ":", "print", "(", "\"\"\"Faile...
Validate JSON according to JSONSchema *Args*:\n _checked_json_: validated JSON. _schema_: schema that used for validation.
[ "Validate", "JSON", "according", "to", "JSONSchema" ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L75-L95
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator.validate_jsonschema_from_file
def validate_jsonschema_from_file(self, json_string, path_to_schema): """ Validate JSON according to schema, loaded from a file. *Args:*\n _json_string_ - JSON string;\n _path_to_schema_ - path to file with JSON schema; *Raises:*\n JsonValidatorError *E...
python
def validate_jsonschema_from_file(self, json_string, path_to_schema): """ Validate JSON according to schema, loaded from a file. *Args:*\n _json_string_ - JSON string;\n _path_to_schema_ - path to file with JSON schema; *Raises:*\n JsonValidatorError *E...
[ "def", "validate_jsonschema_from_file", "(", "self", ",", "json_string", ",", "path_to_schema", ")", ":", "schema", "=", "open", "(", "path_to_schema", ")", ".", "read", "(", ")", "load_input_json", "=", "self", ".", "string_to_json", "(", "json_string", ")", ...
Validate JSON according to schema, loaded from a file. *Args:*\n _json_string_ - JSON string;\n _path_to_schema_ - path to file with JSON schema; *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonValidator | ...
[ "Validate", "JSON", "according", "to", "schema", "loaded", "from", "a", "file", "." ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L97-L122
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator.validate_jsonschema
def validate_jsonschema(self, json_string, input_schema): """ Validate JSON according to schema. *Args:*\n _json_string_ - JSON string;\n _input_schema_ - schema in string format; *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value...
python
def validate_jsonschema(self, json_string, input_schema): """ Validate JSON according to schema. *Args:*\n _json_string_ - JSON string;\n _input_schema_ - schema in string format; *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value...
[ "def", "validate_jsonschema", "(", "self", ",", "json_string", ",", "input_schema", ")", ":", "load_input_json", "=", "self", ".", "string_to_json", "(", "json_string", ")", "try", ":", "load_schema", "=", "json", ".", "loads", "(", "input_schema", ")", "excep...
Validate JSON according to schema. *Args:*\n _json_string_ - JSON string;\n _input_schema_ - schema in string format; *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonValidator | | Library | OperatingSys...
[ "Validate", "JSON", "according", "to", "schema", "." ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L124-L150
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator.string_to_json
def string_to_json(self, source): """ Deserialize string into JSON structure. *Args:*\n _source_ - JSON string *Returns:*\n JSON structure *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonV...
python
def string_to_json(self, source): """ Deserialize string into JSON structure. *Args:*\n _source_ - JSON string *Returns:*\n JSON structure *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonV...
[ "def", "string_to_json", "(", "self", ",", "source", ")", ":", "try", ":", "load_input_json", "=", "json", ".", "loads", "(", "source", ")", "except", "ValueError", "as", "e", ":", "raise", "JsonValidatorError", "(", "\"Could not parse '%s' as JSON: %s\"", "%", ...
Deserialize string into JSON structure. *Args:*\n _source_ - JSON string *Returns:*\n JSON structure *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonValidator | | Library | OperatingSystem | ...
[ "Deserialize", "string", "into", "JSON", "structure", "." ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L152-L180
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator.json_to_string
def json_to_string(self, source): """ Serialize JSON structure into string. *Args:*\n _source_ - JSON structure *Returns:*\n JSON string *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonVal...
python
def json_to_string(self, source): """ Serialize JSON structure into string. *Args:*\n _source_ - JSON structure *Returns:*\n JSON string *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonVal...
[ "def", "json_to_string", "(", "self", ",", "source", ")", ":", "try", ":", "load_input_json", "=", "json", ".", "dumps", "(", "source", ")", "except", "ValueError", "as", "e", ":", "raise", "JsonValidatorError", "(", "\"Could serialize '%s' to JSON: %s\"", "%", ...
Serialize JSON structure into string. *Args:*\n _source_ - JSON structure *Returns:*\n JSON string *Raises:*\n JsonValidatorError *Example:*\n | *Settings* | *Value* | | Library | JsonValidator | | Library | OperatingSystem | ...
[ "Serialize", "JSON", "structure", "into", "string", "." ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L182-L210
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator.get_elements
def get_elements(self, json_string, expr): """ Get list of elements from _json_string_, matching [http://goessner.net/articles/JsonPath/|JSONPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression; *Returns:*\n List of found eleme...
python
def get_elements(self, json_string, expr): """ Get list of elements from _json_string_, matching [http://goessner.net/articles/JsonPath/|JSONPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression; *Returns:*\n List of found eleme...
[ "def", "get_elements", "(", "self", ",", "json_string", ",", "expr", ")", ":", "load_input_json", "=", "self", ".", "string_to_json", "(", "json_string", ")", "# parsing jsonpath", "jsonpath_expr", "=", "parse", "(", "expr", ")", "# list of returned elements", "va...
Get list of elements from _json_string_, matching [http://goessner.net/articles/JsonPath/|JSONPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression; *Returns:*\n List of found elements or ``None`` if no elements were found *Example:*\n...
[ "Get", "list", "of", "elements", "from", "_json_string_", "matching", "[", "http", ":", "//", "goessner", ".", "net", "/", "articles", "/", "JsonPath", "/", "|JSONPath", "]", "expression", "." ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L212-L243
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator.select_elements
def select_elements(self, json_string, expr): """ Return list of elements from _json_string_, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. ...
python
def select_elements(self, json_string, expr): """ Return list of elements from _json_string_, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. ...
[ "def", "select_elements", "(", "self", ",", "json_string", ",", "expr", ")", ":", "load_input_json", "=", "self", ".", "string_to_json", "(", "json_string", ")", "# parsing jsonselect", "match", "=", "jsonselect", ".", "match", "(", "sel", "=", "expr", ",", ...
Return list of elements from _json_string_, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. *Args:*\n _json_string_ - JSON string;\n _ex...
[ "Return", "list", "of", "elements", "from", "_json_string_", "matching", "[", "http", ":", "//", "jsonselect", ".", "org", "/", "|", "JSONSelect", "]", "expression", "." ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L245-L273
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator.select_objects
def select_objects(self, json_string, expr): """ Return list of elements from _json_string_, matching [ http://objectpath.org// | ObjectPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - ObjectPath expression; *Returns:*\n List of found elements...
python
def select_objects(self, json_string, expr): """ Return list of elements from _json_string_, matching [ http://objectpath.org// | ObjectPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - ObjectPath expression; *Returns:*\n List of found elements...
[ "def", "select_objects", "(", "self", ",", "json_string", ",", "expr", ")", ":", "load_input_json", "=", "self", ".", "string_to_json", "(", "json_string", ")", "# parsing objectpath", "tree", "=", "objectpath", ".", "Tree", "(", "load_input_json", ")", "values"...
Return list of elements from _json_string_, matching [ http://objectpath.org// | ObjectPath] expression. *Args:*\n _json_string_ - JSON string;\n _expr_ - ObjectPath expression; *Returns:*\n List of found elements. If no elements were found, empty list will be returned ...
[ "Return", "list", "of", "elements", "from", "_json_string_", "matching", "[", "http", ":", "//", "objectpath", ".", "org", "//", "|", "ObjectPath", "]", "expression", "." ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L275-L300
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator.element_should_exist
def element_should_exist(self, json_string, expr): """ Check the existence of one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSO...
python
def element_should_exist(self, json_string, expr): """ Check the existence of one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSO...
[ "def", "element_should_exist", "(", "self", ",", "json_string", ",", "expr", ")", ":", "value", "=", "self", ".", "select_elements", "(", "json_string", ",", "expr", ")", "if", "value", "is", "None", ":", "raise", "JsonValidatorError", "(", "'Elements %s does ...
Check the existence of one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. *Args:*\n _json_string_ - JSON string;\n _e...
[ "Check", "the", "existence", "of", "one", "or", "more", "elements", "matching", "[", "http", ":", "//", "jsonselect", ".", "org", "/", "|", "JSONSelect", "]", "expression", "." ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L302-L327
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator.element_should_not_exist
def element_should_not_exist(self, json_string, expr): """ Check that one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression, don't exist. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to quer...
python
def element_should_not_exist(self, json_string, expr): """ Check that one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression, don't exist. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to quer...
[ "def", "element_should_not_exist", "(", "self", ",", "json_string", ",", "expr", ")", ":", "value", "=", "self", ".", "select_elements", "(", "json_string", ",", "expr", ")", "if", "value", "is", "not", "None", ":", "raise", "JsonValidatorError", "(", "'Elem...
Check that one or more elements, matching [ http://jsonselect.org/ | JSONSelect] expression, don't exist. *DEPRECATED* JSON Select query language is outdated and not supported any more. Use other keywords of this library to query JSON. *Args:*\n _json_string_ - JSON string;\n _...
[ "Check", "that", "one", "or", "more", "elements", "matching", "[", "http", ":", "//", "jsonselect", ".", "org", "/", "|", "JSONSelect", "]", "expression", "don", "t", "exist", "." ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L329-L345
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator._json_path_search
def _json_path_search(self, json_dict, expr): """ Scan JSON dictionary with using json-path passed sting of the format of $.element..element1[index] etc. *Args:*\n _json_dict_ - JSON dictionary;\n _expr_ - string of fuzzy search for items within the directory;\n *Return...
python
def _json_path_search(self, json_dict, expr): """ Scan JSON dictionary with using json-path passed sting of the format of $.element..element1[index] etc. *Args:*\n _json_dict_ - JSON dictionary;\n _expr_ - string of fuzzy search for items within the directory;\n *Return...
[ "def", "_json_path_search", "(", "self", ",", "json_dict", ",", "expr", ")", ":", "path", "=", "parse", "(", "expr", ")", "results", "=", "path", ".", "find", "(", "json_dict", ")", "if", "len", "(", "results", ")", "is", "0", ":", "raise", "JsonVali...
Scan JSON dictionary with using json-path passed sting of the format of $.element..element1[index] etc. *Args:*\n _json_dict_ - JSON dictionary;\n _expr_ - string of fuzzy search for items within the directory;\n *Returns:*\n List of DatumInContext objects: ``[DatumInCo...
[ "Scan", "JSON", "dictionary", "with", "using", "json", "-", "path", "passed", "sting", "of", "the", "format", "of", "$", ".", "element", "..", "element1", "[", "index", "]", "etc", "." ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L347-L371
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator.update_json
def update_json(self, json_string, expr, value, index=0): """ Replace the value in the JSON string. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression for determining the value to be replaced;\n _value_ - the value to be replaced with;\n _index...
python
def update_json(self, json_string, expr, value, index=0): """ Replace the value in the JSON string. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression for determining the value to be replaced;\n _value_ - the value to be replaced with;\n _index...
[ "def", "update_json", "(", "self", ",", "json_string", ",", "expr", ",", "value", ",", "index", "=", "0", ")", ":", "load_input_json", "=", "self", ".", "string_to_json", "(", "json_string", ")", "matches", "=", "self", ".", "_json_path_search", "(", "load...
Replace the value in the JSON string. *Args:*\n _json_string_ - JSON string;\n _expr_ - JSONPath expression for determining the value to be replaced;\n _value_ - the value to be replaced with;\n _index_ - index for selecting item within a match list, default value is 0;\n ...
[ "Replace", "the", "value", "in", "the", "JSON", "string", "." ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L373-L412
peterservice-rnd/robotframework-jsonvalidator
src/JsonValidator.py
JsonValidator.pretty_print_json
def pretty_print_json(self, json_string): """ Return formatted JSON string _json_string_.\n Using method json.dumps with settings: _indent=2, ensure_ascii=False_. *Args:*\n _json_string_ - JSON string. *Returns:*\n Formatted JSON string. *Example:*\n ...
python
def pretty_print_json(self, json_string): """ Return formatted JSON string _json_string_.\n Using method json.dumps with settings: _indent=2, ensure_ascii=False_. *Args:*\n _json_string_ - JSON string. *Returns:*\n Formatted JSON string. *Example:*\n ...
[ "def", "pretty_print_json", "(", "self", ",", "json_string", ")", ":", "return", "json", ".", "dumps", "(", "self", ".", "string_to_json", "(", "json_string", ")", ",", "indent", "=", "2", ",", "ensure_ascii", "=", "False", ")" ]
Return formatted JSON string _json_string_.\n Using method json.dumps with settings: _indent=2, ensure_ascii=False_. *Args:*\n _json_string_ - JSON string. *Returns:*\n Formatted JSON string. *Example:*\n | *Settings* | *Value* | | Library | JsonVali...
[ "Return", "formatted", "JSON", "string", "_json_string_", ".", "\\", "n", "Using", "method", "json", ".", "dumps", "with", "settings", ":", "_indent", "=", "2", "ensure_ascii", "=", "False_", "." ]
train
https://github.com/peterservice-rnd/robotframework-jsonvalidator/blob/acde5045c04d0a7b9079f22707c3e71a5d3fa724/src/JsonValidator.py#L414-L447
HdrHistogram/HdrHistogram_py
hdrh/log.py
HistogramLogWriter.output_interval_histogram
def output_interval_histogram(self, histogram, start_time_stamp_sec=0, end_time_stamp_sec=0, max_value_unit_ratio=1000000.0): '''Output an interval histogram, with the given ti...
python
def output_interval_histogram(self, histogram, start_time_stamp_sec=0, end_time_stamp_sec=0, max_value_unit_ratio=1000000.0): '''Output an interval histogram, with the given ti...
[ "def", "output_interval_histogram", "(", "self", ",", "histogram", ",", "start_time_stamp_sec", "=", "0", ",", "end_time_stamp_sec", "=", "0", ",", "max_value_unit_ratio", "=", "1000000.0", ")", ":", "if", "not", "start_time_stamp_sec", ":", "start_time_stamp_sec", ...
Output an interval histogram, with the given timestamp and a configurable maxValueUnitRatio. (note that the specified timestamp will be used, and the timestamp in the actual histogram will be ignored). The max value reported with the interval line will be scaled by the given max_...
[ "Output", "an", "interval", "histogram", "with", "the", "given", "timestamp", "and", "a", "configurable", "maxValueUnitRatio", ".", "(", "note", "that", "the", "specified", "timestamp", "will", "be", "used", "and", "the", "timestamp", "in", "the", "actual", "h...
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/log.py#L51-L92
HdrHistogram/HdrHistogram_py
hdrh/log.py
HistogramLogWriter.output_start_time
def output_start_time(self, start_time_msec): '''Log a start time in the log. Params: start_time_msec time (in milliseconds) since the absolute start time (the epoch) ''' self.log.write("#[StartTime: %f (seconds since epoch), %s]\n" % (float(start_time_...
python
def output_start_time(self, start_time_msec): '''Log a start time in the log. Params: start_time_msec time (in milliseconds) since the absolute start time (the epoch) ''' self.log.write("#[StartTime: %f (seconds since epoch), %s]\n" % (float(start_time_...
[ "def", "output_start_time", "(", "self", ",", "start_time_msec", ")", ":", "self", ".", "log", ".", "write", "(", "\"#[StartTime: %f (seconds since epoch), %s]\\n\"", "%", "(", "float", "(", "start_time_msec", ")", "/", "1000.0", ",", "datetime", ".", "fromtimesta...
Log a start time in the log. Params: start_time_msec time (in milliseconds) since the absolute start time (the epoch)
[ "Log", "a", "start", "time", "in", "the", "log", ".", "Params", ":", "start_time_msec", "time", "(", "in", "milliseconds", ")", "since", "the", "absolute", "start", "time", "(", "the", "epoch", ")" ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/log.py#L94-L101
HdrHistogram/HdrHistogram_py
hdrh/log.py
HistogramLogReader._decode_next_interval_histogram
def _decode_next_interval_histogram(self, dest_histogram, range_start_time_sec=0.0, range_end_time_sec=sys.maxsize, absolute=False): '''Read the next in...
python
def _decode_next_interval_histogram(self, dest_histogram, range_start_time_sec=0.0, range_end_time_sec=sys.maxsize, absolute=False): '''Read the next in...
[ "def", "_decode_next_interval_histogram", "(", "self", ",", "dest_histogram", ",", "range_start_time_sec", "=", "0.0", ",", "range_end_time_sec", "=", "sys", ".", "maxsize", ",", "absolute", "=", "False", ")", ":", "while", "1", ":", "line", "=", "self", ".", ...
Read the next interval histogram from the log, if interval falls within an absolute or relative time range. Timestamps are assumed to appear in order in the log file, and as such this method will return a null upon encountering a timestamp larger than range_end_time_sec. Relati...
[ "Read", "the", "next", "interval", "histogram", "from", "the", "log", "if", "interval", "falls", "within", "an", "absolute", "or", "relative", "time", "range", "." ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/log.py#L173-L289
HdrHistogram/HdrHistogram_py
hdrh/log.py
HistogramLogReader.get_next_interval_histogram
def get_next_interval_histogram(self, range_start_time_sec=0.0, range_end_time_sec=sys.maxsize, absolute=False): '''Read the next interval histogram from the log, if interval falls within an absol...
python
def get_next_interval_histogram(self, range_start_time_sec=0.0, range_end_time_sec=sys.maxsize, absolute=False): '''Read the next interval histogram from the log, if interval falls within an absol...
[ "def", "get_next_interval_histogram", "(", "self", ",", "range_start_time_sec", "=", "0.0", ",", "range_end_time_sec", "=", "sys", ".", "maxsize", ",", "absolute", "=", "False", ")", ":", "return", "self", ".", "_decode_next_interval_histogram", "(", "None", ",", ...
Read the next interval histogram from the log, if interval falls within an absolute or relative time range. Timestamps are assumed to appear in order in the log file, and as such this method will return a null upon encountering a timestamp larger than range_end_time_sec. Relati...
[ "Read", "the", "next", "interval", "histogram", "from", "the", "log", "if", "interval", "falls", "within", "an", "absolute", "or", "relative", "time", "range", "." ]
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/log.py#L291-L337
HdrHistogram/HdrHistogram_py
hdrh/log.py
HistogramLogReader.add_next_interval_histogram
def add_next_interval_histogram(self, dest_histogram=None, range_start_time_sec=0.0, range_end_time_sec=sys.maxsize, absolute=False): '''Read the next interval histogra...
python
def add_next_interval_histogram(self, dest_histogram=None, range_start_time_sec=0.0, range_end_time_sec=sys.maxsize, absolute=False): '''Read the next interval histogra...
[ "def", "add_next_interval_histogram", "(", "self", ",", "dest_histogram", "=", "None", ",", "range_start_time_sec", "=", "0.0", ",", "range_end_time_sec", "=", "sys", ".", "maxsize", ",", "absolute", "=", "False", ")", ":", "if", "not", "dest_histogram", ":", ...
Read the next interval histogram from the log, if interval falls within an absolute or relative time range, and add it to the destination histogram (or to the reference histogram if dest_histogram is None) Timestamps are assumed to appear in order in the log file, and as such this metho...
[ "Read", "the", "next", "interval", "histogram", "from", "the", "log", "if", "interval", "falls", "within", "an", "absolute", "or", "relative", "time", "range", "and", "add", "it", "to", "the", "destination", "histogram", "(", "or", "to", "the", "reference", ...
train
https://github.com/HdrHistogram/HdrHistogram_py/blob/cb99981b0564a62e1aa02bd764efa6445923f8f7/hdrh/log.py#L339-L391
ui/django-html_sanitizer
sanitizer/templatetags/sanitizer.py
sanitize
def sanitize(value): ''' Sanitizes strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|escape_html }} ''' if isinstance(value, basestring): value =...
python
def sanitize(value): ''' Sanitizes strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|escape_html }} ''' if isinstance(value, basestring): value =...
[ "def", "sanitize", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "value", "=", "bleach", ".", "clean", "(", "value", ",", "tags", "=", "ALLOWED_TAGS", ",", "attributes", "=", "ALLOWED_ATTRIBUTES", ",", "styles", "...
Sanitizes strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|escape_html }}
[ "Sanitizes", "strings", "according", "to", "SANITIZER_ALLOWED_TAGS", "SANITIZER_ALLOWED_ATTRIBUTES", "and", "SANITIZER_ALLOWED_STYLES", "variables", "in", "settings", "." ]
train
https://github.com/ui/django-html_sanitizer/blob/63311131630471ef2315f1ddbbd18354159d24c1/sanitizer/templatetags/sanitizer.py#L20-L36
ui/django-html_sanitizer
sanitizer/templatetags/sanitizer.py
strip_filter
def strip_filter(value): ''' Strips HTML tags from strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|strip_html }} ''' if isinstance(value, basestring): ...
python
def strip_filter(value): ''' Strips HTML tags from strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|strip_html }} ''' if isinstance(value, basestring): ...
[ "def", "strip_filter", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "value", "=", "bleach", ".", "clean", "(", "value", ",", "tags", "=", "ALLOWED_TAGS", ",", "attributes", "=", "ALLOWED_ATTRIBUTES", ",", "styles",...
Strips HTML tags from strings according to SANITIZER_ALLOWED_TAGS, SANITIZER_ALLOWED_ATTRIBUTES and SANITIZER_ALLOWED_STYLES variables in settings. Example usage: {% load sanitizer %} {{ post.content|strip_html }}
[ "Strips", "HTML", "tags", "from", "strings", "according", "to", "SANITIZER_ALLOWED_TAGS", "SANITIZER_ALLOWED_ATTRIBUTES", "and", "SANITIZER_ALLOWED_STYLES", "variables", "in", "settings", "." ]
train
https://github.com/ui/django-html_sanitizer/blob/63311131630471ef2315f1ddbbd18354159d24c1/sanitizer/templatetags/sanitizer.py#L42-L58
ui/django-html_sanitizer
sanitizer/templatetags/sanitizer.py
sanitize_allow
def sanitize_allow(value, args=''): ''' Strip HTML tags other than provided tags and attributes. Example usage: {% load sanitizer %} {{ post.body|sanitize_allow:'a, strong, img; href, src'}} ''' if isinstance(value, basestring): allowed_tags = [] allowed_attributes = [] ...
python
def sanitize_allow(value, args=''): ''' Strip HTML tags other than provided tags and attributes. Example usage: {% load sanitizer %} {{ post.body|sanitize_allow:'a, strong, img; href, src'}} ''' if isinstance(value, basestring): allowed_tags = [] allowed_attributes = [] ...
[ "def", "sanitize_allow", "(", "value", ",", "args", "=", "''", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "allowed_tags", "=", "[", "]", "allowed_attributes", "=", "[", "]", "allowed_styles", "=", "[", "]", "args", "=", "a...
Strip HTML tags other than provided tags and attributes. Example usage: {% load sanitizer %} {{ post.body|sanitize_allow:'a, strong, img; href, src'}}
[ "Strip", "HTML", "tags", "other", "than", "provided", "tags", "and", "attributes", ".", "Example", "usage", ":" ]
train
https://github.com/ui/django-html_sanitizer/blob/63311131630471ef2315f1ddbbd18354159d24c1/sanitizer/templatetags/sanitizer.py#L64-L85
ui/django-html_sanitizer
sanitizer/templatetags/sanitizer.py
escape_html
def escape_html(value, allowed_tags=[], allowed_attributes=[], allowed_styles=[]): """ Template tag to sanitize string values. It accepts lists of allowed tags, attributes or styles in comma separated string or list format. For example: {% load sanitizer %} {% escape_html '<a h...
python
def escape_html(value, allowed_tags=[], allowed_attributes=[], allowed_styles=[]): """ Template tag to sanitize string values. It accepts lists of allowed tags, attributes or styles in comma separated string or list format. For example: {% load sanitizer %} {% escape_html '<a h...
[ "def", "escape_html", "(", "value", ",", "allowed_tags", "=", "[", "]", ",", "allowed_attributes", "=", "[", "]", ",", "allowed_styles", "=", "[", "]", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "value", "=", "bleach", "."...
Template tag to sanitize string values. It accepts lists of allowed tags, attributes or styles in comma separated string or list format. For example: {% load sanitizer %} {% escape_html '<a href="">bar</a> <script>alert('baz')</script>' "a,img' 'href',src' %} Will output: <a href="">bar</a> ...
[ "Template", "tag", "to", "sanitize", "string", "values", ".", "It", "accepts", "lists", "of", "allowed", "tags", "attributes", "or", "styles", "in", "comma", "separated", "string", "or", "list", "format", "." ]
train
https://github.com/ui/django-html_sanitizer/blob/63311131630471ef2315f1ddbbd18354159d24c1/sanitizer/templatetags/sanitizer.py#L91-L115
ui/django-html_sanitizer
sanitizer/templatetags/sanitizer.py
strip_html
def strip_html(value, allowed_tags=[], allowed_attributes=[], allowed_styles=[]): """ Template tag to strip html from string values. It accepts lists of allowed tags, attributes or stylesin comma separated string or list format. For example: {% load sanitizer %} {% strip_html '<...
python
def strip_html(value, allowed_tags=[], allowed_attributes=[], allowed_styles=[]): """ Template tag to strip html from string values. It accepts lists of allowed tags, attributes or stylesin comma separated string or list format. For example: {% load sanitizer %} {% strip_html '<...
[ "def", "strip_html", "(", "value", ",", "allowed_tags", "=", "[", "]", ",", "allowed_attributes", "=", "[", "]", ",", "allowed_styles", "=", "[", "]", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "value", "=", "bleach", ".",...
Template tag to strip html from string values. It accepts lists of allowed tags, attributes or stylesin comma separated string or list format. For example: {% load sanitizer %} {% strip_html '<a href="">bar</a> <script>alert('baz')</script>' "a,img' 'href',src' %} Will output: <a href="">bar...
[ "Template", "tag", "to", "strip", "html", "from", "string", "values", ".", "It", "accepts", "lists", "of", "allowed", "tags", "attributes", "or", "stylesin", "comma", "separated", "string", "or", "list", "format", "." ]
train
https://github.com/ui/django-html_sanitizer/blob/63311131630471ef2315f1ddbbd18354159d24c1/sanitizer/templatetags/sanitizer.py#L119-L143
ben174/profanity
profanity/profanity.py
get_censor_char
def get_censor_char(): """Plucks a letter out of the censor_pool. If the censor_pool is empty, replenishes it. This is done to ensure all censor chars are used before grabbing more (avoids ugly duplicates). """ global _censor_pool if not _censor_pool: # censor pool is empty. fill it bac...
python
def get_censor_char(): """Plucks a letter out of the censor_pool. If the censor_pool is empty, replenishes it. This is done to ensure all censor chars are used before grabbing more (avoids ugly duplicates). """ global _censor_pool if not _censor_pool: # censor pool is empty. fill it bac...
[ "def", "get_censor_char", "(", ")", ":", "global", "_censor_pool", "if", "not", "_censor_pool", ":", "# censor pool is empty. fill it back up.", "_censor_pool", "=", "list", "(", "_censor_chars", ")", "return", "_censor_pool", ".", "pop", "(", "random", ".", "randra...
Plucks a letter out of the censor_pool. If the censor_pool is empty, replenishes it. This is done to ensure all censor chars are used before grabbing more (avoids ugly duplicates).
[ "Plucks", "a", "letter", "out", "of", "the", "censor_pool", ".", "If", "the", "censor_pool", "is", "empty", "replenishes", "it", ".", "This", "is", "done", "to", "ensure", "all", "censor", "chars", "are", "used", "before", "grabbing", "more", "(", "avoids"...
train
https://github.com/ben174/profanity/blob/98e76d189f4b31848dcc129845bb359b47516c98/profanity/profanity.py#L27-L37
ben174/profanity
profanity/profanity.py
censor
def censor(input_text): """ Returns the input string with profanity replaced with a random string of characters plucked from the censor_characters pool. """ ret = input_text words = get_words() for word in words: curse_word = re.compile(re.escape(word), re.IGNORECASE) cen = "".j...
python
def censor(input_text): """ Returns the input string with profanity replaced with a random string of characters plucked from the censor_characters pool. """ ret = input_text words = get_words() for word in words: curse_word = re.compile(re.escape(word), re.IGNORECASE) cen = "".j...
[ "def", "censor", "(", "input_text", ")", ":", "ret", "=", "input_text", "words", "=", "get_words", "(", ")", "for", "word", "in", "words", ":", "curse_word", "=", "re", ".", "compile", "(", "re", ".", "escape", "(", "word", ")", ",", "re", ".", "IG...
Returns the input string with profanity replaced with a random string of characters plucked from the censor_characters pool.
[ "Returns", "the", "input", "string", "with", "profanity", "replaced", "with", "a", "random", "string", "of", "characters", "plucked", "from", "the", "censor_characters", "pool", "." ]
train
https://github.com/ben174/profanity/blob/98e76d189f4b31848dcc129845bb359b47516c98/profanity/profanity.py#L57-L68
ben174/profanity
profanity/profanity.py
load_words
def load_words(wordlist=None): """ Loads and caches the profanity word list. Input file (if provided) should be a flat text file with one profanity entry per line. """ global words if not wordlist: # no wordlist was provided, load the wordlist from the local store filename = get_dat...
python
def load_words(wordlist=None): """ Loads and caches the profanity word list. Input file (if provided) should be a flat text file with one profanity entry per line. """ global words if not wordlist: # no wordlist was provided, load the wordlist from the local store filename = get_dat...
[ "def", "load_words", "(", "wordlist", "=", "None", ")", ":", "global", "words", "if", "not", "wordlist", ":", "# no wordlist was provided, load the wordlist from the local store", "filename", "=", "get_data", "(", "'wordlist.txt'", ")", "f", "=", "open", "(", "filen...
Loads and caches the profanity word list. Input file (if provided) should be a flat text file with one profanity entry per line.
[ "Loads", "and", "caches", "the", "profanity", "word", "list", ".", "Input", "file", "(", "if", "provided", ")", "should", "be", "a", "flat", "text", "file", "with", "one", "profanity", "entry", "per", "line", "." ]
train
https://github.com/ben174/profanity/blob/98e76d189f4b31848dcc129845bb359b47516c98/profanity/profanity.py#L71-L83
oplatek/csv2json
csv2json/__init__.py
convert
def convert(csv, json, **kwargs): '''Convert csv to json. csv: filename or file-like object json: filename or file-like object if csv is '-' or None: stdin is used for input if json is '-' or None: stdout is used for output ''' csv_local, json_local = None, None try...
python
def convert(csv, json, **kwargs): '''Convert csv to json. csv: filename or file-like object json: filename or file-like object if csv is '-' or None: stdin is used for input if json is '-' or None: stdout is used for output ''' csv_local, json_local = None, None try...
[ "def", "convert", "(", "csv", ",", "json", ",", "*", "*", "kwargs", ")", ":", "csv_local", ",", "json_local", "=", "None", ",", "None", "try", ":", "if", "csv", "==", "'-'", "or", "csv", "is", "None", ":", "csv", "=", "sys", ".", "stdin", "elif",...
Convert csv to json. csv: filename or file-like object json: filename or file-like object if csv is '-' or None: stdin is used for input if json is '-' or None: stdout is used for output
[ "Convert", "csv", "to", "json", "." ]
train
https://github.com/oplatek/csv2json/blob/f2f95db71ba2ce683fd6d0d3e2f13c9d0a77ceb6/csv2json/__init__.py#L20-L51
CyberZHG/keras-word-char-embd
keras_wc_embd/wrapper.py
WordCharEmbd.update_dicts
def update_dicts(self, sentence): """Add new sentence to generate dictionaries. :param sentence: A list of strings representing the sentence. """ self.dict_generator(sentence=sentence) self.word_dict, self.char_dict = None, None
python
def update_dicts(self, sentence): """Add new sentence to generate dictionaries. :param sentence: A list of strings representing the sentence. """ self.dict_generator(sentence=sentence) self.word_dict, self.char_dict = None, None
[ "def", "update_dicts", "(", "self", ",", "sentence", ")", ":", "self", ".", "dict_generator", "(", "sentence", "=", "sentence", ")", "self", ".", "word_dict", ",", "self", ".", "char_dict", "=", "None", ",", "None" ]
Add new sentence to generate dictionaries. :param sentence: A list of strings representing the sentence.
[ "Add", "new", "sentence", "to", "generate", "dictionaries", "." ]
train
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/wrapper.py#L30-L36
CyberZHG/keras-word-char-embd
keras_wc_embd/wrapper.py
WordCharEmbd.set_dicts
def set_dicts(self, word_dict, char_dict): """Set with custom dictionaries. :param word_dict: The word dictionary. :param char_dict: The character dictionary. """ self.word_dict = word_dict self.char_dict = char_dict
python
def set_dicts(self, word_dict, char_dict): """Set with custom dictionaries. :param word_dict: The word dictionary. :param char_dict: The character dictionary. """ self.word_dict = word_dict self.char_dict = char_dict
[ "def", "set_dicts", "(", "self", ",", "word_dict", ",", "char_dict", ")", ":", "self", ".", "word_dict", "=", "word_dict", "self", ".", "char_dict", "=", "char_dict" ]
Set with custom dictionaries. :param word_dict: The word dictionary. :param char_dict: The character dictionary.
[ "Set", "with", "custom", "dictionaries", "." ]
train
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/wrapper.py#L38-L45
CyberZHG/keras-word-char-embd
keras_wc_embd/wrapper.py
WordCharEmbd.get_dicts
def get_dicts(self): """Get word and character dictionaries. :return word_dict, char_dict: """ if self.word_dict is None: self.word_dict, self.char_dict, self.max_word_len = self.dict_generator(return_dict=True) return self.word_dict, self.char_dict
python
def get_dicts(self): """Get word and character dictionaries. :return word_dict, char_dict: """ if self.word_dict is None: self.word_dict, self.char_dict, self.max_word_len = self.dict_generator(return_dict=True) return self.word_dict, self.char_dict
[ "def", "get_dicts", "(", "self", ")", ":", "if", "self", ".", "word_dict", "is", "None", ":", "self", ".", "word_dict", ",", "self", ".", "char_dict", ",", "self", ".", "max_word_len", "=", "self", ".", "dict_generator", "(", "return_dict", "=", "True", ...
Get word and character dictionaries. :return word_dict, char_dict:
[ "Get", "word", "and", "character", "dictionaries", "." ]
train
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/wrapper.py#L47-L54
CyberZHG/keras-word-char-embd
keras_wc_embd/wrapper.py
WordCharEmbd.get_embedding_layer
def get_embedding_layer(self, word_embd_dim=300, char_embd_dim=30, char_hidden_dim=150, char_hidden_layer_type='lstm', word_embd_weights=None, word_embd...
python
def get_embedding_layer(self, word_embd_dim=300, char_embd_dim=30, char_hidden_dim=150, char_hidden_layer_type='lstm', word_embd_weights=None, word_embd...
[ "def", "get_embedding_layer", "(", "self", ",", "word_embd_dim", "=", "300", ",", "char_embd_dim", "=", "30", ",", "char_hidden_dim", "=", "150", ",", "char_hidden_layer_type", "=", "'lstm'", ",", "word_embd_weights", "=", "None", ",", "word_embd_file_path", "=", ...
Get the merged embedding layer. :param word_embd_dim: The dimensions of the word embedding. :param char_embd_dim: The dimensions of the character embedding :param char_hidden_dim: The dimensions of the hidden states of RNN in one direction. :param word_embd_weights: A numpy array repres...
[ "Get", "the", "merged", "embedding", "layer", "." ]
train
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/wrapper.py#L72-L122
CyberZHG/keras-word-char-embd
keras_wc_embd/wrapper.py
WordCharEmbd.get_batch_input
def get_batch_input(self, sentences): """Convert sentences to desired input tensors. :param sentences: A list of lists representing the input sentences. :return word_embd_input, char_embd_input: The desired inputs. """ return get_batch_input(sentences, ...
python
def get_batch_input(self, sentences): """Convert sentences to desired input tensors. :param sentences: A list of lists representing the input sentences. :return word_embd_input, char_embd_input: The desired inputs. """ return get_batch_input(sentences, ...
[ "def", "get_batch_input", "(", "self", ",", "sentences", ")", ":", "return", "get_batch_input", "(", "sentences", ",", "max_word_len", "=", "self", ".", "max_word_len", ",", "word_dict", "=", "self", ".", "get_word_dict", "(", ")", ",", "char_dict", "=", "se...
Convert sentences to desired input tensors. :param sentences: A list of lists representing the input sentences. :return word_embd_input, char_embd_input: The desired inputs.
[ "Convert", "sentences", "to", "desired", "input", "tensors", "." ]
train
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/wrapper.py#L124-L136
CyberZHG/keras-word-char-embd
keras_wc_embd/word_char_embd.py
get_batch_input
def get_batch_input(sentences, max_word_len, word_dict, char_dict, word_unknown=1, char_unknown=1, word_ignore_case=False, char_ignore_case=False): """Convert sentences to desi...
python
def get_batch_input(sentences, max_word_len, word_dict, char_dict, word_unknown=1, char_unknown=1, word_ignore_case=False, char_ignore_case=False): """Convert sentences to desi...
[ "def", "get_batch_input", "(", "sentences", ",", "max_word_len", ",", "word_dict", ",", "char_dict", ",", "word_unknown", "=", "1", ",", "char_unknown", "=", "1", ",", "word_ignore_case", "=", "False", ",", "char_ignore_case", "=", "False", ")", ":", "sentence...
Convert sentences to desired input tensors. :param sentences: A list of lists representing the input sentences. :param max_word_len: The maximum allowed length of word. :param word_dict: Map a word to an integer. (0 and 1 should be preserved) :param char_dict: Map a character to an integer. (0 and 1 sh...
[ "Convert", "sentences", "to", "desired", "input", "tensors", "." ]
train
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/word_char_embd.py#L39-L81
CyberZHG/keras-word-char-embd
keras_wc_embd/word_char_embd.py
get_embedding_layer
def get_embedding_layer(word_dict_len, char_dict_len, max_word_len, word_embd_dim=300, char_embd_dim=30, char_hidden_dim=150, char_hidden_layer_type='lstm', ...
python
def get_embedding_layer(word_dict_len, char_dict_len, max_word_len, word_embd_dim=300, char_embd_dim=30, char_hidden_dim=150, char_hidden_layer_type='lstm', ...
[ "def", "get_embedding_layer", "(", "word_dict_len", ",", "char_dict_len", ",", "max_word_len", ",", "word_embd_dim", "=", "300", ",", "char_embd_dim", "=", "30", ",", "char_hidden_dim", "=", "150", ",", "char_hidden_layer_type", "=", "'lstm'", ",", "word_embd_weight...
Get the merged embedding layer. :param word_dict_len: The number of words in the dictionary including the ones mapped to 0 or 1. :param char_dict_len: The number of characters in the dictionary including the ones mapped to 0 or 1. :param max_word_len: The maximum allowed length of word. :param word_emb...
[ "Get", "the", "merged", "embedding", "layer", "." ]
train
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/word_char_embd.py#L84-L198
CyberZHG/keras-word-char-embd
keras_wc_embd/word_char_embd.py
get_dicts_generator
def get_dicts_generator(word_min_freq=4, char_min_freq=2, word_ignore_case=False, char_ignore_case=False): """Get word and character dictionaries from sentences. :param word_min_freq: The minimum frequency of a word. :param char_min_fr...
python
def get_dicts_generator(word_min_freq=4, char_min_freq=2, word_ignore_case=False, char_ignore_case=False): """Get word and character dictionaries from sentences. :param word_min_freq: The minimum frequency of a word. :param char_min_fr...
[ "def", "get_dicts_generator", "(", "word_min_freq", "=", "4", ",", "char_min_freq", "=", "2", ",", "word_ignore_case", "=", "False", ",", "char_ignore_case", "=", "False", ")", ":", "word_count", ",", "char_count", "=", "{", "}", ",", "{", "}", "def", "get...
Get word and character dictionaries from sentences. :param word_min_freq: The minimum frequency of a word. :param char_min_freq: The minimum frequency of a character. :param word_ignore_case: Word will be transformed to lower case before saving to dictionary. :param char_ignore_case: Character will be ...
[ "Get", "word", "and", "character", "dictionaries", "from", "sentences", "." ]
train
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/word_char_embd.py#L201-L251
CyberZHG/keras-word-char-embd
keras_wc_embd/word_char_embd.py
get_word_list_eng
def get_word_list_eng(text): """A naive function that extracts English words from raw texts. :param text: The raw text. :return words: A list of strings. """ words, index = [''], 0 while index < len(text): while index < len(text) and ('a' <= text[index] <= 'z' or 'A' <= text[index] <= '...
python
def get_word_list_eng(text): """A naive function that extracts English words from raw texts. :param text: The raw text. :return words: A list of strings. """ words, index = [''], 0 while index < len(text): while index < len(text) and ('a' <= text[index] <= 'z' or 'A' <= text[index] <= '...
[ "def", "get_word_list_eng", "(", "text", ")", ":", "words", ",", "index", "=", "[", "''", "]", ",", "0", "while", "index", "<", "len", "(", "text", ")", ":", "while", "index", "<", "len", "(", "text", ")", "and", "(", "'a'", "<=", "text", "[", ...
A naive function that extracts English words from raw texts. :param text: The raw text. :return words: A list of strings.
[ "A", "naive", "function", "that", "extracts", "English", "words", "from", "raw", "texts", "." ]
train
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/word_char_embd.py#L254-L275
CyberZHG/keras-word-char-embd
keras_wc_embd/word_char_embd.py
get_embedding_weights_from_file
def get_embedding_weights_from_file(word_dict, file_path, ignore_case=False): """Load pre-trained embeddings from a text file. Each line in the file should look like this: word feature_dim_1 feature_dim_2 ... feature_dim_n The `feature_dim_i` should be a floating point number. :param word_dic...
python
def get_embedding_weights_from_file(word_dict, file_path, ignore_case=False): """Load pre-trained embeddings from a text file. Each line in the file should look like this: word feature_dim_1 feature_dim_2 ... feature_dim_n The `feature_dim_i` should be a floating point number. :param word_dic...
[ "def", "get_embedding_weights_from_file", "(", "word_dict", ",", "file_path", ",", "ignore_case", "=", "False", ")", ":", "pre_trained", "=", "{", "}", "with", "codecs", ".", "open", "(", "file_path", ",", "'r'", ",", "'utf8'", ")", "as", "reader", ":", "f...
Load pre-trained embeddings from a text file. Each line in the file should look like this: word feature_dim_1 feature_dim_2 ... feature_dim_n The `feature_dim_i` should be a floating point number. :param word_dict: A dict that maps words to indice. :param file_path: The location of the text f...
[ "Load", "pre", "-", "trained", "embeddings", "from", "a", "text", "file", "." ]
train
https://github.com/CyberZHG/keras-word-char-embd/blob/cca6ddff01b6264dd0d12613bb9ed308e1367b8c/keras_wc_embd/word_char_embd.py#L278-L313
pygobject/pgi
pgi/codegen/backend.py
init_backends
def init_backends(): """Loads all backends""" global _BACKENDS, _ACTIVE_BACKENDS try: from .cffi_backend import CFFIBackend except ImportError: pass else: _BACKENDS.append(CFFIBackend) from .ctypes_backend import CTypesBackend from .null_backend import NullBackend ...
python
def init_backends(): """Loads all backends""" global _BACKENDS, _ACTIVE_BACKENDS try: from .cffi_backend import CFFIBackend except ImportError: pass else: _BACKENDS.append(CFFIBackend) from .ctypes_backend import CTypesBackend from .null_backend import NullBackend ...
[ "def", "init_backends", "(", ")", ":", "global", "_BACKENDS", ",", "_ACTIVE_BACKENDS", "try", ":", "from", ".", "cffi_backend", "import", "CFFIBackend", "except", "ImportError", ":", "pass", "else", ":", "_BACKENDS", ".", "append", "(", "CFFIBackend", ")", "fr...
Loads all backends
[ "Loads", "all", "backends" ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/codegen/backend.py#L12-L30
pygobject/pgi
pgi/codegen/backend.py
get_backend
def get_backend(name): """Returns the backend by name or raises KeyError""" for backend in _BACKENDS: if backend.NAME == name: return backend raise KeyError("Backend %r not available" % name)
python
def get_backend(name): """Returns the backend by name or raises KeyError""" for backend in _BACKENDS: if backend.NAME == name: return backend raise KeyError("Backend %r not available" % name)
[ "def", "get_backend", "(", "name", ")", ":", "for", "backend", "in", "_BACKENDS", ":", "if", "backend", ".", "NAME", "==", "name", ":", "return", "backend", "raise", "KeyError", "(", "\"Backend %r not available\"", "%", "name", ")" ]
Returns the backend by name or raises KeyError
[ "Returns", "the", "backend", "by", "name", "or", "raises", "KeyError" ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/codegen/backend.py#L39-L45
pygobject/pgi
pgi/codegen/backend.py
set_backend
def set_backend(name=None): """Set a prefered ffi backend (cffi, ctypes). set_backend() -- default set_backend("cffi") -- cffi first, others as fallback set_backend("ctypes") -- ctypes first, others as fallback """ possible = list(_BACKENDS) if name is None: names = [] else: ...
python
def set_backend(name=None): """Set a prefered ffi backend (cffi, ctypes). set_backend() -- default set_backend("cffi") -- cffi first, others as fallback set_backend("ctypes") -- ctypes first, others as fallback """ possible = list(_BACKENDS) if name is None: names = [] else: ...
[ "def", "set_backend", "(", "name", "=", "None", ")", ":", "possible", "=", "list", "(", "_BACKENDS", ")", "if", "name", "is", "None", ":", "names", "=", "[", "]", "else", ":", "names", "=", "name", ".", "split", "(", "\",\"", ")", "for", "name", ...
Set a prefered ffi backend (cffi, ctypes). set_backend() -- default set_backend("cffi") -- cffi first, others as fallback set_backend("ctypes") -- ctypes first, others as fallback
[ "Set", "a", "prefered", "ffi", "backend", "(", "cffi", "ctypes", ")", "." ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/codegen/backend.py#L48-L75
pygobject/pgi
pgi/debug.py
pprint
def pprint(obj, file_=None): """Prints debug information for various public objects like methods, functions, constructors etc. """ if file_ is None: file_ = sys.stdout # functions, methods if callable(obj) and hasattr(obj, "_code"): obj._code.pprint(file_) return #...
python
def pprint(obj, file_=None): """Prints debug information for various public objects like methods, functions, constructors etc. """ if file_ is None: file_ = sys.stdout # functions, methods if callable(obj) and hasattr(obj, "_code"): obj._code.pprint(file_) return #...
[ "def", "pprint", "(", "obj", ",", "file_", "=", "None", ")", ":", "if", "file_", "is", "None", ":", "file_", "=", "sys", ".", "stdout", "# functions, methods", "if", "callable", "(", "obj", ")", "and", "hasattr", "(", "obj", ",", "\"_code\"", ")", ":...
Prints debug information for various public objects like methods, functions, constructors etc.
[ "Prints", "debug", "information", "for", "various", "public", "objects", "like", "methods", "functions", "constructors", "etc", "." ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/debug.py#L11-L31
pygobject/pgi
pgi/codegen/fieldgen.py
get_field_type
def get_field_type(info): """A field python type""" type_ = info.get_type() cls = get_field_class(type_) field = cls(info, type_, None) field.setup() return field.py_type
python
def get_field_type(info): """A field python type""" type_ = info.get_type() cls = get_field_class(type_) field = cls(info, type_, None) field.setup() return field.py_type
[ "def", "get_field_type", "(", "info", ")", ":", "type_", "=", "info", ".", "get_type", "(", ")", "cls", "=", "get_field_class", "(", "type_", ")", "field", "=", "cls", "(", "info", ",", "type_", ",", "None", ")", "field", ".", "setup", "(", ")", "r...
A field python type
[ "A", "field", "python", "type" ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/codegen/fieldgen.py#L105-L114
pygobject/pgi
pgi/overrides/Gdk.py
Color.from_floats
def from_floats(red, green, blue): """Return a new Color object from red/green/blue values from 0.0 to 1.0.""" return Color(int(red * Color.MAX_VALUE), int(green * Color.MAX_VALUE), int(blue * Color.MAX_VALUE))
python
def from_floats(red, green, blue): """Return a new Color object from red/green/blue values from 0.0 to 1.0.""" return Color(int(red * Color.MAX_VALUE), int(green * Color.MAX_VALUE), int(blue * Color.MAX_VALUE))
[ "def", "from_floats", "(", "red", ",", "green", ",", "blue", ")", ":", "return", "Color", "(", "int", "(", "red", "*", "Color", ".", "MAX_VALUE", ")", ",", "int", "(", "green", "*", "Color", ".", "MAX_VALUE", ")", ",", "int", "(", "blue", "*", "C...
Return a new Color object from red/green/blue values from 0.0 to 1.0.
[ "Return", "a", "new", "Color", "object", "from", "red", "/", "green", "/", "blue", "values", "from", "0", ".", "0", "to", "1", ".", "0", "." ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gdk.py#L74-L79
pygobject/pgi
pgi/overrides/Gtk.py
_construct_target_list
def _construct_target_list(targets): """Create a list of TargetEntry items from a list of tuples in the form (target, flags, info) The list can also contain existing TargetEntry items in which case the existing entry is re-used in the return list. """ target_entries = [] for entry in targets: ...
python
def _construct_target_list(targets): """Create a list of TargetEntry items from a list of tuples in the form (target, flags, info) The list can also contain existing TargetEntry items in which case the existing entry is re-used in the return list. """ target_entries = [] for entry in targets: ...
[ "def", "_construct_target_list", "(", "targets", ")", ":", "target_entries", "=", "[", "]", "for", "entry", "in", "targets", ":", "if", "not", "isinstance", "(", "entry", ",", "Gtk", ".", "TargetEntry", ")", ":", "entry", "=", "Gtk", ".", "TargetEntry", ...
Create a list of TargetEntry items from a list of tuples in the form (target, flags, info) The list can also contain existing TargetEntry items in which case the existing entry is re-used in the return list.
[ "Create", "a", "list", "of", "TargetEntry", "items", "from", "a", "list", "of", "tuples", "in", "the", "form", "(", "target", "flags", "info", ")" ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L59-L70
pygobject/pgi
pgi/overrides/Gtk.py
Widget.style_get_property
def style_get_property(self, property_name, value=None): """style_get_property(property_name, value=None) :param property_name: the name of a style property :type property_name: :obj:`str` :param value: Either :obj:`None` or a correctly initialized :obj:`GObject...
python
def style_get_property(self, property_name, value=None): """style_get_property(property_name, value=None) :param property_name: the name of a style property :type property_name: :obj:`str` :param value: Either :obj:`None` or a correctly initialized :obj:`GObject...
[ "def", "style_get_property", "(", "self", ",", "property_name", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "prop", "=", "self", ".", "find_style_property", "(", "property_name", ")", "if", "prop", "is", "None", ":", "raise", "...
style_get_property(property_name, value=None) :param property_name: the name of a style property :type property_name: :obj:`str` :param value: Either :obj:`None` or a correctly initialized :obj:`GObject.Value` :type value: :obj:`GObject.Value` or :obj:`None` ...
[ "style_get_property", "(", "property_name", "value", "=", "None", ")" ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L147-L171
pygobject/pgi
pgi/overrides/Gtk.py
Container.child_get_property
def child_get_property(self, child, property_name, value=None): """child_get_property(child, property_name, value=None) :param child: a widget which is a child of `self` :type child: :obj:`Gtk.Widget` :param property_name: the name of the property to get ...
python
def child_get_property(self, child, property_name, value=None): """child_get_property(child, property_name, value=None) :param child: a widget which is a child of `self` :type child: :obj:`Gtk.Widget` :param property_name: the name of the property to get ...
[ "def", "child_get_property", "(", "self", ",", "child", ",", "property_name", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "prop", "=", "self", ".", "find_child_property", "(", "property_name", ")", "if", "prop", "is", "None", "...
child_get_property(child, property_name, value=None) :param child: a widget which is a child of `self` :type child: :obj:`Gtk.Widget` :param property_name: the name of the property to get :type property_name: :obj:`str` :param value: Either ...
[ "child_get_property", "(", "child", "property_name", "value", "=", "None", ")" ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L208-L236
pygobject/pgi
pgi/overrides/Gtk.py
Container.child_get
def child_get(self, child, *prop_names): """Returns a list of child property values for the given names.""" return [self.child_get_property(child, name) for name in prop_names]
python
def child_get(self, child, *prop_names): """Returns a list of child property values for the given names.""" return [self.child_get_property(child, name) for name in prop_names]
[ "def", "child_get", "(", "self", ",", "child", ",", "*", "prop_names", ")", ":", "return", "[", "self", ".", "child_get_property", "(", "child", ",", "name", ")", "for", "name", "in", "prop_names", "]" ]
Returns a list of child property values for the given names.
[ "Returns", "a", "list", "of", "child", "property", "values", "for", "the", "given", "names", "." ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L238-L241
pygobject/pgi
pgi/overrides/Gtk.py
Container.child_set
def child_set(self, child, **kwargs): """Set a child properties on the given child to key/value pairs.""" for name, value in kwargs.items(): name = name.replace('_', '-') self.child_set_property(child, name, value)
python
def child_set(self, child, **kwargs): """Set a child properties on the given child to key/value pairs.""" for name, value in kwargs.items(): name = name.replace('_', '-') self.child_set_property(child, name, value)
[ "def", "child_set", "(", "self", ",", "child", ",", "*", "*", "kwargs", ")", ":", "for", "name", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "name", "=", "name", ".", "replace", "(", "'_'", ",", "'-'", ")", "self", ".", "child_set_...
Set a child properties on the given child to key/value pairs.
[ "Set", "a", "child", "properties", "on", "the", "given", "child", "to", "key", "/", "value", "pairs", "." ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L243-L248
pygobject/pgi
pgi/overrides/Gtk.py
Editable.insert_text
def insert_text(self, text, position): """insert_text(self, text, position) :param new_text: the text to append :type new_text: :obj:`str` :param position: location of the position text will be inserted at :type position: :obj:`int` :returns: ...
python
def insert_text(self, text, position): """insert_text(self, text, position) :param new_text: the text to append :type new_text: :obj:`str` :param position: location of the position text will be inserted at :type position: :obj:`int` :returns: ...
[ "def", "insert_text", "(", "self", ",", "text", ",", "position", ")", ":", "return", "super", "(", "Editable", ",", "self", ")", ".", "insert_text", "(", "text", ",", "-", "1", ",", "position", ")" ]
insert_text(self, text, position) :param new_text: the text to append :type new_text: :obj:`str` :param position: location of the position text will be inserted at :type position: :obj:`int` :returns: location of the position text will be in...
[ "insert_text", "(", "self", "text", "position", ")" ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L257-L278
pygobject/pgi
pgi/overrides/Gtk.py
ActionGroup.add_actions
def add_actions(self, entries, user_data=None): """ The add_actions() method is a convenience method that creates a number of gtk.Action objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples c...
python
def add_actions(self, entries, user_data=None): """ The add_actions() method is a convenience method that creates a number of gtk.Action objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples c...
[ "def", "add_actions", "(", "self", ",", "entries", ",", "user_data", "=", "None", ")", ":", "try", ":", "iter", "(", "entries", ")", "except", "(", "TypeError", ")", ":", "raise", "TypeError", "(", "'entries must be iterable'", ")", "def", "_process_action",...
The add_actions() method is a convenience method that creates a number of gtk.Action objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples can vary in size from one to six items with the following inf...
[ "The", "add_actions", "()", "method", "is", "a", "convenience", "method", "that", "creates", "a", "number", "of", "gtk", ".", "Action", "objects", "based", "on", "the", "information", "in", "the", "list", "of", "action", "entry", "tuples", "contained", "in",...
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L325-L368
pygobject/pgi
pgi/overrides/Gtk.py
ActionGroup.add_toggle_actions
def add_toggle_actions(self, entries, user_data=None): """ The add_toggle_actions() method is a convenience method that creates a number of gtk.ToggleAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group....
python
def add_toggle_actions(self, entries, user_data=None): """ The add_toggle_actions() method is a convenience method that creates a number of gtk.ToggleAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group....
[ "def", "add_toggle_actions", "(", "self", ",", "entries", ",", "user_data", "=", "None", ")", ":", "try", ":", "iter", "(", "entries", ")", "except", "(", "TypeError", ")", ":", "raise", "TypeError", "(", "'entries must be iterable'", ")", "def", "_process_a...
The add_toggle_actions() method is a convenience method that creates a number of gtk.ToggleAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The toggle action entry tuples can vary in size from one to seven ...
[ "The", "add_toggle_actions", "()", "method", "is", "a", "convenience", "method", "that", "creates", "a", "number", "of", "gtk", ".", "ToggleAction", "objects", "based", "on", "the", "information", "in", "the", "list", "of", "action", "entry", "tuples", "contai...
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L370-L417
pygobject/pgi
pgi/overrides/Gtk.py
ActionGroup.add_radio_actions
def add_radio_actions(self, entries, value=None, on_change=None, user_data=None): """ The add_radio_actions() method is a convenience method that creates a number of gtk.RadioAction objects based on the information in the list of action entry tuples contained in entries and adds them to ...
python
def add_radio_actions(self, entries, value=None, on_change=None, user_data=None): """ The add_radio_actions() method is a convenience method that creates a number of gtk.RadioAction objects based on the information in the list of action entry tuples contained in entries and adds them to ...
[ "def", "add_radio_actions", "(", "self", ",", "entries", ",", "value", "=", "None", ",", "on_change", "=", "None", ",", "user_data", "=", "None", ")", ":", "try", ":", "iter", "(", "entries", ")", "except", "(", "TypeError", ")", ":", "raise", "TypeErr...
The add_radio_actions() method is a convenience method that creates a number of gtk.RadioAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples can vary in size from one to six items with the fol...
[ "The", "add_radio_actions", "()", "method", "is", "a", "convenience", "method", "that", "creates", "a", "number", "of", "gtk", ".", "RadioAction", "objects", "based", "on", "the", "information", "in", "the", "list", "of", "action", "entry", "tuples", "containe...
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L419-L481
pygobject/pgi
pgi/overrides/Gtk.py
UIManager.add_ui_from_string
def add_ui_from_string(self, buffer, length=-1): """add_ui_from_string(buffer, length=-1) {{ all }} """ return Gtk.UIManager.add_ui_from_string(self, buffer, length)
python
def add_ui_from_string(self, buffer, length=-1): """add_ui_from_string(buffer, length=-1) {{ all }} """ return Gtk.UIManager.add_ui_from_string(self, buffer, length)
[ "def", "add_ui_from_string", "(", "self", ",", "buffer", ",", "length", "=", "-", "1", ")", ":", "return", "Gtk", ".", "UIManager", ".", "add_ui_from_string", "(", "self", ",", "buffer", ",", "length", ")" ]
add_ui_from_string(buffer, length=-1) {{ all }}
[ "add_ui_from_string", "(", "buffer", "length", "=", "-", "1", ")" ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L488-L494
pygobject/pgi
pgi/overrides/Gtk.py
Builder.add_from_string
def add_from_string(self, buffer, length=-1): """add_from_string(buffer, length=-1) {{ all }} """ return Gtk.Builder.add_from_string(self, buffer, length)
python
def add_from_string(self, buffer, length=-1): """add_from_string(buffer, length=-1) {{ all }} """ return Gtk.Builder.add_from_string(self, buffer, length)
[ "def", "add_from_string", "(", "self", ",", "buffer", ",", "length", "=", "-", "1", ")", ":", "return", "Gtk", ".", "Builder", ".", "add_from_string", "(", "self", ",", "buffer", ",", "length", ")" ]
add_from_string(buffer, length=-1) {{ all }}
[ "add_from_string", "(", "buffer", "length", "=", "-", "1", ")" ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L561-L567
pygobject/pgi
pgi/overrides/Gtk.py
Builder.add_objects_from_string
def add_objects_from_string(self, buffer, object_ids): """add_objects_from_string(buffer, object_ids) :param buffer: the string to parse :type buffer: :obj:`str` :param object_ids: array of objects to build :type object_ids: [:obj:`str`] :raises: :class:`GLib.Error` ...
python
def add_objects_from_string(self, buffer, object_ids): """add_objects_from_string(buffer, object_ids) :param buffer: the string to parse :type buffer: :obj:`str` :param object_ids: array of objects to build :type object_ids: [:obj:`str`] :raises: :class:`GLib.Error` ...
[ "def", "add_objects_from_string", "(", "self", ",", "buffer", ",", "object_ids", ")", ":", "length", "=", "-", "1", "return", "Gtk", ".", "Builder", ".", "add_objects_from_string", "(", "self", ",", "buffer", ",", "length", ",", "object_ids", ")" ]
add_objects_from_string(buffer, object_ids) :param buffer: the string to parse :type buffer: :obj:`str` :param object_ids: array of objects to build :type object_ids: [:obj:`str`] :raises: :class:`GLib.Error` :returns: A positive value on success, 0 if an error occurre...
[ "add_objects_from_string", "(", "buffer", "object_ids", ")" ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L569-L586
pygobject/pgi
pgi/overrides/Gtk.py
Dialog.add_buttons
def add_buttons(self, *args): """add_buttons(*args) The add_buttons() method adds several buttons to the Gtk.Dialog using the button data passed as arguments to the method. This method is the same as calling the Gtk.Dialog.add_button() repeatedly. The button data pairs - button ...
python
def add_buttons(self, *args): """add_buttons(*args) The add_buttons() method adds several buttons to the Gtk.Dialog using the button data passed as arguments to the method. This method is the same as calling the Gtk.Dialog.add_button() repeatedly. The button data pairs - button ...
[ "def", "add_buttons", "(", "self", ",", "*", "args", ")", ":", "def", "_button", "(", "b", ")", ":", "while", "b", ":", "t", ",", "r", "=", "b", "[", "0", ":", "2", "]", "b", "=", "b", "[", "2", ":", "]", "yield", "t", ",", "r", "try", ...
add_buttons(*args) The add_buttons() method adds several buttons to the Gtk.Dialog using the button data passed as arguments to the method. This method is the same as calling the Gtk.Dialog.add_button() repeatedly. The button data pairs - button text (or stock ID) and a response ID inte...
[ "add_buttons", "(", "*", "args", ")" ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L661-L686
pygobject/pgi
pgi/overrides/Gtk.py
TextBuffer.create_tag
def create_tag(self, tag_name=None, **properties): """Creates a tag and adds it to the tag table of the TextBuffer. :param str tag_name: Name of the new tag, or None :param **properties: Keyword list of properties and their values :returns: A new tag....
python
def create_tag(self, tag_name=None, **properties): """Creates a tag and adds it to the tag table of the TextBuffer. :param str tag_name: Name of the new tag, or None :param **properties: Keyword list of properties and their values :returns: A new tag....
[ "def", "create_tag", "(", "self", ",", "tag_name", "=", "None", ",", "*", "*", "properties", ")", ":", "tag", "=", "Gtk", ".", "TextTag", "(", "name", "=", "tag_name", ",", "*", "*", "properties", ")", "self", ".", "_get_or_create_tag_table", "(", ")",...
Creates a tag and adds it to the tag table of the TextBuffer. :param str tag_name: Name of the new tag, or None :param **properties: Keyword list of properties and their values :returns: A new tag. This is equivalent to creating a Gtk.TextTag and the...
[ "Creates", "a", "tag", "and", "adds", "it", "to", "the", "tag", "table", "of", "the", "TextBuffer", "." ]
train
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L876-L901