repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
junzis/pyModeS | pyModeS/decoder/adsb.py | nic_v2 | def nic_v2(msg, NICa, NICbc):
"""Calculate NIC, navigation integrity category, for ADS-B version 2
Args:
msg (string): 28 bytes hexadecimal message string
NICa (int or string): NIC supplement - A
NICbc (int or srting): NIC supplement - B or C
Returns:
int or string: Horizon... | python | def nic_v2(msg, NICa, NICbc):
"""Calculate NIC, navigation integrity category, for ADS-B version 2
Args:
msg (string): 28 bytes hexadecimal message string
NICa (int or string): NIC supplement - A
NICbc (int or srting): NIC supplement - B or C
Returns:
int or string: Horizon... | [
"def",
"nic_v2",
"(",
"msg",
",",
"NICa",
",",
"NICbc",
")",
":",
"if",
"typecode",
"(",
"msg",
")",
"<",
"5",
"or",
"typecode",
"(",
"msg",
")",
">",
"22",
":",
"raise",
"RuntimeError",
"(",
"\"%s: Not a surface position message (5<TC<8), \\ airbor... | Calculate NIC, navigation integrity category, for ADS-B version 2
Args:
msg (string): 28 bytes hexadecimal message string
NICa (int or string): NIC supplement - A
NICbc (int or srting): NIC supplement - B or C
Returns:
int or string: Horizontal Radius of Containment | [
"Calculate",
"NIC",
"navigation",
"integrity",
"category",
"for",
"ADS",
"-",
"B",
"version",
"2"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/adsb.py#L311-L345 | train |
junzis/pyModeS | pyModeS/decoder/adsb.py | nic_s | def nic_s(msg):
"""Obtain NIC supplement bit, TC=31 message
Args:
msg (string): 28 bytes hexadecimal message string
Returns:
int: NICs number (0 or 1)
"""
tc = typecode(msg)
if tc != 31:
raise RuntimeError("%s: Not a status operation message, expecting TC = 31" % msg)
... | python | def nic_s(msg):
"""Obtain NIC supplement bit, TC=31 message
Args:
msg (string): 28 bytes hexadecimal message string
Returns:
int: NICs number (0 or 1)
"""
tc = typecode(msg)
if tc != 31:
raise RuntimeError("%s: Not a status operation message, expecting TC = 31" % msg)
... | [
"def",
"nic_s",
"(",
"msg",
")",
":",
"tc",
"=",
"typecode",
"(",
"msg",
")",
"if",
"tc",
"!=",
"31",
":",
"raise",
"RuntimeError",
"(",
"\"%s: Not a status operation message, expecting TC = 31\"",
"%",
"msg",
")",
"msgbin",
"=",
"common",
".",
"hex2bin",
"(... | Obtain NIC supplement bit, TC=31 message
Args:
msg (string): 28 bytes hexadecimal message string
Returns:
int: NICs number (0 or 1) | [
"Obtain",
"NIC",
"supplement",
"bit",
"TC",
"=",
"31",
"message"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/adsb.py#L348-L365 | train |
junzis/pyModeS | pyModeS/decoder/adsb.py | nic_b | def nic_b(msg):
"""Obtain NICb, navigation integrity category supplement-b
Args:
msg (string): 28 bytes hexadecimal message string
Returns:
int: NICb number (0 or 1)
"""
tc = typecode(msg)
if tc < 9 or tc > 18:
raise RuntimeError("%s: Not a airborne position message, e... | python | def nic_b(msg):
"""Obtain NICb, navigation integrity category supplement-b
Args:
msg (string): 28 bytes hexadecimal message string
Returns:
int: NICb number (0 or 1)
"""
tc = typecode(msg)
if tc < 9 or tc > 18:
raise RuntimeError("%s: Not a airborne position message, e... | [
"def",
"nic_b",
"(",
"msg",
")",
":",
"tc",
"=",
"typecode",
"(",
"msg",
")",
"if",
"tc",
"<",
"9",
"or",
"tc",
">",
"18",
":",
"raise",
"RuntimeError",
"(",
"\"%s: Not a airborne position message, expecting 8<TC<19\"",
"%",
"msg",
")",
"msgbin",
"=",
"com... | Obtain NICb, navigation integrity category supplement-b
Args:
msg (string): 28 bytes hexadecimal message string
Returns:
int: NICb number (0 or 1) | [
"Obtain",
"NICb",
"navigation",
"integrity",
"category",
"supplement",
"-",
"b"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/adsb.py#L389-L406 | train |
junzis/pyModeS | pyModeS/decoder/adsb.py | nac_p | def nac_p(msg):
"""Calculate NACp, Navigation Accuracy Category - Position
Args:
msg (string): 28 bytes hexadecimal message string, TC = 29 or 31
Returns:
int or string: 95% horizontal accuracy bounds, Estimated Position Uncertainty
int or string: 95% vertical accuracy bounds, Vert... | python | def nac_p(msg):
"""Calculate NACp, Navigation Accuracy Category - Position
Args:
msg (string): 28 bytes hexadecimal message string, TC = 29 or 31
Returns:
int or string: 95% horizontal accuracy bounds, Estimated Position Uncertainty
int or string: 95% vertical accuracy bounds, Vert... | [
"def",
"nac_p",
"(",
"msg",
")",
":",
"tc",
"=",
"typecode",
"(",
"msg",
")",
"if",
"tc",
"not",
"in",
"[",
"29",
",",
"31",
"]",
":",
"raise",
"RuntimeError",
"(",
"\"%s: Not a target state and status message, \\ or operation status messag... | Calculate NACp, Navigation Accuracy Category - Position
Args:
msg (string): 28 bytes hexadecimal message string, TC = 29 or 31
Returns:
int or string: 95% horizontal accuracy bounds, Estimated Position Uncertainty
int or string: 95% vertical accuracy bounds, Vertical Estimated Position... | [
"Calculate",
"NACp",
"Navigation",
"Accuracy",
"Category",
"-",
"Position"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/adsb.py#L409-L438 | train |
junzis/pyModeS | pyModeS/decoder/adsb.py | nac_v | def nac_v(msg):
"""Calculate NACv, Navigation Accuracy Category - Velocity
Args:
msg (string): 28 bytes hexadecimal message string, TC = 19
Returns:
int or string: 95% horizontal accuracy bounds for velocity, Horizontal Figure of Merit
int or string: 95% vertical accuracy bounds fo... | python | def nac_v(msg):
"""Calculate NACv, Navigation Accuracy Category - Velocity
Args:
msg (string): 28 bytes hexadecimal message string, TC = 19
Returns:
int or string: 95% horizontal accuracy bounds for velocity, Horizontal Figure of Merit
int or string: 95% vertical accuracy bounds fo... | [
"def",
"nac_v",
"(",
"msg",
")",
":",
"tc",
"=",
"typecode",
"(",
"msg",
")",
"if",
"tc",
"!=",
"19",
":",
"raise",
"RuntimeError",
"(",
"\"%s: Not an airborne velocity message, expecting TC = 19\"",
"%",
"msg",
")",
"msgbin",
"=",
"common",
".",
"hex2bin",
... | Calculate NACv, Navigation Accuracy Category - Velocity
Args:
msg (string): 28 bytes hexadecimal message string, TC = 19
Returns:
int or string: 95% horizontal accuracy bounds for velocity, Horizontal Figure of Merit
int or string: 95% vertical accuracy bounds for velocity, Vertical Fi... | [
"Calculate",
"NACv",
"Navigation",
"Accuracy",
"Category",
"-",
"Velocity"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/adsb.py#L441-L465 | train |
junzis/pyModeS | pyModeS/decoder/adsb.py | sil | def sil(msg, version):
"""Calculate SIL, Surveillance Integrity Level
Args:
msg (string): 28 bytes hexadecimal message string with TC = 29, 31
Returns:
int or string: Probability of exceeding Horizontal Radius of Containment RCu
int or string: Probability of exceeding Vertical Inte... | python | def sil(msg, version):
"""Calculate SIL, Surveillance Integrity Level
Args:
msg (string): 28 bytes hexadecimal message string with TC = 29, 31
Returns:
int or string: Probability of exceeding Horizontal Radius of Containment RCu
int or string: Probability of exceeding Vertical Inte... | [
"def",
"sil",
"(",
"msg",
",",
"version",
")",
":",
"tc",
"=",
"typecode",
"(",
"msg",
")",
"if",
"tc",
"not",
"in",
"[",
"29",
",",
"31",
"]",
":",
"raise",
"RuntimeError",
"(",
"\"%s: Not a target state and status messag, \\ or operat... | Calculate SIL, Surveillance Integrity Level
Args:
msg (string): 28 bytes hexadecimal message string with TC = 29, 31
Returns:
int or string: Probability of exceeding Horizontal Radius of Containment RCu
int or string: Probability of exceeding Vertical Integrity Containment Region VPL
... | [
"Calculate",
"SIL",
"Surveillance",
"Integrity",
"Level"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/adsb.py#L468-L511 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds50.py | roll50 | def roll50(msg):
"""Roll angle, BDS 5,0 message
Args:
msg (String): 28 bytes hexadecimal message (BDS50) string
Returns:
float: angle in degrees,
negative->left wing down, positive->right wing down
"""
d = hex2bin(data(msg))
if d[0] == '0':
return None
... | python | def roll50(msg):
"""Roll angle, BDS 5,0 message
Args:
msg (String): 28 bytes hexadecimal message (BDS50) string
Returns:
float: angle in degrees,
negative->left wing down, positive->right wing down
"""
d = hex2bin(data(msg))
if d[0] == '0':
return None
... | [
"def",
"roll50",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"0",
"]",
"==",
"'0'",
":",
"return",
"None",
"sign",
"=",
"int",
"(",
"d",
"[",
"1",
"]",
")",
"value",
"=",
"bin2int",
"(",
"d"... | Roll angle, BDS 5,0 message
Args:
msg (String): 28 bytes hexadecimal message (BDS50) string
Returns:
float: angle in degrees,
negative->left wing down, positive->right wing down | [
"Roll",
"angle",
"BDS",
"5",
"0",
"message"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds50.py#L76-L98 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds50.py | trk50 | def trk50(msg):
"""True track angle, BDS 5,0 message
Args:
msg (String): 28 bytes hexadecimal message (BDS50) string
Returns:
float: angle in degrees to true north (from 0 to 360)
"""
d = hex2bin(data(msg))
if d[11] == '0':
return None
sign = int(d[12]) # 1 -> w... | python | def trk50(msg):
"""True track angle, BDS 5,0 message
Args:
msg (String): 28 bytes hexadecimal message (BDS50) string
Returns:
float: angle in degrees to true north (from 0 to 360)
"""
d = hex2bin(data(msg))
if d[11] == '0':
return None
sign = int(d[12]) # 1 -> w... | [
"def",
"trk50",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"11",
"]",
"==",
"'0'",
":",
"return",
"None",
"sign",
"=",
"int",
"(",
"d",
"[",
"12",
"]",
")",
"value",
"=",
"bin2int",
"(",
"d... | True track angle, BDS 5,0 message
Args:
msg (String): 28 bytes hexadecimal message (BDS50) string
Returns:
float: angle in degrees to true north (from 0 to 360) | [
"True",
"track",
"angle",
"BDS",
"5",
"0",
"message"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds50.py#L101-L127 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds50.py | gs50 | def gs50(msg):
"""Ground speed, BDS 5,0 message
Args:
msg (String): 28 bytes hexadecimal message (BDS50) string
Returns:
int: ground speed in knots
"""
d = hex2bin(data(msg))
if d[23] == '0':
return None
spd = bin2int(d[24:34]) * 2 # kts
return spd | python | def gs50(msg):
"""Ground speed, BDS 5,0 message
Args:
msg (String): 28 bytes hexadecimal message (BDS50) string
Returns:
int: ground speed in knots
"""
d = hex2bin(data(msg))
if d[23] == '0':
return None
spd = bin2int(d[24:34]) * 2 # kts
return spd | [
"def",
"gs50",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"23",
"]",
"==",
"'0'",
":",
"return",
"None",
"spd",
"=",
"bin2int",
"(",
"d",
"[",
"24",
":",
"34",
"]",
")",
"*",
"2",
"return",... | Ground speed, BDS 5,0 message
Args:
msg (String): 28 bytes hexadecimal message (BDS50) string
Returns:
int: ground speed in knots | [
"Ground",
"speed",
"BDS",
"5",
"0",
"message"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds50.py#L130-L145 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds50.py | tas50 | def tas50(msg):
"""Aircraft true airspeed, BDS 5,0 message
Args:
msg (String): 28 bytes hexadecimal message (BDS50) string
Returns:
int: true airspeed in knots
"""
d = hex2bin(data(msg))
if d[45] == '0':
return None
tas = bin2int(d[46:56]) * 2 # kts
return t... | python | def tas50(msg):
"""Aircraft true airspeed, BDS 5,0 message
Args:
msg (String): 28 bytes hexadecimal message (BDS50) string
Returns:
int: true airspeed in knots
"""
d = hex2bin(data(msg))
if d[45] == '0':
return None
tas = bin2int(d[46:56]) * 2 # kts
return t... | [
"def",
"tas50",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"45",
"]",
"==",
"'0'",
":",
"return",
"None",
"tas",
"=",
"bin2int",
"(",
"d",
"[",
"46",
":",
"56",
"]",
")",
"*",
"2",
"return"... | Aircraft true airspeed, BDS 5,0 message
Args:
msg (String): 28 bytes hexadecimal message (BDS50) string
Returns:
int: true airspeed in knots | [
"Aircraft",
"true",
"airspeed",
"BDS",
"5",
"0",
"message"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds50.py#L174-L189 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds53.py | ias53 | def ias53(msg):
"""Indicated airspeed, DBS 5,3 message
Args:
msg (String): 28 bytes hexadecimal message
Returns:
int: indicated arispeed in knots
"""
d = hex2bin(data(msg))
if d[12] == '0':
return None
ias = bin2int(d[13:23]) # knots
return ias | python | def ias53(msg):
"""Indicated airspeed, DBS 5,3 message
Args:
msg (String): 28 bytes hexadecimal message
Returns:
int: indicated arispeed in knots
"""
d = hex2bin(data(msg))
if d[12] == '0':
return None
ias = bin2int(d[13:23]) # knots
return ias | [
"def",
"ias53",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"12",
"]",
"==",
"'0'",
":",
"return",
"None",
"ias",
"=",
"bin2int",
"(",
"d",
"[",
"13",
":",
"23",
"]",
")",
"return",
"ias"
] | Indicated airspeed, DBS 5,3 message
Args:
msg (String): 28 bytes hexadecimal message
Returns:
int: indicated arispeed in knots | [
"Indicated",
"airspeed",
"DBS",
"5",
"3",
"message"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds53.py#L106-L121 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds53.py | mach53 | def mach53(msg):
"""MACH number, DBS 5,3 message
Args:
msg (String): 28 bytes hexadecimal message
Returns:
float: MACH number
"""
d = hex2bin(data(msg))
if d[23] == '0':
return None
mach = bin2int(d[24:33]) * 0.008
return round(mach, 3) | python | def mach53(msg):
"""MACH number, DBS 5,3 message
Args:
msg (String): 28 bytes hexadecimal message
Returns:
float: MACH number
"""
d = hex2bin(data(msg))
if d[23] == '0':
return None
mach = bin2int(d[24:33]) * 0.008
return round(mach, 3) | [
"def",
"mach53",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"23",
"]",
"==",
"'0'",
":",
"return",
"None",
"mach",
"=",
"bin2int",
"(",
"d",
"[",
"24",
":",
"33",
"]",
")",
"*",
"0.008",
"r... | MACH number, DBS 5,3 message
Args:
msg (String): 28 bytes hexadecimal message
Returns:
float: MACH number | [
"MACH",
"number",
"DBS",
"5",
"3",
"message"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds53.py#L124-L139 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds53.py | tas53 | def tas53(msg):
"""Aircraft true airspeed, BDS 5,3 message
Args:
msg (String): 28 bytes hexadecimal message
Returns:
float: true airspeed in knots
"""
d = hex2bin(data(msg))
if d[33] == '0':
return None
tas = bin2int(d[34:46]) * 0.5 # kts
return round(tas, 1... | python | def tas53(msg):
"""Aircraft true airspeed, BDS 5,3 message
Args:
msg (String): 28 bytes hexadecimal message
Returns:
float: true airspeed in knots
"""
d = hex2bin(data(msg))
if d[33] == '0':
return None
tas = bin2int(d[34:46]) * 0.5 # kts
return round(tas, 1... | [
"def",
"tas53",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"33",
"]",
"==",
"'0'",
":",
"return",
"None",
"tas",
"=",
"bin2int",
"(",
"d",
"[",
"34",
":",
"46",
"]",
")",
"*",
"0.5",
"retur... | Aircraft true airspeed, BDS 5,3 message
Args:
msg (String): 28 bytes hexadecimal message
Returns:
float: true airspeed in knots | [
"Aircraft",
"true",
"airspeed",
"BDS",
"5",
"3",
"message"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds53.py#L142-L157 | train |
junzis/pyModeS | pyModeS/extra/tcpclient.py | BaseClient.read_skysense_buffer | def read_skysense_buffer(self):
"""Skysense stream format.
::
----------------------------------------------------------------------------------
Field SS MS MS MS MS MS MS MS MS MS MS MS MS MS MS TS TS TS TS TS TS RS RS RS
--------------------------------------... | python | def read_skysense_buffer(self):
"""Skysense stream format.
::
----------------------------------------------------------------------------------
Field SS MS MS MS MS MS MS MS MS MS MS MS MS MS MS TS TS TS TS TS TS RS RS RS
--------------------------------------... | [
"def",
"read_skysense_buffer",
"(",
"self",
")",
":",
"SS_MSGLENGTH",
"=",
"24",
"SS_STARTCHAR",
"=",
"0x24",
"if",
"len",
"(",
"self",
".",
"buffer",
")",
"<=",
"SS_MSGLENGTH",
":",
"return",
"None",
"messages",
"=",
"[",
"]",
"while",
"len",
"(",
"self... | Skysense stream format.
::
----------------------------------------------------------------------------------
Field SS MS MS MS MS MS MS MS MS MS MS MS MS MS MS TS TS TS TS TS TS RS RS RS
---------------------------------------------------------------------------------... | [
"Skysense",
"stream",
"format",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/extra/tcpclient.py#L147-L233 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds10.py | is10 | def is10(msg):
"""Check if a message is likely to be BDS code 1,0
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
# first 8 bits must be 0x10
if d[0:8] != '00010000... | python | def is10(msg):
"""Check if a message is likely to be BDS code 1,0
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
# first 8 bits must be 0x10
if d[0:8] != '00010000... | [
"def",
"is10",
"(",
"msg",
")",
":",
"if",
"allzeros",
"(",
"msg",
")",
":",
"return",
"False",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"0",
":",
"8",
"]",
"!=",
"'00010000'",
":",
"return",
"False",
"if",
"bin2i... | Check if a message is likely to be BDS code 1,0
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False | [
"Check",
"if",
"a",
"message",
"is",
"likely",
"to",
"be",
"BDS",
"code",
"1",
"0"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds10.py#L24-L53 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds17.py | is17 | def is17(msg):
"""Check if a message is likely to be BDS code 1,7
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
if bin2int(d[28:56]) != 0:
return False
c... | python | def is17(msg):
"""Check if a message is likely to be BDS code 1,7
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
if bin2int(d[28:56]) != 0:
return False
c... | [
"def",
"is17",
"(",
"msg",
")",
":",
"if",
"allzeros",
"(",
"msg",
")",
":",
"return",
"False",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"bin2int",
"(",
"d",
"[",
"28",
":",
"56",
"]",
")",
"!=",
"0",
":",
"return",
"Fals... | Check if a message is likely to be BDS code 1,7
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False | [
"Check",
"if",
"a",
"message",
"is",
"likely",
"to",
"be",
"BDS",
"code",
"1",
"7"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds17.py#L27-L56 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds17.py | cap17 | def cap17(msg):
"""Extract capacities from BDS 1,7 message
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
list: list of suport BDS codes
"""
allbds = ['05', '06', '07', '08', '09', '0A', '20', '21', '40', '41',
'42', '43', '44', '45', '48', '50', '51... | python | def cap17(msg):
"""Extract capacities from BDS 1,7 message
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
list: list of suport BDS codes
"""
allbds = ['05', '06', '07', '08', '09', '0A', '20', '21', '40', '41',
'42', '43', '44', '45', '48', '50', '51... | [
"def",
"cap17",
"(",
"msg",
")",
":",
"allbds",
"=",
"[",
"'05'",
",",
"'06'",
",",
"'07'",
",",
"'08'",
",",
"'09'",
",",
"'0A'",
",",
"'20'",
",",
"'21'",
",",
"'40'",
",",
"'41'",
",",
"'42'",
",",
"'43'",
",",
"'44'",
",",
"'45'",
",",
"'... | Extract capacities from BDS 1,7 message
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
list: list of suport BDS codes | [
"Extract",
"capacities",
"from",
"BDS",
"1",
"7",
"message"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds17.py#L58-L75 | train |
junzis/pyModeS | pyModeS/streamer/stream.py | Stream.get_aircraft | def get_aircraft(self):
"""all aircraft that are stored in memeory"""
acs = self.acs
icaos = list(acs.keys())
for icao in icaos:
if acs[icao]['lat'] is None:
acs.pop(icao)
return acs | python | def get_aircraft(self):
"""all aircraft that are stored in memeory"""
acs = self.acs
icaos = list(acs.keys())
for icao in icaos:
if acs[icao]['lat'] is None:
acs.pop(icao)
return acs | [
"def",
"get_aircraft",
"(",
"self",
")",
":",
"acs",
"=",
"self",
".",
"acs",
"icaos",
"=",
"list",
"(",
"acs",
".",
"keys",
"(",
")",
")",
"for",
"icao",
"in",
"icaos",
":",
"if",
"acs",
"[",
"icao",
"]",
"[",
"'lat'",
"]",
"is",
"None",
":",
... | all aircraft that are stored in memeory | [
"all",
"aircraft",
"that",
"are",
"stored",
"in",
"memeory"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/streamer/stream.py#L248-L255 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds09.py | altitude_diff | def altitude_diff(msg):
"""Decode the differece between GNSS and barometric altitude
Args:
msg (string): 28 bytes hexadecimal message string, TC=19
Returns:
int: Altitude difference in ft. Negative value indicates GNSS altitude
below barometric altitude.
"""
tc = common... | python | def altitude_diff(msg):
"""Decode the differece between GNSS and barometric altitude
Args:
msg (string): 28 bytes hexadecimal message string, TC=19
Returns:
int: Altitude difference in ft. Negative value indicates GNSS altitude
below barometric altitude.
"""
tc = common... | [
"def",
"altitude_diff",
"(",
"msg",
")",
":",
"tc",
"=",
"common",
".",
"typecode",
"(",
"msg",
")",
"if",
"tc",
"!=",
"19",
":",
"raise",
"RuntimeError",
"(",
"\"%s: Not a airborne velocity message, expecting TC=19\"",
"%",
"msg",
")",
"msgbin",
"=",
"common"... | Decode the differece between GNSS and barometric altitude
Args:
msg (string): 28 bytes hexadecimal message string, TC=19
Returns:
int: Altitude difference in ft. Negative value indicates GNSS altitude
below barometric altitude. | [
"Decode",
"the",
"differece",
"between",
"GNSS",
"and",
"barometric",
"altitude"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds09.py#L93-L115 | train |
junzis/pyModeS | pyModeS/decoder/bds/__init__.py | is50or60 | def is50or60(msg, spd_ref, trk_ref, alt_ref):
"""Use reference ground speed and trk to determine BDS50 and DBS60.
Args:
msg (String): 28 bytes hexadecimal message string
spd_ref (float): reference speed (ADS-B ground speed), kts
trk_ref (float): reference track (ADS-B track angle), deg
... | python | def is50or60(msg, spd_ref, trk_ref, alt_ref):
"""Use reference ground speed and trk to determine BDS50 and DBS60.
Args:
msg (String): 28 bytes hexadecimal message string
spd_ref (float): reference speed (ADS-B ground speed), kts
trk_ref (float): reference track (ADS-B track angle), deg
... | [
"def",
"is50or60",
"(",
"msg",
",",
"spd_ref",
",",
"trk_ref",
",",
"alt_ref",
")",
":",
"def",
"vxy",
"(",
"v",
",",
"angle",
")",
":",
"vx",
"=",
"v",
"*",
"np",
".",
"sin",
"(",
"np",
".",
"radians",
"(",
"angle",
")",
")",
"vy",
"=",
"v",... | Use reference ground speed and trk to determine BDS50 and DBS60.
Args:
msg (String): 28 bytes hexadecimal message string
spd_ref (float): reference speed (ADS-B ground speed), kts
trk_ref (float): reference track (ADS-B track angle), deg
alt_ref (float): reference altitude (ADS-B al... | [
"Use",
"reference",
"ground",
"speed",
"and",
"trk",
"to",
"determine",
"BDS50",
"and",
"DBS60",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/__init__.py#L30-L89 | train |
junzis/pyModeS | pyModeS/decoder/bds/__init__.py | infer | def infer(msg, mrar=False):
"""Estimate the most likely BDS code of an message.
Args:
msg (String): 28 bytes hexadecimal message string
mrar (bool): Also infer MRAR (BDS 44) and MHR (BDS 45). Defaults to False.
Returns:
String or None: BDS version, or possible versions, or None if ... | python | def infer(msg, mrar=False):
"""Estimate the most likely BDS code of an message.
Args:
msg (String): 28 bytes hexadecimal message string
mrar (bool): Also infer MRAR (BDS 44) and MHR (BDS 45). Defaults to False.
Returns:
String or None: BDS version, or possible versions, or None if ... | [
"def",
"infer",
"(",
"msg",
",",
"mrar",
"=",
"False",
")",
":",
"df",
"=",
"common",
".",
"df",
"(",
"msg",
")",
"if",
"common",
".",
"allzeros",
"(",
"msg",
")",
":",
"return",
"'EMPTY'",
"if",
"df",
"==",
"17",
":",
"tc",
"=",
"common",
".",... | Estimate the most likely BDS code of an message.
Args:
msg (String): 28 bytes hexadecimal message string
mrar (bool): Also infer MRAR (BDS 44) and MHR (BDS 45). Defaults to False.
Returns:
String or None: BDS version, or possible versions, or None if nothing matches. | [
"Estimate",
"the",
"most",
"likely",
"BDS",
"code",
"of",
"an",
"message",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/__init__.py#L92-L154 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds40.py | is40 | def is40(msg):
"""Check if a message is likely to be BDS code 4,0
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
# status bit 1, 14, and 27
if wrongstatus(d, 1, 2... | python | def is40(msg):
"""Check if a message is likely to be BDS code 4,0
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
# status bit 1, 14, and 27
if wrongstatus(d, 1, 2... | [
"def",
"is40",
"(",
"msg",
")",
":",
"if",
"allzeros",
"(",
"msg",
")",
":",
"return",
"False",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"wrongstatus",
"(",
"d",
",",
"1",
",",
"2",
",",
"13",
")",
":",
"return",
"False",
... | Check if a message is likely to be BDS code 4,0
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False | [
"Check",
"if",
"a",
"message",
"is",
"likely",
"to",
"be",
"BDS",
"code",
"4",
"0"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds40.py#L25-L65 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds40.py | alt40fms | def alt40fms(msg):
"""Selected altitude, FMS
Args:
msg (String): 28 bytes hexadecimal message (BDS40) string
Returns:
int: altitude in feet
"""
d = hex2bin(data(msg))
if d[13] == '0':
return None
alt = bin2int(d[14:26]) * 16 # ft
return alt | python | def alt40fms(msg):
"""Selected altitude, FMS
Args:
msg (String): 28 bytes hexadecimal message (BDS40) string
Returns:
int: altitude in feet
"""
d = hex2bin(data(msg))
if d[13] == '0':
return None
alt = bin2int(d[14:26]) * 16 # ft
return alt | [
"def",
"alt40fms",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"13",
"]",
"==",
"'0'",
":",
"return",
"None",
"alt",
"=",
"bin2int",
"(",
"d",
"[",
"14",
":",
"26",
"]",
")",
"*",
"16",
"ret... | Selected altitude, FMS
Args:
msg (String): 28 bytes hexadecimal message (BDS40) string
Returns:
int: altitude in feet | [
"Selected",
"altitude",
"FMS"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds40.py#L86-L101 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds40.py | p40baro | def p40baro(msg):
"""Barometric pressure setting
Args:
msg (String): 28 bytes hexadecimal message (BDS40) string
Returns:
float: pressure in millibar
"""
d = hex2bin(data(msg))
if d[26] == '0':
return None
p = bin2int(d[27:39]) * 0.1 + 800 # millibar
return... | python | def p40baro(msg):
"""Barometric pressure setting
Args:
msg (String): 28 bytes hexadecimal message (BDS40) string
Returns:
float: pressure in millibar
"""
d = hex2bin(data(msg))
if d[26] == '0':
return None
p = bin2int(d[27:39]) * 0.1 + 800 # millibar
return... | [
"def",
"p40baro",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"26",
"]",
"==",
"'0'",
":",
"return",
"None",
"p",
"=",
"bin2int",
"(",
"d",
"[",
"27",
":",
"39",
"]",
")",
"*",
"0.1",
"+",
... | Barometric pressure setting
Args:
msg (String): 28 bytes hexadecimal message (BDS40) string
Returns:
float: pressure in millibar | [
"Barometric",
"pressure",
"setting"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds40.py#L104-L119 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds44.py | is44 | def is44(msg):
"""Check if a message is likely to be BDS code 4,4.
Meteorological routine air report
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
# status bit 5... | python | def is44(msg):
"""Check if a message is likely to be BDS code 4,4.
Meteorological routine air report
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
# status bit 5... | [
"def",
"is44",
"(",
"msg",
")",
":",
"if",
"allzeros",
"(",
"msg",
")",
":",
"return",
"False",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"wrongstatus",
"(",
"d",
",",
"5",
",",
"6",
",",
"23",
")",
":",
"return",
"False",
... | Check if a message is likely to be BDS code 4,4.
Meteorological routine air report
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False | [
"Check",
"if",
"a",
"message",
"is",
"likely",
"to",
"be",
"BDS",
"code",
"4",
"4",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds44.py#L25-L67 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds44.py | wind44 | def wind44(msg):
"""Wind speed and direction.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
(int, float): speed (kt), direction (degree)
"""
d = hex2bin(data(msg))
status = int(d[4])
if not status:
return None
speed = bin2int(d[5:14]) # k... | python | def wind44(msg):
"""Wind speed and direction.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
(int, float): speed (kt), direction (degree)
"""
d = hex2bin(data(msg))
status = int(d[4])
if not status:
return None
speed = bin2int(d[5:14]) # k... | [
"def",
"wind44",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"status",
"=",
"int",
"(",
"d",
"[",
"4",
"]",
")",
"if",
"not",
"status",
":",
"return",
"None",
"speed",
"=",
"bin2int",
"(",
"d",
"[",
"5",
":",... | Wind speed and direction.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
(int, float): speed (kt), direction (degree) | [
"Wind",
"speed",
"and",
"direction",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds44.py#L70-L89 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds44.py | p44 | def p44(msg):
"""Static pressure.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: static pressure in hPa
"""
d = hex2bin(data(msg))
if d[34] == '0':
return None
p = bin2int(d[35:46]) # hPa
return p | python | def p44(msg):
"""Static pressure.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: static pressure in hPa
"""
d = hex2bin(data(msg))
if d[34] == '0':
return None
p = bin2int(d[35:46]) # hPa
return p | [
"def",
"p44",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"34",
"]",
"==",
"'0'",
":",
"return",
"None",
"p",
"=",
"bin2int",
"(",
"d",
"[",
"35",
":",
"46",
"]",
")",
"return",
"p"
] | Static pressure.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: static pressure in hPa | [
"Static",
"pressure",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds44.py#L121-L138 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds60.py | is60 | def is60(msg):
"""Check if a message is likely to be BDS code 6,0
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
# status bit 1, 13, 24, 35, 46
if wrongstatus(d, ... | python | def is60(msg):
"""Check if a message is likely to be BDS code 6,0
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
# status bit 1, 13, 24, 35, 46
if wrongstatus(d, ... | [
"def",
"is60",
"(",
"msg",
")",
":",
"if",
"allzeros",
"(",
"msg",
")",
":",
"return",
"False",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"wrongstatus",
"(",
"d",
",",
"1",
",",
"2",
",",
"12",
")",
":",
"return",
"False",
... | Check if a message is likely to be BDS code 6,0
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False | [
"Check",
"if",
"a",
"message",
"is",
"likely",
"to",
"be",
"BDS",
"code",
"6",
"0"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds60.py#L24-L72 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds60.py | hdg60 | def hdg60(msg):
"""Megnetic heading of aircraft
Args:
msg (String): 28 bytes hexadecimal message (BDS60) string
Returns:
float: heading in degrees to megnetic north (from 0 to 360)
"""
d = hex2bin(data(msg))
if d[0] == '0':
return None
sign = int(d[1]) # 1 -> w... | python | def hdg60(msg):
"""Megnetic heading of aircraft
Args:
msg (String): 28 bytes hexadecimal message (BDS60) string
Returns:
float: heading in degrees to megnetic north (from 0 to 360)
"""
d = hex2bin(data(msg))
if d[0] == '0':
return None
sign = int(d[1]) # 1 -> w... | [
"def",
"hdg60",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"0",
"]",
"==",
"'0'",
":",
"return",
"None",
"sign",
"=",
"int",
"(",
"d",
"[",
"1",
"]",
")",
"value",
"=",
"bin2int",
"(",
"d",... | Megnetic heading of aircraft
Args:
msg (String): 28 bytes hexadecimal message (BDS60) string
Returns:
float: heading in degrees to megnetic north (from 0 to 360) | [
"Megnetic",
"heading",
"of",
"aircraft"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds60.py#L75-L101 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds60.py | mach60 | def mach60(msg):
"""Aircraft MACH number
Args:
msg (String): 28 bytes hexadecimal message (BDS60) string
Returns:
float: MACH number
"""
d = hex2bin(data(msg))
if d[23] == '0':
return None
mach = bin2int(d[24:34]) * 2.048 / 512.0
return round(mach, 3) | python | def mach60(msg):
"""Aircraft MACH number
Args:
msg (String): 28 bytes hexadecimal message (BDS60) string
Returns:
float: MACH number
"""
d = hex2bin(data(msg))
if d[23] == '0':
return None
mach = bin2int(d[24:34]) * 2.048 / 512.0
return round(mach, 3) | [
"def",
"mach60",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"23",
"]",
"==",
"'0'",
":",
"return",
"None",
"mach",
"=",
"bin2int",
"(",
"d",
"[",
"24",
":",
"34",
"]",
")",
"*",
"2.048",
"/... | Aircraft MACH number
Args:
msg (String): 28 bytes hexadecimal message (BDS60) string
Returns:
float: MACH number | [
"Aircraft",
"MACH",
"number"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds60.py#L122-L137 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds60.py | vr60baro | def vr60baro(msg):
"""Vertical rate from barometric measurement, this value may be very noisy.
Args:
msg (String): 28 bytes hexadecimal message (BDS60) string
Returns:
int: vertical rate in feet/minutes
"""
d = hex2bin(data(msg))
if d[34] == '0':
return None
sign ... | python | def vr60baro(msg):
"""Vertical rate from barometric measurement, this value may be very noisy.
Args:
msg (String): 28 bytes hexadecimal message (BDS60) string
Returns:
int: vertical rate in feet/minutes
"""
d = hex2bin(data(msg))
if d[34] == '0':
return None
sign ... | [
"def",
"vr60baro",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"34",
"]",
"==",
"'0'",
":",
"return",
"None",
"sign",
"=",
"int",
"(",
"d",
"[",
"35",
"]",
")",
"value",
"=",
"bin2int",
"(",
... | Vertical rate from barometric measurement, this value may be very noisy.
Args:
msg (String): 28 bytes hexadecimal message (BDS60) string
Returns:
int: vertical rate in feet/minutes | [
"Vertical",
"rate",
"from",
"barometric",
"measurement",
"this",
"value",
"may",
"be",
"very",
"noisy",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds60.py#L140-L163 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds45.py | is45 | def is45(msg):
"""Check if a message is likely to be BDS code 4,5.
Meteorological hazard report
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
# status bit 1, 4, ... | python | def is45(msg):
"""Check if a message is likely to be BDS code 4,5.
Meteorological hazard report
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False
"""
if allzeros(msg):
return False
d = hex2bin(data(msg))
# status bit 1, 4, ... | [
"def",
"is45",
"(",
"msg",
")",
":",
"if",
"allzeros",
"(",
"msg",
")",
":",
"return",
"False",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"wrongstatus",
"(",
"d",
",",
"1",
",",
"2",
",",
"3",
")",
":",
"return",
"False",
... | Check if a message is likely to be BDS code 4,5.
Meteorological hazard report
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
bool: True or False | [
"Check",
"if",
"a",
"message",
"is",
"likely",
"to",
"be",
"BDS",
"code",
"4",
"5",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds45.py#L25-L76 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds45.py | ws45 | def ws45(msg):
"""Wind shear.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: Wind shear level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
"""
d = hex2bin(data(msg))
if d[3] == '0':
return None
ws = bin2int(d[4:6])
return ws | python | def ws45(msg):
"""Wind shear.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: Wind shear level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
"""
d = hex2bin(data(msg))
if d[3] == '0':
return None
ws = bin2int(d[4:6])
return ws | [
"def",
"ws45",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"3",
"]",
"==",
"'0'",
":",
"return",
"None",
"ws",
"=",
"bin2int",
"(",
"d",
"[",
"4",
":",
"6",
"]",
")",
"return",
"ws"
] | Wind shear.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: Wind shear level. 0=NIL, 1=Light, 2=Moderate, 3=Severe | [
"Wind",
"shear",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds45.py#L97-L112 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds45.py | wv45 | def wv45(msg):
"""Wake vortex.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: Wake vortex level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
"""
d = hex2bin(data(msg))
if d[12] == '0':
return None
ws = bin2int(d[13:15])
return ws | python | def wv45(msg):
"""Wake vortex.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: Wake vortex level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
"""
d = hex2bin(data(msg))
if d[12] == '0':
return None
ws = bin2int(d[13:15])
return ws | [
"def",
"wv45",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"12",
"]",
"==",
"'0'",
":",
"return",
"None",
"ws",
"=",
"bin2int",
"(",
"d",
"[",
"13",
":",
"15",
"]",
")",
"return",
"ws"
] | Wake vortex.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: Wake vortex level. 0=NIL, 1=Light, 2=Moderate, 3=Severe | [
"Wake",
"vortex",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds45.py#L151-L166 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds45.py | p45 | def p45(msg):
"""Average static pressure.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: static pressure in hPa
"""
d = hex2bin(data(msg))
if d[26] == '0':
return None
p = bin2int(d[27:38]) # hPa
return p | python | def p45(msg):
"""Average static pressure.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: static pressure in hPa
"""
d = hex2bin(data(msg))
if d[26] == '0':
return None
p = bin2int(d[27:38]) # hPa
return p | [
"def",
"p45",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"26",
"]",
"==",
"'0'",
":",
"return",
"None",
"p",
"=",
"bin2int",
"(",
"d",
"[",
"27",
":",
"38",
"]",
")",
"return",
"p"
] | Average static pressure.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: static pressure in hPa | [
"Average",
"static",
"pressure",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds45.py#L193-L207 | train |
junzis/pyModeS | pyModeS/decoder/bds/bds45.py | rh45 | def rh45(msg):
"""Radio height.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: radio height in ft
"""
d = hex2bin(data(msg))
if d[38] == '0':
return None
rh = bin2int(d[39:51]) * 16
return rh | python | def rh45(msg):
"""Radio height.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: radio height in ft
"""
d = hex2bin(data(msg))
if d[38] == '0':
return None
rh = bin2int(d[39:51]) * 16
return rh | [
"def",
"rh45",
"(",
"msg",
")",
":",
"d",
"=",
"hex2bin",
"(",
"data",
"(",
"msg",
")",
")",
"if",
"d",
"[",
"38",
"]",
"==",
"'0'",
":",
"return",
"None",
"rh",
"=",
"bin2int",
"(",
"d",
"[",
"39",
":",
"51",
"]",
")",
"*",
"16",
"return",... | Radio height.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: radio height in ft | [
"Radio",
"height",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/decoder/bds/bds45.py#L210-L224 | train |
junzis/pyModeS | pyModeS/extra/aero.py | vsound | def vsound(H):
"""Speed of sound"""
T = temperature(H)
a = np.sqrt(gamma * R * T)
return a | python | def vsound(H):
"""Speed of sound"""
T = temperature(H)
a = np.sqrt(gamma * R * T)
return a | [
"def",
"vsound",
"(",
"H",
")",
":",
"T",
"=",
"temperature",
"(",
"H",
")",
"a",
"=",
"np",
".",
"sqrt",
"(",
"gamma",
"*",
"R",
"*",
"T",
")",
"return",
"a"
] | Speed of sound | [
"Speed",
"of",
"sound"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/extra/aero.py#L78-L82 | train |
junzis/pyModeS | pyModeS/extra/aero.py | distance | def distance(lat1, lon1, lat2, lon2, H=0):
"""
Compute spherical distance from spherical coordinates.
For two locations in spherical coordinates
(1, theta, phi) and (1, theta', phi')
cosine( arc length ) =
sin phi sin phi' cos(theta-theta') + cos phi cos phi'
distance = rho * arc length
... | python | def distance(lat1, lon1, lat2, lon2, H=0):
"""
Compute spherical distance from spherical coordinates.
For two locations in spherical coordinates
(1, theta, phi) and (1, theta', phi')
cosine( arc length ) =
sin phi sin phi' cos(theta-theta') + cos phi cos phi'
distance = rho * arc length
... | [
"def",
"distance",
"(",
"lat1",
",",
"lon1",
",",
"lat2",
",",
"lon2",
",",
"H",
"=",
"0",
")",
":",
"phi1",
"=",
"np",
".",
"radians",
"(",
"90.0",
"-",
"lat1",
")",
"phi2",
"=",
"np",
".",
"radians",
"(",
"90.0",
"-",
"lat2",
")",
"theta1",
... | Compute spherical distance from spherical coordinates.
For two locations in spherical coordinates
(1, theta, phi) and (1, theta', phi')
cosine( arc length ) =
sin phi sin phi' cos(theta-theta') + cos phi cos phi'
distance = rho * arc length | [
"Compute",
"spherical",
"distance",
"from",
"spherical",
"coordinates",
"."
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/extra/aero.py#L85-L109 | train |
junzis/pyModeS | pyModeS/extra/aero.py | tas2mach | def tas2mach(Vtas, H):
"""True Airspeed to Mach number"""
a = vsound(H)
Mach = Vtas/a
return Mach | python | def tas2mach(Vtas, H):
"""True Airspeed to Mach number"""
a = vsound(H)
Mach = Vtas/a
return Mach | [
"def",
"tas2mach",
"(",
"Vtas",
",",
"H",
")",
":",
"a",
"=",
"vsound",
"(",
"H",
")",
"Mach",
"=",
"Vtas",
"/",
"a",
"return",
"Mach"
] | True Airspeed to Mach number | [
"True",
"Airspeed",
"to",
"Mach",
"number"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/extra/aero.py#L129-L133 | train |
junzis/pyModeS | pyModeS/extra/aero.py | mach2tas | def mach2tas(Mach, H):
"""Mach number to True Airspeed"""
a = vsound(H)
Vtas = Mach*a
return Vtas | python | def mach2tas(Mach, H):
"""Mach number to True Airspeed"""
a = vsound(H)
Vtas = Mach*a
return Vtas | [
"def",
"mach2tas",
"(",
"Mach",
",",
"H",
")",
":",
"a",
"=",
"vsound",
"(",
"H",
")",
"Vtas",
"=",
"Mach",
"*",
"a",
"return",
"Vtas"
] | Mach number to True Airspeed | [
"Mach",
"number",
"to",
"True",
"Airspeed"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/extra/aero.py#L136-L140 | train |
junzis/pyModeS | pyModeS/extra/aero.py | tas2eas | def tas2eas(Vtas, H):
"""True Airspeed to Equivalent Airspeed"""
rho = density(H)
Veas = Vtas * np.sqrt(rho/rho0)
return Veas | python | def tas2eas(Vtas, H):
"""True Airspeed to Equivalent Airspeed"""
rho = density(H)
Veas = Vtas * np.sqrt(rho/rho0)
return Veas | [
"def",
"tas2eas",
"(",
"Vtas",
",",
"H",
")",
":",
"rho",
"=",
"density",
"(",
"H",
")",
"Veas",
"=",
"Vtas",
"*",
"np",
".",
"sqrt",
"(",
"rho",
"/",
"rho0",
")",
"return",
"Veas"
] | True Airspeed to Equivalent Airspeed | [
"True",
"Airspeed",
"to",
"Equivalent",
"Airspeed"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/extra/aero.py#L150-L154 | train |
junzis/pyModeS | pyModeS/extra/aero.py | cas2tas | def cas2tas(Vcas, H):
"""Calibrated Airspeed to True Airspeed"""
p, rho, T = atmos(H)
qdyn = p0*((1.+rho0*Vcas*Vcas/(7.*p0))**3.5-1.)
Vtas = np.sqrt(7.*p/rho*((1.+qdyn/p)**(2./7.)-1.))
return Vtas | python | def cas2tas(Vcas, H):
"""Calibrated Airspeed to True Airspeed"""
p, rho, T = atmos(H)
qdyn = p0*((1.+rho0*Vcas*Vcas/(7.*p0))**3.5-1.)
Vtas = np.sqrt(7.*p/rho*((1.+qdyn/p)**(2./7.)-1.))
return Vtas | [
"def",
"cas2tas",
"(",
"Vcas",
",",
"H",
")",
":",
"p",
",",
"rho",
",",
"T",
"=",
"atmos",
"(",
"H",
")",
"qdyn",
"=",
"p0",
"*",
"(",
"(",
"1.",
"+",
"rho0",
"*",
"Vcas",
"*",
"Vcas",
"/",
"(",
"7.",
"*",
"p0",
")",
")",
"**",
"3.5",
... | Calibrated Airspeed to True Airspeed | [
"Calibrated",
"Airspeed",
"to",
"True",
"Airspeed"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/extra/aero.py#L157-L162 | train |
junzis/pyModeS | pyModeS/extra/aero.py | mach2cas | def mach2cas(Mach, H):
"""Mach number to Calibrated Airspeed"""
Vtas = mach2tas(Mach, H)
Vcas = tas2cas(Vtas, H)
return Vcas | python | def mach2cas(Mach, H):
"""Mach number to Calibrated Airspeed"""
Vtas = mach2tas(Mach, H)
Vcas = tas2cas(Vtas, H)
return Vcas | [
"def",
"mach2cas",
"(",
"Mach",
",",
"H",
")",
":",
"Vtas",
"=",
"mach2tas",
"(",
"Mach",
",",
"H",
")",
"Vcas",
"=",
"tas2cas",
"(",
"Vtas",
",",
"H",
")",
"return",
"Vcas"
] | Mach number to Calibrated Airspeed | [
"Mach",
"number",
"to",
"Calibrated",
"Airspeed"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/extra/aero.py#L173-L177 | train |
junzis/pyModeS | pyModeS/extra/aero.py | cas2mach | def cas2mach(Vcas, H):
"""Calibrated Airspeed to Mach number"""
Vtas = cas2tas(Vcas, H)
Mach = tas2mach(Vtas, H)
return Mach | python | def cas2mach(Vcas, H):
"""Calibrated Airspeed to Mach number"""
Vtas = cas2tas(Vcas, H)
Mach = tas2mach(Vtas, H)
return Mach | [
"def",
"cas2mach",
"(",
"Vcas",
",",
"H",
")",
":",
"Vtas",
"=",
"cas2tas",
"(",
"Vcas",
",",
"H",
")",
"Mach",
"=",
"tas2mach",
"(",
"Vtas",
",",
"H",
")",
"return",
"Mach"
] | Calibrated Airspeed to Mach number | [
"Calibrated",
"Airspeed",
"to",
"Mach",
"number"
] | 8cd5655a04b08171a9ad5f1ffd232b7e0178ea53 | https://github.com/junzis/pyModeS/blob/8cd5655a04b08171a9ad5f1ffd232b7e0178ea53/pyModeS/extra/aero.py#L180-L184 | train |
agusmakmun/django-markdown-editor | martor/views.py | markdown_search_user | def markdown_search_user(request):
"""
Json usernames of the users registered & actived.
url(method=get):
/martor/search-user/?username={username}
Response:
error:
- `status` is status code (204)
- `error` is error message.
success:
- `status... | python | def markdown_search_user(request):
"""
Json usernames of the users registered & actived.
url(method=get):
/martor/search-user/?username={username}
Response:
error:
- `status` is status code (204)
- `error` is error message.
success:
- `status... | [
"def",
"markdown_search_user",
"(",
"request",
")",
":",
"data",
"=",
"{",
"}",
"username",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'username'",
")",
"if",
"username",
"is",
"not",
"None",
"and",
"username",
"!=",
"''",
"and",
"' '",
"not",
"in",... | Json usernames of the users registered & actived.
url(method=get):
/martor/search-user/?username={username}
Response:
error:
- `status` is status code (204)
- `error` is error message.
success:
- `status` is status code (204)
- `data` is ... | [
"Json",
"usernames",
"of",
"the",
"users",
"registered",
"&",
"actived",
"."
] | 5ef9b947d247d05dfd1d14dff44c5a6e83372985 | https://github.com/agusmakmun/django-markdown-editor/blob/5ef9b947d247d05dfd1d14dff44c5a6e83372985/martor/views.py#L37-L85 | train |
agusmakmun/django-markdown-editor | martor/extensions/mention.py | MentionPattern.handleMatch | def handleMatch(self, m):
username = self.unescape(m.group(2))
"""Makesure `username` is registered and actived."""
if MARTOR_ENABLE_CONFIGS['mention'] == 'true':
if username in [u.username for u in User.objects.exclude(is_active=False)]:
url = '{0}{1}/'.format(MARTO... | python | def handleMatch(self, m):
username = self.unescape(m.group(2))
"""Makesure `username` is registered and actived."""
if MARTOR_ENABLE_CONFIGS['mention'] == 'true':
if username in [u.username for u in User.objects.exclude(is_active=False)]:
url = '{0}{1}/'.format(MARTO... | [
"def",
"handleMatch",
"(",
"self",
",",
"m",
")",
":",
"username",
"=",
"self",
".",
"unescape",
"(",
"m",
".",
"group",
"(",
"2",
")",
")",
"if",
"MARTOR_ENABLE_CONFIGS",
"[",
"'mention'",
"]",
"==",
"'true'",
":",
"if",
"username",
"in",
"[",
"u",
... | Makesure `username` is registered and actived. | [
"Makesure",
"username",
"is",
"registered",
"and",
"actived",
"."
] | 5ef9b947d247d05dfd1d14dff44c5a6e83372985 | https://github.com/agusmakmun/django-markdown-editor/blob/5ef9b947d247d05dfd1d14dff44c5a6e83372985/martor/extensions/mention.py#L24-L35 | train |
agusmakmun/django-markdown-editor | martor/utils.py | markdownify | def markdownify(markdown_content):
"""
Render the markdown content to HTML.
Basic:
>>> from martor.utils import markdownify
>>> content = ""
>>> markdownify(content)
'<p><img alt="awesome" src="http://i.imgur.com/hvguiSn.jpg" /></p>'... | python | def markdownify(markdown_content):
"""
Render the markdown content to HTML.
Basic:
>>> from martor.utils import markdownify
>>> content = ""
>>> markdownify(content)
'<p><img alt="awesome" src="http://i.imgur.com/hvguiSn.jpg" /></p>'... | [
"def",
"markdownify",
"(",
"markdown_content",
")",
":",
"try",
":",
"return",
"markdown",
".",
"markdown",
"(",
"markdown_content",
",",
"safe_mode",
"=",
"MARTOR_MARKDOWN_SAFE_MODE",
",",
"extensions",
"=",
"MARTOR_MARKDOWN_EXTENSIONS",
",",
"extension_configs",
"="... | Render the markdown content to HTML.
Basic:
>>> from martor.utils import markdownify
>>> content = ""
>>> markdownify(content)
'<p><img alt="awesome" src="http://i.imgur.com/hvguiSn.jpg" /></p>'
>>> | [
"Render",
"the",
"markdown",
"content",
"to",
"HTML",
"."
] | 5ef9b947d247d05dfd1d14dff44c5a6e83372985 | https://github.com/agusmakmun/django-markdown-editor/blob/5ef9b947d247d05dfd1d14dff44c5a6e83372985/martor/utils.py#L17-L37 | train |
APSL/puput | puput/urls.py | get_entry_url | def get_entry_url(entry, blog_page, root_page):
"""
Get the entry url given and entry page a blog page instances.
It will use an url or another depending if blog_page is the root page.
"""
if root_page == blog_page:
return reverse('entry_page_serve', kwargs={
'year': entry.date.s... | python | def get_entry_url(entry, blog_page, root_page):
"""
Get the entry url given and entry page a blog page instances.
It will use an url or another depending if blog_page is the root page.
"""
if root_page == blog_page:
return reverse('entry_page_serve', kwargs={
'year': entry.date.s... | [
"def",
"get_entry_url",
"(",
"entry",
",",
"blog_page",
",",
"root_page",
")",
":",
"if",
"root_page",
"==",
"blog_page",
":",
"return",
"reverse",
"(",
"'entry_page_serve'",
",",
"kwargs",
"=",
"{",
"'year'",
":",
"entry",
".",
"date",
".",
"strftime",
"(... | Get the entry url given and entry page a blog page instances.
It will use an url or another depending if blog_page is the root page. | [
"Get",
"the",
"entry",
"url",
"given",
"and",
"entry",
"page",
"a",
"blog",
"page",
"instances",
".",
"It",
"will",
"use",
"an",
"url",
"or",
"another",
"depending",
"if",
"blog_page",
"is",
"the",
"root",
"page",
"."
] | c3294f6bb0dd784f881ce9e3089cbf40d0528e47 | https://github.com/APSL/puput/blob/c3294f6bb0dd784f881ce9e3089cbf40d0528e47/puput/urls.py#L63-L88 | train |
APSL/puput | puput/urls.py | get_feeds_url | def get_feeds_url(blog_page, root_page):
"""
Get the feeds urls a blog page instance.
It will use an url or another depending if blog_page is the root page.
"""
if root_page == blog_page:
return reverse('blog_page_feed')
else:
blog_path = strip_prefix_and_ending_slash(blog_page.s... | python | def get_feeds_url(blog_page, root_page):
"""
Get the feeds urls a blog page instance.
It will use an url or another depending if blog_page is the root page.
"""
if root_page == blog_page:
return reverse('blog_page_feed')
else:
blog_path = strip_prefix_and_ending_slash(blog_page.s... | [
"def",
"get_feeds_url",
"(",
"blog_page",
",",
"root_page",
")",
":",
"if",
"root_page",
"==",
"blog_page",
":",
"return",
"reverse",
"(",
"'blog_page_feed'",
")",
"else",
":",
"blog_path",
"=",
"strip_prefix_and_ending_slash",
"(",
"blog_page",
".",
"specific",
... | Get the feeds urls a blog page instance.
It will use an url or another depending if blog_page is the root page. | [
"Get",
"the",
"feeds",
"urls",
"a",
"blog",
"page",
"instance",
".",
"It",
"will",
"use",
"an",
"url",
"or",
"another",
"depending",
"if",
"blog_page",
"is",
"the",
"root",
"page",
"."
] | c3294f6bb0dd784f881ce9e3089cbf40d0528e47 | https://github.com/APSL/puput/blob/c3294f6bb0dd784f881ce9e3089cbf40d0528e47/puput/urls.py#L91-L100 | train |
cs50/check50 | check50/__main__.py | install_dependencies | def install_dependencies(dependencies, verbose=False):
"""Install all packages in dependency list via pip."""
if not dependencies:
return
stdout = stderr = None if verbose else subprocess.DEVNULL
with tempfile.TemporaryDirectory() as req_dir:
req_file = Path(req_dir) / "requirements.txt... | python | def install_dependencies(dependencies, verbose=False):
"""Install all packages in dependency list via pip."""
if not dependencies:
return
stdout = stderr = None if verbose else subprocess.DEVNULL
with tempfile.TemporaryDirectory() as req_dir:
req_file = Path(req_dir) / "requirements.txt... | [
"def",
"install_dependencies",
"(",
"dependencies",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"not",
"dependencies",
":",
"return",
"stdout",
"=",
"stderr",
"=",
"None",
"if",
"verbose",
"else",
"subprocess",
".",
"DEVNULL",
"with",
"tempfile",
".",
"Tem... | Install all packages in dependency list via pip. | [
"Install",
"all",
"packages",
"in",
"dependency",
"list",
"via",
"pip",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/__main__.py#L108-L132 | train |
cs50/check50 | check50/__main__.py | install_translations | def install_translations(config):
"""Add check translations according to ``config`` as a fallback to existing translations"""
if not config:
return
from . import _translation
checks_translation = gettext.translation(domain=config["domain"],
localedi... | python | def install_translations(config):
"""Add check translations according to ``config`` as a fallback to existing translations"""
if not config:
return
from . import _translation
checks_translation = gettext.translation(domain=config["domain"],
localedi... | [
"def",
"install_translations",
"(",
"config",
")",
":",
"if",
"not",
"config",
":",
"return",
"from",
".",
"import",
"_translation",
"checks_translation",
"=",
"gettext",
".",
"translation",
"(",
"domain",
"=",
"config",
"[",
"\"domain\"",
"]",
",",
"localedir... | Add check translations according to ``config`` as a fallback to existing translations | [
"Add",
"check",
"translations",
"according",
"to",
"config",
"as",
"a",
"fallback",
"to",
"existing",
"translations"
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/__main__.py#L134-L144 | train |
cs50/check50 | check50/api.py | hash | def hash(file):
"""
Hashes file using SHA-256.
:param file: name of file to be hashed
:type file: str
:rtype: str
:raises check50.Failure: if ``file`` does not exist
"""
exists(file)
log(_("hashing {}...").format(file))
# https://stackoverflow.com/a/22058673
with open(fil... | python | def hash(file):
"""
Hashes file using SHA-256.
:param file: name of file to be hashed
:type file: str
:rtype: str
:raises check50.Failure: if ``file`` does not exist
"""
exists(file)
log(_("hashing {}...").format(file))
# https://stackoverflow.com/a/22058673
with open(fil... | [
"def",
"hash",
"(",
"file",
")",
":",
"exists",
"(",
"file",
")",
"log",
"(",
"_",
"(",
"\"hashing {}...\"",
")",
".",
"format",
"(",
"file",
")",
")",
"with",
"open",
"(",
"file",
",",
"\"rb\"",
")",
"as",
"f",
":",
"sha256",
"=",
"hashlib",
"."... | Hashes file using SHA-256.
:param file: name of file to be hashed
:type file: str
:rtype: str
:raises check50.Failure: if ``file`` does not exist | [
"Hashes",
"file",
"using",
"SHA",
"-",
"256",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/api.py#L67-L86 | train |
cs50/check50 | check50/api.py | exists | def exists(*paths):
"""
Assert that all given paths exist.
:params paths: files/directories to be checked for existence
:raises check50.Failure: if any ``path in paths`` does not exist
Example usage::
check50.exists("foo.c", "foo.h")
"""
for path in paths:
log(_("checking... | python | def exists(*paths):
"""
Assert that all given paths exist.
:params paths: files/directories to be checked for existence
:raises check50.Failure: if any ``path in paths`` does not exist
Example usage::
check50.exists("foo.c", "foo.h")
"""
for path in paths:
log(_("checking... | [
"def",
"exists",
"(",
"*",
"paths",
")",
":",
"for",
"path",
"in",
"paths",
":",
"log",
"(",
"_",
"(",
"\"checking that {} exists...\"",
")",
".",
"format",
"(",
"path",
")",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":"... | Assert that all given paths exist.
:params paths: files/directories to be checked for existence
:raises check50.Failure: if any ``path in paths`` does not exist
Example usage::
check50.exists("foo.c", "foo.h") | [
"Assert",
"that",
"all",
"given",
"paths",
"exist",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/api.py#L89-L104 | train |
cs50/check50 | check50/api.py | import_checks | def import_checks(path):
"""
Import checks module given relative path.
:param path: relative path from which to import checks module
:type path: str
:returns: the imported module
:raises FileNotFoundError: if ``path / .check50.yaml`` does not exist
:raises yaml.YAMLError: if ``path / .check... | python | def import_checks(path):
"""
Import checks module given relative path.
:param path: relative path from which to import checks module
:type path: str
:returns: the imported module
:raises FileNotFoundError: if ``path / .check50.yaml`` does not exist
:raises yaml.YAMLError: if ``path / .check... | [
"def",
"import_checks",
"(",
"path",
")",
":",
"dir",
"=",
"internal",
".",
"check_dir",
"/",
"path",
"file",
"=",
"internal",
".",
"load_config",
"(",
"dir",
")",
"[",
"\"checks\"",
"]",
"mod",
"=",
"internal",
".",
"import_file",
"(",
"dir",
".",
"na... | Import checks module given relative path.
:param path: relative path from which to import checks module
:type path: str
:returns: the imported module
:raises FileNotFoundError: if ``path / .check50.yaml`` does not exist
:raises yaml.YAMLError: if ``path / .check50.yaml`` is not a valid YAML file
... | [
"Import",
"checks",
"module",
"given",
"relative",
"path",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/api.py#L107-L134 | train |
cs50/check50 | check50/api.py | _raw | def _raw(s):
"""Get raw representation of s, truncating if too long."""
if isinstance(s, list):
s = "\n".join(_raw(item) for item in s)
if s == EOF:
return "EOF"
s = repr(s) # Get raw representation of string
s = s[1:-1] # Strip away quotation marks
if len(s) > 15:
s... | python | def _raw(s):
"""Get raw representation of s, truncating if too long."""
if isinstance(s, list):
s = "\n".join(_raw(item) for item in s)
if s == EOF:
return "EOF"
s = repr(s) # Get raw representation of string
s = s[1:-1] # Strip away quotation marks
if len(s) > 15:
s... | [
"def",
"_raw",
"(",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"list",
")",
":",
"s",
"=",
"\"\\n\"",
".",
"join",
"(",
"_raw",
"(",
"item",
")",
"for",
"item",
"in",
"s",
")",
"if",
"s",
"==",
"EOF",
":",
"return",
"\"EOF\"",
"s",
"="... | Get raw representation of s, truncating if too long. | [
"Get",
"raw",
"representation",
"of",
"s",
"truncating",
"if",
"too",
"long",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/api.py#L400-L413 | train |
cs50/check50 | check50/api.py | _copy | def _copy(src, dst):
"""Copy src to dst, copying recursively if src is a directory."""
try:
shutil.copy(src, dst)
except IsADirectoryError:
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
shutil.copytree(src, dst) | python | def _copy(src, dst):
"""Copy src to dst, copying recursively if src is a directory."""
try:
shutil.copy(src, dst)
except IsADirectoryError:
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
shutil.copytree(src, dst) | [
"def",
"_copy",
"(",
"src",
",",
"dst",
")",
":",
"try",
":",
"shutil",
".",
"copy",
"(",
"src",
",",
"dst",
")",
"except",
"IsADirectoryError",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"dst",
")",
":",
"dst",
"=",
"os",
".",
"path",
".... | Copy src to dst, copying recursively if src is a directory. | [
"Copy",
"src",
"to",
"dst",
"copying",
"recursively",
"if",
"src",
"is",
"a",
"directory",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/api.py#L416-L423 | train |
cs50/check50 | check50/api.py | run.stdin | def stdin(self, line, prompt=True, timeout=3):
"""
Send line to stdin, optionally expect a prompt.
:param line: line to be send to stdin
:type line: str
:param prompt: boolean indicating whether a prompt is expected, if True absorbs \
all of stdout before ... | python | def stdin(self, line, prompt=True, timeout=3):
"""
Send line to stdin, optionally expect a prompt.
:param line: line to be send to stdin
:type line: str
:param prompt: boolean indicating whether a prompt is expected, if True absorbs \
all of stdout before ... | [
"def",
"stdin",
"(",
"self",
",",
"line",
",",
"prompt",
"=",
"True",
",",
"timeout",
"=",
"3",
")",
":",
"if",
"line",
"==",
"EOF",
":",
"log",
"(",
"\"sending EOF...\"",
")",
"else",
":",
"log",
"(",
"_",
"(",
"\"sending input {}...\"",
")",
".",
... | Send line to stdin, optionally expect a prompt.
:param line: line to be send to stdin
:type line: str
:param prompt: boolean indicating whether a prompt is expected, if True absorbs \
all of stdout before inserting line into stdin and raises \
:clas... | [
"Send",
"line",
"to",
"stdin",
"optionally",
"expect",
"a",
"prompt",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/api.py#L165-L199 | train |
cs50/check50 | check50/api.py | run.reject | def reject(self, timeout=1):
"""
Check that the process survives for timeout. Useful for checking whether program is waiting on input.
:param timeout: number of seconds to wait
:type timeout: int / float
:raises check50.Failure: if process ends before ``timeout``
"""
... | python | def reject(self, timeout=1):
"""
Check that the process survives for timeout. Useful for checking whether program is waiting on input.
:param timeout: number of seconds to wait
:type timeout: int / float
:raises check50.Failure: if process ends before ``timeout``
"""
... | [
"def",
"reject",
"(",
"self",
",",
"timeout",
"=",
"1",
")",
":",
"log",
"(",
"_",
"(",
"\"checking that input was rejected...\"",
")",
")",
"try",
":",
"self",
".",
"_wait",
"(",
"timeout",
")",
"except",
"Failure",
"as",
"e",
":",
"if",
"not",
"isins... | Check that the process survives for timeout. Useful for checking whether program is waiting on input.
:param timeout: number of seconds to wait
:type timeout: int / float
:raises check50.Failure: if process ends before ``timeout`` | [
"Check",
"that",
"the",
"process",
"survives",
"for",
"timeout",
".",
"Useful",
"for",
"checking",
"whether",
"program",
"is",
"waiting",
"on",
"input",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/api.py#L269-L286 | train |
cs50/check50 | check50/internal.py | import_file | def import_file(name, path):
"""
Import a file given a raw file path.
:param name: Name of module to be imported
:type name: str
:param path: Path to Python file
:type path: str / Path
"""
spec = importlib.util.spec_from_file_location(name, path)
mod = importlib.util.module_from_spe... | python | def import_file(name, path):
"""
Import a file given a raw file path.
:param name: Name of module to be imported
:type name: str
:param path: Path to Python file
:type path: str / Path
"""
spec = importlib.util.spec_from_file_location(name, path)
mod = importlib.util.module_from_spe... | [
"def",
"import_file",
"(",
"name",
",",
"path",
")",
":",
"spec",
"=",
"importlib",
".",
"util",
".",
"spec_from_file_location",
"(",
"name",
",",
"path",
")",
"mod",
"=",
"importlib",
".",
"util",
".",
"module_from_spec",
"(",
"spec",
")",
"spec",
".",
... | Import a file given a raw file path.
:param name: Name of module to be imported
:type name: str
:param path: Path to Python file
:type path: str / Path | [
"Import",
"a",
"file",
"given",
"a",
"raw",
"file",
"path",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/internal.py#L108-L120 | train |
cs50/check50 | check50/c.py | compile | def compile(*files, exe_name=None, cc=CC, **cflags):
"""
Compile C source files.
:param files: filenames to be compiled
:param exe_name: name of resulting executable
:param cc: compiler to use (:data:`check50.c.CC` by default)
:param cflags: additional flags to pass to the compiler
:raises ... | python | def compile(*files, exe_name=None, cc=CC, **cflags):
"""
Compile C source files.
:param files: filenames to be compiled
:param exe_name: name of resulting executable
:param cc: compiler to use (:data:`check50.c.CC` by default)
:param cflags: additional flags to pass to the compiler
:raises ... | [
"def",
"compile",
"(",
"*",
"files",
",",
"exe_name",
"=",
"None",
",",
"cc",
"=",
"CC",
",",
"**",
"cflags",
")",
":",
"if",
"not",
"files",
":",
"raise",
"RuntimeError",
"(",
"_",
"(",
"\"compile requires at least one file\"",
")",
")",
"if",
"exe_name... | Compile C source files.
:param files: filenames to be compiled
:param exe_name: name of resulting executable
:param cc: compiler to use (:data:`check50.c.CC` by default)
:param cflags: additional flags to pass to the compiler
:raises check50.Failure: if compilation failed (i.e., if the compiler ret... | [
"Compile",
"C",
"source",
"files",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/c.py#L16-L57 | train |
cs50/check50 | check50/c.py | valgrind | def valgrind(command, env={}):
"""Run a command with valgrind.
:param command: command to be run
:type command: str
:param env: environment in which to run command
:type env: str
:raises check50.Failure: if, at the end of the check, valgrind reports any errors
This function works exactly l... | python | def valgrind(command, env={}):
"""Run a command with valgrind.
:param command: command to be run
:type command: str
:param env: environment in which to run command
:type env: str
:raises check50.Failure: if, at the end of the check, valgrind reports any errors
This function works exactly l... | [
"def",
"valgrind",
"(",
"command",
",",
"env",
"=",
"{",
"}",
")",
":",
"xml_file",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
")",
"internal",
".",
"register",
".",
"after_check",
"(",
"lambda",
":",
"_check_valgrind",
"(",
"xml_file",
")",
")",
"... | Run a command with valgrind.
:param command: command to be run
:type command: str
:param env: environment in which to run command
:type env: str
:raises check50.Failure: if, at the end of the check, valgrind reports any errors
This function works exactly like :func:`check50.run`, with the addi... | [
"Run",
"a",
"command",
"with",
"valgrind",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/c.py#L60-L86 | train |
cs50/check50 | check50/c.py | _check_valgrind | def _check_valgrind(xml_file):
"""Log and report any errors encountered by valgrind."""
log(_("checking for valgrind errors..."))
# Load XML file created by valgrind
xml = ET.ElementTree(file=xml_file)
# Ensure that we don't get duplicate error messages.
reported = set()
for error in xml.i... | python | def _check_valgrind(xml_file):
"""Log and report any errors encountered by valgrind."""
log(_("checking for valgrind errors..."))
# Load XML file created by valgrind
xml = ET.ElementTree(file=xml_file)
# Ensure that we don't get duplicate error messages.
reported = set()
for error in xml.i... | [
"def",
"_check_valgrind",
"(",
"xml_file",
")",
":",
"log",
"(",
"_",
"(",
"\"checking for valgrind errors...\"",
")",
")",
"xml",
"=",
"ET",
".",
"ElementTree",
"(",
"file",
"=",
"xml_file",
")",
"reported",
"=",
"set",
"(",
")",
"for",
"error",
"in",
"... | Log and report any errors encountered by valgrind. | [
"Log",
"and",
"report",
"any",
"errors",
"encountered",
"by",
"valgrind",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/c.py#L89-L124 | train |
cs50/check50 | check50/runner.py | _timeout | def _timeout(seconds):
"""Context manager that runs code block until timeout is reached.
Example usage::
try:
with _timeout(10):
do_stuff()
except Timeout:
print("do_stuff timed out")
"""
def _handle_timeout(*args):
raise Timeout(seconds... | python | def _timeout(seconds):
"""Context manager that runs code block until timeout is reached.
Example usage::
try:
with _timeout(10):
do_stuff()
except Timeout:
print("do_stuff timed out")
"""
def _handle_timeout(*args):
raise Timeout(seconds... | [
"def",
"_timeout",
"(",
"seconds",
")",
":",
"def",
"_handle_timeout",
"(",
"*",
"args",
")",
":",
"raise",
"Timeout",
"(",
"seconds",
")",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGALRM",
",",
"_handle_timeout",
")",
"signal",
".",
"alarm",
"(",
... | Context manager that runs code block until timeout is reached.
Example usage::
try:
with _timeout(10):
do_stuff()
except Timeout:
print("do_stuff timed out") | [
"Context",
"manager",
"that",
"runs",
"code",
"block",
"until",
"timeout",
"is",
"reached",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/runner.py#L52-L73 | train |
cs50/check50 | check50/runner.py | CheckRunner.run | def run(self, files, working_area):
"""
Run checks concurrently.
Returns a list of CheckResults ordered by declaration order of the checks in the imported module
"""
# Ensure that dictionary is ordered by check declaration order (via self.check_names)
# NOTE: Requires CP... | python | def run(self, files, working_area):
"""
Run checks concurrently.
Returns a list of CheckResults ordered by declaration order of the checks in the imported module
"""
# Ensure that dictionary is ordered by check declaration order (via self.check_names)
# NOTE: Requires CP... | [
"def",
"run",
"(",
"self",
",",
"files",
",",
"working_area",
")",
":",
"results",
"=",
"{",
"name",
":",
"None",
"for",
"name",
"in",
"self",
".",
"check_names",
"}",
"checks_root",
"=",
"working_area",
".",
"parent",
"with",
"futures",
".",
"ProcessPoo... | Run checks concurrently.
Returns a list of CheckResults ordered by declaration order of the checks in the imported module | [
"Run",
"checks",
"concurrently",
".",
"Returns",
"a",
"list",
"of",
"CheckResults",
"ordered",
"by",
"declaration",
"order",
"of",
"the",
"checks",
"in",
"the",
"imported",
"module"
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/runner.py#L178-L212 | train |
cs50/check50 | check50/py.py | append_code | def append_code(original, codefile):
"""Append the contents of one file to another.
:param original: name of file that will be appended to
:type original: str
:param codefile: name of file that will be appende
:type codefile: str
This function is particularly useful when one wants to replace a... | python | def append_code(original, codefile):
"""Append the contents of one file to another.
:param original: name of file that will be appended to
:type original: str
:param codefile: name of file that will be appende
:type codefile: str
This function is particularly useful when one wants to replace a... | [
"def",
"append_code",
"(",
"original",
",",
"codefile",
")",
":",
"with",
"open",
"(",
"codefile",
")",
"as",
"code",
",",
"open",
"(",
"original",
",",
"\"a\"",
")",
"as",
"o",
":",
"o",
".",
"write",
"(",
"\"\\n\"",
")",
"o",
".",
"writelines",
"... | Append the contents of one file to another.
:param original: name of file that will be appended to
:type original: str
:param codefile: name of file that will be appende
:type codefile: str
This function is particularly useful when one wants to replace a function
in student code with their own... | [
"Append",
"the",
"contents",
"of",
"one",
"file",
"to",
"another",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/py.py#L10-L34 | train |
cs50/check50 | check50/py.py | import_ | def import_(path):
"""Import a Python program given a raw file path
:param path: path to python file to be imported
:type path: str
:raises check50.Failure: if ``path`` doesn't exist, or if the Python file at ``path`` throws an exception when imported.
"""
exists(path)
log(_("importing {}..... | python | def import_(path):
"""Import a Python program given a raw file path
:param path: path to python file to be imported
:type path: str
:raises check50.Failure: if ``path`` doesn't exist, or if the Python file at ``path`` throws an exception when imported.
"""
exists(path)
log(_("importing {}..... | [
"def",
"import_",
"(",
"path",
")",
":",
"exists",
"(",
"path",
")",
"log",
"(",
"_",
"(",
"\"importing {}...\"",
")",
".",
"format",
"(",
"path",
")",
")",
"name",
"=",
"Path",
"(",
"path",
")",
".",
"stem",
"try",
":",
"return",
"internal",
".",
... | Import a Python program given a raw file path
:param path: path to python file to be imported
:type path: str
:raises check50.Failure: if ``path`` doesn't exist, or if the Python file at ``path`` throws an exception when imported. | [
"Import",
"a",
"Python",
"program",
"given",
"a",
"raw",
"file",
"path"
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/py.py#L37-L50 | train |
cs50/check50 | check50/py.py | compile | def compile(file):
"""
Compile a Python program into byte code
:param file: file to be compiled
:raises check50.Failure: if compilation fails e.g. if there is a SyntaxError
"""
log(_("compiling {} into byte code...").format(file))
try:
py_compile.compile(file, doraise=True)
exc... | python | def compile(file):
"""
Compile a Python program into byte code
:param file: file to be compiled
:raises check50.Failure: if compilation fails e.g. if there is a SyntaxError
"""
log(_("compiling {} into byte code...").format(file))
try:
py_compile.compile(file, doraise=True)
exc... | [
"def",
"compile",
"(",
"file",
")",
":",
"log",
"(",
"_",
"(",
"\"compiling {} into byte code...\"",
")",
".",
"format",
"(",
"file",
")",
")",
"try",
":",
"py_compile",
".",
"compile",
"(",
"file",
",",
"doraise",
"=",
"True",
")",
"except",
"py_compile... | Compile a Python program into byte code
:param file: file to be compiled
:raises check50.Failure: if compilation fails e.g. if there is a SyntaxError | [
"Compile",
"a",
"Python",
"program",
"into",
"byte",
"code"
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/py.py#L52-L68 | train |
cs50/check50 | check50/flask.py | app.get | def get(self, route, data=None, params=None, follow_redirects=True):
"""Send GET request to app.
:param route: route to send request to
:type route: str
:param data: form data to include in request
:type data: dict
:param params: URL parameters to include in request
... | python | def get(self, route, data=None, params=None, follow_redirects=True):
"""Send GET request to app.
:param route: route to send request to
:type route: str
:param data: form data to include in request
:type data: dict
:param params: URL parameters to include in request
... | [
"def",
"get",
"(",
"self",
",",
"route",
",",
"data",
"=",
"None",
",",
"params",
"=",
"None",
",",
"follow_redirects",
"=",
"True",
")",
":",
"return",
"self",
".",
"_send",
"(",
"\"GET\"",
",",
"route",
",",
"data",
",",
"params",
",",
"follow_redi... | Send GET request to app.
:param route: route to send request to
:type route: str
:param data: form data to include in request
:type data: dict
:param params: URL parameters to include in request
:param follow_redirects: enable redirection (defaults to ``True``)
:... | [
"Send",
"GET",
"request",
"to",
"app",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/flask.py#L52-L69 | train |
cs50/check50 | check50/flask.py | app.post | def post(self, route, data=None, params=None, follow_redirects=True):
"""Send POST request to app.
:param route: route to send request to
:type route: str
:param data: form data to include in request
:type data: dict
:param params: URL parameters to include in request
... | python | def post(self, route, data=None, params=None, follow_redirects=True):
"""Send POST request to app.
:param route: route to send request to
:type route: str
:param data: form data to include in request
:type data: dict
:param params: URL parameters to include in request
... | [
"def",
"post",
"(",
"self",
",",
"route",
",",
"data",
"=",
"None",
",",
"params",
"=",
"None",
",",
"follow_redirects",
"=",
"True",
")",
":",
"return",
"self",
".",
"_send",
"(",
"\"POST\"",
",",
"route",
",",
"data",
",",
"params",
",",
"follow_re... | Send POST request to app.
:param route: route to send request to
:type route: str
:param data: form data to include in request
:type data: dict
:param params: URL parameters to include in request
:param follow_redirects: enable redirection (defaults to ``True``)
... | [
"Send",
"POST",
"request",
"to",
"app",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/flask.py#L71-L88 | train |
cs50/check50 | check50/flask.py | app.status | def status(self, code=None):
"""Check status code in response returned by application.
If ``code`` is not None, assert that ``code`` is returned by application,
else simply return the status code.
:param code: ``code`` to assert that application returns
:type code: int
... | python | def status(self, code=None):
"""Check status code in response returned by application.
If ``code`` is not None, assert that ``code`` is returned by application,
else simply return the status code.
:param code: ``code`` to assert that application returns
:type code: int
... | [
"def",
"status",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"if",
"code",
"is",
"None",
":",
"return",
"self",
".",
"response",
".",
"status_code",
"log",
"(",
"_",
"(",
"\"checking that status code {} is returned...\"",
")",
".",
"format",
"(",
"cod... | Check status code in response returned by application.
If ``code`` is not None, assert that ``code`` is returned by application,
else simply return the status code.
:param code: ``code`` to assert that application returns
:type code: int
Example usage::
check50.fla... | [
"Check",
"status",
"code",
"in",
"response",
"returned",
"by",
"application",
".",
"If",
"code",
"is",
"not",
"None",
"assert",
"that",
"code",
"is",
"returned",
"by",
"application",
"else",
"simply",
"return",
"the",
"status",
"code",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/flask.py#L90-L114 | train |
cs50/check50 | check50/flask.py | app.raw_content | def raw_content(self, output=None, str_output=None):
"""Searches for `output` regex match within content of page, regardless of mimetype."""
return self._search_page(output, str_output, self.response.data, lambda regex, content: regex.search(content.decode())) | python | def raw_content(self, output=None, str_output=None):
"""Searches for `output` regex match within content of page, regardless of mimetype."""
return self._search_page(output, str_output, self.response.data, lambda regex, content: regex.search(content.decode())) | [
"def",
"raw_content",
"(",
"self",
",",
"output",
"=",
"None",
",",
"str_output",
"=",
"None",
")",
":",
"return",
"self",
".",
"_search_page",
"(",
"output",
",",
"str_output",
",",
"self",
".",
"response",
".",
"data",
",",
"lambda",
"regex",
",",
"c... | Searches for `output` regex match within content of page, regardless of mimetype. | [
"Searches",
"for",
"output",
"regex",
"match",
"within",
"content",
"of",
"page",
"regardless",
"of",
"mimetype",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/flask.py#L116-L118 | train |
cs50/check50 | check50/flask.py | app.content | def content(self, output=None, str_output=None, **kwargs):
"""Searches for `output` regex within HTML page. kwargs are passed to BeautifulSoup's find function to filter for tags."""
if self.response.mimetype != "text/html":
raise Failure(_("expected request to return HTML, but it returned {}... | python | def content(self, output=None, str_output=None, **kwargs):
"""Searches for `output` regex within HTML page. kwargs are passed to BeautifulSoup's find function to filter for tags."""
if self.response.mimetype != "text/html":
raise Failure(_("expected request to return HTML, but it returned {}... | [
"def",
"content",
"(",
"self",
",",
"output",
"=",
"None",
",",
"str_output",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"self",
".",
"response",
".",
"mimetype",
"!=",
"\"text/html\"",
":",
"raise",
"Failure",
"(",
"_",
"(",
"\"expected request t... | Searches for `output` regex within HTML page. kwargs are passed to BeautifulSoup's find function to filter for tags. | [
"Searches",
"for",
"output",
"regex",
"within",
"HTML",
"page",
".",
"kwargs",
"are",
"passed",
"to",
"BeautifulSoup",
"s",
"find",
"function",
"to",
"filter",
"for",
"tags",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/flask.py#L120-L135 | train |
cs50/check50 | check50/flask.py | app._send | def _send(self, method, route, data, params, **kwargs):
"""Send request of type `method` to `route`."""
route = self._fmt_route(route, params)
log(_("sending {} request to {}").format(method.upper(), route))
try:
self.response = getattr(self._client, method.lower())(route, da... | python | def _send(self, method, route, data, params, **kwargs):
"""Send request of type `method` to `route`."""
route = self._fmt_route(route, params)
log(_("sending {} request to {}").format(method.upper(), route))
try:
self.response = getattr(self._client, method.lower())(route, da... | [
"def",
"_send",
"(",
"self",
",",
"method",
",",
"route",
",",
"data",
",",
"params",
",",
"**",
"kwargs",
")",
":",
"route",
"=",
"self",
".",
"_fmt_route",
"(",
"route",
",",
"params",
")",
"log",
"(",
"_",
"(",
"\"sending {} request to {}\"",
")",
... | Send request of type `method` to `route`. | [
"Send",
"request",
"of",
"type",
"method",
"to",
"route",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/flask.py#L137-L146 | train |
cs50/check50 | check50/simple.py | compile | def compile(checks):
"""Returns compiled check50 checks from simple YAML checks in path."""
out = ["import check50"]
for name, check in checks.items():
out.append(_compile_check(name, check))
return "\n\n".join(out) | python | def compile(checks):
"""Returns compiled check50 checks from simple YAML checks in path."""
out = ["import check50"]
for name, check in checks.items():
out.append(_compile_check(name, check))
return "\n\n".join(out) | [
"def",
"compile",
"(",
"checks",
")",
":",
"out",
"=",
"[",
"\"import check50\"",
"]",
"for",
"name",
",",
"check",
"in",
"checks",
".",
"items",
"(",
")",
":",
"out",
".",
"append",
"(",
"_compile_check",
"(",
"name",
",",
"check",
")",
")",
"return... | Returns compiled check50 checks from simple YAML checks in path. | [
"Returns",
"compiled",
"check50",
"checks",
"from",
"simple",
"YAML",
"checks",
"in",
"path",
"."
] | 42c1f0c36baa6a24f69742d74551a9ea7a5ceb33 | https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/simple.py#L8-L16 | train |
quantopian/trading_calendars | trading_calendars/utils/pandas_utils.py | days_at_time | def days_at_time(days, t, tz, day_offset=0):
"""
Create an index of days at time ``t``, interpreted in timezone ``tz``.
The returned index is localized to UTC.
Parameters
----------
days : DatetimeIndex
An index of dates (represented as midnight).
t : datetime.time
The time... | python | def days_at_time(days, t, tz, day_offset=0):
"""
Create an index of days at time ``t``, interpreted in timezone ``tz``.
The returned index is localized to UTC.
Parameters
----------
days : DatetimeIndex
An index of dates (represented as midnight).
t : datetime.time
The time... | [
"def",
"days_at_time",
"(",
"days",
",",
"t",
",",
"tz",
",",
"day_offset",
"=",
"0",
")",
":",
"days",
"=",
"pd",
".",
"DatetimeIndex",
"(",
"days",
")",
".",
"tz_localize",
"(",
"None",
")",
"if",
"len",
"(",
"days",
")",
"==",
"0",
":",
"retur... | Create an index of days at time ``t``, interpreted in timezone ``tz``.
The returned index is localized to UTC.
Parameters
----------
days : DatetimeIndex
An index of dates (represented as midnight).
t : datetime.time
The time to apply as an offset to each day in ``days``.
tz : ... | [
"Create",
"an",
"index",
"of",
"days",
"at",
"time",
"t",
"interpreted",
"in",
"timezone",
"tz",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/utils/pandas_utils.py#L6-L48 | train |
quantopian/trading_calendars | trading_calendars/common_holidays.py | weekend_boxing_day | def weekend_boxing_day(start_date=None, end_date=None, observance=None):
"""
If boxing day is saturday then Monday 28th is a holiday
If boxing day is sunday then Tuesday 28th is a holiday
"""
return Holiday(
"Weekend Boxing Day",
month=12,
day=28,
days_of_week=(MONDAY... | python | def weekend_boxing_day(start_date=None, end_date=None, observance=None):
"""
If boxing day is saturday then Monday 28th is a holiday
If boxing day is sunday then Tuesday 28th is a holiday
"""
return Holiday(
"Weekend Boxing Day",
month=12,
day=28,
days_of_week=(MONDAY... | [
"def",
"weekend_boxing_day",
"(",
"start_date",
"=",
"None",
",",
"end_date",
"=",
"None",
",",
"observance",
"=",
"None",
")",
":",
"return",
"Holiday",
"(",
"\"Weekend Boxing Day\"",
",",
"month",
"=",
"12",
",",
"day",
"=",
"28",
",",
"days_of_week",
"=... | If boxing day is saturday then Monday 28th is a holiday
If boxing day is sunday then Tuesday 28th is a holiday | [
"If",
"boxing",
"day",
"is",
"saturday",
"then",
"Monday",
"28th",
"is",
"a",
"holiday",
"If",
"boxing",
"day",
"is",
"sunday",
"then",
"Tuesday",
"28th",
"is",
"a",
"holiday"
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/common_holidays.py#L261-L274 | train |
quantopian/trading_calendars | trading_calendars/xtks_holidays.py | is_holiday_or_weekend | def is_holiday_or_weekend(holidays, dt):
"""
Given a list of holidays, return whether dt is a holiday
or it is on a weekend.
"""
one_day = timedelta(days=1)
for h in holidays:
if dt in h.dates(dt - one_day, dt + one_day) or \
dt.weekday() in WEEKENDS:
return ... | python | def is_holiday_or_weekend(holidays, dt):
"""
Given a list of holidays, return whether dt is a holiday
or it is on a weekend.
"""
one_day = timedelta(days=1)
for h in holidays:
if dt in h.dates(dt - one_day, dt + one_day) or \
dt.weekday() in WEEKENDS:
return ... | [
"def",
"is_holiday_or_weekend",
"(",
"holidays",
",",
"dt",
")",
":",
"one_day",
"=",
"timedelta",
"(",
"days",
"=",
"1",
")",
"for",
"h",
"in",
"holidays",
":",
"if",
"dt",
"in",
"h",
".",
"dates",
"(",
"dt",
"-",
"one_day",
",",
"dt",
"+",
"one_d... | Given a list of holidays, return whether dt is a holiday
or it is on a weekend. | [
"Given",
"a",
"list",
"of",
"holidays",
"return",
"whether",
"dt",
"is",
"a",
"holiday",
"or",
"it",
"is",
"on",
"a",
"weekend",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/xtks_holidays.py#L18-L30 | train |
quantopian/trading_calendars | trading_calendars/xtks_holidays.py | next_non_holiday_weekday | def next_non_holiday_weekday(holidays, dt):
"""
If a holiday falls on a Sunday, observe it on the next non-holiday weekday.
Parameters
----------
holidays : list[pd.tseries.holiday.Holiday]
list of holidays
dt : pd.Timestamp
date of holiday.
"""
day_of_week = dt.weekday(... | python | def next_non_holiday_weekday(holidays, dt):
"""
If a holiday falls on a Sunday, observe it on the next non-holiday weekday.
Parameters
----------
holidays : list[pd.tseries.holiday.Holiday]
list of holidays
dt : pd.Timestamp
date of holiday.
"""
day_of_week = dt.weekday(... | [
"def",
"next_non_holiday_weekday",
"(",
"holidays",
",",
"dt",
")",
":",
"day_of_week",
"=",
"dt",
".",
"weekday",
"(",
")",
"if",
"day_of_week",
"==",
"SUNDAY",
":",
"while",
"is_holiday_or_weekend",
"(",
"holidays",
",",
"dt",
")",
":",
"dt",
"+=",
"time... | If a holiday falls on a Sunday, observe it on the next non-holiday weekday.
Parameters
----------
holidays : list[pd.tseries.holiday.Holiday]
list of holidays
dt : pd.Timestamp
date of holiday. | [
"If",
"a",
"holiday",
"falls",
"on",
"a",
"Sunday",
"observe",
"it",
"on",
"the",
"next",
"non",
"-",
"holiday",
"weekday",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/xtks_holidays.py#L33-L50 | train |
quantopian/trading_calendars | trading_calendars/calendar_helpers.py | compute_all_minutes | def compute_all_minutes(opens_in_ns, closes_in_ns):
"""
Given arrays of opens and closes, both in nanoseconds,
return an array of each minute between the opens and closes.
"""
deltas = closes_in_ns - opens_in_ns
# + 1 because we want 390 mins per standard day, not 389
daily_sizes = (deltas ... | python | def compute_all_minutes(opens_in_ns, closes_in_ns):
"""
Given arrays of opens and closes, both in nanoseconds,
return an array of each minute between the opens and closes.
"""
deltas = closes_in_ns - opens_in_ns
# + 1 because we want 390 mins per standard day, not 389
daily_sizes = (deltas ... | [
"def",
"compute_all_minutes",
"(",
"opens_in_ns",
",",
"closes_in_ns",
")",
":",
"deltas",
"=",
"closes_in_ns",
"-",
"opens_in_ns",
"daily_sizes",
"=",
"(",
"deltas",
"//",
"NANOSECONDS_PER_MINUTE",
")",
"+",
"1",
"num_minutes",
"=",
"daily_sizes",
".",
"sum",
"... | Given arrays of opens and closes, both in nanoseconds,
return an array of each minute between the opens and closes. | [
"Given",
"arrays",
"of",
"opens",
"and",
"closes",
"both",
"in",
"nanoseconds",
"return",
"an",
"array",
"of",
"each",
"minute",
"between",
"the",
"opens",
"and",
"closes",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/calendar_helpers.py#L47-L71 | train |
quantopian/trading_calendars | trading_calendars/calendar_utils.py | TradingCalendarDispatcher.get_calendar | def get_calendar(self, name):
"""
Retrieves an instance of an TradingCalendar whose name is given.
Parameters
----------
name : str
The name of the TradingCalendar to be retrieved.
Returns
-------
calendar : calendars.TradingCalendar
... | python | def get_calendar(self, name):
"""
Retrieves an instance of an TradingCalendar whose name is given.
Parameters
----------
name : str
The name of the TradingCalendar to be retrieved.
Returns
-------
calendar : calendars.TradingCalendar
... | [
"def",
"get_calendar",
"(",
"self",
",",
"name",
")",
":",
"canonical_name",
"=",
"self",
".",
"resolve_alias",
"(",
"name",
")",
"try",
":",
"return",
"self",
".",
"_calendars",
"[",
"canonical_name",
"]",
"except",
"KeyError",
":",
"pass",
"try",
":",
... | Retrieves an instance of an TradingCalendar whose name is given.
Parameters
----------
name : str
The name of the TradingCalendar to be retrieved.
Returns
-------
calendar : calendars.TradingCalendar
The desired calendar. | [
"Retrieves",
"an",
"instance",
"of",
"an",
"TradingCalendar",
"whose",
"name",
"is",
"given",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/calendar_utils.py#L118-L148 | train |
quantopian/trading_calendars | trading_calendars/calendar_utils.py | TradingCalendarDispatcher.register_calendar | def register_calendar(self, name, calendar, force=False):
"""
Registers a calendar for retrieval by the get_calendar method.
Parameters
----------
name: str
The key with which to register this calendar.
calendar: TradingCalendar
The calendar to be... | python | def register_calendar(self, name, calendar, force=False):
"""
Registers a calendar for retrieval by the get_calendar method.
Parameters
----------
name: str
The key with which to register this calendar.
calendar: TradingCalendar
The calendar to be... | [
"def",
"register_calendar",
"(",
"self",
",",
"name",
",",
"calendar",
",",
"force",
"=",
"False",
")",
":",
"if",
"force",
":",
"self",
".",
"deregister_calendar",
"(",
"name",
")",
"if",
"self",
".",
"has_calendar",
"(",
"name",
")",
":",
"raise",
"C... | Registers a calendar for retrieval by the get_calendar method.
Parameters
----------
name: str
The key with which to register this calendar.
calendar: TradingCalendar
The calendar to be registered for retrieval.
force : bool, optional
If True,... | [
"Registers",
"a",
"calendar",
"for",
"retrieval",
"by",
"the",
"get_calendar",
"method",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/calendar_utils.py#L160-L186 | train |
quantopian/trading_calendars | trading_calendars/calendar_utils.py | TradingCalendarDispatcher.register_calendar_type | def register_calendar_type(self, name, calendar_type, force=False):
"""
Registers a calendar by type.
This is useful for registering a new calendar to be lazily instantiated
at some future point in time.
Parameters
----------
name: str
The key with w... | python | def register_calendar_type(self, name, calendar_type, force=False):
"""
Registers a calendar by type.
This is useful for registering a new calendar to be lazily instantiated
at some future point in time.
Parameters
----------
name: str
The key with w... | [
"def",
"register_calendar_type",
"(",
"self",
",",
"name",
",",
"calendar_type",
",",
"force",
"=",
"False",
")",
":",
"if",
"force",
":",
"self",
".",
"deregister_calendar",
"(",
"name",
")",
"if",
"self",
".",
"has_calendar",
"(",
"name",
")",
":",
"ra... | Registers a calendar by type.
This is useful for registering a new calendar to be lazily instantiated
at some future point in time.
Parameters
----------
name: str
The key with which to register this calendar.
calendar_type: type
The type of the ... | [
"Registers",
"a",
"calendar",
"by",
"type",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/calendar_utils.py#L188-L217 | train |
quantopian/trading_calendars | trading_calendars/calendar_utils.py | TradingCalendarDispatcher.register_calendar_alias | def register_calendar_alias(self, alias, real_name, force=False):
"""
Register an alias for a calendar.
This is useful when multiple exchanges should share a calendar, or when
there are multiple ways to refer to the same exchange.
After calling ``register_alias('alias', 'real_n... | python | def register_calendar_alias(self, alias, real_name, force=False):
"""
Register an alias for a calendar.
This is useful when multiple exchanges should share a calendar, or when
there are multiple ways to refer to the same exchange.
After calling ``register_alias('alias', 'real_n... | [
"def",
"register_calendar_alias",
"(",
"self",
",",
"alias",
",",
"real_name",
",",
"force",
"=",
"False",
")",
":",
"if",
"force",
":",
"self",
".",
"deregister_calendar",
"(",
"alias",
")",
"if",
"self",
".",
"has_calendar",
"(",
"alias",
")",
":",
"ra... | Register an alias for a calendar.
This is useful when multiple exchanges should share a calendar, or when
there are multiple ways to refer to the same exchange.
After calling ``register_alias('alias', 'real_name')``, subsequent
calls to ``get_calendar('alias')`` will return the same re... | [
"Register",
"an",
"alias",
"for",
"a",
"calendar",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/calendar_utils.py#L219-L255 | train |
quantopian/trading_calendars | trading_calendars/calendar_utils.py | TradingCalendarDispatcher.resolve_alias | def resolve_alias(self, name):
"""
Resolve a calendar alias for retrieval.
Parameters
----------
name : str
The name of the requested calendar.
Returns
-------
canonical_name : str
The real name of the calendar to create/return.
... | python | def resolve_alias(self, name):
"""
Resolve a calendar alias for retrieval.
Parameters
----------
name : str
The name of the requested calendar.
Returns
-------
canonical_name : str
The real name of the calendar to create/return.
... | [
"def",
"resolve_alias",
"(",
"self",
",",
"name",
")",
":",
"seen",
"=",
"[",
"]",
"while",
"name",
"in",
"self",
".",
"_aliases",
":",
"seen",
".",
"append",
"(",
"name",
")",
"name",
"=",
"self",
".",
"_aliases",
"[",
"name",
"]",
"if",
"name",
... | Resolve a calendar alias for retrieval.
Parameters
----------
name : str
The name of the requested calendar.
Returns
-------
canonical_name : str
The real name of the calendar to create/return. | [
"Resolve",
"a",
"calendar",
"alias",
"for",
"retrieval",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/calendar_utils.py#L257-L285 | train |
quantopian/trading_calendars | trading_calendars/calendar_utils.py | TradingCalendarDispatcher.deregister_calendar | def deregister_calendar(self, name):
"""
If a calendar is registered with the given name, it is de-registered.
Parameters
----------
cal_name : str
The name of the calendar to be deregistered.
"""
self._calendars.pop(name, None)
self._calendar... | python | def deregister_calendar(self, name):
"""
If a calendar is registered with the given name, it is de-registered.
Parameters
----------
cal_name : str
The name of the calendar to be deregistered.
"""
self._calendars.pop(name, None)
self._calendar... | [
"def",
"deregister_calendar",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_calendars",
".",
"pop",
"(",
"name",
",",
"None",
")",
"self",
".",
"_calendar_factories",
".",
"pop",
"(",
"name",
",",
"None",
")",
"self",
".",
"_aliases",
".",
"pop",
... | If a calendar is registered with the given name, it is de-registered.
Parameters
----------
cal_name : str
The name of the calendar to be deregistered. | [
"If",
"a",
"calendar",
"is",
"registered",
"with",
"the",
"given",
"name",
"it",
"is",
"de",
"-",
"registered",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/calendar_utils.py#L287-L298 | train |
quantopian/trading_calendars | trading_calendars/calendar_utils.py | TradingCalendarDispatcher.clear_calendars | def clear_calendars(self):
"""
Deregisters all current registered calendars
"""
self._calendars.clear()
self._calendar_factories.clear()
self._aliases.clear() | python | def clear_calendars(self):
"""
Deregisters all current registered calendars
"""
self._calendars.clear()
self._calendar_factories.clear()
self._aliases.clear() | [
"def",
"clear_calendars",
"(",
"self",
")",
":",
"self",
".",
"_calendars",
".",
"clear",
"(",
")",
"self",
".",
"_calendar_factories",
".",
"clear",
"(",
")",
"self",
".",
"_aliases",
".",
"clear",
"(",
")"
] | Deregisters all current registered calendars | [
"Deregisters",
"all",
"current",
"registered",
"calendars"
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/calendar_utils.py#L300-L306 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | _overwrite_special_dates | def _overwrite_special_dates(midnight_utcs,
opens_or_closes,
special_opens_or_closes):
"""
Overwrite dates in open_or_closes with corresponding dates in
special_opens_or_closes, using midnight_utcs for alignment.
"""
# Short circuit when noth... | python | def _overwrite_special_dates(midnight_utcs,
opens_or_closes,
special_opens_or_closes):
"""
Overwrite dates in open_or_closes with corresponding dates in
special_opens_or_closes, using midnight_utcs for alignment.
"""
# Short circuit when noth... | [
"def",
"_overwrite_special_dates",
"(",
"midnight_utcs",
",",
"opens_or_closes",
",",
"special_opens_or_closes",
")",
":",
"if",
"not",
"len",
"(",
"special_opens_or_closes",
")",
":",
"return",
"len_m",
",",
"len_oc",
"=",
"len",
"(",
"midnight_utcs",
")",
",",
... | Overwrite dates in open_or_closes with corresponding dates in
special_opens_or_closes, using midnight_utcs for alignment. | [
"Overwrite",
"dates",
"in",
"open_or_closes",
"with",
"corresponding",
"dates",
"in",
"special_opens_or_closes",
"using",
"midnight_utcs",
"for",
"alignment",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L1016-L1049 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.is_open_on_minute | def is_open_on_minute(self, dt):
"""
Given a dt, return whether this exchange is open at the given dt.
Parameters
----------
dt: pd.Timestamp
The dt for which to check if this exchange is open.
Returns
-------
bool
Whether the exc... | python | def is_open_on_minute(self, dt):
"""
Given a dt, return whether this exchange is open at the given dt.
Parameters
----------
dt: pd.Timestamp
The dt for which to check if this exchange is open.
Returns
-------
bool
Whether the exc... | [
"def",
"is_open_on_minute",
"(",
"self",
",",
"dt",
")",
":",
"return",
"is_open",
"(",
"self",
".",
"market_opens_nanos",
",",
"self",
".",
"market_closes_nanos",
",",
"dt",
".",
"value",
")"
] | Given a dt, return whether this exchange is open at the given dt.
Parameters
----------
dt: pd.Timestamp
The dt for which to check if this exchange is open.
Returns
-------
bool
Whether the exchange is open on this dt. | [
"Given",
"a",
"dt",
"return",
"whether",
"this",
"exchange",
"is",
"open",
"at",
"the",
"given",
"dt",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L339-L354 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.next_open | def next_open(self, dt):
"""
Given a dt, returns the next open.
If the given dt happens to be a session open, the next session's open
will be returned.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the next open.
Returns
... | python | def next_open(self, dt):
"""
Given a dt, returns the next open.
If the given dt happens to be a session open, the next session's open
will be returned.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the next open.
Returns
... | [
"def",
"next_open",
"(",
"self",
",",
"dt",
")",
":",
"idx",
"=",
"next_divider_idx",
"(",
"self",
".",
"market_opens_nanos",
",",
"dt",
".",
"value",
")",
"return",
"pd",
".",
"Timestamp",
"(",
"self",
".",
"market_opens_nanos",
"[",
"idx",
"]",
",",
... | Given a dt, returns the next open.
If the given dt happens to be a session open, the next session's open
will be returned.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the next open.
Returns
-------
pd.Timestamp
... | [
"Given",
"a",
"dt",
"returns",
"the",
"next",
"open",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L356-L374 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.next_close | def next_close(self, dt):
"""
Given a dt, returns the next close.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the next close.
Returns
-------
pd.Timestamp
The UTC timestamp of the next close.
"""
... | python | def next_close(self, dt):
"""
Given a dt, returns the next close.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the next close.
Returns
-------
pd.Timestamp
The UTC timestamp of the next close.
"""
... | [
"def",
"next_close",
"(",
"self",
",",
"dt",
")",
":",
"idx",
"=",
"next_divider_idx",
"(",
"self",
".",
"market_closes_nanos",
",",
"dt",
".",
"value",
")",
"return",
"pd",
".",
"Timestamp",
"(",
"self",
".",
"market_closes_nanos",
"[",
"idx",
"]",
",",... | Given a dt, returns the next close.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the next close.
Returns
-------
pd.Timestamp
The UTC timestamp of the next close. | [
"Given",
"a",
"dt",
"returns",
"the",
"next",
"close",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L376-L391 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.previous_open | def previous_open(self, dt):
"""
Given a dt, returns the previous open.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the previous open.
Returns
-------
pd.Timestamp
The UTC imestamp of the previous open.
... | python | def previous_open(self, dt):
"""
Given a dt, returns the previous open.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the previous open.
Returns
-------
pd.Timestamp
The UTC imestamp of the previous open.
... | [
"def",
"previous_open",
"(",
"self",
",",
"dt",
")",
":",
"idx",
"=",
"previous_divider_idx",
"(",
"self",
".",
"market_opens_nanos",
",",
"dt",
".",
"value",
")",
"return",
"pd",
".",
"Timestamp",
"(",
"self",
".",
"market_opens_nanos",
"[",
"idx",
"]",
... | Given a dt, returns the previous open.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the previous open.
Returns
-------
pd.Timestamp
The UTC imestamp of the previous open. | [
"Given",
"a",
"dt",
"returns",
"the",
"previous",
"open",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L393-L408 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.previous_close | def previous_close(self, dt):
"""
Given a dt, returns the previous close.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the previous close.
Returns
-------
pd.Timestamp
The UTC timestamp of the previous close.
... | python | def previous_close(self, dt):
"""
Given a dt, returns the previous close.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the previous close.
Returns
-------
pd.Timestamp
The UTC timestamp of the previous close.
... | [
"def",
"previous_close",
"(",
"self",
",",
"dt",
")",
":",
"idx",
"=",
"previous_divider_idx",
"(",
"self",
".",
"market_closes_nanos",
",",
"dt",
".",
"value",
")",
"return",
"pd",
".",
"Timestamp",
"(",
"self",
".",
"market_closes_nanos",
"[",
"idx",
"]"... | Given a dt, returns the previous close.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the previous close.
Returns
-------
pd.Timestamp
The UTC timestamp of the previous close. | [
"Given",
"a",
"dt",
"returns",
"the",
"previous",
"close",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L410-L425 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.next_minute | def next_minute(self, dt):
"""
Given a dt, return the next exchange minute. If the given dt is not
an exchange minute, returns the next exchange open.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the next exchange minute.
Returns
... | python | def next_minute(self, dt):
"""
Given a dt, return the next exchange minute. If the given dt is not
an exchange minute, returns the next exchange open.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the next exchange minute.
Returns
... | [
"def",
"next_minute",
"(",
"self",
",",
"dt",
")",
":",
"idx",
"=",
"next_divider_idx",
"(",
"self",
".",
"_trading_minutes_nanos",
",",
"dt",
".",
"value",
")",
"return",
"self",
".",
"all_minutes",
"[",
"idx",
"]"
] | Given a dt, return the next exchange minute. If the given dt is not
an exchange minute, returns the next exchange open.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the next exchange minute.
Returns
-------
pd.Timestamp
... | [
"Given",
"a",
"dt",
"return",
"the",
"next",
"exchange",
"minute",
".",
"If",
"the",
"given",
"dt",
"is",
"not",
"an",
"exchange",
"minute",
"returns",
"the",
"next",
"exchange",
"open",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L427-L443 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.previous_minute | def previous_minute(self, dt):
"""
Given a dt, return the previous exchange minute.
Raises KeyError if the given timestamp is not an exchange minute.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the previous exchange minute.
Return... | python | def previous_minute(self, dt):
"""
Given a dt, return the previous exchange minute.
Raises KeyError if the given timestamp is not an exchange minute.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the previous exchange minute.
Return... | [
"def",
"previous_minute",
"(",
"self",
",",
"dt",
")",
":",
"idx",
"=",
"previous_divider_idx",
"(",
"self",
".",
"_trading_minutes_nanos",
",",
"dt",
".",
"value",
")",
"return",
"self",
".",
"all_minutes",
"[",
"idx",
"]"
] | Given a dt, return the previous exchange minute.
Raises KeyError if the given timestamp is not an exchange minute.
Parameters
----------
dt: pd.Timestamp
The dt for which to get the previous exchange minute.
Returns
-------
pd.Timestamp
... | [
"Given",
"a",
"dt",
"return",
"the",
"previous",
"exchange",
"minute",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L445-L463 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.next_session_label | def next_session_label(self, session_label):
"""
Given a session label, returns the label of the next session.
Parameters
----------
session_label: pd.Timestamp
A session whose next session is desired.
Returns
-------
pd.Timestamp
... | python | def next_session_label(self, session_label):
"""
Given a session label, returns the label of the next session.
Parameters
----------
session_label: pd.Timestamp
A session whose next session is desired.
Returns
-------
pd.Timestamp
... | [
"def",
"next_session_label",
"(",
"self",
",",
"session_label",
")",
":",
"idx",
"=",
"self",
".",
"schedule",
".",
"index",
".",
"get_loc",
"(",
"session_label",
")",
"try",
":",
"return",
"self",
".",
"schedule",
".",
"index",
"[",
"idx",
"+",
"1",
"... | Given a session label, returns the label of the next session.
Parameters
----------
session_label: pd.Timestamp
A session whose next session is desired.
Returns
-------
pd.Timestamp
The next session label (midnight UTC).
Notes
--... | [
"Given",
"a",
"session",
"label",
"returns",
"the",
"label",
"of",
"the",
"next",
"session",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L465-L492 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.previous_session_label | def previous_session_label(self, session_label):
"""
Given a session label, returns the label of the previous session.
Parameters
----------
session_label: pd.Timestamp
A session whose previous session is desired.
Returns
-------
pd.Timestamp... | python | def previous_session_label(self, session_label):
"""
Given a session label, returns the label of the previous session.
Parameters
----------
session_label: pd.Timestamp
A session whose previous session is desired.
Returns
-------
pd.Timestamp... | [
"def",
"previous_session_label",
"(",
"self",
",",
"session_label",
")",
":",
"idx",
"=",
"self",
".",
"schedule",
".",
"index",
".",
"get_loc",
"(",
"session_label",
")",
"if",
"idx",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"There is no previous session... | Given a session label, returns the label of the previous session.
Parameters
----------
session_label: pd.Timestamp
A session whose previous session is desired.
Returns
-------
pd.Timestamp
The previous session label (midnight UTC).
Note... | [
"Given",
"a",
"session",
"label",
"returns",
"the",
"label",
"of",
"the",
"previous",
"session",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L494-L518 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.minutes_for_session | def minutes_for_session(self, session_label):
"""
Given a session label, return the minutes for that session.
Parameters
----------
session_label: pd.Timestamp (midnight UTC)
A session label whose session's minutes are desired.
Returns
-------
... | python | def minutes_for_session(self, session_label):
"""
Given a session label, return the minutes for that session.
Parameters
----------
session_label: pd.Timestamp (midnight UTC)
A session label whose session's minutes are desired.
Returns
-------
... | [
"def",
"minutes_for_session",
"(",
"self",
",",
"session_label",
")",
":",
"return",
"self",
".",
"minutes_in_range",
"(",
"start_minute",
"=",
"self",
".",
"schedule",
".",
"at",
"[",
"session_label",
",",
"'market_open'",
"]",
",",
"end_minute",
"=",
"self",... | Given a session label, return the minutes for that session.
Parameters
----------
session_label: pd.Timestamp (midnight UTC)
A session label whose session's minutes are desired.
Returns
-------
pd.DateTimeIndex
All the minutes for the given sessi... | [
"Given",
"a",
"session",
"label",
"return",
"the",
"minutes",
"for",
"that",
"session",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L520-L537 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.execution_minutes_for_session | def execution_minutes_for_session(self, session_label):
"""
Given a session label, return the execution minutes for that session.
Parameters
----------
session_label: pd.Timestamp (midnight UTC)
A session label whose session's minutes are desired.
Returns
... | python | def execution_minutes_for_session(self, session_label):
"""
Given a session label, return the execution minutes for that session.
Parameters
----------
session_label: pd.Timestamp (midnight UTC)
A session label whose session's minutes are desired.
Returns
... | [
"def",
"execution_minutes_for_session",
"(",
"self",
",",
"session_label",
")",
":",
"return",
"self",
".",
"minutes_in_range",
"(",
"start_minute",
"=",
"self",
".",
"execution_time_from_open",
"(",
"self",
".",
"schedule",
".",
"at",
"[",
"session_label",
",",
... | Given a session label, return the execution minutes for that session.
Parameters
----------
session_label: pd.Timestamp (midnight UTC)
A session label whose session's minutes are desired.
Returns
-------
pd.DateTimeIndex
All the execution minutes... | [
"Given",
"a",
"session",
"label",
"return",
"the",
"execution",
"minutes",
"for",
"that",
"session",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L539-L560 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.sessions_in_range | def sessions_in_range(self, start_session_label, end_session_label):
"""
Given start and end session labels, return all the sessions in that
range, inclusive.
Parameters
----------
start_session_label: pd.Timestamp (midnight UTC)
The label representing the fi... | python | def sessions_in_range(self, start_session_label, end_session_label):
"""
Given start and end session labels, return all the sessions in that
range, inclusive.
Parameters
----------
start_session_label: pd.Timestamp (midnight UTC)
The label representing the fi... | [
"def",
"sessions_in_range",
"(",
"self",
",",
"start_session_label",
",",
"end_session_label",
")",
":",
"return",
"self",
".",
"all_sessions",
"[",
"self",
".",
"all_sessions",
".",
"slice_indexer",
"(",
"start_session_label",
",",
"end_session_label",
")",
"]"
] | Given start and end session labels, return all the sessions in that
range, inclusive.
Parameters
----------
start_session_label: pd.Timestamp (midnight UTC)
The label representing the first session of the desired range.
end_session_label: pd.Timestamp (midnight UTC)... | [
"Given",
"start",
"and",
"end",
"session",
"labels",
"return",
"all",
"the",
"sessions",
"in",
"that",
"range",
"inclusive",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L592-L615 | train |
quantopian/trading_calendars | trading_calendars/trading_calendar.py | TradingCalendar.minutes_in_range | def minutes_in_range(self, start_minute, end_minute):
"""
Given start and end minutes, return all the calendar minutes
in that range, inclusive.
Given minutes don't need to be calendar minutes.
Parameters
----------
start_minute: pd.Timestamp
The min... | python | def minutes_in_range(self, start_minute, end_minute):
"""
Given start and end minutes, return all the calendar minutes
in that range, inclusive.
Given minutes don't need to be calendar minutes.
Parameters
----------
start_minute: pd.Timestamp
The min... | [
"def",
"minutes_in_range",
"(",
"self",
",",
"start_minute",
",",
"end_minute",
")",
":",
"start_idx",
"=",
"searchsorted",
"(",
"self",
".",
"_trading_minutes_nanos",
",",
"start_minute",
".",
"value",
")",
"end_idx",
"=",
"searchsorted",
"(",
"self",
".",
"_... | Given start and end minutes, return all the calendar minutes
in that range, inclusive.
Given minutes don't need to be calendar minutes.
Parameters
----------
start_minute: pd.Timestamp
The minute representing the start of the desired range.
end_minute: pd.T... | [
"Given",
"start",
"and",
"end",
"minutes",
"return",
"all",
"the",
"calendar",
"minutes",
"in",
"that",
"range",
"inclusive",
"."
] | 951711c82c8a2875c09e96e2979faaf8734fb4df | https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/trading_calendar.py#L681-L711 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.