repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_line_break_property | def get_line_break_property(value, is_bytes=False):
"""Get `LINE BREAK` property."""
obj = unidata.ascii_line_break if is_bytes else unidata.unicode_line_break
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['linebreak'].get(negated, negated)
else:
... | python | def get_line_break_property(value, is_bytes=False):
"""Get `LINE BREAK` property."""
obj = unidata.ascii_line_break if is_bytes else unidata.unicode_line_break
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['linebreak'].get(negated, negated)
else:
... | Get `LINE BREAK` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L112-L123 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_sentence_break_property | def get_sentence_break_property(value, is_bytes=False):
"""Get `SENTENCE BREAK` property."""
obj = unidata.ascii_sentence_break if is_bytes else unidata.unicode_sentence_break
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['sentencebreak'].get(negated, ne... | python | def get_sentence_break_property(value, is_bytes=False):
"""Get `SENTENCE BREAK` property."""
obj = unidata.ascii_sentence_break if is_bytes else unidata.unicode_sentence_break
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['sentencebreak'].get(negated, ne... | Get `SENTENCE BREAK` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L126-L137 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_word_break_property | def get_word_break_property(value, is_bytes=False):
"""Get `WORD BREAK` property."""
obj = unidata.ascii_word_break if is_bytes else unidata.unicode_word_break
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['wordbreak'].get(negated, negated)
else:
... | python | def get_word_break_property(value, is_bytes=False):
"""Get `WORD BREAK` property."""
obj = unidata.ascii_word_break if is_bytes else unidata.unicode_word_break
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['wordbreak'].get(negated, negated)
else:
... | Get `WORD BREAK` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L140-L151 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_hangul_syllable_type_property | def get_hangul_syllable_type_property(value, is_bytes=False):
"""Get `HANGUL SYLLABLE TYPE` property."""
obj = unidata.ascii_hangul_syllable_type if is_bytes else unidata.unicode_hangul_syllable_type
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['hanguls... | python | def get_hangul_syllable_type_property(value, is_bytes=False):
"""Get `HANGUL SYLLABLE TYPE` property."""
obj = unidata.ascii_hangul_syllable_type if is_bytes else unidata.unicode_hangul_syllable_type
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['hanguls... | Get `HANGUL SYLLABLE TYPE` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L154-L165 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_indic_positional_category_property | def get_indic_positional_category_property(value, is_bytes=False):
"""Get `INDIC POSITIONAL/MATRA CATEGORY` property."""
if PY35:
obj = unidata.ascii_indic_positional_category if is_bytes else unidata.unicode_indic_positional_category
alias_key = 'indicpositionalcategory'
else:
obj ... | python | def get_indic_positional_category_property(value, is_bytes=False):
"""Get `INDIC POSITIONAL/MATRA CATEGORY` property."""
if PY35:
obj = unidata.ascii_indic_positional_category if is_bytes else unidata.unicode_indic_positional_category
alias_key = 'indicpositionalcategory'
else:
obj ... | Get `INDIC POSITIONAL/MATRA CATEGORY` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L168-L184 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_indic_syllabic_category_property | def get_indic_syllabic_category_property(value, is_bytes=False):
"""Get `INDIC SYLLABIC CATEGORY` property."""
obj = unidata.ascii_indic_syllabic_category if is_bytes else unidata.unicode_indic_syllabic_category
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_al... | python | def get_indic_syllabic_category_property(value, is_bytes=False):
"""Get `INDIC SYLLABIC CATEGORY` property."""
obj = unidata.ascii_indic_syllabic_category if is_bytes else unidata.unicode_indic_syllabic_category
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_al... | Get `INDIC SYLLABIC CATEGORY` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L187-L198 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_decomposition_type_property | def get_decomposition_type_property(value, is_bytes=False):
"""Get `DECOMPOSITION TYPE` property."""
obj = unidata.ascii_decomposition_type if is_bytes else unidata.unicode_decomposition_type
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['decompositionty... | python | def get_decomposition_type_property(value, is_bytes=False):
"""Get `DECOMPOSITION TYPE` property."""
obj = unidata.ascii_decomposition_type if is_bytes else unidata.unicode_decomposition_type
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['decompositionty... | Get `DECOMPOSITION TYPE` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L201-L212 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_nfc_quick_check_property | def get_nfc_quick_check_property(value, is_bytes=False):
"""Get `NFC QUICK CHECK` property."""
obj = unidata.ascii_nfc_quick_check if is_bytes else unidata.unicode_nfc_quick_check
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['nfcquickcheck'].get(negated... | python | def get_nfc_quick_check_property(value, is_bytes=False):
"""Get `NFC QUICK CHECK` property."""
obj = unidata.ascii_nfc_quick_check if is_bytes else unidata.unicode_nfc_quick_check
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['nfcquickcheck'].get(negated... | Get `NFC QUICK CHECK` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L215-L226 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_nfd_quick_check_property | def get_nfd_quick_check_property(value, is_bytes=False):
"""Get `NFD QUICK CHECK` property."""
obj = unidata.ascii_nfd_quick_check if is_bytes else unidata.unicode_nfd_quick_check
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['nfdquickcheck'].get(negated... | python | def get_nfd_quick_check_property(value, is_bytes=False):
"""Get `NFD QUICK CHECK` property."""
obj = unidata.ascii_nfd_quick_check if is_bytes else unidata.unicode_nfd_quick_check
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['nfdquickcheck'].get(negated... | Get `NFD QUICK CHECK` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L229-L240 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_nfkc_quick_check_property | def get_nfkc_quick_check_property(value, is_bytes=False):
"""Get `NFKC QUICK CHECK` property."""
obj = unidata.ascii_nfkc_quick_check if is_bytes else unidata.unicode_nfkc_quick_check
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['nfkcquickcheck'].get(ne... | python | def get_nfkc_quick_check_property(value, is_bytes=False):
"""Get `NFKC QUICK CHECK` property."""
obj = unidata.ascii_nfkc_quick_check if is_bytes else unidata.unicode_nfkc_quick_check
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['nfkcquickcheck'].get(ne... | Get `NFKC QUICK CHECK` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L243-L254 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_nfkd_quick_check_property | def get_nfkd_quick_check_property(value, is_bytes=False):
"""Get `NFKD QUICK CHECK` property."""
obj = unidata.ascii_nfkd_quick_check if is_bytes else unidata.unicode_nfkd_quick_check
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['nfkdquickcheck'].get(ne... | python | def get_nfkd_quick_check_property(value, is_bytes=False):
"""Get `NFKD QUICK CHECK` property."""
obj = unidata.ascii_nfkd_quick_check if is_bytes else unidata.unicode_nfkd_quick_check
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['nfkdquickcheck'].get(ne... | Get `NFKD QUICK CHECK` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L257-L268 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_numeric_type_property | def get_numeric_type_property(value, is_bytes=False):
"""Get `NUMERIC TYPE` property."""
obj = unidata.ascii_numeric_type if is_bytes else unidata.unicode_numeric_type
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['numerictype'].get(negated, negated)
... | python | def get_numeric_type_property(value, is_bytes=False):
"""Get `NUMERIC TYPE` property."""
obj = unidata.ascii_numeric_type if is_bytes else unidata.unicode_numeric_type
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['numerictype'].get(negated, negated)
... | Get `NUMERIC TYPE` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L271-L282 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_numeric_value_property | def get_numeric_value_property(value, is_bytes=False):
"""Get `NUMERIC VALUE` property."""
obj = unidata.ascii_numeric_values if is_bytes else unidata.unicode_numeric_values
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['numericvalue'].get(negated, negat... | python | def get_numeric_value_property(value, is_bytes=False):
"""Get `NUMERIC VALUE` property."""
obj = unidata.ascii_numeric_values if is_bytes else unidata.unicode_numeric_values
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['numericvalue'].get(negated, negat... | Get `NUMERIC VALUE` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L285-L296 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_age_property | def get_age_property(value, is_bytes=False):
"""Get `AGE` property."""
obj = unidata.ascii_age if is_bytes else unidata.unicode_age
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['age'].get(negated, negated)
else:
value = unidata.unicode_alias... | python | def get_age_property(value, is_bytes=False):
"""Get `AGE` property."""
obj = unidata.ascii_age if is_bytes else unidata.unicode_age
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['age'].get(negated, negated)
else:
value = unidata.unicode_alias... | Get `AGE` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L299-L310 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_joining_type_property | def get_joining_type_property(value, is_bytes=False):
"""Get `JOINING TYPE` property."""
obj = unidata.ascii_joining_type if is_bytes else unidata.unicode_joining_type
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['joiningtype'].get(negated, negated)
... | python | def get_joining_type_property(value, is_bytes=False):
"""Get `JOINING TYPE` property."""
obj = unidata.ascii_joining_type if is_bytes else unidata.unicode_joining_type
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['joiningtype'].get(negated, negated)
... | Get `JOINING TYPE` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L313-L324 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_joining_group_property | def get_joining_group_property(value, is_bytes=False):
"""Get `JOINING GROUP` property."""
obj = unidata.ascii_joining_group if is_bytes else unidata.unicode_joining_group
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['joininggroup'].get(negated, negated... | python | def get_joining_group_property(value, is_bytes=False):
"""Get `JOINING GROUP` property."""
obj = unidata.ascii_joining_group if is_bytes else unidata.unicode_joining_group
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['joininggroup'].get(negated, negated... | Get `JOINING GROUP` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L327-L338 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_script_property | def get_script_property(value, is_bytes=False):
"""Get `SC` property."""
obj = unidata.ascii_scripts if is_bytes else unidata.unicode_scripts
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['script'].get(negated, negated)
else:
value = unidata.... | python | def get_script_property(value, is_bytes=False):
"""Get `SC` property."""
obj = unidata.ascii_scripts if is_bytes else unidata.unicode_scripts
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['script'].get(negated, negated)
else:
value = unidata.... | Get `SC` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L341-L352 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_script_extension_property | def get_script_extension_property(value, is_bytes=False):
"""Get `SCX` property."""
obj = unidata.ascii_script_extensions if is_bytes else unidata.unicode_script_extensions
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['script'].get(negated, negated)
... | python | def get_script_extension_property(value, is_bytes=False):
"""Get `SCX` property."""
obj = unidata.ascii_script_extensions if is_bytes else unidata.unicode_script_extensions
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['script'].get(negated, negated)
... | Get `SCX` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L355-L366 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_block_property | def get_block_property(value, is_bytes=False):
"""Get `BLK` property."""
obj = unidata.ascii_blocks if is_bytes else unidata.unicode_blocks
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['block'].get(negated, negated)
else:
value = unidata.uni... | python | def get_block_property(value, is_bytes=False):
"""Get `BLK` property."""
obj = unidata.ascii_blocks if is_bytes else unidata.unicode_blocks
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['block'].get(negated, negated)
else:
value = unidata.uni... | Get `BLK` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L369-L380 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_bidi_property | def get_bidi_property(value, is_bytes=False):
"""Get `BC` property."""
obj = unidata.ascii_bidi_classes if is_bytes else unidata.unicode_bidi_classes
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['bidiclass'].get(negated, negated)
else:
value... | python | def get_bidi_property(value, is_bytes=False):
"""Get `BC` property."""
obj = unidata.ascii_bidi_classes if is_bytes else unidata.unicode_bidi_classes
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['bidiclass'].get(negated, negated)
else:
value... | Get `BC` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L383-L394 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_bidi_paired_bracket_type_property | def get_bidi_paired_bracket_type_property(value, is_bytes=False):
"""Get `BPT` property."""
obj = unidata.ascii_bidi_paired_bracket_type if is_bytes else unidata.unicode_bidi_paired_bracket_type
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['bidipairedbr... | python | def get_bidi_paired_bracket_type_property(value, is_bytes=False):
"""Get `BPT` property."""
obj = unidata.ascii_bidi_paired_bracket_type if is_bytes else unidata.unicode_bidi_paired_bracket_type
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['bidipairedbr... | Get `BPT` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L397-L408 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_vertical_orientation_property | def get_vertical_orientation_property(value, is_bytes=False):
"""Get `VO` property."""
obj = unidata.ascii_vertical_orientation if is_bytes else unidata.unicode_vertical_orientation
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['verticalorientation'].get... | python | def get_vertical_orientation_property(value, is_bytes=False):
"""Get `VO` property."""
obj = unidata.ascii_vertical_orientation if is_bytes else unidata.unicode_vertical_orientation
if value.startswith('^'):
negated = value[1:]
value = '^' + unidata.unicode_alias['verticalorientation'].get... | Get `VO` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L411-L422 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_is_property | def get_is_property(value, is_bytes=False):
"""Get shortcut for `SC` or `Binary` property."""
if value.startswith('^'):
prefix = value[1:3]
temp = value[3:]
negate = '^'
else:
prefix = value[:2]
temp = value[2:]
negate = ''
if prefix != 'is':
rai... | python | def get_is_property(value, is_bytes=False):
"""Get shortcut for `SC` or `Binary` property."""
if value.startswith('^'):
prefix = value[1:3]
temp = value[3:]
negate = '^'
else:
prefix = value[:2]
temp = value[2:]
negate = ''
if prefix != 'is':
rai... | Get shortcut for `SC` or `Binary` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L425-L451 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_in_property | def get_in_property(value, is_bytes=False):
"""Get shortcut for `Block` property."""
if value.startswith('^'):
prefix = value[1:3]
temp = value[3:]
negate = '^'
else:
prefix = value[:2]
temp = value[2:]
negate = ''
if prefix != 'in':
raise ValueE... | python | def get_in_property(value, is_bytes=False):
"""Get shortcut for `Block` property."""
if value.startswith('^'):
prefix = value[1:3]
temp = value[3:]
negate = '^'
else:
prefix = value[:2]
temp = value[2:]
negate = ''
if prefix != 'in':
raise ValueE... | Get shortcut for `Block` property. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L454-L472 |
facelessuser/backrefs | backrefs/uniprops/__init__.py | get_unicode_property | def get_unicode_property(value, prop=None, is_bytes=False):
"""Retrieve the Unicode category from the table."""
if prop is not None:
prop = unidata.unicode_alias['_'].get(prop, prop)
try:
if prop == 'generalcategory':
return get_gc_property(value, is_bytes)
... | python | def get_unicode_property(value, prop=None, is_bytes=False):
"""Retrieve the Unicode category from the table."""
if prop is not None:
prop = unidata.unicode_alias['_'].get(prop, prop)
try:
if prop == 'generalcategory':
return get_gc_property(value, is_bytes)
... | Retrieve the Unicode category from the table. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L481-L578 |
facelessuser/backrefs | backrefs/bre.py | _cached_search_compile | def _cached_search_compile(pattern, re_verbose, re_version, pattern_type):
"""Cached search compile."""
return _bre_parse._SearchParser(pattern, re_verbose, re_version).parse() | python | def _cached_search_compile(pattern, re_verbose, re_version, pattern_type):
"""Cached search compile."""
return _bre_parse._SearchParser(pattern, re_verbose, re_version).parse() | Cached search compile. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/bre.py#L72-L75 |
facelessuser/backrefs | backrefs/bre.py | _apply_search_backrefs | def _apply_search_backrefs(pattern, flags=0):
"""Apply the search backrefs to the search pattern."""
if isinstance(pattern, (str, bytes)):
re_verbose = bool(VERBOSE & flags)
re_unicode = None
if bool((ASCII | LOCALE) & flags):
re_unicode = False
elif bool(UNICODE & f... | python | def _apply_search_backrefs(pattern, flags=0):
"""Apply the search backrefs to the search pattern."""
if isinstance(pattern, (str, bytes)):
re_verbose = bool(VERBOSE & flags)
re_unicode = None
if bool((ASCII | LOCALE) & flags):
re_unicode = False
elif bool(UNICODE & f... | Apply the search backrefs to the search pattern. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/bre.py#L120-L143 |
facelessuser/backrefs | backrefs/bre.py | compile | def compile(pattern, flags=0, auto_compile=None): # noqa A001
"""Compile both the search or search and replace into one object."""
if isinstance(pattern, Bre):
if auto_compile is not None:
raise ValueError("Cannot compile Bre with a different auto_compile!")
elif flags != 0:
... | python | def compile(pattern, flags=0, auto_compile=None): # noqa A001
"""Compile both the search or search and replace into one object."""
if isinstance(pattern, Bre):
if auto_compile is not None:
raise ValueError("Cannot compile Bre with a different auto_compile!")
elif flags != 0:
... | Compile both the search or search and replace into one object. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/bre.py#L310-L323 |
facelessuser/backrefs | backrefs/bre.py | compile_replace | def compile_replace(pattern, repl, flags=0):
"""Construct a method that can be used as a replace method for `sub`, `subn`, etc."""
call = None
if pattern is not None and isinstance(pattern, _RE_TYPE):
if isinstance(repl, (str, bytes)):
if not (pattern.flags & DEBUG):
cal... | python | def compile_replace(pattern, repl, flags=0):
"""Construct a method that can be used as a replace method for `sub`, `subn`, etc."""
call = None
if pattern is not None and isinstance(pattern, _RE_TYPE):
if isinstance(repl, (str, bytes)):
if not (pattern.flags & DEBUG):
cal... | Construct a method that can be used as a replace method for `sub`, `subn`, etc. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/bre.py#L332-L352 |
facelessuser/backrefs | backrefs/bre.py | findall | def findall(pattern, string, *args, **kwargs):
"""Apply `findall` after applying backrefs."""
flags = args[2] if len(args) > 2 else kwargs.get('flags', 0)
return _re.findall(_apply_search_backrefs(pattern, flags), string, *args, **kwargs) | python | def findall(pattern, string, *args, **kwargs):
"""Apply `findall` after applying backrefs."""
flags = args[2] if len(args) > 2 else kwargs.get('flags', 0)
return _re.findall(_apply_search_backrefs(pattern, flags), string, *args, **kwargs) | Apply `findall` after applying backrefs. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/bre.py#L405-L409 |
facelessuser/backrefs | backrefs/bre.py | sub | def sub(pattern, repl, string, *args, **kwargs):
"""Apply `sub` after applying backrefs."""
flags = args[4] if len(args) > 4 else kwargs.get('flags', 0)
is_replace = _is_replace(repl)
is_string = isinstance(repl, (str, bytes))
if is_replace and repl.use_format:
raise ValueError("Compiled re... | python | def sub(pattern, repl, string, *args, **kwargs):
"""Apply `sub` after applying backrefs."""
flags = args[4] if len(args) > 4 else kwargs.get('flags', 0)
is_replace = _is_replace(repl)
is_string = isinstance(repl, (str, bytes))
if is_replace and repl.use_format:
raise ValueError("Compiled re... | Apply `sub` after applying backrefs. | https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/bre.py#L419-L431 |
pinax/pinax-webanalytics | pinax/webanalytics/activity.py | add | def add(request, kind, method, *args):
"""
add(request, "mixpanel", "track", "purchase", {order: "1234", amount: "100"})
add(request, "google", "push", ["_addTrans", "1234", "Gondor", "100"])
"""
request.session.setdefault(_key_name(kind), []).append({
"method": method,
"args": args
... | python | def add(request, kind, method, *args):
"""
add(request, "mixpanel", "track", "purchase", {order: "1234", amount: "100"})
add(request, "google", "push", ["_addTrans", "1234", "Gondor", "100"])
"""
request.session.setdefault(_key_name(kind), []).append({
"method": method,
"args": args
... | add(request, "mixpanel", "track", "purchase", {order: "1234", amount: "100"})
add(request, "google", "push", ["_addTrans", "1234", "Gondor", "100"]) | https://github.com/pinax/pinax-webanalytics/blob/bc84f6bcefa022bfd2532187e5a949a391494578/pinax/webanalytics/activity.py#L25-L33 |
joesecurity/jbxapi | setup.py | get_version | def get_version():
""" Extract the version number from the code. """
here = os.path.abspath(os.path.dirname(__file__))
jbxapi_file = os.path.join(here, "jbxapi.py")
with open(jbxapi_file) as f:
content = f.read()
match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", content, re.M)
... | python | def get_version():
""" Extract the version number from the code. """
here = os.path.abspath(os.path.dirname(__file__))
jbxapi_file = os.path.join(here, "jbxapi.py")
with open(jbxapi_file) as f:
content = f.read()
match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", content, re.M)
... | Extract the version number from the code. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/setup.py#L7-L18 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.analysis_list | def analysis_list(self):
"""
Fetch a list of all analyses.
"""
response = self._post(self.apiurl + '/v2/analysis/list', data={'apikey': self.apikey})
return self._raise_or_extract(response) | python | def analysis_list(self):
"""
Fetch a list of all analyses.
"""
response = self._post(self.apiurl + '/v2/analysis/list', data={'apikey': self.apikey})
return self._raise_or_extract(response) | Fetch a list of all analyses. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L158-L164 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.submit_sample | def submit_sample(self, sample, cookbook=None, params={}, _extra_params={}):
"""
Submit a sample and returns the submission id.
Parameters:
sample: The sample to submit. Needs to be a file-like object or a tuple in
the shape (filename, file-like object).
... | python | def submit_sample(self, sample, cookbook=None, params={}, _extra_params={}):
"""
Submit a sample and returns the submission id.
Parameters:
sample: The sample to submit. Needs to be a file-like object or a tuple in
the shape (filename, file-like object).
... | Submit a sample and returns the submission id.
Parameters:
sample: The sample to submit. Needs to be a file-like object or a tuple in
the shape (filename, file-like object).
cookbook: Uploads a cookbook together with the sample. Needs to be a file-like obje... | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L166-L202 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.submit_sample_url | def submit_sample_url(self, url, params={}, _extra_params={}):
"""
Submit a sample at a given URL for analysis.
"""
self._check_user_parameters(params)
params = copy.copy(params)
params['sample-url'] = url
return self._submit(params, _extra_params=_extra_params) | python | def submit_sample_url(self, url, params={}, _extra_params={}):
"""
Submit a sample at a given URL for analysis.
"""
self._check_user_parameters(params)
params = copy.copy(params)
params['sample-url'] = url
return self._submit(params, _extra_params=_extra_params) | Submit a sample at a given URL for analysis. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L204-L211 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.submit_url | def submit_url(self, url, params={}, _extra_params={}):
"""
Submit a website for analysis.
"""
self._check_user_parameters(params)
params = copy.copy(params)
params['url'] = url
return self._submit(params, _extra_params=_extra_params) | python | def submit_url(self, url, params={}, _extra_params={}):
"""
Submit a website for analysis.
"""
self._check_user_parameters(params)
params = copy.copy(params)
params['url'] = url
return self._submit(params, _extra_params=_extra_params) | Submit a website for analysis. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L213-L220 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.submit_cookbook | def submit_cookbook(self, cookbook, params={}, _extra_params={}):
"""
Submit a cookbook.
"""
self._check_user_parameters(params)
files = {'cookbook': cookbook}
return self._submit(params, files, _extra_params=_extra_params) | python | def submit_cookbook(self, cookbook, params={}, _extra_params={}):
"""
Submit a cookbook.
"""
self._check_user_parameters(params)
files = {'cookbook': cookbook}
return self._submit(params, files, _extra_params=_extra_params) | Submit a cookbook. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L222-L228 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.submission_delete | def submission_delete(self, submission_id):
"""
Delete a submission.
"""
response = self._post(self.apiurl + '/v2/submission/delete', data={'apikey': self.apikey, 'submission_id': submission_id})
return self._raise_or_extract(response) | python | def submission_delete(self, submission_id):
"""
Delete a submission.
"""
response = self._post(self.apiurl + '/v2/submission/delete', data={'apikey': self.apikey, 'submission_id': submission_id})
return self._raise_or_extract(response) | Delete a submission. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L271-L277 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.server_online | def server_online(self):
"""
Returns True if the Joe Sandbox servers are running or False if they are in maintenance mode.
"""
response = self._post(self.apiurl + '/v2/server/online', data={'apikey': self.apikey})
return self._raise_or_extract(response) | python | def server_online(self):
"""
Returns True if the Joe Sandbox servers are running or False if they are in maintenance mode.
"""
response = self._post(self.apiurl + '/v2/server/online', data={'apikey': self.apikey})
return self._raise_or_extract(response) | Returns True if the Joe Sandbox servers are running or False if they are in maintenance mode. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L279-L285 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.analysis_info | def analysis_info(self, webid):
"""
Show the status and most important attributes of an analysis.
"""
response = self._post(self.apiurl + "/v2/analysis/info", data={'apikey': self.apikey, 'webid': webid})
return self._raise_or_extract(response) | python | def analysis_info(self, webid):
"""
Show the status and most important attributes of an analysis.
"""
response = self._post(self.apiurl + "/v2/analysis/info", data={'apikey': self.apikey, 'webid': webid})
return self._raise_or_extract(response) | Show the status and most important attributes of an analysis. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L287-L293 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.analysis_download | def analysis_download(self, webid, type, run=None, file=None):
"""
Download a resource for an analysis. E.g. the full report, binaries, screenshots.
The full list of resources can be found in our API documentation.
When `file` is given, the return value is the filename specified by the ... | python | def analysis_download(self, webid, type, run=None, file=None):
"""
Download a resource for an analysis. E.g. the full report, binaries, screenshots.
The full list of resources can be found in our API documentation.
When `file` is given, the return value is the filename specified by the ... | Download a resource for an analysis. E.g. the full report, binaries, screenshots.
The full list of resources can be found in our API documentation.
When `file` is given, the return value is the filename specified by the server,
otherwise it's a tuple of (filename, bytes).
Parameters:
... | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L303-L363 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.analysis_search | def analysis_search(self, query):
"""
Lists the webids of the analyses that match the given query.
Searches in MD5, SHA1, SHA256, filename, cookbook name, comment, url and report id.
"""
response = self._post(self.apiurl + "/v2/analysis/search", data={'apikey': self.apikey, 'q':... | python | def analysis_search(self, query):
"""
Lists the webids of the analyses that match the given query.
Searches in MD5, SHA1, SHA256, filename, cookbook name, comment, url and report id.
"""
response = self._post(self.apiurl + "/v2/analysis/search", data={'apikey': self.apikey, 'q':... | Lists the webids of the analyses that match the given query.
Searches in MD5, SHA1, SHA256, filename, cookbook name, comment, url and report id. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L365-L373 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.server_systems | def server_systems(self):
"""
Retrieve a list of available systems.
"""
response = self._post(self.apiurl + "/v2/server/systems", data={'apikey': self.apikey})
return self._raise_or_extract(response) | python | def server_systems(self):
"""
Retrieve a list of available systems.
"""
response = self._post(self.apiurl + "/v2/server/systems", data={'apikey': self.apikey})
return self._raise_or_extract(response) | Retrieve a list of available systems. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L375-L381 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.account_info | def account_info(self):
"""
Only available on Joe Sandbox Cloud
Show information about the account.
"""
response = self._post(self.apiurl + "/v2/account/info", data={'apikey': self.apikey})
return self._raise_or_extract(response) | python | def account_info(self):
"""
Only available on Joe Sandbox Cloud
Show information about the account.
"""
response = self._post(self.apiurl + "/v2/account/info", data={'apikey': self.apikey})
return self._raise_or_extract(response) | Only available on Joe Sandbox Cloud
Show information about the account. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L383-L391 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.server_info | def server_info(self):
"""
Query information about the server.
"""
response = self._post(self.apiurl + "/v2/server/info", data={'apikey': self.apikey})
return self._raise_or_extract(response) | python | def server_info(self):
"""
Query information about the server.
"""
response = self._post(self.apiurl + "/v2/server/info", data={'apikey': self.apikey})
return self._raise_or_extract(response) | Query information about the server. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L393-L399 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.server_lia_countries | def server_lia_countries(self):
"""
Show the available localized internet anonymization countries.
"""
response = self._post(self.apiurl + "/v2/server/lia_countries", data={'apikey': self.apikey})
return self._raise_or_extract(response) | python | def server_lia_countries(self):
"""
Show the available localized internet anonymization countries.
"""
response = self._post(self.apiurl + "/v2/server/lia_countries", data={'apikey': self.apikey})
return self._raise_or_extract(response) | Show the available localized internet anonymization countries. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L401-L407 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox.server_languages_and_locales | def server_languages_and_locales(self):
"""
Show the available languages and locales
"""
response = self._post(self.apiurl + "/v2/server/languages_and_locales", data={'apikey': self.apikey})
return self._raise_or_extract(response) | python | def server_languages_and_locales(self):
"""
Show the available languages and locales
"""
response = self._post(self.apiurl + "/v2/server/languages_and_locales", data={'apikey': self.apikey})
return self._raise_or_extract(response) | Show the available languages and locales | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L409-L415 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox._post | def _post(self, url, data=None, **kwargs):
"""
Wrapper around requests.post which
(a) always inserts a timeout
(b) converts errors to ConnectionError
(c) re-tries a few times
(d) converts file names to ASCII
"""
# Remove non-ASCII charact... | python | def _post(self, url, data=None, **kwargs):
"""
Wrapper around requests.post which
(a) always inserts a timeout
(b) converts errors to ConnectionError
(c) re-tries a few times
(d) converts file names to ASCII
"""
# Remove non-ASCII charact... | Wrapper around requests.post which
(a) always inserts a timeout
(b) converts errors to ConnectionError
(c) re-tries a few times
(d) converts file names to ASCII | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L417-L463 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox._check_user_parameters | def _check_user_parameters(self, user_parameters):
"""
Verifies that the parameter dict given by the user only contains
known keys. This ensures that the user detects typos faster.
"""
if not user_parameters:
return
# sanity check against typos
for ke... | python | def _check_user_parameters(self, user_parameters):
"""
Verifies that the parameter dict given by the user only contains
known keys. This ensures that the user detects typos faster.
"""
if not user_parameters:
return
# sanity check against typos
for ke... | Verifies that the parameter dict given by the user only contains
known keys. This ensures that the user detects typos faster. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L465-L476 |
joesecurity/jbxapi | jbxapi.py | JoeSandbox._raise_or_extract | def _raise_or_extract(self, response):
"""
Raises an exception if the response indicates an API error.
Otherwise returns the object at the 'data' key of the API response.
"""
try:
data = response.json()
except ValueError:
raise JoeException("The ... | python | def _raise_or_extract(self, response):
"""
Raises an exception if the response indicates an API error.
Otherwise returns the object at the 'data' key of the API response.
"""
try:
data = response.json()
except ValueError:
raise JoeException("The ... | Raises an exception if the response indicates an API error.
Otherwise returns the object at the 'data' key of the API response. | https://github.com/joesecurity/jbxapi/blob/cea2f5edef9661d53fe3d58435d4e88701331f79/jbxapi.py#L478-L497 |
nir0s/distro | distro.py | LinuxDistribution._parse_os_release_content | def _parse_os_release_content(lines):
"""
Parse the lines of an os-release file.
Parameters:
* lines: Iterable through the lines in the os-release file.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
A ... | python | def _parse_os_release_content(lines):
"""
Parse the lines of an os-release file.
Parameters:
* lines: Iterable through the lines in the os-release file.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
A ... | Parse the lines of an os-release file.
Parameters:
* lines: Iterable through the lines in the os-release file.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
A dictionary containing all information items. | https://github.com/nir0s/distro/blob/f3e164cf085ad68822a4be9b7b1531ea8ce14499/distro.py#L933-L997 |
merenlab/illumina-utils | IlluminaUtils/utils/helperfunctions.py | visualize_qual_stats_dict_single | def visualize_qual_stats_dict_single(D, dest, title):
"""
same as visualize_qual_stats_dict, but puts all tiles together.
"""
# first find out how many cycles were there. it is going to be about 101 for
# hiseq runs, and 251 in miseq runs, but these values may change from run to
# run. although... | python | def visualize_qual_stats_dict_single(D, dest, title):
"""
same as visualize_qual_stats_dict, but puts all tiles together.
"""
# first find out how many cycles were there. it is going to be about 101 for
# hiseq runs, and 251 in miseq runs, but these values may change from run to
# run. although... | same as visualize_qual_stats_dict, but puts all tiles together. | https://github.com/merenlab/illumina-utils/blob/246d0611f976471783b83d2aba309b0cb57210f6/IlluminaUtils/utils/helperfunctions.py#L572-L654 |
merenlab/illumina-utils | IlluminaUtils/utils/terminal.py | pretty_print | def pretty_print(n):
"""Pretty print function for very big integers"""
if type(n) != int:
return n
ret = []
n = str(n)
for i in range(len(n) - 1, -1, -1):
ret.append(n[i])
if (len(n) - i) % 3 == 0:
ret.append(',')
ret.reverse()
return ''.join(ret[1:]) if ... | python | def pretty_print(n):
"""Pretty print function for very big integers"""
if type(n) != int:
return n
ret = []
n = str(n)
for i in range(len(n) - 1, -1, -1):
ret.append(n[i])
if (len(n) - i) % 3 == 0:
ret.append(',')
ret.reverse()
return ''.join(ret[1:]) if ... | Pretty print function for very big integers | https://github.com/merenlab/illumina-utils/blob/246d0611f976471783b83d2aba309b0cb57210f6/IlluminaUtils/utils/terminal.py#L170-L182 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/neutron_ext/extensions/a10Certificate.py | A10Certificate.get_resources | def get_resources(cls):
"""Returns external resources."""
my_plurals = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
attributes.PLURALS.update(my_plurals)
attr_map = RESOURCE_ATTRIBUTE_MAP
ext_resources = resource_helper.build_resource_info(my_plu... | python | def get_resources(cls):
"""Returns external resources."""
my_plurals = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
attributes.PLURALS.update(my_plurals)
attr_map = RESOURCE_ATTRIBUTE_MAP
ext_resources = resource_helper.build_resource_info(my_plu... | Returns external resources. | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/neutron_ext/extensions/a10Certificate.py#L78-L88 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/neutron_ext/services/a10_device_instance/plugin.py | A10DeviceInstancePlugin.create_a10_device_instance | def create_a10_device_instance(self, context, a10_device_instance):
"""Attempt to create instance using neutron context"""
LOG.debug("A10DeviceInstancePlugin.create(): a10_device_instance=%s", a10_device_instance)
config = a10_config.A10Config()
vthunder_defaults = config.get_vthunder_c... | python | def create_a10_device_instance(self, context, a10_device_instance):
"""Attempt to create instance using neutron context"""
LOG.debug("A10DeviceInstancePlugin.create(): a10_device_instance=%s", a10_device_instance)
config = a10_config.A10Config()
vthunder_defaults = config.get_vthunder_c... | Attempt to create instance using neutron context | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/neutron_ext/services/a10_device_instance/plugin.py#L95-L122 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/v1/handler_vip.py | VipHandler.vport_meta | def vport_meta(self, vip):
"""Get the vport meta, no matter which name was used"""
vport_meta = self.meta(vip, 'vport', None)
if vport_meta is None:
vport_meta = self.meta(vip, 'port', {})
return vport_meta | python | def vport_meta(self, vip):
"""Get the vport meta, no matter which name was used"""
vport_meta = self.meta(vip, 'vport', None)
if vport_meta is None:
vport_meta = self.meta(vip, 'port', {})
return vport_meta | Get the vport meta, no matter which name was used | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/v1/handler_vip.py#L28-L33 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/neutron_ext/common/resources.py | apply_template | def apply_template(template, *args, **kw):
"""Applies every callable in any Mapping or Iterable"""
if six.callable(template):
return template(*args, **kw)
if isinstance(template, six.string_types):
return template
if isinstance(template, collections.Mapping):
return template.__cl... | python | def apply_template(template, *args, **kw):
"""Applies every callable in any Mapping or Iterable"""
if six.callable(template):
return template(*args, **kw)
if isinstance(template, six.string_types):
return template
if isinstance(template, collections.Mapping):
return template.__cl... | Applies every callable in any Mapping or Iterable | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/neutron_ext/common/resources.py#L26-L36 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/neutron_ext/extensions/a10DeviceInstance.py | A10deviceinstance.get_resources | def get_resources(cls):
"""Returns external resources."""
my_plurals = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
attributes.PLURALS.update(my_plurals)
attr_map = RESOURCE_ATTRIBUTE_MAP
resources = resource_helper.build_resource_info(my_plurals... | python | def get_resources(cls):
"""Returns external resources."""
my_plurals = resource_helper.build_plural_mappings(
{}, RESOURCE_ATTRIBUTE_MAP)
attributes.PLURALS.update(my_plurals)
attr_map = RESOURCE_ATTRIBUTE_MAP
resources = resource_helper.build_resource_info(my_plurals... | Returns external resources. | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/neutron_ext/extensions/a10DeviceInstance.py#L78-L88 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/vthunder/instance_initialization.py | initialize_vthunder | def initialize_vthunder(a10_cfg, device_cfg, client):
"""Perform initialization of system-wide settings"""
vth = a10_cfg.get_vthunder_config()
initialize_interfaces(vth, device_cfg, client)
initialize_dns(vth, device_cfg, client)
initialize_licensing(vth, device_cfg, client)
initialize_sflow(vt... | python | def initialize_vthunder(a10_cfg, device_cfg, client):
"""Perform initialization of system-wide settings"""
vth = a10_cfg.get_vthunder_config()
initialize_interfaces(vth, device_cfg, client)
initialize_dns(vth, device_cfg, client)
initialize_licensing(vth, device_cfg, client)
initialize_sflow(vt... | Perform initialization of system-wide settings | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/vthunder/instance_initialization.py#L74-L81 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/db/api.py | magic_session | def magic_session(db_session=None, url=None):
"""Either does nothing with the session you already have or
makes one that commits and closes no matter what happens
"""
if db_session is not None:
yield db_session
else:
session = get_session(url, expire_on_commit=False)
try:
... | python | def magic_session(db_session=None, url=None):
"""Either does nothing with the session you already have or
makes one that commits and closes no matter what happens
"""
if db_session is not None:
yield db_session
else:
session = get_session(url, expire_on_commit=False)
try:
... | Either does nothing with the session you already have or
makes one that commits and closes no matter what happens | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/db/api.py#L50-L65 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/vthunder/instance_manager.py | InstanceManager._plumb_port | def _plumb_port(self, server, network_id, wrong_ips):
"""Look for an existing port on the network
Add one if it doesn't exist
"""
for attached_interface in server.interface_list():
if attached_interface.net_id == network_id:
if any(map(lambda x: x['ip_address... | python | def _plumb_port(self, server, network_id, wrong_ips):
"""Look for an existing port on the network
Add one if it doesn't exist
"""
for attached_interface in server.interface_list():
if attached_interface.net_id == network_id:
if any(map(lambda x: x['ip_address... | Look for an existing port on the network
Add one if it doesn't exist | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/vthunder/instance_manager.py#L349-L360 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/plumbing/wrappers.py | NeutronDbWrapper.allocate_ip_for_subnet | def allocate_ip_for_subnet(self, subnet_id, mac, port_id):
"""Allocates an IP from the specified subnet and creates a port"""
# Get an available IP and mark it as used before someone else does
# If there's no IP, , log it and return an error
# If we successfully get an IP, create a port ... | python | def allocate_ip_for_subnet(self, subnet_id, mac, port_id):
"""Allocates an IP from the specified subnet and creates a port"""
# Get an available IP and mark it as used before someone else does
# If there's no IP, , log it and return an error
# If we successfully get an IP, create a port ... | Allocates an IP from the specified subnet and creates a port | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/plumbing/wrappers.py#L132-L140 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/plumbing/wrappers.py | NeutronDbWrapper.a10_allocate_ip_from_dhcp_range | def a10_allocate_ip_from_dhcp_range(self, subnet, interface_id, mac, port_id):
"""Search for an available IP.addr from unallocated nmodels.IPAllocationPool range.
If no addresses are available then an error is raised. Returns the address as a string.
This search is conducted by a difference of t... | python | def a10_allocate_ip_from_dhcp_range(self, subnet, interface_id, mac, port_id):
"""Search for an available IP.addr from unallocated nmodels.IPAllocationPool range.
If no addresses are available then an error is raised. Returns the address as a string.
This search is conducted by a difference of t... | Search for an available IP.addr from unallocated nmodels.IPAllocationPool range.
If no addresses are available then an error is raised. Returns the address as a string.
This search is conducted by a difference of the nmodels.IPAllocationPool set_a
and the current IP allocations. | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/plumbing/wrappers.py#L195-L225 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/v1/handler_hm.py | HealthMonitorHandler._dissociate | def _dissociate(self, c, context, hm, pool_id):
"""Remove a pool association"""
pool_name = self._pool_name(context, pool_id)
c.client.slb.service_group.update(pool_name, health_monitor="",
health_check_disable=True) | python | def _dissociate(self, c, context, hm, pool_id):
"""Remove a pool association"""
pool_name = self._pool_name(context, pool_id)
c.client.slb.service_group.update(pool_name, health_monitor="",
health_check_disable=True) | Remove a pool association | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/v1/handler_hm.py#L75-L79 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/v1/handler_hm.py | HealthMonitorHandler.dissociate | def dissociate(self, c, context, hm, pool_id):
"""Remove a pool association, and the healthmonitor if its the last one"""
self._dissociate(c, context, hm, pool_id)
pools = hm.get("pools", [])
if not any(p for p in pools if p.get("pool_id") != pool_id):
self._delete_unused(c,... | python | def dissociate(self, c, context, hm, pool_id):
"""Remove a pool association, and the healthmonitor if its the last one"""
self._dissociate(c, context, hm, pool_id)
pools = hm.get("pools", [])
if not any(p for p in pools if p.get("pool_id") != pool_id):
self._delete_unused(c,... | Remove a pool association, and the healthmonitor if its the last one | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/v1/handler_hm.py#L81-L87 |
a10networks/a10-neutron-lbaas | a10_neutron_lbaas/v1/handler_hm.py | HealthMonitorHandler._delete | def _delete(self, c, context, hm):
"""Delete a healthmonitor and ALL its pool associations"""
pools = hm.get("pools", [])
for pool in pools:
pool_id = pool.get("pool_id")
self._dissociate(c, context, hm, pool_id)
self._delete_unused(c, context, hm) | python | def _delete(self, c, context, hm):
"""Delete a healthmonitor and ALL its pool associations"""
pools = hm.get("pools", [])
for pool in pools:
pool_id = pool.get("pool_id")
self._dissociate(c, context, hm, pool_id)
self._delete_unused(c, context, hm) | Delete a healthmonitor and ALL its pool associations | https://github.com/a10networks/a10-neutron-lbaas/blob/ff834c295c8019874ca4b209d864367e40cc9881/a10_neutron_lbaas/v1/handler_hm.py#L89-L97 |
Dallinger/Dallinger | demos/dlgr/demos/rogers/models.py | RogersAgent.calculate_fitness | def calculate_fitness(self):
"""Calculcate your fitness."""
if self.fitness is not None:
raise Exception(
"You are calculating the fitness of agent {}, ".format(self.id)
+ "but they already have a fitness"
)
said_blue = self.infos(type=Mem... | python | def calculate_fitness(self):
"""Calculcate your fitness."""
if self.fitness is not None:
raise Exception(
"You are calculating the fitness of agent {}, ".format(self.id)
+ "but they already have a fitness"
)
said_blue = self.infos(type=Mem... | Calculcate your fitness. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/rogers/models.py#L94-L125 |
Dallinger/Dallinger | demos/dlgr/demos/rogers/models.py | RogersAgent.update | def update(self, infos):
"""Process received infos."""
genes = [i for i in infos if isinstance(i, LearningGene)]
for gene in genes:
if (
self.network.role == "experiment"
and self.generation > 0
and random.random() < 0.10
):... | python | def update(self, infos):
"""Process received infos."""
genes = [i for i in infos if isinstance(i, LearningGene)]
for gene in genes:
if (
self.network.role == "experiment"
and self.generation > 0
and random.random() < 0.10
):... | Process received infos. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/rogers/models.py#L127-L138 |
Dallinger/Dallinger | demos/dlgr/demos/bartlett1932/experiment.py | Bartlett1932.setup | def setup(self):
"""Setup the networks.
Setup only does stuff if there are no networks, this is so it only
runs once at the start of the experiment. It first calls the same
function in the super (see experiments.py in dallinger). Then it adds a
source to each network.
""... | python | def setup(self):
"""Setup the networks.
Setup only does stuff if there are no networks, this is so it only
runs once at the start of the experiment. It first calls the same
function in the super (see experiments.py in dallinger). Then it adds a
source to each network.
""... | Setup the networks.
Setup only does stuff if there are no networks, this is so it only
runs once at the start of the experiment. It first calls the same
function in the super (see experiments.py in dallinger). Then it adds a
source to each network. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/bartlett1932/experiment.py#L47-L58 |
Dallinger/Dallinger | demos/dlgr/demos/bartlett1932/experiment.py | Bartlett1932.add_node_to_network | def add_node_to_network(self, node, network):
"""Add node to the chain and receive transmissions."""
network.add_node(node)
parents = node.neighbors(direction="from")
if len(parents):
parent = parents[0]
parent.transmit()
node.receive() | python | def add_node_to_network(self, node, network):
"""Add node to the chain and receive transmissions."""
network.add_node(node)
parents = node.neighbors(direction="from")
if len(parents):
parent = parents[0]
parent.transmit()
node.receive() | Add node to the chain and receive transmissions. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/bartlett1932/experiment.py#L64-L71 |
Dallinger/Dallinger | demos/dlgr/demos/bartlett1932/experiment.py | Bartlett1932.recruit | def recruit(self):
"""Recruit one participant at a time until all networks are full."""
if self.networks(full=False):
self.recruiter.recruit(n=1)
else:
self.recruiter.close_recruitment() | python | def recruit(self):
"""Recruit one participant at a time until all networks are full."""
if self.networks(full=False):
self.recruiter.recruit(n=1)
else:
self.recruiter.close_recruitment() | Recruit one participant at a time until all networks are full. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/bartlett1932/experiment.py#L73-L78 |
Dallinger/Dallinger | demos/dlgr/demos/bartlett1932/experiment.py | Bot.participate | def participate(self):
"""Finish reading and send text"""
try:
logger.info("Entering participate method")
ready = WebDriverWait(self.driver, 10).until(
EC.element_to_be_clickable((By.ID, "finish-reading"))
)
stimulus = self.driver.find_elem... | python | def participate(self):
"""Finish reading and send text"""
try:
logger.info("Entering participate method")
ready = WebDriverWait(self.driver, 10).until(
EC.element_to_be_clickable((By.ID, "finish-reading"))
)
stimulus = self.driver.find_elem... | Finish reading and send text | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/bartlett1932/experiment.py#L84-L111 |
Dallinger/Dallinger | dallinger/nodes.py | Source.create_information | def create_information(self):
"""Create new infos on demand."""
info = self._info_type()(origin=self, contents=self._contents())
return info | python | def create_information(self):
"""Create new infos on demand."""
info = self._info_type()(origin=self, contents=self._contents())
return info | Create new infos on demand. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/nodes.py#L63-L66 |
Dallinger/Dallinger | demos/dlgr/demos/iterated_drawing/experiment.py | IteratedDrawing.setup | def setup(self):
"""Setup the networks.
Setup only does stuff if there are no networks, this is so it only
runs once at the start of the experiment. It first calls the same
function in the super (see experiments.py in dallinger). Then it adds a
source to each network.
""... | python | def setup(self):
"""Setup the networks.
Setup only does stuff if there are no networks, this is so it only
runs once at the start of the experiment. It first calls the same
function in the super (see experiments.py in dallinger). Then it adds a
source to each network.
""... | Setup the networks.
Setup only does stuff if there are no networks, this is so it only
runs once at the start of the experiment. It first calls the same
function in the super (see experiments.py in dallinger). Then it adds a
source to each network. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/iterated_drawing/experiment.py#L28-L39 |
Dallinger/Dallinger | demos/dlgr/demos/rogers/experiment.py | RogersExperiment.setup | def setup(self):
"""First time setup."""
super(RogersExperiment, self).setup()
for net in random.sample(self.networks(role="experiment"), self.catch_repeats):
net.role = "catch"
for net in self.networks():
source = self.models.RogersSource(network=net)
... | python | def setup(self):
"""First time setup."""
super(RogersExperiment, self).setup()
for net in random.sample(self.networks(role="experiment"), self.catch_repeats):
net.role = "catch"
for net in self.networks():
source = self.models.RogersSource(network=net)
... | First time setup. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/rogers/experiment.py#L82-L95 |
Dallinger/Dallinger | demos/dlgr/demos/rogers/experiment.py | RogersExperiment.create_network | def create_network(self):
"""Create a new network."""
return DiscreteGenerational(
generations=self.generations,
generation_size=self.generation_size,
initial_source=True,
) | python | def create_network(self):
"""Create a new network."""
return DiscreteGenerational(
generations=self.generations,
generation_size=self.generation_size,
initial_source=True,
) | Create a new network. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/rogers/experiment.py#L105-L111 |
Dallinger/Dallinger | demos/dlgr/demos/rogers/experiment.py | RogersExperiment.create_node | def create_node(self, network, participant):
"""Make a new node for participants."""
return self.models.RogersAgent(network=network, participant=participant) | python | def create_node(self, network, participant):
"""Make a new node for participants."""
return self.models.RogersAgent(network=network, participant=participant) | Make a new node for participants. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/rogers/experiment.py#L113-L115 |
Dallinger/Dallinger | demos/dlgr/demos/rogers/experiment.py | RogersExperiment.submission_successful | def submission_successful(self, participant):
"""Run when a participant submits successfully."""
num_approved = len(Participant.query.filter_by(status="approved").all())
current_generation = participant.nodes()[0].generation
if (
num_approved % self.generation_size == 0
... | python | def submission_successful(self, participant):
"""Run when a participant submits successfully."""
num_approved = len(Participant.query.filter_by(status="approved").all())
current_generation = participant.nodes()[0].generation
if (
num_approved % self.generation_size == 0
... | Run when a participant submits successfully. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/rogers/experiment.py#L121-L130 |
Dallinger/Dallinger | demos/dlgr/demos/rogers/experiment.py | RogersExperiment.recruit | def recruit(self):
"""Recruit participants if necessary."""
num_approved = len(Participant.query.filter_by(status="approved").all())
end_of_generation = num_approved % self.generation_size == 0
complete = num_approved >= (self.generations * self.generation_size)
if complete:
... | python | def recruit(self):
"""Recruit participants if necessary."""
num_approved = len(Participant.query.filter_by(status="approved").all())
end_of_generation = num_approved % self.generation_size == 0
complete = num_approved >= (self.generations * self.generation_size)
if complete:
... | Recruit participants if necessary. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/rogers/experiment.py#L132-L142 |
Dallinger/Dallinger | demos/dlgr/demos/rogers/experiment.py | RogersExperiment.bonus | def bonus(self, participant):
"""Calculate a participants bonus."""
scores = [
n.score for n in participant.nodes() if n.network.role == "experiment"
]
average = float(sum(scores)) / float(len(scores))
bonus = round(max(0.0, ((average - 0.5) * 2)) * self.bonus_paymen... | python | def bonus(self, participant):
"""Calculate a participants bonus."""
scores = [
n.score for n in participant.nodes() if n.network.role == "experiment"
]
average = float(sum(scores)) / float(len(scores))
bonus = round(max(0.0, ((average - 0.5) * 2)) * self.bonus_paymen... | Calculate a participants bonus. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/rogers/experiment.py#L144-L152 |
Dallinger/Dallinger | demos/dlgr/demos/rogers/experiment.py | RogersExperiment.attention_check | def attention_check(self, participant=None):
"""Check a participant paid attention."""
if self.catch_repeats == 0:
return True
scores = [n.score for n in participant.nodes() if n.network.role == "catch"]
avg = float(sum(scores)) / float(len(scores))
return avg >= sel... | python | def attention_check(self, participant=None):
"""Check a participant paid attention."""
if self.catch_repeats == 0:
return True
scores = [n.score for n in participant.nodes() if n.network.role == "catch"]
avg = float(sum(scores)) / float(len(scores))
return avg >= sel... | Check a participant paid attention. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/rogers/experiment.py#L154-L161 |
Dallinger/Dallinger | dallinger/deployment.py | size_on_copy | def size_on_copy(root="."):
"""Return the size of the experiment directory in bytes, excluding any
files and directories which would be excluded on copy.
"""
total_size = 0
exclusions = exclusion_policy()
for dirpath, dirnames, filenames in os.walk(root, topdown=True):
current_exclusions... | python | def size_on_copy(root="."):
"""Return the size of the experiment directory in bytes, excluding any
files and directories which would be excluded on copy.
"""
total_size = 0
exclusions = exclusion_policy()
for dirpath, dirnames, filenames in os.walk(root, topdown=True):
current_exclusions... | Return the size of the experiment directory in bytes, excluding any
files and directories which would be excluded on copy. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/deployment.py#L97-L113 |
Dallinger/Dallinger | dallinger/deployment.py | assemble_experiment_temp_dir | def assemble_experiment_temp_dir(config):
"""Create a temp directory from which to run an experiment.
The new directory will include:
- Copies of custom experiment files which don't match the exclusion policy
- Templates and static resources from Dallinger
- An export of the loaded configuration
... | python | def assemble_experiment_temp_dir(config):
"""Create a temp directory from which to run an experiment.
The new directory will include:
- Copies of custom experiment files which don't match the exclusion policy
- Templates and static resources from Dallinger
- An export of the loaded configuration
... | Create a temp directory from which to run an experiment.
The new directory will include:
- Copies of custom experiment files which don't match the exclusion policy
- Templates and static resources from Dallinger
- An export of the loaded configuration
- Heroku-specific files (Procile, runtime.txt) f... | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/deployment.py#L116-L186 |
Dallinger/Dallinger | dallinger/deployment.py | setup_experiment | def setup_experiment(log, debug=True, verbose=False, app=None, exp_config=None):
"""Checks the experiment's python dependencies, then prepares a temp directory
with files merged from the custom experiment and Dallinger.
The resulting directory includes all the files necessary to deploy to
Heroku.
"... | python | def setup_experiment(log, debug=True, verbose=False, app=None, exp_config=None):
"""Checks the experiment's python dependencies, then prepares a temp directory
with files merged from the custom experiment and Dallinger.
The resulting directory includes all the files necessary to deploy to
Heroku.
"... | Checks the experiment's python dependencies, then prepares a temp directory
with files merged from the custom experiment and Dallinger.
The resulting directory includes all the files necessary to deploy to
Heroku. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/deployment.py#L189-L241 |
Dallinger/Dallinger | dallinger/deployment.py | deploy_sandbox_shared_setup | def deploy_sandbox_shared_setup(log, verbose=True, app=None, exp_config=None):
"""Set up Git, push to Heroku, and launch the app."""
if verbose:
out = None
else:
out = open(os.devnull, "w")
config = get_config()
if not config.ready:
config.load()
heroku.sanity_check(conf... | python | def deploy_sandbox_shared_setup(log, verbose=True, app=None, exp_config=None):
"""Set up Git, push to Heroku, and launch the app."""
if verbose:
out = None
else:
out = open(os.devnull, "w")
config = get_config()
if not config.ready:
config.load()
heroku.sanity_check(conf... | Set up Git, push to Heroku, and launch the app. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/deployment.py#L282-L406 |
Dallinger/Dallinger | dallinger/deployment.py | HerokuLocalDeployment.run | def run(self):
"""Set up the environment, get a HerokuLocalWrapper instance, and pass
it to the concrete class's execute() method.
"""
self.configure()
self.setup()
self.update_dir()
db.init_db(drop_all=True)
self.out.log("Starting up the server...")
... | python | def run(self):
"""Set up the environment, get a HerokuLocalWrapper instance, and pass
it to the concrete class's execute() method.
"""
self.configure()
self.setup()
self.update_dir()
db.init_db(drop_all=True)
self.out.log("Starting up the server...")
... | Set up the environment, get a HerokuLocalWrapper instance, and pass
it to the concrete class's execute() method. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/deployment.py#L445-L462 |
Dallinger/Dallinger | dallinger/deployment.py | HerokuLocalDeployment.notify | def notify(self, message):
"""Callback function which checks lines of output, tries to match
against regex defined in subclass's "dispatch" dict, and passes through
to a handler on match.
"""
for regex, handler in self.dispatch.items():
match = re.search(regex, messag... | python | def notify(self, message):
"""Callback function which checks lines of output, tries to match
against regex defined in subclass's "dispatch" dict, and passes through
to a handler on match.
"""
for regex, handler in self.dispatch.items():
match = re.search(regex, messag... | Callback function which checks lines of output, tries to match
against regex defined in subclass's "dispatch" dict, and passes through
to a handler on match. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/deployment.py#L464-L473 |
Dallinger/Dallinger | dallinger/deployment.py | DebugDeployment.new_recruit | def new_recruit(self, match):
"""Dispatched to by notify(). If a recruitment request has been issued,
open a browser window for the a new participant (in this case the
person doing local debugging).
"""
self.out.log("new recruitment request!")
url = match.group(1)
... | python | def new_recruit(self, match):
"""Dispatched to by notify(). If a recruitment request has been issued,
open a browser window for the a new participant (in this case the
person doing local debugging).
"""
self.out.log("new recruitment request!")
url = match.group(1)
... | Dispatched to by notify(). If a recruitment request has been issued,
open a browser window for the a new participant (in this case the
person doing local debugging). | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/deployment.py#L527-L537 |
Dallinger/Dallinger | dallinger/deployment.py | DebugDeployment.recruitment_closed | def recruitment_closed(self, match):
"""Recruitment is closed.
Start a thread to check the experiment summary.
"""
if self.status_thread is None:
self.status_thread = threading.Thread(target=self.check_status)
self.status_thread.start() | python | def recruitment_closed(self, match):
"""Recruitment is closed.
Start a thread to check the experiment summary.
"""
if self.status_thread is None:
self.status_thread = threading.Thread(target=self.check_status)
self.status_thread.start() | Recruitment is closed.
Start a thread to check the experiment summary. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/deployment.py#L539-L546 |
Dallinger/Dallinger | dallinger/deployment.py | DebugDeployment.check_status | def check_status(self):
"""Check the output of the summary route until
the experiment is complete, then we can stop monitoring Heroku
subprocess output.
"""
self.out.log("Recruitment is complete. Waiting for experiment completion...")
base_url = get_base_url()
sta... | python | def check_status(self):
"""Check the output of the summary route until
the experiment is complete, then we can stop monitoring Heroku
subprocess output.
"""
self.out.log("Recruitment is complete. Waiting for experiment completion...")
base_url = get_base_url()
sta... | Check the output of the summary route until
the experiment is complete, then we can stop monitoring Heroku
subprocess output. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/deployment.py#L548-L568 |
Dallinger/Dallinger | dallinger/deployment.py | DebugDeployment.notify | def notify(self, message):
"""Monitor output from heroku process.
This overrides the base class's `notify`
to make sure that we stop if the status-monitoring thread
has determined that the experiment is complete.
"""
if self.complete:
return HerokuLocalWrappe... | python | def notify(self, message):
"""Monitor output from heroku process.
This overrides the base class's `notify`
to make sure that we stop if the status-monitoring thread
has determined that the experiment is complete.
"""
if self.complete:
return HerokuLocalWrappe... | Monitor output from heroku process.
This overrides the base class's `notify`
to make sure that we stop if the status-monitoring thread
has determined that the experiment is complete. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/deployment.py#L570-L579 |
Dallinger/Dallinger | dallinger/deployment.py | LoaderDeployment.execute | def execute(self, heroku):
"""Start the server, load the zip file into the database, then loop
until terminated with <control>-c.
"""
db.init_db(drop_all=True)
self.out.log(
"Ingesting dataset from {}...".format(os.path.basename(self.zip_path))
)
data.... | python | def execute(self, heroku):
"""Start the server, load the zip file into the database, then loop
until terminated with <control>-c.
"""
db.init_db(drop_all=True)
self.out.log(
"Ingesting dataset from {}...".format(os.path.basename(self.zip_path))
)
data.... | Start the server, load the zip file into the database, then loop
until terminated with <control>-c. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/deployment.py#L606-L626 |
Dallinger/Dallinger | dallinger/deployment.py | LoaderDeployment.start_replay | def start_replay(self, match):
"""Dispatched to by notify(). If a recruitment request has been issued,
open a browser window for the a new participant (in this case the
person doing local debugging).
"""
self.out.log("replay ready!")
url = match.group(1)
new_webbr... | python | def start_replay(self, match):
"""Dispatched to by notify(). If a recruitment request has been issued,
open a browser window for the a new participant (in this case the
person doing local debugging).
"""
self.out.log("replay ready!")
url = match.group(1)
new_webbr... | Dispatched to by notify(). If a recruitment request has been issued,
open a browser window for the a new participant (in this case the
person doing local debugging). | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/deployment.py#L628-L635 |
Dallinger/Dallinger | dallinger/experiment_server/gunicorn.py | StandaloneServer.load | def load(self):
"""Return our application to be run."""
app = util.import_app("dallinger.experiment_server.sockets:app")
if self.options.get("mode") == "debug":
app.debug = True
return app | python | def load(self):
"""Return our application to be run."""
app = util.import_app("dallinger.experiment_server.sockets:app")
if self.options.get("mode") == "debug":
app.debug = True
return app | Return our application to be run. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/experiment_server/gunicorn.py#L52-L57 |
Dallinger/Dallinger | demos/dlgr/demos/mcmcp/models.py | AnimalInfo.perturbed_contents | def perturbed_contents(self):
"""Perturb the given animal."""
animal = json.loads(self.contents)
for prop, prop_range in self.properties.items():
range = prop_range[1] - prop_range[0]
jittered = animal[prop] + random.gauss(0, 0.1 * range)
animal[prop] = max(m... | python | def perturbed_contents(self):
"""Perturb the given animal."""
animal = json.loads(self.contents)
for prop, prop_range in self.properties.items():
range = prop_range[1] - prop_range[0]
jittered = animal[prop] + random.gauss(0, 0.1 * range)
animal[prop] = max(m... | Perturb the given animal. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/mcmcp/models.py#L94-L103 |
Dallinger/Dallinger | dallinger/networks.py | DelayedChain.add_node | def add_node(self, node):
"""Add an agent, connecting it to the previous node."""
other_nodes = [n for n in self.nodes() if n.id != node.id]
if len(self.nodes()) > 11:
parents = [max(other_nodes, key=attrgetter("creation_time"))]
else:
parents = [n for n in other_... | python | def add_node(self, node):
"""Add an agent, connecting it to the previous node."""
other_nodes = [n for n in self.nodes() if n.id != node.id]
if len(self.nodes()) > 11:
parents = [max(other_nodes, key=attrgetter("creation_time"))]
else:
parents = [n for n in other_... | Add an agent, connecting it to the previous node. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/networks.py#L23-L32 |
Dallinger/Dallinger | dallinger/networks.py | FullyConnected.add_node | def add_node(self, node):
"""Add a node, connecting it to everyone and back."""
other_nodes = [n for n in self.nodes() if n.id != node.id]
for n in other_nodes:
if isinstance(n, Source):
node.connect(direction="from", whom=n)
else:
node.co... | python | def add_node(self, node):
"""Add a node, connecting it to everyone and back."""
other_nodes = [n for n in self.nodes() if n.id != node.id]
for n in other_nodes:
if isinstance(n, Source):
node.connect(direction="from", whom=n)
else:
node.co... | Add a node, connecting it to everyone and back. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/networks.py#L60-L68 |
Dallinger/Dallinger | dallinger/networks.py | Empty.add_source | def add_source(self, source):
"""Connect the source to all existing other nodes."""
nodes = [n for n in self.nodes() if not isinstance(n, Source)]
source.connect(whom=nodes) | python | def add_source(self, source):
"""Connect the source to all existing other nodes."""
nodes = [n for n in self.nodes() if not isinstance(n, Source)]
source.connect(whom=nodes) | Connect the source to all existing other nodes. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/networks.py#L80-L83 |
Dallinger/Dallinger | dallinger/networks.py | Star.add_node | def add_node(self, node):
"""Add a node and connect it to the center."""
nodes = self.nodes()
if len(nodes) > 1:
first_node = min(nodes, key=attrgetter("creation_time"))
first_node.connect(direction="both", whom=node) | python | def add_node(self, node):
"""Add a node and connect it to the center."""
nodes = self.nodes()
if len(nodes) > 1:
first_node = min(nodes, key=attrgetter("creation_time"))
first_node.connect(direction="both", whom=node) | Add a node and connect it to the center. | https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/networks.py#L95-L101 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.