repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
sirfoga/pyhal | hal/times/dates.py | Day.get_just_date | def get_just_date(self):
"""Parses just date from date-time
:return: Just day, month and year (setting hours to 00:00:00)
"""
return datetime.datetime(
self.date_time.year,
self.date_time.month,
self.date_time.day
) | python | def get_just_date(self):
"""Parses just date from date-time
:return: Just day, month and year (setting hours to 00:00:00)
"""
return datetime.datetime(
self.date_time.year,
self.date_time.month,
self.date_time.day
) | [
"def",
"get_just_date",
"(",
"self",
")",
":",
"return",
"datetime",
".",
"datetime",
"(",
"self",
".",
"date_time",
".",
"year",
",",
"self",
".",
"date_time",
".",
"month",
",",
"self",
".",
"date_time",
".",
"day",
")"
] | Parses just date from date-time
:return: Just day, month and year (setting hours to 00:00:00) | [
"Parses",
"just",
"date",
"from",
"date",
"-",
"time"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/times/dates.py#L74-L83 | train |
sirfoga/pyhal | hal/times/dates.py | Day.is_date_in_between | def is_date_in_between(self, start, end, include_start=True,
include_end=True):
"""Checks if date is in between dates
:param start: Date cannot be before this date
:param end: Date cannot be after this date
:param include_start: True iff date is start
... | python | def is_date_in_between(self, start, end, include_start=True,
include_end=True):
"""Checks if date is in between dates
:param start: Date cannot be before this date
:param end: Date cannot be after this date
:param include_start: True iff date is start
... | [
"def",
"is_date_in_between",
"(",
"self",
",",
"start",
",",
"end",
",",
"include_start",
"=",
"True",
",",
"include_end",
"=",
"True",
")",
":",
"start",
"=",
"Day",
"(",
"start",
")",
".",
"get_just_date",
"(",
")",
"now",
"=",
"self",
".",
"get_just... | Checks if date is in between dates
:param start: Date cannot be before this date
:param end: Date cannot be after this date
:param include_start: True iff date is start
:param include_end: True iff date is end
:return: True iff date is in between dates | [
"Checks",
"if",
"date",
"is",
"in",
"between",
"dates"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/times/dates.py#L96-L120 | train |
sirfoga/pyhal | hal/times/dates.py | Day.get_next_weekday | def get_next_weekday(self, including_today=False):
"""Gets next week day
:param including_today: If today is sunday and requesting next sunday
:return: Date of next monday, tuesday ..
"""
weekday = self.date_time.weekday()
return Weekday.get_next(weekday, including_today... | python | def get_next_weekday(self, including_today=False):
"""Gets next week day
:param including_today: If today is sunday and requesting next sunday
:return: Date of next monday, tuesday ..
"""
weekday = self.date_time.weekday()
return Weekday.get_next(weekday, including_today... | [
"def",
"get_next_weekday",
"(",
"self",
",",
"including_today",
"=",
"False",
")",
":",
"weekday",
"=",
"self",
".",
"date_time",
".",
"weekday",
"(",
")",
"return",
"Weekday",
".",
"get_next",
"(",
"weekday",
",",
"including_today",
"=",
"including_today",
... | Gets next week day
:param including_today: If today is sunday and requesting next sunday
:return: Date of next monday, tuesday .. | [
"Gets",
"next",
"week",
"day"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/times/dates.py#L122-L129 | train |
sirfoga/pyhal | hal/times/dates.py | Day.get_last_weekday | def get_last_weekday(self, including_today=False):
"""Gets last week day
:param including_today: If today is sunday and requesting next sunday
:return: Date of last monday, tuesday ..
"""
weekday = self.date_time.weekday()
return Weekday.get_last(weekday, including_today... | python | def get_last_weekday(self, including_today=False):
"""Gets last week day
:param including_today: If today is sunday and requesting next sunday
:return: Date of last monday, tuesday ..
"""
weekday = self.date_time.weekday()
return Weekday.get_last(weekday, including_today... | [
"def",
"get_last_weekday",
"(",
"self",
",",
"including_today",
"=",
"False",
")",
":",
"weekday",
"=",
"self",
".",
"date_time",
".",
"weekday",
"(",
")",
"return",
"Weekday",
".",
"get_last",
"(",
"weekday",
",",
"including_today",
"=",
"including_today",
... | Gets last week day
:param including_today: If today is sunday and requesting next sunday
:return: Date of last monday, tuesday .. | [
"Gets",
"last",
"week",
"day"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/times/dates.py#L131-L138 | train |
NoviceLive/intellicoder | intellicoder/main.py | cli | def cli(context, verbose, quiet, database, sense):
"""Position Independent Programming For Humans."""
logger = logging.getLogger()
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(LevelFormatter())
logger.addHandler(handler)
logger.setLevel(logging.WARNING + (quiet-verbose)*10)
... | python | def cli(context, verbose, quiet, database, sense):
"""Position Independent Programming For Humans."""
logger = logging.getLogger()
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(LevelFormatter())
logger.addHandler(handler)
logger.setLevel(logging.WARNING + (quiet-verbose)*10)
... | [
"def",
"cli",
"(",
"context",
",",
"verbose",
",",
"quiet",
",",
"database",
",",
"sense",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
")",
"handler",
"=",
"logging",
".",
"StreamHandler",
"(",
"sys",
".",
"stderr",
")",
"handler",
".",
... | Position Independent Programming For Humans. | [
"Position",
"Independent",
"Programming",
"For",
"Humans",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/main.py#L57-L69 | train |
NoviceLive/intellicoder | intellicoder/main.py | search | def search(context, keywords, module, raw, kind):
"""Query Windows identifiers and locations.
Windows database must be prepared before using this.
"""
logging.info(_('Entering search mode'))
sense = context.obj['sense']
func = sense.query_names if module else sense.query_info
none = True
... | python | def search(context, keywords, module, raw, kind):
"""Query Windows identifiers and locations.
Windows database must be prepared before using this.
"""
logging.info(_('Entering search mode'))
sense = context.obj['sense']
func = sense.query_names if module else sense.query_info
none = True
... | [
"def",
"search",
"(",
"context",
",",
"keywords",
",",
"module",
",",
"raw",
",",
"kind",
")",
":",
"logging",
".",
"info",
"(",
"_",
"(",
"'Entering search mode'",
")",
")",
"sense",
"=",
"context",
".",
"obj",
"[",
"'sense'",
"]",
"func",
"=",
"sen... | Query Windows identifiers and locations.
Windows database must be prepared before using this. | [
"Query",
"Windows",
"identifiers",
"and",
"locations",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/main.py#L192-L208 | train |
NoviceLive/intellicoder | intellicoder/main.py | winapi | def winapi(context, names):
"""Query Win32 API declarations.
Windows database must be prepared before using this.
"""
logging.info(_('Entering winapi mode'))
sense = context.obj['sense']
none = True
for name in names:
code = sense.query_args(name)
if code:
none =... | python | def winapi(context, names):
"""Query Win32 API declarations.
Windows database must be prepared before using this.
"""
logging.info(_('Entering winapi mode'))
sense = context.obj['sense']
none = True
for name in names:
code = sense.query_args(name)
if code:
none =... | [
"def",
"winapi",
"(",
"context",
",",
"names",
")",
":",
"logging",
".",
"info",
"(",
"_",
"(",
"'Entering winapi mode'",
")",
")",
"sense",
"=",
"context",
".",
"obj",
"[",
"'sense'",
"]",
"none",
"=",
"True",
"for",
"name",
"in",
"names",
":",
"cod... | Query Win32 API declarations.
Windows database must be prepared before using this. | [
"Query",
"Win32",
"API",
"declarations",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/main.py#L214-L229 | train |
NoviceLive/intellicoder | intellicoder/main.py | kinds | def kinds(context, show_all, ids_or_names):
"""Operate on IntelliSense kind ids and names.
Without an argument, list all available kinds and their ids.
Windows database must be prepared before using this.
"""
logging.info(_('Entering kind mode'))
logging.debug('args: %s', ids_or_names)
sen... | python | def kinds(context, show_all, ids_or_names):
"""Operate on IntelliSense kind ids and names.
Without an argument, list all available kinds and their ids.
Windows database must be prepared before using this.
"""
logging.info(_('Entering kind mode'))
logging.debug('args: %s', ids_or_names)
sen... | [
"def",
"kinds",
"(",
"context",
",",
"show_all",
",",
"ids_or_names",
")",
":",
"logging",
".",
"info",
"(",
"_",
"(",
"'Entering kind mode'",
")",
")",
"logging",
".",
"debug",
"(",
"'args: %s'",
",",
"ids_or_names",
")",
"sense",
"=",
"context",
".",
"... | Operate on IntelliSense kind ids and names.
Without an argument, list all available kinds and their ids.
Windows database must be prepared before using this. | [
"Operate",
"on",
"IntelliSense",
"kind",
"ids",
"and",
"names",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/main.py#L237-L257 | train |
NoviceLive/intellicoder | intellicoder/main.py | export | def export(context, keywords, module, update):
"""Operate on libraries and exported functions.
Query the module name containing the function by default.
Windows database must be prepared before using this.
"""
logging.info(_('Export Mode'))
database = context.obj['sense']
none = True
i... | python | def export(context, keywords, module, update):
"""Operate on libraries and exported functions.
Query the module name containing the function by default.
Windows database must be prepared before using this.
"""
logging.info(_('Export Mode'))
database = context.obj['sense']
none = True
i... | [
"def",
"export",
"(",
"context",
",",
"keywords",
",",
"module",
",",
"update",
")",
":",
"logging",
".",
"info",
"(",
"_",
"(",
"'Export Mode'",
")",
")",
"database",
"=",
"context",
".",
"obj",
"[",
"'sense'",
"]",
"none",
"=",
"True",
"if",
"updat... | Operate on libraries and exported functions.
Query the module name containing the function by default.
Windows database must be prepared before using this. | [
"Operate",
"on",
"libraries",
"and",
"exported",
"functions",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/main.py#L267-L305 | train |
NoviceLive/intellicoder | intellicoder/main.py | add | def add(context, filenames):
"""Add data on Linux system calls.
Arguments shall be *.tbl files from Linux x86 source code,
or output from grep.
Delete the old database before adding if necessary.
"""
logging.info(_('Current Mode: Add Linux data'))
context.obj['database'].add_data(filenames... | python | def add(context, filenames):
"""Add data on Linux system calls.
Arguments shall be *.tbl files from Linux x86 source code,
or output from grep.
Delete the old database before adding if necessary.
"""
logging.info(_('Current Mode: Add Linux data'))
context.obj['database'].add_data(filenames... | [
"def",
"add",
"(",
"context",
",",
"filenames",
")",
":",
"logging",
".",
"info",
"(",
"_",
"(",
"'Current Mode: Add Linux data'",
")",
")",
"context",
".",
"obj",
"[",
"'database'",
"]",
".",
"add_data",
"(",
"filenames",
")",
"sys",
".",
"exit",
"(",
... | Add data on Linux system calls.
Arguments shall be *.tbl files from Linux x86 source code,
or output from grep.
Delete the old database before adding if necessary. | [
"Add",
"data",
"on",
"Linux",
"system",
"calls",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/main.py#L312-L322 | train |
NoviceLive/intellicoder | intellicoder/main.py | make | def make(filenames, x64, cl_args, link_args, output):
"""Make binaries from sources.
Note that this is incomplete.
"""
from .msbuild import Builder
builder = Builder()
builder.build(list(filenames), x64=x64,
cl_args=cl_args, link_args=link_args,
out_dir=outpu... | python | def make(filenames, x64, cl_args, link_args, output):
"""Make binaries from sources.
Note that this is incomplete.
"""
from .msbuild import Builder
builder = Builder()
builder.build(list(filenames), x64=x64,
cl_args=cl_args, link_args=link_args,
out_dir=outpu... | [
"def",
"make",
"(",
"filenames",
",",
"x64",
",",
"cl_args",
",",
"link_args",
",",
"output",
")",
":",
"from",
".",
"msbuild",
"import",
"Builder",
"builder",
"=",
"Builder",
"(",
")",
"builder",
".",
"build",
"(",
"list",
"(",
"filenames",
")",
",",
... | Make binaries from sources.
Note that this is incomplete. | [
"Make",
"binaries",
"from",
"sources",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/main.py#L331-L340 | train |
NoviceLive/intellicoder | intellicoder/main.py | info | def info(context, keywords, x86, x64, x32, common):
"""Find in the Linux system calls.
"""
logging.info(_('Current Mode: Find in Linux'))
database = context.obj['database']
for one in keywords:
abis = ['i386', 'x64', 'common', 'x32']
if x86:
abis = ['i386']
if x64... | python | def info(context, keywords, x86, x64, x32, common):
"""Find in the Linux system calls.
"""
logging.info(_('Current Mode: Find in Linux'))
database = context.obj['database']
for one in keywords:
abis = ['i386', 'x64', 'common', 'x32']
if x86:
abis = ['i386']
if x64... | [
"def",
"info",
"(",
"context",
",",
"keywords",
",",
"x86",
",",
"x64",
",",
"x32",
",",
"common",
")",
":",
"logging",
".",
"info",
"(",
"_",
"(",
"'Current Mode: Find in Linux'",
")",
")",
"database",
"=",
"context",
".",
"obj",
"[",
"'database'",
"]... | Find in the Linux system calls. | [
"Find",
"in",
"the",
"Linux",
"system",
"calls",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/main.py#L350-L377 | train |
NoviceLive/intellicoder | intellicoder/main.py | conv | def conv(arg, source, target, filename, section):
"""Convert binary.
Extract bytes in the given section from binary files
and construct C source code
that can be used to test as shellcode.
Supported executable formats:
ELF via pyelftools and PE via pefile.
"""
logging.info(_('This is B... | python | def conv(arg, source, target, filename, section):
"""Convert binary.
Extract bytes in the given section from binary files
and construct C source code
that can be used to test as shellcode.
Supported executable formats:
ELF via pyelftools and PE via pefile.
"""
logging.info(_('This is B... | [
"def",
"conv",
"(",
"arg",
",",
"source",
",",
"target",
",",
"filename",
",",
"section",
")",
":",
"logging",
".",
"info",
"(",
"_",
"(",
"'This is Binary Conversion mode.'",
")",
")",
"section",
"=",
"section",
".",
"encode",
"(",
"'utf-8'",
")",
"if",... | Convert binary.
Extract bytes in the given section from binary files
and construct C source code
that can be used to test as shellcode.
Supported executable formats:
ELF via pyelftools and PE via pefile. | [
"Convert",
"binary",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/main.py#L392-L424 | train |
loganasherjones/yapconf | yapconf/sources.py | get_source | def get_source(label, source_type, **kwargs):
"""Get a config source based on type and keyword args.
This is meant to be used internally by the spec via ``add_source``.
Args:
label (str): The label for this source.
source_type: The type of source. See ``yapconf.SUPPORTED_SOURCES``
Key... | python | def get_source(label, source_type, **kwargs):
"""Get a config source based on type and keyword args.
This is meant to be used internally by the spec via ``add_source``.
Args:
label (str): The label for this source.
source_type: The type of source. See ``yapconf.SUPPORTED_SOURCES``
Key... | [
"def",
"get_source",
"(",
"label",
",",
"source_type",
",",
"**",
"kwargs",
")",
":",
"if",
"source_type",
"not",
"in",
"yapconf",
".",
"ALL_SUPPORTED_SOURCES",
":",
"raise",
"YapconfSourceError",
"(",
"'Invalid source type %s. Supported types are %s.'",
"%",
"(",
"... | Get a config source based on type and keyword args.
This is meant to be used internally by the spec via ``add_source``.
Args:
label (str): The label for this source.
source_type: The type of source. See ``yapconf.SUPPORTED_SOURCES``
Keyword Args:
The keyword arguments are based on... | [
"Get",
"a",
"config",
"source",
"based",
"on",
"type",
"and",
"keyword",
"args",
"."
] | d2970e6e7e3334615d4d978d8b0ca33006d79d16 | https://github.com/loganasherjones/yapconf/blob/d2970e6e7e3334615d4d978d8b0ca33006d79d16/yapconf/sources.py#L23-L95 | train |
iqbal-lab-org/cluster_vcf_records | cluster_vcf_records/vcf_record_cluster.py | VcfRecordCluster.make_simple_merged_vcf_with_no_combinations | def make_simple_merged_vcf_with_no_combinations(self, ref_seq):
'''Does a simple merging of all variants in this cluster.
Assumes one ALT in each variant. Uses the ALT for each
variant, making one new vcf_record that has all the variants
put together'''
if len(self) <= 1:
... | python | def make_simple_merged_vcf_with_no_combinations(self, ref_seq):
'''Does a simple merging of all variants in this cluster.
Assumes one ALT in each variant. Uses the ALT for each
variant, making one new vcf_record that has all the variants
put together'''
if len(self) <= 1:
... | [
"def",
"make_simple_merged_vcf_with_no_combinations",
"(",
"self",
",",
"ref_seq",
")",
":",
"if",
"len",
"(",
"self",
")",
"<=",
"1",
":",
"return",
"merged_vcf_record",
"=",
"self",
".",
"vcf_records",
"[",
"0",
"]",
"for",
"i",
"in",
"range",
"(",
"1",
... | Does a simple merging of all variants in this cluster.
Assumes one ALT in each variant. Uses the ALT for each
variant, making one new vcf_record that has all the variants
put together | [
"Does",
"a",
"simple",
"merging",
"of",
"all",
"variants",
"in",
"this",
"cluster",
".",
"Assumes",
"one",
"ALT",
"in",
"each",
"variant",
".",
"Uses",
"the",
"ALT",
"for",
"each",
"variant",
"making",
"one",
"new",
"vcf_record",
"that",
"has",
"all",
"t... | 0db26af36b6da97a7361364457d2152dc756055c | https://github.com/iqbal-lab-org/cluster_vcf_records/blob/0db26af36b6da97a7361364457d2152dc756055c/cluster_vcf_records/vcf_record_cluster.py#L140-L156 | train |
iqbal-lab-org/cluster_vcf_records | cluster_vcf_records/vcf_record_cluster.py | VcfRecordCluster.make_simple_gt_aware_merged_vcf_with_no_combinations | def make_simple_gt_aware_merged_vcf_with_no_combinations(self, ref_seq):
'''Does a simple merging of all variants in this cluster.
Assumes one ALT in each variant. Uses the called allele for each
variant, making one new vcf_record that has all the variants
put together'''
if len(... | python | def make_simple_gt_aware_merged_vcf_with_no_combinations(self, ref_seq):
'''Does a simple merging of all variants in this cluster.
Assumes one ALT in each variant. Uses the called allele for each
variant, making one new vcf_record that has all the variants
put together'''
if len(... | [
"def",
"make_simple_gt_aware_merged_vcf_with_no_combinations",
"(",
"self",
",",
"ref_seq",
")",
":",
"if",
"len",
"(",
"self",
")",
"<=",
"1",
":",
"return",
"merged_vcf_record",
"=",
"self",
".",
"vcf_records",
"[",
"0",
"]",
"for",
"i",
"in",
"range",
"("... | Does a simple merging of all variants in this cluster.
Assumes one ALT in each variant. Uses the called allele for each
variant, making one new vcf_record that has all the variants
put together | [
"Does",
"a",
"simple",
"merging",
"of",
"all",
"variants",
"in",
"this",
"cluster",
".",
"Assumes",
"one",
"ALT",
"in",
"each",
"variant",
".",
"Uses",
"the",
"called",
"allele",
"for",
"each",
"variant",
"making",
"one",
"new",
"vcf_record",
"that",
"has"... | 0db26af36b6da97a7361364457d2152dc756055c | https://github.com/iqbal-lab-org/cluster_vcf_records/blob/0db26af36b6da97a7361364457d2152dc756055c/cluster_vcf_records/vcf_record_cluster.py#L158-L174 | train |
iqbal-lab-org/cluster_vcf_records | cluster_vcf_records/vcf_record_cluster.py | VcfRecordCluster.make_separate_indels_and_one_alt_with_all_snps_no_combinations | def make_separate_indels_and_one_alt_with_all_snps_no_combinations(self, ref_seq):
'''Returns a VCF record, where each indel from this
cluster is in a separate ALT. Then all the remaining SNPs are
applied to make one ALT. If >1 SNP in same place, either one
might be used'''
final... | python | def make_separate_indels_and_one_alt_with_all_snps_no_combinations(self, ref_seq):
'''Returns a VCF record, where each indel from this
cluster is in a separate ALT. Then all the remaining SNPs are
applied to make one ALT. If >1 SNP in same place, either one
might be used'''
final... | [
"def",
"make_separate_indels_and_one_alt_with_all_snps_no_combinations",
"(",
"self",
",",
"ref_seq",
")",
":",
"final_start_position",
"=",
"min",
"(",
"[",
"x",
".",
"POS",
"for",
"x",
"in",
"self",
".",
"vcf_records",
"]",
")",
"final_end_position",
"=",
"max",... | Returns a VCF record, where each indel from this
cluster is in a separate ALT. Then all the remaining SNPs are
applied to make one ALT. If >1 SNP in same place, either one
might be used | [
"Returns",
"a",
"VCF",
"record",
"where",
"each",
"indel",
"from",
"this",
"cluster",
"is",
"in",
"a",
"separate",
"ALT",
".",
"Then",
"all",
"the",
"remaining",
"SNPs",
"are",
"applied",
"to",
"make",
"one",
"ALT",
".",
"If",
">",
"1",
"SNP",
"in",
... | 0db26af36b6da97a7361364457d2152dc756055c | https://github.com/iqbal-lab-org/cluster_vcf_records/blob/0db26af36b6da97a7361364457d2152dc756055c/cluster_vcf_records/vcf_record_cluster.py#L177-L207 | train |
sirfoga/pyhal | hal/streams/markdown.py | MarkdownTable._get_header | def _get_header(self):
"""Gets header of table
:return: markdown-formatted header"""
out = self._get_row(self.labels)
out += "\n"
out += self._get_row(["---"] * len(self.labels)) # line below headers
return out | python | def _get_header(self):
"""Gets header of table
:return: markdown-formatted header"""
out = self._get_row(self.labels)
out += "\n"
out += self._get_row(["---"] * len(self.labels)) # line below headers
return out | [
"def",
"_get_header",
"(",
"self",
")",
":",
"out",
"=",
"self",
".",
"_get_row",
"(",
"self",
".",
"labels",
")",
"out",
"+=",
"\"\\n\"",
"out",
"+=",
"self",
".",
"_get_row",
"(",
"[",
"\"---\"",
"]",
"*",
"len",
"(",
"self",
".",
"labels",
")",
... | Gets header of table
:return: markdown-formatted header | [
"Gets",
"header",
"of",
"table"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/streams/markdown.py#L64-L71 | train |
portfors-lab/sparkle | sparkle/gui/stim/auto_parameters_editor.py | Parametizer.setModel | def setModel(self, model):
"""sets the model for the auto parameters
:param model: The data stucture for this editor to provide access to
:type model: :class:`QAutoParameterModel<sparkle.gui.stim.qauto_parameter_model.QAutoParameterModel>`
"""
self.paramList.setModel(model)
... | python | def setModel(self, model):
"""sets the model for the auto parameters
:param model: The data stucture for this editor to provide access to
:type model: :class:`QAutoParameterModel<sparkle.gui.stim.qauto_parameter_model.QAutoParameterModel>`
"""
self.paramList.setModel(model)
... | [
"def",
"setModel",
"(",
"self",
",",
"model",
")",
":",
"self",
".",
"paramList",
".",
"setModel",
"(",
"model",
")",
"model",
".",
"hintRequested",
".",
"connect",
"(",
"self",
".",
"hintRequested",
")",
"model",
".",
"rowsInserted",
".",
"connect",
"("... | sets the model for the auto parameters
:param model: The data stucture for this editor to provide access to
:type model: :class:`QAutoParameterModel<sparkle.gui.stim.qauto_parameter_model.QAutoParameterModel>` | [
"sets",
"the",
"model",
"for",
"the",
"auto",
"parameters"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/auto_parameters_editor.py#L53-L63 | train |
portfors-lab/sparkle | sparkle/gui/stim/auto_parameters_editor.py | Parametizer.updateTitle | def updateTitle(self):
"""Updates the Title of this widget according to how many parameters are currently in the model"""
title = 'Auto Parameters ({})'.format(self.paramList.model().rowCount())
self.titleChange.emit(title)
self.setWindowTitle(title) | python | def updateTitle(self):
"""Updates the Title of this widget according to how many parameters are currently in the model"""
title = 'Auto Parameters ({})'.format(self.paramList.model().rowCount())
self.titleChange.emit(title)
self.setWindowTitle(title) | [
"def",
"updateTitle",
"(",
"self",
")",
":",
"title",
"=",
"'Auto Parameters ({})'",
".",
"format",
"(",
"self",
".",
"paramList",
".",
"model",
"(",
")",
".",
"rowCount",
"(",
")",
")",
"self",
".",
"titleChange",
".",
"emit",
"(",
"title",
")",
"self... | Updates the Title of this widget according to how many parameters are currently in the model | [
"Updates",
"the",
"Title",
"of",
"this",
"widget",
"according",
"to",
"how",
"many",
"parameters",
"are",
"currently",
"in",
"the",
"model"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/auto_parameters_editor.py#L65-L69 | train |
portfors-lab/sparkle | sparkle/gui/stim/auto_parameters_editor.py | Parametizer.showEvent | def showEvent(self, event):
"""When this widget is shown it has an effect of putting
other widgets in the parent widget into different editing modes, emits
signal to notify other widgets. Restores the previous selection the last
time this widget was visible"""
selected = self.par... | python | def showEvent(self, event):
"""When this widget is shown it has an effect of putting
other widgets in the parent widget into different editing modes, emits
signal to notify other widgets. Restores the previous selection the last
time this widget was visible"""
selected = self.par... | [
"def",
"showEvent",
"(",
"self",
",",
"event",
")",
":",
"selected",
"=",
"self",
".",
"paramList",
".",
"selectedIndexes",
"(",
")",
"model",
"=",
"self",
".",
"paramList",
".",
"model",
"(",
")",
"self",
".",
"visibilityChanged",
".",
"emit",
"(",
"1... | When this widget is shown it has an effect of putting
other widgets in the parent widget into different editing modes, emits
signal to notify other widgets. Restores the previous selection the last
time this widget was visible | [
"When",
"this",
"widget",
"is",
"shown",
"it",
"has",
"an",
"effect",
"of",
"putting",
"other",
"widgets",
"in",
"the",
"parent",
"widget",
"into",
"different",
"editing",
"modes",
"emits",
"signal",
"to",
"notify",
"other",
"widgets",
".",
"Restores",
"the"... | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/auto_parameters_editor.py#L71-L91 | train |
portfors-lab/sparkle | sparkle/gui/stim/auto_parameters_editor.py | Parametizer.closeEvent | def closeEvent(self, event):
"""Emits a signal to update start values on components"""
self.visibilityChanged.emit(0)
model = self.paramList.model()
model.hintRequested.disconnect()
model.rowsInserted.disconnect()
model.rowsRemoved.disconnect() | python | def closeEvent(self, event):
"""Emits a signal to update start values on components"""
self.visibilityChanged.emit(0)
model = self.paramList.model()
model.hintRequested.disconnect()
model.rowsInserted.disconnect()
model.rowsRemoved.disconnect() | [
"def",
"closeEvent",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"visibilityChanged",
".",
"emit",
"(",
"0",
")",
"model",
"=",
"self",
".",
"paramList",
".",
"model",
"(",
")",
"model",
".",
"hintRequested",
".",
"disconnect",
"(",
")",
"model",... | Emits a signal to update start values on components | [
"Emits",
"a",
"signal",
"to",
"update",
"start",
"values",
"on",
"components"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/auto_parameters_editor.py#L98-L104 | train |
yamcs/yamcs-python | yamcs-client/examples/authenticate.py | authenticate_with_access_token | def authenticate_with_access_token(access_token):
"""Authenticate using an existing access token."""
credentials = Credentials(access_token=access_token)
client = YamcsClient('localhost:8090', credentials=credentials)
for link in client.list_data_links('simulator'):
print(link) | python | def authenticate_with_access_token(access_token):
"""Authenticate using an existing access token."""
credentials = Credentials(access_token=access_token)
client = YamcsClient('localhost:8090', credentials=credentials)
for link in client.list_data_links('simulator'):
print(link) | [
"def",
"authenticate_with_access_token",
"(",
"access_token",
")",
":",
"credentials",
"=",
"Credentials",
"(",
"access_token",
"=",
"access_token",
")",
"client",
"=",
"YamcsClient",
"(",
"'localhost:8090'",
",",
"credentials",
"=",
"credentials",
")",
"for",
"link... | Authenticate using an existing access token. | [
"Authenticate",
"using",
"an",
"existing",
"access",
"token",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/examples/authenticate.py#L24-L30 | train |
sirfoga/pyhal | hal/streams/pretty_table.py | pretty_format_table | def pretty_format_table(labels, data, num_format="{:.3f}", line_separator="\n"):
"""Parses and creates pretty table
:param labels: List of labels of data
:param data: Matrix of any type
:param num_format: Format numbers with this format
:param line_separator: Separate each new line with this
:r... | python | def pretty_format_table(labels, data, num_format="{:.3f}", line_separator="\n"):
"""Parses and creates pretty table
:param labels: List of labels of data
:param data: Matrix of any type
:param num_format: Format numbers with this format
:param line_separator: Separate each new line with this
:r... | [
"def",
"pretty_format_table",
"(",
"labels",
",",
"data",
",",
"num_format",
"=",
"\"{:.3f}\"",
",",
"line_separator",
"=",
"\"\\n\"",
")",
":",
"table",
"=",
"SqlTable",
"(",
"labels",
",",
"data",
",",
"num_format",
",",
"line_separator",
")",
"return",
"t... | Parses and creates pretty table
:param labels: List of labels of data
:param data: Matrix of any type
:param num_format: Format numbers with this format
:param line_separator: Separate each new line with this
:return: Pretty formatted table (first row is labels, then actual data) | [
"Parses",
"and",
"creates",
"pretty",
"table"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/streams/pretty_table.py#L170-L180 | train |
sirfoga/pyhal | hal/streams/pretty_table.py | SqlTable._parse | def _parse(self):
"""Parses raw data"""
for i in range(len(self.data)):
self._parse_row(i) | python | def _parse(self):
"""Parses raw data"""
for i in range(len(self.data)):
self._parse_row(i) | [
"def",
"_parse",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"data",
")",
")",
":",
"self",
".",
"_parse_row",
"(",
"i",
")"
] | Parses raw data | [
"Parses",
"raw",
"data"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/streams/pretty_table.py#L64-L67 | train |
sirfoga/pyhal | hal/streams/pretty_table.py | SqlTable._calculate_optimal_column_widths | def _calculate_optimal_column_widths(self):
"""Calculates widths of columns
:return: Length of longest data in each column (labels and data)
"""
columns = len(self.data[0]) # number of columns
str_labels = [parse_colorama(str(l)) for l in
self.labels] # l... | python | def _calculate_optimal_column_widths(self):
"""Calculates widths of columns
:return: Length of longest data in each column (labels and data)
"""
columns = len(self.data[0]) # number of columns
str_labels = [parse_colorama(str(l)) for l in
self.labels] # l... | [
"def",
"_calculate_optimal_column_widths",
"(",
"self",
")",
":",
"columns",
"=",
"len",
"(",
"self",
".",
"data",
"[",
"0",
"]",
")",
"str_labels",
"=",
"[",
"parse_colorama",
"(",
"str",
"(",
"l",
")",
")",
"for",
"l",
"in",
"self",
".",
"labels",
... | Calculates widths of columns
:return: Length of longest data in each column (labels and data) | [
"Calculates",
"widths",
"of",
"columns"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/streams/pretty_table.py#L69-L90 | train |
sirfoga/pyhal | hal/streams/pretty_table.py | SqlTable.get_blank_row | def get_blank_row(self, filler="-", splitter="+"):
"""Gets blank row
:param filler: Fill empty columns with this char
:param splitter: Separate columns with this char
:return: Pretty formatted blank row (with no meaningful data in it)
"""
return self.get_pretty_row(
... | python | def get_blank_row(self, filler="-", splitter="+"):
"""Gets blank row
:param filler: Fill empty columns with this char
:param splitter: Separate columns with this char
:return: Pretty formatted blank row (with no meaningful data in it)
"""
return self.get_pretty_row(
... | [
"def",
"get_blank_row",
"(",
"self",
",",
"filler",
"=",
"\"-\"",
",",
"splitter",
"=",
"\"+\"",
")",
":",
"return",
"self",
".",
"get_pretty_row",
"(",
"[",
"\"\"",
"for",
"_",
"in",
"self",
".",
"widths",
"]",
",",
"filler",
",",
"splitter",
",",
"... | Gets blank row
:param filler: Fill empty columns with this char
:param splitter: Separate columns with this char
:return: Pretty formatted blank row (with no meaningful data in it) | [
"Gets",
"blank",
"row"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/streams/pretty_table.py#L111-L122 | train |
sirfoga/pyhal | hal/streams/pretty_table.py | SqlTable.build | def build(self):
"""Builds pretty-formatted table
:return: pretty table
"""
self._calculate_optimal_column_widths()
pretty_table = self.get_blank_row() + self.new_line # first row
pretty_table += self.pretty_format_row(self.labels) + self.new_line
pretty_table ... | python | def build(self):
"""Builds pretty-formatted table
:return: pretty table
"""
self._calculate_optimal_column_widths()
pretty_table = self.get_blank_row() + self.new_line # first row
pretty_table += self.pretty_format_row(self.labels) + self.new_line
pretty_table ... | [
"def",
"build",
"(",
"self",
")",
":",
"self",
".",
"_calculate_optimal_column_widths",
"(",
")",
"pretty_table",
"=",
"self",
".",
"get_blank_row",
"(",
")",
"+",
"self",
".",
"new_line",
"pretty_table",
"+=",
"self",
".",
"pretty_format_row",
"(",
"self",
... | Builds pretty-formatted table
:return: pretty table | [
"Builds",
"pretty",
"-",
"formatted",
"table"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/streams/pretty_table.py#L138-L153 | train |
sirfoga/pyhal | hal/streams/pretty_table.py | SqlTable.from_df | def from_df(data_frame):
"""Parses data and builds an instance of this class
:param data_frame: pandas DataFrame
:return: SqlTable
"""
labels = data_frame.keys().tolist()
data = data_frame.values.tolist()
return SqlTable(labels, data, "{:.3f}", "\n") | python | def from_df(data_frame):
"""Parses data and builds an instance of this class
:param data_frame: pandas DataFrame
:return: SqlTable
"""
labels = data_frame.keys().tolist()
data = data_frame.values.tolist()
return SqlTable(labels, data, "{:.3f}", "\n") | [
"def",
"from_df",
"(",
"data_frame",
")",
":",
"labels",
"=",
"data_frame",
".",
"keys",
"(",
")",
".",
"tolist",
"(",
")",
"data",
"=",
"data_frame",
".",
"values",
".",
"tolist",
"(",
")",
"return",
"SqlTable",
"(",
"labels",
",",
"data",
",",
"\"{... | Parses data and builds an instance of this class
:param data_frame: pandas DataFrame
:return: SqlTable | [
"Parses",
"data",
"and",
"builds",
"an",
"instance",
"of",
"this",
"class"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/streams/pretty_table.py#L159-L167 | train |
lowandrew/OLCTools | sipprCommon/editsamheaders.py | editheaders | def editheaders():
"""Edits the headers of SAM files to remove 'secondary alignments'"""
# Read stdin - this will be the output from samtools view
for line in fileinput.input():
try:
# Get the flag value from the input
columns = line.split('\t')
# The FLAG is in t... | python | def editheaders():
"""Edits the headers of SAM files to remove 'secondary alignments'"""
# Read stdin - this will be the output from samtools view
for line in fileinput.input():
try:
# Get the flag value from the input
columns = line.split('\t')
# The FLAG is in t... | [
"def",
"editheaders",
"(",
")",
":",
"for",
"line",
"in",
"fileinput",
".",
"input",
"(",
")",
":",
"try",
":",
"columns",
"=",
"line",
".",
"split",
"(",
"'\\t'",
")",
"flag",
"=",
"int",
"(",
"columns",
"[",
"1",
"]",
")",
"columns",
"[",
"1",
... | Edits the headers of SAM files to remove 'secondary alignments | [
"Edits",
"the",
"headers",
"of",
"SAM",
"files",
"to",
"remove",
"secondary",
"alignments"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/sipprCommon/editsamheaders.py#L12-L40 | train |
iqbal-lab-org/cluster_vcf_records | cluster_vcf_records/vcf_record.py | VcfRecord.ref_string_matches_ref_sequence | def ref_string_matches_ref_sequence(self, ref_sequence):
'''Returns true iff the REF string in the record agrees with
the given ref_sequence'''
# you never know what you're gonna get...
if self.POS < 0:
return False
end_pos = self.ref_end_pos()
if end_pos >= ... | python | def ref_string_matches_ref_sequence(self, ref_sequence):
'''Returns true iff the REF string in the record agrees with
the given ref_sequence'''
# you never know what you're gonna get...
if self.POS < 0:
return False
end_pos = self.ref_end_pos()
if end_pos >= ... | [
"def",
"ref_string_matches_ref_sequence",
"(",
"self",
",",
"ref_sequence",
")",
":",
"if",
"self",
".",
"POS",
"<",
"0",
":",
"return",
"False",
"end_pos",
"=",
"self",
".",
"ref_end_pos",
"(",
")",
"if",
"end_pos",
">=",
"len",
"(",
"ref_sequence",
")",
... | Returns true iff the REF string in the record agrees with
the given ref_sequence | [
"Returns",
"true",
"iff",
"the",
"REF",
"string",
"in",
"the",
"record",
"agrees",
"with",
"the",
"given",
"ref_sequence"
] | 0db26af36b6da97a7361364457d2152dc756055c | https://github.com/iqbal-lab-org/cluster_vcf_records/blob/0db26af36b6da97a7361364457d2152dc756055c/cluster_vcf_records/vcf_record.py#L87-L98 | train |
iqbal-lab-org/cluster_vcf_records | cluster_vcf_records/vcf_record.py | VcfRecord.ref_string_matches_dict_of_ref_sequences | def ref_string_matches_dict_of_ref_sequences(self, ref_sequences):
'''Returns true iff there is a sequence called self.CHROM in the
dict of ref_sequences, and the REF string matches'''
return self.CHROM in ref_sequences and self.ref_string_matches_ref_sequence(ref_sequences[self.CHROM]) | python | def ref_string_matches_dict_of_ref_sequences(self, ref_sequences):
'''Returns true iff there is a sequence called self.CHROM in the
dict of ref_sequences, and the REF string matches'''
return self.CHROM in ref_sequences and self.ref_string_matches_ref_sequence(ref_sequences[self.CHROM]) | [
"def",
"ref_string_matches_dict_of_ref_sequences",
"(",
"self",
",",
"ref_sequences",
")",
":",
"return",
"self",
".",
"CHROM",
"in",
"ref_sequences",
"and",
"self",
".",
"ref_string_matches_ref_sequence",
"(",
"ref_sequences",
"[",
"self",
".",
"CHROM",
"]",
")"
] | Returns true iff there is a sequence called self.CHROM in the
dict of ref_sequences, and the REF string matches | [
"Returns",
"true",
"iff",
"there",
"is",
"a",
"sequence",
"called",
"self",
".",
"CHROM",
"in",
"the",
"dict",
"of",
"ref_sequences",
"and",
"the",
"REF",
"string",
"matches"
] | 0db26af36b6da97a7361364457d2152dc756055c | https://github.com/iqbal-lab-org/cluster_vcf_records/blob/0db26af36b6da97a7361364457d2152dc756055c/cluster_vcf_records/vcf_record.py#L101-L104 | train |
iqbal-lab-org/cluster_vcf_records | cluster_vcf_records/vcf_record.py | VcfRecord.is_snp | def is_snp(self):
'''Returns true iff this variant is a SNP'''
nucleotides = {'A', 'C', 'G', 'T'}
return len(self.REF) == 1 and self.REF in nucleotides and set(self.ALT).issubset(nucleotides) | python | def is_snp(self):
'''Returns true iff this variant is a SNP'''
nucleotides = {'A', 'C', 'G', 'T'}
return len(self.REF) == 1 and self.REF in nucleotides and set(self.ALT).issubset(nucleotides) | [
"def",
"is_snp",
"(",
"self",
")",
":",
"nucleotides",
"=",
"{",
"'A'",
",",
"'C'",
",",
"'G'",
",",
"'T'",
"}",
"return",
"len",
"(",
"self",
".",
"REF",
")",
"==",
"1",
"and",
"self",
".",
"REF",
"in",
"nucleotides",
"and",
"set",
"(",
"self",
... | Returns true iff this variant is a SNP | [
"Returns",
"true",
"iff",
"this",
"variant",
"is",
"a",
"SNP"
] | 0db26af36b6da97a7361364457d2152dc756055c | https://github.com/iqbal-lab-org/cluster_vcf_records/blob/0db26af36b6da97a7361364457d2152dc756055c/cluster_vcf_records/vcf_record.py#L113-L116 | train |
iqbal-lab-org/cluster_vcf_records | cluster_vcf_records/vcf_record.py | VcfRecord.add_flanking_seqs | def add_flanking_seqs(self, ref_seq, new_start, new_end):
'''Adds new_start many nucleotides at the start, and new_end many nucleotides
at the end from the appropriate nucleotides in reference sequence ref_seq.'''
if new_start > self.POS or new_end < self.ref_end_pos():
raise Error('... | python | def add_flanking_seqs(self, ref_seq, new_start, new_end):
'''Adds new_start many nucleotides at the start, and new_end many nucleotides
at the end from the appropriate nucleotides in reference sequence ref_seq.'''
if new_start > self.POS or new_end < self.ref_end_pos():
raise Error('... | [
"def",
"add_flanking_seqs",
"(",
"self",
",",
"ref_seq",
",",
"new_start",
",",
"new_end",
")",
":",
"if",
"new_start",
">",
"self",
".",
"POS",
"or",
"new_end",
"<",
"self",
".",
"ref_end_pos",
"(",
")",
":",
"raise",
"Error",
"(",
"'new start and end pos... | Adds new_start many nucleotides at the start, and new_end many nucleotides
at the end from the appropriate nucleotides in reference sequence ref_seq. | [
"Adds",
"new_start",
"many",
"nucleotides",
"at",
"the",
"start",
"and",
"new_end",
"many",
"nucleotides",
"at",
"the",
"end",
"from",
"the",
"appropriate",
"nucleotides",
"in",
"reference",
"sequence",
"ref_seq",
"."
] | 0db26af36b6da97a7361364457d2152dc756055c | https://github.com/iqbal-lab-org/cluster_vcf_records/blob/0db26af36b6da97a7361364457d2152dc756055c/cluster_vcf_records/vcf_record.py#L270-L280 | train |
iqbal-lab-org/cluster_vcf_records | cluster_vcf_records/vcf_record.py | VcfRecord.remove_useless_start_nucleotides | def remove_useless_start_nucleotides(self):
'''Removes duplicated nucleotides at the start of REF and ALT.
But always leaves at least one nucleotide in each of REF and ALT.
eg if variant is at position 42, REF=GCTGA, ALT=GCA, then
sets position=41, REF=CTGA, ALT=CA.
Assumes only ... | python | def remove_useless_start_nucleotides(self):
'''Removes duplicated nucleotides at the start of REF and ALT.
But always leaves at least one nucleotide in each of REF and ALT.
eg if variant is at position 42, REF=GCTGA, ALT=GCA, then
sets position=41, REF=CTGA, ALT=CA.
Assumes only ... | [
"def",
"remove_useless_start_nucleotides",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"REF",
")",
"==",
"1",
"or",
"len",
"(",
"self",
".",
"ALT",
")",
"!=",
"1",
":",
"return",
"i",
"=",
"0",
"while",
"i",
"<",
"len",
"(",
"self",
"."... | Removes duplicated nucleotides at the start of REF and ALT.
But always leaves at least one nucleotide in each of REF and ALT.
eg if variant is at position 42, REF=GCTGA, ALT=GCA, then
sets position=41, REF=CTGA, ALT=CA.
Assumes only one ALT, and does nothing if there is >1 ALT | [
"Removes",
"duplicated",
"nucleotides",
"at",
"the",
"start",
"of",
"REF",
"and",
"ALT",
".",
"But",
"always",
"leaves",
"at",
"least",
"one",
"nucleotide",
"in",
"each",
"of",
"REF",
"and",
"ALT",
".",
"eg",
"if",
"variant",
"is",
"at",
"position",
"42"... | 0db26af36b6da97a7361364457d2152dc756055c | https://github.com/iqbal-lab-org/cluster_vcf_records/blob/0db26af36b6da97a7361364457d2152dc756055c/cluster_vcf_records/vcf_record.py#L310-L326 | train |
iqbal-lab-org/cluster_vcf_records | cluster_vcf_records/vcf_record.py | VcfRecord.inferred_var_seqs_plus_flanks | def inferred_var_seqs_plus_flanks(self, ref_seq, flank_length):
'''Returns start position of first flank sequence, plus a list of sequences -
the REF, plus one for each ALT.sequence. Order same as in ALT column'''
flank_start = max(0, self.POS - flank_length)
flank_end = min(len(ref_seq)... | python | def inferred_var_seqs_plus_flanks(self, ref_seq, flank_length):
'''Returns start position of first flank sequence, plus a list of sequences -
the REF, plus one for each ALT.sequence. Order same as in ALT column'''
flank_start = max(0, self.POS - flank_length)
flank_end = min(len(ref_seq)... | [
"def",
"inferred_var_seqs_plus_flanks",
"(",
"self",
",",
"ref_seq",
",",
"flank_length",
")",
":",
"flank_start",
"=",
"max",
"(",
"0",
",",
"self",
".",
"POS",
"-",
"flank_length",
")",
"flank_end",
"=",
"min",
"(",
"len",
"(",
"ref_seq",
")",
"-",
"1"... | Returns start position of first flank sequence, plus a list of sequences -
the REF, plus one for each ALT.sequence. Order same as in ALT column | [
"Returns",
"start",
"position",
"of",
"first",
"flank",
"sequence",
"plus",
"a",
"list",
"of",
"sequences",
"-",
"the",
"REF",
"plus",
"one",
"for",
"each",
"ALT",
".",
"sequence",
".",
"Order",
"same",
"as",
"in",
"ALT",
"column"
] | 0db26af36b6da97a7361364457d2152dc756055c | https://github.com/iqbal-lab-org/cluster_vcf_records/blob/0db26af36b6da97a7361364457d2152dc756055c/cluster_vcf_records/vcf_record.py#L336-L346 | train |
iqbal-lab-org/cluster_vcf_records | cluster_vcf_records/vcf_record.py | VcfRecord.total_coverage | def total_coverage(self):
'''Returns the sum of COV data, if present. Otherwise returns None'''
if 'COV' in self.FORMAT:
return sum([int(x) for x in self.FORMAT['COV'].split(',')])
else:
return None | python | def total_coverage(self):
'''Returns the sum of COV data, if present. Otherwise returns None'''
if 'COV' in self.FORMAT:
return sum([int(x) for x in self.FORMAT['COV'].split(',')])
else:
return None | [
"def",
"total_coverage",
"(",
"self",
")",
":",
"if",
"'COV'",
"in",
"self",
".",
"FORMAT",
":",
"return",
"sum",
"(",
"[",
"int",
"(",
"x",
")",
"for",
"x",
"in",
"self",
".",
"FORMAT",
"[",
"'COV'",
"]",
".",
"split",
"(",
"','",
")",
"]",
")... | Returns the sum of COV data, if present. Otherwise returns None | [
"Returns",
"the",
"sum",
"of",
"COV",
"data",
"if",
"present",
".",
"Otherwise",
"returns",
"None"
] | 0db26af36b6da97a7361364457d2152dc756055c | https://github.com/iqbal-lab-org/cluster_vcf_records/blob/0db26af36b6da97a7361364457d2152dc756055c/cluster_vcf_records/vcf_record.py#L349-L354 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.set_parent | def set_parent(self, child, parent):
"""Set the parent of the child reftrack node
:param child: the child reftrack node
:type child: str
:param parent: the parent reftrack node
:type parent: str
:returns: None
:rtype: None
:raises: None
"""
... | python | def set_parent(self, child, parent):
"""Set the parent of the child reftrack node
:param child: the child reftrack node
:type child: str
:param parent: the parent reftrack node
:type parent: str
:returns: None
:rtype: None
:raises: None
"""
... | [
"def",
"set_parent",
"(",
"self",
",",
"child",
",",
"parent",
")",
":",
"parents",
"=",
"cmds",
".",
"listConnections",
"(",
"\"%s.parent\"",
"%",
"child",
",",
"plugs",
"=",
"True",
",",
"source",
"=",
"True",
")",
"if",
"parents",
":",
"cmds",
".",
... | Set the parent of the child reftrack node
:param child: the child reftrack node
:type child: str
:param parent: the parent reftrack node
:type parent: str
:returns: None
:rtype: None
:raises: None | [
"Set",
"the",
"parent",
"of",
"the",
"child",
"reftrack",
"node"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L62-L78 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.get_children | def get_children(self, refobj):
"""Get the children reftrack nodes of the given node
It is the reverse query of :meth:`RefobjInterface.get_parent`
:param refobj: the parent reftrack node
:type refobj: str
:returns: a list with children reftrack nodes
:rtype: list
... | python | def get_children(self, refobj):
"""Get the children reftrack nodes of the given node
It is the reverse query of :meth:`RefobjInterface.get_parent`
:param refobj: the parent reftrack node
:type refobj: str
:returns: a list with children reftrack nodes
:rtype: list
... | [
"def",
"get_children",
"(",
"self",
",",
"refobj",
")",
":",
"children",
"=",
"cmds",
".",
"listConnections",
"(",
"\"%s.children\"",
"%",
"refobj",
",",
"d",
"=",
"False",
")",
"if",
"not",
"children",
":",
"children",
"=",
"[",
"]",
"return",
"children... | Get the children reftrack nodes of the given node
It is the reverse query of :meth:`RefobjInterface.get_parent`
:param refobj: the parent reftrack node
:type refobj: str
:returns: a list with children reftrack nodes
:rtype: list
:raises: None | [
"Get",
"the",
"children",
"reftrack",
"nodes",
"of",
"the",
"given",
"node"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L80-L94 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.get_typ | def get_typ(self, refobj):
"""Return the entity type of the given reftrack node
See: :data:`MayaRefobjInterface.types`.
:param refobj: the reftrack node to query
:type refobj: str
:returns: the entity type
:rtype: str
:raises: ValueError
"""
enum... | python | def get_typ(self, refobj):
"""Return the entity type of the given reftrack node
See: :data:`MayaRefobjInterface.types`.
:param refobj: the reftrack node to query
:type refobj: str
:returns: the entity type
:rtype: str
:raises: ValueError
"""
enum... | [
"def",
"get_typ",
"(",
"self",
",",
"refobj",
")",
":",
"enum",
"=",
"cmds",
".",
"getAttr",
"(",
"\"%s.type\"",
"%",
"refobj",
")",
"try",
":",
"return",
"JB_ReftrackNode",
".",
"types",
"[",
"enum",
"]",
"except",
"IndexError",
":",
"raise",
"ValueErro... | Return the entity type of the given reftrack node
See: :data:`MayaRefobjInterface.types`.
:param refobj: the reftrack node to query
:type refobj: str
:returns: the entity type
:rtype: str
:raises: ValueError | [
"Return",
"the",
"entity",
"type",
"of",
"the",
"given",
"reftrack",
"node"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L96-L112 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.set_typ | def set_typ(self, refobj, typ):
"""Set the type of the given refobj
:param refobj: the reftrack node to edit
:type refobj: refobj
:param typ: the entity type
:type typ: str
:returns: None
:rtype: None
:raises: ValueError
"""
try:
... | python | def set_typ(self, refobj, typ):
"""Set the type of the given refobj
:param refobj: the reftrack node to edit
:type refobj: refobj
:param typ: the entity type
:type typ: str
:returns: None
:rtype: None
:raises: ValueError
"""
try:
... | [
"def",
"set_typ",
"(",
"self",
",",
"refobj",
",",
"typ",
")",
":",
"try",
":",
"enum",
"=",
"JB_ReftrackNode",
".",
"types",
".",
"index",
"(",
"typ",
")",
"except",
"ValueError",
":",
"raise",
"ValueError",
"(",
"\"The given type %s could not be found in ava... | Set the type of the given refobj
:param refobj: the reftrack node to edit
:type refobj: refobj
:param typ: the entity type
:type typ: str
:returns: None
:rtype: None
:raises: ValueError | [
"Set",
"the",
"type",
"of",
"the",
"given",
"refobj"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L114-L129 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.create_refobj | def create_refobj(self, ):
"""Create and return a new reftrack node
:returns: the new reftrack node
:rtype: str
:raises: None
"""
n = cmds.createNode("jb_reftrack")
cmds.lockNode(n, lock=True)
return n | python | def create_refobj(self, ):
"""Create and return a new reftrack node
:returns: the new reftrack node
:rtype: str
:raises: None
"""
n = cmds.createNode("jb_reftrack")
cmds.lockNode(n, lock=True)
return n | [
"def",
"create_refobj",
"(",
"self",
",",
")",
":",
"n",
"=",
"cmds",
".",
"createNode",
"(",
"\"jb_reftrack\"",
")",
"cmds",
".",
"lockNode",
"(",
"n",
",",
"lock",
"=",
"True",
")",
"return",
"n"
] | Create and return a new reftrack node
:returns: the new reftrack node
:rtype: str
:raises: None | [
"Create",
"and",
"return",
"a",
"new",
"reftrack",
"node"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L155-L164 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.referenced_by | def referenced_by(self, refobj):
"""Return the reference that holds the given reftrack node.
Returns None if it is imported/in the current scene.
:param refobj: the reftrack node to query
:type refobj: str
:returns: the reference node that holds the given refobj
:rtype:... | python | def referenced_by(self, refobj):
"""Return the reference that holds the given reftrack node.
Returns None if it is imported/in the current scene.
:param refobj: the reftrack node to query
:type refobj: str
:returns: the reference node that holds the given refobj
:rtype:... | [
"def",
"referenced_by",
"(",
"self",
",",
"refobj",
")",
":",
"try",
":",
"ref",
"=",
"cmds",
".",
"referenceQuery",
"(",
"refobj",
",",
"referenceNode",
"=",
"True",
")",
"return",
"ref",
"except",
"RuntimeError",
"as",
"e",
":",
"if",
"str",
"(",
"e"... | Return the reference that holds the given reftrack node.
Returns None if it is imported/in the current scene.
:param refobj: the reftrack node to query
:type refobj: str
:returns: the reference node that holds the given refobj
:rtype: str | None
:raises: None | [
"Return",
"the",
"reference",
"that",
"holds",
"the",
"given",
"reftrack",
"node",
"."
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L166-L184 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.delete_refobj | def delete_refobj(self, refobj):
"""Delete the given reftrack node
:param refobj: the node to delete
:type refobj: str
:returns: None
:rtype: None
:raises: None
"""
with common.locknode(refobj, lock=False):
cmds.delete(refobj) | python | def delete_refobj(self, refobj):
"""Delete the given reftrack node
:param refobj: the node to delete
:type refobj: str
:returns: None
:rtype: None
:raises: None
"""
with common.locknode(refobj, lock=False):
cmds.delete(refobj) | [
"def",
"delete_refobj",
"(",
"self",
",",
"refobj",
")",
":",
"with",
"common",
".",
"locknode",
"(",
"refobj",
",",
"lock",
"=",
"False",
")",
":",
"cmds",
".",
"delete",
"(",
"refobj",
")"
] | Delete the given reftrack node
:param refobj: the node to delete
:type refobj: str
:returns: None
:rtype: None
:raises: None | [
"Delete",
"the",
"given",
"reftrack",
"node"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L197-L207 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.get_current_element | def get_current_element(self, ):
"""Return the currently open Shot or Asset
:returns: the currently open element
:rtype: :class:`jukeboxcore.djadapter.models.Asset` | :class:`jukeboxcore.djadapter.models.Shot` | None
:raises: :class:`djadapter.models.TaskFile.DoesNotExist`
"""
... | python | def get_current_element(self, ):
"""Return the currently open Shot or Asset
:returns: the currently open element
:rtype: :class:`jukeboxcore.djadapter.models.Asset` | :class:`jukeboxcore.djadapter.models.Shot` | None
:raises: :class:`djadapter.models.TaskFile.DoesNotExist`
"""
... | [
"def",
"get_current_element",
"(",
"self",
",",
")",
":",
"n",
"=",
"jbscene",
".",
"get_current_scene_node",
"(",
")",
"if",
"not",
"n",
":",
"return",
"None",
"tfid",
"=",
"cmds",
".",
"getAttr",
"(",
"\"%s.taskfile_id\"",
"%",
"n",
")",
"try",
":",
... | Return the currently open Shot or Asset
:returns: the currently open element
:rtype: :class:`jukeboxcore.djadapter.models.Asset` | :class:`jukeboxcore.djadapter.models.Shot` | None
:raises: :class:`djadapter.models.TaskFile.DoesNotExist` | [
"Return",
"the",
"currently",
"open",
"Shot",
"or",
"Asset"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L218-L233 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.set_reference | def set_reference(self, refobj, reference):
"""Connect the given reftrack node with the given refernce node
:param refobj: the reftrack node to update
:type refobj: str
:param reference: the reference node
:type reference: str
:returns: None
:rtype: None
... | python | def set_reference(self, refobj, reference):
"""Connect the given reftrack node with the given refernce node
:param refobj: the reftrack node to update
:type refobj: str
:param reference: the reference node
:type reference: str
:returns: None
:rtype: None
... | [
"def",
"set_reference",
"(",
"self",
",",
"refobj",
",",
"reference",
")",
":",
"refnodeattr",
"=",
"\"%s.referencenode\"",
"%",
"refobj",
"if",
"reference",
":",
"cmds",
".",
"connectAttr",
"(",
"\"%s.message\"",
"%",
"reference",
",",
"refnodeattr",
",",
"fo... | Connect the given reftrack node with the given refernce node
:param refobj: the reftrack node to update
:type refobj: str
:param reference: the reference node
:type reference: str
:returns: None
:rtype: None
:raises: None | [
"Connect",
"the",
"given",
"reftrack",
"node",
"with",
"the",
"given",
"refernce",
"node"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L235-L256 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.get_reference | def get_reference(self, refobj):
"""Return the reference node that the reftrack node is connected to or None if it is imported.
:param refobj: the reftrack node to query
:type refobj: str
:returns: the reference node
:rtype: str | None
:raises: None
"""
c... | python | def get_reference(self, refobj):
"""Return the reference node that the reftrack node is connected to or None if it is imported.
:param refobj: the reftrack node to query
:type refobj: str
:returns: the reference node
:rtype: str | None
:raises: None
"""
c... | [
"def",
"get_reference",
"(",
"self",
",",
"refobj",
")",
":",
"c",
"=",
"cmds",
".",
"listConnections",
"(",
"\"%s.referencenode\"",
"%",
"refobj",
",",
"d",
"=",
"False",
")",
"return",
"c",
"[",
"0",
"]",
"if",
"c",
"else",
"None"
] | Return the reference node that the reftrack node is connected to or None if it is imported.
:param refobj: the reftrack node to query
:type refobj: str
:returns: the reference node
:rtype: str | None
:raises: None | [
"Return",
"the",
"reference",
"node",
"that",
"the",
"reftrack",
"node",
"is",
"connected",
"to",
"or",
"None",
"if",
"it",
"is",
"imported",
"."
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L258-L268 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.get_status | def get_status(self, refobj):
"""Return the status of the given reftrack node
See: :data:`Reftrack.LOADED`, :data:`Reftrack.UNLOADED`, :data:`Reftrack.IMPORTED`.
:param refobj: the reftrack node to query
:type refobj: str
:returns: the status of the given reftrack node
... | python | def get_status(self, refobj):
"""Return the status of the given reftrack node
See: :data:`Reftrack.LOADED`, :data:`Reftrack.UNLOADED`, :data:`Reftrack.IMPORTED`.
:param refobj: the reftrack node to query
:type refobj: str
:returns: the status of the given reftrack node
... | [
"def",
"get_status",
"(",
"self",
",",
"refobj",
")",
":",
"reference",
"=",
"self",
".",
"get_reference",
"(",
"refobj",
")",
"return",
"Reftrack",
".",
"IMPORTED",
"if",
"not",
"reference",
"else",
"Reftrack",
".",
"LOADED",
"if",
"cmds",
".",
"reference... | Return the status of the given reftrack node
See: :data:`Reftrack.LOADED`, :data:`Reftrack.UNLOADED`, :data:`Reftrack.IMPORTED`.
:param refobj: the reftrack node to query
:type refobj: str
:returns: the status of the given reftrack node
:rtype: str
:raises: None | [
"Return",
"the",
"status",
"of",
"the",
"given",
"reftrack",
"node"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L270-L282 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.get_taskfile | def get_taskfile(self, refobj):
"""Return the taskfile that is loaded and represented by the refobj
:param refobj: the reftrack node to query
:type refobj: str
:returns: The taskfile that is loaded in the scene
:rtype: :class:`jukeboxcore.djadapter.TaskFile`
:raises: Non... | python | def get_taskfile(self, refobj):
"""Return the taskfile that is loaded and represented by the refobj
:param refobj: the reftrack node to query
:type refobj: str
:returns: The taskfile that is loaded in the scene
:rtype: :class:`jukeboxcore.djadapter.TaskFile`
:raises: Non... | [
"def",
"get_taskfile",
"(",
"self",
",",
"refobj",
")",
":",
"tfid",
"=",
"cmds",
".",
"getAttr",
"(",
"\"%s.taskfile_id\"",
"%",
"refobj",
")",
"try",
":",
"return",
"djadapter",
".",
"taskfiles",
".",
"get",
"(",
"pk",
"=",
"tfid",
")",
"except",
"dj... | Return the taskfile that is loaded and represented by the refobj
:param refobj: the reftrack node to query
:type refobj: str
:returns: The taskfile that is loaded in the scene
:rtype: :class:`jukeboxcore.djadapter.TaskFile`
:raises: None | [
"Return",
"the",
"taskfile",
"that",
"is",
"loaded",
"and",
"represented",
"by",
"the",
"refobj"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L284-L297 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/refobjinter.py | MayaRefobjInterface.connect_reftrack_scenenode | def connect_reftrack_scenenode(self, refobj, scenenode):
"""Connect the given reftrack node with the given scene node
:param refobj: the reftrack node to connect
:type refobj: str
:param scenenode: the jb_sceneNode to connect
:type scenenode: str
:returns: None
:... | python | def connect_reftrack_scenenode(self, refobj, scenenode):
"""Connect the given reftrack node with the given scene node
:param refobj: the reftrack node to connect
:type refobj: str
:param scenenode: the jb_sceneNode to connect
:type scenenode: str
:returns: None
:... | [
"def",
"connect_reftrack_scenenode",
"(",
"self",
",",
"refobj",
",",
"scenenode",
")",
":",
"conns",
"=",
"[",
"(",
"\"%s.scenenode\"",
"%",
"refobj",
",",
"\"%s.reftrack\"",
"%",
"scenenode",
")",
",",
"(",
"\"%s.taskfile_id\"",
"%",
"scenenode",
",",
"\"%s.... | Connect the given reftrack node with the given scene node
:param refobj: the reftrack node to connect
:type refobj: str
:param scenenode: the jb_sceneNode to connect
:type scenenode: str
:returns: None
:rtype: None
:raises: None | [
"Connect",
"the",
"given",
"reftrack",
"node",
"with",
"the",
"given",
"scene",
"node"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/refobjinter.py#L299-L314 | train |
sirfoga/pyhal | hal/internet/engines.py | SearchEngine.get_search_page | def get_search_page(self, query):
"""Gets HTML source
:param query: query to search engine
:return: HTML source of search page of given query
"""
query_web_page = Webpage(self.url + self.parse_query(query))
query_web_page.get_html_source() # get html source
retu... | python | def get_search_page(self, query):
"""Gets HTML source
:param query: query to search engine
:return: HTML source of search page of given query
"""
query_web_page = Webpage(self.url + self.parse_query(query))
query_web_page.get_html_source() # get html source
retu... | [
"def",
"get_search_page",
"(",
"self",
",",
"query",
")",
":",
"query_web_page",
"=",
"Webpage",
"(",
"self",
".",
"url",
"+",
"self",
".",
"parse_query",
"(",
"query",
")",
")",
"query_web_page",
".",
"get_html_source",
"(",
")",
"return",
"query_web_page",... | Gets HTML source
:param query: query to search engine
:return: HTML source of search page of given query | [
"Gets",
"HTML",
"source"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/internet/engines.py#L51-L59 | train |
klahnakoski/mo-logs | mo_logs/constants.py | set | def set(constants):
"""
REACH INTO THE MODULES AND OBJECTS TO SET CONSTANTS.
THINK OF THIS AS PRIMITIVE DEPENDENCY INJECTION FOR MODULES.
USEFUL FOR SETTING DEBUG FLAGS.
"""
if not constants:
return
constants = wrap(constants)
for k, new_value in constants.leaves():
erro... | python | def set(constants):
"""
REACH INTO THE MODULES AND OBJECTS TO SET CONSTANTS.
THINK OF THIS AS PRIMITIVE DEPENDENCY INJECTION FOR MODULES.
USEFUL FOR SETTING DEBUG FLAGS.
"""
if not constants:
return
constants = wrap(constants)
for k, new_value in constants.leaves():
erro... | [
"def",
"set",
"(",
"constants",
")",
":",
"if",
"not",
"constants",
":",
"return",
"constants",
"=",
"wrap",
"(",
"constants",
")",
"for",
"k",
",",
"new_value",
"in",
"constants",
".",
"leaves",
"(",
")",
":",
"errors",
"=",
"[",
"]",
"try",
":",
... | REACH INTO THE MODULES AND OBJECTS TO SET CONSTANTS.
THINK OF THIS AS PRIMITIVE DEPENDENCY INJECTION FOR MODULES.
USEFUL FOR SETTING DEBUG FLAGS. | [
"REACH",
"INTO",
"THE",
"MODULES",
"AND",
"OBJECTS",
"TO",
"SET",
"CONSTANTS",
".",
"THINK",
"OF",
"THIS",
"AS",
"PRIMITIVE",
"DEPENDENCY",
"INJECTION",
"FOR",
"MODULES",
".",
"USEFUL",
"FOR",
"SETTING",
"DEBUG",
"FLAGS",
"."
] | 0971277ac9caf28a755b766b70621916957d4fea | https://github.com/klahnakoski/mo-logs/blob/0971277ac9caf28a755b766b70621916957d4fea/mo_logs/constants.py#L19-L70 | train |
portfors-lab/sparkle | sparkle/gui/plotting/raster_bounds_dlg.py | RasterBoundsDialog.values | def values(self):
"""Gets the user enter max and min values of where the
raster points should appear on the y-axis
:returns: (float, float) -- (min, max) y-values to bound the raster plot by
"""
lower = float(self.lowerSpnbx.value())
upper = float(self.upperSpnbx.value(... | python | def values(self):
"""Gets the user enter max and min values of where the
raster points should appear on the y-axis
:returns: (float, float) -- (min, max) y-values to bound the raster plot by
"""
lower = float(self.lowerSpnbx.value())
upper = float(self.upperSpnbx.value(... | [
"def",
"values",
"(",
"self",
")",
":",
"lower",
"=",
"float",
"(",
"self",
".",
"lowerSpnbx",
".",
"value",
"(",
")",
")",
"upper",
"=",
"float",
"(",
"self",
".",
"upperSpnbx",
".",
"value",
"(",
")",
")",
"return",
"(",
"lower",
",",
"upper",
... | Gets the user enter max and min values of where the
raster points should appear on the y-axis
:returns: (float, float) -- (min, max) y-values to bound the raster plot by | [
"Gets",
"the",
"user",
"enter",
"max",
"and",
"min",
"values",
"of",
"where",
"the",
"raster",
"points",
"should",
"appear",
"on",
"the",
"y",
"-",
"axis"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/raster_bounds_dlg.py#L16-L24 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/menu.py | Menu._delete | def _delete(self, ):
""" Delete the menu and remove it from parent
Deletes all children, so they do not reference to this instance and it can be garbage collected.
Sets parent to None, so parent is also garbage collectable
This has proven to be very unreliable. so we delete the menu fr... | python | def _delete(self, ):
""" Delete the menu and remove it from parent
Deletes all children, so they do not reference to this instance and it can be garbage collected.
Sets parent to None, so parent is also garbage collectable
This has proven to be very unreliable. so we delete the menu fr... | [
"def",
"_delete",
"(",
"self",
",",
")",
":",
"for",
"k",
"in",
"self",
".",
"keys",
"(",
")",
":",
"try",
":",
"self",
"[",
"k",
"]",
".",
"_delete",
"(",
")",
"except",
"KeyError",
":",
"pass",
"if",
"self",
".",
"__parent",
"is",
"not",
"Non... | Delete the menu and remove it from parent
Deletes all children, so they do not reference to this instance and it can be garbage collected.
Sets parent to None, so parent is also garbage collectable
This has proven to be very unreliable. so we delete the menu from the parent manually too.
... | [
"Delete",
"the",
"menu",
"and",
"remove",
"it",
"from",
"parent"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/menu.py#L91-L111 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/menu.py | MenuManager.create_menu | def create_menu(self, name, parent=None, **kwargs):
""" Creates a maya menu or menu item
:param name: Used to access a menu via its parent. Unless the nolabel flag is set to True, the name will also become the label of the menu.
:type name: str
:param parent: Optional - The parent menu.... | python | def create_menu(self, name, parent=None, **kwargs):
""" Creates a maya menu or menu item
:param name: Used to access a menu via its parent. Unless the nolabel flag is set to True, the name will also become the label of the menu.
:type name: str
:param parent: Optional - The parent menu.... | [
"def",
"create_menu",
"(",
"self",
",",
"name",
",",
"parent",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"m",
"=",
"Menu",
"(",
"name",
",",
"parent",
",",
"**",
"kwargs",
")",
"if",
"parent",
"is",
"None",
":",
"self",
".",
"menus",
"[",
"name... | Creates a maya menu or menu item
:param name: Used to access a menu via its parent. Unless the nolabel flag is set to True, the name will also become the label of the menu.
:type name: str
:param parent: Optional - The parent menu. If None, this will create a toplevel menu. If parent menu is a ... | [
"Creates",
"a",
"maya",
"menu",
"or",
"menu",
"item"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/menu.py#L188-L206 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/menu.py | MenuManager.delete_menu | def delete_menu(self, menu):
""" Delete the specified menu
:param menu:
:type menu:
:returns:
:rtype:
:raises:
"""
if menu.parent is None:
del self.menus[menu.name()]
menu._delete() | python | def delete_menu(self, menu):
""" Delete the specified menu
:param menu:
:type menu:
:returns:
:rtype:
:raises:
"""
if menu.parent is None:
del self.menus[menu.name()]
menu._delete() | [
"def",
"delete_menu",
"(",
"self",
",",
"menu",
")",
":",
"if",
"menu",
".",
"parent",
"is",
"None",
":",
"del",
"self",
".",
"menus",
"[",
"menu",
".",
"name",
"(",
")",
"]",
"menu",
".",
"_delete",
"(",
")"
] | Delete the specified menu
:param menu:
:type menu:
:returns:
:rtype:
:raises: | [
"Delete",
"the",
"specified",
"menu"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/menu.py#L208-L219 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/menu.py | MenuManager.delete_all_menus | def delete_all_menus(self, ):
""" Delete all menues managed by this manager
:returns: None
:rtype: None
:raises: None
"""
for m in self.menus.itervalues():
m._delete()
self.menus.clear() | python | def delete_all_menus(self, ):
""" Delete all menues managed by this manager
:returns: None
:rtype: None
:raises: None
"""
for m in self.menus.itervalues():
m._delete()
self.menus.clear() | [
"def",
"delete_all_menus",
"(",
"self",
",",
")",
":",
"for",
"m",
"in",
"self",
".",
"menus",
".",
"itervalues",
"(",
")",
":",
"m",
".",
"_delete",
"(",
")",
"self",
".",
"menus",
".",
"clear",
"(",
")"
] | Delete all menues managed by this manager
:returns: None
:rtype: None
:raises: None | [
"Delete",
"all",
"menues",
"managed",
"by",
"this",
"manager"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/menu.py#L221-L230 | train |
ClearcodeHQ/matchbox | src/matchbox/index.py | MatchIndex.add_mismatch | def add_mismatch(self, entity, *traits):
"""
Add a mismatching entity to the index.
We do this by simply adding the mismatch to the index.
:param collections.Hashable entity: an object to be mismatching the values of `traits_indexed_by`
:param list traits: a list of hashable tr... | python | def add_mismatch(self, entity, *traits):
"""
Add a mismatching entity to the index.
We do this by simply adding the mismatch to the index.
:param collections.Hashable entity: an object to be mismatching the values of `traits_indexed_by`
:param list traits: a list of hashable tr... | [
"def",
"add_mismatch",
"(",
"self",
",",
"entity",
",",
"*",
"traits",
")",
":",
"for",
"trait",
"in",
"traits",
":",
"self",
".",
"index",
"[",
"trait",
"]",
".",
"add",
"(",
"entity",
")"
] | Add a mismatching entity to the index.
We do this by simply adding the mismatch to the index.
:param collections.Hashable entity: an object to be mismatching the values of `traits_indexed_by`
:param list traits: a list of hashable traits to index the entity with | [
"Add",
"a",
"mismatching",
"entity",
"to",
"the",
"index",
"."
] | 22f5bd163ad22ceacb0fcd5d4ddae9069d1a94f4 | https://github.com/ClearcodeHQ/matchbox/blob/22f5bd163ad22ceacb0fcd5d4ddae9069d1a94f4/src/matchbox/index.py#L141-L151 | train |
ClearcodeHQ/matchbox | src/matchbox/index.py | MatchIndex.add_match | def add_match(self, entity, *traits):
"""
Add a matching entity to the index.
We have to maintain the constraints of the data layout:
- `self.mismatch_unknown` must still contain all matched entities
- each key of the index must mismatch all known matching entities excep... | python | def add_match(self, entity, *traits):
"""
Add a matching entity to the index.
We have to maintain the constraints of the data layout:
- `self.mismatch_unknown` must still contain all matched entities
- each key of the index must mismatch all known matching entities excep... | [
"def",
"add_match",
"(",
"self",
",",
"entity",
",",
"*",
"traits",
")",
":",
"for",
"trait",
"in",
"traits",
":",
"if",
"trait",
"not",
"in",
"self",
".",
"index",
":",
"self",
".",
"index",
"[",
"trait",
"]",
"=",
"self",
".",
"mismatch_unknown",
... | Add a matching entity to the index.
We have to maintain the constraints of the data layout:
- `self.mismatch_unknown` must still contain all matched entities
- each key of the index must mismatch all known matching entities except those this particular key
explicitly inclu... | [
"Add",
"a",
"matching",
"entity",
"to",
"the",
"index",
"."
] | 22f5bd163ad22ceacb0fcd5d4ddae9069d1a94f4 | https://github.com/ClearcodeHQ/matchbox/blob/22f5bd163ad22ceacb0fcd5d4ddae9069d1a94f4/src/matchbox/index.py#L153-L180 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | hist_axis_func | def hist_axis_func(axis_type: enum.Enum) -> Callable[[Hist], Axis]:
""" Wrapper to retrieve the axis of a given histogram.
This can be convenient outside of just projections, so it's made available in the API.
Args:
axis_type: The type of axis to retrieve.
Returns:
Callable to retrieve... | python | def hist_axis_func(axis_type: enum.Enum) -> Callable[[Hist], Axis]:
""" Wrapper to retrieve the axis of a given histogram.
This can be convenient outside of just projections, so it's made available in the API.
Args:
axis_type: The type of axis to retrieve.
Returns:
Callable to retrieve... | [
"def",
"hist_axis_func",
"(",
"axis_type",
":",
"enum",
".",
"Enum",
")",
"->",
"Callable",
"[",
"[",
"Hist",
"]",
",",
"Axis",
"]",
":",
"def",
"axis_func",
"(",
"hist",
":",
"Hist",
")",
"->",
"Axis",
":",
"try",
":",
"hist_axis_type",
"=",
"axis_t... | Wrapper to retrieve the axis of a given histogram.
This can be convenient outside of just projections, so it's made available in the API.
Args:
axis_type: The type of axis to retrieve.
Returns:
Callable to retrieve the specified axis when given a hist. | [
"Wrapper",
"to",
"retrieve",
"the",
"axis",
"of",
"a",
"given",
"histogram",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L29-L77 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistAxisRange.axis | def axis(self) -> Callable[[Any], Any]:
""" Determine the axis to return based on the hist type. """
axis_func = hist_axis_func(
axis_type = self.axis_type
)
return axis_func | python | def axis(self) -> Callable[[Any], Any]:
""" Determine the axis to return based on the hist type. """
axis_func = hist_axis_func(
axis_type = self.axis_type
)
return axis_func | [
"def",
"axis",
"(",
"self",
")",
"->",
"Callable",
"[",
"[",
"Any",
"]",
",",
"Any",
"]",
":",
"axis_func",
"=",
"hist_axis_func",
"(",
"axis_type",
"=",
"self",
".",
"axis_type",
")",
"return",
"axis_func"
] | Determine the axis to return based on the hist type. | [
"Determine",
"the",
"axis",
"to",
"return",
"based",
"on",
"the",
"hist",
"type",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L116-L121 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistAxisRange.apply_range_set | def apply_range_set(self, hist: Hist) -> None:
""" Apply the associated range set to the axis of a given hist.
Note:
The min and max values should be bins, not user ranges! For more, see the binning
explanation in ``apply_func_to_find_bin(...)``.
Args:
hist:... | python | def apply_range_set(self, hist: Hist) -> None:
""" Apply the associated range set to the axis of a given hist.
Note:
The min and max values should be bins, not user ranges! For more, see the binning
explanation in ``apply_func_to_find_bin(...)``.
Args:
hist:... | [
"def",
"apply_range_set",
"(",
"self",
",",
"hist",
":",
"Hist",
")",
"->",
"None",
":",
"axis",
"=",
"self",
".",
"axis",
"(",
"hist",
")",
"assert",
"not",
"isinstance",
"(",
"self",
".",
"min_val",
",",
"float",
")",
"assert",
"not",
"isinstance",
... | Apply the associated range set to the axis of a given hist.
Note:
The min and max values should be bins, not user ranges! For more, see the binning
explanation in ``apply_func_to_find_bin(...)``.
Args:
hist: Histogram to which the axis range restriction should be ap... | [
"Apply",
"the",
"associated",
"range",
"set",
"to",
"the",
"axis",
"of",
"a",
"given",
"hist",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L123-L147 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistAxisRange.apply_func_to_find_bin | def apply_func_to_find_bin(
func: Union[None, Callable[..., Union[float, int, Any]]],
values: Optional[float] = None
) -> Callable[[Any], Union[float, int]]:
""" Closure to determine the bin associated with a value on an axis.
It can apply a function to an axis if necessary to deter... | python | def apply_func_to_find_bin(
func: Union[None, Callable[..., Union[float, int, Any]]],
values: Optional[float] = None
) -> Callable[[Any], Union[float, int]]:
""" Closure to determine the bin associated with a value on an axis.
It can apply a function to an axis if necessary to deter... | [
"def",
"apply_func_to_find_bin",
"(",
"func",
":",
"Union",
"[",
"None",
",",
"Callable",
"[",
"...",
",",
"Union",
"[",
"float",
",",
"int",
",",
"Any",
"]",
"]",
"]",
",",
"values",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
")",
"->",
"Cal... | Closure to determine the bin associated with a value on an axis.
It can apply a function to an axis if necessary to determine the proper bin. Otherwise,
it can just return a stored value.
Note:
To properly determine the value, carefully note the information below. In many cases,
... | [
"Closure",
"to",
"determine",
"the",
"bin",
"associated",
"with",
"a",
"value",
"on",
"an",
"axis",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L150-L203 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistProjector.call_projection_function | def call_projection_function(self, hist: Hist) -> Hist:
""" Calls the actual projection function for the hist.
Args:
hist: Histogram from which the projections should be performed.
Returns:
The projected histogram.
"""
# Restrict projection axis ranges
... | python | def call_projection_function(self, hist: Hist) -> Hist:
""" Calls the actual projection function for the hist.
Args:
hist: Histogram from which the projections should be performed.
Returns:
The projected histogram.
"""
# Restrict projection axis ranges
... | [
"def",
"call_projection_function",
"(",
"self",
",",
"hist",
":",
"Hist",
")",
"->",
"Hist",
":",
"for",
"axis",
"in",
"self",
".",
"projection_axes",
":",
"logger",
".",
"debug",
"(",
"f\"Apply projection axes hist range: {axis.name}\"",
")",
"axis",
".",
"appl... | Calls the actual projection function for the hist.
Args:
hist: Histogram from which the projections should be performed.
Returns:
The projected histogram. | [
"Calls",
"the",
"actual",
"projection",
"function",
"for",
"the",
"hist",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L314-L343 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistProjector._project_THn | def _project_THn(self, hist: Hist) -> Any:
""" Perform the actual THn -> THn or TH1 projection.
This projection could be to 1D, 2D, 3D, or ND.
Args:
hist (ROOT.THnBase): Histogram from which the projections should be performed.
Returns:
ROOT.THnBase or ROOT.TH1:... | python | def _project_THn(self, hist: Hist) -> Any:
""" Perform the actual THn -> THn or TH1 projection.
This projection could be to 1D, 2D, 3D, or ND.
Args:
hist (ROOT.THnBase): Histogram from which the projections should be performed.
Returns:
ROOT.THnBase or ROOT.TH1:... | [
"def",
"_project_THn",
"(",
"self",
",",
"hist",
":",
"Hist",
")",
"->",
"Any",
":",
"projection_axes",
"=",
"[",
"axis",
".",
"axis_type",
".",
"value",
"for",
"axis",
"in",
"self",
".",
"projection_axes",
"]",
"if",
"len",
"(",
"projection_axes",
")",
... | Perform the actual THn -> THn or TH1 projection.
This projection could be to 1D, 2D, 3D, or ND.
Args:
hist (ROOT.THnBase): Histogram from which the projections should be performed.
Returns:
ROOT.THnBase or ROOT.TH1: The projected histogram. | [
"Perform",
"the",
"actual",
"THn",
"-",
">",
"THn",
"or",
"TH1",
"projection",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L345-L378 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistProjector._project_TH3 | def _project_TH3(self, hist: Hist) -> Any:
""" Perform the actual TH3 -> TH1 projection.
This projection could be to 1D or 2D.
Args:
hist (ROOT.TH3): Histogram from which the projections should be performed.
Returns:
ROOT.TH1: The projected histogram.
""... | python | def _project_TH3(self, hist: Hist) -> Any:
""" Perform the actual TH3 -> TH1 projection.
This projection could be to 1D or 2D.
Args:
hist (ROOT.TH3): Histogram from which the projections should be performed.
Returns:
ROOT.TH1: The projected histogram.
""... | [
"def",
"_project_TH3",
"(",
"self",
",",
"hist",
":",
"Hist",
")",
"->",
"Any",
":",
"if",
"len",
"(",
"self",
".",
"projection_axes",
")",
"<",
"1",
"or",
"len",
"(",
"self",
".",
"projection_axes",
")",
">",
"2",
":",
"raise",
"ValueError",
"(",
... | Perform the actual TH3 -> TH1 projection.
This projection could be to 1D or 2D.
Args:
hist (ROOT.TH3): Histogram from which the projections should be performed.
Returns:
ROOT.TH1: The projected histogram. | [
"Perform",
"the",
"actual",
"TH3",
"-",
">",
"TH1",
"projection",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L380-L420 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistProjector._project_TH2 | def _project_TH2(self, hist: Hist) -> Any:
""" Perform the actual TH2 -> TH1 projection.
This projection can only be to 1D.
Args:
hist (ROOT.TH2): Histogram from which the projections should be performed.
Returns:
ROOT.TH1: The projected histogram.
"""
... | python | def _project_TH2(self, hist: Hist) -> Any:
""" Perform the actual TH2 -> TH1 projection.
This projection can only be to 1D.
Args:
hist (ROOT.TH2): Histogram from which the projections should be performed.
Returns:
ROOT.TH1: The projected histogram.
"""
... | [
"def",
"_project_TH2",
"(",
"self",
",",
"hist",
":",
"Hist",
")",
"->",
"Any",
":",
"if",
"len",
"(",
"self",
".",
"projection_axes",
")",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"len",
"(",
"self",
".",
"projection_axes",
")",
",",
"\"Invalid num... | Perform the actual TH2 -> TH1 projection.
This projection can only be to 1D.
Args:
hist (ROOT.TH2): Histogram from which the projections should be performed.
Returns:
ROOT.TH1: The projected histogram. | [
"Perform",
"the",
"actual",
"TH2",
"-",
">",
"TH1",
"projection",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L422-L461 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistProjector._project_observable | def _project_observable(self, input_key: str,
input_observable: Any,
get_hist_args: Dict[str, Any] = None,
projection_name_args: Dict[str, Any] = None,
**kwargs) -> Hist:
""" Perform a projection for ... | python | def _project_observable(self, input_key: str,
input_observable: Any,
get_hist_args: Dict[str, Any] = None,
projection_name_args: Dict[str, Any] = None,
**kwargs) -> Hist:
""" Perform a projection for ... | [
"def",
"_project_observable",
"(",
"self",
",",
"input_key",
":",
"str",
",",
"input_observable",
":",
"Any",
",",
"get_hist_args",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
"=",
"None",
",",
"projection_name_args",
":",
"Dict",
"[",
"str",
",",
"Any",
"... | Perform a projection for a single observable.
Note:
All cuts on the original histograms will be reset when this function is completed.
Args:
input_key: Key to describe the input observable.
input_observable: Observable to project from.
get_hist_args: Arg... | [
"Perform",
"a",
"projection",
"for",
"a",
"single",
"observable",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L463-L570 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistProjector._project_single_observable | def _project_single_observable(self, **kwargs: Dict[str, Any]) -> Hist:
""" Driver function for projecting and storing a single observable.
Args:
kwargs (dict): Additional named args to be passed to projection_name(...) and output_key_name(...)
Returns:
The projected his... | python | def _project_single_observable(self, **kwargs: Dict[str, Any]) -> Hist:
""" Driver function for projecting and storing a single observable.
Args:
kwargs (dict): Additional named args to be passed to projection_name(...) and output_key_name(...)
Returns:
The projected his... | [
"def",
"_project_single_observable",
"(",
"self",
",",
"**",
"kwargs",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Hist",
":",
"assert",
"isinstance",
"(",
"self",
".",
"output_attribute_name",
",",
"str",
")",
"output_hist",
",",
"projection_name"... | Driver function for projecting and storing a single observable.
Args:
kwargs (dict): Additional named args to be passed to projection_name(...) and output_key_name(...)
Returns:
The projected histogram. The histogram is also stored in the output specified by ``output_observable`... | [
"Driver",
"function",
"for",
"projecting",
"and",
"storing",
"a",
"single",
"observable",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L572-L606 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistProjector._project_dict | def _project_dict(self, **kwargs: Dict[str, Any]) -> Dict[str, Hist]:
""" Driver function for projecting and storing a dictionary of observables.
Args:
kwargs (dict): Additional named args to be passed to projection_name(...) and output_key_name(...)
Returns:
The project... | python | def _project_dict(self, **kwargs: Dict[str, Any]) -> Dict[str, Hist]:
""" Driver function for projecting and storing a dictionary of observables.
Args:
kwargs (dict): Additional named args to be passed to projection_name(...) and output_key_name(...)
Returns:
The project... | [
"def",
"_project_dict",
"(",
"self",
",",
"**",
"kwargs",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"Hist",
"]",
":",
"get_hist_args",
"=",
"copy",
".",
"deepcopy",
"(",
"kwargs",
")",
"projection_name_args",
"=",
... | Driver function for projecting and storing a dictionary of observables.
Args:
kwargs (dict): Additional named args to be passed to projection_name(...) and output_key_name(...)
Returns:
The projected histograms. The projected histograms are also stored in ``output_observable``. | [
"Driver",
"function",
"for",
"projecting",
"and",
"storing",
"a",
"dictionary",
"of",
"observables",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L608-L637 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistProjector.cleanup_cuts | def cleanup_cuts(self, hist: Hist, cut_axes: Iterable[HistAxisRange]) -> None:
""" Cleanup applied cuts by resetting the axis to the full range.
Inspired by: https://github.com/matplo/rootutils/blob/master/python/2.7/THnSparseWrapper.py
Args:
hist: Histogram for which the axes shou... | python | def cleanup_cuts(self, hist: Hist, cut_axes: Iterable[HistAxisRange]) -> None:
""" Cleanup applied cuts by resetting the axis to the full range.
Inspired by: https://github.com/matplo/rootutils/blob/master/python/2.7/THnSparseWrapper.py
Args:
hist: Histogram for which the axes shou... | [
"def",
"cleanup_cuts",
"(",
"self",
",",
"hist",
":",
"Hist",
",",
"cut_axes",
":",
"Iterable",
"[",
"HistAxisRange",
"]",
")",
"->",
"None",
":",
"for",
"axis",
"in",
"cut_axes",
":",
"axis",
".",
"axis",
"(",
"hist",
")",
".",
"SetRange",
"(",
"1",... | Cleanup applied cuts by resetting the axis to the full range.
Inspired by: https://github.com/matplo/rootutils/blob/master/python/2.7/THnSparseWrapper.py
Args:
hist: Histogram for which the axes should be reset.
cut_axes: List of axis cuts, which correspond to axes that should ... | [
"Cleanup",
"applied",
"cuts",
"by",
"resetting",
"the",
"axis",
"to",
"the",
"full",
"range",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L655-L667 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistProjector.projection_name | def projection_name(self, **kwargs: Dict[str, Any]) -> str:
""" Define the projection name for this projector.
Note:
This function is just a basic placeholder and likely should be overridden.
Args:
kwargs: Projection information dict combined with additional arguments p... | python | def projection_name(self, **kwargs: Dict[str, Any]) -> str:
""" Define the projection name for this projector.
Note:
This function is just a basic placeholder and likely should be overridden.
Args:
kwargs: Projection information dict combined with additional arguments p... | [
"def",
"projection_name",
"(",
"self",
",",
"**",
"kwargs",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"str",
":",
"return",
"self",
".",
"projection_name_format",
".",
"format",
"(",
"**",
"kwargs",
")"
] | Define the projection name for this projector.
Note:
This function is just a basic placeholder and likely should be overridden.
Args:
kwargs: Projection information dict combined with additional arguments passed to the
projection function.
Returns:
... | [
"Define",
"the",
"projection",
"name",
"for",
"this",
"projector",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L672-L685 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistProjector.get_hist | def get_hist(self, observable: Any, **kwargs: Dict[str, Any]) -> Any:
""" Get the histogram that may be stored in some object.
This histogram is used to project from.
Note:
The output object could just be the raw ROOT histogram.
Note:
This function is just a ba... | python | def get_hist(self, observable: Any, **kwargs: Dict[str, Any]) -> Any:
""" Get the histogram that may be stored in some object.
This histogram is used to project from.
Note:
The output object could just be the raw ROOT histogram.
Note:
This function is just a ba... | [
"def",
"get_hist",
"(",
"self",
",",
"observable",
":",
"Any",
",",
"**",
"kwargs",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Any",
":",
"return",
"observable"
] | Get the histogram that may be stored in some object.
This histogram is used to project from.
Note:
The output object could just be the raw ROOT histogram.
Note:
This function is just a basic placeholder and likely should be overridden.
Args:
observ... | [
"Get",
"the",
"histogram",
"that",
"may",
"be",
"stored",
"in",
"some",
"object",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L687-L705 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistProjector.output_key_name | def output_key_name(self, input_key: str, output_hist: Hist, projection_name: str, **kwargs) -> str:
""" Returns the key under which the output object should be stored.
Note:
This function is just a basic placeholder which returns the projection name
and likely should be overrid... | python | def output_key_name(self, input_key: str, output_hist: Hist, projection_name: str, **kwargs) -> str:
""" Returns the key under which the output object should be stored.
Note:
This function is just a basic placeholder which returns the projection name
and likely should be overrid... | [
"def",
"output_key_name",
"(",
"self",
",",
"input_key",
":",
"str",
",",
"output_hist",
":",
"Hist",
",",
"projection_name",
":",
"str",
",",
"**",
"kwargs",
")",
"->",
"str",
":",
"return",
"projection_name"
] | Returns the key under which the output object should be stored.
Note:
This function is just a basic placeholder which returns the projection name
and likely should be overridden.
Args:
input_key: Key of the input hist in the input dict
output_hist: The o... | [
"Returns",
"the",
"key",
"under",
"which",
"the",
"output",
"object",
"should",
"be",
"stored",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L707-L724 | train |
raymondEhlers/pachyderm | pachyderm/projectors.py | HistProjector.output_hist | def output_hist(self, output_hist: Hist, input_observable: Any, **kwargs: Dict[str, Any]) -> Union[Hist, Any]:
""" Return an output object. It should store the ``output_hist``.
Note:
The output object could just be the raw histogram.
Note:
This function is just a basic ... | python | def output_hist(self, output_hist: Hist, input_observable: Any, **kwargs: Dict[str, Any]) -> Union[Hist, Any]:
""" Return an output object. It should store the ``output_hist``.
Note:
The output object could just be the raw histogram.
Note:
This function is just a basic ... | [
"def",
"output_hist",
"(",
"self",
",",
"output_hist",
":",
"Hist",
",",
"input_observable",
":",
"Any",
",",
"**",
"kwargs",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Union",
"[",
"Hist",
",",
"Any",
"]",
":",
"return",
"output_hist"
] | Return an output object. It should store the ``output_hist``.
Note:
The output object could just be the raw histogram.
Note:
This function is just a basic placeholder which returns the given output object (a histogram)
and likely should be overridden.
Args:... | [
"Return",
"an",
"output",
"object",
".",
"It",
"should",
"store",
"the",
"output_hist",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/projectors.py#L726-L746 | train |
lsst-sqre/sqre-codekit | codekit/cli/github_mv_repos_to_team.py | run | def run():
"""Move the repos"""
args = parse_args()
codetools.setup_logging(args.debug)
global g
g = pygithub.login_github(token_path=args.token_path, token=args.token)
org = g.get_organization(args.org)
# only iterate over all teams once
try:
teams = list(org.get_teams())
... | python | def run():
"""Move the repos"""
args = parse_args()
codetools.setup_logging(args.debug)
global g
g = pygithub.login_github(token_path=args.token_path, token=args.token)
org = g.get_organization(args.org)
# only iterate over all teams once
try:
teams = list(org.get_teams())
... | [
"def",
"run",
"(",
")",
":",
"args",
"=",
"parse_args",
"(",
")",
"codetools",
".",
"setup_logging",
"(",
"args",
".",
"debug",
")",
"global",
"g",
"g",
"=",
"pygithub",
".",
"login_github",
"(",
"token_path",
"=",
"args",
".",
"token_path",
",",
"toke... | Move the repos | [
"Move",
"the",
"repos"
] | 98122404cd9065d4d1d570867fe518042669126c | https://github.com/lsst-sqre/sqre-codekit/blob/98122404cd9065d4d1d570867fe518042669126c/codekit/cli/github_mv_repos_to_team.py#L91-L163 | train |
yamcs/yamcs-python | yamcs-client/examples/parameter_subscription.py | poll_values | def poll_values():
"""Shows how to poll values from the subscription."""
subscription = processor.create_parameter_subscription([
'/YSS/SIMULATOR/BatteryVoltage1'
])
sleep(5)
print('Latest value:')
print(subscription.get_value('/YSS/SIMULATOR/BatteryVoltage1'))
sleep(5)
print('... | python | def poll_values():
"""Shows how to poll values from the subscription."""
subscription = processor.create_parameter_subscription([
'/YSS/SIMULATOR/BatteryVoltage1'
])
sleep(5)
print('Latest value:')
print(subscription.get_value('/YSS/SIMULATOR/BatteryVoltage1'))
sleep(5)
print('... | [
"def",
"poll_values",
"(",
")",
":",
"subscription",
"=",
"processor",
".",
"create_parameter_subscription",
"(",
"[",
"'/YSS/SIMULATOR/BatteryVoltage1'",
"]",
")",
"sleep",
"(",
"5",
")",
"print",
"(",
"'Latest value:'",
")",
"print",
"(",
"subscription",
".",
... | Shows how to poll values from the subscription. | [
"Shows",
"how",
"to",
"poll",
"values",
"from",
"the",
"subscription",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/examples/parameter_subscription.py#L8-L20 | train |
yamcs/yamcs-python | yamcs-client/examples/parameter_subscription.py | receive_callbacks | def receive_callbacks():
"""Shows how to receive callbacks on value updates."""
def print_data(data):
for parameter in data.parameters:
print(parameter)
processor.create_parameter_subscription('/YSS/SIMULATOR/BatteryVoltage1',
on_data=print_da... | python | def receive_callbacks():
"""Shows how to receive callbacks on value updates."""
def print_data(data):
for parameter in data.parameters:
print(parameter)
processor.create_parameter_subscription('/YSS/SIMULATOR/BatteryVoltage1',
on_data=print_da... | [
"def",
"receive_callbacks",
"(",
")",
":",
"def",
"print_data",
"(",
"data",
")",
":",
"for",
"parameter",
"in",
"data",
".",
"parameters",
":",
"print",
"(",
"parameter",
")",
"processor",
".",
"create_parameter_subscription",
"(",
"'/YSS/SIMULATOR/BatteryVoltage... | Shows how to receive callbacks on value updates. | [
"Shows",
"how",
"to",
"receive",
"callbacks",
"on",
"value",
"updates",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/examples/parameter_subscription.py#L23-L31 | train |
yamcs/yamcs-python | yamcs-client/examples/parameter_subscription.py | manage_subscription | def manage_subscription():
"""Shows how to interact with a parameter subscription."""
subscription = processor.create_parameter_subscription([
'/YSS/SIMULATOR/BatteryVoltage1'
])
sleep(5)
print('Adding extra items to the existing subscription...')
subscription.add([
'/YSS/SIMUL... | python | def manage_subscription():
"""Shows how to interact with a parameter subscription."""
subscription = processor.create_parameter_subscription([
'/YSS/SIMULATOR/BatteryVoltage1'
])
sleep(5)
print('Adding extra items to the existing subscription...')
subscription.add([
'/YSS/SIMUL... | [
"def",
"manage_subscription",
"(",
")",
":",
"subscription",
"=",
"processor",
".",
"create_parameter_subscription",
"(",
"[",
"'/YSS/SIMULATOR/BatteryVoltage1'",
"]",
")",
"sleep",
"(",
"5",
")",
"print",
"(",
"'Adding extra items to the existing subscription...'",
")",
... | Shows how to interact with a parameter subscription. | [
"Shows",
"how",
"to",
"interact",
"with",
"a",
"parameter",
"subscription",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/examples/parameter_subscription.py#L34-L61 | train |
portfors-lab/sparkle | sparkle/gui/stim/stimulusview.py | StimulusView.setPixelScale | def setPixelScale(self, pxms):
"""Sets the zoom scale
:param pxms: number of pixels per ms
:type pxms: int
:returns: float -- the miliseconds between grid lines
"""
pxms = float(pxms)/2
self.pixelsPerms = pxms
if pxms*self.gridms < GRID_PIXEL_MIN:
... | python | def setPixelScale(self, pxms):
"""Sets the zoom scale
:param pxms: number of pixels per ms
:type pxms: int
:returns: float -- the miliseconds between grid lines
"""
pxms = float(pxms)/2
self.pixelsPerms = pxms
if pxms*self.gridms < GRID_PIXEL_MIN:
... | [
"def",
"setPixelScale",
"(",
"self",
",",
"pxms",
")",
":",
"pxms",
"=",
"float",
"(",
"pxms",
")",
"/",
"2",
"self",
".",
"pixelsPerms",
"=",
"pxms",
"if",
"pxms",
"*",
"self",
".",
"gridms",
"<",
"GRID_PIXEL_MIN",
":",
"self",
".",
"gridms",
"=",
... | Sets the zoom scale
:param pxms: number of pixels per ms
:type pxms: int
:returns: float -- the miliseconds between grid lines | [
"Sets",
"the",
"zoom",
"scale"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/stimulusview.py#L50-L66 | train |
portfors-lab/sparkle | sparkle/gui/stim/stimulusview.py | StimulusView.indexXY | def indexXY(self, index):
"""Returns the top left coordinates of the item for the given index
:param index: index for the item
:type index: :qtdoc:`QModelIndex`
:returns: (int, int) -- (x, y) view coordinates of item
"""
rect = self.visualRect(index)
return rect.... | python | def indexXY(self, index):
"""Returns the top left coordinates of the item for the given index
:param index: index for the item
:type index: :qtdoc:`QModelIndex`
:returns: (int, int) -- (x, y) view coordinates of item
"""
rect = self.visualRect(index)
return rect.... | [
"def",
"indexXY",
"(",
"self",
",",
"index",
")",
":",
"rect",
"=",
"self",
".",
"visualRect",
"(",
"index",
")",
"return",
"rect",
".",
"x",
"(",
")",
",",
"rect",
".",
"y",
"(",
")"
] | Returns the top left coordinates of the item for the given index
:param index: index for the item
:type index: :qtdoc:`QModelIndex`
:returns: (int, int) -- (x, y) view coordinates of item | [
"Returns",
"the",
"top",
"left",
"coordinates",
"of",
"the",
"item",
"for",
"the",
"given",
"index"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/stimulusview.py#L82-L90 | train |
portfors-lab/sparkle | sparkle/gui/stim/stimulusview.py | StimulusView.mouseDoubleClickEvent | def mouseDoubleClickEvent(self, event):
"""Launches an editor for the component, if the mouse cursor is over an item"""
if self.mode == BuildMode:
if event.button() == QtCore.Qt.LeftButton:
index = self.indexAt(event.pos())
self.edit(index) | python | def mouseDoubleClickEvent(self, event):
"""Launches an editor for the component, if the mouse cursor is over an item"""
if self.mode == BuildMode:
if event.button() == QtCore.Qt.LeftButton:
index = self.indexAt(event.pos())
self.edit(index) | [
"def",
"mouseDoubleClickEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"mode",
"==",
"BuildMode",
":",
"if",
"event",
".",
"button",
"(",
")",
"==",
"QtCore",
".",
"Qt",
".",
"LeftButton",
":",
"index",
"=",
"self",
".",
"indexAt",
"... | Launches an editor for the component, if the mouse cursor is over an item | [
"Launches",
"an",
"editor",
"for",
"the",
"component",
"if",
"the",
"mouse",
"cursor",
"is",
"over",
"an",
"item"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/stimulusview.py#L322-L327 | train |
portfors-lab/sparkle | sparkle/gui/stim/stimulusview.py | StimulusView.mousePressEvent | def mousePressEvent(self, event):
"""In Auto-parameter selection mode, mouse press over an item emits
`componentSelected`"""
if self.mode == BuildMode:
super(StimulusView, self).mousePressEvent(event)
else:
# select and de-select components
index = sel... | python | def mousePressEvent(self, event):
"""In Auto-parameter selection mode, mouse press over an item emits
`componentSelected`"""
if self.mode == BuildMode:
super(StimulusView, self).mousePressEvent(event)
else:
# select and de-select components
index = sel... | [
"def",
"mousePressEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"mode",
"==",
"BuildMode",
":",
"super",
"(",
"StimulusView",
",",
"self",
")",
".",
"mousePressEvent",
"(",
"event",
")",
"else",
":",
"index",
"=",
"self",
".",
"indexA... | In Auto-parameter selection mode, mouse press over an item emits
`componentSelected` | [
"In",
"Auto",
"-",
"parameter",
"selection",
"mode",
"mouse",
"press",
"over",
"an",
"item",
"emits",
"componentSelected"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/stimulusview.py#L351-L363 | train |
portfors-lab/sparkle | sparkle/gui/stim/stimulusview.py | StimulusView.visualRegionForSelection | def visualRegionForSelection(self, selection):
"""Gets the region of all of the components in selection
:param selection: a selection model for this view
:type selection: :qtdoc:`QItemSelectionModel`
:returns: :qtdoc:`QRegion` -- union of rects of the selected components
"""
... | python | def visualRegionForSelection(self, selection):
"""Gets the region of all of the components in selection
:param selection: a selection model for this view
:type selection: :qtdoc:`QItemSelectionModel`
:returns: :qtdoc:`QRegion` -- union of rects of the selected components
"""
... | [
"def",
"visualRegionForSelection",
"(",
"self",
",",
"selection",
")",
":",
"region",
"=",
"QtGui",
".",
"QRegion",
"(",
")",
"for",
"index",
"in",
"selection",
".",
"indexes",
"(",
")",
":",
"region",
"=",
"region",
".",
"united",
"(",
"self",
".",
"_... | Gets the region of all of the components in selection
:param selection: a selection model for this view
:type selection: :qtdoc:`QItemSelectionModel`
:returns: :qtdoc:`QRegion` -- union of rects of the selected components | [
"Gets",
"the",
"region",
"of",
"all",
"of",
"the",
"components",
"in",
"selection"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/stimulusview.py#L474-L485 | train |
portfors-lab/sparkle | sparkle/gui/stim/stimulusview.py | ComponentDelegate.sizeHint | def sizeHint(self, option, index):
"""Size based on component duration and a fixed height"""
# calculate size by data component
component = index.internalPointer()
width = self.component.duration() * self.pixelsPerms*1000
return QtCore.QSize(width, 50) | python | def sizeHint(self, option, index):
"""Size based on component duration and a fixed height"""
# calculate size by data component
component = index.internalPointer()
width = self.component.duration() * self.pixelsPerms*1000
return QtCore.QSize(width, 50) | [
"def",
"sizeHint",
"(",
"self",
",",
"option",
",",
"index",
")",
":",
"component",
"=",
"index",
".",
"internalPointer",
"(",
")",
"width",
"=",
"self",
".",
"component",
".",
"duration",
"(",
")",
"*",
"self",
".",
"pixelsPerms",
"*",
"1000",
"return... | Size based on component duration and a fixed height | [
"Size",
"based",
"on",
"component",
"duration",
"and",
"a",
"fixed",
"height"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/stimulusview.py#L558-L563 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/__init__.py | get_namespace | def get_namespace(taskfileinfo):
"""Return a suitable name for a namespace for the taskfileinfo
Returns the name of the shot/asset with a "_1" suffix.
When you create the namespace the number will automatically be incremented by Maya.
:param taskfileinfo: the taskfile info for the file that needs a na... | python | def get_namespace(taskfileinfo):
"""Return a suitable name for a namespace for the taskfileinfo
Returns the name of the shot/asset with a "_1" suffix.
When you create the namespace the number will automatically be incremented by Maya.
:param taskfileinfo: the taskfile info for the file that needs a na... | [
"def",
"get_namespace",
"(",
"taskfileinfo",
")",
":",
"element",
"=",
"taskfileinfo",
".",
"task",
".",
"element",
"name",
"=",
"element",
".",
"name",
"return",
"name",
"+",
"\"_1\""
] | Return a suitable name for a namespace for the taskfileinfo
Returns the name of the shot/asset with a "_1" suffix.
When you create the namespace the number will automatically be incremented by Maya.
:param taskfileinfo: the taskfile info for the file that needs a namespace
:type taskfileinfo: :class:`... | [
"Return",
"a",
"suitable",
"name",
"for",
"a",
"namespace",
"for",
"the",
"taskfileinfo"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/__init__.py#L7-L21 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/__init__.py | get_groupname | def get_groupname(taskfileinfo):
"""Return a suitable name for a groupname for the given taskfileinfo.
:param taskfileinfo: the taskfile info for the file that needs a group when importing/referencing
:type taskfileinfo: :class:`jukeboxcore.filesys.TaskFileInfo`
:returns: None
:rtype: None
:rai... | python | def get_groupname(taskfileinfo):
"""Return a suitable name for a groupname for the given taskfileinfo.
:param taskfileinfo: the taskfile info for the file that needs a group when importing/referencing
:type taskfileinfo: :class:`jukeboxcore.filesys.TaskFileInfo`
:returns: None
:rtype: None
:rai... | [
"def",
"get_groupname",
"(",
"taskfileinfo",
")",
":",
"element",
"=",
"taskfileinfo",
".",
"task",
".",
"element",
"name",
"=",
"element",
".",
"name",
"return",
"name",
"+",
"\"_grp\""
] | Return a suitable name for a groupname for the given taskfileinfo.
:param taskfileinfo: the taskfile info for the file that needs a group when importing/referencing
:type taskfileinfo: :class:`jukeboxcore.filesys.TaskFileInfo`
:returns: None
:rtype: None
:raises: None | [
"Return",
"a",
"suitable",
"name",
"for",
"a",
"groupname",
"for",
"the",
"given",
"taskfileinfo",
"."
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/__init__.py#L24-L35 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/reftrack/__init__.py | group_content | def group_content(content, namespace, grpname, grpnodetype):
"""Group the given content in the given namespace under a node of type
grpnodetype with the name grpname
:param content: the nodes to group
:type content: :class:`list`
:param namespace: the namespace to use
:type namespace: str | Non... | python | def group_content(content, namespace, grpname, grpnodetype):
"""Group the given content in the given namespace under a node of type
grpnodetype with the name grpname
:param content: the nodes to group
:type content: :class:`list`
:param namespace: the namespace to use
:type namespace: str | Non... | [
"def",
"group_content",
"(",
"content",
",",
"namespace",
",",
"grpname",
",",
"grpnodetype",
")",
":",
"with",
"common",
".",
"preserve_namespace",
"(",
"namespace",
")",
":",
"grpnode",
"=",
"cmds",
".",
"createNode",
"(",
"grpnodetype",
",",
"name",
"=",
... | Group the given content in the given namespace under a node of type
grpnodetype with the name grpname
:param content: the nodes to group
:type content: :class:`list`
:param namespace: the namespace to use
:type namespace: str | None
:param grpname: the name of the new grpnode
:type grpname:... | [
"Group",
"the",
"given",
"content",
"in",
"the",
"given",
"namespace",
"under",
"a",
"node",
"of",
"type",
"grpnodetype",
"with",
"the",
"name",
"grpname"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/reftrack/__init__.py#L38-L57 | train |
portfors-lab/sparkle | sparkle/gui/stim/component_label.py | ComponentTemplateTable.getLabelByName | def getLabelByName(self, name):
"""Gets a label widget by it component name
:param name: name of the AbstractStimulusComponent which this label is named after
:type name: str
:returns: :class:`DragLabel<sparkle.gui.drag_label.DragLabel>`
"""
name = name.lower()
i... | python | def getLabelByName(self, name):
"""Gets a label widget by it component name
:param name: name of the AbstractStimulusComponent which this label is named after
:type name: str
:returns: :class:`DragLabel<sparkle.gui.drag_label.DragLabel>`
"""
name = name.lower()
i... | [
"def",
"getLabelByName",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"if",
"name",
"in",
"self",
".",
"stimLabels",
":",
"return",
"self",
".",
"stimLabels",
"[",
"name",
"]",
"else",
":",
"return",
"None"
] | Gets a label widget by it component name
:param name: name of the AbstractStimulusComponent which this label is named after
:type name: str
:returns: :class:`DragLabel<sparkle.gui.drag_label.DragLabel>` | [
"Gets",
"a",
"label",
"widget",
"by",
"it",
"component",
"name"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/component_label.py#L37-L48 | train |
rmb938/vmw-cloudinit-metadata | vmw_cloudinit_metadata/vspc/async_telnet.py | AsyncTelnet.read_byte | def read_byte(self):
"""Read one byte of cooked data
"""
buf = b''
if len(self.cookedq) > 0:
buf = bytes([self.cookedq[0]])
self.cookedq = self.cookedq[1:]
else:
yield from self.process_rawq()
if not self.eof:
yield ... | python | def read_byte(self):
"""Read one byte of cooked data
"""
buf = b''
if len(self.cookedq) > 0:
buf = bytes([self.cookedq[0]])
self.cookedq = self.cookedq[1:]
else:
yield from self.process_rawq()
if not self.eof:
yield ... | [
"def",
"read_byte",
"(",
"self",
")",
":",
"buf",
"=",
"b''",
"if",
"len",
"(",
"self",
".",
"cookedq",
")",
">",
"0",
":",
"buf",
"=",
"bytes",
"(",
"[",
"self",
".",
"cookedq",
"[",
"0",
"]",
"]",
")",
"self",
".",
"cookedq",
"=",
"self",
"... | Read one byte of cooked data | [
"Read",
"one",
"byte",
"of",
"cooked",
"data"
] | b667b2a0e10e11dbd6cf058d9b5be70b97b7950e | https://github.com/rmb938/vmw-cloudinit-metadata/blob/b667b2a0e10e11dbd6cf058d9b5be70b97b7950e/vmw_cloudinit_metadata/vspc/async_telnet.py#L154-L169 | train |
rmb938/vmw-cloudinit-metadata | vmw_cloudinit_metadata/vspc/async_telnet.py | AsyncTelnet.read_line | def read_line(self):
"""Read data until \n is found
"""
buf = b''
while not self.eof and buf.endswith(b'\n') is False:
buf += yield from self.read_byte()
if self.eof:
buf = b''
# Remove \n character
buf = buf.replace(b'\n', b'')
... | python | def read_line(self):
"""Read data until \n is found
"""
buf = b''
while not self.eof and buf.endswith(b'\n') is False:
buf += yield from self.read_byte()
if self.eof:
buf = b''
# Remove \n character
buf = buf.replace(b'\n', b'')
... | [
"def",
"read_line",
"(",
"self",
")",
":",
"buf",
"=",
"b''",
"while",
"not",
"self",
".",
"eof",
"and",
"buf",
".",
"endswith",
"(",
"b'\\n'",
")",
"is",
"False",
":",
"buf",
"+=",
"yield",
"from",
"self",
".",
"read_byte",
"(",
")",
"if",
"self",... | Read data until \n is found | [
"Read",
"data",
"until",
"\\",
"n",
"is",
"found"
] | b667b2a0e10e11dbd6cf058d9b5be70b97b7950e | https://github.com/rmb938/vmw-cloudinit-metadata/blob/b667b2a0e10e11dbd6cf058d9b5be70b97b7950e/vmw_cloudinit_metadata/vspc/async_telnet.py#L172-L185 | train |
tBaxter/python-card-me | card_me/icalendar.py | getTzid | def getTzid(tzid, smart=True):
"""Return the tzid if it exists, or None."""
tz = __tzidMap.get(toUnicode(tzid), None)
if smart and tzid and not tz:
try:
from pytz import timezone, UnknownTimeZoneError
try:
tz = timezone(tzid)
registerTzid(toUni... | python | def getTzid(tzid, smart=True):
"""Return the tzid if it exists, or None."""
tz = __tzidMap.get(toUnicode(tzid), None)
if smart and tzid and not tz:
try:
from pytz import timezone, UnknownTimeZoneError
try:
tz = timezone(tzid)
registerTzid(toUni... | [
"def",
"getTzid",
"(",
"tzid",
",",
"smart",
"=",
"True",
")",
":",
"tz",
"=",
"__tzidMap",
".",
"get",
"(",
"toUnicode",
"(",
"tzid",
")",
",",
"None",
")",
"if",
"smart",
"and",
"tzid",
"and",
"not",
"tz",
":",
"try",
":",
"from",
"pytz",
"impo... | Return the tzid if it exists, or None. | [
"Return",
"the",
"tzid",
"if",
"it",
"exists",
"or",
"None",
"."
] | ffebc7fed44f83983b7438e57263dcda67207664 | https://github.com/tBaxter/python-card-me/blob/ffebc7fed44f83983b7438e57263dcda67207664/card_me/icalendar.py#L52-L65 | train |
tBaxter/python-card-me | card_me/icalendar.py | dateTimeToString | def dateTimeToString(dateTime, convertToUTC=False):
"""
Ignore tzinfo unless convertToUTC. Output string.
"""
if dateTime.tzinfo and convertToUTC:
dateTime = dateTime.astimezone(utc)
datestr = "{}{}{}T{}{}{}".format(
numToDigits(dateTime.year, 4),
numToDigits(dateTime.month... | python | def dateTimeToString(dateTime, convertToUTC=False):
"""
Ignore tzinfo unless convertToUTC. Output string.
"""
if dateTime.tzinfo and convertToUTC:
dateTime = dateTime.astimezone(utc)
datestr = "{}{}{}T{}{}{}".format(
numToDigits(dateTime.year, 4),
numToDigits(dateTime.month... | [
"def",
"dateTimeToString",
"(",
"dateTime",
",",
"convertToUTC",
"=",
"False",
")",
":",
"if",
"dateTime",
".",
"tzinfo",
"and",
"convertToUTC",
":",
"dateTime",
"=",
"dateTime",
".",
"astimezone",
"(",
"utc",
")",
"datestr",
"=",
"\"{}{}{}T{}{}{}\"",
".",
"... | Ignore tzinfo unless convertToUTC. Output string. | [
"Ignore",
"tzinfo",
"unless",
"convertToUTC",
".",
"Output",
"string",
"."
] | ffebc7fed44f83983b7438e57263dcda67207664 | https://github.com/tBaxter/python-card-me/blob/ffebc7fed44f83983b7438e57263dcda67207664/card_me/icalendar.py#L1564-L1581 | train |
tBaxter/python-card-me | card_me/icalendar.py | RecurringComponent.getrruleset | def getrruleset(self, addRDate=False):
"""
Get an rruleset created from self.
If addRDate is True, add an RDATE for dtstart if it's not included in
an RRULE, and count is decremented if it exists.
Note that for rules which don't match DTSTART, DTSTART may not appear
in ... | python | def getrruleset(self, addRDate=False):
"""
Get an rruleset created from self.
If addRDate is True, add an RDATE for dtstart if it's not included in
an RRULE, and count is decremented if it exists.
Note that for rules which don't match DTSTART, DTSTART may not appear
in ... | [
"def",
"getrruleset",
"(",
"self",
",",
"addRDate",
"=",
"False",
")",
":",
"rruleset",
"=",
"None",
"for",
"name",
"in",
"DATESANDRULES",
":",
"addfunc",
"=",
"None",
"for",
"line",
"in",
"self",
".",
"contents",
".",
"get",
"(",
"name",
",",
"(",
"... | Get an rruleset created from self.
If addRDate is True, add an RDATE for dtstart if it's not included in
an RRULE, and count is decremented if it exists.
Note that for rules which don't match DTSTART, DTSTART may not appear
in list(rruleset), although it should. By default, an RDATE i... | [
"Get",
"an",
"rruleset",
"created",
"from",
"self",
"."
] | ffebc7fed44f83983b7438e57263dcda67207664 | https://github.com/tBaxter/python-card-me/blob/ffebc7fed44f83983b7438e57263dcda67207664/card_me/icalendar.py#L361-L471 | train |
tBaxter/python-card-me | card_me/icalendar.py | DateTimeBehavior.transformToNative | def transformToNative(obj):
"""Turn obj.value into a datetime.
RFC2445 allows times without time zone information, "floating times"
in some properties. Mostly, this isn't what you want, but when parsing
a file, real floating times are noted by setting to 'TRUE' the
X-VOBJ-FLOAT... | python | def transformToNative(obj):
"""Turn obj.value into a datetime.
RFC2445 allows times without time zone information, "floating times"
in some properties. Mostly, this isn't what you want, but when parsing
a file, real floating times are noted by setting to 'TRUE' the
X-VOBJ-FLOAT... | [
"def",
"transformToNative",
"(",
"obj",
")",
":",
"if",
"obj",
".",
"isNative",
":",
"return",
"obj",
"obj",
".",
"isNative",
"=",
"True",
"if",
"obj",
".",
"value",
"==",
"''",
":",
"return",
"obj",
"obj",
".",
"value",
"=",
"obj",
".",
"value",
"... | Turn obj.value into a datetime.
RFC2445 allows times without time zone information, "floating times"
in some properties. Mostly, this isn't what you want, but when parsing
a file, real floating times are noted by setting to 'TRUE' the
X-VOBJ-FLOATINGTIME-ALLOWED parameter. | [
"Turn",
"obj",
".",
"value",
"into",
"a",
"datetime",
"."
] | ffebc7fed44f83983b7438e57263dcda67207664 | https://github.com/tBaxter/python-card-me/blob/ffebc7fed44f83983b7438e57263dcda67207664/card_me/icalendar.py#L669-L692 | train |
tBaxter/python-card-me | card_me/icalendar.py | DateTimeBehavior.transformFromNative | def transformFromNative(cls, obj):
"""Replace the datetime in obj.value with an ISO 8601 string."""
# print('transforming from native')
if obj.isNative:
obj.isNative = False
tzid = TimezoneComponent.registerTzinfo(obj.value.tzinfo)
obj.value = dateTimeToString... | python | def transformFromNative(cls, obj):
"""Replace the datetime in obj.value with an ISO 8601 string."""
# print('transforming from native')
if obj.isNative:
obj.isNative = False
tzid = TimezoneComponent.registerTzinfo(obj.value.tzinfo)
obj.value = dateTimeToString... | [
"def",
"transformFromNative",
"(",
"cls",
",",
"obj",
")",
":",
"if",
"obj",
".",
"isNative",
":",
"obj",
".",
"isNative",
"=",
"False",
"tzid",
"=",
"TimezoneComponent",
".",
"registerTzinfo",
"(",
"obj",
".",
"value",
".",
"tzinfo",
")",
"obj",
".",
... | Replace the datetime in obj.value with an ISO 8601 string. | [
"Replace",
"the",
"datetime",
"in",
"obj",
".",
"value",
"with",
"an",
"ISO",
"8601",
"string",
"."
] | ffebc7fed44f83983b7438e57263dcda67207664 | https://github.com/tBaxter/python-card-me/blob/ffebc7fed44f83983b7438e57263dcda67207664/card_me/icalendar.py#L695-L709 | train |
Egregors/cbrf | cbrf/api.py | get_currencies_info | def get_currencies_info() -> Element:
"""Get META information about currencies
url: http://www.cbr.ru/scripts/XML_val.asp
:return: :class: `Element <Element 'Valuta'>` object
:rtype: ElementTree.Element
"""
response = requests.get(const.CBRF_API_URLS['info'])
return XML(response.text) | python | def get_currencies_info() -> Element:
"""Get META information about currencies
url: http://www.cbr.ru/scripts/XML_val.asp
:return: :class: `Element <Element 'Valuta'>` object
:rtype: ElementTree.Element
"""
response = requests.get(const.CBRF_API_URLS['info'])
return XML(response.text) | [
"def",
"get_currencies_info",
"(",
")",
"->",
"Element",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"const",
".",
"CBRF_API_URLS",
"[",
"'info'",
"]",
")",
"return",
"XML",
"(",
"response",
".",
"text",
")"
] | Get META information about currencies
url: http://www.cbr.ru/scripts/XML_val.asp
:return: :class: `Element <Element 'Valuta'>` object
:rtype: ElementTree.Element | [
"Get",
"META",
"information",
"about",
"currencies"
] | e4ce332fcead83c75966337c97c0ae070fb7e576 | https://github.com/Egregors/cbrf/blob/e4ce332fcead83c75966337c97c0ae070fb7e576/cbrf/api.py#L22-L32 | train |
Egregors/cbrf | cbrf/api.py | get_daily_rates | def get_daily_rates(date_req: datetime.datetime = None, lang: str = 'rus') -> Element:
""" Getting currency for current day.
see example: http://www.cbr.ru/scripts/Root.asp?PrtId=SXML
:param date_req:
:type date_req: datetime.datetime
:param lang: language of API response ('eng' || 'rus')
:typ... | python | def get_daily_rates(date_req: datetime.datetime = None, lang: str = 'rus') -> Element:
""" Getting currency for current day.
see example: http://www.cbr.ru/scripts/Root.asp?PrtId=SXML
:param date_req:
:type date_req: datetime.datetime
:param lang: language of API response ('eng' || 'rus')
:typ... | [
"def",
"get_daily_rates",
"(",
"date_req",
":",
"datetime",
".",
"datetime",
"=",
"None",
",",
"lang",
":",
"str",
"=",
"'rus'",
")",
"->",
"Element",
":",
"if",
"lang",
"not",
"in",
"[",
"'rus'",
",",
"'eng'",
"]",
":",
"raise",
"ValueError",
"(",
"... | Getting currency for current day.
see example: http://www.cbr.ru/scripts/Root.asp?PrtId=SXML
:param date_req:
:type date_req: datetime.datetime
:param lang: language of API response ('eng' || 'rus')
:type lang: str
:return: :class: `Element <Element 'ValCurs'>` object
:rtype: ElementTree.... | [
"Getting",
"currency",
"for",
"current",
"day",
"."
] | e4ce332fcead83c75966337c97c0ae070fb7e576 | https://github.com/Egregors/cbrf/blob/e4ce332fcead83c75966337c97c0ae070fb7e576/cbrf/api.py#L35-L58 | train |
stu-gott/pykira | pykira/utils.py | mangleIR | def mangleIR(data, ignore_errors=False):
"""Mangle a raw Kira data packet into shorthand"""
try:
# Packet mangling algorithm inspired by Rex Becket's kirarx vera plugin
# Determine a median value for the timing packets and categorize each
# timing as longer or shorter than that. This wil... | python | def mangleIR(data, ignore_errors=False):
"""Mangle a raw Kira data packet into shorthand"""
try:
# Packet mangling algorithm inspired by Rex Becket's kirarx vera plugin
# Determine a median value for the timing packets and categorize each
# timing as longer or shorter than that. This wil... | [
"def",
"mangleIR",
"(",
"data",
",",
"ignore_errors",
"=",
"False",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"data",
",",
"bytes",
")",
":",
"data",
"=",
"data",
".",
"decode",
"(",
"'ascii'",
")",
"data",
"=",
"data",
".",
"strip",
"(",
")",... | Mangle a raw Kira data packet into shorthand | [
"Mangle",
"a",
"raw",
"Kira",
"data",
"packet",
"into",
"shorthand"
] | b48522ceed694a5393ac4ed8c9a6f11c20f7b150 | https://github.com/stu-gott/pykira/blob/b48522ceed694a5393ac4ed8c9a6f11c20f7b150/pykira/utils.py#L7-L28 | train |
stu-gott/pykira | pykira/utils.py | mangleNec | def mangleNec(code, freq=40):
"""Convert NEC code to shorthand notation"""
# base time is 550 microseconds
# unit of burst time
# lead in pattern: 214d 10b3
# "1" burst pattern: 0226 0960
# "0" burst pattern: 0226 0258
# lead out pattern: 0226 2000
# there's large disagreement between... | python | def mangleNec(code, freq=40):
"""Convert NEC code to shorthand notation"""
# base time is 550 microseconds
# unit of burst time
# lead in pattern: 214d 10b3
# "1" burst pattern: 0226 0960
# "0" burst pattern: 0226 0258
# lead out pattern: 0226 2000
# there's large disagreement between... | [
"def",
"mangleNec",
"(",
"code",
",",
"freq",
"=",
"40",
")",
":",
"timings",
"=",
"[",
"]",
"for",
"octet",
"in",
"binascii",
".",
"unhexlify",
"(",
"code",
".",
"replace",
"(",
"\" \"",
",",
"\"\"",
")",
")",
":",
"burst",
"=",
"lambda",
"x",
"... | Convert NEC code to shorthand notation | [
"Convert",
"NEC",
"code",
"to",
"shorthand",
"notation"
] | b48522ceed694a5393ac4ed8c9a6f11c20f7b150 | https://github.com/stu-gott/pykira/blob/b48522ceed694a5393ac4ed8c9a6f11c20f7b150/pykira/utils.py#L46-L65 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.