partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
_warn_node
Do not warn on external images.
docs/conf.py
def _warn_node(self, msg, *args, **kwargs): """Do not warn on external images.""" if not msg.startswith('nonlocal image URI found:'): _warn_node_old(self, msg, *args, **kwargs)
def _warn_node(self, msg, *args, **kwargs): """Do not warn on external images.""" if not msg.startswith('nonlocal image URI found:'): _warn_node_old(self, msg, *args, **kwargs)
[ "Do", "not", "warn", "on", "external", "images", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/docs/conf.py#L34-L37
[ "def", "_warn_node", "(", "self", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "msg", ".", "startswith", "(", "'nonlocal image URI found:'", ")", ":", "_warn_node_old", "(", "self", ",", "msg", ",", "*", "args", ",", ...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
connect_receivers
Connect receivers to signals.
zenodo_accessrequests/receivers.py
def connect_receivers(): """Connect receivers to signals.""" request_created.connect(send_email_validation) request_confirmed.connect(send_confirmed_notifications) request_rejected.connect(send_reject_notification) # Order is important: request_accepted.connect(create_secret_link) request_ac...
def connect_receivers(): """Connect receivers to signals.""" request_created.connect(send_email_validation) request_confirmed.connect(send_confirmed_notifications) request_rejected.connect(send_reject_notification) # Order is important: request_accepted.connect(create_secret_link) request_ac...
[ "Connect", "receivers", "to", "signals", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/receivers.py#L41-L48
[ "def", "connect_receivers", "(", ")", ":", "request_created", ".", "connect", "(", "send_email_validation", ")", "request_confirmed", ".", "connect", "(", "send_confirmed_notifications", ")", "request_rejected", ".", "connect", "(", "send_reject_notification", ")", "# O...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
create_secret_link
Receiver for request-accepted signal.
zenodo_accessrequests/receivers.py
def create_secret_link(request, message=None, expires_at=None): """Receiver for request-accepted signal.""" pid, record = get_record(request.recid) if not record: raise RecordNotFound(request.recid) description = render_template( "zenodo_accessrequests/link_description.tpl", req...
def create_secret_link(request, message=None, expires_at=None): """Receiver for request-accepted signal.""" pid, record = get_record(request.recid) if not record: raise RecordNotFound(request.recid) description = render_template( "zenodo_accessrequests/link_description.tpl", req...
[ "Receiver", "for", "request", "-", "accepted", "signal", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/receivers.py#L51-L70
[ "def", "create_secret_link", "(", "request", ",", "message", "=", "None", ",", "expires_at", "=", "None", ")", ":", "pid", ",", "record", "=", "get_record", "(", "request", ".", "recid", ")", "if", "not", "record", ":", "raise", "RecordNotFound", "(", "r...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
send_accept_notification
Receiver for request-accepted signal to send email notification.
zenodo_accessrequests/receivers.py
def send_accept_notification(request, message=None, expires_at=None): """Receiver for request-accepted signal to send email notification.""" pid, record = get_record(request.recid) _send_notification( request.sender_email, _("Access request accepted"), "zenodo_accessrequests/emails/a...
def send_accept_notification(request, message=None, expires_at=None): """Receiver for request-accepted signal to send email notification.""" pid, record = get_record(request.recid) _send_notification( request.sender_email, _("Access request accepted"), "zenodo_accessrequests/emails/a...
[ "Receiver", "for", "request", "-", "accepted", "signal", "to", "send", "email", "notification", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/receivers.py#L73-L86
[ "def", "send_accept_notification", "(", "request", ",", "message", "=", "None", ",", "expires_at", "=", "None", ")", ":", "pid", ",", "record", "=", "get_record", "(", "request", ".", "recid", ")", "_send_notification", "(", "request", ".", "sender_email", "...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
send_confirmed_notifications
Receiver for request-confirmed signal to send email notification.
zenodo_accessrequests/receivers.py
def send_confirmed_notifications(request): """Receiver for request-confirmed signal to send email notification.""" pid, record = get_record(request.recid) if record is None: current_app.logger.error("Cannot retrieve record %s. Emails not sent" % request.recid) ...
def send_confirmed_notifications(request): """Receiver for request-confirmed signal to send email notification.""" pid, record = get_record(request.recid) if record is None: current_app.logger.error("Cannot retrieve record %s. Emails not sent" % request.recid) ...
[ "Receiver", "for", "request", "-", "confirmed", "signal", "to", "send", "email", "notification", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/receivers.py#L89-L114
[ "def", "send_confirmed_notifications", "(", "request", ")", ":", "pid", ",", "record", "=", "get_record", "(", "request", ".", "recid", ")", "if", "record", "is", "None", ":", "current_app", ".", "logger", ".", "error", "(", "\"Cannot retrieve record %s. Emails ...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
send_email_validation
Receiver for request-created signal to send email notification.
zenodo_accessrequests/receivers.py
def send_email_validation(request): """Receiver for request-created signal to send email notification.""" token = EmailConfirmationSerializer().create_token( request.id, dict(email=request.sender_email) ) pid, record = get_record(request.recid) _send_notification( request.sender_ema...
def send_email_validation(request): """Receiver for request-created signal to send email notification.""" token = EmailConfirmationSerializer().create_token( request.id, dict(email=request.sender_email) ) pid, record = get_record(request.recid) _send_notification( request.sender_ema...
[ "Receiver", "for", "request", "-", "created", "signal", "to", "send", "email", "notification", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/receivers.py#L117-L140
[ "def", "send_email_validation", "(", "request", ")", ":", "token", "=", "EmailConfirmationSerializer", "(", ")", ".", "create_token", "(", "request", ".", "id", ",", "dict", "(", "email", "=", "request", ".", "sender_email", ")", ")", "pid", ",", "record", ...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
send_reject_notification
Receiver for request-rejected signal to send email notification.
zenodo_accessrequests/receivers.py
def send_reject_notification(request, message=None): """Receiver for request-rejected signal to send email notification.""" pid, record = get_record(request.recid) _send_notification( request.sender_email, _("Access request rejected"), "zenodo_accessrequests/emails/rejected.tpl", ...
def send_reject_notification(request, message=None): """Receiver for request-rejected signal to send email notification.""" pid, record = get_record(request.recid) _send_notification( request.sender_email, _("Access request rejected"), "zenodo_accessrequests/emails/rejected.tpl", ...
[ "Receiver", "for", "request", "-", "rejected", "signal", "to", "send", "email", "notification", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/receivers.py#L143-L154
[ "def", "send_reject_notification", "(", "request", ",", "message", "=", "None", ")", ":", "pid", ",", "record", "=", "get_record", "(", "request", ".", "recid", ")", "_send_notification", "(", "request", ".", "sender_email", ",", "_", "(", "\"Access request re...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
_send_notification
Render a template and send as email.
zenodo_accessrequests/receivers.py
def _send_notification(to, subject, template, **ctx): """Render a template and send as email.""" msg = Message( subject, sender=current_app.config.get('SUPPORT_EMAIL'), recipients=[to] ) msg.body = render_template(template, **ctx) send_email.delay(msg.__dict__)
def _send_notification(to, subject, template, **ctx): """Render a template and send as email.""" msg = Message( subject, sender=current_app.config.get('SUPPORT_EMAIL'), recipients=[to] ) msg.body = render_template(template, **ctx) send_email.delay(msg.__dict__)
[ "Render", "a", "template", "and", "send", "as", "email", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/receivers.py#L157-L166
[ "def", "_send_notification", "(", "to", ",", "subject", ",", "template", ",", "*", "*", "ctx", ")", ":", "msg", "=", "Message", "(", "subject", ",", "sender", "=", "current_app", ".", "config", ".", "get", "(", "'SUPPORT_EMAIL'", ")", ",", "recipients", ...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
SecretLink.create
Create a new secret link.
zenodo_accessrequests/models.py
def create(cls, title, owner, extra_data, description="", expires_at=None): """Create a new secret link.""" if isinstance(expires_at, date): expires_at = datetime.combine(expires_at, datetime.min.time()) with db.session.begin_nested(): obj = cls( owner=ow...
def create(cls, title, owner, extra_data, description="", expires_at=None): """Create a new secret link.""" if isinstance(expires_at, date): expires_at = datetime.combine(expires_at, datetime.min.time()) with db.session.begin_nested(): obj = cls( owner=ow...
[ "Create", "a", "new", "secret", "link", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L99-L121
[ "def", "create", "(", "cls", ",", "title", ",", "owner", ",", "extra_data", ",", "description", "=", "\"\"", ",", "expires_at", "=", "None", ")", ":", "if", "isinstance", "(", "expires_at", ",", "date", ")", ":", "expires_at", "=", "datetime", ".", "co...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
SecretLink.validate_token
Validate a secret link token. Only queries the database if token is valid to determine that the token has not been revoked.
zenodo_accessrequests/models.py
def validate_token(cls, token, expected_data): """Validate a secret link token. Only queries the database if token is valid to determine that the token has not been revoked. """ data = SecretLinkFactory.validate_token( token, expected_data=expected_data ) ...
def validate_token(cls, token, expected_data): """Validate a secret link token. Only queries the database if token is valid to determine that the token has not been revoked. """ data = SecretLinkFactory.validate_token( token, expected_data=expected_data ) ...
[ "Validate", "a", "secret", "link", "token", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L124-L138
[ "def", "validate_token", "(", "cls", ",", "token", ",", "expected_data", ")", ":", "data", "=", "SecretLinkFactory", ".", "validate_token", "(", "token", ",", "expected_data", "=", "expected_data", ")", "if", "data", ":", "link", "=", "cls", ".", "query", ...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
SecretLink.extra_data
Load token data stored in token (ignores expiry date of tokens).
zenodo_accessrequests/models.py
def extra_data(self): """Load token data stored in token (ignores expiry date of tokens).""" if self.token: return SecretLinkFactory.load_token(self.token, force=True)["data"] return None
def extra_data(self): """Load token data stored in token (ignores expiry date of tokens).""" if self.token: return SecretLinkFactory.load_token(self.token, force=True)["data"] return None
[ "Load", "token", "data", "stored", "in", "token", "(", "ignores", "expiry", "date", "of", "tokens", ")", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L148-L152
[ "def", "extra_data", "(", "self", ")", ":", "if", "self", ".", "token", ":", "return", "SecretLinkFactory", ".", "load_token", "(", "self", ".", "token", ",", "force", "=", "True", ")", "[", "\"data\"", "]", "return", "None" ]
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
SecretLink.get_absolute_url
Get absolute for secret link (using https scheme). The endpoint is passed to ``url_for`` with ``token`` and ``extra_data`` as keyword arguments. E.g.:: >>> link.extra_data dict(recid=1) >>> link.get_absolute_url('record.metadata') translates into:: ...
zenodo_accessrequests/models.py
def get_absolute_url(self, endpoint): """Get absolute for secret link (using https scheme). The endpoint is passed to ``url_for`` with ``token`` and ``extra_data`` as keyword arguments. E.g.:: >>> link.extra_data dict(recid=1) >>> link.get_absolute_url('reco...
def get_absolute_url(self, endpoint): """Get absolute for secret link (using https scheme). The endpoint is passed to ``url_for`` with ``token`` and ``extra_data`` as keyword arguments. E.g.:: >>> link.extra_data dict(recid=1) >>> link.get_absolute_url('reco...
[ "Get", "absolute", "for", "secret", "link", "(", "using", "https", "scheme", ")", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L154-L174
[ "def", "get_absolute_url", "(", "self", ",", "endpoint", ")", ":", "copy", "=", "deepcopy", "(", "self", ".", "extra_data", ")", "if", "'recid'", "in", "copy", ":", "copy", "[", "'pid_value'", "]", "=", "copy", ".", "pop", "(", "'recid'", ")", "return"...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
SecretLink.revoke
Revoken a secret link.
zenodo_accessrequests/models.py
def revoke(self): """Revoken a secret link.""" if self.revoked_at is None: with db.session.begin_nested(): self.revoked_at = datetime.utcnow() link_revoked.send(self) return True return False
def revoke(self): """Revoken a secret link.""" if self.revoked_at is None: with db.session.begin_nested(): self.revoked_at = datetime.utcnow() link_revoked.send(self) return True return False
[ "Revoken", "a", "secret", "link", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L176-L183
[ "def", "revoke", "(", "self", ")", ":", "if", "self", ".", "revoked_at", "is", "None", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "self", ".", "revoked_at", "=", "datetime", ".", "utcnow", "(", ")", "link_revoked", ".", "s...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
AccessRequest.create
Create a new access request. :param recid: Record id (required). :param receiver: User object of receiver (required). :param sender_full_name: Full name of sender (required). :param sender_email: Email address of sender (required). :param justification: Justification message (re...
zenodo_accessrequests/models.py
def create(cls, recid=None, receiver=None, sender_full_name=None, sender_email=None, justification=None, sender=None): """Create a new access request. :param recid: Record id (required). :param receiver: User object of receiver (required). :param sender_full_name: Full na...
def create(cls, recid=None, receiver=None, sender_full_name=None, sender_email=None, justification=None, sender=None): """Create a new access request. :param recid: Record id (required). :param receiver: User object of receiver (required). :param sender_full_name: Full na...
[ "Create", "a", "new", "access", "request", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L275-L318
[ "def", "create", "(", "cls", ",", "recid", "=", "None", ",", "receiver", "=", "None", ",", "sender_full_name", "=", "None", ",", "sender_email", "=", "None", ",", "justification", "=", "None", ",", "sender", "=", "None", ")", ":", "sender_user_id", "=", ...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
AccessRequest.get_by_receiver
Get access request for a specific receiver.
zenodo_accessrequests/models.py
def get_by_receiver(cls, request_id, user): """Get access request for a specific receiver.""" return cls.query.filter_by( id=request_id, receiver_user_id=user.id ).first()
def get_by_receiver(cls, request_id, user): """Get access request for a specific receiver.""" return cls.query.filter_by( id=request_id, receiver_user_id=user.id ).first()
[ "Get", "access", "request", "for", "a", "specific", "receiver", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L328-L333
[ "def", "get_by_receiver", "(", "cls", ",", "request_id", ",", "user", ")", ":", "return", "cls", ".", "query", ".", "filter_by", "(", "id", "=", "request_id", ",", "receiver_user_id", "=", "user", ".", "id", ")", ".", "first", "(", ")" ]
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
AccessRequest.confirm_email
Confirm that senders email is valid.
zenodo_accessrequests/models.py
def confirm_email(self): """Confirm that senders email is valid.""" with db.session.begin_nested(): if self.status != RequestStatus.EMAIL_VALIDATION: raise InvalidRequestStateError(RequestStatus.EMAIL_VALIDATION) self.status = RequestStatus.PENDING reques...
def confirm_email(self): """Confirm that senders email is valid.""" with db.session.begin_nested(): if self.status != RequestStatus.EMAIL_VALIDATION: raise InvalidRequestStateError(RequestStatus.EMAIL_VALIDATION) self.status = RequestStatus.PENDING reques...
[ "Confirm", "that", "senders", "email", "is", "valid", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L335-L342
[ "def", "confirm_email", "(", "self", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "if", "self", ".", "status", "!=", "RequestStatus", ".", "EMAIL_VALIDATION", ":", "raise", "InvalidRequestStateError", "(", "RequestStatus", ".", ...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
AccessRequest.accept
Accept request.
zenodo_accessrequests/models.py
def accept(self, message=None, expires_at=None): """Accept request.""" with db.session.begin_nested(): if self.status != RequestStatus.PENDING: raise InvalidRequestStateError(RequestStatus.PENDING) self.status = RequestStatus.ACCEPTED request_accepted.send...
def accept(self, message=None, expires_at=None): """Accept request.""" with db.session.begin_nested(): if self.status != RequestStatus.PENDING: raise InvalidRequestStateError(RequestStatus.PENDING) self.status = RequestStatus.ACCEPTED request_accepted.send...
[ "Accept", "request", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L344-L350
[ "def", "accept", "(", "self", ",", "message", "=", "None", ",", "expires_at", "=", "None", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "if", "self", ".", "status", "!=", "RequestStatus", ".", "PENDING", ":", "raise", "...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
AccessRequest.reject
Reject request.
zenodo_accessrequests/models.py
def reject(self, message=None): """Reject request.""" with db.session.begin_nested(): if self.status != RequestStatus.PENDING: raise InvalidRequestStateError(RequestStatus.PENDING) self.status = RequestStatus.REJECTED request_rejected.send(self, message=me...
def reject(self, message=None): """Reject request.""" with db.session.begin_nested(): if self.status != RequestStatus.PENDING: raise InvalidRequestStateError(RequestStatus.PENDING) self.status = RequestStatus.REJECTED request_rejected.send(self, message=me...
[ "Reject", "request", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L352-L358
[ "def", "reject", "(", "self", ",", "message", "=", "None", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "if", "self", ".", "status", "!=", "RequestStatus", ".", "PENDING", ":", "raise", "InvalidRequestStateError", "(", "Req...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
AccessRequest.create_secret_link
Create a secret link from request.
zenodo_accessrequests/models.py
def create_secret_link(self, title, description=None, expires_at=None): """Create a secret link from request.""" self.link = SecretLink.create( title, self.receiver, extra_data=dict(recid=self.recid), description=description, expires_at=expires...
def create_secret_link(self, title, description=None, expires_at=None): """Create a secret link from request.""" self.link = SecretLink.create( title, self.receiver, extra_data=dict(recid=self.recid), description=description, expires_at=expires...
[ "Create", "a", "secret", "link", "from", "request", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L360-L369
[ "def", "create_secret_link", "(", "self", ",", "title", ",", "description", "=", "None", ",", "expires_at", "=", "None", ")", ":", "self", ".", "link", "=", "SecretLink", ".", "create", "(", "title", ",", "self", ".", "receiver", ",", "extra_data", "=", ...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
NistBeaconCrypto.get_hash
Given required properties from a NistBeaconValue, compute the SHA512Hash object. :param version: NistBeaconValue.version :param frequency: NistBeaconValue.frequency :param timestamp: NistBeaconValue.timestamp :param seed_value: NistBeaconValue.seed_value :param prev_outp...
nistbeacon/nistbeaconcrypto.py
def get_hash( cls, version: str, frequency: int, timestamp: int, seed_value: str, prev_output: str, status_code: str, ) -> SHA512Hash: """ Given required properties from a NistBeaconValue, compute the SHA512H...
def get_hash( cls, version: str, frequency: int, timestamp: int, seed_value: str, prev_output: str, status_code: str, ) -> SHA512Hash: """ Given required properties from a NistBeaconValue, compute the SHA512H...
[ "Given", "required", "properties", "from", "a", "NistBeaconValue", "compute", "the", "SHA512Hash", "object", "." ]
urda/nistbeacon
python
https://github.com/urda/nistbeacon/blob/43e0c3d1e186e71387f072daf98911abb14469dd/nistbeacon/nistbeaconcrypto.py#L114-L146
[ "def", "get_hash", "(", "cls", ",", "version", ":", "str", ",", "frequency", ":", "int", ",", "timestamp", ":", "int", ",", "seed_value", ":", "str", ",", "prev_output", ":", "str", ",", "status_code", ":", "str", ",", ")", "->", "SHA512Hash", ":", "...
43e0c3d1e186e71387f072daf98911abb14469dd
test
NistBeaconCrypto.verify
Verify a given NIST message hash and signature for a beacon value. :param timestamp: The timestamp of the record being verified. :param message_hash: The hash that was carried out over the message. This is an object belonging to the `Crypto.Hash` module. :param signature...
nistbeacon/nistbeaconcrypto.py
def verify( cls, timestamp: int, message_hash: SHA512Hash, signature: bytes, ) -> bool: """ Verify a given NIST message hash and signature for a beacon value. :param timestamp: The timestamp of the record being verified. :param message...
def verify( cls, timestamp: int, message_hash: SHA512Hash, signature: bytes, ) -> bool: """ Verify a given NIST message hash and signature for a beacon value. :param timestamp: The timestamp of the record being verified. :param message...
[ "Verify", "a", "given", "NIST", "message", "hash", "and", "signature", "for", "a", "beacon", "value", "." ]
urda/nistbeacon
python
https://github.com/urda/nistbeacon/blob/43e0c3d1e186e71387f072daf98911abb14469dd/nistbeacon/nistbeaconcrypto.py#L149-L188
[ "def", "verify", "(", "cls", ",", "timestamp", ":", "int", ",", "message_hash", ":", "SHA512Hash", ",", "signature", ":", "bytes", ",", ")", "->", "bool", ":", "# Determine verifier type to use based on timestamp.", "if", "timestamp", "<", "1496176860", ":", "ve...
43e0c3d1e186e71387f072daf98911abb14469dd
test
is_embargoed
Template filter to check if a record is embargoed.
zenodo_accessrequests/views/requests.py
def is_embargoed(record): """Template filter to check if a record is embargoed.""" return record.get('access_right') == 'embargoed' and \ record.get('embargo_date') and \ record.get('embargo_date') > datetime.utcnow().date()
def is_embargoed(record): """Template filter to check if a record is embargoed.""" return record.get('access_right') == 'embargoed' and \ record.get('embargo_date') and \ record.get('embargo_date') > datetime.utcnow().date()
[ "Template", "filter", "to", "check", "if", "a", "record", "is", "embargoed", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/views/requests.py#L63-L67
[ "def", "is_embargoed", "(", "record", ")", ":", "return", "record", ".", "get", "(", "'access_right'", ")", "==", "'embargoed'", "and", "record", ".", "get", "(", "'embargo_date'", ")", "and", "record", ".", "get", "(", "'embargo_date'", ")", ">", "datetim...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
access_request
Create an access request.
zenodo_accessrequests/views/requests.py
def access_request(pid, record, template, **kwargs): """Create an access request.""" recid = int(pid.pid_value) datastore = LocalProxy( lambda: current_app.extensions['security'].datastore) # Record must be in restricted access mode. if record.get('access_right') != 'restricted' or \ ...
def access_request(pid, record, template, **kwargs): """Create an access request.""" recid = int(pid.pid_value) datastore = LocalProxy( lambda: current_app.extensions['security'].datastore) # Record must be in restricted access mode. if record.get('access_right') != 'restricted' or \ ...
[ "Create", "an", "access", "request", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/views/requests.py#L80-L137
[ "def", "access_request", "(", "pid", ",", "record", ",", "template", ",", "*", "*", "kwargs", ")", ":", "recid", "=", "int", "(", "pid", ".", "pid_value", ")", "datastore", "=", "LocalProxy", "(", "lambda", ":", "current_app", ".", "extensions", "[", "...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
confirm
Confirm email address.
zenodo_accessrequests/views/requests.py
def confirm(pid, record, template, **kwargs): """Confirm email address.""" recid = int(pid.pid_value) token = request.view_args['token'] # Validate token data = EmailConfirmationSerializer.compat_validate_token(token) if data is None: flash(_("Invalid confirmation link."), category='da...
def confirm(pid, record, template, **kwargs): """Confirm email address.""" recid = int(pid.pid_value) token = request.view_args['token'] # Validate token data = EmailConfirmationSerializer.compat_validate_token(token) if data is None: flash(_("Invalid confirmation link."), category='da...
[ "Confirm", "email", "address", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/views/requests.py#L140-L165
[ "def", "confirm", "(", "pid", ",", "record", ",", "template", ",", "*", "*", "kwargs", ")", ":", "recid", "=", "int", "(", "pid", ".", "pid_value", ")", "token", "=", "request", ".", "view_args", "[", "'token'", "]", "# Validate token", "data", "=", ...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
SSHClient._get_endpoint
Creates a generic endpoint connection that doesn't finish
tensor/protocol/ssh.py
def _get_endpoint(self): """ Creates a generic endpoint connection that doesn't finish """ return SSHCommandClientEndpoint.newConnection( reactor, b'/bin/cat', self.username, self.hostname, port=self.port, keys=self.keys, password=self.password, knownHosts = s...
def _get_endpoint(self): """ Creates a generic endpoint connection that doesn't finish """ return SSHCommandClientEndpoint.newConnection( reactor, b'/bin/cat', self.username, self.hostname, port=self.port, keys=self.keys, password=self.password, knownHosts = s...
[ "Creates", "a", "generic", "endpoint", "connection", "that", "doesn", "t", "finish" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/protocol/ssh.py#L104-L110
[ "def", "_get_endpoint", "(", "self", ")", ":", "return", "SSHCommandClientEndpoint", ".", "newConnection", "(", "reactor", ",", "b'/bin/cat'", ",", "self", ".", "username", ",", "self", ".", "hostname", ",", "port", "=", "self", ".", "port", ",", "keys", "...
7c0c99708b5dbff97f3895f705e11996b608549d
test
Ordering.reverse
Get reverse direction of ordering.
zenodo_accessrequests/helpers.py
def reverse(self, col): """Get reverse direction of ordering.""" if col in self.options: if self.is_selected(col): return col if not self.asc else '-{0}'.format(col) else: return col return None
def reverse(self, col): """Get reverse direction of ordering.""" if col in self.options: if self.is_selected(col): return col if not self.asc else '-{0}'.format(col) else: return col return None
[ "Get", "reverse", "direction", "of", "ordering", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/helpers.py#L51-L58
[ "def", "reverse", "(", "self", ",", "col", ")", ":", "if", "col", "in", "self", ".", "options", ":", "if", "self", ".", "is_selected", "(", "col", ")", ":", "return", "col", "if", "not", "self", ".", "asc", "else", "'-{0}'", ".", "format", "(", "...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
Ordering.dir
Get direction (ascending/descending) of ordering.
zenodo_accessrequests/helpers.py
def dir(self, col, asc='asc', desc='desc'): """Get direction (ascending/descending) of ordering.""" if col == self._selected and self.asc is not None: return asc if self.asc else desc else: return None
def dir(self, col, asc='asc', desc='desc'): """Get direction (ascending/descending) of ordering.""" if col == self._selected and self.asc is not None: return asc if self.asc else desc else: return None
[ "Get", "direction", "(", "ascending", "/", "descending", ")", "of", "ordering", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/helpers.py#L60-L65
[ "def", "dir", "(", "self", ",", "col", ",", "asc", "=", "'asc'", ",", "desc", "=", "'desc'", ")", ":", "if", "col", "==", "self", ".", "_selected", "and", "self", ".", "asc", "is", "not", "None", ":", "return", "asc", "if", "self", ".", "asc", ...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
Ordering.selected
Get column which is being order by.
zenodo_accessrequests/helpers.py
def selected(self): """Get column which is being order by.""" if self._selected: return self._selected if self.asc else \ "-{0}".format(self._selected) return None
def selected(self): """Get column which is being order by.""" if self._selected: return self._selected if self.asc else \ "-{0}".format(self._selected) return None
[ "Get", "column", "which", "is", "being", "order", "by", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/helpers.py#L71-L76
[ "def", "selected", "(", "self", ")", ":", "if", "self", ".", "_selected", ":", "return", "self", ".", "_selected", "if", "self", ".", "asc", "else", "\"-{0}\"", ".", "format", "(", "self", ".", "_selected", ")", "return", "None" ]
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
QueryOrdering.items
Get query with correct ordering.
zenodo_accessrequests/helpers.py
def items(self): """Get query with correct ordering.""" if self.asc is not None: if self._selected and self.asc: return self.query.order_by(self._selected) elif self._selected and not self.asc: return self.query.order_by(desc(self._selected)) ...
def items(self): """Get query with correct ordering.""" if self.asc is not None: if self._selected and self.asc: return self.query.order_by(self._selected) elif self._selected and not self.asc: return self.query.order_by(desc(self._selected)) ...
[ "Get", "query", "with", "correct", "ordering", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/helpers.py#L87-L94
[ "def", "items", "(", "self", ")", ":", "if", "self", ".", "asc", "is", "not", "None", ":", "if", "self", ".", "_selected", "and", "self", ".", "asc", ":", "return", "self", ".", "query", ".", "order_by", "(", "self", ".", "_selected", ")", "elif", ...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
FileVersionInfo.get_version
Open the file referenced in this object, and scrape the version. :return: The version as a string, an empty string if there is no match to the magic_line, or any file exception messages encountered.
scripts/version_manager.py
def get_version(self) -> str: """ Open the file referenced in this object, and scrape the version. :return: The version as a string, an empty string if there is no match to the magic_line, or any file exception messages encountered. """ try: ...
def get_version(self) -> str: """ Open the file referenced in this object, and scrape the version. :return: The version as a string, an empty string if there is no match to the magic_line, or any file exception messages encountered. """ try: ...
[ "Open", "the", "file", "referenced", "in", "this", "object", "and", "scrape", "the", "version", "." ]
urda/nistbeacon
python
https://github.com/urda/nistbeacon/blob/43e0c3d1e186e71387f072daf98911abb14469dd/scripts/version_manager.py#L58-L83
[ "def", "get_version", "(", "self", ")", "->", "str", ":", "try", ":", "f", "=", "open", "(", "self", ".", "file_path", ",", "'r'", ")", "lines", "=", "f", ".", "readlines", "(", ")", "f", ".", "close", "(", ")", "except", "Exception", "as", "e", ...
43e0c3d1e186e71387f072daf98911abb14469dd
test
FileVersionInfo.set_version
Set the version for this given file. :param new_version: The new version string to set.
scripts/version_manager.py
def set_version(self, new_version: str): """ Set the version for this given file. :param new_version: The new version string to set. """ try: f = open(self.file_path, 'r') lines = f.readlines() f.close() except Exception as e: ...
def set_version(self, new_version: str): """ Set the version for this given file. :param new_version: The new version string to set. """ try: f = open(self.file_path, 'r') lines = f.readlines() f.close() except Exception as e: ...
[ "Set", "the", "version", "for", "this", "given", "file", "." ]
urda/nistbeacon
python
https://github.com/urda/nistbeacon/blob/43e0c3d1e186e71387f072daf98911abb14469dd/scripts/version_manager.py#L85-L115
[ "def", "set_version", "(", "self", ",", "new_version", ":", "str", ")", ":", "try", ":", "f", "=", "open", "(", "self", ".", "file_path", ",", "'r'", ")", "lines", "=", "f", ".", "readlines", "(", ")", "f", ".", "close", "(", ")", "except", "Exce...
43e0c3d1e186e71387f072daf98911abb14469dd
test
records
Load test data fixture.
examples/app.py
def records(): """Load test data fixture.""" import uuid from invenio_records.api import Record from invenio_pidstore.models import PersistentIdentifier, PIDStatus create_test_user() indexer = RecordIndexer() # Record 1 - Live record with db.session.begin_nested(): rec_uuid = ...
def records(): """Load test data fixture.""" import uuid from invenio_records.api import Record from invenio_pidstore.models import PersistentIdentifier, PIDStatus create_test_user() indexer = RecordIndexer() # Record 1 - Live record with db.session.begin_nested(): rec_uuid = ...
[ "Load", "test", "data", "fixture", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/examples/app.py#L132-L161
[ "def", "records", "(", ")", ":", "import", "uuid", "from", "invenio_records", ".", "api", "import", "Record", "from", "invenio_pidstore", ".", "models", "import", "PersistentIdentifier", ",", "PIDStatus", "create_test_user", "(", ")", "indexer", "=", "RecordIndexe...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
Source._init_ssh
Configure SSH client options
tensor/objects.py
def _init_ssh(self): """ Configure SSH client options """ self.ssh_host = self.config.get('ssh_host', self.hostname) self.known_hosts = self.config.get('ssh_knownhosts_file', self.tensor.config.get('ssh_knownhosts_file', None)) self.ssh_keyfile = self.config.get('s...
def _init_ssh(self): """ Configure SSH client options """ self.ssh_host = self.config.get('ssh_host', self.hostname) self.known_hosts = self.config.get('ssh_knownhosts_file', self.tensor.config.get('ssh_knownhosts_file', None)) self.ssh_keyfile = self.config.get('s...
[ "Configure", "SSH", "client", "options" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/objects.py#L175-L236
[ "def", "_init_ssh", "(", "self", ")", ":", "self", ".", "ssh_host", "=", "self", ".", "config", ".", "get", "(", "'ssh_host'", ",", "self", ".", "hostname", ")", "self", ".", "known_hosts", "=", "self", ".", "config", ".", "get", "(", "'ssh_knownhosts_...
7c0c99708b5dbff97f3895f705e11996b608549d
test
Source.startTimer
Starts the timer for this source
tensor/objects.py
def startTimer(self): """Starts the timer for this source""" self.td = self.t.start(self.inter) if self.use_ssh and self.ssh_connector: self.ssh_client.connect()
def startTimer(self): """Starts the timer for this source""" self.td = self.t.start(self.inter) if self.use_ssh and self.ssh_connector: self.ssh_client.connect()
[ "Starts", "the", "timer", "for", "this", "source" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/objects.py#L241-L246
[ "def", "startTimer", "(", "self", ")", ":", "self", ".", "td", "=", "self", ".", "t", ".", "start", "(", "self", ".", "inter", ")", "if", "self", ".", "use_ssh", "and", "self", ".", "ssh_connector", ":", "self", ".", "ssh_client", ".", "connect", "...
7c0c99708b5dbff97f3895f705e11996b608549d
test
Source.tick
Called for every timer tick. Calls self.get which can be a deferred and passes that result back to the queueBack method Returns a deferred
tensor/objects.py
def tick(self): """Called for every timer tick. Calls self.get which can be a deferred and passes that result back to the queueBack method Returns a deferred""" if self.sync: if self.running: defer.returnValue(None) self.running = True ...
def tick(self): """Called for every timer tick. Calls self.get which can be a deferred and passes that result back to the queueBack method Returns a deferred""" if self.sync: if self.running: defer.returnValue(None) self.running = True ...
[ "Called", "for", "every", "timer", "tick", ".", "Calls", "self", ".", "get", "which", "can", "be", "a", "deferred", "and", "passes", "that", "result", "back", "to", "the", "queueBack", "method", "Returns", "a", "deferred" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/objects.py#L273-L293
[ "def", "tick", "(", "self", ")", ":", "if", "self", ".", "sync", ":", "if", "self", ".", "running", ":", "defer", ".", "returnValue", "(", "None", ")", "self", ".", "running", "=", "True", "try", ":", "event", "=", "yield", "self", ".", "_get", "...
7c0c99708b5dbff97f3895f705e11996b608549d
test
Source.createEvent
Creates an Event object from the Source configuration
tensor/objects.py
def createEvent(self, state, description, metric, prefix=None, hostname=None, aggregation=None, evtime=None): """Creates an Event object from the Source configuration""" if prefix: service_name = self.service + "." + prefix else: service_name = self.service ...
def createEvent(self, state, description, metric, prefix=None, hostname=None, aggregation=None, evtime=None): """Creates an Event object from the Source configuration""" if prefix: service_name = self.service + "." + prefix else: service_name = self.service ...
[ "Creates", "an", "Event", "object", "from", "the", "Source", "configuration" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/objects.py#L295-L306
[ "def", "createEvent", "(", "self", ",", "state", ",", "description", ",", "metric", ",", "prefix", "=", "None", ",", "hostname", "=", "None", ",", "aggregation", "=", "None", ",", "evtime", "=", "None", ")", ":", "if", "prefix", ":", "service_name", "=...
7c0c99708b5dbff97f3895f705e11996b608549d
test
Source.createLog
Creates an Event object from the Source configuration
tensor/objects.py
def createLog(self, type, data, evtime=None, hostname=None): """Creates an Event object from the Source configuration""" return Event(None, type, data, 0, self.ttl, hostname=hostname or self.hostname, evtime=evtime, tags=self.tags, type='log' )
def createLog(self, type, data, evtime=None, hostname=None): """Creates an Event object from the Source configuration""" return Event(None, type, data, 0, self.ttl, hostname=hostname or self.hostname, evtime=evtime, tags=self.tags, type='log' )
[ "Creates", "an", "Event", "object", "from", "the", "Source", "configuration" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/objects.py#L308-L313
[ "def", "createLog", "(", "self", ",", "type", ",", "data", ",", "evtime", "=", "None", ",", "hostname", "=", "None", ")", ":", "return", "Event", "(", "None", ",", "type", ",", "data", ",", "0", ",", "self", ".", "ttl", ",", "hostname", "=", "hos...
7c0c99708b5dbff97f3895f705e11996b608549d
test
index
List pending access requests and shared links.
zenodo_accessrequests/views/settings.py
def index(): """List pending access requests and shared links.""" query = request.args.get('query', '') order = request.args.get('sort', '-created') try: page = int(request.args.get('page', 1)) per_page = int(request.args.get('per_page', 20)) except (TypeError, ValueError): a...
def index(): """List pending access requests and shared links.""" query = request.args.get('query', '') order = request.args.get('sort', '-created') try: page = int(request.args.get('page', 1)) per_page = int(request.args.get('per_page', 20)) except (TypeError, ValueError): a...
[ "List", "pending", "access", "requests", "and", "shared", "links", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/views/settings.py#L78-L125
[ "def", "index", "(", ")", ":", "query", "=", "request", ".", "args", ".", "get", "(", "'query'", ",", "''", ")", "order", "=", "request", ".", "args", ".", "get", "(", "'sort'", ",", "'-created'", ")", "try", ":", "page", "=", "int", "(", "reques...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
accessrequest
Accept/reject access request.
zenodo_accessrequests/views/settings.py
def accessrequest(request_id): """Accept/reject access request.""" r = AccessRequest.get_by_receiver(request_id, current_user) if not r or r.status != RequestStatus.PENDING: abort(404) form = ApprovalForm(request.form) if form.validate_on_submit(): if form.accept.data: ...
def accessrequest(request_id): """Accept/reject access request.""" r = AccessRequest.get_by_receiver(request_id, current_user) if not r or r.status != RequestStatus.PENDING: abort(404) form = ApprovalForm(request.form) if form.validate_on_submit(): if form.accept.data: ...
[ "Accept", "/", "reject", "access", "request", "." ]
zenodo/zenodo-accessrequests
python
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/views/settings.py#L134-L161
[ "def", "accessrequest", "(", "request_id", ")", ":", "r", "=", "AccessRequest", ".", "get_by_receiver", "(", "request_id", ",", "current_user", ")", "if", "not", "r", "or", "r", ".", "status", "!=", "RequestStatus", ".", "PENDING", ":", "abort", "(", "404"...
ce2cf3f1425d02ba4f3ad3202cfca43a1892558a
test
RiemannTCP.createClient
Create a TCP connection to Riemann with automatic reconnection
tensor/outputs/riemann.py
def createClient(self): """Create a TCP connection to Riemann with automatic reconnection """ server = self.config.get('server', 'localhost') port = self.config.get('port', 5555) failover = self.config.get('failover', False) self.factory = riemann.RiemannClientFactory(s...
def createClient(self): """Create a TCP connection to Riemann with automatic reconnection """ server = self.config.get('server', 'localhost') port = self.config.get('port', 5555) failover = self.config.get('failover', False) self.factory = riemann.RiemannClientFactory(s...
[ "Create", "a", "TCP", "connection", "to", "Riemann", "with", "automatic", "reconnection" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/outputs/riemann.py#L83-L123
[ "def", "createClient", "(", "self", ")", ":", "server", "=", "self", ".", "config", ".", "get", "(", "'server'", ",", "'localhost'", ")", "port", "=", "self", ".", "config", ".", "get", "(", "'port'", ",", "5555", ")", "failover", "=", "self", ".", ...
7c0c99708b5dbff97f3895f705e11996b608549d
test
RiemannTCP.stop
Stop this client.
tensor/outputs/riemann.py
def stop(self): """Stop this client. """ self.t.stop() self.factory.stopTrying() self.connector.disconnect()
def stop(self): """Stop this client. """ self.t.stop() self.factory.stopTrying() self.connector.disconnect()
[ "Stop", "this", "client", "." ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/outputs/riemann.py#L125-L130
[ "def", "stop", "(", "self", ")", ":", "self", ".", "t", ".", "stop", "(", ")", "self", ".", "factory", ".", "stopTrying", "(", ")", "self", ".", "connector", ".", "disconnect", "(", ")" ]
7c0c99708b5dbff97f3895f705e11996b608549d
test
RiemannTCP.tick
Clock tick called every self.inter
tensor/outputs/riemann.py
def tick(self): """Clock tick called every self.inter """ if self.factory.proto: # Check backpressure if (self.pressure < 0) or (self.factory.proto.pressure <= self.pressure): self.emptyQueue() elif self.expire: # Check queue age and ex...
def tick(self): """Clock tick called every self.inter """ if self.factory.proto: # Check backpressure if (self.pressure < 0) or (self.factory.proto.pressure <= self.pressure): self.emptyQueue() elif self.expire: # Check queue age and ex...
[ "Clock", "tick", "called", "every", "self", ".", "inter" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/outputs/riemann.py#L132-L143
[ "def", "tick", "(", "self", ")", ":", "if", "self", ".", "factory", ".", "proto", ":", "# Check backpressure", "if", "(", "self", ".", "pressure", "<", "0", ")", "or", "(", "self", ".", "factory", ".", "proto", ".", "pressure", "<=", "self", ".", "...
7c0c99708b5dbff97f3895f705e11996b608549d
test
RiemannTCP.emptyQueue
Remove all or self.queueDepth events from the queue
tensor/outputs/riemann.py
def emptyQueue(self): """Remove all or self.queueDepth events from the queue """ if self.events: if self.queueDepth and (len(self.events) > self.queueDepth): # Remove maximum of self.queueDepth items from queue events = self.events[:self.queueDepth] ...
def emptyQueue(self): """Remove all or self.queueDepth events from the queue """ if self.events: if self.queueDepth and (len(self.events) > self.queueDepth): # Remove maximum of self.queueDepth items from queue events = self.events[:self.queueDepth] ...
[ "Remove", "all", "or", "self", ".", "queueDepth", "events", "from", "the", "queue" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/outputs/riemann.py#L145-L160
[ "def", "emptyQueue", "(", "self", ")", ":", "if", "self", ".", "events", ":", "if", "self", ".", "queueDepth", "and", "(", "len", "(", "self", ".", "events", ")", ">", "self", ".", "queueDepth", ")", ":", "# Remove maximum of self.queueDepth items from queue...
7c0c99708b5dbff97f3895f705e11996b608549d
test
RiemannTCP.eventsReceived
Receives a list of events and transmits them to Riemann Arguments: events -- list of `tensor.objects.Event`
tensor/outputs/riemann.py
def eventsReceived(self, events): """Receives a list of events and transmits them to Riemann Arguments: events -- list of `tensor.objects.Event` """ # Make sure queue isn't oversized if (self.maxsize < 1) or (len(self.events) < self.maxsize): self.events.exte...
def eventsReceived(self, events): """Receives a list of events and transmits them to Riemann Arguments: events -- list of `tensor.objects.Event` """ # Make sure queue isn't oversized if (self.maxsize < 1) or (len(self.events) < self.maxsize): self.events.exte...
[ "Receives", "a", "list", "of", "events", "and", "transmits", "them", "to", "Riemann" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/outputs/riemann.py#L162-L170
[ "def", "eventsReceived", "(", "self", ",", "events", ")", ":", "# Make sure queue isn't oversized", "if", "(", "self", ".", "maxsize", "<", "1", ")", "or", "(", "len", "(", "self", ".", "events", ")", "<", "self", ".", "maxsize", ")", ":", "self", ".",...
7c0c99708b5dbff97f3895f705e11996b608549d
test
RiemannUDP.createClient
Create a UDP connection to Riemann
tensor/outputs/riemann.py
def createClient(self): """Create a UDP connection to Riemann""" server = self.config.get('server', '127.0.0.1') port = self.config.get('port', 5555) def connect(ip): self.protocol = riemann.RiemannUDP(ip, port) self.endpoint = reactor.listenUDP(0, self.protocol)...
def createClient(self): """Create a UDP connection to Riemann""" server = self.config.get('server', '127.0.0.1') port = self.config.get('port', 5555) def connect(ip): self.protocol = riemann.RiemannUDP(ip, port) self.endpoint = reactor.listenUDP(0, self.protocol)...
[ "Create", "a", "UDP", "connection", "to", "Riemann" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/outputs/riemann.py#L187-L198
[ "def", "createClient", "(", "self", ")", ":", "server", "=", "self", ".", "config", ".", "get", "(", "'server'", ",", "'127.0.0.1'", ")", "port", "=", "self", ".", "config", ".", "get", "(", "'port'", ",", "5555", ")", "def", "connect", "(", "ip", ...
7c0c99708b5dbff97f3895f705e11996b608549d
test
ElasticSearch.createClient
Sets up HTTP connector and starts queue timer
tensor/outputs/elasticsearch.py
def createClient(self): """Sets up HTTP connector and starts queue timer """ server = self.config.get('server', 'localhost') port = int(self.config.get('port', 9200)) self.client = elasticsearch.ElasticSearch(self.url, self.user, self.password, self.index) ...
def createClient(self): """Sets up HTTP connector and starts queue timer """ server = self.config.get('server', 'localhost') port = int(self.config.get('port', 9200)) self.client = elasticsearch.ElasticSearch(self.url, self.user, self.password, self.index) ...
[ "Sets", "up", "HTTP", "connector", "and", "starts", "queue", "timer" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/outputs/elasticsearch.py#L61-L71
[ "def", "createClient", "(", "self", ")", ":", "server", "=", "self", ".", "config", ".", "get", "(", "'server'", ",", "'localhost'", ")", "port", "=", "int", "(", "self", ".", "config", ".", "get", "(", "'port'", ",", "9200", ")", ")", "self", ".",...
7c0c99708b5dbff97f3895f705e11996b608549d
test
ElasticSearch.tick
Clock tick called every self.inter
tensor/outputs/elasticsearch.py
def tick(self): """Clock tick called every self.inter """ if self.events: if self.queueDepth and (len(self.events) > self.queueDepth): # Remove maximum of self.queueDepth items from queue events = self.events[:self.queueDepth] self.even...
def tick(self): """Clock tick called every self.inter """ if self.events: if self.queueDepth and (len(self.events) > self.queueDepth): # Remove maximum of self.queueDepth items from queue events = self.events[:self.queueDepth] self.even...
[ "Clock", "tick", "called", "every", "self", ".", "inter" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/outputs/elasticsearch.py#L93-L113
[ "def", "tick", "(", "self", ")", ":", "if", "self", ".", "events", ":", "if", "self", ".", "queueDepth", "and", "(", "len", "(", "self", ".", "events", ")", ">", "self", ".", "queueDepth", ")", ":", "# Remove maximum of self.queueDepth items from queue", "...
7c0c99708b5dbff97f3895f705e11996b608549d
test
RiemannProtobufMixin.encodeEvent
Adapts an Event object to a Riemann protobuf event Event
tensor/protocol/riemann.py
def encodeEvent(self, event): """Adapts an Event object to a Riemann protobuf event Event""" pbevent = proto_pb2.Event( time=int(event.time), state=event.state, service=event.service, host=event.hostname, description=event.description, ...
def encodeEvent(self, event): """Adapts an Event object to a Riemann protobuf event Event""" pbevent = proto_pb2.Event( time=int(event.time), state=event.state, service=event.service, host=event.hostname, description=event.description, ...
[ "Adapts", "an", "Event", "object", "to", "a", "Riemann", "protobuf", "event", "Event" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/protocol/riemann.py#L12-L37
[ "def", "encodeEvent", "(", "self", ",", "event", ")", ":", "pbevent", "=", "proto_pb2", ".", "Event", "(", "time", "=", "int", "(", "event", ".", "time", ")", ",", "state", "=", "event", ".", "state", ",", "service", "=", "event", ".", "service", "...
7c0c99708b5dbff97f3895f705e11996b608549d
test
RiemannProtobufMixin.encodeMessage
Encode a list of Tensor events with protobuf
tensor/protocol/riemann.py
def encodeMessage(self, events): """Encode a list of Tensor events with protobuf""" message = proto_pb2.Msg( events=[self.encodeEvent(e) for e in events if e._type=='riemann'] ) return message.SerializeToString()
def encodeMessage(self, events): """Encode a list of Tensor events with protobuf""" message = proto_pb2.Msg( events=[self.encodeEvent(e) for e in events if e._type=='riemann'] ) return message.SerializeToString()
[ "Encode", "a", "list", "of", "Tensor", "events", "with", "protobuf" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/protocol/riemann.py#L39-L46
[ "def", "encodeMessage", "(", "self", ",", "events", ")", ":", "message", "=", "proto_pb2", ".", "Msg", "(", "events", "=", "[", "self", ".", "encodeEvent", "(", "e", ")", "for", "e", "in", "events", "if", "e", ".", "_type", "==", "'riemann'", "]", ...
7c0c99708b5dbff97f3895f705e11996b608549d
test
RiemannProtobufMixin.decodeMessage
Decode a protobuf message into a list of Tensor events
tensor/protocol/riemann.py
def decodeMessage(self, data): """Decode a protobuf message into a list of Tensor events""" message = proto_pb2.Msg() message.ParseFromString(data) return message
def decodeMessage(self, data): """Decode a protobuf message into a list of Tensor events""" message = proto_pb2.Msg() message.ParseFromString(data) return message
[ "Decode", "a", "protobuf", "message", "into", "a", "list", "of", "Tensor", "events" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/protocol/riemann.py#L48-L53
[ "def", "decodeMessage", "(", "self", ",", "data", ")", ":", "message", "=", "proto_pb2", ".", "Msg", "(", ")", "message", ".", "ParseFromString", "(", "data", ")", "return", "message" ]
7c0c99708b5dbff97f3895f705e11996b608549d
test
RiemannProtobufMixin.sendEvents
Send a Tensor Event to Riemann
tensor/protocol/riemann.py
def sendEvents(self, events): """Send a Tensor Event to Riemann""" self.pressure += 1 self.sendString(self.encodeMessage(events))
def sendEvents(self, events): """Send a Tensor Event to Riemann""" self.pressure += 1 self.sendString(self.encodeMessage(events))
[ "Send", "a", "Tensor", "Event", "to", "Riemann" ]
calston/tensor
python
https://github.com/calston/tensor/blob/7c0c99708b5dbff97f3895f705e11996b608549d/tensor/protocol/riemann.py#L55-L58
[ "def", "sendEvents", "(", "self", ",", "events", ")", ":", "self", ".", "pressure", "+=", "1", "self", ".", "sendString", "(", "self", ".", "encodeMessage", "(", "events", ")", ")" ]
7c0c99708b5dbff97f3895f705e11996b608549d
test
generate
Generate preview for URL.
filepreviews/__main__.py
def generate(ctx, url, *args, **kwargs): """ Generate preview for URL. """ file_previews = ctx.obj['file_previews'] options = {} metadata = kwargs['metadata'] width = kwargs['width'] height = kwargs['height'] output_format = kwargs['format'] if metadata: options['metada...
def generate(ctx, url, *args, **kwargs): """ Generate preview for URL. """ file_previews = ctx.obj['file_previews'] options = {} metadata = kwargs['metadata'] width = kwargs['width'] height = kwargs['height'] output_format = kwargs['format'] if metadata: options['metada...
[ "Generate", "preview", "for", "URL", "." ]
filepreviews/filepreviews-python
python
https://github.com/filepreviews/filepreviews-python/blob/11be871a07438e3ab5d87ab1f2c163bbac4d4570/filepreviews/__main__.py#L30-L58
[ "def", "generate", "(", "ctx", ",", "url", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "file_previews", "=", "ctx", ".", "obj", "[", "'file_previews'", "]", "options", "=", "{", "}", "metadata", "=", "kwargs", "[", "'metadata'", "]", "width"...
11be871a07438e3ab5d87ab1f2c163bbac4d4570
test
retrieve
Retreive preview results for ID.
filepreviews/__main__.py
def retrieve(ctx, preview_id, *args, **kwargs): """ Retreive preview results for ID. """ file_previews = ctx.obj['file_previews'] results = file_previews.retrieve(preview_id) click.echo(results)
def retrieve(ctx, preview_id, *args, **kwargs): """ Retreive preview results for ID. """ file_previews = ctx.obj['file_previews'] results = file_previews.retrieve(preview_id) click.echo(results)
[ "Retreive", "preview", "results", "for", "ID", "." ]
filepreviews/filepreviews-python
python
https://github.com/filepreviews/filepreviews-python/blob/11be871a07438e3ab5d87ab1f2c163bbac4d4570/filepreviews/__main__.py#L64-L71
[ "def", "retrieve", "(", "ctx", ",", "preview_id", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "file_previews", "=", "ctx", ".", "obj", "[", "'file_previews'", "]", "results", "=", "file_previews", ".", "retrieve", "(", "preview_id", ")", "click"...
11be871a07438e3ab5d87ab1f2c163bbac4d4570
test
ChatterCall._refresh_access_token
If the client application has a refresh token, it can use it to send a request for a new access token. To ask for a new access token, the client application should send a POST request to https://login.instance_name/services/oauth2/token with the following query parameters: grant_t...
chatter/base.py
def _refresh_access_token(self): """ If the client application has a refresh token, it can use it to send a request for a new access token. To ask for a new access token, the client application should send a POST request to https://login.instance_name/services/oauth2/token with the fol...
def _refresh_access_token(self): """ If the client application has a refresh token, it can use it to send a request for a new access token. To ask for a new access token, the client application should send a POST request to https://login.instance_name/services/oauth2/token with the fol...
[ "If", "the", "client", "application", "has", "a", "refresh", "token", "it", "can", "use", "it", "to", "send", "a", "request", "for", "a", "new", "access", "token", ".", "To", "ask", "for", "a", "new", "access", "token", "the", "client", "application", ...
nixmc/chatter
python
https://github.com/nixmc/chatter/blob/332304ed9bee45182f73871dc90c95998b0f32c9/chatter/base.py#L81-L126
[ "def", "_refresh_access_token", "(", "self", ")", ":", "resource", "=", "\"https://na1.salesforce.com/services/oauth2/token\"", "fields", "=", "dict", "(", "grant_type", "=", "\"refresh_token\"", ",", "refresh_token", "=", "self", ".", "refresh_token", ",", "client_id",...
332304ed9bee45182f73871dc90c95998b0f32c9
test
Worker.r_q_send
Send message dicts through r_q, and throw explicit errors for pickle problems
polymer/Polymer.py
def r_q_send(self, msg_dict): """Send message dicts through r_q, and throw explicit errors for pickle problems""" # Check whether msg_dict can be pickled... no_pickle_keys = self.invalid_dict_pickle_keys(msg_dict) if no_pickle_keys == []: self.r_q.put(msg_dict) ...
def r_q_send(self, msg_dict): """Send message dicts through r_q, and throw explicit errors for pickle problems""" # Check whether msg_dict can be pickled... no_pickle_keys = self.invalid_dict_pickle_keys(msg_dict) if no_pickle_keys == []: self.r_q.put(msg_dict) ...
[ "Send", "message", "dicts", "through", "r_q", "and", "throw", "explicit", "errors", "for", "pickle", "problems" ]
mpenning/polymer
python
https://github.com/mpenning/polymer/blob/1cdf4ed2573c894bde9d398fa173816b6b47e9f3/polymer/Polymer.py#L73-L161
[ "def", "r_q_send", "(", "self", ",", "msg_dict", ")", ":", "# Check whether msg_dict can be pickled...", "no_pickle_keys", "=", "self", ".", "invalid_dict_pickle_keys", "(", "msg_dict", ")", "if", "no_pickle_keys", "==", "[", "]", ":", "self", ".", "r_q", ".", "...
1cdf4ed2573c894bde9d398fa173816b6b47e9f3
test
Worker.invalid_dict_pickle_keys
Return a list of keys that can't be pickled. Return [] if there are no pickling problems with the values associated with the keys. Return the list of keys, if there are problems.
polymer/Polymer.py
def invalid_dict_pickle_keys(self, msg_dict): """Return a list of keys that can't be pickled. Return [] if there are no pickling problems with the values associated with the keys. Return the list of keys, if there are problems.""" no_pickle_keys = list() for key, val in msg_di...
def invalid_dict_pickle_keys(self, msg_dict): """Return a list of keys that can't be pickled. Return [] if there are no pickling problems with the values associated with the keys. Return the list of keys, if there are problems.""" no_pickle_keys = list() for key, val in msg_di...
[ "Return", "a", "list", "of", "keys", "that", "can", "t", "be", "pickled", ".", "Return", "[]", "if", "there", "are", "no", "pickling", "problems", "with", "the", "values", "associated", "with", "the", "keys", ".", "Return", "the", "list", "of", "keys", ...
mpenning/polymer
python
https://github.com/mpenning/polymer/blob/1cdf4ed2573c894bde9d398fa173816b6b47e9f3/polymer/Polymer.py#L163-L180
[ "def", "invalid_dict_pickle_keys", "(", "self", ",", "msg_dict", ")", ":", "no_pickle_keys", "=", "list", "(", ")", "for", "key", ",", "val", "in", "msg_dict", ".", "items", "(", ")", ":", "try", ":", "pickle", ".", "dumps", "(", "key", ")", "pickle", ...
1cdf4ed2573c894bde9d398fa173816b6b47e9f3
test
Worker.message_loop
Loop through messages and execute tasks
polymer/Polymer.py
def message_loop(self, t_q, r_q): """Loop through messages and execute tasks""" t_msg = {} while t_msg.get("state", "") != "__DIE__": try: t_msg = t_q.get(True, self.cycle_sleep) # Poll blocking self.task = t_msg.get("task", "") # __DIE__ has no task...
def message_loop(self, t_q, r_q): """Loop through messages and execute tasks""" t_msg = {} while t_msg.get("state", "") != "__DIE__": try: t_msg = t_q.get(True, self.cycle_sleep) # Poll blocking self.task = t_msg.get("task", "") # __DIE__ has no task...
[ "Loop", "through", "messages", "and", "execute", "tasks" ]
mpenning/polymer
python
https://github.com/mpenning/polymer/blob/1cdf4ed2573c894bde9d398fa173816b6b47e9f3/polymer/Polymer.py#L195-L241
[ "def", "message_loop", "(", "self", ",", "t_q", ",", "r_q", ")", ":", "t_msg", "=", "{", "}", "while", "t_msg", ".", "get", "(", "\"state\"", ",", "\"\"", ")", "!=", "\"__DIE__\"", ":", "try", ":", "t_msg", "=", "t_q", ".", "get", "(", "True", ",...
1cdf4ed2573c894bde9d398fa173816b6b47e9f3
test
TaskMgrStats.log_time
Return True if it's time to log
polymer/Polymer.py
def log_time(self): """Return True if it's time to log""" if self.hot_loop and self.time_delta >= self.log_interval: return True return False
def log_time(self): """Return True if it's time to log""" if self.hot_loop and self.time_delta >= self.log_interval: return True return False
[ "Return", "True", "if", "it", "s", "time", "to", "log" ]
mpenning/polymer
python
https://github.com/mpenning/polymer/blob/1cdf4ed2573c894bde9d398fa173816b6b47e9f3/polymer/Polymer.py#L268-L272
[ "def", "log_time", "(", "self", ")", ":", "if", "self", ".", "hot_loop", "and", "self", ".", "time_delta", ">=", "self", ".", "log_interval", ":", "return", "True", "return", "False" ]
1cdf4ed2573c894bde9d398fa173816b6b47e9f3
test
TaskMgrStats.log_message
Build a log message and reset the stats
polymer/Polymer.py
def log_message(self): """Build a log message and reset the stats""" time_delta = deepcopy(self.time_delta) total_work_time = self.worker_count * time_delta time_worked = sum(self.exec_times) pct_busy = time_worked / total_work_time * 100.0 min_task_time = min(self.exec_...
def log_message(self): """Build a log message and reset the stats""" time_delta = deepcopy(self.time_delta) total_work_time = self.worker_count * time_delta time_worked = sum(self.exec_times) pct_busy = time_worked / total_work_time * 100.0 min_task_time = min(self.exec_...
[ "Build", "a", "log", "message", "and", "reset", "the", "stats" ]
mpenning/polymer
python
https://github.com/mpenning/polymer/blob/1cdf4ed2573c894bde9d398fa173816b6b47e9f3/polymer/Polymer.py#L275-L306
[ "def", "log_message", "(", "self", ")", ":", "time_delta", "=", "deepcopy", "(", "self", ".", "time_delta", ")", "total_work_time", "=", "self", ".", "worker_count", "*", "time_delta", "time_worked", "=", "sum", "(", "self", ".", "exec_times", ")", "pct_busy...
1cdf4ed2573c894bde9d398fa173816b6b47e9f3
test
TaskMgr.supervise
If not in a hot_loop, call supervise() to start the tasks
polymer/Polymer.py
def supervise(self): """If not in a hot_loop, call supervise() to start the tasks""" self.retval = set([]) stats = TaskMgrStats( worker_count=self.worker_count, log_interval=self.log_interval, hot_loop=self.hot_loop, ) hot_loop = self.hot_loop...
def supervise(self): """If not in a hot_loop, call supervise() to start the tasks""" self.retval = set([]) stats = TaskMgrStats( worker_count=self.worker_count, log_interval=self.log_interval, hot_loop=self.hot_loop, ) hot_loop = self.hot_loop...
[ "If", "not", "in", "a", "hot_loop", "call", "supervise", "()", "to", "start", "the", "tasks" ]
mpenning/polymer
python
https://github.com/mpenning/polymer/blob/1cdf4ed2573c894bde9d398fa173816b6b47e9f3/polymer/Polymer.py#L380-L515
[ "def", "supervise", "(", "self", ")", ":", "self", ".", "retval", "=", "set", "(", "[", "]", ")", "stats", "=", "TaskMgrStats", "(", "worker_count", "=", "self", ".", "worker_count", ",", "log_interval", "=", "self", ".", "log_interval", ",", "hot_loop",...
1cdf4ed2573c894bde9d398fa173816b6b47e9f3
test
TaskMgr.respawn_dead_workers
Respawn workers / tasks upon crash
polymer/Polymer.py
def respawn_dead_workers(self): """Respawn workers / tasks upon crash""" for w_id, p in self.workers.items(): if not p.is_alive(): # Queue the task for another worker, if required... if self.log_level >= 2: self.log.info("Worker w_id {0} di...
def respawn_dead_workers(self): """Respawn workers / tasks upon crash""" for w_id, p in self.workers.items(): if not p.is_alive(): # Queue the task for another worker, if required... if self.log_level >= 2: self.log.info("Worker w_id {0} di...
[ "Respawn", "workers", "/", "tasks", "upon", "crash" ]
mpenning/polymer
python
https://github.com/mpenning/polymer/blob/1cdf4ed2573c894bde9d398fa173816b6b47e9f3/polymer/Polymer.py#L561-L597
[ "def", "respawn_dead_workers", "(", "self", ")", ":", "for", "w_id", ",", "p", "in", "self", ".", "workers", ".", "items", "(", ")", ":", "if", "not", "p", ".", "is_alive", "(", ")", ":", "# Queue the task for another worker, if required...", "if", "self", ...
1cdf4ed2573c894bde9d398fa173816b6b47e9f3
test
get_monoprice
Return synchronous version of Monoprice interface :param port_url: serial port, i.e. '/dev/ttyUSB0' :return: synchronous implementation of Monoprice interface
pymonoprice/__init__.py
def get_monoprice(port_url): """ Return synchronous version of Monoprice interface :param port_url: serial port, i.e. '/dev/ttyUSB0' :return: synchronous implementation of Monoprice interface """ lock = RLock() def synchronized(func): @wraps(func) def wrapper(*args, **kwarg...
def get_monoprice(port_url): """ Return synchronous version of Monoprice interface :param port_url: serial port, i.e. '/dev/ttyUSB0' :return: synchronous implementation of Monoprice interface """ lock = RLock() def synchronized(func): @wraps(func) def wrapper(*args, **kwarg...
[ "Return", "synchronous", "version", "of", "Monoprice", "interface", ":", "param", "port_url", ":", "serial", "port", "i", ".", "e", ".", "/", "dev", "/", "ttyUSB0", ":", "return", ":", "synchronous", "implementation", "of", "Monoprice", "interface" ]
etsinko/pymonoprice
python
https://github.com/etsinko/pymonoprice/blob/7e54cd349942bfe42a4c9aad0ad814ffff2b5109/pymonoprice/__init__.py#L169-L266
[ "def", "get_monoprice", "(", "port_url", ")", ":", "lock", "=", "RLock", "(", ")", "def", "synchronized", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "lock", ...
7e54cd349942bfe42a4c9aad0ad814ffff2b5109
test
get_async_monoprice
Return asynchronous version of Monoprice interface :param port_url: serial port, i.e. '/dev/ttyUSB0' :return: asynchronous implementation of Monoprice interface
pymonoprice/__init__.py
def get_async_monoprice(port_url, loop): """ Return asynchronous version of Monoprice interface :param port_url: serial port, i.e. '/dev/ttyUSB0' :return: asynchronous implementation of Monoprice interface """ lock = asyncio.Lock() def locked_coro(coro): @asyncio.coroutine ...
def get_async_monoprice(port_url, loop): """ Return asynchronous version of Monoprice interface :param port_url: serial port, i.e. '/dev/ttyUSB0' :return: asynchronous implementation of Monoprice interface """ lock = asyncio.Lock() def locked_coro(coro): @asyncio.coroutine ...
[ "Return", "asynchronous", "version", "of", "Monoprice", "interface", ":", "param", "port_url", ":", "serial", "port", "i", ".", "e", ".", "/", "dev", "/", "ttyUSB0", ":", "return", ":", "asynchronous", "implementation", "of", "Monoprice", "interface" ]
etsinko/pymonoprice
python
https://github.com/etsinko/pymonoprice/blob/7e54cd349942bfe42a4c9aad0ad814ffff2b5109/pymonoprice/__init__.py#L270-L385
[ "def", "get_async_monoprice", "(", "port_url", ",", "loop", ")", ":", "lock", "=", "asyncio", ".", "Lock", "(", ")", "def", "locked_coro", "(", "coro", ")", ":", "@", "asyncio", ".", "coroutine", "@", "wraps", "(", "coro", ")", "def", "wrapper", "(", ...
7e54cd349942bfe42a4c9aad0ad814ffff2b5109
test
SASLState.from_reply
Comptaibility layer for old :class:`SASLInterface` implementations. Accepts the follwing set of :class:`SASLState` or strings and maps the strings to :class:`SASLState` elements as follows: ``"challenge"`` :member:`SASLState.CHALLENGE` ``"failue"`` ...
aiosasl/__init__.py
def from_reply(cls, state): """ Comptaibility layer for old :class:`SASLInterface` implementations. Accepts the follwing set of :class:`SASLState` or strings and maps the strings to :class:`SASLState` elements as follows: ``"challenge"`` :member:`SASLState...
def from_reply(cls, state): """ Comptaibility layer for old :class:`SASLInterface` implementations. Accepts the follwing set of :class:`SASLState` or strings and maps the strings to :class:`SASLState` elements as follows: ``"challenge"`` :member:`SASLState...
[ "Comptaibility", "layer", "for", "old", ":", "class", ":", "SASLInterface", "implementations", "." ]
horazont/aiosasl
python
https://github.com/horazont/aiosasl/blob/af58bf30f688757e58af6e87892d35a8ce798482/aiosasl/__init__.py#L316-L340
[ "def", "from_reply", "(", "cls", ",", "state", ")", ":", "if", "state", "in", "(", "SASLState", ".", "FAILURE", ",", "SASLState", ".", "SUCCESS", ",", "SASLState", ".", "CHALLENGE", ")", ":", "return", "state", "if", "state", "in", "(", "\"failure\"", ...
af58bf30f688757e58af6e87892d35a8ce798482
test
SASLStateMachine.initiate
Initiate the SASL handshake and advertise the use of the given `mechanism`. If `payload` is not :data:`None`, it will be base64 encoded and sent as initial client response along with the ``<auth />`` element. Return the next state of the state machine as tuple (see :class:`SASLS...
aiosasl/__init__.py
def initiate(self, mechanism, payload=None): """ Initiate the SASL handshake and advertise the use of the given `mechanism`. If `payload` is not :data:`None`, it will be base64 encoded and sent as initial client response along with the ``<auth />`` element. Return the ne...
def initiate(self, mechanism, payload=None): """ Initiate the SASL handshake and advertise the use of the given `mechanism`. If `payload` is not :data:`None`, it will be base64 encoded and sent as initial client response along with the ``<auth />`` element. Return the ne...
[ "Initiate", "the", "SASL", "handshake", "and", "advertise", "the", "use", "of", "the", "given", "mechanism", ".", "If", "payload", "is", "not", ":", "data", ":", "None", "it", "will", "be", "base64", "encoded", "and", "sent", "as", "initial", "client", "...
horazont/aiosasl
python
https://github.com/horazont/aiosasl/blob/af58bf30f688757e58af6e87892d35a8ce798482/aiosasl/__init__.py#L437-L461
[ "def", "initiate", "(", "self", ",", "mechanism", ",", "payload", "=", "None", ")", ":", "if", "self", ".", "_state", "!=", "SASLState", ".", "INITIAL", ":", "raise", "RuntimeError", "(", "\"initiate has already been called\"", ")", "try", ":", "next_state", ...
af58bf30f688757e58af6e87892d35a8ce798482
test
SASLStateMachine.response
Send a response to the previously received challenge, with the given `payload`. The payload is encoded using base64 and transmitted to the server. Return the next state of the state machine as tuple (see :class:`SASLStateMachine` for details).
aiosasl/__init__.py
def response(self, payload): """ Send a response to the previously received challenge, with the given `payload`. The payload is encoded using base64 and transmitted to the server. Return the next state of the state machine as tuple (see :class:`SASLStateMachine` for deta...
def response(self, payload): """ Send a response to the previously received challenge, with the given `payload`. The payload is encoded using base64 and transmitted to the server. Return the next state of the state machine as tuple (see :class:`SASLStateMachine` for deta...
[ "Send", "a", "response", "to", "the", "previously", "received", "challenge", "with", "the", "given", "payload", ".", "The", "payload", "is", "encoded", "using", "base64", "and", "transmitted", "to", "the", "server", "." ]
horazont/aiosasl
python
https://github.com/horazont/aiosasl/blob/af58bf30f688757e58af6e87892d35a8ce798482/aiosasl/__init__.py#L464-L509
[ "def", "response", "(", "self", ",", "payload", ")", ":", "if", "self", ".", "_state", "==", "SASLState", ".", "SUCCESS_SIMULATE_CHALLENGE", ":", "if", "payload", "!=", "b\"\"", ":", "# XXX: either our mechanism is buggy or the server", "# sent SASLState.SUCCESS before ...
af58bf30f688757e58af6e87892d35a8ce798482
test
SASLStateMachine.abort
Abort an initiated SASL authentication process. The expected result state is ``failure``.
aiosasl/__init__.py
def abort(self): """ Abort an initiated SASL authentication process. The expected result state is ``failure``. """ if self._state == SASLState.INITIAL: raise RuntimeError("SASL authentication hasn't started yet") if self._state == SASLState.SUCCESS_SIMULATE_C...
def abort(self): """ Abort an initiated SASL authentication process. The expected result state is ``failure``. """ if self._state == SASLState.INITIAL: raise RuntimeError("SASL authentication hasn't started yet") if self._state == SASLState.SUCCESS_SIMULATE_C...
[ "Abort", "an", "initiated", "SASL", "authentication", "process", ".", "The", "expected", "result", "state", "is", "failure", "." ]
horazont/aiosasl
python
https://github.com/horazont/aiosasl/blob/af58bf30f688757e58af6e87892d35a8ce798482/aiosasl/__init__.py#L512-L526
[ "def", "abort", "(", "self", ")", ":", "if", "self", ".", "_state", "==", "SASLState", ".", "INITIAL", ":", "raise", "RuntimeError", "(", "\"SASL authentication hasn't started yet\"", ")", "if", "self", ".", "_state", "==", "SASLState", ".", "SUCCESS_SIMULATE_CH...
af58bf30f688757e58af6e87892d35a8ce798482
test
_saslprep_do_mapping
Perform the stringprep mapping step of SASLprep. Operates in-place on a list of unicode characters provided in `chars`.
aiosasl/stringprep.py
def _saslprep_do_mapping(chars): """ Perform the stringprep mapping step of SASLprep. Operates in-place on a list of unicode characters provided in `chars`. """ i = 0 while i < len(chars): c = chars[i] if stringprep.in_table_c12(c): chars[i] = "\u0020" elif st...
def _saslprep_do_mapping(chars): """ Perform the stringprep mapping step of SASLprep. Operates in-place on a list of unicode characters provided in `chars`. """ i = 0 while i < len(chars): c = chars[i] if stringprep.in_table_c12(c): chars[i] = "\u0020" elif st...
[ "Perform", "the", "stringprep", "mapping", "step", "of", "SASLprep", ".", "Operates", "in", "-", "place", "on", "a", "list", "of", "unicode", "characters", "provided", "in", "chars", "." ]
horazont/aiosasl
python
https://github.com/horazont/aiosasl/blob/af58bf30f688757e58af6e87892d35a8ce798482/aiosasl/stringprep.py#L130-L143
[ "def", "_saslprep_do_mapping", "(", "chars", ")", ":", "i", "=", "0", "while", "i", "<", "len", "(", "chars", ")", ":", "c", "=", "chars", "[", "i", "]", "if", "stringprep", ".", "in_table_c12", "(", "c", ")", ":", "chars", "[", "i", "]", "=", ...
af58bf30f688757e58af6e87892d35a8ce798482
test
trace
Implement the ``trace`` profile specified in :rfc:`4505`.
aiosasl/stringprep.py
def trace(string): """ Implement the ``trace`` profile specified in :rfc:`4505`. """ check_prohibited_output( string, ( stringprep.in_table_c21, stringprep.in_table_c22, stringprep.in_table_c3, stringprep.in_table_c4, stringpre...
def trace(string): """ Implement the ``trace`` profile specified in :rfc:`4505`. """ check_prohibited_output( string, ( stringprep.in_table_c21, stringprep.in_table_c22, stringprep.in_table_c3, stringprep.in_table_c4, stringpre...
[ "Implement", "the", "trace", "profile", "specified", "in", ":", "rfc", ":", "4505", "." ]
horazont/aiosasl
python
https://github.com/horazont/aiosasl/blob/af58bf30f688757e58af6e87892d35a8ce798482/aiosasl/stringprep.py#L183-L202
[ "def", "trace", "(", "string", ")", ":", "check_prohibited_output", "(", "string", ",", "(", "stringprep", ".", "in_table_c21", ",", "stringprep", ".", "in_table_c22", ",", "stringprep", ".", "in_table_c3", ",", "stringprep", ".", "in_table_c4", ",", "stringprep...
af58bf30f688757e58af6e87892d35a8ce798482
test
xor_bytes
Calculate the byte wise exclusive of of two :class:`bytes` objects of the same length.
aiosasl/utils.py
def xor_bytes(a, b): """ Calculate the byte wise exclusive of of two :class:`bytes` objects of the same length. """ assert len(a) == len(b) return bytes(map(operator.xor, a, b))
def xor_bytes(a, b): """ Calculate the byte wise exclusive of of two :class:`bytes` objects of the same length. """ assert len(a) == len(b) return bytes(map(operator.xor, a, b))
[ "Calculate", "the", "byte", "wise", "exclusive", "of", "of", "two", ":", "class", ":", "bytes", "objects", "of", "the", "same", "length", "." ]
horazont/aiosasl
python
https://github.com/horazont/aiosasl/blob/af58bf30f688757e58af6e87892d35a8ce798482/aiosasl/utils.py#L26-L32
[ "def", "xor_bytes", "(", "a", ",", "b", ")", ":", "assert", "len", "(", "a", ")", "==", "len", "(", "b", ")", "return", "bytes", "(", "map", "(", "operator", ".", "xor", ",", "a", ",", "b", ")", ")" ]
af58bf30f688757e58af6e87892d35a8ce798482
test
admin_footer
Template tag that renders the footer information based on the authenticated user's permissions.
admin_footer/templatetags/footer.py
def admin_footer(parser, token): """ Template tag that renders the footer information based on the authenticated user's permissions. """ # split_contents() doesn't know how to split quoted strings. tag_name = token.split_contents() if len(tag_name) > 1: raise base.TemplateSyntaxErro...
def admin_footer(parser, token): """ Template tag that renders the footer information based on the authenticated user's permissions. """ # split_contents() doesn't know how to split quoted strings. tag_name = token.split_contents() if len(tag_name) > 1: raise base.TemplateSyntaxErro...
[ "Template", "tag", "that", "renders", "the", "footer", "information", "based", "on", "the", "authenticated", "user", "s", "permissions", "." ]
collab-project/django-admin-footer
python
https://github.com/collab-project/django-admin-footer/blob/55d5b7a4b168fa56f39664091af06820236057c6/admin_footer/templatetags/footer.py#L34-L49
[ "def", "admin_footer", "(", "parser", ",", "token", ")", ":", "# split_contents() doesn't know how to split quoted strings.", "tag_name", "=", "token", ".", "split_contents", "(", ")", "if", "len", "(", "tag_name", ")", ">", "1", ":", "raise", "base", ".", "Temp...
55d5b7a4b168fa56f39664091af06820236057c6
test
build_payment_parameters
Builds the parameters needed to present the user with a datatrans payment form. :param amount: The amount and currency we want the user to pay :param client_ref: A unique reference for this payment :return: The parameters needed to display the datatrans form
datatrans/gateway/payment_parameters.py
def build_payment_parameters(amount: Money, client_ref: str) -> PaymentParameters: """ Builds the parameters needed to present the user with a datatrans payment form. :param amount: The amount and currency we want the user to pay :param client_ref: A unique reference for this payment :return: The p...
def build_payment_parameters(amount: Money, client_ref: str) -> PaymentParameters: """ Builds the parameters needed to present the user with a datatrans payment form. :param amount: The amount and currency we want the user to pay :param client_ref: A unique reference for this payment :return: The p...
[ "Builds", "the", "parameters", "needed", "to", "present", "the", "user", "with", "a", "datatrans", "payment", "form", "." ]
skioo/django-datatrans-gateway
python
https://github.com/skioo/django-datatrans-gateway/blob/1c4de5b589403e4ec3aadc4ff2fc1eb17b34bcc7/datatrans/gateway/payment_parameters.py#L13-L37
[ "def", "build_payment_parameters", "(", "amount", ":", "Money", ",", "client_ref", ":", "str", ")", "->", "PaymentParameters", ":", "merchant_id", "=", "web_merchant_id", "amount", ",", "currency", "=", "money_to_amount_and_currency", "(", "amount", ")", "refno", ...
1c4de5b589403e4ec3aadc4ff2fc1eb17b34bcc7
test
build_register_credit_card_parameters
Builds the parameters needed to present the user with a datatrans form to register a credit card. Contrary to a payment form, datatrans will not show an amount. :param client_ref: A unique reference for this alias capture. :return: The parameters needed to display the datatrans form
datatrans/gateway/payment_parameters.py
def build_register_credit_card_parameters(client_ref: str) -> PaymentParameters: """ Builds the parameters needed to present the user with a datatrans form to register a credit card. Contrary to a payment form, datatrans will not show an amount. :param client_ref: A unique reference for this alias capt...
def build_register_credit_card_parameters(client_ref: str) -> PaymentParameters: """ Builds the parameters needed to present the user with a datatrans form to register a credit card. Contrary to a payment form, datatrans will not show an amount. :param client_ref: A unique reference for this alias capt...
[ "Builds", "the", "parameters", "needed", "to", "present", "the", "user", "with", "a", "datatrans", "form", "to", "register", "a", "credit", "card", ".", "Contrary", "to", "a", "payment", "form", "datatrans", "will", "not", "show", "an", "amount", "." ]
skioo/django-datatrans-gateway
python
https://github.com/skioo/django-datatrans-gateway/blob/1c4de5b589403e4ec3aadc4ff2fc1eb17b34bcc7/datatrans/gateway/payment_parameters.py#L40-L66
[ "def", "build_register_credit_card_parameters", "(", "client_ref", ":", "str", ")", "->", "PaymentParameters", ":", "amount", "=", "0", "currency", "=", "'CHF'", "# Datatrans requires this value to be filled, so we use this arbitrary currency.", "merchant_id", "=", "web_merchan...
1c4de5b589403e4ec3aadc4ff2fc1eb17b34bcc7
test
pay_with_alias
Charges money using datatrans, given a previously registered credit card alias. :param amount: The amount and currency we want to charge :param alias_registration_id: The alias registration to use :param client_ref: A unique reference for this charge :return: a Payment (either successful or not)
datatrans/gateway/payment_with_alias.py
def pay_with_alias(amount: Money, alias_registration_id: str, client_ref: str) -> Payment: """ Charges money using datatrans, given a previously registered credit card alias. :param amount: The amount and currency we want to charge :param alias_registration_id: The alias registration to use :param ...
def pay_with_alias(amount: Money, alias_registration_id: str, client_ref: str) -> Payment: """ Charges money using datatrans, given a previously registered credit card alias. :param amount: The amount and currency we want to charge :param alias_registration_id: The alias registration to use :param ...
[ "Charges", "money", "using", "datatrans", "given", "a", "previously", "registered", "credit", "card", "alias", "." ]
skioo/django-datatrans-gateway
python
https://github.com/skioo/django-datatrans-gateway/blob/1c4de5b589403e4ec3aadc4ff2fc1eb17b34bcc7/datatrans/gateway/payment_with_alias.py#L15-L47
[ "def", "pay_with_alias", "(", "amount", ":", "Money", ",", "alias_registration_id", ":", "str", ",", "client_ref", ":", "str", ")", "->", "Payment", ":", "if", "amount", ".", "amount", "<=", "0", ":", "raise", "ValueError", "(", "'Pay with alias takes a strict...
1c4de5b589403e4ec3aadc4ff2fc1eb17b34bcc7
test
parse_notification_xml
Both alias registration and payments are received here. We can differentiate them by looking at the use-alias user-parameter (and verifying the amount is o).
datatrans/gateway/notification.py
def parse_notification_xml(xml: str) -> Union[AliasRegistration, Payment]: """" Both alias registration and payments are received here. We can differentiate them by looking at the use-alias user-parameter (and verifying the amount is o). """ body = fromstring(xml).find('body') transaction = bod...
def parse_notification_xml(xml: str) -> Union[AliasRegistration, Payment]: """" Both alias registration and payments are received here. We can differentiate them by looking at the use-alias user-parameter (and verifying the amount is o). """ body = fromstring(xml).find('body') transaction = bod...
[ "Both", "alias", "registration", "and", "payments", "are", "received", "here", ".", "We", "can", "differentiate", "them", "by", "looking", "at", "the", "use", "-", "alias", "user", "-", "parameter", "(", "and", "verifying", "the", "amount", "is", "o", ")",...
skioo/django-datatrans-gateway
python
https://github.com/skioo/django-datatrans-gateway/blob/1c4de5b589403e4ec3aadc4ff2fc1eb17b34bcc7/datatrans/gateway/notification.py#L19-L134
[ "def", "parse_notification_xml", "(", "xml", ":", "str", ")", "->", "Union", "[", "AliasRegistration", ",", "Payment", "]", ":", "body", "=", "fromstring", "(", "xml", ")", ".", "find", "(", "'body'", ")", "transaction", "=", "body", ".", "find", "(", ...
1c4de5b589403e4ec3aadc4ff2fc1eb17b34bcc7
test
short_version
Return short application version. For example: `1.0.0`.
admin_footer/__init__.py
def short_version(version=None): """ Return short application version. For example: `1.0.0`. """ v = version or __version__ return '.'.join([str(x) for x in v[:3]])
def short_version(version=None): """ Return short application version. For example: `1.0.0`. """ v = version or __version__ return '.'.join([str(x) for x in v[:3]])
[ "Return", "short", "application", "version", ".", "For", "example", ":", "1", ".", "0", ".", "0", "." ]
collab-project/django-admin-footer
python
https://github.com/collab-project/django-admin-footer/blob/55d5b7a4b168fa56f39664091af06820236057c6/admin_footer/__init__.py#L15-L20
[ "def", "short_version", "(", "version", "=", "None", ")", ":", "v", "=", "version", "or", "__version__", "return", "'.'", ".", "join", "(", "[", "str", "(", "x", ")", "for", "x", "in", "v", "[", ":", "3", "]", "]", ")" ]
55d5b7a4b168fa56f39664091af06820236057c6
test
get_version
Return full version nr, inc. rc, beta etc tags. For example: `2.0.0a1` :rtype: str
admin_footer/__init__.py
def get_version(version=None): """ Return full version nr, inc. rc, beta etc tags. For example: `2.0.0a1` :rtype: str """ v = version or __version__ if len(v) == 4: return '{0}{1}'.format(short_version(v), v[3]) return short_version(v)
def get_version(version=None): """ Return full version nr, inc. rc, beta etc tags. For example: `2.0.0a1` :rtype: str """ v = version or __version__ if len(v) == 4: return '{0}{1}'.format(short_version(v), v[3]) return short_version(v)
[ "Return", "full", "version", "nr", "inc", ".", "rc", "beta", "etc", "tags", "." ]
collab-project/django-admin-footer
python
https://github.com/collab-project/django-admin-footer/blob/55d5b7a4b168fa56f39664091af06820236057c6/admin_footer/__init__.py#L23-L34
[ "def", "get_version", "(", "version", "=", "None", ")", ":", "v", "=", "version", "or", "__version__", "if", "len", "(", "v", ")", "==", "4", ":", "return", "'{0}{1}'", ".", "format", "(", "short_version", "(", "v", ")", ",", "v", "[", "3", "]", ...
55d5b7a4b168fa56f39664091af06820236057c6
test
refund
Refunds (partially or completely) a previously authorized and settled payment. :param amount: The amount and currency we want to refund. Must be positive, in the same currency as the original payment, and not exceed the amount of the original payment. :param payment_id: The id of the payment to refund. ...
datatrans/gateway/refunding.py
def refund(amount: Money, payment_id: str) -> Refund: """ Refunds (partially or completely) a previously authorized and settled payment. :param amount: The amount and currency we want to refund. Must be positive, in the same currency as the original payment, and not exceed the amount of the original pay...
def refund(amount: Money, payment_id: str) -> Refund: """ Refunds (partially or completely) a previously authorized and settled payment. :param amount: The amount and currency we want to refund. Must be positive, in the same currency as the original payment, and not exceed the amount of the original pay...
[ "Refunds", "(", "partially", "or", "completely", ")", "a", "previously", "authorized", "and", "settled", "payment", ".", ":", "param", "amount", ":", "The", "amount", "and", "currency", "we", "want", "to", "refund", ".", "Must", "be", "positive", "in", "th...
skioo/django-datatrans-gateway
python
https://github.com/skioo/django-datatrans-gateway/blob/1c4de5b589403e4ec3aadc4ff2fc1eb17b34bcc7/datatrans/gateway/refunding.py#L15-L57
[ "def", "refund", "(", "amount", ":", "Money", ",", "payment_id", ":", "str", ")", "->", "Refund", ":", "if", "amount", ".", "amount", "<=", "0", ":", "raise", "ValueError", "(", "'Refund takes a strictly positive amount'", ")", "payment", "=", "Payment", "."...
1c4de5b589403e4ec3aadc4ff2fc1eb17b34bcc7
test
FilesystemBrowser._construct
Construct widget.
source/riffle/browser.py
def _construct(self): '''Construct widget.''' self.setLayout(QtGui.QVBoxLayout()) self._headerLayout = QtGui.QHBoxLayout() self._locationWidget = QtGui.QComboBox() self._headerLayout.addWidget(self._locationWidget, stretch=1) self._upButton = QtGui.QToolButton() ...
def _construct(self): '''Construct widget.''' self.setLayout(QtGui.QVBoxLayout()) self._headerLayout = QtGui.QHBoxLayout() self._locationWidget = QtGui.QComboBox() self._headerLayout.addWidget(self._locationWidget, stretch=1) self._upButton = QtGui.QToolButton() ...
[ "Construct", "widget", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/browser.py#L35-L88
[ "def", "_construct", "(", "self", ")", ":", "self", ".", "setLayout", "(", "QtGui", ".", "QVBoxLayout", "(", ")", ")", "self", ".", "_headerLayout", "=", "QtGui", ".", "QHBoxLayout", "(", ")", "self", ".", "_locationWidget", "=", "QtGui", ".", "QComboBox...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemBrowser._postConstruction
Perform post-construction operations.
source/riffle/browser.py
def _postConstruction(self): '''Perform post-construction operations.''' self.setWindowTitle('Filesystem Browser') self._filesystemWidget.sortByColumn(0, QtCore.Qt.AscendingOrder) # TODO: Remove once bookmarks widget implemented. self._bookmarksWidget.hide() self._accep...
def _postConstruction(self): '''Perform post-construction operations.''' self.setWindowTitle('Filesystem Browser') self._filesystemWidget.sortByColumn(0, QtCore.Qt.AscendingOrder) # TODO: Remove once bookmarks widget implemented. self._bookmarksWidget.hide() self._accep...
[ "Perform", "post", "-", "construction", "operations", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/browser.py#L90-L122
[ "def", "_postConstruction", "(", "self", ")", ":", "self", ".", "setWindowTitle", "(", "'Filesystem Browser'", ")", "self", ".", "_filesystemWidget", ".", "sortByColumn", "(", "0", ",", "QtCore", ".", "Qt", ".", "AscendingOrder", ")", "# TODO: Remove once bookmark...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemBrowser._configureShortcuts
Add keyboard shortcuts to navigate the filesystem.
source/riffle/browser.py
def _configureShortcuts(self): '''Add keyboard shortcuts to navigate the filesystem.''' self._upShortcut = QtGui.QShortcut( QtGui.QKeySequence('Backspace'), self ) self._upShortcut.setAutoRepeat(False) self._upShortcut.activated.connect(self._onNavigateUpButtonClicked...
def _configureShortcuts(self): '''Add keyboard shortcuts to navigate the filesystem.''' self._upShortcut = QtGui.QShortcut( QtGui.QKeySequence('Backspace'), self ) self._upShortcut.setAutoRepeat(False) self._upShortcut.activated.connect(self._onNavigateUpButtonClicked...
[ "Add", "keyboard", "shortcuts", "to", "navigate", "the", "filesystem", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/browser.py#L124-L130
[ "def", "_configureShortcuts", "(", "self", ")", ":", "self", ".", "_upShortcut", "=", "QtGui", ".", "QShortcut", "(", "QtGui", ".", "QKeySequence", "(", "'Backspace'", ")", ",", "self", ")", "self", ".", "_upShortcut", ".", "setAutoRepeat", "(", "False", "...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemBrowser._onActivateItem
Handle activation of item in listing.
source/riffle/browser.py
def _onActivateItem(self, index): '''Handle activation of item in listing.''' item = self._filesystemWidget.model().item(index) if not isinstance(item, riffle.model.File): self._acceptButton.setDisabled(True) self.setLocation(item.path, interactive=True)
def _onActivateItem(self, index): '''Handle activation of item in listing.''' item = self._filesystemWidget.model().item(index) if not isinstance(item, riffle.model.File): self._acceptButton.setDisabled(True) self.setLocation(item.path, interactive=True)
[ "Handle", "activation", "of", "item", "in", "listing", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/browser.py#L132-L137
[ "def", "_onActivateItem", "(", "self", ",", "index", ")", ":", "item", "=", "self", ".", "_filesystemWidget", ".", "model", "(", ")", ".", "item", "(", "index", ")", "if", "not", "isinstance", "(", "item", ",", "riffle", ".", "model", ".", "File", ")...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemBrowser._onSelectItem
Handle selection of item in listing.
source/riffle/browser.py
def _onSelectItem(self, selection, previousSelection): '''Handle selection of item in listing.''' self._acceptButton.setEnabled(True) del self._selected[:] item = self._filesystemWidget.model().item(selection) self._selected.append(item.path)
def _onSelectItem(self, selection, previousSelection): '''Handle selection of item in listing.''' self._acceptButton.setEnabled(True) del self._selected[:] item = self._filesystemWidget.model().item(selection) self._selected.append(item.path)
[ "Handle", "selection", "of", "item", "in", "listing", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/browser.py#L139-L144
[ "def", "_onSelectItem", "(", "self", ",", "selection", ",", "previousSelection", ")", ":", "self", ".", "_acceptButton", ".", "setEnabled", "(", "True", ")", "del", "self", ".", "_selected", "[", ":", "]", "item", "=", "self", ".", "_filesystemWidget", "."...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemBrowser._onNavigate
Handle selection of path segment.
source/riffle/browser.py
def _onNavigate(self, index): '''Handle selection of path segment.''' if index > 0: self.setLocation( self._locationWidget.itemData(index), interactive=True )
def _onNavigate(self, index): '''Handle selection of path segment.''' if index > 0: self.setLocation( self._locationWidget.itemData(index), interactive=True )
[ "Handle", "selection", "of", "path", "segment", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/browser.py#L146-L151
[ "def", "_onNavigate", "(", "self", ",", "index", ")", ":", "if", "index", ">", "0", ":", "self", ".", "setLocation", "(", "self", ".", "_locationWidget", ".", "itemData", "(", "index", ")", ",", "interactive", "=", "True", ")" ]
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemBrowser._segmentPath
Return list of valid *path* segments.
source/riffle/browser.py
def _segmentPath(self, path): '''Return list of valid *path* segments.''' parts = [] model = self._filesystemWidget.model() # Separate root path from remainder. remainder = path while True: if remainder == model.root.path: break ...
def _segmentPath(self, path): '''Return list of valid *path* segments.''' parts = [] model = self._filesystemWidget.model() # Separate root path from remainder. remainder = path while True: if remainder == model.root.path: break ...
[ "Return", "list", "of", "valid", "*", "path", "*", "segments", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/browser.py#L158-L180
[ "def", "_segmentPath", "(", "self", ",", "path", ")", ":", "parts", "=", "[", "]", "model", "=", "self", ".", "_filesystemWidget", ".", "model", "(", ")", "# Separate root path from remainder.", "remainder", "=", "path", "while", "True", ":", "if", "remainde...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemBrowser.setLocation
Set current location to *path*. *path* must be the same as root or under the root. .. note:: Comparisons are case-sensitive. If you set the root as 'D:/' then location can be set as 'D:/folder' *not* 'd:/folder'. If *interactive* is True, catch any exception occurring...
source/riffle/browser.py
def setLocation(self, path, interactive=False): '''Set current location to *path*. *path* must be the same as root or under the root. .. note:: Comparisons are case-sensitive. If you set the root as 'D:/' then location can be set as 'D:/folder' *not* 'd:/folder'. ...
def setLocation(self, path, interactive=False): '''Set current location to *path*. *path* must be the same as root or under the root. .. note:: Comparisons are case-sensitive. If you set the root as 'D:/' then location can be set as 'D:/folder' *not* 'd:/folder'. ...
[ "Set", "current", "location", "to", "*", "path", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/browser.py#L182-L211
[ "def", "setLocation", "(", "self", ",", "path", ",", "interactive", "=", "False", ")", ":", "try", ":", "self", ".", "_setLocation", "(", "path", ")", "except", "Exception", "as", "error", ":", "if", "not", "interactive", ":", "raise", "else", ":", "wa...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
FilesystemBrowser._setLocation
Set current location to *path*. *path* must be the same as root or under the root. .. note:: Comparisons are case-sensitive. If you set the root as 'D:/' then location can be set as 'D:/folder' *not* 'd:/folder'.
source/riffle/browser.py
def _setLocation(self, path): '''Set current location to *path*. *path* must be the same as root or under the root. .. note:: Comparisons are case-sensitive. If you set the root as 'D:/' then location can be set as 'D:/folder' *not* 'd:/folder'. ''' mo...
def _setLocation(self, path): '''Set current location to *path*. *path* must be the same as root or under the root. .. note:: Comparisons are case-sensitive. If you set the root as 'D:/' then location can be set as 'D:/folder' *not* 'd:/folder'. ''' mo...
[ "Set", "current", "location", "to", "*", "path", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/browser.py#L213-L258
[ "def", "_setLocation", "(", "self", ",", "path", ")", ":", "model", "=", "self", ".", "_filesystemWidget", ".", "model", "(", ")", "if", "not", "path", ".", "startswith", "(", "model", ".", "root", ".", "path", ")", ":", "raise", "ValueError", "(", "...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
BuildResources.finalize_options
Finalize options to be used.
setup.py
def finalize_options(self): '''Finalize options to be used.''' self.resource_source_path = os.path.join(RESOURCE_PATH, 'resource.qrc') self.resource_target_path = RESOURCE_TARGET_PATH
def finalize_options(self): '''Finalize options to be used.''' self.resource_source_path = os.path.join(RESOURCE_PATH, 'resource.qrc') self.resource_target_path = RESOURCE_TARGET_PATH
[ "Finalize", "options", "to", "be", "used", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/setup.py#L48-L51
[ "def", "finalize_options", "(", "self", ")", ":", "self", ".", "resource_source_path", "=", "os", ".", "path", ".", "join", "(", "RESOURCE_PATH", ",", "'resource.qrc'", ")", "self", ".", "resource_target_path", "=", "RESOURCE_TARGET_PATH" ]
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
BuildResources.run
Run build.
setup.py
def run(self): '''Run build.''' if ON_READ_THE_DOCS: # PySide not available. return try: pyside_rcc_command = 'pyside-rcc' # On Windows, pyside-rcc is not automatically available on the # PATH so try to find it manually. i...
def run(self): '''Run build.''' if ON_READ_THE_DOCS: # PySide not available. return try: pyside_rcc_command = 'pyside-rcc' # On Windows, pyside-rcc is not automatically available on the # PATH so try to find it manually. i...
[ "Run", "build", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/setup.py#L53-L83
[ "def", "run", "(", "self", ")", ":", "if", "ON_READ_THE_DOCS", ":", "# PySide not available.", "return", "try", ":", "pyside_rcc_command", "=", "'pyside-rcc'", "# On Windows, pyside-rcc is not automatically available on the", "# PATH so try to find it manually.", "if", "sys", ...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Clean.run
Run clean.
setup.py
def run(self): '''Run clean.''' relative_resource_path = os.path.relpath( RESOURCE_TARGET_PATH, ROOT_PATH ) if os.path.exists(relative_resource_path): os.remove(relative_resource_path) else: distutils.log.warn( '\'{0}\' does not...
def run(self): '''Run clean.''' relative_resource_path = os.path.relpath( RESOURCE_TARGET_PATH, ROOT_PATH ) if os.path.exists(relative_resource_path): os.remove(relative_resource_path) else: distutils.log.warn( '\'{0}\' does not...
[ "Run", "clean", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/setup.py#L114-L135
[ "def", "run", "(", "self", ")", ":", "relative_resource_path", "=", "os", ".", "path", ".", "relpath", "(", "RESOURCE_TARGET_PATH", ",", "ROOT_PATH", ")", "if", "os", ".", "path", ".", "exists", "(", "relative_resource_path", ")", ":", "os", ".", "remove",...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
ItemFactory
Return appropriate :py:class:`Item` instance for *path*. If *path* is null then return Computer root.
source/riffle/model.py
def ItemFactory(path): '''Return appropriate :py:class:`Item` instance for *path*. If *path* is null then return Computer root. ''' if not path: return Computer() elif os.path.isfile(path): return File(path) elif os.path.ismount(path): return Mount(path) elif os....
def ItemFactory(path): '''Return appropriate :py:class:`Item` instance for *path*. If *path* is null then return Computer root. ''' if not path: return Computer() elif os.path.isfile(path): return File(path) elif os.path.ismount(path): return Mount(path) elif os....
[ "Return", "appropriate", ":", "py", ":", "class", ":", "Item", "instance", "for", "*", "path", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L13-L33
[ "def", "ItemFactory", "(", "path", ")", ":", "if", "not", "path", ":", "return", "Computer", "(", ")", "elif", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "return", "File", "(", "path", ")", "elif", "os", ".", "path", ".", "ismount", ...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Item.addChild
Add *item* as child of this item.
source/riffle/model.py
def addChild(self, item): '''Add *item* as child of this item.''' if item.parent and item.parent != self: item.parent.removeChild(item) self.children.append(item) item.parent = self
def addChild(self, item): '''Add *item* as child of this item.''' if item.parent and item.parent != self: item.parent.removeChild(item) self.children.append(item) item.parent = self
[ "Add", "*", "item", "*", "as", "child", "of", "this", "item", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L80-L86
[ "def", "addChild", "(", "self", ",", "item", ")", ":", "if", "item", ".", "parent", "and", "item", ".", "parent", "!=", "self", ":", "item", ".", "parent", ".", "removeChild", "(", "item", ")", "self", ".", "children", ".", "append", "(", "item", "...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Item.fetchChildren
Fetch and return new children. Will only fetch children whilst canFetchMore is True. .. note:: It is the caller's responsibility to add each fetched child to this parent if desired using :py:meth:`Item.addChild`.
source/riffle/model.py
def fetchChildren(self): '''Fetch and return new children. Will only fetch children whilst canFetchMore is True. .. note:: It is the caller's responsibility to add each fetched child to this parent if desired using :py:meth:`Item.addChild`. ''' if not ...
def fetchChildren(self): '''Fetch and return new children. Will only fetch children whilst canFetchMore is True. .. note:: It is the caller's responsibility to add each fetched child to this parent if desired using :py:meth:`Item.addChild`. ''' if not ...
[ "Fetch", "and", "return", "new", "children", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L105-L122
[ "def", "fetchChildren", "(", "self", ")", ":", "if", "not", "self", ".", "canFetchMore", "(", ")", ":", "return", "[", "]", "children", "=", "self", ".", "_fetchChildren", "(", ")", "self", ".", "_fetched", "=", "True", "return", "children" ]
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Item.refetch
Reload children.
source/riffle/model.py
def refetch(self): '''Reload children.''' # Reset children for child in self.children[:]: self.removeChild(child) # Enable children fetching self._fetched = False
def refetch(self): '''Reload children.''' # Reset children for child in self.children[:]: self.removeChild(child) # Enable children fetching self._fetched = False
[ "Reload", "children", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L133-L140
[ "def", "refetch", "(", "self", ")", ":", "# Reset children", "for", "child", "in", "self", ".", "children", "[", ":", "]", ":", "self", ".", "removeChild", "(", "child", ")", "# Enable children fetching", "self", ".", "_fetched", "=", "False" ]
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Computer._fetchChildren
Fetch and return new child items.
source/riffle/model.py
def _fetchChildren(self): '''Fetch and return new child items.''' children = [] for entry in QDir.drives(): path = os.path.normpath(entry.canonicalFilePath()) children.append(Mount(path)) return children
def _fetchChildren(self): '''Fetch and return new child items.''' children = [] for entry in QDir.drives(): path = os.path.normpath(entry.canonicalFilePath()) children.append(Mount(path)) return children
[ "Fetch", "and", "return", "new", "child", "items", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L160-L167
[ "def", "_fetchChildren", "(", "self", ")", ":", "children", "=", "[", "]", "for", "entry", "in", "QDir", ".", "drives", "(", ")", ":", "path", "=", "os", ".", "path", ".", "normpath", "(", "entry", ".", "canonicalFilePath", "(", ")", ")", "children",...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Directory._fetchChildren
Fetch and return new child items.
source/riffle/model.py
def _fetchChildren(self): '''Fetch and return new child items.''' children = [] # List paths under this directory. paths = [] for name in os.listdir(self.path): paths.append(os.path.normpath(os.path.join(self.path, name))) # Handle collections. colle...
def _fetchChildren(self): '''Fetch and return new child items.''' children = [] # List paths under this directory. paths = [] for name in os.listdir(self.path): paths.append(os.path.normpath(os.path.join(self.path, name))) # Handle collections. colle...
[ "Fetch", "and", "return", "new", "child", "items", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L191-L216
[ "def", "_fetchChildren", "(", "self", ")", ":", "children", "=", "[", "]", "# List paths under this directory.", "paths", "=", "[", "]", "for", "name", "in", "os", ".", "listdir", "(", "self", ".", "path", ")", ":", "paths", ".", "append", "(", "os", "...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Collection._fetchChildren
Fetch and return new child items.
source/riffle/model.py
def _fetchChildren(self): '''Fetch and return new child items.''' children = [] for path in self._collection: try: child = ItemFactory(path) except ValueError: pass else: children.append(child) return ch...
def _fetchChildren(self): '''Fetch and return new child items.''' children = [] for path in self._collection: try: child = ItemFactory(path) except ValueError: pass else: children.append(child) return ch...
[ "Fetch", "and", "return", "new", "child", "items", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L265-L276
[ "def", "_fetchChildren", "(", "self", ")", ":", "children", "=", "[", "]", "for", "path", "in", "self", ".", "_collection", ":", "try", ":", "child", "=", "ItemFactory", "(", "path", ")", "except", "ValueError", ":", "pass", "else", ":", "children", "....
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Filesystem.rowCount
Return number of children *parent* index has.
source/riffle/model.py
def rowCount(self, parent): '''Return number of children *parent* index has.''' if parent.column() > 0: return 0 if parent.isValid(): item = parent.internalPointer() else: item = self.root return len(item.children)
def rowCount(self, parent): '''Return number of children *parent* index has.''' if parent.column() > 0: return 0 if parent.isValid(): item = parent.internalPointer() else: item = self.root return len(item.children)
[ "Return", "number", "of", "children", "*", "parent", "*", "index", "has", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L297-L307
[ "def", "rowCount", "(", "self", ",", "parent", ")", ":", "if", "parent", ".", "column", "(", ")", ">", "0", ":", "return", "0", "if", "parent", ".", "isValid", "(", ")", ":", "item", "=", "parent", ".", "internalPointer", "(", ")", "else", ":", "...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Filesystem.index
Return index for *row* and *column* under *parent*.
source/riffle/model.py
def index(self, row, column, parent): '''Return index for *row* and *column* under *parent*.''' if not self.hasIndex(row, column, parent): return QModelIndex() if not parent.isValid(): item = self.root else: item = parent.internalPointer() tr...
def index(self, row, column, parent): '''Return index for *row* and *column* under *parent*.''' if not self.hasIndex(row, column, parent): return QModelIndex() if not parent.isValid(): item = self.root else: item = parent.internalPointer() tr...
[ "Return", "index", "for", "*", "row", "*", "and", "*", "column", "*", "under", "*", "parent", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L320-L335
[ "def", "index", "(", "self", ",", "row", ",", "column", ",", "parent", ")", ":", "if", "not", "self", ".", "hasIndex", "(", "row", ",", "column", ",", "parent", ")", ":", "return", "QModelIndex", "(", ")", "if", "not", "parent", ".", "isValid", "("...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d
test
Filesystem.pathIndex
Return index of item with *path*.
source/riffle/model.py
def pathIndex(self, path): '''Return index of item with *path*.''' if path == self.root.path: return QModelIndex() if not path.startswith(self.root.path): return QModelIndex() parts = [] while True: if path == self.root.path: ...
def pathIndex(self, path): '''Return index of item with *path*.''' if path == self.root.path: return QModelIndex() if not path.startswith(self.root.path): return QModelIndex() parts = [] while True: if path == self.root.path: ...
[ "Return", "index", "of", "item", "with", "*", "path", "*", "." ]
4degrees/riffle
python
https://github.com/4degrees/riffle/blob/e5a0d908df8c93ff1ee7abdda8875fd1667df53d/source/riffle/model.py#L337-L379
[ "def", "pathIndex", "(", "self", ",", "path", ")", ":", "if", "path", "==", "self", ".", "root", ".", "path", ":", "return", "QModelIndex", "(", ")", "if", "not", "path", ".", "startswith", "(", "self", ".", "root", ".", "path", ")", ":", "return",...
e5a0d908df8c93ff1ee7abdda8875fd1667df53d