repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cloud-custodian/cloud-custodian | c7n/ufuncs/logsub.py | process_log_event | def process_log_event(event, context):
"""Format log events and relay via sns/email"""
init()
serialized = event['awslogs'].pop('data')
data = json.loads(zlib.decompress(
base64.b64decode(serialized), 16 + zlib.MAX_WBITS))
# Fetch additional logs for context (20s window)
timestamps = [e... | python | def process_log_event(event, context):
"""Format log events and relay via sns/email"""
init()
serialized = event['awslogs'].pop('data')
data = json.loads(zlib.decompress(
base64.b64decode(serialized), 16 + zlib.MAX_WBITS))
# Fetch additional logs for context (20s window)
timestamps = [e... | [
"def",
"process_log_event",
"(",
"event",
",",
"context",
")",
":",
"init",
"(",
")",
"serialized",
"=",
"event",
"[",
"'awslogs'",
"]",
".",
"pop",
"(",
"'data'",
")",
"data",
"=",
"json",
".",
"loads",
"(",
"zlib",
".",
"decompress",
"(",
"base64",
... | Format log events and relay via sns/email | [
"Format",
"log",
"events",
"and",
"relay",
"via",
"sns",
"/",
"email"
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/ufuncs/logsub.py#L46-L89 | train | Format log events and relay them to SNS | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | c7n/ufuncs/logsub.py | get_function | def get_function(session_factory, name, role, sns_topic, log_groups,
subject="Lambda Error", pattern="Traceback"):
"""Lambda function provisioning.
Self contained within the component, to allow for easier reuse.
"""
# Lazy import to avoid runtime dependency
from c7n.mu import (
... | python | def get_function(session_factory, name, role, sns_topic, log_groups,
subject="Lambda Error", pattern="Traceback"):
"""Lambda function provisioning.
Self contained within the component, to allow for easier reuse.
"""
# Lazy import to avoid runtime dependency
from c7n.mu import (
... | [
"def",
"get_function",
"(",
"session_factory",
",",
"name",
",",
"role",
",",
"sns_topic",
",",
"log_groups",
",",
"subject",
"=",
"\"Lambda Error\"",
",",
"pattern",
"=",
"\"Traceback\"",
")",
":",
"# Lazy import to avoid runtime dependency",
"from",
"c7n",
".",
... | Lambda function provisioning.
Self contained within the component, to allow for easier reuse. | [
"Lambda",
"function",
"provisioning",
"."
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/ufuncs/logsub.py#L92-L124 | train | Creates a Lambda function provisioning. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | c7n/cwe.py | CloudWatchEvents.match | def match(cls, event):
"""Match a given cwe event as cloudtrail with an api call
That has its information filled out.
"""
if 'detail' not in event:
return False
if 'eventName' not in event['detail']:
return False
k = event['detail']['eventName']
... | python | def match(cls, event):
"""Match a given cwe event as cloudtrail with an api call
That has its information filled out.
"""
if 'detail' not in event:
return False
if 'eventName' not in event['detail']:
return False
k = event['detail']['eventName']
... | [
"def",
"match",
"(",
"cls",
",",
"event",
")",
":",
"if",
"'detail'",
"not",
"in",
"event",
":",
"return",
"False",
"if",
"'eventName'",
"not",
"in",
"event",
"[",
"'detail'",
"]",
":",
"return",
"False",
"k",
"=",
"event",
"[",
"'detail'",
"]",
"[",... | Match a given cwe event as cloudtrail with an api call
That has its information filled out. | [
"Match",
"a",
"given",
"cwe",
"event",
"as",
"cloudtrail",
"with",
"an",
"api",
"call"
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/cwe.py#L96-L117 | train | Match a given cwe event as cloudtrail with an api call
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | c7n/cwe.py | CloudWatchEvents.get_trail_ids | def get_trail_ids(cls, event, mode):
"""extract resources ids from a cloud trail event."""
resource_ids = ()
event_name = event['detail']['eventName']
event_source = event['detail']['eventSource']
for e in mode.get('events', []):
if not isinstance(e, dict):
... | python | def get_trail_ids(cls, event, mode):
"""extract resources ids from a cloud trail event."""
resource_ids = ()
event_name = event['detail']['eventName']
event_source = event['detail']['eventSource']
for e in mode.get('events', []):
if not isinstance(e, dict):
... | [
"def",
"get_trail_ids",
"(",
"cls",
",",
"event",
",",
"mode",
")",
":",
"resource_ids",
"=",
"(",
")",
"event_name",
"=",
"event",
"[",
"'detail'",
"]",
"[",
"'eventName'",
"]",
"event_source",
"=",
"event",
"[",
"'detail'",
"]",
"[",
"'eventSource'",
"... | extract resources ids from a cloud trail event. | [
"extract",
"resources",
"ids",
"from",
"a",
"cloud",
"trail",
"event",
"."
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/cwe.py#L120-L147 | train | extract resources ids from a cloud trail event. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/c7n_org/scripts/orgaccounts.py | main | def main(role, ou, assume, profile, output, regions, active):
"""Generate a c7n-org accounts config file using AWS Organizations
With c7n-org you can then run policies or arbitrary scripts across
accounts.
"""
session = get_session(assume, 'c7n-org', profile)
client = session.client('organizat... | python | def main(role, ou, assume, profile, output, regions, active):
"""Generate a c7n-org accounts config file using AWS Organizations
With c7n-org you can then run policies or arbitrary scripts across
accounts.
"""
session = get_session(assume, 'c7n-org', profile)
client = session.client('organizat... | [
"def",
"main",
"(",
"role",
",",
"ou",
",",
"assume",
",",
"profile",
",",
"output",
",",
"regions",
",",
"active",
")",
":",
"session",
"=",
"get_session",
"(",
"assume",
",",
"'c7n-org'",
",",
"profile",
")",
"client",
"=",
"session",
".",
"client",
... | Generate a c7n-org accounts config file using AWS Organizations
With c7n-org you can then run policies or arbitrary scripts across
accounts. | [
"Generate",
"a",
"c7n",
"-",
"org",
"accounts",
"config",
"file",
"using",
"AWS",
"Organizations"
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_org/scripts/orgaccounts.py#L40-L75 | train | Generate a c7n - org accounts config file using AWS Organizations | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/c7n_traildb/c7n_traildb/trailts.py | download | def download(config, account, day, region, output):
"""Download a traildb file for a given account/day/region"""
with open(config) as fh:
config = yaml.safe_load(fh.read())
jsonschema.validate(config, CONFIG_SCHEMA)
found = None
for info in config['accounts']:
if info['name'] == a... | python | def download(config, account, day, region, output):
"""Download a traildb file for a given account/day/region"""
with open(config) as fh:
config = yaml.safe_load(fh.read())
jsonschema.validate(config, CONFIG_SCHEMA)
found = None
for info in config['accounts']:
if info['name'] == a... | [
"def",
"download",
"(",
"config",
",",
"account",
",",
"day",
",",
"region",
",",
"output",
")",
":",
"with",
"open",
"(",
"config",
")",
"as",
"fh",
":",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"fh",
".",
"read",
"(",
")",
")",
"jsonschema",... | Download a traildb file for a given account/day/region | [
"Download",
"a",
"traildb",
"file",
"for",
"a",
"given",
"account",
"/",
"day",
"/",
"region"
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_traildb/c7n_traildb/trailts.py#L309-L337 | train | Download a traildb file for a given account day and region | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/c7n_traildb/c7n_traildb/trailts.py | status | def status(config):
"""time series lastest record time by account."""
with open(config) as fh:
config = yaml.safe_load(fh.read())
jsonschema.validate(config, CONFIG_SCHEMA)
last_index = get_incremental_starts(config, None)
accounts = {}
for (a, region), last in last_index.items():
... | python | def status(config):
"""time series lastest record time by account."""
with open(config) as fh:
config = yaml.safe_load(fh.read())
jsonschema.validate(config, CONFIG_SCHEMA)
last_index = get_incremental_starts(config, None)
accounts = {}
for (a, region), last in last_index.items():
... | [
"def",
"status",
"(",
"config",
")",
":",
"with",
"open",
"(",
"config",
")",
"as",
"fh",
":",
"config",
"=",
"yaml",
".",
"safe_load",
"(",
"fh",
".",
"read",
"(",
")",
")",
"jsonschema",
".",
"validate",
"(",
"config",
",",
"CONFIG_SCHEMA",
")",
... | time series lastest record time by account. | [
"time",
"series",
"lastest",
"record",
"time",
"by",
"account",
"."
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_traildb/c7n_traildb/trailts.py#L342-L351 | train | show the status of the last record time by account | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/c7n_traildb/c7n_traildb/trailts.py | index | def index(config, start, end, incremental=False, concurrency=5, accounts=None,
verbose=False):
"""index traildbs directly from s3 for multiple accounts.
context: assumes a daily traildb file in s3 with key path
specified by key_template in config file for each account
"""
with op... | python | def index(config, start, end, incremental=False, concurrency=5, accounts=None,
verbose=False):
"""index traildbs directly from s3 for multiple accounts.
context: assumes a daily traildb file in s3 with key path
specified by key_template in config file for each account
"""
with op... | [
"def",
"index",
"(",
"config",
",",
"start",
",",
"end",
",",
"incremental",
"=",
"False",
",",
"concurrency",
"=",
"5",
",",
"accounts",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"with",
"open",
"(",
"config",
")",
"as",
"fh",
":",
"con... | index traildbs directly from s3 for multiple accounts.
context: assumes a daily traildb file in s3 with key path
specified by key_template in config file for each account | [
"index",
"traildbs",
"directly",
"from",
"s3",
"for",
"multiple",
"accounts",
"."
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_traildb/c7n_traildb/trailts.py#L363-L405 | train | index traildbs directly from s3 for multiple accounts | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/c7n_traildb/c7n_traildb/trailes.py | dict_factory | def dict_factory(cursor, row):
"""Returns a sqlite row factory that returns a dictionary"""
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d | python | def dict_factory(cursor, row):
"""Returns a sqlite row factory that returns a dictionary"""
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d | [
"def",
"dict_factory",
"(",
"cursor",
",",
"row",
")",
":",
"d",
"=",
"{",
"}",
"for",
"idx",
",",
"col",
"in",
"enumerate",
"(",
"cursor",
".",
"description",
")",
":",
"d",
"[",
"col",
"[",
"0",
"]",
"]",
"=",
"row",
"[",
"idx",
"]",
"return"... | Returns a sqlite row factory that returns a dictionary | [
"Returns",
"a",
"sqlite",
"row",
"factory",
"that",
"returns",
"a",
"dictionary"
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_traildb/c7n_traildb/trailes.py#L97-L102 | train | Returns a sqlite row factory that returns a dictionary | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/c7n_traildb/c7n_traildb/trailes.py | fetch_events | def fetch_events(cursor, config, account_name):
"""Generator that returns the events"""
query = config['indexer'].get('query',
'select * from events where user_agent glob \'*CloudCustodian*\'')
for event in cursor.execute(query):
event['account'] = account_name
event['_index'] = con... | python | def fetch_events(cursor, config, account_name):
"""Generator that returns the events"""
query = config['indexer'].get('query',
'select * from events where user_agent glob \'*CloudCustodian*\'')
for event in cursor.execute(query):
event['account'] = account_name
event['_index'] = con... | [
"def",
"fetch_events",
"(",
"cursor",
",",
"config",
",",
"account_name",
")",
":",
"query",
"=",
"config",
"[",
"'indexer'",
"]",
".",
"get",
"(",
"'query'",
",",
"'select * from events where user_agent glob \\'*CloudCustodian*\\''",
")",
"for",
"event",
"in",
"c... | Generator that returns the events | [
"Generator",
"that",
"returns",
"the",
"events"
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_traildb/c7n_traildb/trailes.py#L105-L114 | train | Generator that returns the events that are available for the given account | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/c7n_traildb/c7n_traildb/trailes.py | valid_date | def valid_date(key, config_date):
""" traildb bucket folders are not zero-padded so this validation
checks that the keys returned by the paginator are
*really after* the config date
"""
key_date = "/".join(key.split("/")[4:7])
return parse_date(key_date) > parse_date(config_date) | python | def valid_date(key, config_date):
""" traildb bucket folders are not zero-padded so this validation
checks that the keys returned by the paginator are
*really after* the config date
"""
key_date = "/".join(key.split("/")[4:7])
return parse_date(key_date) > parse_date(config_date) | [
"def",
"valid_date",
"(",
"key",
",",
"config_date",
")",
":",
"key_date",
"=",
"\"/\"",
".",
"join",
"(",
"key",
".",
"split",
"(",
"\"/\"",
")",
"[",
"4",
":",
"7",
"]",
")",
"return",
"parse_date",
"(",
"key_date",
")",
">",
"parse_date",
"(",
"... | traildb bucket folders are not zero-padded so this validation
checks that the keys returned by the paginator are
*really after* the config date | [
"traildb",
"bucket",
"folders",
"are",
"not",
"zero",
"-",
"padded",
"so",
"this",
"validation",
"checks",
"that",
"the",
"keys",
"returned",
"by",
"the",
"paginator",
"are",
"*",
"really",
"after",
"*",
"the",
"config",
"date"
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_traildb/c7n_traildb/trailes.py#L132-L138 | train | Checks that the key is not longer than the config date | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/c7n_traildb/c7n_traildb/trailes.py | index | def index(
config, date=None, directory=None, concurrency=5, accounts=None,
tag=None, verbose=False):
"""index traildbs directly from s3 for multiple accounts.
context: assumes a daily traildb file in s3 with dated key path
"""
logging.basicConfig(level=(verbose and logging.DEBUG or lo... | python | def index(
config, date=None, directory=None, concurrency=5, accounts=None,
tag=None, verbose=False):
"""index traildbs directly from s3 for multiple accounts.
context: assumes a daily traildb file in s3 with dated key path
"""
logging.basicConfig(level=(verbose and logging.DEBUG or lo... | [
"def",
"index",
"(",
"config",
",",
"date",
"=",
"None",
",",
"directory",
"=",
"None",
",",
"concurrency",
"=",
"5",
",",
"accounts",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"logging",
".",
"basicConfig",
"(",
... | index traildbs directly from s3 for multiple accounts.
context: assumes a daily traildb file in s3 with dated key path | [
"index",
"traildbs",
"directly",
"from",
"s3",
"for",
"multiple",
"accounts",
"."
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_traildb/c7n_traildb/trailes.py#L214-L268 | train | index traildbs directly from s3 for multiple accounts | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/c7n_azure/c7n_azure/session.py | Session._initialize_session | def _initialize_session(self):
"""
Creates a session using available authentication type.
Auth priority:
1. Token Auth
2. Tenant Auth
3. Azure CLI Auth
"""
# Only run once
if self.credentials is not None:
return
tenant_auth_... | python | def _initialize_session(self):
"""
Creates a session using available authentication type.
Auth priority:
1. Token Auth
2. Tenant Auth
3. Azure CLI Auth
"""
# Only run once
if self.credentials is not None:
return
tenant_auth_... | [
"def",
"_initialize_session",
"(",
"self",
")",
":",
"# Only run once",
"if",
"self",
".",
"credentials",
"is",
"not",
"None",
":",
"return",
"tenant_auth_variables",
"=",
"[",
"constants",
".",
"ENV_TENANT_ID",
",",
"constants",
".",
"ENV_SUB_ID",
",",
"constan... | Creates a session using available authentication type.
Auth priority:
1. Token Auth
2. Tenant Auth
3. Azure CLI Auth | [
"Creates",
"a",
"session",
"using",
"available",
"authentication",
"type",
"."
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_azure/c7n_azure/session.py#L58-L139 | train | Initializes the session with the available authentication type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/c7n_azure/c7n_azure/session.py | Session.resource_api_version | def resource_api_version(self, resource_id):
""" latest non-preview api version for resource """
namespace = ResourceIdParser.get_namespace(resource_id)
resource_type = ResourceIdParser.get_resource_type(resource_id)
cache_id = namespace + resource_type
if cache_id in self._pr... | python | def resource_api_version(self, resource_id):
""" latest non-preview api version for resource """
namespace = ResourceIdParser.get_namespace(resource_id)
resource_type = ResourceIdParser.get_resource_type(resource_id)
cache_id = namespace + resource_type
if cache_id in self._pr... | [
"def",
"resource_api_version",
"(",
"self",
",",
"resource_id",
")",
":",
"namespace",
"=",
"ResourceIdParser",
".",
"get_namespace",
"(",
"resource_id",
")",
"resource_type",
"=",
"ResourceIdParser",
".",
"get_resource_type",
"(",
"resource_id",
")",
"cache_id",
"=... | latest non-preview api version for resource | [
"latest",
"non",
"-",
"preview",
"api",
"version",
"for",
"resource"
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_azure/c7n_azure/session.py#L188-L209 | train | Get the latest non - preview api version for a resource. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/c7n_azure/c7n_azure/session.py | Session.get_functions_auth_string | def get_functions_auth_string(self, target_subscription_id):
"""
Build auth json string for deploying
Azure Functions. Look for dedicated
Functions environment variables or
fall back to normal Service Principal
variables.
"""
self._initialize_session()
... | python | def get_functions_auth_string(self, target_subscription_id):
"""
Build auth json string for deploying
Azure Functions. Look for dedicated
Functions environment variables or
fall back to normal Service Principal
variables.
"""
self._initialize_session()
... | [
"def",
"get_functions_auth_string",
"(",
"self",
",",
"target_subscription_id",
")",
":",
"self",
".",
"_initialize_session",
"(",
")",
"function_auth_variables",
"=",
"[",
"constants",
".",
"ENV_FUNCTION_TENANT_ID",
",",
"constants",
".",
"ENV_FUNCTION_CLIENT_ID",
",",... | Build auth json string for deploying
Azure Functions. Look for dedicated
Functions environment variables or
fall back to normal Service Principal
variables. | [
"Build",
"auth",
"json",
"string",
"for",
"deploying",
"Azure",
"Functions",
".",
"Look",
"for",
"dedicated",
"Functions",
"environment",
"variables",
"or",
"fall",
"back",
"to",
"normal",
"Service",
"Principal",
"variables",
"."
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_azure/c7n_azure/session.py#L236-L282 | train | Build auth json string for deploying Azure Functions. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | c7n/query.py | ResourceQuery.filter | def filter(self, resource_manager, **params):
"""Query a set of resources."""
m = self.resolve(resource_manager.resource_type)
client = local_session(self.session_factory).client(
m.service, resource_manager.config.region)
enum_op, path, extra_args = m.enum_spec
if ex... | python | def filter(self, resource_manager, **params):
"""Query a set of resources."""
m = self.resolve(resource_manager.resource_type)
client = local_session(self.session_factory).client(
m.service, resource_manager.config.region)
enum_op, path, extra_args = m.enum_spec
if ex... | [
"def",
"filter",
"(",
"self",
",",
"resource_manager",
",",
"*",
"*",
"params",
")",
":",
"m",
"=",
"self",
".",
"resolve",
"(",
"resource_manager",
".",
"resource_type",
")",
"client",
"=",
"local_session",
"(",
"self",
".",
"session_factory",
")",
".",
... | Query a set of resources. | [
"Query",
"a",
"set",
"of",
"resources",
"."
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/query.py#L80-L90 | train | Query a set of resources. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | c7n/query.py | ResourceQuery.get | def get(self, resource_manager, identities):
"""Get resources by identities
"""
m = self.resolve(resource_manager.resource_type)
params = {}
client_filter = False
# Try to formulate server side query
if m.filter_name:
if m.filter_type == 'list':
... | python | def get(self, resource_manager, identities):
"""Get resources by identities
"""
m = self.resolve(resource_manager.resource_type)
params = {}
client_filter = False
# Try to formulate server side query
if m.filter_name:
if m.filter_type == 'list':
... | [
"def",
"get",
"(",
"self",
",",
"resource_manager",
",",
"identities",
")",
":",
"m",
"=",
"self",
".",
"resolve",
"(",
"resource_manager",
".",
"resource_type",
")",
"params",
"=",
"{",
"}",
"client_filter",
"=",
"False",
"# Try to formulate server side query",... | Get resources by identities | [
"Get",
"resources",
"by",
"identities"
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/query.py#L92-L118 | train | Get resources by identities | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | c7n/query.py | ChildResourceQuery.filter | def filter(self, resource_manager, **params):
"""Query a set of resources."""
m = self.resolve(resource_manager.resource_type)
client = local_session(self.session_factory).client(m.service)
enum_op, path, extra_args = m.enum_spec
if extra_args:
params.update(extra_ar... | python | def filter(self, resource_manager, **params):
"""Query a set of resources."""
m = self.resolve(resource_manager.resource_type)
client = local_session(self.session_factory).client(m.service)
enum_op, path, extra_args = m.enum_spec
if extra_args:
params.update(extra_ar... | [
"def",
"filter",
"(",
"self",
",",
"resource_manager",
",",
"*",
"*",
"params",
")",
":",
"m",
"=",
"self",
".",
"resolve",
"(",
"resource_manager",
".",
"resource_type",
")",
"client",
"=",
"local_session",
"(",
"self",
".",
"session_factory",
")",
".",
... | Query a set of resources. | [
"Query",
"a",
"set",
"of",
"resources",
"."
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/query.py#L136-L171 | train | Query a set of resources. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/sandbox/c7n_sphere11/c7n_sphere11/wsgigw.py | create_gw_response | def create_gw_response(app, wsgi_env):
"""Create an api gw response from a wsgi app and environ.
"""
response = {}
buf = []
result = []
def start_response(status, headers, exc_info=None):
result[:] = [status, headers]
return buf.append
appr = app(wsgi_env, start_response)
... | python | def create_gw_response(app, wsgi_env):
"""Create an api gw response from a wsgi app and environ.
"""
response = {}
buf = []
result = []
def start_response(status, headers, exc_info=None):
result[:] = [status, headers]
return buf.append
appr = app(wsgi_env, start_response)
... | [
"def",
"create_gw_response",
"(",
"app",
",",
"wsgi_env",
")",
":",
"response",
"=",
"{",
"}",
"buf",
"=",
"[",
"]",
"result",
"=",
"[",
"]",
"def",
"start_response",
"(",
"status",
",",
"headers",
",",
"exc_info",
"=",
"None",
")",
":",
"result",
"[... | Create an api gw response from a wsgi app and environ. | [
"Create",
"an",
"api",
"gw",
"response",
"from",
"a",
"wsgi",
"app",
"and",
"environ",
"."
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/sandbox/c7n_sphere11/c7n_sphere11/wsgigw.py#L25-L53 | train | Create an api gw response from a wsgi app and environ. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
cloud-custodian/cloud-custodian | tools/sandbox/c7n_sphere11/c7n_sphere11/wsgigw.py | create_wsgi_request | def create_wsgi_request(event, server_name='apigw'):
"""Create a wsgi environment from an apigw request.
"""
path = urllib.url2pathname(event['path'])
script_name = (
event['headers']['Host'].endswith('.amazonaws.com') and
event['requestContext']['stage'] or '').encode('utf8')
query ... | python | def create_wsgi_request(event, server_name='apigw'):
"""Create a wsgi environment from an apigw request.
"""
path = urllib.url2pathname(event['path'])
script_name = (
event['headers']['Host'].endswith('.amazonaws.com') and
event['requestContext']['stage'] or '').encode('utf8')
query ... | [
"def",
"create_wsgi_request",
"(",
"event",
",",
"server_name",
"=",
"'apigw'",
")",
":",
"path",
"=",
"urllib",
".",
"url2pathname",
"(",
"event",
"[",
"'path'",
"]",
")",
"script_name",
"=",
"(",
"event",
"[",
"'headers'",
"]",
"[",
"'Host'",
"]",
".",... | Create a wsgi environment from an apigw request. | [
"Create",
"a",
"wsgi",
"environment",
"from",
"an",
"apigw",
"request",
"."
] | 52ef732eb3d7bc939d1579faf519314814695c08 | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/sandbox/c7n_sphere11/c7n_sphere11/wsgigw.py#L56-L118 | train | Create a wsgi environment from an apigw request. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/logs.py | LogRetriever.create_from_lambda_arn | def create_from_lambda_arn(cls, client, lambda_arn):
# type: (TypedAWSClient, str) -> LogRetriever
"""Create a LogRetriever from a client and lambda arn.
:type client: botocore.client.Logs
:param client: A ``logs`` client.
:type lambda_arn: str
:param lambda_arn: The AR... | python | def create_from_lambda_arn(cls, client, lambda_arn):
# type: (TypedAWSClient, str) -> LogRetriever
"""Create a LogRetriever from a client and lambda arn.
:type client: botocore.client.Logs
:param client: A ``logs`` client.
:type lambda_arn: str
:param lambda_arn: The AR... | [
"def",
"create_from_lambda_arn",
"(",
"cls",
",",
"client",
",",
"lambda_arn",
")",
":",
"# type: (TypedAWSClient, str) -> LogRetriever",
"lambda_name",
"=",
"lambda_arn",
".",
"split",
"(",
"':'",
")",
"[",
"6",
"]",
"log_group_name",
"=",
"'/aws/lambda/%s'",
"%",
... | Create a LogRetriever from a client and lambda arn.
:type client: botocore.client.Logs
:param client: A ``logs`` client.
:type lambda_arn: str
:param lambda_arn: The ARN of the lambda function.
:return: An instance of ``LogRetriever``. | [
"Create",
"a",
"LogRetriever",
"from",
"a",
"client",
"and",
"lambda",
"arn",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/logs.py#L33-L48 | train | Create a LogRetriever from a client and lambda arn. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/logs.py | LogRetriever.retrieve_logs | def retrieve_logs(self, include_lambda_messages=True, max_entries=None):
# type: (bool, Optional[int]) -> Iterator[Dict[str, Any]]
"""Retrieve logs from a log group.
:type include_lambda_messages: boolean
:param include_lambda_messages: Include logs generated by the AWS
Lamb... | python | def retrieve_logs(self, include_lambda_messages=True, max_entries=None):
# type: (bool, Optional[int]) -> Iterator[Dict[str, Any]]
"""Retrieve logs from a log group.
:type include_lambda_messages: boolean
:param include_lambda_messages: Include logs generated by the AWS
Lamb... | [
"def",
"retrieve_logs",
"(",
"self",
",",
"include_lambda_messages",
"=",
"True",
",",
"max_entries",
"=",
"None",
")",
":",
"# type: (bool, Optional[int]) -> Iterator[Dict[str, Any]]",
"# TODO: Add support for startTime/endTime.",
"shown",
"=",
"0",
"for",
"event",
"in",
... | Retrieve logs from a log group.
:type include_lambda_messages: boolean
:param include_lambda_messages: Include logs generated by the AWS
Lambda service. If this value is False, only chalice logs will be
included.
:type max_entries: int
:param max_entries: Maxim... | [
"Retrieve",
"logs",
"from",
"a",
"log",
"group",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/logs.py#L67-L109 | train | Retrieve the log entries from the log group. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/deploy/validate.py | validate_configuration | def validate_configuration(config):
# type: (Config) -> None
"""Validate app configuration.
The purpose of this method is to provide a fail fast mechanism
for anything we know is going to fail deployment.
We can detect common error cases and provide the user with helpful
error messages.
""... | python | def validate_configuration(config):
# type: (Config) -> None
"""Validate app configuration.
The purpose of this method is to provide a fail fast mechanism
for anything we know is going to fail deployment.
We can detect common error cases and provide the user with helpful
error messages.
""... | [
"def",
"validate_configuration",
"(",
"config",
")",
":",
"# type: (Config) -> None",
"routes",
"=",
"config",
".",
"chalice_app",
".",
"routes",
"validate_routes",
"(",
"routes",
")",
"validate_route_content_types",
"(",
"routes",
",",
"config",
".",
"chalice_app",
... | Validate app configuration.
The purpose of this method is to provide a fail fast mechanism
for anything we know is going to fail deployment.
We can detect common error cases and provide the user with helpful
error messages. | [
"Validate",
"app",
"configuration",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/deploy/validate.py#L28-L44 | train | Validate app configuration. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/deploy/validate.py | validate_python_version | def validate_python_version(config, actual_py_version=None):
# type: (Config, Optional[str]) -> None
"""Validate configuration matches a specific python version.
If the ``actual_py_version`` is not provided, it will default
to the major/minor version of the currently running python
interpreter.
... | python | def validate_python_version(config, actual_py_version=None):
# type: (Config, Optional[str]) -> None
"""Validate configuration matches a specific python version.
If the ``actual_py_version`` is not provided, it will default
to the major/minor version of the currently running python
interpreter.
... | [
"def",
"validate_python_version",
"(",
"config",
",",
"actual_py_version",
"=",
"None",
")",
":",
"# type: (Config, Optional[str]) -> None",
"lambda_version",
"=",
"config",
".",
"lambda_python_version",
"if",
"actual_py_version",
"is",
"None",
":",
"actual_py_version",
"... | Validate configuration matches a specific python version.
If the ``actual_py_version`` is not provided, it will default
to the major/minor version of the currently running python
interpreter.
:param actual_py_version: The major/minor python version in
the form "pythonX.Y", e.g "python2.7", "py... | [
"Validate",
"configuration",
"matches",
"a",
"specific",
"python",
"version",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/deploy/validate.py#L74-L97 | train | Validate that the given configuration matches a specific python version. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/deploy/packager.py | PipRunner._execute | def _execute(self,
command, # type: str
args, # type: List[str]
env_vars=None, # type: EnvVars
shim=None # type: OptStr
):
# type: (...) -> Tuple[int, bytes, bytes]
"""Execute a pip command with ... | python | def _execute(self,
command, # type: str
args, # type: List[str]
env_vars=None, # type: EnvVars
shim=None # type: OptStr
):
# type: (...) -> Tuple[int, bytes, bytes]
"""Execute a pip command with ... | [
"def",
"_execute",
"(",
"self",
",",
"command",
",",
"# type: str",
"args",
",",
"# type: List[str]",
"env_vars",
"=",
"None",
",",
"# type: EnvVars",
"shim",
"=",
"None",
"# type: OptStr",
")",
":",
"# type: (...) -> Tuple[int, bytes, bytes]",
"main_args",
"=",
"["... | Execute a pip command with the given arguments. | [
"Execute",
"a",
"pip",
"command",
"with",
"the",
"given",
"arguments",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/deploy/packager.py#L696-L708 | train | Execute a pip command with the given arguments. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/deploy/packager.py | PipRunner.build_wheel | def build_wheel(self, wheel, directory, compile_c=True):
# type: (str, str, bool) -> None
"""Build an sdist into a wheel file."""
arguments = ['--no-deps', '--wheel-dir', directory, wheel]
env_vars = self._osutils.environ()
shim = ''
if not compile_c:
env_vars... | python | def build_wheel(self, wheel, directory, compile_c=True):
# type: (str, str, bool) -> None
"""Build an sdist into a wheel file."""
arguments = ['--no-deps', '--wheel-dir', directory, wheel]
env_vars = self._osutils.environ()
shim = ''
if not compile_c:
env_vars... | [
"def",
"build_wheel",
"(",
"self",
",",
"wheel",
",",
"directory",
",",
"compile_c",
"=",
"True",
")",
":",
"# type: (str, str, bool) -> None",
"arguments",
"=",
"[",
"'--no-deps'",
",",
"'--wheel-dir'",
",",
"directory",
",",
"wheel",
"]",
"env_vars",
"=",
"s... | Build an sdist into a wheel file. | [
"Build",
"an",
"sdist",
"into",
"a",
"wheel",
"file",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/deploy/packager.py#L710-L723 | train | Build an sdist into a wheel file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/deploy/packager.py | PipRunner.download_all_dependencies | def download_all_dependencies(self, requirements_filename, directory):
# type: (str, str) -> None
"""Download all dependencies as sdist or wheel."""
arguments = ['-r', requirements_filename, '--dest', directory]
rc, out, err = self._execute('download', arguments)
# When downloadi... | python | def download_all_dependencies(self, requirements_filename, directory):
# type: (str, str) -> None
"""Download all dependencies as sdist or wheel."""
arguments = ['-r', requirements_filename, '--dest', directory]
rc, out, err = self._execute('download', arguments)
# When downloadi... | [
"def",
"download_all_dependencies",
"(",
"self",
",",
"requirements_filename",
",",
"directory",
")",
":",
"# type: (str, str) -> None",
"arguments",
"=",
"[",
"'-r'",
",",
"requirements_filename",
",",
"'--dest'",
",",
"directory",
"]",
"rc",
",",
"out",
",",
"er... | Download all dependencies as sdist or wheel. | [
"Download",
"all",
"dependencies",
"as",
"sdist",
"or",
"wheel",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/deploy/packager.py#L725-L758 | train | Download all dependencies as sdist or wheel. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/deploy/packager.py | PipRunner.download_manylinux_wheels | def download_manylinux_wheels(self, abi, packages, directory):
# type: (str, List[str], str) -> None
"""Download wheel files for manylinux for all the given packages."""
# If any one of these dependencies fails pip will bail out. Since we
# are only interested in all the ones we can down... | python | def download_manylinux_wheels(self, abi, packages, directory):
# type: (str, List[str], str) -> None
"""Download wheel files for manylinux for all the given packages."""
# If any one of these dependencies fails pip will bail out. Since we
# are only interested in all the ones we can down... | [
"def",
"download_manylinux_wheels",
"(",
"self",
",",
"abi",
",",
"packages",
",",
"directory",
")",
":",
"# type: (str, List[str], str) -> None",
"# If any one of these dependencies fails pip will bail out. Since we",
"# are only interested in all the ones we can download, we need to fe... | Download wheel files for manylinux for all the given packages. | [
"Download",
"wheel",
"files",
"for",
"manylinux",
"for",
"all",
"the",
"given",
"packages",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/deploy/packager.py#L760-L775 | train | Download wheel files for manylinux for all the given packages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/utils.py | to_cfn_resource_name | def to_cfn_resource_name(name):
# type: (str) -> str
"""Transform a name to a valid cfn name.
This will convert the provided name to a CamelCase name.
It's possible that the conversion to a CFN resource name
can result in name collisions. It's up to the caller
to handle name collisions appropr... | python | def to_cfn_resource_name(name):
# type: (str) -> str
"""Transform a name to a valid cfn name.
This will convert the provided name to a CamelCase name.
It's possible that the conversion to a CFN resource name
can result in name collisions. It's up to the caller
to handle name collisions appropr... | [
"def",
"to_cfn_resource_name",
"(",
"name",
")",
":",
"# type: (str) -> str",
"if",
"not",
"name",
":",
"raise",
"ValueError",
"(",
"\"Invalid name: %r\"",
"%",
"name",
")",
"word_separators",
"=",
"[",
"'-'",
",",
"'_'",
"]",
"for",
"word_separator",
"in",
"w... | Transform a name to a valid cfn name.
This will convert the provided name to a CamelCase name.
It's possible that the conversion to a CFN resource name
can result in name collisions. It's up to the caller
to handle name collisions appropriately. | [
"Transform",
"a",
"name",
"to",
"a",
"valid",
"cfn",
"name",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/utils.py#L30-L46 | train | Transform a name to a valid CFN resource name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/utils.py | remove_stage_from_deployed_values | def remove_stage_from_deployed_values(key, filename):
# type: (str, str) -> None
"""Delete a top level key from the deployed JSON file."""
final_values = {} # type: Dict[str, Any]
try:
with open(filename, 'r') as f:
final_values = json.load(f)
except IOError:
# If there ... | python | def remove_stage_from_deployed_values(key, filename):
# type: (str, str) -> None
"""Delete a top level key from the deployed JSON file."""
final_values = {} # type: Dict[str, Any]
try:
with open(filename, 'r') as f:
final_values = json.load(f)
except IOError:
# If there ... | [
"def",
"remove_stage_from_deployed_values",
"(",
"key",
",",
"filename",
")",
":",
"# type: (str, str) -> None",
"final_values",
"=",
"{",
"}",
"# type: Dict[str, Any]",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"final_values",
... | Delete a top level key from the deployed JSON file. | [
"Delete",
"a",
"top",
"level",
"key",
"from",
"the",
"deployed",
"JSON",
"file",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/utils.py#L49-L67 | train | Delete a top level key from the deployed JSON file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/utils.py | record_deployed_values | def record_deployed_values(deployed_values, filename):
# type: (Dict[str, Any], str) -> None
"""Record deployed values to a JSON file.
This allows subsequent deploys to lookup previously deployed values.
"""
final_values = {} # type: Dict[str, Any]
if os.path.isfile(filename):
with op... | python | def record_deployed_values(deployed_values, filename):
# type: (Dict[str, Any], str) -> None
"""Record deployed values to a JSON file.
This allows subsequent deploys to lookup previously deployed values.
"""
final_values = {} # type: Dict[str, Any]
if os.path.isfile(filename):
with op... | [
"def",
"record_deployed_values",
"(",
"deployed_values",
",",
"filename",
")",
":",
"# type: (Dict[str, Any], str) -> None",
"final_values",
"=",
"{",
"}",
"# type: Dict[str, Any]",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
":",
"with",
"open",
... | Record deployed values to a JSON file.
This allows subsequent deploys to lookup previously deployed values. | [
"Record",
"deployed",
"values",
"to",
"a",
"JSON",
"file",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/utils.py#L70-L84 | train | Record deployed values to a JSON file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/utils.py | create_zip_file | def create_zip_file(source_dir, outfile):
# type: (str, str) -> None
"""Create a zip file from a source input directory.
This function is intended to be an equivalent to
`zip -r`. You give it a source directory, `source_dir`,
and it will recursively zip up the files into a zipfile
specified by... | python | def create_zip_file(source_dir, outfile):
# type: (str, str) -> None
"""Create a zip file from a source input directory.
This function is intended to be an equivalent to
`zip -r`. You give it a source directory, `source_dir`,
and it will recursively zip up the files into a zipfile
specified by... | [
"def",
"create_zip_file",
"(",
"source_dir",
",",
"outfile",
")",
":",
"# type: (str, str) -> None",
"with",
"zipfile",
".",
"ZipFile",
"(",
"outfile",
",",
"'w'",
",",
"compression",
"=",
"zipfile",
".",
"ZIP_DEFLATED",
")",
"as",
"z",
":",
"for",
"root",
"... | Create a zip file from a source input directory.
This function is intended to be an equivalent to
`zip -r`. You give it a source directory, `source_dir`,
and it will recursively zip up the files into a zipfile
specified by the `outfile` argument. | [
"Create",
"a",
"zip",
"file",
"from",
"a",
"source",
"input",
"directory",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/utils.py#L99-L115 | train | Create a zip file from a source directory. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/awsclient.py | TypedAWSClient.update_function | def update_function(self,
function_name, # type: str
zip_contents, # type: str
environment_variables=None, # type: StrMap
runtime=None, # type: OptStr
tags... | python | def update_function(self,
function_name, # type: str
zip_contents, # type: str
environment_variables=None, # type: StrMap
runtime=None, # type: OptStr
tags... | [
"def",
"update_function",
"(",
"self",
",",
"function_name",
",",
"# type: str",
"zip_contents",
",",
"# type: str",
"environment_variables",
"=",
"None",
",",
"# type: StrMap",
"runtime",
"=",
"None",
",",
"# type: OptStr",
"tags",
"=",
"None",
",",
"# type: StrMap... | Update a Lambda function's code and configuration.
This method only updates the values provided to it. If a parameter
is not provided, no changes will be made for that that parameter on
the targeted lambda function. | [
"Update",
"a",
"Lambda",
"function",
"s",
"code",
"and",
"configuration",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/awsclient.py#L252-L287 | train | Updates a Lambda function s code and configuration. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/awsclient.py | TypedAWSClient.delete_role | def delete_role(self, name):
# type: (str) -> None
"""Delete a role by first deleting all inline policies."""
client = self._client('iam')
inline_policies = client.list_role_policies(
RoleName=name
)['PolicyNames']
for policy_name in inline_policies:
... | python | def delete_role(self, name):
# type: (str) -> None
"""Delete a role by first deleting all inline policies."""
client = self._client('iam')
inline_policies = client.list_role_policies(
RoleName=name
)['PolicyNames']
for policy_name in inline_policies:
... | [
"def",
"delete_role",
"(",
"self",
",",
"name",
")",
":",
"# type: (str) -> None",
"client",
"=",
"self",
".",
"_client",
"(",
"'iam'",
")",
"inline_policies",
"=",
"client",
".",
"list_role_policies",
"(",
"RoleName",
"=",
"name",
")",
"[",
"'PolicyNames'",
... | Delete a role by first deleting all inline policies. | [
"Delete",
"a",
"role",
"by",
"first",
"deleting",
"all",
"inline",
"policies",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/awsclient.py#L424-L433 | train | Delete a role by first deleting all inline policies. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/awsclient.py | TypedAWSClient.get_rest_api_id | def get_rest_api_id(self, name):
# type: (str) -> Optional[str]
"""Get rest api id associated with an API name.
:type name: str
:param name: The name of the rest api.
:rtype: str
:return: If the rest api exists, then the restApiId
is returned, otherwise None... | python | def get_rest_api_id(self, name):
# type: (str) -> Optional[str]
"""Get rest api id associated with an API name.
:type name: str
:param name: The name of the rest api.
:rtype: str
:return: If the rest api exists, then the restApiId
is returned, otherwise None... | [
"def",
"get_rest_api_id",
"(",
"self",
",",
"name",
")",
":",
"# type: (str) -> Optional[str]",
"rest_apis",
"=",
"self",
".",
"_client",
"(",
"'apigateway'",
")",
".",
"get_rest_apis",
"(",
")",
"[",
"'items'",
"]",
"for",
"api",
"in",
"rest_apis",
":",
"if... | Get rest api id associated with an API name.
:type name: str
:param name: The name of the rest api.
:rtype: str
:return: If the rest api exists, then the restApiId
is returned, otherwise None. | [
"Get",
"rest",
"api",
"id",
"associated",
"with",
"an",
"API",
"name",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/awsclient.py#L435-L451 | train | Get the rest api id associated with an API name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/awsclient.py | TypedAWSClient.rest_api_exists | def rest_api_exists(self, rest_api_id):
# type: (str) -> bool
"""Check if an an API Gateway REST API exists."""
client = self._client('apigateway')
try:
client.get_rest_api(restApiId=rest_api_id)
return True
except client.exceptions.NotFoundException:
... | python | def rest_api_exists(self, rest_api_id):
# type: (str) -> bool
"""Check if an an API Gateway REST API exists."""
client = self._client('apigateway')
try:
client.get_rest_api(restApiId=rest_api_id)
return True
except client.exceptions.NotFoundException:
... | [
"def",
"rest_api_exists",
"(",
"self",
",",
"rest_api_id",
")",
":",
"# type: (str) -> bool",
"client",
"=",
"self",
".",
"_client",
"(",
"'apigateway'",
")",
"try",
":",
"client",
".",
"get_rest_api",
"(",
"restApiId",
"=",
"rest_api_id",
")",
"return",
"True... | Check if an an API Gateway REST API exists. | [
"Check",
"if",
"an",
"an",
"API",
"Gateway",
"REST",
"API",
"exists",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/awsclient.py#L453-L461 | train | Check if an API Gateway REST API exists. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/awsclient.py | TypedAWSClient.add_permission_for_apigateway | def add_permission_for_apigateway(self, function_name,
region_name, account_id,
rest_api_id, random_id=None):
# type: (str, str, str, str, Optional[str]) -> None
"""Authorize API gateway to invoke a lambda function is needed.
... | python | def add_permission_for_apigateway(self, function_name,
region_name, account_id,
rest_api_id, random_id=None):
# type: (str, str, str, str, Optional[str]) -> None
"""Authorize API gateway to invoke a lambda function is needed.
... | [
"def",
"add_permission_for_apigateway",
"(",
"self",
",",
"function_name",
",",
"region_name",
",",
"account_id",
",",
"rest_api_id",
",",
"random_id",
"=",
"None",
")",
":",
"# type: (str, str, str, str, Optional[str]) -> None",
"source_arn",
"=",
"self",
".",
"_build_... | Authorize API gateway to invoke a lambda function is needed.
This method will first check if API gateway has permission to call
the lambda function, and only if necessary will it invoke
``self.add_permission_for_apigateway(...). | [
"Authorize",
"API",
"gateway",
"to",
"invoke",
"a",
"lambda",
"function",
"is",
"needed",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/awsclient.py#L496-L513 | train | Authorize API gateway to invoke a lambda function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/awsclient.py | TypedAWSClient.get_function_policy | def get_function_policy(self, function_name):
# type: (str) -> Dict[str, Any]
"""Return the function policy for a lambda function.
This function will extract the policy string as a json document
and return the json.loads(...) version of the policy.
"""
client = self._cl... | python | def get_function_policy(self, function_name):
# type: (str) -> Dict[str, Any]
"""Return the function policy for a lambda function.
This function will extract the policy string as a json document
and return the json.loads(...) version of the policy.
"""
client = self._cl... | [
"def",
"get_function_policy",
"(",
"self",
",",
"function_name",
")",
":",
"# type: (str) -> Dict[str, Any]",
"client",
"=",
"self",
".",
"_client",
"(",
"'lambda'",
")",
"try",
":",
"policy",
"=",
"client",
".",
"get_policy",
"(",
"FunctionName",
"=",
"function... | Return the function policy for a lambda function.
This function will extract the policy string as a json document
and return the json.loads(...) version of the policy. | [
"Return",
"the",
"function",
"policy",
"for",
"a",
"lambda",
"function",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/awsclient.py#L515-L528 | train | Returns the function policy for a lambda function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/awsclient.py | TypedAWSClient.download_sdk | def download_sdk(self, rest_api_id, output_dir,
api_gateway_stage=DEFAULT_STAGE_NAME,
sdk_type='javascript'):
# type: (str, str, str, str) -> None
"""Download an SDK to a directory.
This will generate an SDK and download it to the provided
``out... | python | def download_sdk(self, rest_api_id, output_dir,
api_gateway_stage=DEFAULT_STAGE_NAME,
sdk_type='javascript'):
# type: (str, str, str, str) -> None
"""Download an SDK to a directory.
This will generate an SDK and download it to the provided
``out... | [
"def",
"download_sdk",
"(",
"self",
",",
"rest_api_id",
",",
"output_dir",
",",
"api_gateway_stage",
"=",
"DEFAULT_STAGE_NAME",
",",
"sdk_type",
"=",
"'javascript'",
")",
":",
"# type: (str, str, str, str) -> None",
"zip_stream",
"=",
"self",
".",
"get_sdk_download_stre... | Download an SDK to a directory.
This will generate an SDK and download it to the provided
``output_dir``. If you're using ``get_sdk_download_stream()``,
you have to handle downloading the stream and unzipping the
contents yourself. This method handles that for you. | [
"Download",
"an",
"SDK",
"to",
"a",
"directory",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/awsclient.py#L530-L564 | train | Download an SDK to a directory. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/awsclient.py | TypedAWSClient.get_sdk_download_stream | def get_sdk_download_stream(self, rest_api_id,
api_gateway_stage=DEFAULT_STAGE_NAME,
sdk_type='javascript'):
# type: (str, str, str) -> file
"""Generate an SDK for a given SDK.
Returns a file like object that streams a zip contents... | python | def get_sdk_download_stream(self, rest_api_id,
api_gateway_stage=DEFAULT_STAGE_NAME,
sdk_type='javascript'):
# type: (str, str, str) -> file
"""Generate an SDK for a given SDK.
Returns a file like object that streams a zip contents... | [
"def",
"get_sdk_download_stream",
"(",
"self",
",",
"rest_api_id",
",",
"api_gateway_stage",
"=",
"DEFAULT_STAGE_NAME",
",",
"sdk_type",
"=",
"'javascript'",
")",
":",
"# type: (str, str, str) -> file",
"response",
"=",
"self",
".",
"_client",
"(",
"'apigateway'",
")"... | Generate an SDK for a given SDK.
Returns a file like object that streams a zip contents for the
generated SDK. | [
"Generate",
"an",
"SDK",
"for",
"a",
"given",
"SDK",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/awsclient.py#L566-L579 | train | Generate an SDK for a given API Gateway stage and type and return a file like object that streams the contents of the generated SDK. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/awsclient.py | TypedAWSClient.verify_sns_subscription_current | def verify_sns_subscription_current(self, subscription_arn, topic_name,
function_arn):
# type: (str, str, str) -> bool
"""Verify a subscription arn matches the topic and function name.
Given a subscription arn, verify that the associated topic name
... | python | def verify_sns_subscription_current(self, subscription_arn, topic_name,
function_arn):
# type: (str, str, str) -> bool
"""Verify a subscription arn matches the topic and function name.
Given a subscription arn, verify that the associated topic name
... | [
"def",
"verify_sns_subscription_current",
"(",
"self",
",",
"subscription_arn",
",",
"topic_name",
",",
"function_arn",
")",
":",
"# type: (str, str, str) -> bool",
"sns_client",
"=",
"self",
".",
"_client",
"(",
"'sns'",
")",
"try",
":",
"attributes",
"=",
"sns_cli... | Verify a subscription arn matches the topic and function name.
Given a subscription arn, verify that the associated topic name
and function arn match up to the parameters passed in. | [
"Verify",
"a",
"subscription",
"arn",
"matches",
"the",
"topic",
"and",
"function",
"name",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/awsclient.py#L594-L614 | train | Verify that the topic and function name of a topic is the current topic. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/awsclient.py | TypedAWSClient.connect_s3_bucket_to_lambda | def connect_s3_bucket_to_lambda(self, bucket, function_arn, events,
prefix=None, suffix=None):
# type: (str, str, List[str], OptStr, OptStr) -> None
"""Configure S3 bucket to invoke a lambda function.
The S3 bucket must already have permission to invoke the
... | python | def connect_s3_bucket_to_lambda(self, bucket, function_arn, events,
prefix=None, suffix=None):
# type: (str, str, List[str], OptStr, OptStr) -> None
"""Configure S3 bucket to invoke a lambda function.
The S3 bucket must already have permission to invoke the
... | [
"def",
"connect_s3_bucket_to_lambda",
"(",
"self",
",",
"bucket",
",",
"function_arn",
",",
"events",
",",
"prefix",
"=",
"None",
",",
"suffix",
"=",
"None",
")",
":",
"# type: (str, str, List[str], OptStr, OptStr) -> None",
"s3",
"=",
"self",
".",
"_client",
"(",... | Configure S3 bucket to invoke a lambda function.
The S3 bucket must already have permission to invoke the
lambda function before you call this function, otherwise
the service will return an error. You can add permissions
by using the ``add_permission_for_s3_event`` below. The
... | [
"Configure",
"S3",
"bucket",
"to",
"invoke",
"a",
"lambda",
"function",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/awsclient.py#L741-L782 | train | Connects an S3 bucket to a Lambda function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/awsclient.py | TypedAWSClient.verify_event_source_current | def verify_event_source_current(self, event_uuid, resource_name,
service_name, function_arn):
# type: (str, str, str, str) -> bool
"""Check if the uuid matches the resource and function arn provided.
Given a uuid representing an event source mapping for a lam... | python | def verify_event_source_current(self, event_uuid, resource_name,
service_name, function_arn):
# type: (str, str, str, str) -> bool
"""Check if the uuid matches the resource and function arn provided.
Given a uuid representing an event source mapping for a lam... | [
"def",
"verify_event_source_current",
"(",
"self",
",",
"event_uuid",
",",
"resource_name",
",",
"service_name",
",",
"function_arn",
")",
":",
"# type: (str, str, str, str) -> bool",
"client",
"=",
"self",
".",
"_client",
"(",
"'lambda'",
")",
"try",
":",
"attribut... | Check if the uuid matches the resource and function arn provided.
Given a uuid representing an event source mapping for a lambda
function, verify that the associated source arn
and function arn match up to the parameters passed in.
Instead of providing the event source arn, the resourc... | [
"Check",
"if",
"the",
"uuid",
"matches",
"the",
"resource",
"and",
"function",
"arn",
"provided",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/awsclient.py#L951-L977 | train | Verify that the uuid matches the resource and function arn provided. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/cli/factory.py | CLIFactory.load_project_config | def load_project_config(self):
# type: () -> Dict[str, Any]
"""Load the chalice config file from the project directory.
:raise: OSError/IOError if unable to load the config file.
"""
config_file = os.path.join(self.project_dir, '.chalice', 'config.json')
with open(confi... | python | def load_project_config(self):
# type: () -> Dict[str, Any]
"""Load the chalice config file from the project directory.
:raise: OSError/IOError if unable to load the config file.
"""
config_file = os.path.join(self.project_dir, '.chalice', 'config.json')
with open(confi... | [
"def",
"load_project_config",
"(",
"self",
")",
":",
"# type: () -> Dict[str, Any]",
"config_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"project_dir",
",",
"'.chalice'",
",",
"'config.json'",
")",
"with",
"open",
"(",
"config_file",
")",
"as... | Load the chalice config file from the project directory.
:raise: OSError/IOError if unable to load the config file. | [
"Load",
"the",
"chalice",
"config",
"file",
"from",
"the",
"project",
"directory",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/cli/factory.py#L269-L278 | train | Load the chalice config file from the project directory. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/cli/__init__.py | invoke | def invoke(ctx, name, profile, stage):
# type: (click.Context, str, str, str) -> None
"""Invoke the deployed lambda function NAME."""
factory = ctx.obj['factory'] # type: CLIFactory
factory.profile = profile
try:
invoke_handler = factory.create_lambda_invoke_handler(name, stage)
pa... | python | def invoke(ctx, name, profile, stage):
# type: (click.Context, str, str, str) -> None
"""Invoke the deployed lambda function NAME."""
factory = ctx.obj['factory'] # type: CLIFactory
factory.profile = profile
try:
invoke_handler = factory.create_lambda_invoke_handler(name, stage)
pa... | [
"def",
"invoke",
"(",
"ctx",
",",
"name",
",",
"profile",
",",
"stage",
")",
":",
"# type: (click.Context, str, str, str) -> None",
"factory",
"=",
"ctx",
".",
"obj",
"[",
"'factory'",
"]",
"# type: CLIFactory",
"factory",
".",
"profile",
"=",
"profile",
"try",
... | Invoke the deployed lambda function NAME. | [
"Invoke",
"the",
"deployed",
"lambda",
"function",
"NAME",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/cli/__init__.py#L217-L247 | train | Invoke the deployed lambda function NAME. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/cli/__init__.py | generate_pipeline | def generate_pipeline(ctx, codebuild_image, source, buildspec_file, filename):
# type: (click.Context, str, str, str, str) -> None
"""Generate a cloudformation template for a starter CD pipeline.
This command will write a starter cloudformation template to
the filename you provide. It contains a CodeC... | python | def generate_pipeline(ctx, codebuild_image, source, buildspec_file, filename):
# type: (click.Context, str, str, str, str) -> None
"""Generate a cloudformation template for a starter CD pipeline.
This command will write a starter cloudformation template to
the filename you provide. It contains a CodeC... | [
"def",
"generate_pipeline",
"(",
"ctx",
",",
"codebuild_image",
",",
"source",
",",
"buildspec_file",
",",
"filename",
")",
":",
"# type: (click.Context, str, str, str, str) -> None",
"from",
"chalice",
"import",
"pipeline",
"factory",
"=",
"ctx",
".",
"obj",
"[",
"... | Generate a cloudformation template for a starter CD pipeline.
This command will write a starter cloudformation template to
the filename you provide. It contains a CodeCommit repo,
a CodeBuild stage for packaging your chalice app, and a
CodePipeline stage to deploy your application using cloudformation... | [
"Generate",
"a",
"cloudformation",
"template",
"for",
"a",
"starter",
"CD",
"pipeline",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/cli/__init__.py#L419-L453 | train | Generate a CodePipeline for a given codebuild image and source. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/config.py | Config.deployed_resources | def deployed_resources(self, chalice_stage_name):
# type: (str) -> DeployedResources
"""Return resources associated with a given stage.
If a deployment to a given stage has never happened,
this method will return a value of None.
"""
# This is arguably the wrong level o... | python | def deployed_resources(self, chalice_stage_name):
# type: (str) -> DeployedResources
"""Return resources associated with a given stage.
If a deployment to a given stage has never happened,
this method will return a value of None.
"""
# This is arguably the wrong level o... | [
"def",
"deployed_resources",
"(",
"self",
",",
"chalice_stage_name",
")",
":",
"# type: (str) -> DeployedResources",
"# This is arguably the wrong level of abstraction.",
"# We might be able to move this elsewhere.",
"deployed_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"s... | Return resources associated with a given stage.
If a deployment to a given stage has never happened,
this method will return a value of None. | [
"Return",
"resources",
"associated",
"with",
"a",
"given",
"stage",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/config.py#L326-L346 | train | Returns a list of deployed resources associated with a given stage. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/policy.py | AppPolicyGenerator.generate_policy | def generate_policy(self, config):
# type: (Config) -> Dict[str, Any]
"""Auto generate policy for an application."""
# Admittedly, this is pretty bare bones logic for the time
# being. All it really does it work out, given a Config instance,
# which files need to analyzed and th... | python | def generate_policy(self, config):
# type: (Config) -> Dict[str, Any]
"""Auto generate policy for an application."""
# Admittedly, this is pretty bare bones logic for the time
# being. All it really does it work out, given a Config instance,
# which files need to analyzed and th... | [
"def",
"generate_policy",
"(",
"self",
",",
"config",
")",
":",
"# type: (Config) -> Dict[str, Any]",
"# Admittedly, this is pretty bare bones logic for the time",
"# being. All it really does it work out, given a Config instance,",
"# which files need to analyzed and then delegates to the",
... | Auto generate policy for an application. | [
"Auto",
"generate",
"policy",
"for",
"an",
"application",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/policy.py#L81-L96 | train | Auto generate policy for an application. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/analyzer.py | get_client_calls | def get_client_calls(source_code):
# type: (str) -> APICallT
"""Return all clients calls made in provided source code.
:returns: A dict of service_name -> set([client calls]).
Example: {"s3": set(["list_objects", "create_bucket"]),
"dynamodb": set(["describe_table"])}
"""
... | python | def get_client_calls(source_code):
# type: (str) -> APICallT
"""Return all clients calls made in provided source code.
:returns: A dict of service_name -> set([client calls]).
Example: {"s3": set(["list_objects", "create_bucket"]),
"dynamodb": set(["describe_table"])}
"""
... | [
"def",
"get_client_calls",
"(",
"source_code",
")",
":",
"# type: (str) -> APICallT",
"parsed",
"=",
"parse_code",
"(",
"source_code",
")",
"t",
"=",
"SymbolTableTypeInfer",
"(",
"parsed",
")",
"binder",
"=",
"t",
".",
"bind_types",
"(",
")",
"collector",
"=",
... | Return all clients calls made in provided source code.
:returns: A dict of service_name -> set([client calls]).
Example: {"s3": set(["list_objects", "create_bucket"]),
"dynamodb": set(["describe_table"])} | [
"Return",
"all",
"clients",
"calls",
"made",
"in",
"provided",
"source",
"code",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/analyzer.py#L47-L60 | train | Returns all clients calls made in provided source code. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/analyzer.py | get_client_calls_for_app | def get_client_calls_for_app(source_code):
# type: (str) -> APICallT
"""Return client calls for a chalice app.
This is similar to ``get_client_calls`` except it will
automatically traverse into chalice views with the assumption
that they will be called.
"""
parsed = parse_code(source_code)... | python | def get_client_calls_for_app(source_code):
# type: (str) -> APICallT
"""Return client calls for a chalice app.
This is similar to ``get_client_calls`` except it will
automatically traverse into chalice views with the assumption
that they will be called.
"""
parsed = parse_code(source_code)... | [
"def",
"get_client_calls_for_app",
"(",
"source_code",
")",
":",
"# type: (str) -> APICallT",
"parsed",
"=",
"parse_code",
"(",
"source_code",
")",
"parsed",
".",
"parsed_ast",
"=",
"AppViewTransformer",
"(",
")",
".",
"visit",
"(",
"parsed",
".",
"parsed_ast",
")... | Return client calls for a chalice app.
This is similar to ``get_client_calls`` except it will
automatically traverse into chalice views with the assumption
that they will be called. | [
"Return",
"client",
"calls",
"for",
"a",
"chalice",
"app",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/analyzer.py#L63-L79 | train | Return client calls for a chalice app. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/local.py | RouteMatcher.match_route | def match_route(self, url):
# type: (str) -> MatchResult
"""Match the url against known routes.
This method takes a concrete route "/foo/bar", and
matches it against a set of routes. These routes can
use param substitution corresponding to API gateway patterns.
For exam... | python | def match_route(self, url):
# type: (str) -> MatchResult
"""Match the url against known routes.
This method takes a concrete route "/foo/bar", and
matches it against a set of routes. These routes can
use param substitution corresponding to API gateway patterns.
For exam... | [
"def",
"match_route",
"(",
"self",
",",
"url",
")",
":",
"# type: (str) -> MatchResult",
"# Otherwise we need to check for param substitution",
"parsed_url",
"=",
"urlparse",
"(",
"url",
")",
"parsed_qs",
"=",
"parse_qs",
"(",
"parsed_url",
".",
"query",
",",
"keep_bl... | Match the url against known routes.
This method takes a concrete route "/foo/bar", and
matches it against a set of routes. These routes can
use param substitution corresponding to API gateway patterns.
For example::
match_route('/foo/bar') -> '/foo/{name}' | [
"Match",
"the",
"url",
"against",
"known",
"routes",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/local.py#L113-L147 | train | Match the url against a set of known routes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
aws/chalice | chalice/local.py | LocalGatewayAuthorizer._prepare_authorizer_event | def _prepare_authorizer_event(self, arn, lambda_event, lambda_context):
# type: (str, EventType, LambdaContext) -> EventType
"""Translate event for an authorizer input."""
authorizer_event = lambda_event.copy()
authorizer_event['type'] = 'TOKEN'
try:
authorizer_event[... | python | def _prepare_authorizer_event(self, arn, lambda_event, lambda_context):
# type: (str, EventType, LambdaContext) -> EventType
"""Translate event for an authorizer input."""
authorizer_event = lambda_event.copy()
authorizer_event['type'] = 'TOKEN'
try:
authorizer_event[... | [
"def",
"_prepare_authorizer_event",
"(",
"self",
",",
"arn",
",",
"lambda_event",
",",
"lambda_context",
")",
":",
"# type: (str, EventType, LambdaContext) -> EventType",
"authorizer_event",
"=",
"lambda_event",
".",
"copy",
"(",
")",
"authorizer_event",
"[",
"'type'",
... | Translate event for an authorizer input. | [
"Translate",
"event",
"for",
"an",
"authorizer",
"input",
"."
] | 10d7fb52e68bd1c52aae251c97e3939fc0190412 | https://github.com/aws/chalice/blob/10d7fb52e68bd1c52aae251c97e3939fc0190412/chalice/local.py#L378-L392 | train | Translate an authorizer input into a dictionary of fields that can be used to send to the authorizer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/controller/GeneratorTabController.py | GeneratorTabController.bootstrap_modulator | def bootstrap_modulator(self, protocol: ProtocolAnalyzer):
"""
Set initial parameters for default modulator if it was not edited by user previously
:return:
"""
if len(self.modulators) != 1 or len(self.table_model.protocol.messages) == 0:
return
modulator = s... | python | def bootstrap_modulator(self, protocol: ProtocolAnalyzer):
"""
Set initial parameters for default modulator if it was not edited by user previously
:return:
"""
if len(self.modulators) != 1 or len(self.table_model.protocol.messages) == 0:
return
modulator = s... | [
"def",
"bootstrap_modulator",
"(",
"self",
",",
"protocol",
":",
"ProtocolAnalyzer",
")",
":",
"if",
"len",
"(",
"self",
".",
"modulators",
")",
"!=",
"1",
"or",
"len",
"(",
"self",
".",
"table_model",
".",
"protocol",
".",
"messages",
")",
"==",
"0",
... | Set initial parameters for default modulator if it was not edited by user previously
:return: | [
"Set",
"initial",
"parameters",
"for",
"default",
"modulator",
"if",
"it",
"was",
"not",
"edited",
"by",
"user",
"previously",
":",
"return",
":"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/GeneratorTabController.py#L206-L224 | train | Set initial parameters for default modulator if it was not edited by user previously. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/controller/GeneratorTabController.py | GeneratorTabController.modulate_data | def modulate_data(self, buffer: np.ndarray) -> np.ndarray:
"""
:param buffer: Buffer in which the modulated data shall be written, initialized with zeros
:return:
"""
self.ui.prBarGeneration.show()
self.ui.prBarGeneration.setValue(0)
self.ui.prBarGenerat... | python | def modulate_data(self, buffer: np.ndarray) -> np.ndarray:
"""
:param buffer: Buffer in which the modulated data shall be written, initialized with zeros
:return:
"""
self.ui.prBarGeneration.show()
self.ui.prBarGeneration.setValue(0)
self.ui.prBarGenerat... | [
"def",
"modulate_data",
"(",
"self",
",",
"buffer",
":",
"np",
".",
"ndarray",
")",
"->",
"np",
".",
"ndarray",
":",
"self",
".",
"ui",
".",
"prBarGeneration",
".",
"show",
"(",
")",
"self",
".",
"ui",
".",
"prBarGeneration",
".",
"setValue",
"(",
"0... | :param buffer: Buffer in which the modulated data shall be written, initialized with zeros
:return: | [
":",
"param",
"buffer",
":",
"Buffer",
"in",
"which",
"the",
"modulated",
"data",
"shall",
"be",
"written",
"initialized",
"with",
"zeros",
":",
"return",
":"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/GeneratorTabController.py#L413-L437 | train | Modulate the data of the current state of the modulated message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/controller/GeneratorTabController.py | GeneratorTabController.refresh_existing_encodings | def refresh_existing_encodings(self, encodings_from_file):
"""
Refresh existing encodings for messages, when encoding was changed by user in dialog
:return:
"""
update = False
for msg in self.table_model.protocol.messages:
i = next((i for i, d in enumerate(e... | python | def refresh_existing_encodings(self, encodings_from_file):
"""
Refresh existing encodings for messages, when encoding was changed by user in dialog
:return:
"""
update = False
for msg in self.table_model.protocol.messages:
i = next((i for i, d in enumerate(e... | [
"def",
"refresh_existing_encodings",
"(",
"self",
",",
"encodings_from_file",
")",
":",
"update",
"=",
"False",
"for",
"msg",
"in",
"self",
".",
"table_model",
".",
"protocol",
".",
"messages",
":",
"i",
"=",
"next",
"(",
"(",
"i",
"for",
"i",
",",
"d",
... | Refresh existing encodings for messages, when encoding was changed by user in dialog
:return: | [
"Refresh",
"existing",
"encodings",
"for",
"messages",
"when",
"encoding",
"was",
"changed",
"by",
"user",
"in",
"dialog"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/GeneratorTabController.py#L499-L517 | train | Refresh existing encodings for messages when encoding was changed by user in dialog. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/controller/CompareFrameController.py | CompareFrameController.protocols | def protocols(self):
"""
:rtype: dict[int, list of ProtocolAnalyzer]
"""
if self.__protocols is None:
self.__protocols = self.proto_tree_model.protocols
return self.__protocols | python | def protocols(self):
"""
:rtype: dict[int, list of ProtocolAnalyzer]
"""
if self.__protocols is None:
self.__protocols = self.proto_tree_model.protocols
return self.__protocols | [
"def",
"protocols",
"(",
"self",
")",
":",
"if",
"self",
".",
"__protocols",
"is",
"None",
":",
"self",
".",
"__protocols",
"=",
"self",
".",
"proto_tree_model",
".",
"protocols",
"return",
"self",
".",
"__protocols"
] | :rtype: dict[int, list of ProtocolAnalyzer] | [
":",
"rtype",
":",
"dict",
"[",
"int",
"list",
"of",
"ProtocolAnalyzer",
"]"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/CompareFrameController.py#L201-L207 | train | returns a list of ProtocolAnalyzer objects for the current node | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/controller/CompareFrameController.py | CompareFrameController.protocol_list | def protocol_list(self):
"""
:return: visible protocols
:rtype: list of ProtocolAnalyzer
"""
result = []
for group in self.groups:
result.extend(group.protocols)
return result | python | def protocol_list(self):
"""
:return: visible protocols
:rtype: list of ProtocolAnalyzer
"""
result = []
for group in self.groups:
result.extend(group.protocols)
return result | [
"def",
"protocol_list",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"for",
"group",
"in",
"self",
".",
"groups",
":",
"result",
".",
"extend",
"(",
"group",
".",
"protocols",
")",
"return",
"result"
] | :return: visible protocols
:rtype: list of ProtocolAnalyzer | [
":",
"return",
":",
"visible",
"protocols",
":",
"rtype",
":",
"list",
"of",
"ProtocolAnalyzer"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/CompareFrameController.py#L210-L218 | train | Returns a list of visible protocols in this hierarchy. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/controller/CompareFrameController.py | CompareFrameController.full_protocol_list | def full_protocol_list(self):
"""
:return: all protocols including not shown ones
:rtype: list of ProtocolAnalyzer
"""
result = []
for group in self.groups:
result.extend(group.all_protocols)
return result | python | def full_protocol_list(self):
"""
:return: all protocols including not shown ones
:rtype: list of ProtocolAnalyzer
"""
result = []
for group in self.groups:
result.extend(group.all_protocols)
return result | [
"def",
"full_protocol_list",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"for",
"group",
"in",
"self",
".",
"groups",
":",
"result",
".",
"extend",
"(",
"group",
".",
"all_protocols",
")",
"return",
"result"
] | :return: all protocols including not shown ones
:rtype: list of ProtocolAnalyzer | [
":",
"return",
":",
"all",
"protocols",
"including",
"not",
"shown",
"ones",
":",
"rtype",
":",
"list",
"of",
"ProtocolAnalyzer"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/CompareFrameController.py#L221-L229 | train | returns a list of all protocols including not shown ones | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/controller/CompareFrameController.py | CompareFrameController.refresh_existing_encodings | def refresh_existing_encodings(self):
"""
Refresh existing encodings for messages, when encoding was changed by user in dialog
:return:
"""
update = False
for msg in self.proto_analyzer.messages:
i = next((i for i, d in enumerate(self.decodings) if d.name ==... | python | def refresh_existing_encodings(self):
"""
Refresh existing encodings for messages, when encoding was changed by user in dialog
:return:
"""
update = False
for msg in self.proto_analyzer.messages:
i = next((i for i, d in enumerate(self.decodings) if d.name ==... | [
"def",
"refresh_existing_encodings",
"(",
"self",
")",
":",
"update",
"=",
"False",
"for",
"msg",
"in",
"self",
".",
"proto_analyzer",
".",
"messages",
":",
"i",
"=",
"next",
"(",
"(",
"i",
"for",
"i",
",",
"d",
"in",
"enumerate",
"(",
"self",
".",
"... | Refresh existing encodings for messages, when encoding was changed by user in dialog
:return: | [
"Refresh",
"existing",
"encodings",
"for",
"messages",
"when",
"encoding",
"was",
"changed",
"by",
"user",
"in",
"dialog"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/CompareFrameController.py#L383-L401 | train | Refresh existing encodings for messages when encoding was changed by user in dialog. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/controller/CompareFrameController.py | CompareFrameController.set_show_only_status | def set_show_only_status(self):
"""
Handles the different combinations of the show only checkboxes, namely:
- Show only labels
- Show only Diffs
"""
if self.ui.chkBoxShowOnlyDiffs.isChecked() and not self.ui.cbShowDiffs.isChecked():
self.ui.cbShowDiffs.setCh... | python | def set_show_only_status(self):
"""
Handles the different combinations of the show only checkboxes, namely:
- Show only labels
- Show only Diffs
"""
if self.ui.chkBoxShowOnlyDiffs.isChecked() and not self.ui.cbShowDiffs.isChecked():
self.ui.cbShowDiffs.setCh... | [
"def",
"set_show_only_status",
"(",
"self",
")",
":",
"if",
"self",
".",
"ui",
".",
"chkBoxShowOnlyDiffs",
".",
"isChecked",
"(",
")",
"and",
"not",
"self",
".",
"ui",
".",
"cbShowDiffs",
".",
"isChecked",
"(",
")",
":",
"self",
".",
"ui",
".",
"cbShow... | Handles the different combinations of the show only checkboxes, namely:
- Show only labels
- Show only Diffs | [
"Handles",
"the",
"different",
"combinations",
"of",
"the",
"show",
"only",
"checkboxes",
"namely",
":",
"-",
"Show",
"only",
"labels",
"-",
"Show",
"only",
"Diffs"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/CompareFrameController.py#L862-L881 | train | Sets the show only status of the current locale. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/awre/components/Component.py | Component.find_field | def find_field(self, messages):
"""
Wrapper method selecting the backend to assign the protocol field.
Various strategies are possible e.g.:
1) Heuristics e.g. for Preamble
2) Scoring based e.g. for Length
3) Fulltext search for addresses based on participant subgroups
... | python | def find_field(self, messages):
"""
Wrapper method selecting the backend to assign the protocol field.
Various strategies are possible e.g.:
1) Heuristics e.g. for Preamble
2) Scoring based e.g. for Length
3) Fulltext search for addresses based on participant subgroups
... | [
"def",
"find_field",
"(",
"self",
",",
"messages",
")",
":",
"try",
":",
"if",
"self",
".",
"backend",
"==",
"self",
".",
"Backend",
".",
"python",
":",
"self",
".",
"_py_find_field",
"(",
"messages",
")",
"elif",
"self",
".",
"backend",
"==",
"self",
... | Wrapper method selecting the backend to assign the protocol field.
Various strategies are possible e.g.:
1) Heuristics e.g. for Preamble
2) Scoring based e.g. for Length
3) Fulltext search for addresses based on participant subgroups
:param messages: messages a field shall be se... | [
"Wrapper",
"method",
"selecting",
"the",
"backend",
"to",
"assign",
"the",
"protocol",
"field",
".",
"Various",
"strategies",
"are",
"possible",
"e",
".",
"g",
".",
":",
"1",
")",
"Heuristics",
"e",
".",
"g",
".",
"for",
"Preamble",
"2",
")",
"Scoring",
... | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/awre/components/Component.py#L45-L66 | train | Wrapper method selecting the backend to assign the protocol field to the given messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/awre/components/Component.py | Component.assign_messagetypes | def assign_messagetypes(self, messages, clusters):
"""
Assign message types based on the clusters. Following rules:
1) Messages from different clusters will get different message types
2) Messages from same clusters will get same message type
3) The new message type will copy ove... | python | def assign_messagetypes(self, messages, clusters):
"""
Assign message types based on the clusters. Following rules:
1) Messages from different clusters will get different message types
2) Messages from same clusters will get same message type
3) The new message type will copy ove... | [
"def",
"assign_messagetypes",
"(",
"self",
",",
"messages",
",",
"clusters",
")",
":",
"for",
"clustername",
",",
"clustercontent",
"in",
"clusters",
".",
"items",
"(",
")",
":",
"if",
"clustername",
"==",
"\"default\"",
":",
"# Do not force the default message ty... | Assign message types based on the clusters. Following rules:
1) Messages from different clusters will get different message types
2) Messages from same clusters will get same message type
3) The new message type will copy over the existing labels
4) No new message type will be set for me... | [
"Assign",
"message",
"types",
"based",
"on",
"the",
"clusters",
".",
"Following",
"rules",
":",
"1",
")",
"Messages",
"from",
"different",
"clusters",
"will",
"get",
"different",
"message",
"types",
"2",
")",
"Messages",
"from",
"same",
"clusters",
"will",
"... | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/awre/components/Component.py#L78-L111 | train | Assign message types based on the clusters. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/signalprocessing/Spectrogram.py | Spectrogram.stft | def stft(self, samples: np.ndarray):
"""
Perform Short-time Fourier transform to get the spectrogram for the given samples
:return: short-time Fourier transform of the given signal
"""
window = self.window_function(self.window_size)
hop_size = self.hop_size
if le... | python | def stft(self, samples: np.ndarray):
"""
Perform Short-time Fourier transform to get the spectrogram for the given samples
:return: short-time Fourier transform of the given signal
"""
window = self.window_function(self.window_size)
hop_size = self.hop_size
if le... | [
"def",
"stft",
"(",
"self",
",",
"samples",
":",
"np",
".",
"ndarray",
")",
":",
"window",
"=",
"self",
".",
"window_function",
"(",
"self",
".",
"window_size",
")",
"hop_size",
"=",
"self",
".",
"hop_size",
"if",
"len",
"(",
"samples",
")",
"<",
"se... | Perform Short-time Fourier transform to get the spectrogram for the given samples
:return: short-time Fourier transform of the given signal | [
"Perform",
"Short",
"-",
"time",
"Fourier",
"transform",
"to",
"get",
"the",
"spectrogram",
"for",
"the",
"given",
"samples",
":",
"return",
":",
"short",
"-",
"time",
"Fourier",
"transform",
"of",
"the",
"given",
"signal"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/Spectrogram.py#L78-L98 | train | Perform the short - time Fourier transform to get the spectrogram for the given samples
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/signalprocessing/Spectrogram.py | Spectrogram.export_to_fta | def export_to_fta(self, sample_rate, filename: str, include_amplitude=False):
"""
Export to Frequency, Time, Amplitude file.
Frequency is double, Time (nanosecond) is uint32, Amplitude is float32
:return:
"""
spectrogram = self.__calculate_spectrogram(self.samples)
... | python | def export_to_fta(self, sample_rate, filename: str, include_amplitude=False):
"""
Export to Frequency, Time, Amplitude file.
Frequency is double, Time (nanosecond) is uint32, Amplitude is float32
:return:
"""
spectrogram = self.__calculate_spectrogram(self.samples)
... | [
"def",
"export_to_fta",
"(",
"self",
",",
"sample_rate",
",",
"filename",
":",
"str",
",",
"include_amplitude",
"=",
"False",
")",
":",
"spectrogram",
"=",
"self",
".",
"__calculate_spectrogram",
"(",
"self",
".",
"samples",
")",
"spectrogram",
"=",
"np",
".... | Export to Frequency, Time, Amplitude file.
Frequency is double, Time (nanosecond) is uint32, Amplitude is float32
:return: | [
"Export",
"to",
"Frequency",
"Time",
"Amplitude",
"file",
".",
"Frequency",
"is",
"double",
"Time",
"(",
"nanosecond",
")",
"is",
"uint32",
"Amplitude",
"is",
"float32"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/Spectrogram.py#L100-L126 | train | Export to Fourier Transform | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/signalprocessing/Spectrogram.py | Spectrogram.create_image | def create_image(data: np.ndarray, colormap, data_min=None, data_max=None, normalize=True) -> QImage:
"""
Create QImage from ARGB array.
The ARGB must have shape (width, height, 4) and dtype=ubyte.
NOTE: The order of values in the 3rd axis must be (blue, green, red, alpha).
:retu... | python | def create_image(data: np.ndarray, colormap, data_min=None, data_max=None, normalize=True) -> QImage:
"""
Create QImage from ARGB array.
The ARGB must have shape (width, height, 4) and dtype=ubyte.
NOTE: The order of values in the 3rd axis must be (blue, green, red, alpha).
:retu... | [
"def",
"create_image",
"(",
"data",
":",
"np",
".",
"ndarray",
",",
"colormap",
",",
"data_min",
"=",
"None",
",",
"data_max",
"=",
"None",
",",
"normalize",
"=",
"True",
")",
"->",
"QImage",
":",
"image_data",
"=",
"Spectrogram",
".",
"apply_bgra_lookup",... | Create QImage from ARGB array.
The ARGB must have shape (width, height, 4) and dtype=ubyte.
NOTE: The order of values in the 3rd axis must be (blue, green, red, alpha).
:return: | [
"Create",
"QImage",
"from",
"ARGB",
"array",
".",
"The",
"ARGB",
"must",
"have",
"shape",
"(",
"width",
"height",
"4",
")",
"and",
"dtype",
"=",
"ubyte",
".",
"NOTE",
":",
"The",
"order",
"of",
"values",
"in",
"the",
"3rd",
"axis",
"must",
"be",
"(",... | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/Spectrogram.py#L164-L185 | train | Create QImage from ARGB array. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/signalprocessing/Signal.py | Signal.modulation_type | def modulation_type(self, value: int):
"""
0 - "ASK", 1 - "FSK", 2 - "PSK", 3 - "APSK (QAM)"
:param value:
:return:
"""
if self.__modulation_type != value:
self.__modulation_type = value
self._qad = None
self.modulation_type_changed.e... | python | def modulation_type(self, value: int):
"""
0 - "ASK", 1 - "FSK", 2 - "PSK", 3 - "APSK (QAM)"
:param value:
:return:
"""
if self.__modulation_type != value:
self.__modulation_type = value
self._qad = None
self.modulation_type_changed.e... | [
"def",
"modulation_type",
"(",
"self",
",",
"value",
":",
"int",
")",
":",
"if",
"self",
".",
"__modulation_type",
"!=",
"value",
":",
"self",
".",
"__modulation_type",
"=",
"value",
"self",
".",
"_qad",
"=",
"None",
"self",
".",
"modulation_type_changed",
... | 0 - "ASK", 1 - "FSK", 2 - "PSK", 3 - "APSK (QAM)"
:param value:
:return: | [
"0",
"-",
"ASK",
"1",
"-",
"FSK",
"2",
"-",
"PSK",
"3",
"-",
"APSK",
"(",
"QAM",
")"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/Signal.py#L171-L184 | train | Sets the modulation type of the modulation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/signalprocessing/Signal.py | Signal.estimate_frequency | def estimate_frequency(self, start: int, end: int, sample_rate: float):
"""
Estimate the frequency of the baseband signal using FFT
:param start: Start of the area that shall be investigated
:param end: End of the area that shall be investigated
:param sample_rate: Sample rate o... | python | def estimate_frequency(self, start: int, end: int, sample_rate: float):
"""
Estimate the frequency of the baseband signal using FFT
:param start: Start of the area that shall be investigated
:param end: End of the area that shall be investigated
:param sample_rate: Sample rate o... | [
"def",
"estimate_frequency",
"(",
"self",
",",
"start",
":",
"int",
",",
"end",
":",
"int",
",",
"sample_rate",
":",
"float",
")",
":",
"# ensure power of 2 for faster fft",
"length",
"=",
"2",
"**",
"int",
"(",
"math",
".",
"log2",
"(",
"end",
"-",
"sta... | Estimate the frequency of the baseband signal using FFT
:param start: Start of the area that shall be investigated
:param end: End of the area that shall be investigated
:param sample_rate: Sample rate of the signal
:return: | [
"Estimate",
"the",
"frequency",
"of",
"the",
"baseband",
"signal",
"using",
"FFT"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/Signal.py#L410-L433 | train | Estimate the frequency of the baseband signal using FFT
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/ui/views/FuzzingTableView.py | FuzzingTableView.selection_range | def selection_range(self):
"""
:rtype: int, int, int, int
"""
selected = self.selectionModel().selection()
""":type: QItemSelection """
if selected.isEmpty():
return -1, -1, -1, -1
min_row = numpy.min([rng.top() for rng in selected])
max_row ... | python | def selection_range(self):
"""
:rtype: int, int, int, int
"""
selected = self.selectionModel().selection()
""":type: QItemSelection """
if selected.isEmpty():
return -1, -1, -1, -1
min_row = numpy.min([rng.top() for rng in selected])
max_row ... | [
"def",
"selection_range",
"(",
"self",
")",
":",
"selected",
"=",
"self",
".",
"selectionModel",
"(",
")",
".",
"selection",
"(",
")",
"\"\"\":type: QItemSelection \"\"\"",
"if",
"selected",
".",
"isEmpty",
"(",
")",
":",
"return",
"-",
"1",
",",
"-",
"1",... | :rtype: int, int, int, int | [
":",
"rtype",
":",
"int",
"int",
"int",
"int"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/views/FuzzingTableView.py#L22-L37 | train | Returns the range of the selected entries in the current tree. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/main.py | fix_windows_stdout_stderr | def fix_windows_stdout_stderr():
"""
Processes can't write to stdout/stderr on frozen windows apps because they do not exist here
if process tries it anyway we get a nasty dialog window popping up, so we redirect the streams to a dummy
see https://github.com/jopohl/urh/issues/370
"""
if hasattr... | python | def fix_windows_stdout_stderr():
"""
Processes can't write to stdout/stderr on frozen windows apps because they do not exist here
if process tries it anyway we get a nasty dialog window popping up, so we redirect the streams to a dummy
see https://github.com/jopohl/urh/issues/370
"""
if hasattr... | [
"def",
"fix_windows_stdout_stderr",
"(",
")",
":",
"if",
"hasattr",
"(",
"sys",
",",
"\"frozen\"",
")",
"and",
"sys",
".",
"platform",
"==",
"\"win32\"",
":",
"try",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"\"\\n\"",
")",
"sys",
".",
"stdout",
".... | Processes can't write to stdout/stderr on frozen windows apps because they do not exist here
if process tries it anyway we get a nasty dialog window popping up, so we redirect the streams to a dummy
see https://github.com/jopohl/urh/issues/370 | [
"Processes",
"can",
"t",
"write",
"to",
"stdout",
"/",
"stderr",
"on",
"frozen",
"windows",
"apps",
"because",
"they",
"do",
"not",
"exist",
"here",
"if",
"process",
"tries",
"it",
"anyway",
"we",
"get",
"a",
"nasty",
"dialog",
"window",
"popping",
"up",
... | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/main.py#L23-L47 | train | Fixes stdout and stderr for frozen windows apps. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/awre/FormatFinder.py | FormatFinder.build_component_order | def build_component_order(self):
"""
Build the order of component based on their priority and predecessors
:rtype: list of Component
"""
present_components = [item for item in self.__dict__.values() if isinstance(item, Component) and item.enabled]
result = [None] * len(p... | python | def build_component_order(self):
"""
Build the order of component based on their priority and predecessors
:rtype: list of Component
"""
present_components = [item for item in self.__dict__.values() if isinstance(item, Component) and item.enabled]
result = [None] * len(p... | [
"def",
"build_component_order",
"(",
"self",
")",
":",
"present_components",
"=",
"[",
"item",
"for",
"item",
"in",
"self",
".",
"__dict__",
".",
"values",
"(",
")",
"if",
"isinstance",
"(",
"item",
",",
"Component",
")",
"and",
"item",
".",
"enabled",
"... | Build the order of component based on their priority and predecessors
:rtype: list of Component | [
"Build",
"the",
"order",
"of",
"component",
"based",
"on",
"their",
"priority",
"and",
"predecessors"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/awre/FormatFinder.py#L48-L70 | train | Build the order of components based on their priority and predecessors. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/awre/FormatFinder.py | FormatFinder.cluster_lengths | def cluster_lengths(self):
"""
This method clusters some bitvectors based on their length. An example output is
2: [0.5, 1]
4: [1, 0.75, 1, 1]
Meaning there were two message lengths: 2 and 4 bit.
(0.5, 1) means, the first bit was equal in 50% of cases (meaning maximum d... | python | def cluster_lengths(self):
"""
This method clusters some bitvectors based on their length. An example output is
2: [0.5, 1]
4: [1, 0.75, 1, 1]
Meaning there were two message lengths: 2 and 4 bit.
(0.5, 1) means, the first bit was equal in 50% of cases (meaning maximum d... | [
"def",
"cluster_lengths",
"(",
"self",
")",
":",
"number_ones",
"=",
"dict",
"(",
")",
"# dict of tuple. 0 = number ones vector, 1 = number of blocks for this vector",
"for",
"vector",
"in",
"self",
".",
"bitvectors",
":",
"vec_len",
"=",
"4",
"*",
"(",
"len",
"(",
... | This method clusters some bitvectors based on their length. An example output is
2: [0.5, 1]
4: [1, 0.75, 1, 1]
Meaning there were two message lengths: 2 and 4 bit.
(0.5, 1) means, the first bit was equal in 50% of cases (meaning maximum difference) and bit 2 was equal in all messages
... | [
"This",
"method",
"clusters",
"some",
"bitvectors",
"based",
"on",
"their",
"length",
".",
"An",
"example",
"output",
"is"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/awre/FormatFinder.py#L77-L106 | train | This method clusters some bitvectors based on their length. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/awre/components/Address.py | Address.find_candidates | def find_candidates(candidates):
"""
Find candidate addresses using LCS algorithm
perform a scoring based on how often a candidate appears in a longer candidate
Input is something like
------------------------
['1b6033', '1b6033fd57', '701b603378e289', '20701b603378e2890... | python | def find_candidates(candidates):
"""
Find candidate addresses using LCS algorithm
perform a scoring based on how often a candidate appears in a longer candidate
Input is something like
------------------------
['1b6033', '1b6033fd57', '701b603378e289', '20701b603378e2890... | [
"def",
"find_candidates",
"(",
"candidates",
")",
":",
"result",
"=",
"defaultdict",
"(",
"int",
")",
"for",
"i",
",",
"c_i",
"in",
"enumerate",
"(",
"candidates",
")",
":",
"for",
"j",
"in",
"range",
"(",
"i",
",",
"len",
"(",
"candidates",
")",
")"... | Find candidate addresses using LCS algorithm
perform a scoring based on how often a candidate appears in a longer candidate
Input is something like
------------------------
['1b6033', '1b6033fd57', '701b603378e289', '20701b603378e289000c62',
'1b603300', '78e289757e', '7078e2891b... | [
"Find",
"candidate",
"addresses",
"using",
"LCS",
"algorithm",
"perform",
"a",
"scoring",
"based",
"on",
"how",
"often",
"a",
"candidate",
"appears",
"in",
"a",
"longer",
"candidate"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/awre/components/Address.py#L190-L217 | train | Find candidate addresses using LCS algorithm. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/awre/components/Address.py | Address.choose_candidate_pair | def choose_candidate_pair(candidates):
"""
Choose a pair of address candidates ensuring they have the same length and starting with the highest scored ones
:type candidates: dict[str, int]
:param candidates: Count how often the longest common substrings appeared in the messages
... | python | def choose_candidate_pair(candidates):
"""
Choose a pair of address candidates ensuring they have the same length and starting with the highest scored ones
:type candidates: dict[str, int]
:param candidates: Count how often the longest common substrings appeared in the messages
... | [
"def",
"choose_candidate_pair",
"(",
"candidates",
")",
":",
"highscored",
"=",
"sorted",
"(",
"candidates",
",",
"key",
"=",
"candidates",
".",
"get",
",",
"reverse",
"=",
"True",
")",
"for",
"i",
",",
"h_i",
"in",
"enumerate",
"(",
"highscored",
")",
"... | Choose a pair of address candidates ensuring they have the same length and starting with the highest scored ones
:type candidates: dict[str, int]
:param candidates: Count how often the longest common substrings appeared in the messages
:return: | [
"Choose",
"a",
"pair",
"of",
"address",
"candidates",
"ensuring",
"they",
"have",
"the",
"same",
"length",
"and",
"starting",
"with",
"the",
"highest",
"scored",
"ones"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/awre/components/Address.py#L220-L232 | train | Choose a pair of address candidates ensuring they have the same length and starting with the highest scored ones. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/util/FileOperator.py | uncompress_archives | def uncompress_archives(file_names, temp_dir):
"""
Extract each archive from the list of filenames.
Normal files stay untouched.
Add all files to the Recent Files.
:type file_names: list of str
:type temp_dir: str
:rtype: list of str
"""
result = []
for filename in file_names:
... | python | def uncompress_archives(file_names, temp_dir):
"""
Extract each archive from the list of filenames.
Normal files stay untouched.
Add all files to the Recent Files.
:type file_names: list of str
:type temp_dir: str
:rtype: list of str
"""
result = []
for filename in file_names:
... | [
"def",
"uncompress_archives",
"(",
"file_names",
",",
"temp_dir",
")",
":",
"result",
"=",
"[",
"]",
"for",
"filename",
"in",
"file_names",
":",
"if",
"filename",
".",
"endswith",
"(",
"\".tar\"",
")",
"or",
"filename",
".",
"endswith",
"(",
"\".tar.gz\"",
... | Extract each archive from the list of filenames.
Normal files stay untouched.
Add all files to the Recent Files.
:type file_names: list of str
:type temp_dir: str
:rtype: list of str | [
"Extract",
"each",
"archive",
"from",
"the",
"list",
"of",
"filenames",
".",
"Normal",
"files",
"stay",
"untouched",
".",
"Add",
"all",
"files",
"to",
"the",
"Recent",
"Files",
".",
":",
"type",
"file_names",
":",
"list",
"of",
"str",
":",
"type",
"temp_... | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/util/FileOperator.py#L63-L95 | train | Extract each archive from the list of filenames. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/util/ProjectManager.py | ProjectManager.write_modulators_to_project_file | def write_modulators_to_project_file(self, tree=None):
"""
:type modulators: list of Modulator
:return:
"""
if self.project_file is None or not self.modulators:
return
if tree is None:
tree = ET.parse(self.project_file)
root = tree.getroo... | python | def write_modulators_to_project_file(self, tree=None):
"""
:type modulators: list of Modulator
:return:
"""
if self.project_file is None or not self.modulators:
return
if tree is None:
tree = ET.parse(self.project_file)
root = tree.getroo... | [
"def",
"write_modulators_to_project_file",
"(",
"self",
",",
"tree",
"=",
"None",
")",
":",
"if",
"self",
".",
"project_file",
"is",
"None",
"or",
"not",
"self",
".",
"modulators",
":",
"return",
"if",
"tree",
"is",
"None",
":",
"tree",
"=",
"ET",
".",
... | :type modulators: list of Modulator
:return: | [
":",
"type",
"modulators",
":",
"list",
"of",
"Modulator",
":",
"return",
":"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/util/ProjectManager.py#L331-L345 | train | Writes modulators to the project file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/ainterpretation/Wavelet.py | cwt_haar | def cwt_haar(x: np.ndarray, scale=10):
"""
continuous haar wavelet transform based on the paper
"A practical guide to wavelet analysis" by Christopher Torrence and Gilbert P Compo
"""
next_power_two = 2 ** int(np.log2(len(x)))
x = x[0:next_power_two]
num_data = len(x)
# get FFT of x (... | python | def cwt_haar(x: np.ndarray, scale=10):
"""
continuous haar wavelet transform based on the paper
"A practical guide to wavelet analysis" by Christopher Torrence and Gilbert P Compo
"""
next_power_two = 2 ** int(np.log2(len(x)))
x = x[0:next_power_two]
num_data = len(x)
# get FFT of x (... | [
"def",
"cwt_haar",
"(",
"x",
":",
"np",
".",
"ndarray",
",",
"scale",
"=",
"10",
")",
":",
"next_power_two",
"=",
"2",
"**",
"int",
"(",
"np",
".",
"log2",
"(",
"len",
"(",
"x",
")",
")",
")",
"x",
"=",
"x",
"[",
"0",
":",
"next_power_two",
"... | continuous haar wavelet transform based on the paper
"A practical guide to wavelet analysis" by Christopher Torrence and Gilbert P Compo | [
"continuous",
"haar",
"wavelet",
"transform",
"based",
"on",
"the",
"paper",
"A",
"practical",
"guide",
"to",
"wavelet",
"analysis",
"by",
"Christopher",
"Torrence",
"and",
"Gilbert",
"P",
"Compo"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ainterpretation/Wavelet.py#L15-L39 | train | continuous haar wavelet transform based on the paper
continuous haar wavelet analysis by Christopher Torrence and Gilbert P Compo | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/awre/components/Preamble.py | Preamble.__find_sync_range | def __find_sync_range(self, messages, preamble_end: int, search_end: int):
"""
Finding the synchronization works by finding the first difference between two messages.
This is performed for all messages and the most frequent first difference is chosen
:type messages: list of Message
... | python | def __find_sync_range(self, messages, preamble_end: int, search_end: int):
"""
Finding the synchronization works by finding the first difference between two messages.
This is performed for all messages and the most frequent first difference is chosen
:type messages: list of Message
... | [
"def",
"__find_sync_range",
"(",
"self",
",",
"messages",
",",
"preamble_end",
":",
"int",
",",
"search_end",
":",
"int",
")",
":",
"possible_sync_pos",
"=",
"defaultdict",
"(",
"int",
")",
"for",
"i",
",",
"msg",
"in",
"enumerate",
"(",
"messages",
")",
... | Finding the synchronization works by finding the first difference between two messages.
This is performed for all messages and the most frequent first difference is chosen
:type messages: list of Message
:param preamble_end: End of preamble = start of search
:param search_end: End of se... | [
"Finding",
"the",
"synchronization",
"works",
"by",
"finding",
"the",
"first",
"difference",
"between",
"two",
"messages",
".",
"This",
"is",
"performed",
"for",
"all",
"messages",
"and",
"the",
"most",
"frequent",
"first",
"difference",
"is",
"chosen"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/awre/components/Preamble.py#L95-L121 | train | Find the synchronization interval between two messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/models/TableModel.py | TableModel.__pad_until_index | def __pad_until_index(self, row: int, bit_pos: int):
"""
Pad message in given row with zeros until given column so user can enter values behind end of message
:return:
"""
try:
new_bits = array.array("B", [0] * max(0, bit_pos - len(self.protocol.messages[row])))
... | python | def __pad_until_index(self, row: int, bit_pos: int):
"""
Pad message in given row with zeros until given column so user can enter values behind end of message
:return:
"""
try:
new_bits = array.array("B", [0] * max(0, bit_pos - len(self.protocol.messages[row])))
... | [
"def",
"__pad_until_index",
"(",
"self",
",",
"row",
":",
"int",
",",
"bit_pos",
":",
"int",
")",
":",
"try",
":",
"new_bits",
"=",
"array",
".",
"array",
"(",
"\"B\"",
",",
"[",
"0",
"]",
"*",
"max",
"(",
"0",
",",
"bit_pos",
"-",
"len",
"(",
... | Pad message in given row with zeros until given column so user can enter values behind end of message
:return: | [
"Pad",
"message",
"in",
"given",
"row",
"with",
"zeros",
"until",
"given",
"column",
"so",
"user",
"can",
"enter",
"values",
"behind",
"end",
"of",
"message",
":",
"return",
":"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/models/TableModel.py#L84-L101 | train | Pads message in given row with zeros until given column so user can enter values behind end of message
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/models/TableModel.py | TableModel.find_differences | def find_differences(self, refindex: int):
"""
Search all differences between protocol messages regarding a reference message
:param refindex: index of reference message
:rtype: dict[int, set[int]]
"""
differences = defaultdict(set)
if refindex >= len(self.proto... | python | def find_differences(self, refindex: int):
"""
Search all differences between protocol messages regarding a reference message
:param refindex: index of reference message
:rtype: dict[int, set[int]]
"""
differences = defaultdict(set)
if refindex >= len(self.proto... | [
"def",
"find_differences",
"(",
"self",
",",
"refindex",
":",
"int",
")",
":",
"differences",
"=",
"defaultdict",
"(",
"set",
")",
"if",
"refindex",
">=",
"len",
"(",
"self",
".",
"protocol",
".",
"messages",
")",
":",
"return",
"differences",
"if",
"sel... | Search all differences between protocol messages regarding a reference message
:param refindex: index of reference message
:rtype: dict[int, set[int]] | [
"Search",
"all",
"differences",
"between",
"protocol",
"messages",
"regarding",
"a",
"reference",
"message"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/models/TableModel.py#L337-L373 | train | Search all differences between protocol messages regarding a reference message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/signalprocessing/ProtocolSniffer.py | ProtocolSniffer.__demodulate_data | def __demodulate_data(self, data):
"""
Demodulates received IQ data and adds demodulated bits to messages
:param data:
:return:
"""
if len(data) == 0:
return
power_spectrum = data.real ** 2 + data.imag ** 2
is_above_noise = np.sqrt(np.mean(pow... | python | def __demodulate_data(self, data):
"""
Demodulates received IQ data and adds demodulated bits to messages
:param data:
:return:
"""
if len(data) == 0:
return
power_spectrum = data.real ** 2 + data.imag ** 2
is_above_noise = np.sqrt(np.mean(pow... | [
"def",
"__demodulate_data",
"(",
"self",
",",
"data",
")",
":",
"if",
"len",
"(",
"data",
")",
"==",
"0",
":",
"return",
"power_spectrum",
"=",
"data",
".",
"real",
"**",
"2",
"+",
"data",
".",
"imag",
"**",
"2",
"is_above_noise",
"=",
"np",
".",
"... | Demodulates received IQ data and adds demodulated bits to messages
:param data:
:return: | [
"Demodulates",
"received",
"IQ",
"data",
"and",
"adds",
"demodulated",
"bits",
"to",
"messages",
":",
"param",
"data",
":",
":",
"return",
":"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/ProtocolSniffer.py#L155-L203 | train | Demodulates received IQ data and adds demodulated bits to messages
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/ui/painting/SceneManager.py | SceneManager.create_rectangle | def create_rectangle(proto_bits, pulse_len=100):
"""
:type proto_bits: list of str
"""
ones = np.ones(pulse_len, dtype=np.float32) * 1
zeros = np.ones(pulse_len, dtype=np.float32) * -1
n = 0
y = []
for msg in proto_bits:
for bit in msg:
... | python | def create_rectangle(proto_bits, pulse_len=100):
"""
:type proto_bits: list of str
"""
ones = np.ones(pulse_len, dtype=np.float32) * 1
zeros = np.ones(pulse_len, dtype=np.float32) * -1
n = 0
y = []
for msg in proto_bits:
for bit in msg:
... | [
"def",
"create_rectangle",
"(",
"proto_bits",
",",
"pulse_len",
"=",
"100",
")",
":",
"ones",
"=",
"np",
".",
"ones",
"(",
"pulse_len",
",",
"dtype",
"=",
"np",
".",
"float32",
")",
"*",
"1",
"zeros",
"=",
"np",
".",
"ones",
"(",
"pulse_len",
",",
... | :type proto_bits: list of str | [
":",
"type",
"proto_bits",
":",
"list",
"of",
"str"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/painting/SceneManager.py#L107-L133 | train | Create a rectangle that contains the contents of the given list of message types. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/ui/painting/SpectrogramSceneManager.py | SpectrogramSceneManager.set_parameters | def set_parameters(self, samples: np.ndarray, window_size, data_min, data_max) -> bool:
"""
Return true if redraw is needed
"""
redraw_needed = False
if self.samples_need_update:
self.spectrogram.samples = samples
redraw_needed = True
self.samp... | python | def set_parameters(self, samples: np.ndarray, window_size, data_min, data_max) -> bool:
"""
Return true if redraw is needed
"""
redraw_needed = False
if self.samples_need_update:
self.spectrogram.samples = samples
redraw_needed = True
self.samp... | [
"def",
"set_parameters",
"(",
"self",
",",
"samples",
":",
"np",
".",
"ndarray",
",",
"window_size",
",",
"data_min",
",",
"data_max",
")",
"->",
"bool",
":",
"redraw_needed",
"=",
"False",
"if",
"self",
".",
"samples_need_update",
":",
"self",
".",
"spect... | Return true if redraw is needed | [
"Return",
"true",
"if",
"redraw",
"is",
"needed"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/painting/SpectrogramSceneManager.py#L24-L46 | train | Set the parameters of the current spectrogram. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/plugins/MessageBreak/MessageBreakPlugin.py | MessageBreakPlugin.get_action | def get_action(self, parent, undo_stack: QUndoStack, sel_range, protocol: ProtocolAnalyzer, view: int):
"""
:type parent: QTableView
:type undo_stack: QUndoStack
:type protocol_analyzers: list of ProtocolAnalyzer
"""
min_row, max_row, start, end = sel_range
if min... | python | def get_action(self, parent, undo_stack: QUndoStack, sel_range, protocol: ProtocolAnalyzer, view: int):
"""
:type parent: QTableView
:type undo_stack: QUndoStack
:type protocol_analyzers: list of ProtocolAnalyzer
"""
min_row, max_row, start, end = sel_range
if min... | [
"def",
"get_action",
"(",
"self",
",",
"parent",
",",
"undo_stack",
":",
"QUndoStack",
",",
"sel_range",
",",
"protocol",
":",
"ProtocolAnalyzer",
",",
"view",
":",
"int",
")",
":",
"min_row",
",",
"max_row",
",",
"start",
",",
"end",
"=",
"sel_range",
"... | :type parent: QTableView
:type undo_stack: QUndoStack
:type protocol_analyzers: list of ProtocolAnalyzer | [
":",
"type",
"parent",
":",
"QTableView",
":",
"type",
"undo_stack",
":",
"QUndoStack",
":",
"type",
"protocol_analyzers",
":",
"list",
"of",
"ProtocolAnalyzer"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/plugins/MessageBreak/MessageBreakPlugin.py#L16-L36 | train | Get the next action from the selection. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/signalprocessing/Message.py | Message.get_byte_length | def get_byte_length(self, decoded=True) -> int:
"""
Return the length of this message in byte.
"""
end = len(self.decoded_bits) if decoded else len(self.__plain_bits)
end = self.convert_index(end, 0, 2, decoded=decoded)[0]
return int(end) | python | def get_byte_length(self, decoded=True) -> int:
"""
Return the length of this message in byte.
"""
end = len(self.decoded_bits) if decoded else len(self.__plain_bits)
end = self.convert_index(end, 0, 2, decoded=decoded)[0]
return int(end) | [
"def",
"get_byte_length",
"(",
"self",
",",
"decoded",
"=",
"True",
")",
"->",
"int",
":",
"end",
"=",
"len",
"(",
"self",
".",
"decoded_bits",
")",
"if",
"decoded",
"else",
"len",
"(",
"self",
".",
"__plain_bits",
")",
"end",
"=",
"self",
".",
"conv... | Return the length of this message in byte. | [
"Return",
"the",
"length",
"of",
"this",
"message",
"in",
"byte",
"."
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/Message.py#L155-L162 | train | Return the length of this message in byte. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/signalprocessing/Message.py | Message.get_src_address_from_data | def get_src_address_from_data(self, decoded=True):
"""
Return the SRC address of a message if SRC_ADDRESS label is present in message type of the message
Return None otherwise
:param decoded:
:return:
"""
src_address_label = next((lbl for lbl in self.message_type... | python | def get_src_address_from_data(self, decoded=True):
"""
Return the SRC address of a message if SRC_ADDRESS label is present in message type of the message
Return None otherwise
:param decoded:
:return:
"""
src_address_label = next((lbl for lbl in self.message_type... | [
"def",
"get_src_address_from_data",
"(",
"self",
",",
"decoded",
"=",
"True",
")",
":",
"src_address_label",
"=",
"next",
"(",
"(",
"lbl",
"for",
"lbl",
"in",
"self",
".",
"message_type",
"if",
"lbl",
".",
"field_type",
"and",
"lbl",
".",
"field_type",
"."... | Return the SRC address of a message if SRC_ADDRESS label is present in message type of the message
Return None otherwise
:param decoded:
:return: | [
"Return",
"the",
"SRC",
"address",
"of",
"a",
"message",
"if",
"SRC_ADDRESS",
"label",
"is",
"present",
"in",
"message",
"type",
"of",
"the",
"message",
"Return",
"None",
"otherwise"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/Message.py#L360-L379 | train | Get the SRC address of a message from the data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/signalprocessing/Message.py | Message.split | def split(self, decode=True):
"""
Für das Bit-Alignment (neu Ausrichten von Hex, ASCII-View)
:rtype: list of array.array
"""
start = 0
result = []
message = self.decoded_bits if decode else self.plain_bits
bit_alignments = set()
if self.align_labe... | python | def split(self, decode=True):
"""
Für das Bit-Alignment (neu Ausrichten von Hex, ASCII-View)
:rtype: list of array.array
"""
start = 0
result = []
message = self.decoded_bits if decode else self.plain_bits
bit_alignments = set()
if self.align_labe... | [
"def",
"split",
"(",
"self",
",",
"decode",
"=",
"True",
")",
":",
"start",
"=",
"0",
"result",
"=",
"[",
"]",
"message",
"=",
"self",
".",
"decoded_bits",
"if",
"decode",
"else",
"self",
".",
"plain_bits",
"bit_alignments",
"=",
"set",
"(",
")",
"if... | Für das Bit-Alignment (neu Ausrichten von Hex, ASCII-View)
:rtype: list of array.array | [
"Für",
"das",
"Bit",
"-",
"Alignment",
"(",
"neu",
"Ausrichten",
"von",
"Hex",
"ASCII",
"-",
"View",
")"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/Message.py#L409-L431 | train | Returns a list of the bit - alignment entries in the message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/controller/dialogs/DecoderDialog.py | DecoderDialog.set_e | def set_e(self):
if self.ui.combobox_decodings.count() < 1: # Empty list
return
self.e = copy.deepcopy(self.decodings[self.ui.combobox_decodings.currentIndex()])
""":type: encoding """
chain = self.e.get_chain()
self.ui.decoderchain.clear()
self.chainoptions... | python | def set_e(self):
if self.ui.combobox_decodings.count() < 1: # Empty list
return
self.e = copy.deepcopy(self.decodings[self.ui.combobox_decodings.currentIndex()])
""":type: encoding """
chain = self.e.get_chain()
self.ui.decoderchain.clear()
self.chainoptions... | [
"def",
"set_e",
"(",
"self",
")",
":",
"if",
"self",
".",
"ui",
".",
"combobox_decodings",
".",
"count",
"(",
")",
"<",
"1",
":",
"# Empty list",
"return",
"self",
".",
"e",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
".",
"decodings",
"[",
"self",
... | :type: encoding | [
":",
"type",
":",
"encoding"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/dialogs/DecoderDialog.py#L202-L230 | train | Sets the current language of the current language in the decoder chain. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/models/ProtocolTreeModel.py | ProtocolTreeModel.protocols | def protocols(self):
"""
:rtype: dict[int, list of ProtocolAnalyzer]
"""
result = {}
for i, group in enumerate(self.rootItem.children):
result[i] = [child.protocol for child in group.children]
return result | python | def protocols(self):
"""
:rtype: dict[int, list of ProtocolAnalyzer]
"""
result = {}
for i, group in enumerate(self.rootItem.children):
result[i] = [child.protocol for child in group.children]
return result | [
"def",
"protocols",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"i",
",",
"group",
"in",
"enumerate",
"(",
"self",
".",
"rootItem",
".",
"children",
")",
":",
"result",
"[",
"i",
"]",
"=",
"[",
"child",
".",
"protocol",
"for",
"child",
... | :rtype: dict[int, list of ProtocolAnalyzer] | [
":",
"rtype",
":",
"dict",
"[",
"int",
"list",
"of",
"ProtocolAnalyzer",
"]"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/models/ProtocolTreeModel.py#L25-L33 | train | returns a dictionary of all the protocols in the hierarchy | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/models/ProtocolTreeModel.py | ProtocolTreeModel.protocol_tree_items | def protocol_tree_items(self):
"""
:rtype: dict[int, list of ProtocolTreeItem]
"""
result = {}
for i, group in enumerate(self.rootItem.children):
result[i] = [child for child in group.children]
return result | python | def protocol_tree_items(self):
"""
:rtype: dict[int, list of ProtocolTreeItem]
"""
result = {}
for i, group in enumerate(self.rootItem.children):
result[i] = [child for child in group.children]
return result | [
"def",
"protocol_tree_items",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"i",
",",
"group",
"in",
"enumerate",
"(",
"self",
".",
"rootItem",
".",
"children",
")",
":",
"result",
"[",
"i",
"]",
"=",
"[",
"child",
"for",
"child",
"in",
"g... | :rtype: dict[int, list of ProtocolTreeItem] | [
":",
"rtype",
":",
"dict",
"[",
"int",
"list",
"of",
"ProtocolTreeItem",
"]"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/models/ProtocolTreeModel.py#L48-L56 | train | Returns a dictionary of all the protocol tree items in the tree. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/models/ProtocolTreeModel.py | ProtocolTreeModel.move_to_group | def move_to_group(self, items, new_group_id: int):
"""
:type items: list of ProtocolTreeItem
"""
group = self.rootItem.child(new_group_id)
for item in items:
group.appendChild(item)
self.controller.refresh() | python | def move_to_group(self, items, new_group_id: int):
"""
:type items: list of ProtocolTreeItem
"""
group = self.rootItem.child(new_group_id)
for item in items:
group.appendChild(item)
self.controller.refresh() | [
"def",
"move_to_group",
"(",
"self",
",",
"items",
",",
"new_group_id",
":",
"int",
")",
":",
"group",
"=",
"self",
".",
"rootItem",
".",
"child",
"(",
"new_group_id",
")",
"for",
"item",
"in",
"items",
":",
"group",
".",
"appendChild",
"(",
"item",
")... | :type items: list of ProtocolTreeItem | [
":",
"type",
"items",
":",
"list",
"of",
"ProtocolTreeItem"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/models/ProtocolTreeModel.py#L326-L333 | train | Moves the items to a new group. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/models/ProtocolTreeModel.py | ProtocolTreeModel.set_copy_mode | def set_copy_mode(self, use_copy: bool):
"""
Set all protocols in copy mode. They will return a copy of their protocol.
This is used for writable mode in CFC.
:param use_copy:
:return:
"""
for group in self.rootItem.children:
for proto in group.childr... | python | def set_copy_mode(self, use_copy: bool):
"""
Set all protocols in copy mode. They will return a copy of their protocol.
This is used for writable mode in CFC.
:param use_copy:
:return:
"""
for group in self.rootItem.children:
for proto in group.childr... | [
"def",
"set_copy_mode",
"(",
"self",
",",
"use_copy",
":",
"bool",
")",
":",
"for",
"group",
"in",
"self",
".",
"rootItem",
".",
"children",
":",
"for",
"proto",
"in",
"group",
".",
"children",
":",
"proto",
".",
"copy_data",
"=",
"use_copy"
] | Set all protocols in copy mode. They will return a copy of their protocol.
This is used for writable mode in CFC.
:param use_copy:
:return: | [
"Set",
"all",
"protocols",
"in",
"copy",
"mode",
".",
"They",
"will",
"return",
"a",
"copy",
"of",
"their",
"protocol",
".",
"This",
"is",
"used",
"for",
"writable",
"mode",
"in",
"CFC",
"."
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/models/ProtocolTreeModel.py#L341-L351 | train | Set all protocols in copy mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/util/RingBuffer.py | RingBuffer.view_data | def view_data(self):
"""
Get a representation of the ring buffer for plotting. This is expensive, so it should only be used in frontend
:return:
"""
left, right = self.left_index, self.left_index + len(self)
if left > right:
left, right = right, left
... | python | def view_data(self):
"""
Get a representation of the ring buffer for plotting. This is expensive, so it should only be used in frontend
:return:
"""
left, right = self.left_index, self.left_index + len(self)
if left > right:
left, right = right, left
... | [
"def",
"view_data",
"(",
"self",
")",
":",
"left",
",",
"right",
"=",
"self",
".",
"left_index",
",",
"self",
".",
"left_index",
"+",
"len",
"(",
"self",
")",
"if",
"left",
">",
"right",
":",
"left",
",",
"right",
"=",
"right",
",",
"left",
"data",... | Get a representation of the ring buffer for plotting. This is expensive, so it should only be used in frontend
:return: | [
"Get",
"a",
"representation",
"of",
"the",
"ring",
"buffer",
"for",
"plotting",
".",
"This",
"is",
"expensive",
"so",
"it",
"should",
"only",
"be",
"used",
"in",
"frontend",
":",
"return",
":"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/util/RingBuffer.py#L48-L58 | train | Get a representation of the ring buffer for plotting. This is expensive so it is expensive so it is only used in frontend. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/util/RingBuffer.py | RingBuffer.push | def push(self, values: np.ndarray):
"""
Push values to buffer. If buffer can't store all values a ValueError is raised
"""
n = len(values)
if len(self) + n > self.size:
raise ValueError("Too much data to push to RingBuffer")
slide_1 = np.s_[self.right_index:m... | python | def push(self, values: np.ndarray):
"""
Push values to buffer. If buffer can't store all values a ValueError is raised
"""
n = len(values)
if len(self) + n > self.size:
raise ValueError("Too much data to push to RingBuffer")
slide_1 = np.s_[self.right_index:m... | [
"def",
"push",
"(",
"self",
",",
"values",
":",
"np",
".",
"ndarray",
")",
":",
"n",
"=",
"len",
"(",
"values",
")",
"if",
"len",
"(",
"self",
")",
"+",
"n",
">",
"self",
".",
"size",
":",
"raise",
"ValueError",
"(",
"\"Too much data to push to RingB... | Push values to buffer. If buffer can't store all values a ValueError is raised | [
"Push",
"values",
"to",
"buffer",
".",
"If",
"buffer",
"can",
"t",
"store",
"all",
"values",
"a",
"ValueError",
"is",
"raised"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/util/RingBuffer.py#L67-L83 | train | Push values to buffer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/util/RingBuffer.py | RingBuffer.pop | def pop(self, number: int, ensure_even_length=False):
"""
Pop number of elements. If there are not enough elements, all remaining elements are returned and the
buffer is cleared afterwards. If buffer is empty, an empty numpy array is returned.
If number is -1 (or any other value below z... | python | def pop(self, number: int, ensure_even_length=False):
"""
Pop number of elements. If there are not enough elements, all remaining elements are returned and the
buffer is cleared afterwards. If buffer is empty, an empty numpy array is returned.
If number is -1 (or any other value below z... | [
"def",
"pop",
"(",
"self",
",",
"number",
":",
"int",
",",
"ensure_even_length",
"=",
"False",
")",
":",
"if",
"ensure_even_length",
":",
"number",
"-=",
"number",
"%",
"2",
"if",
"len",
"(",
"self",
")",
"==",
"0",
"or",
"number",
"==",
"0",
":",
... | Pop number of elements. If there are not enough elements, all remaining elements are returned and the
buffer is cleared afterwards. If buffer is empty, an empty numpy array is returned.
If number is -1 (or any other value below zero) than complete buffer is returned | [
"Pop",
"number",
"of",
"elements",
".",
"If",
"there",
"are",
"not",
"enough",
"elements",
"all",
"remaining",
"elements",
"are",
"returned",
"and",
"the",
"buffer",
"is",
"cleared",
"afterwards",
".",
"If",
"buffer",
"is",
"empty",
"an",
"empty",
"numpy",
... | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/util/RingBuffer.py#L85-L121 | train | Pop a number of elements from the buffer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/signalprocessing/Encoding.py | Encoding.code_data_whitening | def code_data_whitening(self, decoding, inpt):
"""
XOR Data Whitening
:param decoding:
:param inpt:
:return:
"""
inpt_copy = array.array("B", inpt)
return self.apply_data_whitening(decoding, inpt_copy) | python | def code_data_whitening(self, decoding, inpt):
"""
XOR Data Whitening
:param decoding:
:param inpt:
:return:
"""
inpt_copy = array.array("B", inpt)
return self.apply_data_whitening(decoding, inpt_copy) | [
"def",
"code_data_whitening",
"(",
"self",
",",
"decoding",
",",
"inpt",
")",
":",
"inpt_copy",
"=",
"array",
".",
"array",
"(",
"\"B\"",
",",
"inpt",
")",
"return",
"self",
".",
"apply_data_whitening",
"(",
"decoding",
",",
"inpt_copy",
")"
] | XOR Data Whitening
:param decoding:
:param inpt:
:return: | [
"XOR",
"Data",
"Whitening",
":",
"param",
"decoding",
":",
":",
"param",
"inpt",
":",
":",
"return",
":"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/signalprocessing/Encoding.py#L451-L459 | train | XOR Data Whitening. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/plugins/ZeroHide/ZeroHidePlugin.py | ZeroHidePlugin.get_action | def get_action(self, parent, undo_stack: QUndoStack, sel_range, protocol, view: int):
"""
:type parent: QTableView
:type undo_stack: QUndoStack
"""
self.command = ZeroHideAction(protocol, self.following_zeros, view, self.zero_hide_offsets)
action = QAction(self.command.te... | python | def get_action(self, parent, undo_stack: QUndoStack, sel_range, protocol, view: int):
"""
:type parent: QTableView
:type undo_stack: QUndoStack
"""
self.command = ZeroHideAction(protocol, self.following_zeros, view, self.zero_hide_offsets)
action = QAction(self.command.te... | [
"def",
"get_action",
"(",
"self",
",",
"parent",
",",
"undo_stack",
":",
"QUndoStack",
",",
"sel_range",
",",
"protocol",
",",
"view",
":",
"int",
")",
":",
"self",
".",
"command",
"=",
"ZeroHideAction",
"(",
"protocol",
",",
"self",
".",
"following_zeros"... | :type parent: QTableView
:type undo_stack: QUndoStack | [
":",
"type",
"parent",
":",
"QTableView",
":",
"type",
"undo_stack",
":",
"QUndoStack"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/plugins/ZeroHide/ZeroHidePlugin.py#L24-L33 | train | Get the action for this table. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/ui/views/SelectableGraphicView.py | SelectableGraphicView.scroll_mouse | def scroll_mouse(self, mouse_x: int):
"""
Scrolls the mouse if ROI Selection reaches corner of view
:param mouse_x:
:return:
"""
scrollbar = self.horizontalScrollBar()
if mouse_x - self.view_rect().x() > self.view_rect().width():
scrollbar.setValue(s... | python | def scroll_mouse(self, mouse_x: int):
"""
Scrolls the mouse if ROI Selection reaches corner of view
:param mouse_x:
:return:
"""
scrollbar = self.horizontalScrollBar()
if mouse_x - self.view_rect().x() > self.view_rect().width():
scrollbar.setValue(s... | [
"def",
"scroll_mouse",
"(",
"self",
",",
"mouse_x",
":",
"int",
")",
":",
"scrollbar",
"=",
"self",
".",
"horizontalScrollBar",
"(",
")",
"if",
"mouse_x",
"-",
"self",
".",
"view_rect",
"(",
")",
".",
"x",
"(",
")",
">",
"self",
".",
"view_rect",
"("... | Scrolls the mouse if ROI Selection reaches corner of view
:param mouse_x:
:return: | [
"Scrolls",
"the",
"mouse",
"if",
"ROI",
"Selection",
"reaches",
"corner",
"of",
"view"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/views/SelectableGraphicView.py#L207-L220 | train | Scrolls the mouse if ROI Selection reaches corner of view | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/ui/views/SelectableGraphicView.py | SelectableGraphicView.refresh_selection_area | def refresh_selection_area(self):
"""
Refresh selection area in case scene was resized/scaled.
This happens e.g. when switching from Signal View to Quad Demod view
:return:
"""
self.__set_selection_area(x=self.selection_area.x, y=self.selection_area.y,
... | python | def refresh_selection_area(self):
"""
Refresh selection area in case scene was resized/scaled.
This happens e.g. when switching from Signal View to Quad Demod view
:return:
"""
self.__set_selection_area(x=self.selection_area.x, y=self.selection_area.y,
... | [
"def",
"refresh_selection_area",
"(",
"self",
")",
":",
"self",
".",
"__set_selection_area",
"(",
"x",
"=",
"self",
".",
"selection_area",
".",
"x",
",",
"y",
"=",
"self",
".",
"selection_area",
".",
"y",
",",
"w",
"=",
"self",
".",
"selection_area",
"."... | Refresh selection area in case scene was resized/scaled.
This happens e.g. when switching from Signal View to Quad Demod view
:return: | [
"Refresh",
"selection",
"area",
"in",
"case",
"scene",
"was",
"resized",
"/",
"scaled",
".",
"This",
"happens",
"e",
".",
"g",
".",
"when",
"switching",
"from",
"Signal",
"View",
"to",
"Quad",
"Demod",
"view",
":",
"return",
":"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/views/SelectableGraphicView.py#L252-L259 | train | Refresh the selection area in case scene was resized or scaled. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/ui/views/SelectableGraphicView.py | SelectableGraphicView.view_rect | def view_rect(self) -> QRectF:
"""
Return the boundaries of the view in scene coordinates
"""
top_left = self.mapToScene(0, 0)
bottom_right = self.mapToScene(self.viewport().width() - 1, self.viewport().height() - 1)
return QRectF(top_left, bottom_right) | python | def view_rect(self) -> QRectF:
"""
Return the boundaries of the view in scene coordinates
"""
top_left = self.mapToScene(0, 0)
bottom_right = self.mapToScene(self.viewport().width() - 1, self.viewport().height() - 1)
return QRectF(top_left, bottom_right) | [
"def",
"view_rect",
"(",
"self",
")",
"->",
"QRectF",
":",
"top_left",
"=",
"self",
".",
"mapToScene",
"(",
"0",
",",
"0",
")",
"bottom_right",
"=",
"self",
".",
"mapToScene",
"(",
"self",
".",
"viewport",
"(",
")",
".",
"width",
"(",
")",
"-",
"1"... | Return the boundaries of the view in scene coordinates | [
"Return",
"the",
"boundaries",
"of",
"the",
"view",
"in",
"scene",
"coordinates"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/views/SelectableGraphicView.py#L317-L323 | train | Return the boundaries of the view in scene coordinates | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
jopohl/urh | src/urh/ui/SimulatorScene.py | SimulatorScene.dropEvent | def dropEvent(self, event: QDropEvent):
items = [item for item in self.items(event.scenePos()) if isinstance(item, GraphicsItem) and item.acceptDrops()]
item = None if len(items) == 0 else items[0]
if len(event.mimeData().urls()) > 0:
self.files_dropped.emit(event.mimeData().urls())
... | python | def dropEvent(self, event: QDropEvent):
items = [item for item in self.items(event.scenePos()) if isinstance(item, GraphicsItem) and item.acceptDrops()]
item = None if len(items) == 0 else items[0]
if len(event.mimeData().urls()) > 0:
self.files_dropped.emit(event.mimeData().urls())
... | [
"def",
"dropEvent",
"(",
"self",
",",
"event",
":",
"QDropEvent",
")",
":",
"items",
"=",
"[",
"item",
"for",
"item",
"in",
"self",
".",
"items",
"(",
"event",
".",
"scenePos",
"(",
")",
")",
"if",
"isinstance",
"(",
"item",
",",
"GraphicsItem",
")",... | :type: list of ProtocolTreeItem | [
":",
"type",
":",
"list",
"of",
"ProtocolTreeItem"
] | 2eb33b125c8407964cd1092843cde5010eb88aae | https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/ui/SimulatorScene.py#L376-L412 | train | Adds the protocol tree item to the tree. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.