Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
python-like pseudocode for marks that implement
# Implementation of a mark that precludes gpl license
class no_gpl: mark
propagation = propagation_types.called_code or propagation_types.contained_code
# Override mark.can_bind(). Return reason why binding is
# impossible, or None on success.
def can_bind(site, attachment):
if attachment == mark_types.explicit_affirmative:
if site.type.scope >= scope_types.code_block:
if site.get_call_tree().is_marked('gpl', mark_types.explicit_affirmative):
return "Is not compatible with GPL'ed code: %s" % site.get_url()
return "Can only bind to code blocks or broader constructs."
# Implementation of the mark for a gpl license
class gpl: mark
propagation = propagation_types.contained_code
def can_bind(site):
if attachment == mark_types.explicit_affirmative:
if site.type.scope < scope_types.code_block:
return "Can only bind to code blocks or broader constructs."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment