repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
quantopian/alphalens
alphalens/tears.py
create_information_tear_sheet
def create_information_tear_sheet(factor_data, group_neutral=False, by_group=False): """ Creates a tear sheet for information analysis of a factor. Parameters ---------- factor_data : pd.DataFrame - MultiIndex A MultiIndex ...
python
def create_information_tear_sheet(factor_data, group_neutral=False, by_group=False): """ Creates a tear sheet for information analysis of a factor. Parameters ---------- factor_data : pd.DataFrame - MultiIndex A MultiIndex ...
[ "def", "create_information_tear_sheet", "(", "factor_data", ",", "group_neutral", "=", "False", ",", "by_group", "=", "False", ")", ":", "ic", "=", "perf", ".", "factor_information_coefficient", "(", "factor_data", ",", "group_neutral", ")", "plotting", ".", "plot...
Creates a tear sheet for information analysis of a factor. Parameters ---------- factor_data : pd.DataFrame - MultiIndex A MultiIndex DataFrame indexed by date (level 0) and asset (level 1), containing the values for a single alpha factor, forward returns for each period, the factor...
[ "Creates", "a", "tear", "sheet", "for", "information", "analysis", "of", "a", "factor", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/tears.py#L325-L382
train
Creates a tear sheet for information analysis of a factor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/tears.py
create_turnover_tear_sheet
def create_turnover_tear_sheet(factor_data, turnover_periods=None): """ Creates a tear sheet for analyzing the turnover properties of a factor. Parameters ---------- factor_data : pd.DataFrame - MultiIndex A MultiIndex DataFrame indexed by date (level 0) and asset (level 1), contain...
python
def create_turnover_tear_sheet(factor_data, turnover_periods=None): """ Creates a tear sheet for analyzing the turnover properties of a factor. Parameters ---------- factor_data : pd.DataFrame - MultiIndex A MultiIndex DataFrame indexed by date (level 0) and asset (level 1), contain...
[ "def", "create_turnover_tear_sheet", "(", "factor_data", ",", "turnover_periods", "=", "None", ")", ":", "if", "turnover_periods", "is", "None", ":", "turnover_periods", "=", "utils", ".", "get_forward_returns_columns", "(", "factor_data", ".", "columns", ")", "quan...
Creates a tear sheet for analyzing the turnover properties of a factor. Parameters ---------- factor_data : pd.DataFrame - MultiIndex A MultiIndex DataFrame indexed by date (level 0) and asset (level 1), containing the values for a single alpha factor, forward returns for each perio...
[ "Creates", "a", "tear", "sheet", "for", "analyzing", "the", "turnover", "properties", "of", "a", "factor", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/tears.py#L386-L446
train
Creates a tear sheet for analyzing the turnover properties of a factor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/tears.py
create_full_tear_sheet
def create_full_tear_sheet(factor_data, long_short=True, group_neutral=False, by_group=False): """ Creates a full tear sheet for analysis and evaluating single return predicting (alpha) factor. Parameters ---------- ...
python
def create_full_tear_sheet(factor_data, long_short=True, group_neutral=False, by_group=False): """ Creates a full tear sheet for analysis and evaluating single return predicting (alpha) factor. Parameters ---------- ...
[ "def", "create_full_tear_sheet", "(", "factor_data", ",", "long_short", "=", "True", ",", "group_neutral", "=", "False", ",", "by_group", "=", "False", ")", ":", "plotting", ".", "plot_quantile_statistics_table", "(", "factor_data", ")", "create_returns_tear_sheet", ...
Creates a full tear sheet for analysis and evaluating single return predicting (alpha) factor. Parameters ---------- factor_data : pd.DataFrame - MultiIndex A MultiIndex DataFrame indexed by date (level 0) and asset (level 1), containing the values for a single alpha factor, forward ret...
[ "Creates", "a", "full", "tear", "sheet", "for", "analysis", "and", "evaluating", "single", "return", "predicting", "(", "alpha", ")", "factor", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/tears.py#L450-L490
train
Create a full tear sheet for analysis and evaluating a single alpha factor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/tears.py
create_event_returns_tear_sheet
def create_event_returns_tear_sheet(factor_data, prices, avgretplot=(5, 15), long_short=True, group_neutral=False, std_bar=True, ...
python
def create_event_returns_tear_sheet(factor_data, prices, avgretplot=(5, 15), long_short=True, group_neutral=False, std_bar=True, ...
[ "def", "create_event_returns_tear_sheet", "(", "factor_data", ",", "prices", ",", "avgretplot", "=", "(", "5", ",", "15", ")", ",", "long_short", "=", "True", ",", "group_neutral", "=", "False", ",", "std_bar", "=", "True", ",", "by_group", "=", "False", "...
Creates a tear sheet to view the average cumulative returns for a factor within a window (pre and post event). Parameters ---------- factor_data : pd.DataFrame - MultiIndex A MultiIndex Series indexed by date (level 0) and asset (level 1), containing the values for a single alpha factor...
[ "Creates", "a", "tear", "sheet", "to", "view", "the", "average", "cumulative", "returns", "for", "a", "factor", "within", "a", "window", "(", "pre", "and", "post", "event", ")", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/tears.py#L494-L591
train
Creates a tear sheet to view the average cumulative returns for a single alpha factor and a single group of assets.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/tears.py
create_event_study_tear_sheet
def create_event_study_tear_sheet(factor_data, prices=None, avgretplot=(5, 15), rate_of_ret=True, n_bars=50): """ Creates an event study tear sheet for analysis of a specific e...
python
def create_event_study_tear_sheet(factor_data, prices=None, avgretplot=(5, 15), rate_of_ret=True, n_bars=50): """ Creates an event study tear sheet for analysis of a specific e...
[ "def", "create_event_study_tear_sheet", "(", "factor_data", ",", "prices", "=", "None", ",", "avgretplot", "=", "(", "5", ",", "15", ")", ",", "rate_of_ret", "=", "True", ",", "n_bars", "=", "50", ")", ":", "long_short", "=", "False", "plotting", ".", "p...
Creates an event study tear sheet for analysis of a specific event. Parameters ---------- factor_data : pd.DataFrame - MultiIndex A MultiIndex DataFrame indexed by date (level 0) and asset (level 1), containing the values for a single event, forward returns for each period, the fact...
[ "Creates", "an", "event", "study", "tear", "sheet", "for", "analysis", "of", "a", "specific", "event", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/tears.py#L595-L701
train
Creates an event study tear sheet for analysis of a specific event.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
rethrow
def rethrow(exception, additional_message): """ Re-raise the last exception that was active in the current scope without losing the stacktrace but adding an additional message. This is hacky because it has to be compatible with both python 2/3 """ e = exception m = additional_message if ...
python
def rethrow(exception, additional_message): """ Re-raise the last exception that was active in the current scope without losing the stacktrace but adding an additional message. This is hacky because it has to be compatible with both python 2/3 """ e = exception m = additional_message if ...
[ "def", "rethrow", "(", "exception", ",", "additional_message", ")", ":", "e", "=", "exception", "m", "=", "additional_message", "if", "not", "e", ".", "args", ":", "e", ".", "args", "=", "(", "m", ",", ")", "else", ":", "e", ".", "args", "=", "(", ...
Re-raise the last exception that was active in the current scope without losing the stacktrace but adding an additional message. This is hacky because it has to be compatible with both python 2/3
[ "Re", "-", "raise", "the", "last", "exception", "that", "was", "active", "in", "the", "current", "scope", "without", "losing", "the", "stacktrace", "but", "adding", "an", "additional", "message", ".", "This", "is", "hacky", "because", "it", "has", "to", "b...
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L33-L45
train
Re - raise the last exception that was active in the current scope with losing the stacktrace but adding additional message.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
non_unique_bin_edges_error
def non_unique_bin_edges_error(func): """ Give user a more informative error in case it is not possible to properly calculate quantiles on the input dataframe (factor) """ message = """ An error occurred while computing bins/quantiles on the input provided. This usually happens when the inp...
python
def non_unique_bin_edges_error(func): """ Give user a more informative error in case it is not possible to properly calculate quantiles on the input dataframe (factor) """ message = """ An error occurred while computing bins/quantiles on the input provided. This usually happens when the inp...
[ "def", "non_unique_bin_edges_error", "(", "func", ")", ":", "message", "=", "\"\"\"\n\n An error occurred while computing bins/quantiles on the input provided.\n This usually happens when the input contains too many identical\n values and they span more than one quantile. The quantiles are ...
Give user a more informative error in case it is not possible to properly calculate quantiles on the input dataframe (factor)
[ "Give", "user", "a", "more", "informative", "error", "in", "case", "it", "is", "not", "possible", "to", "properly", "calculate", "quantiles", "on", "the", "input", "dataframe", "(", "factor", ")" ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L48-L80
train
Decorator to handle non - unique bin edges on a single resource table.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
quantize_factor
def quantize_factor(factor_data, quantiles=5, bins=None, by_group=False, no_raise=False, zero_aware=False): """ Computes period wise factor quantiles. Parameters ---------- factor_data : pd.DataFrame...
python
def quantize_factor(factor_data, quantiles=5, bins=None, by_group=False, no_raise=False, zero_aware=False): """ Computes period wise factor quantiles. Parameters ---------- factor_data : pd.DataFrame...
[ "def", "quantize_factor", "(", "factor_data", ",", "quantiles", "=", "5", ",", "bins", "=", "None", ",", "by_group", "=", "False", ",", "no_raise", "=", "False", ",", "zero_aware", "=", "False", ")", ":", "if", "not", "(", "(", "quantiles", "is", "not"...
Computes period wise factor quantiles. Parameters ---------- factor_data : pd.DataFrame - MultiIndex A MultiIndex DataFrame indexed by date (level 0) and asset (level 1), containing the values for a single alpha factor, forward returns for each period, the factor quantile/bin that f...
[ "Computes", "period", "wise", "factor", "quantiles", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L84-L169
train
Quantize a factor by factor data.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
infer_trading_calendar
def infer_trading_calendar(factor_idx, prices_idx): """ Infer the trading calendar from factor and price information. Parameters ---------- factor_idx : pd.DatetimeIndex The factor datetimes for which we are computing the forward returns prices_idx : pd.DatetimeIndex The prices ...
python
def infer_trading_calendar(factor_idx, prices_idx): """ Infer the trading calendar from factor and price information. Parameters ---------- factor_idx : pd.DatetimeIndex The factor datetimes for which we are computing the forward returns prices_idx : pd.DatetimeIndex The prices ...
[ "def", "infer_trading_calendar", "(", "factor_idx", ",", "prices_idx", ")", ":", "full_idx", "=", "factor_idx", ".", "union", "(", "prices_idx", ")", "traded_weekdays", "=", "[", "]", "holidays", "=", "[", "]", "days_of_the_week", "=", "[", "'Mon'", ",", "'T...
Infer the trading calendar from factor and price information. Parameters ---------- factor_idx : pd.DatetimeIndex The factor datetimes for which we are computing the forward returns prices_idx : pd.DatetimeIndex The prices datetimes associated withthe factor data Returns ------...
[ "Infer", "the", "trading", "calendar", "from", "factor", "and", "price", "information", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L172-L212
train
Infer the trading calendar from factor and price information.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
compute_forward_returns
def compute_forward_returns(factor, prices, periods=(1, 5, 10), filter_zscore=None, cumulative_returns=True): """ Finds the N period forward returns (as percent change) for each asset provided. ...
python
def compute_forward_returns(factor, prices, periods=(1, 5, 10), filter_zscore=None, cumulative_returns=True): """ Finds the N period forward returns (as percent change) for each asset provided. ...
[ "def", "compute_forward_returns", "(", "factor", ",", "prices", ",", "periods", "=", "(", "1", ",", "5", ",", "10", ")", ",", "filter_zscore", "=", "None", ",", "cumulative_returns", "=", "True", ")", ":", "factor_dateindex", "=", "factor", ".", "index", ...
Finds the N period forward returns (as percent change) for each asset provided. Parameters ---------- factor : pd.Series - MultiIndex A MultiIndex Series indexed by timestamp (level 0) and asset (level 1), containing the values for a single alpha factor. - See full explanation ...
[ "Finds", "the", "N", "period", "forward", "returns", "(", "as", "percent", "change", ")", "for", "each", "asset", "provided", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L215-L343
train
This function calculates the forward returns for a single factor and a set of assets.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
demean_forward_returns
def demean_forward_returns(factor_data, grouper=None): """ Convert forward returns to returns relative to mean period wise all-universe or group returns. group-wise normalization incorporates the assumption of a group neutral portfolio constraint and thus allows allows the factor to be evaluated...
python
def demean_forward_returns(factor_data, grouper=None): """ Convert forward returns to returns relative to mean period wise all-universe or group returns. group-wise normalization incorporates the assumption of a group neutral portfolio constraint and thus allows allows the factor to be evaluated...
[ "def", "demean_forward_returns", "(", "factor_data", ",", "grouper", "=", "None", ")", ":", "factor_data", "=", "factor_data", ".", "copy", "(", ")", "if", "not", "grouper", ":", "grouper", "=", "factor_data", ".", "index", ".", "get_level_values", "(", "'da...
Convert forward returns to returns relative to mean period wise all-universe or group returns. group-wise normalization incorporates the assumption of a group neutral portfolio constraint and thus allows allows the factor to be evaluated across groups. For example, if AAPL 5 period return is 0.1% a...
[ "Convert", "forward", "returns", "to", "returns", "relative", "to", "mean", "period", "wise", "all", "-", "universe", "or", "group", "returns", ".", "group", "-", "wise", "normalization", "incorporates", "the", "assumption", "of", "a", "group", "neutral", "por...
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L346-L383
train
Convert forward returns to returns relative to mean period wise all - universe or group returns.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
print_table
def print_table(table, name=None, fmt=None): """ Pretty print a pandas DataFrame. Uses HTML output if running inside Jupyter Notebook, otherwise formatted text output. Parameters ---------- table : pd.Series or pd.DataFrame Table to pretty-print. name : str, optional Ta...
python
def print_table(table, name=None, fmt=None): """ Pretty print a pandas DataFrame. Uses HTML output if running inside Jupyter Notebook, otherwise formatted text output. Parameters ---------- table : pd.Series or pd.DataFrame Table to pretty-print. name : str, optional Ta...
[ "def", "print_table", "(", "table", ",", "name", "=", "None", ",", "fmt", "=", "None", ")", ":", "if", "isinstance", "(", "table", ",", "pd", ".", "Series", ")", ":", "table", "=", "pd", ".", "DataFrame", "(", "table", ")", "if", "isinstance", "(",...
Pretty print a pandas DataFrame. Uses HTML output if running inside Jupyter Notebook, otherwise formatted text output. Parameters ---------- table : pd.Series or pd.DataFrame Table to pretty-print. name : str, optional Table name to display in upper left corner. fmt : str, ...
[ "Pretty", "print", "a", "pandas", "DataFrame", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L386-L417
train
Pretty print a pandas DataFrame.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
get_clean_factor
def get_clean_factor(factor, forward_returns, groupby=None, binning_by_group=False, quantiles=5, bins=None, groupby_labels=None, max_loss=0.35, zero_awa...
python
def get_clean_factor(factor, forward_returns, groupby=None, binning_by_group=False, quantiles=5, bins=None, groupby_labels=None, max_loss=0.35, zero_awa...
[ "def", "get_clean_factor", "(", "factor", ",", "forward_returns", ",", "groupby", "=", "None", ",", "binning_by_group", "=", "False", ",", "quantiles", "=", "5", ",", "bins", "=", "None", ",", "groupby_labels", "=", "None", ",", "max_loss", "=", "0.35", ",...
Formats the factor data, forward return data, and group mappings into a DataFrame that contains aligned MultiIndex indices of timestamp and asset. The returned data will be formatted to be suitable for Alphalens functions. It is safe to skip a call to this function and still make use of Alphalens funct...
[ "Formats", "the", "factor", "data", "forward", "return", "data", "and", "group", "mappings", "into", "a", "DataFrame", "that", "contains", "aligned", "MultiIndex", "indices", "of", "timestamp", "and", "asset", ".", "The", "returned", "data", "will", "be", "for...
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L420-L629
train
Returns a DataFrame that represents the factor data and the forward returns for the given group and returns.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
get_clean_factor_and_forward_returns
def get_clean_factor_and_forward_returns(factor, prices, groupby=None, binning_by_group=False, quantiles=5, bins=No...
python
def get_clean_factor_and_forward_returns(factor, prices, groupby=None, binning_by_group=False, quantiles=5, bins=No...
[ "def", "get_clean_factor_and_forward_returns", "(", "factor", ",", "prices", ",", "groupby", "=", "None", ",", "binning_by_group", "=", "False", ",", "quantiles", "=", "5", ",", "bins", "=", "None", ",", "periods", "=", "(", "1", ",", "5", ",", "10", ")"...
Formats the factor data, pricing data, and group mappings into a DataFrame that contains aligned MultiIndex indices of timestamp and asset. The returned data will be formatted to be suitable for Alphalens functions. It is safe to skip a call to this function and still make use of Alphalens functionalit...
[ "Formats", "the", "factor", "data", "pricing", "data", "and", "group", "mappings", "into", "a", "DataFrame", "that", "contains", "aligned", "MultiIndex", "indices", "of", "timestamp", "and", "asset", ".", "The", "returned", "data", "will", "be", "formatted", "...
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L632-L799
train
Returns a DataFrame containing the factor data pricing data and forward returns for the given factor analysis time period and asset combination.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
rate_of_return
def rate_of_return(period_ret, base_period): """ Convert returns to 'one_period_len' rate of returns: that is the value the returns would have every 'one_period_len' if they had grown at a steady rate Parameters ---------- period_ret: pd.DataFrame DataFrame containing returns values...
python
def rate_of_return(period_ret, base_period): """ Convert returns to 'one_period_len' rate of returns: that is the value the returns would have every 'one_period_len' if they had grown at a steady rate Parameters ---------- period_ret: pd.DataFrame DataFrame containing returns values...
[ "def", "rate_of_return", "(", "period_ret", ",", "base_period", ")", ":", "period_len", "=", "period_ret", ".", "name", "conversion_factor", "=", "(", "pd", ".", "Timedelta", "(", "base_period", ")", "/", "pd", ".", "Timedelta", "(", "period_len", ")", ")", ...
Convert returns to 'one_period_len' rate of returns: that is the value the returns would have every 'one_period_len' if they had grown at a steady rate Parameters ---------- period_ret: pd.DataFrame DataFrame containing returns values with column headings representing the return per...
[ "Convert", "returns", "to", "one_period_len", "rate", "of", "returns", ":", "that", "is", "the", "value", "the", "returns", "would", "have", "every", "one_period_len", "if", "they", "had", "grown", "at", "a", "steady", "rate" ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L802-L827
train
Convert returns to one_period_len rate of returns
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
std_conversion
def std_conversion(period_std, base_period): """ one_period_len standard deviation (or standard error) approximation Parameters ---------- period_std: pd.DataFrame DataFrame containing standard deviation or standard error values with column headings representing the return period. ...
python
def std_conversion(period_std, base_period): """ one_period_len standard deviation (or standard error) approximation Parameters ---------- period_std: pd.DataFrame DataFrame containing standard deviation or standard error values with column headings representing the return period. ...
[ "def", "std_conversion", "(", "period_std", ",", "base_period", ")", ":", "period_len", "=", "period_std", ".", "name", "conversion_factor", "=", "(", "pd", ".", "Timedelta", "(", "period_len", ")", "/", "pd", ".", "Timedelta", "(", "base_period", ")", ")", ...
one_period_len standard deviation (or standard error) approximation Parameters ---------- period_std: pd.DataFrame DataFrame containing standard deviation or standard error values with column headings representing the return period. base_period: string The base period length use...
[ "one_period_len", "standard", "deviation", "(", "or", "standard", "error", ")", "approximation" ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L830-L853
train
Returns a dataframe containing one - period_len standard deviation or standard error values corresponding to the return period.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
get_forward_returns_columns
def get_forward_returns_columns(columns): """ Utility that detects and returns the columns that are forward returns """ pattern = re.compile(r"^(\d+([Dhms]|ms|us|ns))+$", re.IGNORECASE) valid_columns = [(pattern.match(col) is not None) for col in columns] return columns[valid_columns]
python
def get_forward_returns_columns(columns): """ Utility that detects and returns the columns that are forward returns """ pattern = re.compile(r"^(\d+([Dhms]|ms|us|ns))+$", re.IGNORECASE) valid_columns = [(pattern.match(col) is not None) for col in columns] return columns[valid_columns]
[ "def", "get_forward_returns_columns", "(", "columns", ")", ":", "pattern", "=", "re", ".", "compile", "(", "r\"^(\\d+([Dhms]|ms|us|ns))+$\"", ",", "re", ".", "IGNORECASE", ")", "valid_columns", "=", "[", "(", "pattern", ".", "match", "(", "col", ")", "is", "...
Utility that detects and returns the columns that are forward returns
[ "Utility", "that", "detects", "and", "returns", "the", "columns", "that", "are", "forward", "returns" ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L856-L862
train
Utility that detects and returns the columns that are forward returns
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
timedelta_to_string
def timedelta_to_string(timedelta): """ Utility that converts a pandas.Timedelta to a string representation compatible with pandas.Timedelta constructor format Parameters ---------- timedelta: pd.Timedelta Returns ------- string string representation of 'timedelta' """ ...
python
def timedelta_to_string(timedelta): """ Utility that converts a pandas.Timedelta to a string representation compatible with pandas.Timedelta constructor format Parameters ---------- timedelta: pd.Timedelta Returns ------- string string representation of 'timedelta' """ ...
[ "def", "timedelta_to_string", "(", "timedelta", ")", ":", "c", "=", "timedelta", ".", "components", "format", "=", "''", "if", "c", ".", "days", "!=", "0", ":", "format", "+=", "'%dD'", "%", "c", ".", "days", "if", "c", ".", "hours", ">", "0", ":",...
Utility that converts a pandas.Timedelta to a string representation compatible with pandas.Timedelta constructor format Parameters ---------- timedelta: pd.Timedelta Returns ------- string string representation of 'timedelta'
[ "Utility", "that", "converts", "a", "pandas", ".", "Timedelta", "to", "a", "string", "representation", "compatible", "with", "pandas", ".", "Timedelta", "constructor", "format" ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L865-L895
train
Utility that converts a pandas. Timedelta to a string representation of a compatible with pandas. Timedelta constructor format
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
add_custom_calendar_timedelta
def add_custom_calendar_timedelta(input, timedelta, freq): """ Add timedelta to 'input' taking into consideration custom frequency, which is used to deal with custom calendars, such as a trading calendar Parameters ---------- input : pd.DatetimeIndex or pd.Timestamp timedelta : pd.Timedelta...
python
def add_custom_calendar_timedelta(input, timedelta, freq): """ Add timedelta to 'input' taking into consideration custom frequency, which is used to deal with custom calendars, such as a trading calendar Parameters ---------- input : pd.DatetimeIndex or pd.Timestamp timedelta : pd.Timedelta...
[ "def", "add_custom_calendar_timedelta", "(", "input", ",", "timedelta", ",", "freq", ")", ":", "if", "not", "isinstance", "(", "freq", ",", "(", "Day", ",", "BusinessDay", ",", "CustomBusinessDay", ")", ")", ":", "raise", "ValueError", "(", "\"freq must be Day...
Add timedelta to 'input' taking into consideration custom frequency, which is used to deal with custom calendars, such as a trading calendar Parameters ---------- input : pd.DatetimeIndex or pd.Timestamp timedelta : pd.Timedelta freq : pd.DataOffset (CustomBusinessDay, Day or BusinessDay) ...
[ "Add", "timedelta", "to", "input", "taking", "into", "consideration", "custom", "frequency", "which", "is", "used", "to", "deal", "with", "custom", "calendars", "such", "as", "a", "trading", "calendar" ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L898-L918
train
Adds a timedelta to a specific calendar.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/utils.py
diff_custom_calendar_timedeltas
def diff_custom_calendar_timedeltas(start, end, freq): """ Compute the difference between two pd.Timedelta taking into consideration custom frequency, which is used to deal with custom calendars, such as a trading calendar Parameters ---------- start : pd.Timestamp end : pd.Timestamp ...
python
def diff_custom_calendar_timedeltas(start, end, freq): """ Compute the difference between two pd.Timedelta taking into consideration custom frequency, which is used to deal with custom calendars, such as a trading calendar Parameters ---------- start : pd.Timestamp end : pd.Timestamp ...
[ "def", "diff_custom_calendar_timedeltas", "(", "start", ",", "end", ",", "freq", ")", ":", "if", "not", "isinstance", "(", "freq", ",", "(", "Day", ",", "BusinessDay", ",", "CustomBusinessDay", ")", ")", ":", "raise", "ValueError", "(", "\"freq must be Day, Bu...
Compute the difference between two pd.Timedelta taking into consideration custom frequency, which is used to deal with custom calendars, such as a trading calendar Parameters ---------- start : pd.Timestamp end : pd.Timestamp freq : CustomBusinessDay (see infer_trading_calendar) freq : ...
[ "Compute", "the", "difference", "between", "two", "pd", ".", "Timedelta", "taking", "into", "consideration", "custom", "frequency", "which", "is", "used", "to", "deal", "with", "custom", "calendars", "such", "as", "a", "trading", "calendar" ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L921-L966
train
Compute the difference between two pd. Timedelta objects taking into consideration a custom frequency which is used to deal with custom calendars such as a trading calendars and a trading calendars.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
customize
def customize(func): """ Decorator to set plotting context and axes style during function call. """ @wraps(func) def call_w_context(*args, **kwargs): set_context = kwargs.pop('set_context', True) if set_context: color_palette = sns.color_palette('colorblind') ...
python
def customize(func): """ Decorator to set plotting context and axes style during function call. """ @wraps(func) def call_w_context(*args, **kwargs): set_context = kwargs.pop('set_context', True) if set_context: color_palette = sns.color_palette('colorblind') ...
[ "def", "customize", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "call_w_context", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "set_context", "=", "kwargs", ".", "pop", "(", "'set_context'", ",", "True", ")", "if", "set_cont...
Decorator to set plotting context and axes style during function call.
[ "Decorator", "to", "set", "plotting", "context", "and", "axes", "style", "during", "function", "call", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L34-L48
train
Decorator to customize the plotting context and axes style during function call.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_ic_ts
def plot_ic_ts(ic, ax=None): """ Plots Spearman Rank Information Coefficient and IC moving average for a given factor. Parameters ---------- ic : pd.DataFrame DataFrame indexed by date, with IC for each forward return. ax : matplotlib.Axes, optional Axes upon which to plot. ...
python
def plot_ic_ts(ic, ax=None): """ Plots Spearman Rank Information Coefficient and IC moving average for a given factor. Parameters ---------- ic : pd.DataFrame DataFrame indexed by date, with IC for each forward return. ax : matplotlib.Axes, optional Axes upon which to plot. ...
[ "def", "plot_ic_ts", "(", "ic", ",", "ax", "=", "None", ")", ":", "ic", "=", "ic", ".", "copy", "(", ")", "num_plots", "=", "len", "(", "ic", ".", "columns", ")", "if", "ax", "is", "None", ":", "f", ",", "ax", "=", "plt", ".", "subplots", "("...
Plots Spearman Rank Information Coefficient and IC moving average for a given factor. Parameters ---------- ic : pd.DataFrame DataFrame indexed by date, with IC for each forward return. ax : matplotlib.Axes, optional Axes upon which to plot. Returns ------- ax : matplot...
[ "Plots", "Spearman", "Rank", "Information", "Coefficient", "and", "IC", "moving", "average", "for", "a", "given", "factor", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L192-L245
train
Plots the Spearman Rank Information Coefficient and IC moving average for a given factor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_ic_hist
def plot_ic_hist(ic, ax=None): """ Plots Spearman Rank Information Coefficient histogram for a given factor. Parameters ---------- ic : pd.DataFrame DataFrame indexed by date, with IC for each forward return. ax : matplotlib.Axes, optional Axes upon which to plot. Returns ...
python
def plot_ic_hist(ic, ax=None): """ Plots Spearman Rank Information Coefficient histogram for a given factor. Parameters ---------- ic : pd.DataFrame DataFrame indexed by date, with IC for each forward return. ax : matplotlib.Axes, optional Axes upon which to plot. Returns ...
[ "def", "plot_ic_hist", "(", "ic", ",", "ax", "=", "None", ")", ":", "ic", "=", "ic", ".", "copy", "(", ")", "num_plots", "=", "len", "(", "ic", ".", "columns", ")", "v_spaces", "=", "(", "(", "num_plots", "-", "1", ")", "//", "3", ")", "+", "...
Plots Spearman Rank Information Coefficient histogram for a given factor. Parameters ---------- ic : pd.DataFrame DataFrame indexed by date, with IC for each forward return. ax : matplotlib.Axes, optional Axes upon which to plot. Returns ------- ax : matplotlib.Axes ...
[ "Plots", "Spearman", "Rank", "Information", "Coefficient", "histogram", "for", "a", "given", "factor", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L248-L289
train
Plots the Spearman Rank Information Coefficient histogram for a given factor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_ic_qq
def plot_ic_qq(ic, theoretical_dist=stats.norm, ax=None): """ Plots Spearman Rank Information Coefficient "Q-Q" plot relative to a theoretical distribution. Parameters ---------- ic : pd.DataFrame DataFrame indexed by date, with IC for each forward return. theoretical_dist : scipy.s...
python
def plot_ic_qq(ic, theoretical_dist=stats.norm, ax=None): """ Plots Spearman Rank Information Coefficient "Q-Q" plot relative to a theoretical distribution. Parameters ---------- ic : pd.DataFrame DataFrame indexed by date, with IC for each forward return. theoretical_dist : scipy.s...
[ "def", "plot_ic_qq", "(", "ic", ",", "theoretical_dist", "=", "stats", ".", "norm", ",", "ax", "=", "None", ")", ":", "ic", "=", "ic", ".", "copy", "(", ")", "num_plots", "=", "len", "(", "ic", ".", "columns", ")", "v_spaces", "=", "(", "(", "num...
Plots Spearman Rank Information Coefficient "Q-Q" plot relative to a theoretical distribution. Parameters ---------- ic : pd.DataFrame DataFrame indexed by date, with IC for each forward return. theoretical_dist : scipy.stats._continuous_distns Continuous distribution generator. sci...
[ "Plots", "Spearman", "Rank", "Information", "Coefficient", "Q", "-", "Q", "plot", "relative", "to", "a", "theoretical", "distribution", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L292-L338
train
Plots the relative to theoretical distribution of the terms.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_quantile_returns_bar
def plot_quantile_returns_bar(mean_ret_by_q, by_group=False, ylim_percentiles=None, ax=None): """ Plots mean period wise returns for factor quantiles. Parameters ---------- mean_ret_by_q : pd.DataFrame ...
python
def plot_quantile_returns_bar(mean_ret_by_q, by_group=False, ylim_percentiles=None, ax=None): """ Plots mean period wise returns for factor quantiles. Parameters ---------- mean_ret_by_q : pd.DataFrame ...
[ "def", "plot_quantile_returns_bar", "(", "mean_ret_by_q", ",", "by_group", "=", "False", ",", "ylim_percentiles", "=", "None", ",", "ax", "=", "None", ")", ":", "mean_ret_by_q", "=", "mean_ret_by_q", ".", "copy", "(", ")", "if", "ylim_percentiles", "is", "not"...
Plots mean period wise returns for factor quantiles. Parameters ---------- mean_ret_by_q : pd.DataFrame DataFrame with quantile, (group) and mean period wise return values. by_group : bool Disaggregated figures by group. ylim_percentiles : tuple of integers Percentiles of ob...
[ "Plots", "mean", "period", "wise", "returns", "for", "factor", "quantiles", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L341-L409
train
Plots the mean period wise returns for factor quantiles.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_quantile_returns_violin
def plot_quantile_returns_violin(return_by_q, ylim_percentiles=None, ax=None): """ Plots a violin box plot of period wise returns for factor quantiles. Parameters ---------- return_by_q : pd.DataFrame - MultiIndex DataFrame w...
python
def plot_quantile_returns_violin(return_by_q, ylim_percentiles=None, ax=None): """ Plots a violin box plot of period wise returns for factor quantiles. Parameters ---------- return_by_q : pd.DataFrame - MultiIndex DataFrame w...
[ "def", "plot_quantile_returns_violin", "(", "return_by_q", ",", "ylim_percentiles", "=", "None", ",", "ax", "=", "None", ")", ":", "return_by_q", "=", "return_by_q", ".", "copy", "(", ")", "if", "ylim_percentiles", "is", "not", "None", ":", "ymin", "=", "(",...
Plots a violin box plot of period wise returns for factor quantiles. Parameters ---------- return_by_q : pd.DataFrame - MultiIndex DataFrame with date and quantile as rows MultiIndex, forward return windows as columns, returns as values. ylim_percentiles : tuple of integers Perc...
[ "Plots", "a", "violin", "box", "plot", "of", "period", "wise", "returns", "for", "factor", "quantiles", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L412-L469
train
Plots a violin box plot of factor wise returns for factor quantiles.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_mean_quantile_returns_spread_time_series
def plot_mean_quantile_returns_spread_time_series(mean_returns_spread, std_err=None, bandwidth=1, ax=None): """ Plots mean period wise returns for factor quantile...
python
def plot_mean_quantile_returns_spread_time_series(mean_returns_spread, std_err=None, bandwidth=1, ax=None): """ Plots mean period wise returns for factor quantile...
[ "def", "plot_mean_quantile_returns_spread_time_series", "(", "mean_returns_spread", ",", "std_err", "=", "None", ",", "bandwidth", "=", "1", ",", "ax", "=", "None", ")", ":", "if", "isinstance", "(", "mean_returns_spread", ",", "pd", ".", "DataFrame", ")", ":", ...
Plots mean period wise returns for factor quantiles. Parameters ---------- mean_returns_spread : pd.Series Series with difference between quantile mean returns by period. std_err : pd.Series Series with standard error of difference between quantile mean returns each period. ...
[ "Plots", "mean", "period", "wise", "returns", "for", "factor", "quantiles", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L472-L555
train
Plots the mean period wise returns for factor quantiles.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_ic_by_group
def plot_ic_by_group(ic_group, ax=None): """ Plots Spearman Rank Information Coefficient for a given factor over provided forward returns. Separates by group. Parameters ---------- ic_group : pd.DataFrame group-wise mean period wise returns. ax : matplotlib.Axes, optional Ax...
python
def plot_ic_by_group(ic_group, ax=None): """ Plots Spearman Rank Information Coefficient for a given factor over provided forward returns. Separates by group. Parameters ---------- ic_group : pd.DataFrame group-wise mean period wise returns. ax : matplotlib.Axes, optional Ax...
[ "def", "plot_ic_by_group", "(", "ic_group", ",", "ax", "=", "None", ")", ":", "if", "ax", "is", "None", ":", "f", ",", "ax", "=", "plt", ".", "subplots", "(", "1", ",", "1", ",", "figsize", "=", "(", "18", ",", "6", ")", ")", "ic_group", ".", ...
Plots Spearman Rank Information Coefficient for a given factor over provided forward returns. Separates by group. Parameters ---------- ic_group : pd.DataFrame group-wise mean period wise returns. ax : matplotlib.Axes, optional Axes upon which to plot. Returns ------- a...
[ "Plots", "Spearman", "Rank", "Information", "Coefficient", "for", "a", "given", "factor", "over", "provided", "forward", "returns", ".", "Separates", "by", "group", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L558-L582
train
Plots the Spearman Rank Information Coefficient for a given factor over a given forward returns. Separates by group.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_factor_rank_auto_correlation
def plot_factor_rank_auto_correlation(factor_autocorrelation, period=1, ax=None): """ Plots factor rank autocorrelation over time. See factor_rank_autocorrelation for more details. Parameters ---------- factor_autocorre...
python
def plot_factor_rank_auto_correlation(factor_autocorrelation, period=1, ax=None): """ Plots factor rank autocorrelation over time. See factor_rank_autocorrelation for more details. Parameters ---------- factor_autocorre...
[ "def", "plot_factor_rank_auto_correlation", "(", "factor_autocorrelation", ",", "period", "=", "1", ",", "ax", "=", "None", ")", ":", "if", "ax", "is", "None", ":", "f", ",", "ax", "=", "plt", ".", "subplots", "(", "1", ",", "1", ",", "figsize", "=", ...
Plots factor rank autocorrelation over time. See factor_rank_autocorrelation for more details. Parameters ---------- factor_autocorrelation : pd.Series Rolling 1 period (defined by time_rule) autocorrelation of factor values. period: int, optional Period over which the autoc...
[ "Plots", "factor", "rank", "autocorrelation", "over", "time", ".", "See", "factor_rank_autocorrelation", "for", "more", "details", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L585-L620
train
Plots factor rank autocorrelation over time.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_top_bottom_quantile_turnover
def plot_top_bottom_quantile_turnover(quantile_turnover, period=1, ax=None): """ Plots period wise top and bottom quantile factor turnover. Parameters ---------- quantile_turnover: pd.Dataframe Quantile turnover (each DataFrame column a quantile). period: int, optional Period ov...
python
def plot_top_bottom_quantile_turnover(quantile_turnover, period=1, ax=None): """ Plots period wise top and bottom quantile factor turnover. Parameters ---------- quantile_turnover: pd.Dataframe Quantile turnover (each DataFrame column a quantile). period: int, optional Period ov...
[ "def", "plot_top_bottom_quantile_turnover", "(", "quantile_turnover", ",", "period", "=", "1", ",", "ax", "=", "None", ")", ":", "if", "ax", "is", "None", ":", "f", ",", "ax", "=", "plt", ".", "subplots", "(", "1", ",", "1", ",", "figsize", "=", "(",...
Plots period wise top and bottom quantile factor turnover. Parameters ---------- quantile_turnover: pd.Dataframe Quantile turnover (each DataFrame column a quantile). period: int, optional Period over which to calculate the turnover ax : matplotlib.Axes, optional Axes upon w...
[ "Plots", "period", "wise", "top", "and", "bottom", "quantile", "factor", "turnover", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L623-L653
train
Plots the top and bottom quantile factor turnover.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_monthly_ic_heatmap
def plot_monthly_ic_heatmap(mean_monthly_ic, ax=None): """ Plots a heatmap of the information coefficient or returns by month. Parameters ---------- mean_monthly_ic : pd.DataFrame The mean monthly IC for N periods forward. Returns ------- ax : matplotlib.Axes The axes t...
python
def plot_monthly_ic_heatmap(mean_monthly_ic, ax=None): """ Plots a heatmap of the information coefficient or returns by month. Parameters ---------- mean_monthly_ic : pd.DataFrame The mean monthly IC for N periods forward. Returns ------- ax : matplotlib.Axes The axes t...
[ "def", "plot_monthly_ic_heatmap", "(", "mean_monthly_ic", ",", "ax", "=", "None", ")", ":", "mean_monthly_ic", "=", "mean_monthly_ic", ".", "copy", "(", ")", "num_plots", "=", "len", "(", "mean_monthly_ic", ".", "columns", ")", "v_spaces", "=", "(", "(", "nu...
Plots a heatmap of the information coefficient or returns by month. Parameters ---------- mean_monthly_ic : pd.DataFrame The mean monthly IC for N periods forward. Returns ------- ax : matplotlib.Axes The axes that were plotted on.
[ "Plots", "a", "heatmap", "of", "the", "information", "coefficient", "or", "returns", "by", "month", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L656-L711
train
Plots a heatmap of the information coefficient or returns by month.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_cumulative_returns
def plot_cumulative_returns(factor_returns, period, freq, title=None, ax=None): """ Plots the cumulative returns of the returns series passed in. Parameters ---------- factor_returns : pd.Series Period wise returns of dollar neutral portfolio weighted by factor value. period: pa...
python
def plot_cumulative_returns(factor_returns, period, freq, title=None, ax=None): """ Plots the cumulative returns of the returns series passed in. Parameters ---------- factor_returns : pd.Series Period wise returns of dollar neutral portfolio weighted by factor value. period: pa...
[ "def", "plot_cumulative_returns", "(", "factor_returns", ",", "period", ",", "freq", ",", "title", "=", "None", ",", "ax", "=", "None", ")", ":", "if", "ax", "is", "None", ":", "f", ",", "ax", "=", "plt", ".", "subplots", "(", "1", ",", "1", ",", ...
Plots the cumulative returns of the returns series passed in. Parameters ---------- factor_returns : pd.Series Period wise returns of dollar neutral portfolio weighted by factor value. period: pandas.Timedelta or string Length of period for which the returns are computed (e.g. 1...
[ "Plots", "the", "cumulative", "returns", "of", "the", "returns", "series", "passed", "in", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L714-L754
train
Plots the cumulative returns of the factor returns series passed in.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_cumulative_returns_by_quantile
def plot_cumulative_returns_by_quantile(quantile_returns, period, freq, ax=None): """ Plots the cumulative returns of various factor quantiles. Parameters ---------- quantile_retu...
python
def plot_cumulative_returns_by_quantile(quantile_returns, period, freq, ax=None): """ Plots the cumulative returns of various factor quantiles. Parameters ---------- quantile_retu...
[ "def", "plot_cumulative_returns_by_quantile", "(", "quantile_returns", ",", "period", ",", "freq", ",", "ax", "=", "None", ")", ":", "if", "ax", "is", "None", ":", "f", ",", "ax", "=", "plt", ".", "subplots", "(", "1", ",", "1", ",", "figsize", "=", ...
Plots the cumulative returns of various factor quantiles. Parameters ---------- quantile_returns : pd.DataFrame Returns by factor quantile period: pandas.Timedelta or string Length of period for which the returns are computed (e.g. 1 day) if 'period' is a string it must follow p...
[ "Plots", "the", "cumulative", "returns", "of", "various", "factor", "quantiles", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L757-L807
train
Plots the cumulative returns of a particular factor quantile.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_quantile_average_cumulative_return
def plot_quantile_average_cumulative_return(avg_cumulative_returns, by_quantile=False, std_bar=False, title=None, ax=None): """ Plots se...
python
def plot_quantile_average_cumulative_return(avg_cumulative_returns, by_quantile=False, std_bar=False, title=None, ax=None): """ Plots se...
[ "def", "plot_quantile_average_cumulative_return", "(", "avg_cumulative_returns", ",", "by_quantile", "=", "False", ",", "std_bar", "=", "False", ",", "title", "=", "None", ",", "ax", "=", "None", ")", ":", "avg_cumulative_returns", "=", "avg_cumulative_returns", "."...
Plots sector-wise mean daily returns for factor quantiles across provided forward price movement columns. Parameters ---------- avg_cumulative_returns: pd.Dataframe The format is the one returned by performance.average_cumulative_return_by_quantile by_quantile : boolean, optional ...
[ "Plots", "sector", "-", "wise", "mean", "daily", "returns", "for", "factor", "quantiles", "across", "provided", "forward", "price", "movement", "columns", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L810-L895
train
Plots the average daily returns for factor quantiles of the given forward price movement columns.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
quantopian/alphalens
alphalens/plotting.py
plot_events_distribution
def plot_events_distribution(events, num_bars=50, ax=None): """ Plots the distribution of events in time. Parameters ---------- events : pd.Series A pd.Series whose index contains at least 'date' level. num_bars : integer, optional Number of bars to plot ax : matplotlib.Axes...
python
def plot_events_distribution(events, num_bars=50, ax=None): """ Plots the distribution of events in time. Parameters ---------- events : pd.Series A pd.Series whose index contains at least 'date' level. num_bars : integer, optional Number of bars to plot ax : matplotlib.Axes...
[ "def", "plot_events_distribution", "(", "events", ",", "num_bars", "=", "50", ",", "ax", "=", "None", ")", ":", "if", "ax", "is", "None", ":", "f", ",", "ax", "=", "plt", ".", "subplots", "(", "1", ",", "1", ",", "figsize", "=", "(", "18", ",", ...
Plots the distribution of events in time. Parameters ---------- events : pd.Series A pd.Series whose index contains at least 'date' level. num_bars : integer, optional Number of bars to plot ax : matplotlib.Axes, optional Axes upon which to plot. Returns ------- ...
[ "Plots", "the", "distribution", "of", "events", "in", "time", "." ]
d43eac871bb061e956df936794d3dd514da99e44
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/plotting.py#L898-L928
train
Plots the distribution of events in time.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/cursors.py
Cursor.close
def close(self): """ Closing a cursor just exhausts all remaining data. """ conn = self.connection if conn is None: return try: while self.nextset(): pass finally: self.connection = None
python
def close(self): """ Closing a cursor just exhausts all remaining data. """ conn = self.connection if conn is None: return try: while self.nextset(): pass finally: self.connection = None
[ "def", "close", "(", "self", ")", ":", "conn", "=", "self", ".", "connection", "if", "conn", "is", "None", ":", "return", "try", ":", "while", "self", ".", "nextset", "(", ")", ":", "pass", "finally", ":", "self", ".", "connection", "=", "None" ]
Closing a cursor just exhausts all remaining data.
[ "Closing", "a", "cursor", "just", "exhausts", "all", "remaining", "data", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/cursors.py#L47-L58
train
Closes the current cursor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/cursors.py
Cursor._nextset
def _nextset(self, unbuffered=False): """Get the next query set""" conn = self._get_db() current_result = self._result if current_result is None or current_result is not conn._result: return None if not current_result.has_next: return None self._re...
python
def _nextset(self, unbuffered=False): """Get the next query set""" conn = self._get_db() current_result = self._result if current_result is None or current_result is not conn._result: return None if not current_result.has_next: return None self._re...
[ "def", "_nextset", "(", "self", ",", "unbuffered", "=", "False", ")", ":", "conn", "=", "self", ".", "_get_db", "(", ")", "current_result", "=", "self", ".", "_result", "if", "current_result", "is", "None", "or", "current_result", "is", "not", "conn", "....
Get the next query set
[ "Get", "the", "next", "query", "set" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/cursors.py#L85-L97
train
Get the next query set
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/cursors.py
Cursor.mogrify
def mogrify(self, query, args=None): """ Returns the exact string that is sent to the database by calling the execute() method. This method follows the extension to the DB API 2.0 followed by Psycopg. """ conn = self._get_db() if PY2: # Use bytes on Python 2 alw...
python
def mogrify(self, query, args=None): """ Returns the exact string that is sent to the database by calling the execute() method. This method follows the extension to the DB API 2.0 followed by Psycopg. """ conn = self._get_db() if PY2: # Use bytes on Python 2 alw...
[ "def", "mogrify", "(", "self", ",", "query", ",", "args", "=", "None", ")", ":", "conn", "=", "self", ".", "_get_db", "(", ")", "if", "PY2", ":", "# Use bytes on Python 2 always", "query", "=", "self", ".", "_ensure_bytes", "(", "query", ",", "encoding",...
Returns the exact string that is sent to the database by calling the execute() method. This method follows the extension to the DB API 2.0 followed by Psycopg.
[ "Returns", "the", "exact", "string", "that", "is", "sent", "to", "the", "database", "by", "calling", "the", "execute", "()", "method", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/cursors.py#L128-L142
train
Returns the exact string that is sent to the database by calling the execute method.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/cursors.py
Cursor.execute
def execute(self, query, args=None): """Execute a query :param str query: Query to execute. :param args: parameters used with query. (optional) :type args: tuple, list or dict :return: Number of affected rows :rtype: int If args is a list or tuple, %s can be u...
python
def execute(self, query, args=None): """Execute a query :param str query: Query to execute. :param args: parameters used with query. (optional) :type args: tuple, list or dict :return: Number of affected rows :rtype: int If args is a list or tuple, %s can be u...
[ "def", "execute", "(", "self", ",", "query", ",", "args", "=", "None", ")", ":", "while", "self", ".", "nextset", "(", ")", ":", "pass", "query", "=", "self", ".", "mogrify", "(", "query", ",", "args", ")", "result", "=", "self", ".", "_query", "...
Execute a query :param str query: Query to execute. :param args: parameters used with query. (optional) :type args: tuple, list or dict :return: Number of affected rows :rtype: int If args is a list or tuple, %s can be used as a placeholder in the query. If ar...
[ "Execute", "a", "query" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/cursors.py#L144-L165
train
Execute a query on the cache and return the number of affected rows.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/cursors.py
Cursor.callproc
def callproc(self, procname, args=()): """Execute stored procedure procname with args procname -- string, name of procedure to execute on server args -- Sequence of parameters to use with procedure Returns the original args. Compatibility warning: PEP-249 specifies that any m...
python
def callproc(self, procname, args=()): """Execute stored procedure procname with args procname -- string, name of procedure to execute on server args -- Sequence of parameters to use with procedure Returns the original args. Compatibility warning: PEP-249 specifies that any m...
[ "def", "callproc", "(", "self", ",", "procname", ",", "args", "=", "(", ")", ")", ":", "conn", "=", "self", ".", "_get_db", "(", ")", "if", "args", ":", "fmt", "=", "'@_{0}_%d=%s'", ".", "format", "(", "procname", ")", "self", ".", "_query", "(", ...
Execute stored procedure procname with args procname -- string, name of procedure to execute on server args -- Sequence of parameters to use with procedure Returns the original args. Compatibility warning: PEP-249 specifies that any modified parameters must be returned. This ...
[ "Execute", "stored", "procedure", "procname", "with", "args" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/cursors.py#L231-L271
train
Execute a stored procedure procname with args returning the original args.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/cursors.py
Cursor.fetchone
def fetchone(self): """Fetch the next row""" self._check_executed() if self._rows is None or self.rownumber >= len(self._rows): return None result = self._rows[self.rownumber] self.rownumber += 1 return result
python
def fetchone(self): """Fetch the next row""" self._check_executed() if self._rows is None or self.rownumber >= len(self._rows): return None result = self._rows[self.rownumber] self.rownumber += 1 return result
[ "def", "fetchone", "(", "self", ")", ":", "self", ".", "_check_executed", "(", ")", "if", "self", ".", "_rows", "is", "None", "or", "self", ".", "rownumber", ">=", "len", "(", "self", ".", "_rows", ")", ":", "return", "None", "result", "=", "self", ...
Fetch the next row
[ "Fetch", "the", "next", "row" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/cursors.py#L273-L280
train
Fetch the next row from the table.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/cursors.py
Cursor.fetchmany
def fetchmany(self, size=None): """Fetch several rows""" self._check_executed() if self._rows is None: return () end = self.rownumber + (size or self.arraysize) result = self._rows[self.rownumber:end] self.rownumber = min(end, len(self._rows)) return r...
python
def fetchmany(self, size=None): """Fetch several rows""" self._check_executed() if self._rows is None: return () end = self.rownumber + (size or self.arraysize) result = self._rows[self.rownumber:end] self.rownumber = min(end, len(self._rows)) return r...
[ "def", "fetchmany", "(", "self", ",", "size", "=", "None", ")", ":", "self", ".", "_check_executed", "(", ")", "if", "self", ".", "_rows", "is", "None", ":", "return", "(", ")", "end", "=", "self", ".", "rownumber", "+", "(", "size", "or", "self", ...
Fetch several rows
[ "Fetch", "several", "rows" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/cursors.py#L282-L290
train
Fetch several rows from the table.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/cursors.py
Cursor.fetchall
def fetchall(self): """Fetch all the rows""" self._check_executed() if self._rows is None: return () if self.rownumber: result = self._rows[self.rownumber:] else: result = self._rows self.rownumber = len(self._rows) return resul...
python
def fetchall(self): """Fetch all the rows""" self._check_executed() if self._rows is None: return () if self.rownumber: result = self._rows[self.rownumber:] else: result = self._rows self.rownumber = len(self._rows) return resul...
[ "def", "fetchall", "(", "self", ")", ":", "self", ".", "_check_executed", "(", ")", "if", "self", ".", "_rows", "is", "None", ":", "return", "(", ")", "if", "self", ".", "rownumber", ":", "result", "=", "self", ".", "_rows", "[", "self", ".", "rown...
Fetch all the rows
[ "Fetch", "all", "the", "rows" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/cursors.py#L292-L302
train
Fetch all the rows
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/cursors.py
SSCursor.fetchone
def fetchone(self): """Fetch next row""" self._check_executed() row = self.read_next() if row is None: return None self.rownumber += 1 return row
python
def fetchone(self): """Fetch next row""" self._check_executed() row = self.read_next() if row is None: return None self.rownumber += 1 return row
[ "def", "fetchone", "(", "self", ")", ":", "self", ".", "_check_executed", "(", ")", "row", "=", "self", ".", "read_next", "(", ")", "if", "row", "is", "None", ":", "return", "None", "self", ".", "rownumber", "+=", "1", "return", "row" ]
Fetch next row
[ "Fetch", "next", "row" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/cursors.py#L437-L444
train
Fetch next row from the table.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/cursors.py
SSCursor.fetchmany
def fetchmany(self, size=None): """Fetch many""" self._check_executed() if size is None: size = self.arraysize rows = [] for i in range_type(size): row = self.read_next() if row is None: break rows.append(row) ...
python
def fetchmany(self, size=None): """Fetch many""" self._check_executed() if size is None: size = self.arraysize rows = [] for i in range_type(size): row = self.read_next() if row is None: break rows.append(row) ...
[ "def", "fetchmany", "(", "self", ",", "size", "=", "None", ")", ":", "self", ".", "_check_executed", "(", ")", "if", "size", "is", "None", ":", "size", "=", "self", ".", "arraysize", "rows", "=", "[", "]", "for", "i", "in", "range_type", "(", "size...
Fetch many
[ "Fetch", "many" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/cursors.py#L465-L478
train
Fetch many entries from the table.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/converters.py
convert_datetime
def convert_datetime(obj): """Returns a DATETIME or TIMESTAMP column value as a datetime object: >>> datetime_or_None('2007-02-25 23:06:20') datetime.datetime(2007, 2, 25, 23, 6, 20) >>> datetime_or_None('2007-02-25T23:06:20') datetime.datetime(2007, 2, 25, 23, 6, 20) Illegal values ar...
python
def convert_datetime(obj): """Returns a DATETIME or TIMESTAMP column value as a datetime object: >>> datetime_or_None('2007-02-25 23:06:20') datetime.datetime(2007, 2, 25, 23, 6, 20) >>> datetime_or_None('2007-02-25T23:06:20') datetime.datetime(2007, 2, 25, 23, 6, 20) Illegal values ar...
[ "def", "convert_datetime", "(", "obj", ")", ":", "if", "not", "PY2", "and", "isinstance", "(", "obj", ",", "(", "bytes", ",", "bytearray", ")", ")", ":", "obj", "=", "obj", ".", "decode", "(", "'ascii'", ")", "m", "=", "DATETIME_RE", ".", "match", ...
Returns a DATETIME or TIMESTAMP column value as a datetime object: >>> datetime_or_None('2007-02-25 23:06:20') datetime.datetime(2007, 2, 25, 23, 6, 20) >>> datetime_or_None('2007-02-25T23:06:20') datetime.datetime(2007, 2, 25, 23, 6, 20) Illegal values are returned as None: >>> dat...
[ "Returns", "a", "DATETIME", "or", "TIMESTAMP", "column", "value", "as", "a", "datetime", "object", ":" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/converters.py#L167-L195
train
Converts a string representing a datetime or TIMESTAMP column value into a datetime object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/converters.py
convert_timedelta
def convert_timedelta(obj): """Returns a TIME column as a timedelta object: >>> timedelta_or_None('25:06:17') datetime.timedelta(1, 3977) >>> timedelta_or_None('-25:06:17') datetime.timedelta(-2, 83177) Illegal values are returned as None: >>> timedelta_or_None('random crap') is...
python
def convert_timedelta(obj): """Returns a TIME column as a timedelta object: >>> timedelta_or_None('25:06:17') datetime.timedelta(1, 3977) >>> timedelta_or_None('-25:06:17') datetime.timedelta(-2, 83177) Illegal values are returned as None: >>> timedelta_or_None('random crap') is...
[ "def", "convert_timedelta", "(", "obj", ")", ":", "if", "not", "PY2", "and", "isinstance", "(", "obj", ",", "(", "bytes", ",", "bytearray", ")", ")", ":", "obj", "=", "obj", ".", "decode", "(", "'ascii'", ")", "m", "=", "TIMEDELTA_RE", ".", "match", ...
Returns a TIME column as a timedelta object: >>> timedelta_or_None('25:06:17') datetime.timedelta(1, 3977) >>> timedelta_or_None('-25:06:17') datetime.timedelta(-2, 83177) Illegal values are returned as None: >>> timedelta_or_None('random crap') is None True Note that MyS...
[ "Returns", "a", "TIME", "column", "as", "a", "timedelta", "object", ":" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/converters.py#L200-L238
train
Convert a TIME column into a timedelta object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/converters.py
convert_time
def convert_time(obj): """Returns a TIME column as a time object: >>> time_or_None('15:06:17') datetime.time(15, 6, 17) Illegal values are returned as None: >>> time_or_None('-25:06:17') is None True >>> time_or_None('random crap') is None True Note that MySQL always ...
python
def convert_time(obj): """Returns a TIME column as a time object: >>> time_or_None('15:06:17') datetime.time(15, 6, 17) Illegal values are returned as None: >>> time_or_None('-25:06:17') is None True >>> time_or_None('random crap') is None True Note that MySQL always ...
[ "def", "convert_time", "(", "obj", ")", ":", "if", "not", "PY2", "and", "isinstance", "(", "obj", ",", "(", "bytes", ",", "bytearray", ")", ")", ":", "obj", "=", "obj", ".", "decode", "(", "'ascii'", ")", "m", "=", "TIME_RE", ".", "match", "(", "...
Returns a TIME column as a time object: >>> time_or_None('15:06:17') datetime.time(15, 6, 17) Illegal values are returned as None: >>> time_or_None('-25:06:17') is None True >>> time_or_None('random crap') is None True Note that MySQL always returns TIME columns as (+|-)H...
[ "Returns", "a", "TIME", "column", "as", "a", "time", "object", ":" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/converters.py#L243-L279
train
Convert a TIME column into a time object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/converters.py
convert_date
def convert_date(obj): """Returns a DATE column as a date object: >>> date_or_None('2007-02-26') datetime.date(2007, 2, 26) Illegal values are returned as None: >>> date_or_None('2007-02-31') is None True >>> date_or_None('0000-00-00') is None True """ if not PY2 ...
python
def convert_date(obj): """Returns a DATE column as a date object: >>> date_or_None('2007-02-26') datetime.date(2007, 2, 26) Illegal values are returned as None: >>> date_or_None('2007-02-31') is None True >>> date_or_None('0000-00-00') is None True """ if not PY2 ...
[ "def", "convert_date", "(", "obj", ")", ":", "if", "not", "PY2", "and", "isinstance", "(", "obj", ",", "(", "bytes", ",", "bytearray", ")", ")", ":", "obj", "=", "obj", ".", "decode", "(", "'ascii'", ")", "try", ":", "return", "datetime", ".", "dat...
Returns a DATE column as a date object: >>> date_or_None('2007-02-26') datetime.date(2007, 2, 26) Illegal values are returned as None: >>> date_or_None('2007-02-31') is None True >>> date_or_None('0000-00-00') is None True
[ "Returns", "a", "DATE", "column", "as", "a", "date", "object", ":" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/converters.py#L282-L301
train
Converts a string to a DATE column.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/_socketio.py
SocketIO.write
def write(self, b): """Write the given bytes or bytearray object *b* to the socket and return the number of bytes written. This can be less than len(b) if not all data could be written. If the socket is non-blocking and no bytes could be written None is returned. """ se...
python
def write(self, b): """Write the given bytes or bytearray object *b* to the socket and return the number of bytes written. This can be less than len(b) if not all data could be written. If the socket is non-blocking and no bytes could be written None is returned. """ se...
[ "def", "write", "(", "self", ",", "b", ")", ":", "self", ".", "_checkClosed", "(", ")", "self", ".", "_checkWritable", "(", ")", "try", ":", "return", "self", ".", "_sock", ".", "send", "(", "b", ")", "except", "error", "as", "e", ":", "# XXX what ...
Write the given bytes or bytearray object *b* to the socket and return the number of bytes written. This can be less than len(b) if not all data could be written. If the socket is non-blocking and no bytes could be written None is returned.
[ "Write", "the", "given", "bytes", "or", "bytearray", "object", "*", "b", "*", "to", "the", "socket", "and", "return", "the", "number", "of", "bytes", "written", ".", "This", "can", "be", "less", "than", "len", "(", "b", ")", "if", "not", "all", "data...
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/_socketio.py#L71-L85
train
Write the given bytes or bytearray object b to the socket returning the number of bytes written.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/_socketio.py
SocketIO.close
def close(self): """Close the SocketIO object. This doesn't close the underlying socket, except if all references to it have disappeared. """ if self.closed: return io.RawIOBase.close(self) self._sock._decref_socketios() self._sock = None
python
def close(self): """Close the SocketIO object. This doesn't close the underlying socket, except if all references to it have disappeared. """ if self.closed: return io.RawIOBase.close(self) self._sock._decref_socketios() self._sock = None
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "closed", ":", "return", "io", ".", "RawIOBase", ".", "close", "(", "self", ")", "self", ".", "_sock", ".", "_decref_socketios", "(", ")", "self", ".", "_sock", "=", "None" ]
Close the SocketIO object. This doesn't close the underlying socket, except if all references to it have disappeared.
[ "Close", "the", "SocketIO", "object", ".", "This", "doesn", "t", "close", "the", "underlying", "socket", "except", "if", "all", "references", "to", "it", "have", "disappeared", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/_socketio.py#L125-L133
train
This doesn t close the underlying socket.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/protocol.py
MysqlPacket.read
def read(self, size): """Read the first 'size' bytes in packet and advance cursor past them.""" result = self._data[self._position:(self._position+size)] if len(result) != size: error = ('Result length not requested length:\n' 'Expected=%s. Actual=%s. Position:...
python
def read(self, size): """Read the first 'size' bytes in packet and advance cursor past them.""" result = self._data[self._position:(self._position+size)] if len(result) != size: error = ('Result length not requested length:\n' 'Expected=%s. Actual=%s. Position:...
[ "def", "read", "(", "self", ",", "size", ")", ":", "result", "=", "self", ".", "_data", "[", "self", ".", "_position", ":", "(", "self", ".", "_position", "+", "size", ")", "]", "if", "len", "(", "result", ")", "!=", "size", ":", "error", "=", ...
Read the first 'size' bytes in packet and advance cursor past them.
[ "Read", "the", "first", "size", "bytes", "in", "packet", "and", "advance", "cursor", "past", "them", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/protocol.py#L63-L75
train
Read the first size bytes in packet and advance cursor past them.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/protocol.py
MysqlPacket.read_all
def read_all(self): """Read all remaining data in the packet. (Subsequent read() will return errors.) """ result = self._data[self._position:] self._position = None # ensure no subsequent read() return result
python
def read_all(self): """Read all remaining data in the packet. (Subsequent read() will return errors.) """ result = self._data[self._position:] self._position = None # ensure no subsequent read() return result
[ "def", "read_all", "(", "self", ")", ":", "result", "=", "self", ".", "_data", "[", "self", ".", "_position", ":", "]", "self", ".", "_position", "=", "None", "# ensure no subsequent read()", "return", "result" ]
Read all remaining data in the packet. (Subsequent read() will return errors.)
[ "Read", "all", "remaining", "data", "in", "the", "packet", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/protocol.py#L77-L84
train
Read all remaining data in the packet.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/protocol.py
MysqlPacket.advance
def advance(self, length): """Advance the cursor in data buffer 'length' bytes.""" new_position = self._position + length if new_position < 0 or new_position > len(self._data): raise Exception('Invalid advance amount (%s) for cursor. ' 'Position=%s' % (le...
python
def advance(self, length): """Advance the cursor in data buffer 'length' bytes.""" new_position = self._position + length if new_position < 0 or new_position > len(self._data): raise Exception('Invalid advance amount (%s) for cursor. ' 'Position=%s' % (le...
[ "def", "advance", "(", "self", ",", "length", ")", ":", "new_position", "=", "self", ".", "_position", "+", "length", "if", "new_position", "<", "0", "or", "new_position", ">", "len", "(", "self", ".", "_data", ")", ":", "raise", "Exception", "(", "'In...
Advance the cursor in data buffer 'length' bytes.
[ "Advance", "the", "cursor", "in", "data", "buffer", "length", "bytes", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/protocol.py#L86-L92
train
Advance the cursor in data buffer length bytes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/protocol.py
MysqlPacket.rewind
def rewind(self, position=0): """Set the position of the data buffer cursor to 'position'.""" if position < 0 or position > len(self._data): raise Exception("Invalid position to rewind cursor to: %s." % position) self._position = position
python
def rewind(self, position=0): """Set the position of the data buffer cursor to 'position'.""" if position < 0 or position > len(self._data): raise Exception("Invalid position to rewind cursor to: %s." % position) self._position = position
[ "def", "rewind", "(", "self", ",", "position", "=", "0", ")", ":", "if", "position", "<", "0", "or", "position", ">", "len", "(", "self", ".", "_data", ")", ":", "raise", "Exception", "(", "\"Invalid position to rewind cursor to: %s.\"", "%", "position", "...
Set the position of the data buffer cursor to 'position'.
[ "Set", "the", "position", "of", "the", "data", "buffer", "cursor", "to", "position", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/protocol.py#L94-L98
train
Set the position of the data buffer cursor to position.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/protocol.py
MysqlPacket.read_length_encoded_integer
def read_length_encoded_integer(self): """Read a 'Length Coded Binary' number from the data buffer. Length coded numbers can be anywhere from 1 to 9 bytes depending on the value of the first byte. """ c = self.read_uint8() if c == NULL_COLUMN: return None ...
python
def read_length_encoded_integer(self): """Read a 'Length Coded Binary' number from the data buffer. Length coded numbers can be anywhere from 1 to 9 bytes depending on the value of the first byte. """ c = self.read_uint8() if c == NULL_COLUMN: return None ...
[ "def", "read_length_encoded_integer", "(", "self", ")", ":", "c", "=", "self", ".", "read_uint8", "(", ")", "if", "c", "==", "NULL_COLUMN", ":", "return", "None", "if", "c", "<", "UNSIGNED_CHAR_COLUMN", ":", "return", "c", "elif", "c", "==", "UNSIGNED_SHOR...
Read a 'Length Coded Binary' number from the data buffer. Length coded numbers can be anywhere from 1 to 9 bytes depending on the value of the first byte.
[ "Read", "a", "Length", "Coded", "Binary", "number", "from", "the", "data", "buffer", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/protocol.py#L150-L166
train
Reads a Length Coded Binary number from the data buffer.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/protocol.py
FieldDescriptorPacket._parse_field_descriptor
def _parse_field_descriptor(self, encoding): """Parse the 'Field Descriptor' (Metadata) packet. This is compatible with MySQL 4.1+ (not compatible with MySQL 4.0). """ self.catalog = self.read_length_coded_string() self.db = self.read_length_coded_string() self.table_nam...
python
def _parse_field_descriptor(self, encoding): """Parse the 'Field Descriptor' (Metadata) packet. This is compatible with MySQL 4.1+ (not compatible with MySQL 4.0). """ self.catalog = self.read_length_coded_string() self.db = self.read_length_coded_string() self.table_nam...
[ "def", "_parse_field_descriptor", "(", "self", ",", "encoding", ")", ":", "self", ".", "catalog", "=", "self", ".", "read_length_coded_string", "(", ")", "self", ".", "db", "=", "self", ".", "read_length_coded_string", "(", ")", "self", ".", "table_name", "=...
Parse the 'Field Descriptor' (Metadata) packet. This is compatible with MySQL 4.1+ (not compatible with MySQL 4.0).
[ "Parse", "the", "Field", "Descriptor", "(", "Metadata", ")", "packet", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/protocol.py#L237-L249
train
Parse the Field Descriptor packet.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/protocol.py
FieldDescriptorPacket.description
def description(self): """Provides a 7-item tuple compatible with the Python PEP249 DB Spec.""" return ( self.name, self.type_code, None, # TODO: display_length; should this be self.length? self.get_column_length(), # 'internal_size' self.get...
python
def description(self): """Provides a 7-item tuple compatible with the Python PEP249 DB Spec.""" return ( self.name, self.type_code, None, # TODO: display_length; should this be self.length? self.get_column_length(), # 'internal_size' self.get...
[ "def", "description", "(", "self", ")", ":", "return", "(", "self", ".", "name", ",", "self", ".", "type_code", ",", "None", ",", "# TODO: display_length; should this be self.length?", "self", ".", "get_column_length", "(", ")", ",", "# 'internal_size'", "self", ...
Provides a 7-item tuple compatible with the Python PEP249 DB Spec.
[ "Provides", "a", "7", "-", "item", "tuple", "compatible", "with", "the", "Python", "PEP249", "DB", "Spec", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/protocol.py#L253-L262
train
Provides a 7 - item tuple compatible with the Python PEP249 DB Spec.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/connections.py
Connection.close
def close(self): """ Send the quit message and close the socket. See `Connection.close() <https://www.python.org/dev/peps/pep-0249/#Connection.close>`_ in the specification. :raise Error: If the connection is already closed. """ if self._closed: rais...
python
def close(self): """ Send the quit message and close the socket. See `Connection.close() <https://www.python.org/dev/peps/pep-0249/#Connection.close>`_ in the specification. :raise Error: If the connection is already closed. """ if self._closed: rais...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_closed", ":", "raise", "err", ".", "Error", "(", "\"Already closed\"", ")", "self", ".", "_closed", "=", "True", "if", "self", ".", "_sock", "is", "None", ":", "return", "send_data", "=", "s...
Send the quit message and close the socket. See `Connection.close() <https://www.python.org/dev/peps/pep-0249/#Connection.close>`_ in the specification. :raise Error: If the connection is already closed.
[ "Send", "the", "quit", "message", "and", "close", "the", "socket", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/connections.py#L344-L364
train
Send a quit message and close the socket.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/connections.py
Connection._force_close
def _force_close(self): """Close connection without QUIT message""" if self._sock: try: self._sock.close() except: # noqa pass self._sock = None self._rfile = None
python
def _force_close(self): """Close connection without QUIT message""" if self._sock: try: self._sock.close() except: # noqa pass self._sock = None self._rfile = None
[ "def", "_force_close", "(", "self", ")", ":", "if", "self", ".", "_sock", ":", "try", ":", "self", ".", "_sock", ".", "close", "(", ")", "except", ":", "# noqa", "pass", "self", ".", "_sock", "=", "None", "self", ".", "_rfile", "=", "None" ]
Close connection without QUIT message
[ "Close", "connection", "without", "QUIT", "message" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/connections.py#L371-L379
train
Close connection without QUIT message
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/connections.py
Connection._send_autocommit_mode
def _send_autocommit_mode(self): """Set whether or not to commit after every execute()""" self._execute_command(COMMAND.COM_QUERY, "SET AUTOCOMMIT = %s" % self.escape(self.autocommit_mode)) self._read_ok_packet()
python
def _send_autocommit_mode(self): """Set whether or not to commit after every execute()""" self._execute_command(COMMAND.COM_QUERY, "SET AUTOCOMMIT = %s" % self.escape(self.autocommit_mode)) self._read_ok_packet()
[ "def", "_send_autocommit_mode", "(", "self", ")", ":", "self", ".", "_execute_command", "(", "COMMAND", ".", "COM_QUERY", ",", "\"SET AUTOCOMMIT = %s\"", "%", "self", ".", "escape", "(", "self", ".", "autocommit_mode", ")", ")", "self", ".", "_read_ok_packet", ...
Set whether or not to commit after every execute()
[ "Set", "whether", "or", "not", "to", "commit", "after", "every", "execute", "()" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/connections.py#L401-L405
train
Set whether or not to commit after every execute
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/connections.py
Connection.escape
def escape(self, obj, mapping=None): """Escape whatever value you pass to it. Non-standard, for internal use; do not use this in your applications. """ if isinstance(obj, str_type): return "'" + self.escape_string(obj) + "'" if isinstance(obj, (bytes, bytearray)): ...
python
def escape(self, obj, mapping=None): """Escape whatever value you pass to it. Non-standard, for internal use; do not use this in your applications. """ if isinstance(obj, str_type): return "'" + self.escape_string(obj) + "'" if isinstance(obj, (bytes, bytearray)): ...
[ "def", "escape", "(", "self", ",", "obj", ",", "mapping", "=", "None", ")", ":", "if", "isinstance", "(", "obj", ",", "str_type", ")", ":", "return", "\"'\"", "+", "self", ".", "escape_string", "(", "obj", ")", "+", "\"'\"", "if", "isinstance", "(", ...
Escape whatever value you pass to it. Non-standard, for internal use; do not use this in your applications.
[ "Escape", "whatever", "value", "you", "pass", "to", "it", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/connections.py#L448-L460
train
Escape the value you pass to it.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/connections.py
Connection.ping
def ping(self, reconnect=True): """ Check if the server is alive. :param reconnect: If the connection is closed, reconnect. :raise Error: If the connection is closed and reconnect=False. """ if self._sock is None: if reconnect: self.connect() ...
python
def ping(self, reconnect=True): """ Check if the server is alive. :param reconnect: If the connection is closed, reconnect. :raise Error: If the connection is closed and reconnect=False. """ if self._sock is None: if reconnect: self.connect() ...
[ "def", "ping", "(", "self", ",", "reconnect", "=", "True", ")", ":", "if", "self", ".", "_sock", "is", "None", ":", "if", "reconnect", ":", "self", ".", "connect", "(", ")", "reconnect", "=", "False", "else", ":", "raise", "err", ".", "Error", "(",...
Check if the server is alive. :param reconnect: If the connection is closed, reconnect. :raise Error: If the connection is closed and reconnect=False.
[ "Check", "if", "the", "server", "is", "alive", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/connections.py#L518-L539
train
Check if the server is alive.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/connections.py
Connection._read_packet
def _read_packet(self, packet_type=MysqlPacket): """Read an entire "mysql packet" in its entirety from the network and return a MysqlPacket type that represents the results. :raise OperationalError: If the connection to the MySQL server is lost. :raise InternalError: If the packet seque...
python
def _read_packet(self, packet_type=MysqlPacket): """Read an entire "mysql packet" in its entirety from the network and return a MysqlPacket type that represents the results. :raise OperationalError: If the connection to the MySQL server is lost. :raise InternalError: If the packet seque...
[ "def", "_read_packet", "(", "self", ",", "packet_type", "=", "MysqlPacket", ")", ":", "buff", "=", "bytearray", "(", ")", "while", "True", ":", "packet_header", "=", "self", ".", "_read_bytes", "(", "4", ")", "#if DEBUG: dump_packet(packet_header)", "btrl", ",...
Read an entire "mysql packet" in its entirety from the network and return a MysqlPacket type that represents the results. :raise OperationalError: If the connection to the MySQL server is lost. :raise InternalError: If the packet sequence number is wrong.
[ "Read", "an", "entire", "mysql", "packet", "in", "its", "entirety", "from", "the", "network", "and", "return", "a", "MysqlPacket", "type", "that", "represents", "the", "results", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/connections.py#L635-L672
train
Read an entire mysql packet in its entirety and return a MysqlPacket type that represents the results.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/connections.py
Connection._execute_command
def _execute_command(self, command, sql): """ :raise InterfaceError: If the connection is closed. :raise ValueError: If no username was specified. """ if not self._sock: raise err.InterfaceError("(0, '')") # If the last query was unbuffered, make sure it fini...
python
def _execute_command(self, command, sql): """ :raise InterfaceError: If the connection is closed. :raise ValueError: If no username was specified. """ if not self._sock: raise err.InterfaceError("(0, '')") # If the last query was unbuffered, make sure it fini...
[ "def", "_execute_command", "(", "self", ",", "command", ",", "sql", ")", ":", "if", "not", "self", ".", "_sock", ":", "raise", "err", ".", "InterfaceError", "(", "\"(0, '')\"", ")", "# If the last query was unbuffered, make sure it finishes before", "# sending new com...
:raise InterfaceError: If the connection is closed. :raise ValueError: If no username was specified.
[ ":", "raise", "InterfaceError", ":", "If", "the", "connection", "is", "closed", ".", ":", "raise", "ValueError", ":", "If", "no", "username", "was", "specified", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/connections.py#L731-L771
train
Execute a command and return the result.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/connections.py
LoadLocalFile.send_data
def send_data(self): """Send data packets from the local file to the server""" if not self.connection._sock: raise err.InterfaceError("(0, '')") conn = self.connection try: with open(self.filename, 'rb') as open_file: packet_size = min(conn.max_al...
python
def send_data(self): """Send data packets from the local file to the server""" if not self.connection._sock: raise err.InterfaceError("(0, '')") conn = self.connection try: with open(self.filename, 'rb') as open_file: packet_size = min(conn.max_al...
[ "def", "send_data", "(", "self", ")", ":", "if", "not", "self", ".", "connection", ".", "_sock", ":", "raise", "err", ".", "InterfaceError", "(", "\"(0, '')\"", ")", "conn", "=", "self", ".", "connection", "try", ":", "with", "open", "(", "self", ".", ...
Send data packets from the local file to the server
[ "Send", "data", "packets", "from", "the", "local", "file", "to", "the", "server" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/connections.py#L1248-L1266
train
Send data packets from the local file to the server
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/_auth.py
scramble_native_password
def scramble_native_password(password, message): """Scramble used for mysql_native_password""" if not password: return b'' stage1 = sha1_new(password).digest() stage2 = sha1_new(stage1).digest() s = sha1_new() s.update(message[:SCRAMBLE_LENGTH]) s.update(stage2) result = s.diges...
python
def scramble_native_password(password, message): """Scramble used for mysql_native_password""" if not password: return b'' stage1 = sha1_new(password).digest() stage2 = sha1_new(stage1).digest() s = sha1_new() s.update(message[:SCRAMBLE_LENGTH]) s.update(stage2) result = s.diges...
[ "def", "scramble_native_password", "(", "password", ",", "message", ")", ":", "if", "not", "password", ":", "return", "b''", "stage1", "=", "sha1_new", "(", "password", ")", ".", "digest", "(", ")", "stage2", "=", "sha1_new", "(", "stage1", ")", ".", "di...
Scramble used for mysql_native_password
[ "Scramble", "used", "for", "mysql_native_password" ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/_auth.py#L34-L45
train
Scramble used for mysql_native_password
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/_auth.py
sha2_rsa_encrypt
def sha2_rsa_encrypt(password, salt, public_key): """Encrypt password with salt and public_key. Used for sha256_password and caching_sha2_password. """ if not _have_cryptography: raise RuntimeError("'cryptography' package is required for sha256_password or caching_sha2_password auth methods") ...
python
def sha2_rsa_encrypt(password, salt, public_key): """Encrypt password with salt and public_key. Used for sha256_password and caching_sha2_password. """ if not _have_cryptography: raise RuntimeError("'cryptography' package is required for sha256_password or caching_sha2_password auth methods") ...
[ "def", "sha2_rsa_encrypt", "(", "password", ",", "salt", ",", "public_key", ")", ":", "if", "not", "_have_cryptography", ":", "raise", "RuntimeError", "(", "\"'cryptography' package is required for sha256_password or caching_sha2_password auth methods\"", ")", "message", "=",...
Encrypt password with salt and public_key. Used for sha256_password and caching_sha2_password.
[ "Encrypt", "password", "with", "salt", "and", "public_key", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/_auth.py#L136-L152
train
Encrypt password with salt and public_key. Used for sha256_password and caching_sha2_password auth methods.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
PyMySQL/PyMySQL
pymysql/_auth.py
scramble_caching_sha2
def scramble_caching_sha2(password, nonce): # (bytes, bytes) -> bytes """Scramble algorithm used in cached_sha2_password fast path. XOR(SHA256(password), SHA256(SHA256(SHA256(password)), nonce)) """ if not password: return b'' p1 = hashlib.sha256(password).digest() p2 = hashlib.sha...
python
def scramble_caching_sha2(password, nonce): # (bytes, bytes) -> bytes """Scramble algorithm used in cached_sha2_password fast path. XOR(SHA256(password), SHA256(SHA256(SHA256(password)), nonce)) """ if not password: return b'' p1 = hashlib.sha256(password).digest() p2 = hashlib.sha...
[ "def", "scramble_caching_sha2", "(", "password", ",", "nonce", ")", ":", "# (bytes, bytes) -> bytes", "if", "not", "password", ":", "return", "b''", "p1", "=", "hashlib", ".", "sha256", "(", "password", ")", ".", "digest", "(", ")", "p2", "=", "hashlib", "...
Scramble algorithm used in cached_sha2_password fast path. XOR(SHA256(password), SHA256(SHA256(SHA256(password)), nonce))
[ "Scramble", "algorithm", "used", "in", "cached_sha2_password", "fast", "path", "." ]
3674bc6fd064bf88524e839c07690e8c35223709
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/_auth.py#L186-L205
train
Scramble algorithm used in cached_sha2_password fast path.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
playhouse/sqlite_ext.py
ClosureTable
def ClosureTable(model_class, foreign_key=None, referencing_class=None, referencing_key=None): """Model factory for the transitive closure extension.""" if referencing_class is None: referencing_class = model_class if foreign_key is None: for field_obj in model_class._meta....
python
def ClosureTable(model_class, foreign_key=None, referencing_class=None, referencing_key=None): """Model factory for the transitive closure extension.""" if referencing_class is None: referencing_class = model_class if foreign_key is None: for field_obj in model_class._meta....
[ "def", "ClosureTable", "(", "model_class", ",", "foreign_key", "=", "None", ",", "referencing_class", "=", "None", ",", "referencing_key", "=", "None", ")", ":", "if", "referencing_class", "is", "None", ":", "referencing_class", "=", "model_class", "if", "foreig...
Model factory for the transitive closure extension.
[ "Model", "factory", "for", "the", "transitive", "closure", "extension", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L719-L807
train
Model factory for the transitive closure extension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
playhouse/sqlite_ext.py
bm25
def bm25(raw_match_info, *args): """ Usage: # Format string *must* be pcnalx # Second parameter to bm25 specifies the index of the column, on # the table being queries. bm25(matchinfo(document_tbl, 'pcnalx'), 1) AS rank """ match_info = _parse_match_info(raw_match_info) ...
python
def bm25(raw_match_info, *args): """ Usage: # Format string *must* be pcnalx # Second parameter to bm25 specifies the index of the column, on # the table being queries. bm25(matchinfo(document_tbl, 'pcnalx'), 1) AS rank """ match_info = _parse_match_info(raw_match_info) ...
[ "def", "bm25", "(", "raw_match_info", ",", "*", "args", ")", ":", "match_info", "=", "_parse_match_info", "(", "raw_match_info", ")", "K", "=", "1.2", "B", "=", "0.75", "score", "=", "0.0", "P_O", ",", "C_O", ",", "N_O", ",", "A_O", "=", "range", "("...
Usage: # Format string *must* be pcnalx # Second parameter to bm25 specifies the index of the column, on # the table being queries. bm25(matchinfo(document_tbl, 'pcnalx'), 1) AS rank
[ "Usage", ":" ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L1172-L1223
train
This function is used to generate a new n ivgs from the matchinfo output.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
playhouse/sqlite_ext.py
FTSModel.search
def search(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" return cls._search( term, weights, with_score, score_alias, cls.rank, ...
python
def search(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" return cls._search( term, weights, with_score, score_alias, cls.rank, ...
[ "def", "search", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "return", "cls", ".", "_search", "(", "term", ",", "weights", ...
Full-text search using selected `term`.
[ "Full", "-", "text", "search", "using", "selected", "term", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L391-L400
train
Full - text search using selected term.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
playhouse/sqlite_ext.py
FTSModel.search_bm25
def search_bm25(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search for selected `term` using BM25 algorithm.""" return cls._search( term, weights, with_score, score_alias, ...
python
def search_bm25(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search for selected `term` using BM25 algorithm.""" return cls._search( term, weights, with_score, score_alias, ...
[ "def", "search_bm25", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "return", "cls", ".", "_search", "(", "term", ",", "weights...
Full-text search for selected `term` using BM25 algorithm.
[ "Full", "-", "text", "search", "for", "selected", "term", "using", "BM25", "algorithm", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L403-L412
train
Full - text search for selected term using BM25 algorithm.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
playhouse/sqlite_ext.py
FTSModel.search_bm25f
def search_bm25f(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search for selected `term` using BM25 algorithm.""" return cls._search( term, weights, with_score, score_alias, ...
python
def search_bm25f(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search for selected `term` using BM25 algorithm.""" return cls._search( term, weights, with_score, score_alias, ...
[ "def", "search_bm25f", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "return", "cls", ".", "_search", "(", "term", ",", "weight...
Full-text search for selected `term` using BM25 algorithm.
[ "Full", "-", "text", "search", "for", "selected", "term", "using", "BM25", "algorithm", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L415-L424
train
Full - text search for selected term using BM25 algorithm.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
playhouse/sqlite_ext.py
FTSModel.search_lucene
def search_lucene(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search for selected `term` using BM25 algorithm.""" return cls._search( term, weights, with_score, score_alias, ...
python
def search_lucene(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search for selected `term` using BM25 algorithm.""" return cls._search( term, weights, with_score, score_alias, ...
[ "def", "search_lucene", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "return", "cls", ".", "_search", "(", "term", ",", "weigh...
Full-text search for selected `term` using BM25 algorithm.
[ "Full", "-", "text", "search", "for", "selected", "term", "using", "BM25", "algorithm", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L427-L436
train
Full - text search for selected term using Lucene search.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
playhouse/sqlite_ext.py
FTS5Model.validate_query
def validate_query(query): """ Simple helper function to indicate whether a search query is a valid FTS5 query. Note: this simply looks at the characters being used, and is not guaranteed to catch all problematic queries. """ tokens = _quote_re.findall(query) for ...
python
def validate_query(query): """ Simple helper function to indicate whether a search query is a valid FTS5 query. Note: this simply looks at the characters being used, and is not guaranteed to catch all problematic queries. """ tokens = _quote_re.findall(query) for ...
[ "def", "validate_query", "(", "query", ")", ":", "tokens", "=", "_quote_re", ".", "findall", "(", "query", ")", "for", "token", "in", "tokens", ":", "if", "token", ".", "startswith", "(", "'\"'", ")", "and", "token", ".", "endswith", "(", "'\"'", ")", ...
Simple helper function to indicate whether a search query is a valid FTS5 query. Note: this simply looks at the characters being used, and is not guaranteed to catch all problematic queries.
[ "Simple", "helper", "function", "to", "indicate", "whether", "a", "search", "query", "is", "a", "valid", "FTS5", "query", ".", "Note", ":", "this", "simply", "looks", "at", "the", "characters", "being", "used", "and", "is", "not", "guaranteed", "to", "catc...
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L550-L562
train
Simple helper function to indicate whether a search query is a valid FTS5 query.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
playhouse/sqlite_ext.py
FTS5Model.clean_query
def clean_query(query, replace=chr(26)): """ Clean a query of invalid tokens. """ accum = [] any_invalid = False tokens = _quote_re.findall(query) for token in tokens: if token.startswith('"') and token.endswith('"'): accum.append(token...
python
def clean_query(query, replace=chr(26)): """ Clean a query of invalid tokens. """ accum = [] any_invalid = False tokens = _quote_re.findall(query) for token in tokens: if token.startswith('"') and token.endswith('"'): accum.append(token...
[ "def", "clean_query", "(", "query", ",", "replace", "=", "chr", "(", "26", ")", ")", ":", "accum", "=", "[", "]", "any_invalid", "=", "False", "tokens", "=", "_quote_re", ".", "findall", "(", "query", ")", "for", "token", "in", "tokens", ":", "if", ...
Clean a query of invalid tokens.
[ "Clean", "a", "query", "of", "invalid", "tokens", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L565-L586
train
Clean a query of invalid tokens.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
playhouse/sqlite_ext.py
FTS5Model.search
def search(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" return cls.search_bm25( FTS5Model.clean_query(term), weights, with_score, score_alias, ...
python
def search(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" return cls.search_bm25( FTS5Model.clean_query(term), weights, with_score, score_alias, ...
[ "def", "search", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "return", "cls", ".", "search_bm25", "(", "FTS5Model", ".", "cle...
Full-text search using selected `term`.
[ "Full", "-", "text", "search", "using", "selected", "term", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L604-L612
train
Full - text search using selected term.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
playhouse/sqlite_ext.py
FTS5Model.search_bm25
def search_bm25(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" if not weights: rank = SQL('rank') elif isinstance(weights, dict): weight_args = [] for ...
python
def search_bm25(cls, term, weights=None, with_score=False, score_alias='score', explicit_ordering=False): """Full-text search using selected `term`.""" if not weights: rank = SQL('rank') elif isinstance(weights, dict): weight_args = [] for ...
[ "def", "search_bm25", "(", "cls", ",", "term", ",", "weights", "=", "None", ",", "with_score", "=", "False", ",", "score_alias", "=", "'score'", ",", "explicit_ordering", "=", "False", ")", ":", "if", "not", "weights", ":", "rank", "=", "SQL", "(", "'r...
Full-text search using selected `term`.
[ "Full", "-", "text", "search", "using", "selected", "term", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/sqlite_ext.py#L615-L640
train
Full - text search using selected term.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
playhouse/pool.py
PooledDatabase.manual_close
def manual_close(self): """ Close the underlying connection without returning it to the pool. """ if self.is_closed(): return False # Obtain reference to the connection in-use by the calling thread. conn = self.connection() # A connection will only b...
python
def manual_close(self): """ Close the underlying connection without returning it to the pool. """ if self.is_closed(): return False # Obtain reference to the connection in-use by the calling thread. conn = self.connection() # A connection will only b...
[ "def", "manual_close", "(", "self", ")", ":", "if", "self", ".", "is_closed", "(", ")", ":", "return", "False", "# Obtain reference to the connection in-use by the calling thread.", "conn", "=", "self", ".", "connection", "(", ")", "# A connection will only be re-added ...
Close the underlying connection without returning it to the pool.
[ "Close", "the", "underlying", "connection", "without", "returning", "it", "to", "the", "pool", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/pool.py#L190-L206
train
Close the underlying connection without returning it to the pool.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
examples/analytics/reports.py
Report.top_pages_by_time_period
def top_pages_by_time_period(self, interval='day'): """ Get a breakdown of top pages per interval, i.e. day url count 2014-01-01 /blog/ 11 2014-01-02 /blog/ 14 2014-01-03 /blog/ 9 """ date_trunc = fn.date_trunc(interval, PageView.timesta...
python
def top_pages_by_time_period(self, interval='day'): """ Get a breakdown of top pages per interval, i.e. day url count 2014-01-01 /blog/ 11 2014-01-02 /blog/ 14 2014-01-03 /blog/ 9 """ date_trunc = fn.date_trunc(interval, PageView.timesta...
[ "def", "top_pages_by_time_period", "(", "self", ",", "interval", "=", "'day'", ")", ":", "date_trunc", "=", "fn", ".", "date_trunc", "(", "interval", ",", "PageView", ".", "timestamp", ")", "return", "(", "self", ".", "get_query", "(", ")", ".", "select", ...
Get a breakdown of top pages per interval, i.e. day url count 2014-01-01 /blog/ 11 2014-01-02 /blog/ 14 2014-01-03 /blog/ 9
[ "Get", "a", "breakdown", "of", "top", "pages", "per", "interval", "i", ".", "e", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L19-L38
train
Get a breakdown of top pages per interval
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
examples/analytics/reports.py
Report.cookies
def cookies(self): """ Retrieve the cookies header from all the users who visited. """ return (self.get_query() .select(PageView.ip, PageView.headers['Cookie']) .where(PageView.headers['Cookie'].is_null(False)) .tuples())
python
def cookies(self): """ Retrieve the cookies header from all the users who visited. """ return (self.get_query() .select(PageView.ip, PageView.headers['Cookie']) .where(PageView.headers['Cookie'].is_null(False)) .tuples())
[ "def", "cookies", "(", "self", ")", ":", "return", "(", "self", ".", "get_query", "(", ")", ".", "select", "(", "PageView", ".", "ip", ",", "PageView", ".", "headers", "[", "'Cookie'", "]", ")", ".", "where", "(", "PageView", ".", "headers", "[", "...
Retrieve the cookies header from all the users who visited.
[ "Retrieve", "the", "cookies", "header", "from", "all", "the", "users", "who", "visited", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L40-L47
train
Retrieve the cookies header from all the users who visited them.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
examples/analytics/reports.py
Report.user_agents
def user_agents(self): """ Retrieve user-agents, sorted by most common to least common. """ return (self.get_query() .select( PageView.headers['User-Agent'], fn.Count(PageView.id)) .group_by(PageView.headers['User-Ag...
python
def user_agents(self): """ Retrieve user-agents, sorted by most common to least common. """ return (self.get_query() .select( PageView.headers['User-Agent'], fn.Count(PageView.id)) .group_by(PageView.headers['User-Ag...
[ "def", "user_agents", "(", "self", ")", ":", "return", "(", "self", ".", "get_query", "(", ")", ".", "select", "(", "PageView", ".", "headers", "[", "'User-Agent'", "]", ",", "fn", ".", "Count", "(", "PageView", ".", "id", ")", ")", ".", "group_by", ...
Retrieve user-agents, sorted by most common to least common.
[ "Retrieve", "user", "-", "agents", "sorted", "by", "most", "common", "to", "least", "common", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L49-L59
train
Retrieve user - agents sorted by most common to least common.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
examples/analytics/reports.py
Report.languages
def languages(self): """ Retrieve languages, sorted by most common to least common. The Accept-Languages header sometimes looks weird, i.e. "en-US,en;q=0.8,is;q=0.6,da;q=0.4" We will split on the first semi- colon. """ language = PageView.headers['Accept-Language'...
python
def languages(self): """ Retrieve languages, sorted by most common to least common. The Accept-Languages header sometimes looks weird, i.e. "en-US,en;q=0.8,is;q=0.6,da;q=0.4" We will split on the first semi- colon. """ language = PageView.headers['Accept-Language'...
[ "def", "languages", "(", "self", ")", ":", "language", "=", "PageView", ".", "headers", "[", "'Accept-Language'", "]", "first_language", "=", "fn", ".", "SubStr", "(", "language", ",", "# String to slice.", "1", ",", "# Left index.", "fn", ".", "StrPos", "("...
Retrieve languages, sorted by most common to least common. The Accept-Languages header sometimes looks weird, i.e. "en-US,en;q=0.8,is;q=0.6,da;q=0.4" We will split on the first semi- colon.
[ "Retrieve", "languages", "sorted", "by", "most", "common", "to", "least", "common", ".", "The", "Accept", "-", "Languages", "header", "sometimes", "looks", "weird", "i", ".", "e", ".", "en", "-", "US", "en", ";", "q", "=", "0", ".", "8", "is", ";", ...
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L61-L77
train
Retrieve languages in the database sorted by most common to least common.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
examples/analytics/reports.py
Report.trail
def trail(self): """ Get all visitors by IP and then list the pages they visited in order. """ inner = (self.get_query() .select(PageView.ip, PageView.url) .order_by(PageView.timestamp)) return (PageView .select( ...
python
def trail(self): """ Get all visitors by IP and then list the pages they visited in order. """ inner = (self.get_query() .select(PageView.ip, PageView.url) .order_by(PageView.timestamp)) return (PageView .select( ...
[ "def", "trail", "(", "self", ")", ":", "inner", "=", "(", "self", ".", "get_query", "(", ")", ".", "select", "(", "PageView", ".", "ip", ",", "PageView", ".", "url", ")", ".", "order_by", "(", "PageView", ".", "timestamp", ")", ")", "return", "(", ...
Get all visitors by IP and then list the pages they visited in order.
[ "Get", "all", "visitors", "by", "IP", "and", "then", "list", "the", "pages", "they", "visited", "in", "order", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L79-L91
train
Get all visitors by IP and then list the pages they visited in order.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
examples/analytics/reports.py
Report.top_referrers
def top_referrers(self, domain_only=True): """ What domains send us the most traffic? """ referrer = self._referrer_clause(domain_only) return (self.get_query() .select(referrer, fn.Count(PageView.id)) .group_by(referrer) .order_by(...
python
def top_referrers(self, domain_only=True): """ What domains send us the most traffic? """ referrer = self._referrer_clause(domain_only) return (self.get_query() .select(referrer, fn.Count(PageView.id)) .group_by(referrer) .order_by(...
[ "def", "top_referrers", "(", "self", ",", "domain_only", "=", "True", ")", ":", "referrer", "=", "self", ".", "_referrer_clause", "(", "domain_only", ")", "return", "(", "self", ".", "get_query", "(", ")", ".", "select", "(", "referrer", ",", "fn", ".", ...
What domains send us the most traffic?
[ "What", "domains", "send", "us", "the", "most", "traffic?" ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L99-L108
train
Return a list of all top referrer pages.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
examples/diary.py
add_entry
def add_entry(): """Add entry""" print('Enter your entry. Press ctrl+d when finished.') data = sys.stdin.read().strip() if data and raw_input('Save entry? [Yn] ') != 'n': Entry.create(content=data) print('Saved successfully.')
python
def add_entry(): """Add entry""" print('Enter your entry. Press ctrl+d when finished.') data = sys.stdin.read().strip() if data and raw_input('Save entry? [Yn] ') != 'n': Entry.create(content=data) print('Saved successfully.')
[ "def", "add_entry", "(", ")", ":", "print", "(", "'Enter your entry. Press ctrl+d when finished.'", ")", "data", "=", "sys", ".", "stdin", ".", "read", "(", ")", ".", "strip", "(", ")", "if", "data", "and", "raw_input", "(", "'Save entry? [Yn] '", ")", "!=",...
Add entry
[ "Add", "entry" ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/diary.py#L35-L41
train
Add entry to the archive.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
examples/diary.py
view_entries
def view_entries(search_query=None): """View previous entries""" query = Entry.select().order_by(Entry.timestamp.desc()) if search_query: query = query.where(Entry.content.contains(search_query)) for entry in query: timestamp = entry.timestamp.strftime('%A %B %d, %Y %I:%M%p') pr...
python
def view_entries(search_query=None): """View previous entries""" query = Entry.select().order_by(Entry.timestamp.desc()) if search_query: query = query.where(Entry.content.contains(search_query)) for entry in query: timestamp = entry.timestamp.strftime('%A %B %d, %Y %I:%M%p') pr...
[ "def", "view_entries", "(", "search_query", "=", "None", ")", ":", "query", "=", "Entry", ".", "select", "(", ")", ".", "order_by", "(", "Entry", ".", "timestamp", ".", "desc", "(", ")", ")", "if", "search_query", ":", "query", "=", "query", ".", "wh...
View previous entries
[ "View", "previous", "entries" ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/diary.py#L43-L62
train
View previous entries
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
examples/blog/app.py
Entry.html_content
def html_content(self): """ Generate HTML representation of the markdown-formatted blog entry, and also convert any media URLs into rich media objects such as video players or images. """ hilite = CodeHiliteExtension(linenums=False, css_class='highlight') extras =...
python
def html_content(self): """ Generate HTML representation of the markdown-formatted blog entry, and also convert any media URLs into rich media objects such as video players or images. """ hilite = CodeHiliteExtension(linenums=False, css_class='highlight') extras =...
[ "def", "html_content", "(", "self", ")", ":", "hilite", "=", "CodeHiliteExtension", "(", "linenums", "=", "False", ",", "css_class", "=", "'highlight'", ")", "extras", "=", "ExtraExtension", "(", ")", "markdown_content", "=", "markdown", "(", "self", ".", "c...
Generate HTML representation of the markdown-formatted blog entry, and also convert any media URLs into rich media objects such as video players or images.
[ "Generate", "HTML", "representation", "of", "the", "markdown", "-", "formatted", "blog", "entry", "and", "also", "convert", "any", "media", "URLs", "into", "rich", "media", "objects", "such", "as", "video", "players", "or", "images", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/blog/app.py#L66-L80
train
Generate HTML representation of the blog entry and also convert any media URLs into rich media objects such as video players or images.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
playhouse/shortcuts.py
model_to_dict
def model_to_dict(model, recurse=True, backrefs=False, only=None, exclude=None, seen=None, extra_attrs=None, fields_from_query=None, max_depth=None, manytomany=False): """ Convert a model instance (and any related objects) to a dictionary. :param bool recurse: Whether fo...
python
def model_to_dict(model, recurse=True, backrefs=False, only=None, exclude=None, seen=None, extra_attrs=None, fields_from_query=None, max_depth=None, manytomany=False): """ Convert a model instance (and any related objects) to a dictionary. :param bool recurse: Whether fo...
[ "def", "model_to_dict", "(", "model", ",", "recurse", "=", "True", ",", "backrefs", "=", "False", ",", "only", "=", "None", ",", "exclude", "=", "None", ",", "seen", "=", "None", ",", "extra_attrs", "=", "None", ",", "fields_from_query", "=", "None", "...
Convert a model instance (and any related objects) to a dictionary. :param bool recurse: Whether foreign-keys should be recursed. :param bool backrefs: Whether lists of related objects should be recursed. :param only: A list (or set) of field instances indicating which fields should be included. ...
[ "Convert", "a", "model", "instance", "(", "and", "any", "related", "objects", ")", "to", "a", "dictionary", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/playhouse/shortcuts.py#L10-L124
train
Convert a model instance to a dictionary.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
coleifer/peewee
peewee.py
ColumnBase._e
def _e(op, inv=False): """ Lightweight factory which returns a method that builds an Expression consisting of the left-hand and right-hand operands, using `op`. """ def inner(self, rhs): if inv: return Expression(rhs, op, self) return Expre...
python
def _e(op, inv=False): """ Lightweight factory which returns a method that builds an Expression consisting of the left-hand and right-hand operands, using `op`. """ def inner(self, rhs): if inv: return Expression(rhs, op, self) return Expre...
[ "def", "_e", "(", "op", ",", "inv", "=", "False", ")", ":", "def", "inner", "(", "self", ",", "rhs", ")", ":", "if", "inv", ":", "return", "Expression", "(", "rhs", ",", "op", ",", "self", ")", "return", "Expression", "(", "self", ",", "op", ",...
Lightweight factory which returns a method that builds an Expression consisting of the left-hand and right-hand operands, using `op`.
[ "Lightweight", "factory", "which", "returns", "a", "method", "that", "builds", "an", "Expression", "consisting", "of", "the", "left", "-", "hand", "and", "right", "-", "hand", "operands", "using", "op", "." ]
ea9403b01acb039adb3a2472186d795c796b77a0
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/peewee.py#L1091-L1100
train
A factory for creating an Expression that builds an Expression consisting of the left - hand operands using op.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
RomelTorres/alpha_vantage
alpha_vantage/foreignexchange.py
ForeignExchange.get_currency_exchange_intraday
def get_currency_exchange_intraday(self, from_symbol, to_symbol, interval='15min', outputsize='compact'): """ Returns the intraday exchange rate for any pair of physical currency (e.g., EUR) or physical currency (e.g., USD). Keyword Arguments: from_symbol: The currency you would lik...
python
def get_currency_exchange_intraday(self, from_symbol, to_symbol, interval='15min', outputsize='compact'): """ Returns the intraday exchange rate for any pair of physical currency (e.g., EUR) or physical currency (e.g., USD). Keyword Arguments: from_symbol: The currency you would lik...
[ "def", "get_currency_exchange_intraday", "(", "self", ",", "from_symbol", ",", "to_symbol", ",", "interval", "=", "'15min'", ",", "outputsize", "=", "'compact'", ")", ":", "_FUNCTION_KEY", "=", "'FX_INTRADAY'", "return", "_FUNCTION_KEY", ",", "\"Time Series FX ({})\""...
Returns the intraday exchange rate for any pair of physical currency (e.g., EUR) or physical currency (e.g., USD). Keyword Arguments: from_symbol: The currency you would like to get the exchange rate for. For example: from_currency=EUR or from_currency=USD. ...
[ "Returns", "the", "intraday", "exchange", "rate", "for", "any", "pair", "of", "physical", "currency", "(", "e", ".", "g", ".", "EUR", ")", "or", "physical", "currency", "(", "e", ".", "g", ".", "USD", ")", "." ]
4e0b5057e520e3e3de69cf947301765817290121
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/foreignexchange.py#L37-L56
train
This function returns the intraday exchange rate for a given currency.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
RomelTorres/alpha_vantage
alpha_vantage/alphavantage.py
AlphaVantage._call_api_on_func
def _call_api_on_func(cls, func): """ Decorator for forming the api call with the arguments of the function, it works by taking the arguments given to the function and building the url to call the api on it Keyword Arguments: func: The function to be decorated """ ...
python
def _call_api_on_func(cls, func): """ Decorator for forming the api call with the arguments of the function, it works by taking the arguments given to the function and building the url to call the api on it Keyword Arguments: func: The function to be decorated """ ...
[ "def", "_call_api_on_func", "(", "cls", ",", "func", ")", ":", "# Argument Handling", "if", "sys", ".", "version_info", "[", "0", "]", "<", "3", ":", "# Deprecated since version 3.0", "argspec", "=", "inspect", ".", "getargspec", "(", "func", ")", "else", ":...
Decorator for forming the api call with the arguments of the function, it works by taking the arguments given to the function and building the url to call the api on it Keyword Arguments: func: The function to be decorated
[ "Decorator", "for", "forming", "the", "api", "call", "with", "the", "arguments", "of", "the", "function", "it", "works", "by", "taking", "the", "arguments", "given", "to", "the", "function", "and", "building", "the", "url", "to", "call", "the", "api", "on"...
4e0b5057e520e3e3de69cf947301765817290121
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/alphavantage.py#L65-L147
train
Decorator for forming the api call with the arguments of the function that is passed to the function and building the url to call the api on it
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
RomelTorres/alpha_vantage
alpha_vantage/alphavantage.py
AlphaVantage._output_format
def _output_format(cls, func, override=None): """ Decorator in charge of giving the output its right format, either json or pandas Keyword Arguments: func: The function to be decorated override: Override the internal format of the call, default None """ ...
python
def _output_format(cls, func, override=None): """ Decorator in charge of giving the output its right format, either json or pandas Keyword Arguments: func: The function to be decorated override: Override the internal format of the call, default None """ ...
[ "def", "_output_format", "(", "cls", ",", "func", ",", "override", "=", "None", ")", ":", "@", "wraps", "(", "func", ")", "def", "_format_wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "call_response", ",", "data_key", ",...
Decorator in charge of giving the output its right format, either json or pandas Keyword Arguments: func: The function to be decorated override: Override the internal format of the call, default None
[ "Decorator", "in", "charge", "of", "giving", "the", "output", "its", "right", "format", "either", "json", "or", "pandas" ]
4e0b5057e520e3e3de69cf947301765817290121
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/alphavantage.py#L150-L203
train
Decorator to give the output format of the object in the internal format
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
RomelTorres/alpha_vantage
alpha_vantage/alphavantage.py
AlphaVantage.map_to_matype
def map_to_matype(self, matype): """ Convert to the alpha vantage math type integer. It returns an integer correspondent to the type of math to apply to a function. It raises ValueError if an integer greater than the supported math types is given. Keyword Arguments: ...
python
def map_to_matype(self, matype): """ Convert to the alpha vantage math type integer. It returns an integer correspondent to the type of math to apply to a function. It raises ValueError if an integer greater than the supported math types is given. Keyword Arguments: ...
[ "def", "map_to_matype", "(", "self", ",", "matype", ")", ":", "# Check if it is an integer or a string", "try", ":", "value", "=", "int", "(", "matype", ")", "if", "abs", "(", "value", ")", ">", "len", "(", "AlphaVantage", ".", "_ALPHA_VANTAGE_MATH_MAP", ")", ...
Convert to the alpha vantage math type integer. It returns an integer correspondent to the type of math to apply to a function. It raises ValueError if an integer greater than the supported math types is given. Keyword Arguments: matype: The math type of the alpha vantage a...
[ "Convert", "to", "the", "alpha", "vantage", "math", "type", "integer", ".", "It", "returns", "an", "integer", "correspondent", "to", "the", "type", "of", "math", "to", "apply", "to", "a", "function", ".", "It", "raises", "ValueError", "if", "an", "integer"...
4e0b5057e520e3e3de69cf947301765817290121
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/alphavantage.py#L214-L241
train
This function converts the alpha vantage math type integer to the alpha vantage math type integer. It returns an integer corresponding to the type of math to apply to a function. It returns an integer corresponding to the type of math to apply to a function. It raises ValueError if an integer greater than the supported...
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
RomelTorres/alpha_vantage
alpha_vantage/alphavantage.py
AlphaVantage._handle_api_call
def _handle_api_call(self, url): """ Handle the return call from the api and return a data and meta_data object. It raises a ValueError on problems Keyword Arguments: url: The url of the service data_key: The key for getting the data from the jso object me...
python
def _handle_api_call(self, url): """ Handle the return call from the api and return a data and meta_data object. It raises a ValueError on problems Keyword Arguments: url: The url of the service data_key: The key for getting the data from the jso object me...
[ "def", "_handle_api_call", "(", "self", ",", "url", ")", ":", "response", "=", "requests", ".", "get", "(", "url", ",", "proxies", "=", "self", ".", "proxy", ")", "if", "'json'", "in", "self", ".", "output_format", ".", "lower", "(", ")", "or", "'pan...
Handle the return call from the api and return a data and meta_data object. It raises a ValueError on problems Keyword Arguments: url: The url of the service data_key: The key for getting the data from the jso object meta_data_key: The key for getting the meta da...
[ "Handle", "the", "return", "call", "from", "the", "api", "and", "return", "a", "data", "and", "meta_data", "object", ".", "It", "raises", "a", "ValueError", "on", "problems" ]
4e0b5057e520e3e3de69cf947301765817290121
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/alphavantage.py#L243-L269
train
Handle the return call from the api and return a data and meta_data_object object. It raises a ValueError on problems
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
RomelTorres/alpha_vantage
alpha_vantage/sectorperformance.py
SectorPerformances._output_format_sector
def _output_format_sector(func, override=None): """ Decorator in charge of giving the output its right format, either json or pandas (replacing the % for usable floats, range 0-1.0) Keyword Arguments: func: The function to be decorated override: Override the internal for...
python
def _output_format_sector(func, override=None): """ Decorator in charge of giving the output its right format, either json or pandas (replacing the % for usable floats, range 0-1.0) Keyword Arguments: func: The function to be decorated override: Override the internal for...
[ "def", "_output_format_sector", "(", "func", ",", "override", "=", "None", ")", ":", "@", "wraps", "(", "func", ")", "def", "_format_wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "json_response", ",", "data_key", ",", "met...
Decorator in charge of giving the output its right format, either json or pandas (replacing the % for usable floats, range 0-1.0) Keyword Arguments: func: The function to be decorated override: Override the internal format of the call, default None Returns: A...
[ "Decorator", "in", "charge", "of", "giving", "the", "output", "its", "right", "format", "either", "json", "or", "pandas", "(", "replacing", "the", "%", "for", "usable", "floats", "range", "0", "-", "1", ".", "0", ")" ]
4e0b5057e520e3e3de69cf947301765817290121
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/sectorperformance.py#L33-L74
train
Decorator to give the output format sector api
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
RomelTorres/alpha_vantage
alpha_vantage/techindicators.py
TechIndicators.get_macd
def get_macd(self, symbol, interval='daily', series_type='close', fastperiod=None, slowperiod=None, signalperiod=None): """ Return the moving average convergence/divergence time series in two json objects as data and meta_data. It raises ValueError when problems arise K...
python
def get_macd(self, symbol, interval='daily', series_type='close', fastperiod=None, slowperiod=None, signalperiod=None): """ Return the moving average convergence/divergence time series in two json objects as data and meta_data. It raises ValueError when problems arise K...
[ "def", "get_macd", "(", "self", ",", "symbol", ",", "interval", "=", "'daily'", ",", "series_type", "=", "'close'", ",", "fastperiod", "=", "None", ",", "slowperiod", "=", "None", ",", "signalperiod", "=", "None", ")", ":", "_FUNCTION_KEY", "=", "\"MACD\""...
Return the moving average convergence/divergence time series in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: symbol: the symbol for the equity we want to get its data interval: time interval between two conscutive ...
[ "Return", "the", "moving", "average", "convergence", "/", "divergence", "time", "series", "in", "two", "json", "objects", "as", "data", "and", "meta_data", ".", "It", "raises", "ValueError", "when", "problems", "arise" ]
4e0b5057e520e3e3de69cf947301765817290121
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/techindicators.py#L186-L204
train
This function returns the moving average convergence / divergence time series in two json objects as data and meta_data. It raises ValueError when problems are raised
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
RomelTorres/alpha_vantage
alpha_vantage/techindicators.py
TechIndicators.get_macdext
def get_macdext(self, symbol, interval='daily', series_type='close', fastperiod=None, slowperiod=None, signalperiod=None, fastmatype=None, slowmatype=None, signalmatype=None): """ Return the moving average convergence/divergence time series in two json objects as ...
python
def get_macdext(self, symbol, interval='daily', series_type='close', fastperiod=None, slowperiod=None, signalperiod=None, fastmatype=None, slowmatype=None, signalmatype=None): """ Return the moving average convergence/divergence time series in two json objects as ...
[ "def", "get_macdext", "(", "self", ",", "symbol", ",", "interval", "=", "'daily'", ",", "series_type", "=", "'close'", ",", "fastperiod", "=", "None", ",", "slowperiod", "=", "None", ",", "signalperiod", "=", "None", ",", "fastmatype", "=", "None", ",", ...
Return the moving average convergence/divergence time series in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: symbol: the symbol for the equity we want to get its data interval: time interval between two conscutive ...
[ "Return", "the", "moving", "average", "convergence", "/", "divergence", "time", "series", "in", "two", "json", "objects", "as", "data", "and", "meta_data", ".", "It", "raises", "ValueError", "when", "problems", "arise" ]
4e0b5057e520e3e3de69cf947301765817290121
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/techindicators.py#L208-L249
train
This function returns the convergence or divergence time series in two - tuple json objects as data and meta_data. It raises ValueError when problems are encountered.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
RomelTorres/alpha_vantage
alpha_vantage/techindicators.py
TechIndicators.get_stoch
def get_stoch(self, symbol, interval='daily', fastkperiod=None, slowkperiod=None, slowdperiod=None, slowkmatype=None, slowdmatype=None): """ Return the stochatic oscillator values in two json objects as data and meta_data. It raises ValueError when problems arise Keywo...
python
def get_stoch(self, symbol, interval='daily', fastkperiod=None, slowkperiod=None, slowdperiod=None, slowkmatype=None, slowdmatype=None): """ Return the stochatic oscillator values in two json objects as data and meta_data. It raises ValueError when problems arise Keywo...
[ "def", "get_stoch", "(", "self", ",", "symbol", ",", "interval", "=", "'daily'", ",", "fastkperiod", "=", "None", ",", "slowkperiod", "=", "None", ",", "slowdperiod", "=", "None", ",", "slowkmatype", "=", "None", ",", "slowdmatype", "=", "None", ")", ":"...
Return the stochatic oscillator values in two json objects as data and meta_data. It raises ValueError when problems arise Keyword Arguments: symbol: the symbol for the equity we want to get its data interval: time interval between two conscutive values, ...
[ "Return", "the", "stochatic", "oscillator", "values", "in", "two", "json", "objects", "as", "data", "and", "meta_data", ".", "It", "raises", "ValueError", "when", "problems", "arise" ]
4e0b5057e520e3e3de69cf947301765817290121
https://github.com/RomelTorres/alpha_vantage/blob/4e0b5057e520e3e3de69cf947301765817290121/alpha_vantage/techindicators.py#L253-L290
train
Returns the stochatic oscillator values in two - tuple json objects as data and meta_data.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...