Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
LoginTest.test_non_ascii_login
(self)
You can log in even if your password contain non-ASCII characters.
You can log in even if your password contain non-ASCII characters.
def test_non_ascii_login(self) -> None: """ You can log in even if your password contain non-ASCII characters. """ email = self.nonreg_email("test") password = "hümbüǵ" # Registering succeeds. self.register(email, password) user_profile = self.nonreg_u...
[ "def", "test_non_ascii_login", "(", "self", ")", "->", "None", ":", "email", "=", "self", ".", "nonreg_email", "(", "\"test\"", ")", "password", "=", "\"hümbüǵ\"", "# Registering succeeds.", "self", ".", "register", "(", "email", ",", "password", ")", "user...
[ 856, 4 ]
[ 873, 54 ]
python
en
['en', 'error', 'th']
False
LoginTest.test_login_page_redirects_logged_in_user
(self)
You will be redirected to the app's main page if you land on the login page when already logged in.
You will be redirected to the app's main page if you land on the login page when already logged in.
def test_login_page_redirects_logged_in_user(self) -> None: """You will be redirected to the app's main page if you land on the login page when already logged in. """ self.login("cordelia") response = self.client_get("/login/") self.assertEqual(response["Location"], "http...
[ "def", "test_login_page_redirects_logged_in_user", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"cordelia\"", ")", "response", "=", "self", ".", "client_get", "(", "\"/login/\"", ")", "self", ".", "assertEqual", "(", "response", "[", "\"Lo...
[ 876, 4 ]
[ 882, 73 ]
python
en
['en', 'en', 'en']
True
LoginTest.test_login_page_redirects_logged_in_user_under_2fa
(self)
You will be redirected to the app's main page if you land on the login page when already logged in.
You will be redirected to the app's main page if you land on the login page when already logged in.
def test_login_page_redirects_logged_in_user_under_2fa(self) -> None: """You will be redirected to the app's main page if you land on the login page when already logged in. """ user_profile = self.example_user("cordelia") self.create_default_device(user_profile) self.log...
[ "def", "test_login_page_redirects_logged_in_user_under_2fa", "(", "self", ")", "->", "None", ":", "user_profile", "=", "self", ".", "example_user", "(", "\"cordelia\"", ")", "self", ".", "create_default_device", "(", "user_profile", ")", "self", ".", "login", "(", ...
[ 889, 4 ]
[ 900, 73 ]
python
en
['en', 'en', 'en']
True
InviteUserBase.invite
( self, invitee_emails: str, stream_names: Sequence[str], body: str = "", invite_as: int = PreregistrationUser.INVITE_AS["MEMBER"], )
Invites the specified users to Zulip with the specified streams. users should be a string containing the users to invite, comma or newline separated. streams should be a list of strings.
Invites the specified users to Zulip with the specified streams.
def invite( self, invitee_emails: str, stream_names: Sequence[str], body: str = "", invite_as: int = PreregistrationUser.INVITE_AS["MEMBER"], ) -> HttpResponse: """ Invites the specified users to Zulip with the specified streams. users should be a str...
[ "def", "invite", "(", "self", ",", "invitee_emails", ":", "str", ",", "stream_names", ":", "Sequence", "[", "str", "]", ",", "body", ":", "str", "=", "\"\"", ",", "invite_as", ":", "int", "=", "PreregistrationUser", ".", "INVITE_AS", "[", "\"MEMBER\"", "...
[ 951, 4 ]
[ 976, 9 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_successful_invite_user
(self)
A call to /json/invites with valid parameters causes an invitation email to be sent.
A call to /json/invites with valid parameters causes an invitation email to be sent.
def test_successful_invite_user(self) -> None: """ A call to /json/invites with valid parameters causes an invitation email to be sent. """ self.login("hamlet") invitee = "alice-test@zulip.com" self.assert_json_success(self.invite(invitee, ["Denmark"])) se...
[ "def", "test_successful_invite_user", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "invitee", "=", "\"alice-test@zulip.com\"", "self", ".", "assert_json_success", "(", "self", ".", "invite", "(", "invitee", ",", "[", "\"De...
[ 980, 4 ]
[ 989, 68 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_mirror_dummy_user
(self)
A mirror dummy account is a temporary account that we keep in our system if we are mirroring data from something like Zephyr or IRC. We want users to eventually just sign up or register for Zulip, in which case we will just fully "activate" the account. Here we...
A mirror dummy account is a temporary account that we keep in our system if we are mirroring data from something like Zephyr or IRC.
def test_invite_mirror_dummy_user(self) -> None: """ A mirror dummy account is a temporary account that we keep in our system if we are mirroring data from something like Zephyr or IRC. We want users to eventually just sign up or register for Zulip, in which case we will...
[ "def", "test_invite_mirror_dummy_user", "(", "self", ")", "->", "None", ":", "inviter", "=", "self", ".", "example_user", "(", "\"hamlet\"", ")", "self", ".", "login_user", "(", "inviter", ")", "mirror_user", "=", "self", ".", "example_user", "(", "\"cordelia\...
[ 1119, 4 ]
[ 1152, 9 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_user_as_invalid_type
(self)
Test inviting a user as invalid type of user i.e. type of invite_as is not in PreregistrationUser.INVITE_AS
Test inviting a user as invalid type of user i.e. type of invite_as is not in PreregistrationUser.INVITE_AS
def test_invite_user_as_invalid_type(self) -> None: """ Test inviting a user as invalid type of user i.e. type of invite_as is not in PreregistrationUser.INVITE_AS """ self.login("iago") invitee = self.nonreg_email("alice") response = self.invite(invitee, ["Denmar...
[ "def", "test_invite_user_as_invalid_type", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"iago\"", ")", "invitee", "=", "self", ".", "nonreg_email", "(", "\"alice\"", ")", "response", "=", "self", ".", "invite", "(", "invitee", ",", "["...
[ 1230, 4 ]
[ 1238, 84 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_successful_invite_user_with_name
(self)
A call to /json/invites with valid parameters causes an invitation email to be sent.
A call to /json/invites with valid parameters causes an invitation email to be sent.
def test_successful_invite_user_with_name(self) -> None: """ A call to /json/invites with valid parameters causes an invitation email to be sent. """ self.login("hamlet") email = "alice-test@zulip.com" invitee = f"Alice Test <{email}>" self.assert_json_suc...
[ "def", "test_successful_invite_user_with_name", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "email", "=", "\"alice-test@zulip.com\"", "invitee", "=", "f\"Alice Test <{email}>\"", "self", ".", "assert_json_success", "(", "self", ...
[ 1266, 4 ]
[ 1276, 66 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_successful_invite_user_with_name_and_normal_one
(self)
A call to /json/invites with valid parameters causes an invitation email to be sent.
A call to /json/invites with valid parameters causes an invitation email to be sent.
def test_successful_invite_user_with_name_and_normal_one(self) -> None: """ A call to /json/invites with valid parameters causes an invitation email to be sent. """ self.login("hamlet") email = "alice-test@zulip.com" email2 = "bob-test@zulip.com" invitee =...
[ "def", "test_successful_invite_user_with_name_and_normal_one", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "email", "=", "\"alice-test@zulip.com\"", "email2", "=", "\"bob-test@zulip.com\"", "invitee", "=", "f\"Alice Test <{email}>, {...
[ 1278, 4 ]
[ 1290, 74 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_others_to_realm_setting
(self)
The invite_to_realm_policy realm setting works properly.
The invite_to_realm_policy realm setting works properly.
def test_invite_others_to_realm_setting(self) -> None: """ The invite_to_realm_policy realm setting works properly. """ realm = get_realm("zulip") do_set_realm_property( realm, "invite_to_realm_policy", Realm.POLICY_ADMINS_ONLY, acting_user=None ) sel...
[ "def", "test_invite_others_to_realm_setting", "(", "self", ")", "->", "None", ":", "realm", "=", "get_realm", "(", "\"zulip\"", ")", "do_set_realm_property", "(", "realm", ",", "\"invite_to_realm_policy\"", ",", "Realm", ".", "POLICY_ADMINS_ONLY", ",", "acting_user", ...
[ 1299, 4 ]
[ 1390, 47 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_user_signup_initial_history
(self)
Test that a new user invited to a stream receives some initial history but only from public streams.
Test that a new user invited to a stream receives some initial history but only from public streams.
def test_invite_user_signup_initial_history(self) -> None: """ Test that a new user invited to a stream receives some initial history but only from public streams. """ self.login("hamlet") user_profile = self.example_user("hamlet") private_stream_name = "Secret" ...
[ "def", "test_invite_user_signup_initial_history", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "user_profile", "=", "self", ".", "example_user", "(", "\"hamlet\"", ")", "private_stream_name", "=", "\"Secret\"", "self", ".", ...
[ 1392, 4 ]
[ 1443, 85 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_multi_user_invite
(self)
Invites multiple users with a variety of delimiters.
Invites multiple users with a variety of delimiters.
def test_multi_user_invite(self) -> None: """ Invites multiple users with a variety of delimiters. """ self.login("hamlet") # Intentionally use a weird string. self.assert_json_success( self.invite( """bob-test@zulip.com, carol-test@zulip.c...
[ "def", "test_multi_user_invite", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "# Intentionally use a weird string.", "self", ".", "assert_json_success", "(", "self", ".", "invite", "(", "\"\"\"bob-test@zulip.com, carol-test@zuli...
[ 1445, 4 ]
[ 1470, 9 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_missing_or_invalid_params
(self)
Tests inviting with various missing or invalid parameters.
Tests inviting with various missing or invalid parameters.
def test_missing_or_invalid_params(self) -> None: """ Tests inviting with various missing or invalid parameters. """ realm = get_realm("zulip") do_set_realm_property(realm, "emails_restricted_to_domains", True, acting_user=None) self.login("hamlet") invitee_email...
[ "def", "test_missing_or_invalid_params", "(", "self", ")", "->", "None", ":", "realm", "=", "get_realm", "(", "\"zulip\"", ")", "do_set_realm_property", "(", "realm", ",", "\"emails_restricted_to_domains\"", ",", "True", ",", "acting_user", "=", "None", ")", "self...
[ 1495, 4 ]
[ 1519, 34 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_guest_user_invitation
(self)
Guest user can't invite new users
Guest user can't invite new users
def test_guest_user_invitation(self) -> None: """ Guest user can't invite new users """ self.login("polonius") invitee = "alice-test@zulip.com" self.assert_json_error(self.invite(invitee, ["Denmark"]), "Not allowed for guest users") self.assertEqual(find_key_by_em...
[ "def", "test_guest_user_invitation", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"polonius\"", ")", "invitee", "=", "\"alice-test@zulip.com\"", "self", ".", "assert_json_error", "(", "self", ".", "invite", "(", "invitee", ",", "[", "\"Den...
[ 1521, 4 ]
[ 1529, 34 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invalid_stream
(self)
Tests inviting to a non-existent stream.
Tests inviting to a non-existent stream.
def test_invalid_stream(self) -> None: """ Tests inviting to a non-existent stream. """ self.login("hamlet") self.assert_json_error( self.invite("iago-test@zulip.com", ["NotARealStream"]), f"Stream does not exist with id: {self.INVALID_STREAM_ID}. No invit...
[ "def", "test_invalid_stream", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "self", ".", "assert_json_error", "(", "self", ".", "invite", "(", "\"iago-test@zulip.com\"", ",", "[", "\"NotARealStream\"", "]", ")", ",", "f\"...
[ 1531, 4 ]
[ 1540, 34 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_existing_user
(self)
If you invite an address already using Zulip, no invitation is sent.
If you invite an address already using Zulip, no invitation is sent.
def test_invite_existing_user(self) -> None: """ If you invite an address already using Zulip, no invitation is sent. """ self.login("hamlet") hamlet_email = "hAmLeT@zUlIp.com" result = self.invite(hamlet_email, ["Denmark"]) self.assert_json_error(result, "We wer...
[ "def", "test_invite_existing_user", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "hamlet_email", "=", "\"hAmLeT@zUlIp.com\"", "result", "=", "self", ".", "invite", "(", "hamlet_email", ",", "[", "\"Denmark\"", "]", ")", ...
[ 1542, 4 ]
[ 1555, 34 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_links_in_name
(self)
If you invite an address already using Zulip, no invitation is sent.
If you invite an address already using Zulip, no invitation is sent.
def test_invite_links_in_name(self) -> None: """ If you invite an address already using Zulip, no invitation is sent. """ hamlet = self.example_user("hamlet") self.login_user(hamlet) # Test we properly handle links in user full names do_change_full_name(hamlet, "<...
[ "def", "test_invite_links_in_name", "(", "self", ")", "->", "None", ":", "hamlet", "=", "self", ".", "example_user", "(", "\"hamlet\"", ")", "self", ".", "login_user", "(", "hamlet", ")", "# Test we properly handle links in user full names", "do_change_full_name", "("...
[ 1561, 4 ]
[ 1584, 9 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_some_existing_some_new
(self)
If you invite a mix of already existing and new users, invitations are only sent to the new users.
If you invite a mix of already existing and new users, invitations are only sent to the new users.
def test_invite_some_existing_some_new(self) -> None: """ If you invite a mix of already existing and new users, invitations are only sent to the new users. """ self.login("hamlet") existing = [self.example_email("hamlet"), "othello@zulip.com"] new = ["foo-test@zu...
[ "def", "test_invite_some_existing_some_new", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "existing", "=", "[", "self", ".", "example_email", "(", "\"hamlet\"", ")", ",", "\"othello@zulip.com\"", "]", "new", "=", "[", "\...
[ 1590, 4 ]
[ 1618, 65 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_outside_domain_in_closed_realm
(self)
In a realm with `emails_restricted_to_domains = True`, you can't invite people with a different domain from that of the realm or your e-mail address.
In a realm with `emails_restricted_to_domains = True`, you can't invite people with a different domain from that of the realm or your e-mail address.
def test_invite_outside_domain_in_closed_realm(self) -> None: """ In a realm with `emails_restricted_to_domains = True`, you can't invite people with a different domain from that of the realm or your e-mail address. """ zulip_realm = get_realm("zulip") zulip_realm.emails_...
[ "def", "test_invite_outside_domain_in_closed_realm", "(", "self", ")", "->", "None", ":", "zulip_realm", "=", "get_realm", "(", "\"zulip\"", ")", "zulip_realm", ".", "emails_restricted_to_domains", "=", "True", "zulip_realm", ".", "save", "(", ")", "self", ".", "l...
[ 1620, 4 ]
[ 1635, 9 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_using_disposable_email
(self)
In a realm with `disallow_disposable_email_addresses = True`, you can't invite people with a disposable domain.
In a realm with `disallow_disposable_email_addresses = True`, you can't invite people with a disposable domain.
def test_invite_using_disposable_email(self) -> None: """ In a realm with `disallow_disposable_email_addresses = True`, you can't invite people with a disposable domain. """ zulip_realm = get_realm("zulip") zulip_realm.emails_restricted_to_domains = False zulip_re...
[ "def", "test_invite_using_disposable_email", "(", "self", ")", "->", "None", ":", "zulip_realm", "=", "get_realm", "(", "\"zulip\"", ")", "zulip_realm", ".", "emails_restricted_to_domains", "=", "False", "zulip_realm", ".", "disallow_disposable_email_addresses", "=", "T...
[ 1637, 4 ]
[ 1653, 9 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_outside_domain_in_open_realm
(self)
In a realm with `emails_restricted_to_domains = False`, you can invite people with a different domain from that of the realm or your e-mail address.
In a realm with `emails_restricted_to_domains = False`, you can invite people with a different domain from that of the realm or your e-mail address.
def test_invite_outside_domain_in_open_realm(self) -> None: """ In a realm with `emails_restricted_to_domains = False`, you can invite people with a different domain from that of the realm or your e-mail address. """ zulip_realm = get_realm("zulip") zulip_realm.emails_res...
[ "def", "test_invite_outside_domain_in_open_realm", "(", "self", ")", "->", "None", ":", "zulip_realm", "=", "get_realm", "(", "\"zulip\"", ")", "zulip_realm", ".", "emails_restricted_to_domains", "=", "False", "zulip_realm", ".", "save", "(", ")", "self", ".", "lo...
[ 1655, 4 ]
[ 1668, 50 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_outside_domain_before_closing
(self)
If you invite someone with a different domain from that of the realm when `emails_restricted_to_domains = False`, but `emails_restricted_to_domains` later changes to true, the invitation should succeed but the invitee's signup attempt should fail.
If you invite someone with a different domain from that of the realm when `emails_restricted_to_domains = False`, but `emails_restricted_to_domains` later changes to true, the invitation should succeed but the invitee's signup attempt should fail.
def test_invite_outside_domain_before_closing(self) -> None: """ If you invite someone with a different domain from that of the realm when `emails_restricted_to_domains = False`, but `emails_restricted_to_domains` later changes to true, the invitation should succeed but the invitee's sig...
[ "def", "test_invite_outside_domain_before_closing", "(", "self", ")", "->", "None", ":", "zulip_realm", "=", "get_realm", "(", "\"zulip\"", ")", "zulip_realm", ".", "emails_restricted_to_domains", "=", "False", "zulip_realm", ".", "save", "(", ")", "self", ".", "l...
[ 1670, 4 ]
[ 1692, 81 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_disposable_emails_before_closing
(self)
If you invite someone with a disposable email when `disallow_disposable_email_addresses = False`, but later changes to true, the invitation should succeed but the invitee's signup attempt should fail.
If you invite someone with a disposable email when `disallow_disposable_email_addresses = False`, but later changes to true, the invitation should succeed but the invitee's signup attempt should fail.
def test_disposable_emails_before_closing(self) -> None: """ If you invite someone with a disposable email when `disallow_disposable_email_addresses = False`, but later changes to true, the invitation should succeed but the invitee's signup attempt should fail. """ ...
[ "def", "test_disposable_emails_before_closing", "(", "self", ")", "->", "None", ":", "zulip_realm", "=", "get_realm", "(", "\"zulip\"", ")", "zulip_realm", ".", "emails_restricted_to_domains", "=", "False", "zulip_realm", ".", "disallow_disposable_email_addresses", "=", ...
[ 1694, 4 ]
[ 1717, 85 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_with_email_containing_plus_before_closing
(self)
If you invite someone with an email containing plus when `emails_restricted_to_domains = False`, but later change `emails_restricted_to_domains = True`, the invitation should succeed but the invitee's signup attempt should fail as users are not allowed to sign up using email con...
If you invite someone with an email containing plus when `emails_restricted_to_domains = False`, but later change `emails_restricted_to_domains = True`, the invitation should succeed but the invitee's signup attempt should fail as users are not allowed to sign up using email con...
def test_invite_with_email_containing_plus_before_closing(self) -> None: """ If you invite someone with an email containing plus when `emails_restricted_to_domains = False`, but later change `emails_restricted_to_domains = True`, the invitation should succeed but the invitee's si...
[ "def", "test_invite_with_email_containing_plus_before_closing", "(", "self", ")", "->", "None", ":", "zulip_realm", "=", "get_realm", "(", "\"zulip\"", ")", "zulip_realm", ".", "emails_restricted_to_domains", "=", "False", "zulip_realm", ".", "save", "(", ")", "self",...
[ 1719, 4 ]
[ 1745, 9 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_invite_with_non_ascii_streams
(self)
Inviting someone to streams with non-ASCII characters succeeds.
Inviting someone to streams with non-ASCII characters succeeds.
def test_invite_with_non_ascii_streams(self) -> None: """ Inviting someone to streams with non-ASCII characters succeeds. """ self.login("hamlet") invitee = "alice-test@zulip.com" stream_name = "hümbüǵ" # Make sure we're subscribed before inviting someone. ...
[ "def", "test_invite_with_non_ascii_streams", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "invitee", "=", "\"alice-test@zulip.com\"", "stream_name", "=", "\"hümbüǵ\"", "# Make sure we're subscribed before inviting someone.", "self", ...
[ 1764, 4 ]
[ 1776, 69 ]
python
en
['en', 'error', 'th']
False
InviteUserTest.test_confirmation_obj_not_exist_error
(self)
Since the key is a param input by the user to the registration endpoint, if it inserts an invalid value, the confirmation object won't be found. This tests if, in that scenario, we handle the exception by redirecting the user to the confirmation_link_expired_error page.
Since the key is a param input by the user to the registration endpoint, if it inserts an invalid value, the confirmation object won't be found. This tests if, in that scenario, we handle the exception by redirecting the user to the confirmation_link_expired_error page.
def test_confirmation_obj_not_exist_error(self) -> None: """Since the key is a param input by the user to the registration endpoint, if it inserts an invalid value, the confirmation object won't be found. This tests if, in that scenario, we handle the exception by redirecting the user to ...
[ "def", "test_confirmation_obj_not_exist_error", "(", "self", ")", "->", "None", ":", "email", "=", "self", ".", "nonreg_email", "(", "\"alice\"", ")", "password", "=", "\"password\"", "realm", "=", "get_realm", "(", "\"zulip\"", ")", "inviter", "=", "self", "....
[ 1950, 4 ]
[ 1981, 51 ]
python
en
['en', 'en', 'en']
True
InvitationsTestCase.test_successful_get_open_invitations
(self)
A GET call to /json/invites returns all unexpired invitations.
A GET call to /json/invites returns all unexpired invitations.
def test_successful_get_open_invitations(self) -> None: """ A GET call to /json/invites returns all unexpired invitations. """ realm = get_realm("zulip") days_to_activate = getattr(settings, "INVITATION_LINK_VALIDITY_DAYS", "Wrong") active_value = getattr(confirmation_set...
[ "def", "test_successful_get_open_invitations", "(", "self", ")", "->", "None", ":", "realm", "=", "get_realm", "(", "\"zulip\"", ")", "days_to_activate", "=", "getattr", "(", "settings", ",", "\"INVITATION_LINK_VALIDITY_DAYS\"", ",", "\"Wrong\"", ")", "active_value", ...
[ 2038, 4 ]
[ 2084, 69 ]
python
en
['en', 'error', 'th']
False
InvitationsTestCase.test_successful_delete_invitation
(self)
A DELETE call to /json/invites/<ID> should delete the invite and any scheduled invitation reminder emails.
A DELETE call to /json/invites/<ID> should delete the invite and any scheduled invitation reminder emails.
def test_successful_delete_invitation(self) -> None: """ A DELETE call to /json/invites/<ID> should delete the invite and any scheduled invitation reminder emails. """ self.login("iago") invitee = "DeleteMe@zulip.com" self.assert_json_success(self.invite(invitee,...
[ "def", "test_successful_delete_invitation", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"iago\"", ")", "invitee", "=", "\"DeleteMe@zulip.com\"", "self", ".", "assert_json_success", "(", "self", ".", "invite", "(", "invitee", ",", "[", "\"...
[ 2086, 4 ]
[ 2110, 9 ]
python
en
['en', 'error', 'th']
False
InvitationsTestCase.test_successful_member_delete_invitation
(self)
A DELETE call from member account to /json/invites/<ID> should delete the invite and any scheduled invitation reminder emails.
A DELETE call from member account to /json/invites/<ID> should delete the invite and any scheduled invitation reminder emails.
def test_successful_member_delete_invitation(self) -> None: """ A DELETE call from member account to /json/invites/<ID> should delete the invite and any scheduled invitation reminder emails. """ user_profile = self.example_user("hamlet") self.login_user(user_profile) ...
[ "def", "test_successful_member_delete_invitation", "(", "self", ")", "->", "None", ":", "user_profile", "=", "self", ".", "example_user", "(", "\"hamlet\"", ")", "self", ".", "login_user", "(", "user_profile", ")", "invitee", "=", "\"DeleteMe@zulip.com\"", "self", ...
[ 2112, 4 ]
[ 2148, 9 ]
python
en
['en', 'error', 'th']
False
InvitationsTestCase.test_delete_multiuse_invite
(self)
A DELETE call to /json/invites/multiuse<ID> should delete the multiuse_invite.
A DELETE call to /json/invites/multiuse<ID> should delete the multiuse_invite.
def test_delete_multiuse_invite(self) -> None: """ A DELETE call to /json/invites/multiuse<ID> should delete the multiuse_invite. """ self.login("iago") zulip_realm = get_realm("zulip") multiuse_invite = MultiuseInvite.objects.create( referred_by=self...
[ "def", "test_delete_multiuse_invite", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"iago\"", ")", "zulip_realm", "=", "get_realm", "(", "\"zulip\"", ")", "multiuse_invite", "=", "MultiuseInvite", ".", "objects", ".", "create", "(", "referr...
[ 2177, 4 ]
[ 2220, 66 ]
python
en
['en', 'error', 'th']
False
InvitationsTestCase.test_successful_resend_invitation
(self)
A POST call to /json/invites/<ID>/resend should send an invitation reminder email and delete any scheduled invitation reminder email.
A POST call to /json/invites/<ID>/resend should send an invitation reminder email and delete any scheduled invitation reminder email.
def test_successful_resend_invitation(self) -> None: """ A POST call to /json/invites/<ID>/resend should send an invitation reminder email and delete any scheduled invitation reminder email. """ self.login("iago") invitee = "resend_me@zulip.com" self.assert_json_...
[ "def", "test_successful_resend_invitation", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"iago\"", ")", "invitee", "=", "\"resend_me@zulip.com\"", "self", ".", "assert_json_success", "(", "self", ".", "invite", "(", "invitee", ",", "[", "\...
[ 2222, 4 ]
[ 2265, 67 ]
python
en
['en', 'error', 'th']
False
InvitationsTestCase.test_successful_member_resend_invitation
(self)
A POST call from member a account to /json/invites/<ID>/resend should send an invitation reminder email and delete any scheduled invitation reminder email if they send the invite.
A POST call from member a account to /json/invites/<ID>/resend should send an invitation reminder email and delete any scheduled invitation reminder email if they send the invite.
def test_successful_member_resend_invitation(self) -> None: """A POST call from member a account to /json/invites/<ID>/resend should send an invitation reminder email and delete any scheduled invitation reminder email if they send the invite. """ self.login("hamlet") user...
[ "def", "test_successful_member_resend_invitation", "(", "self", ")", "->", "None", ":", "self", ".", "login", "(", "\"hamlet\"", ")", "user_profile", "=", "self", ".", "example_user", "(", "\"hamlet\"", ")", "invitee", "=", "\"resend_me@zulip.com\"", "self", ".", ...
[ 2267, 4 ]
[ 2322, 85 ]
python
en
['en', 'en', 'en']
True
setup_hook
(config)
Filter config parsed from a setup.cfg to inject our defaults.
Filter config parsed from a setup.cfg to inject our defaults.
def setup_hook(config): """Filter config parsed from a setup.cfg to inject our defaults.""" # Tell distutils not to put the data_files in platform-specific # installation locations. See here for an explanation: # https://groups.google.com/forum/#!topic/comp.lang.python/Nex7L-026uw for scheme in inst...
[ "def", "setup_hook", "(", "config", ")", ":", "# Tell distutils not to put the data_files in platform-specific", "# installation locations. See here for an explanation:", "# https://groups.google.com/forum/#!topic/comp.lang.python/Nex7L-026uw", "for", "scheme", "in", "install", ".", "INS...
[ 19, 0 ]
[ 25, 42 ]
python
en
['en', 'en', 'en']
True
Resolver.__init__
(self, schema)
@param schema: A schema object. @type schema: L{xsd.schema.Schema}
def __init__(self, schema): """ @param schema: A schema object. @type schema: L{xsd.schema.Schema} """ self.schema = schema
[ "def", "__init__", "(", "self", ",", "schema", ")", ":", "self", ".", "schema", "=", "schema" ]
[ 38, 4 ]
[ 43, 28 ]
python
en
['en', 'error', 'th']
False
Resolver.find
(self, name, resolved=True)
Get the definition object for the schema object by name. @param name: The name of a schema object. @type name: basestring @param resolved: A flag indicating that the fully resolved type should be returned. @type resolved: boolean @return: The found schema I{t...
Get the definition object for the schema object by name.
def find(self, name, resolved=True): """ Get the definition object for the schema object by name. @param name: The name of a schema object. @type name: basestring @param resolved: A flag indicating that the fully resolved type should be returned. @type resolve...
[ "def", "find", "(", "self", ",", "name", ",", "resolved", "=", "True", ")", ":", "log", ".", "debug", "(", "'searching schema for (%s)'", ",", "name", ")", "qref", "=", "qualify", "(", "name", ",", "self", ".", "schema", ".", "root", ",", "self", "."...
[ 45, 4 ]
[ 66, 21 ]
python
en
['en', 'error', 'th']
False
PathResolver.__init__
(self, wsdl, ps='.')
@param wsdl: A schema object. @type wsdl: L{wsdl.Definitions} @param ps: The path separator character @type ps: char
def __init__(self, wsdl, ps='.'): """ @param wsdl: A schema object. @type wsdl: L{wsdl.Definitions} @param ps: The path separator character @type ps: char """ Resolver.__init__(self, wsdl.schema) self.wsdl = wsdl self.altp = re.compile('({)(.+)(})(...
[ "def", "__init__", "(", "self", ",", "wsdl", ",", "ps", "=", "'.'", ")", ":", "Resolver", ".", "__init__", "(", "self", ",", "wsdl", ".", "schema", ")", "self", ".", "wsdl", "=", "wsdl", "self", ".", "altp", "=", "re", ".", "compile", "(", "'({)(...
[ 77, 4 ]
[ 87, 58 ]
python
en
['en', 'error', 'th']
False
PathResolver.find
(self, path, resolved=True)
Get the definition object for the schema type located at the specified path. The path may contain (.) dot notation to specify nested types. Actually, the path separator is usually a (.) but can be redefined during contruction. @param path: A (.) separated path to a schema type. ...
Get the definition object for the schema type located at the specified path. The path may contain (.) dot notation to specify nested types. Actually, the path separator is usually a (.) but can be redefined during contruction.
def find(self, path, resolved=True): """ Get the definition object for the schema type located at the specified path. The path may contain (.) dot notation to specify nested types. Actually, the path separator is usually a (.) but can be redefined during contruction. @par...
[ "def", "find", "(", "self", ",", "path", ",", "resolved", "=", "True", ")", ":", "result", "=", "None", "parts", "=", "self", ".", "split", "(", "path", ")", "try", ":", "result", "=", "self", ".", "root", "(", "parts", ")", "if", "len", "(", "...
[ 89, 4 ]
[ 115, 21 ]
python
en
['en', 'error', 'th']
False
PathResolver.root
(self, parts)
Find the path root. @param parts: A list of path parts. @type parts: [str,..] @return: The root. @rtype: L{xsd.sxbase.SchemaObject}
Find the path root.
def root(self, parts): """ Find the path root. @param parts: A list of path parts. @type parts: [str,..] @return: The root. @rtype: L{xsd.sxbase.SchemaObject} """ result = None name = parts[0] log.debug('searching schema for (%s)', name) ...
[ "def", "root", "(", "self", ",", "parts", ")", ":", "result", "=", "None", "name", "=", "parts", "[", "0", "]", "log", ".", "debug", "(", "'searching schema for (%s)'", ",", "name", ")", "qref", "=", "self", ".", "qualify", "(", "parts", "[", "0", ...
[ 117, 4 ]
[ 136, 21 ]
python
en
['en', 'error', 'th']
False
PathResolver.branch
(self, root, parts)
Traverse the path until the leaf is reached. @param parts: A list of path parts. @type parts: [str,..] @param root: The root. @type root: L{xsd.sxbase.SchemaObject} @return: The end of the branch. @rtype: L{xsd.sxbase.SchemaObject}
Traverse the path until the leaf is reached.
def branch(self, root, parts): """ Traverse the path until the leaf is reached. @param parts: A list of path parts. @type parts: [str,..] @param root: The root. @type root: L{xsd.sxbase.SchemaObject} @return: The end of the branch. @rtype: L{xsd.sxbase.Sch...
[ "def", "branch", "(", "self", ",", "root", ",", "parts", ")", ":", "result", "=", "root", "for", "part", "in", "parts", "[", "1", ":", "-", "1", "]", ":", "name", "=", "splitPrefix", "(", "part", ")", "[", "1", "]", "log", ".", "debug", "(", ...
[ 138, 4 ]
[ 159, 21 ]
python
en
['en', 'error', 'th']
False
PathResolver.leaf
(self, parent, parts)
Find the leaf. @param parts: A list of path parts. @type parts: [str,..] @param parent: The leaf's parent. @type parent: L{xsd.sxbase.SchemaObject} @return: The leaf. @rtype: L{xsd.sxbase.SchemaObject}
Find the leaf.
def leaf(self, parent, parts): """ Find the leaf. @param parts: A list of path parts. @type parts: [str,..] @param parent: The leaf's parent. @type parent: L{xsd.sxbase.SchemaObject} @return: The leaf. @rtype: L{xsd.sxbase.SchemaObject} """ ...
[ "def", "leaf", "(", "self", ",", "parent", ",", "parts", ")", ":", "name", "=", "splitPrefix", "(", "parts", "[", "-", "1", "]", ")", "[", "1", "]", "if", "name", ".", "startswith", "(", "'@'", ")", ":", "result", ",", "path", "=", "parent", "....
[ 161, 4 ]
[ 178, 21 ]
python
en
['en', 'error', 'th']
False
PathResolver.qualify
(self, name)
Qualify the name as either: - plain name - ns prefixed name (eg: ns0:Person) - fully ns qualified name (eg: {http://myns-uri}Person) @param name: The name of an object in the schema. @type name: str @return: A qualifed name. @rtype: qname
Qualify the name as either: - plain name - ns prefixed name (eg: ns0:Person) - fully ns qualified name (eg: {http://myns-uri}Person)
def qualify(self, name): """ Qualify the name as either: - plain name - ns prefixed name (eg: ns0:Person) - fully ns qualified name (eg: {http://myns-uri}Person) @param name: The name of an object in the schema. @type name: str @return: A qualifed na...
[ "def", "qualify", "(", "self", ",", "name", ")", ":", "m", "=", "self", ".", "altp", ".", "match", "(", "name", ")", "if", "m", "is", "None", ":", "return", "qualify", "(", "name", ",", "self", ".", "wsdl", ".", "root", ",", "self", ".", "wsdl"...
[ 180, 4 ]
[ 195, 43 ]
python
en
['en', 'error', 'th']
False
PathResolver.split
(self, s)
Split the string on (.) while preserving any (.) inside the '{}' alternalte syntax for full ns qualification. @param s: A plain or qualifed name. @type s: str @return: A list of the name's parts. @rtype: [str,..]
Split the string on (.) while preserving any (.) inside the '{}' alternalte syntax for full ns qualification.
def split(self, s): """ Split the string on (.) while preserving any (.) inside the '{}' alternalte syntax for full ns qualification. @param s: A plain or qualifed name. @type s: str @return: A list of the name's parts. @rtype: [str,..] """ parts =...
[ "def", "split", "(", "self", ",", "s", ")", ":", "parts", "=", "[", "]", "b", "=", "0", "while", "1", ":", "m", "=", "self", ".", "splitp", ".", "match", "(", "s", ",", "b", ")", "if", "m", "is", "None", ":", "break", "b", ",", "e", "=", ...
[ 197, 4 ]
[ 215, 20 ]
python
en
['en', 'error', 'th']
False
TreeResolver.__init__
(self, schema)
@param schema: A schema object. @type schema: L{xsd.schema.Schema}
def __init__(self, schema): """ @param schema: A schema object. @type schema: L{xsd.schema.Schema} """ Resolver.__init__(self, schema) self.stack = Stack()
[ "def", "__init__", "(", "self", ",", "schema", ")", ":", "Resolver", ".", "__init__", "(", "self", ",", "schema", ")", "self", ".", "stack", "=", "Stack", "(", ")" ]
[ 230, 4 ]
[ 236, 28 ]
python
en
['en', 'error', 'th']
False
TreeResolver.reset
(self)
Reset the resolver's state.
Reset the resolver's state.
def reset(self): """ Reset the resolver's state. """ self.stack = Stack()
[ "def", "reset", "(", "self", ")", ":", "self", ".", "stack", "=", "Stack", "(", ")" ]
[ 238, 4 ]
[ 242, 28 ]
python
en
['en', 'error', 'th']
False
TreeResolver.push
(self, x)
Push an I{object} onto the stack. @param x: An object to push. @type x: L{Frame} @return: The pushed frame. @rtype: L{Frame}
Push an I{object} onto the stack.
def push(self, x): """ Push an I{object} onto the stack. @param x: An object to push. @type x: L{Frame} @return: The pushed frame. @rtype: L{Frame} """ if isinstance(x, Frame): frame = x else: frame = Frame(x) self.s...
[ "def", "push", "(", "self", ",", "x", ")", ":", "if", "isinstance", "(", "x", ",", "Frame", ")", ":", "frame", "=", "x", "else", ":", "frame", "=", "Frame", "(", "x", ")", "self", ".", "stack", ".", "append", "(", "frame", ")", "log", ".", "d...
[ 244, 4 ]
[ 258, 20 ]
python
en
['en', 'error', 'th']
False
TreeResolver.top
(self)
Get the I{frame} at the top of the stack. @return: The top I{frame}, else None. @rtype: L{Frame}
Get the I{frame} at the top of the stack.
def top(self): """ Get the I{frame} at the top of the stack. @return: The top I{frame}, else None. @rtype: L{Frame} """ if len(self.stack): return self.stack[-1] else: return Frame.Empty()
[ "def", "top", "(", "self", ")", ":", "if", "len", "(", "self", ".", "stack", ")", ":", "return", "self", ".", "stack", "[", "-", "1", "]", "else", ":", "return", "Frame", ".", "Empty", "(", ")" ]
[ 260, 4 ]
[ 269, 32 ]
python
en
['en', 'error', 'th']
False
TreeResolver.pop
(self)
Pop the frame at the top of the stack. @return: The popped frame, else None. @rtype: L{Frame}
Pop the frame at the top of the stack.
def pop(self): """ Pop the frame at the top of the stack. @return: The popped frame, else None. @rtype: L{Frame} """ if len(self.stack): popped = self.stack.pop() log.debug('pop: (%s)\n%s', Repr(popped), Repr(self.stack)) return p...
[ "def", "pop", "(", "self", ")", ":", "if", "len", "(", "self", ".", "stack", ")", ":", "popped", "=", "self", ".", "stack", ".", "pop", "(", ")", "log", ".", "debug", "(", "'pop: (%s)\\n%s'", ",", "Repr", "(", "popped", ")", ",", "Repr", "(", "...
[ 271, 4 ]
[ 283, 19 ]
python
en
['en', 'error', 'th']
False
TreeResolver.depth
(self)
Get the current stack depth. @return: The current stack depth. @rtype: int
Get the current stack depth.
def depth(self): """ Get the current stack depth. @return: The current stack depth. @rtype: int """ return len(self.stack)
[ "def", "depth", "(", "self", ")", ":", "return", "len", "(", "self", ".", "stack", ")" ]
[ 285, 4 ]
[ 291, 30 ]
python
en
['en', 'error', 'th']
False
TreeResolver.getchild
(self, name, parent)
get a child by name
get a child by name
def getchild(self, name, parent): """ get a child by name """ log.debug('searching parent (%s) for (%s)', Repr(parent), name) if name.startswith('@'): return parent.get_attribute(name[1:]) else: return parent.get_child(name)
[ "def", "getchild", "(", "self", ",", "name", ",", "parent", ")", ":", "log", ".", "debug", "(", "'searching parent (%s) for (%s)'", ",", "Repr", "(", "parent", ")", ",", "name", ")", "if", "name", ".", "startswith", "(", "'@'", ")", ":", "return", "par...
[ 293, 4 ]
[ 299, 41 ]
python
en
['en', 'en', 'en']
True
NodeResolver.__init__
(self, schema)
@param schema: A schema object. @type schema: L{xsd.schema.Schema}
def __init__(self, schema): """ @param schema: A schema object. @type schema: L{xsd.schema.Schema} """ TreeResolver.__init__(self, schema)
[ "def", "__init__", "(", "self", ",", "schema", ")", ":", "TreeResolver", ".", "__init__", "(", "self", ",", "schema", ")" ]
[ 310, 4 ]
[ 315, 43 ]
python
en
['en', 'error', 'th']
False
NodeResolver.find
(self, node, resolved=False, push=True)
@param node: An xml node to be resolved. @type node: L{sax.element.Element} @param resolved: A flag indicating that the fully resolved type should be returned. @type resolved: boolean @param push: Indicates that the resolved type should be pushed onto the...
def find(self, node, resolved=False, push=True): """ @param node: An xml node to be resolved. @type node: L{sax.element.Element} @param resolved: A flag indicating that the fully resolved type should be returned. @type resolved: boolean @param push: Indicates ...
[ "def", "find", "(", "self", ",", "node", ",", "resolved", "=", "False", ",", "push", "=", "True", ")", ":", "name", "=", "node", ".", "name", "parent", "=", "self", ".", "top", "(", ")", ".", "resolved", "if", "parent", "is", "None", ":", "result...
[ 317, 4 ]
[ 344, 21 ]
python
en
['en', 'error', 'th']
False
NodeResolver.findattr
(self, name, resolved=True)
Find an attribute type definition. @param name: An attribute name. @type name: basestring @param resolved: A flag indicating that the fully resolved type should be returned. @type resolved: boolean @return: The found schema I{type} @rtype: L{xsd.sxbas...
Find an attribute type definition.
def findattr(self, name, resolved=True): """ Find an attribute type definition. @param name: An attribute name. @type name: basestring @param resolved: A flag indicating that the fully resolved type should be returned. @type resolved: boolean @return: ...
[ "def", "findattr", "(", "self", ",", "name", ",", "resolved", "=", "True", ")", ":", "name", "=", "'@%s'", "%", "name", "parent", "=", "self", ".", "top", "(", ")", ".", "resolved", "if", "parent", "is", "None", ":", "result", ",", "ancestry", "=",...
[ 346, 4 ]
[ 367, 21 ]
python
en
['en', 'error', 'th']
False
NodeResolver.query
(self, name, node)
blindly query the schema by name
blindly query the schema by name
def query(self, name, node): """ blindly query the schema by name """ log.debug('searching schema for (%s)', name) qref = qualify(name, node, node.namespace()) query = BlindQuery(qref) result = query.execute(self.schema) return (result, [])
[ "def", "query", "(", "self", ",", "name", ",", "node", ")", ":", "log", ".", "debug", "(", "'searching schema for (%s)'", ",", "name", ")", "qref", "=", "qualify", "(", "name", ",", "node", ",", "node", ".", "namespace", "(", ")", ")", "query", "=", ...
[ 369, 4 ]
[ 375, 27 ]
python
en
['en', 'en', 'en']
True
NodeResolver.known
(self, node)
resolve type referenced by @xsi:type
resolve type referenced by
def known(self, node): """ resolve type referenced by @xsi:type """ ref = node.get('type', Namespace.xsins) if ref is None: return None qref = qualify(ref, node, node.namespace()) query = BlindQuery(qref) return query.execute(self.schema)
[ "def", "known", "(", "self", ",", "node", ")", ":", "ref", "=", "node", ".", "get", "(", "'type'", ",", "Namespace", ".", "xsins", ")", "if", "ref", "is", "None", ":", "return", "None", "qref", "=", "qualify", "(", "ref", ",", "node", ",", "node"...
[ 377, 4 ]
[ 384, 41 ]
python
en
['en', 'en', 'en']
True
GraphResolver.__init__
(self, schema)
@param schema: A schema object. @type schema: L{xsd.schema.Schema}
def __init__(self, schema): """ @param schema: A schema object. @type schema: L{xsd.schema.Schema} """ TreeResolver.__init__(self, schema)
[ "def", "__init__", "(", "self", ",", "schema", ")", ":", "TreeResolver", ".", "__init__", "(", "self", ",", "schema", ")" ]
[ 395, 4 ]
[ 400, 43 ]
python
en
['en', 'error', 'th']
False
GraphResolver.find
(self, name, object, resolved=False, push=True)
@param name: The name of the object to be resolved. @type name: basestring @param object: The name's value. @type object: (any|L{Object}) @param resolved: A flag indicating that the fully resolved type should be returned. @type resolved: boolean @par...
def find(self, name, object, resolved=False, push=True): """ @param name: The name of the object to be resolved. @type name: basestring @param object: The name's value. @type object: (any|L{Object}) @param resolved: A flag indicating that the fully resolved type ...
[ "def", "find", "(", "self", ",", "name", ",", "object", ",", "resolved", "=", "False", ",", "push", "=", "True", ")", ":", "known", "=", "None", "parent", "=", "self", ".", "top", "(", ")", ".", "resolved", "if", "parent", "is", "None", ":", "res...
[ 402, 4 ]
[ 435, 21 ]
python
en
['en', 'error', 'th']
False
GraphResolver.query
(self, name)
blindly query the schema by name
blindly query the schema by name
def query(self, name): """ blindly query the schema by name """ log.debug('searching schema for (%s)', name) schema = self.schema wsdl = self.wsdl() if wsdl is None: qref = qualify(name, schema.root, schema.tns) else: qref = qualify(name, wsdl.root...
[ "def", "query", "(", "self", ",", "name", ")", ":", "log", ".", "debug", "(", "'searching schema for (%s)'", ",", "name", ")", "schema", "=", "self", ".", "schema", "wsdl", "=", "self", ".", "wsdl", "(", ")", "if", "wsdl", "is", "None", ":", "qref", ...
[ 437, 4 ]
[ 448, 27 ]
python
en
['en', 'en', 'en']
True
GraphResolver.wsdl
(self)
get the wsdl
get the wsdl
def wsdl(self): """ get the wsdl """ container = self.schema.container if container is None: return None else: return container.wsdl
[ "def", "wsdl", "(", "self", ")", ":", "container", "=", "self", ".", "schema", ".", "container", "if", "container", "is", "None", ":", "return", "None", "else", ":", "return", "container", ".", "wsdl" ]
[ 450, 4 ]
[ 456, 33 ]
python
en
['en', 'en', 'en']
True
GraphResolver.known
(self, object)
get the type specified in the object's metadata
get the type specified in the object's metadata
def known(self, object): """ get the type specified in the object's metadata """ try: md = object.__metadata__ known = md.sxtype return known except: pass
[ "def", "known", "(", "self", ",", "object", ")", ":", "try", ":", "md", "=", "object", ".", "__metadata__", "known", "=", "md", ".", "sxtype", "return", "known", "except", ":", "pass" ]
[ 458, 4 ]
[ 465, 16 ]
python
en
['en', 'en', 'en']
True
breadcrumb_nav
(context)
A logic heavy function for automagically creating a breadcrumb. It uses the dashboard, panel group(if it exists), then current panel. Can also use a "custom_breadcrumb" context item to add extra items.
A logic heavy function for automagically creating a breadcrumb.
def breadcrumb_nav(context): """A logic heavy function for automagically creating a breadcrumb. It uses the dashboard, panel group(if it exists), then current panel. Can also use a "custom_breadcrumb" context item to add extra items. """ breadcrumb = [] dashboard = context.request.horizon['dash...
[ "def", "breadcrumb_nav", "(", "context", ")", ":", "breadcrumb", "=", "[", "]", "dashboard", "=", "context", ".", "request", ".", "horizon", "[", "'dashboard'", "]", "try", ":", "panel_groups", "=", "dashboard", ".", "get_panel_groups", "(", ")", "except", ...
[ 21, 0 ]
[ 60, 37 ]
python
en
['en', 'en', 'en']
True
add_bootstrap_class
(field)
Add a "form-control" CSS class to the field's widget. This is so that Bootstrap styles it properly.
Add a "form-control" CSS class to the field's widget.
def add_bootstrap_class(field): """Add a "form-control" CSS class to the field's widget. This is so that Bootstrap styles it properly. """ if not isinstance(field.field.widget, ( django.forms.widgets.CheckboxInput, django.forms.widgets.CheckboxSelectMultiple, django.forms.widget...
[ "def", "add_bootstrap_class", "(", "field", ")", ":", "if", "not", "isinstance", "(", "field", ".", "field", ".", "widget", ",", "(", "django", ".", "forms", ".", "widgets", ".", "CheckboxInput", ",", "django", ".", "forms", ".", "widgets", ".", "Checkbo...
[ 20, 0 ]
[ 35, 16 ]
python
en
['en', 'en', 'en']
True
cache
(request)
Return a cache object that can persist state between testing sessions. cache.get(key, default) cache.set(key, value) Keys must be a ``/`` separated value, where the first part is usually the name of your plugin or application to avoid clashes with other cache users. Values can be any object ...
Return a cache object that can persist state between testing sessions.
def cache(request): """ Return a cache object that can persist state between testing sessions. cache.get(key, default) cache.set(key, value) Keys must be a ``/`` separated value, where the first part is usually the name of your plugin or application to avoid clashes with other cache users. ...
[ "def", "cache", "(", "request", ")", ":", "return", "request", ".", "config", ".", "cache" ]
[ 205, 0 ]
[ 217, 31 ]
python
en
['en', 'error', 'th']
False
Cache.makedir
(self, name)
return a directory path object with the given name. If the directory does not yet exist, it will be created. You can use it to manage files likes e. g. store/retrieve database dumps across test sessions. :param name: must be a string not containing a ``/`` separator. Mak...
return a directory path object with the given name. If the directory does not yet exist, it will be created. You can use it to manage files likes e. g. store/retrieve database dumps across test sessions.
def makedir(self, name): """ return a directory path object with the given name. If the directory does not yet exist, it will be created. You can use it to manage files likes e. g. store/retrieve database dumps across test sessions. :param name: must be a string not containing...
[ "def", "makedir", "(", "self", ",", "name", ")", ":", "if", "_sep", "in", "name", "or", "_altsep", "is", "not", "None", "and", "_altsep", "in", "name", ":", "raise", "ValueError", "(", "\"name is not allowed to contain path separators\"", ")", "return", "self"...
[ 35, 4 ]
[ 47, 51 ]
python
en
['en', 'en', 'en']
True
Cache.get
(self, key, default)
return cached value for the given key. If no value was yet cached or the value cannot be read, the specified default is returned. :param key: must be a ``/`` separated value. Usually the first name is the name of your plugin or your application. :param default: must be pr...
return cached value for the given key. If no value was yet cached or the value cannot be read, the specified default is returned.
def get(self, key, default): """ return cached value for the given key. If no value was yet cached or the value cannot be read, the specified default is returned. :param key: must be a ``/`` separated value. Usually the first name is the name of your plugin or your applica...
[ "def", "get", "(", "self", ",", "key", ",", "default", ")", ":", "path", "=", "self", ".", "_getvaluepath", "(", "key", ")", "if", "path", ".", "check", "(", ")", ":", "try", ":", "with", "path", ".", "open", "(", "\"r\"", ")", "as", "f", ":", ...
[ 52, 4 ]
[ 70, 22 ]
python
en
['en', 'en', 'en']
True
Cache.set
(self, key, value)
save value for the given key. :param key: must be a ``/`` separated value. Usually the first name is the name of your plugin or your application. :param value: must be of any combination of basic python types, including nested types like e. g. lists of dictio...
save value for the given key.
def set(self, key, value): """ save value for the given key. :param key: must be a ``/`` separated value. Usually the first name is the name of your plugin or your application. :param value: must be of any combination of basic python types, including nested types ...
[ "def", "set", "(", "self", ",", "key", ",", "value", ")", ":", "path", "=", "self", ".", "_getvaluepath", "(", "key", ")", "try", ":", "path", ".", "dirpath", "(", ")", ".", "ensure_dir", "(", ")", "except", "(", "py", ".", "error", ".", "EEXIST"...
[ 72, 4 ]
[ 97, 61 ]
python
en
['en', 'en', 'en']
True
BaseRunnableResult.entities
(self)
Возвращает все сущности результата
Возвращает все сущности результата
def entities(self) -> List[Union[BaseError, 'BaseRunnableResult']]: """ Возвращает все сущности результата """ return self._entities
[ "def", "entities", "(", "self", ")", "->", "List", "[", "Union", "[", "BaseError", ",", "'BaseRunnableResult'", "]", "]", ":", "return", "self", ".", "_entities" ]
[ 23, 4 ]
[ 27, 29 ]
python
en
['en', 'error', 'th']
False
BaseRunnableResult.errors
(self)
Возвращает ошибки из результата. Т.к. в качестве сущностей могут выступать как ошибки, так и результаты выполнения запускаемых объектов, предусмотрен рекурсивный поиск ошибок.
Возвращает ошибки из результата. Т.к. в качестве сущностей могут выступать как ошибки, так и результаты выполнения запускаемых объектов, предусмотрен рекурсивный поиск ошибок.
def errors(self) -> List[BaseError]: """ Возвращает ошибки из результата. Т.к. в качестве сущностей могут выступать как ошибки, так и результаты выполнения запускаемых объектов, предусмотрен рекурсивный поиск ошибок. """ errors_list = [] for entity in self._entit...
[ "def", "errors", "(", "self", ")", "->", "List", "[", "BaseError", "]", ":", "errors_list", "=", "[", "]", "for", "entity", "in", "self", ".", "_entities", ":", "if", "isinstance", "(", "entity", ",", "BaseError", ")", ":", "errors_list", ".", "append"...
[ 30, 4 ]
[ 44, 26 ]
python
en
['en', 'error', 'th']
False
BaseRunnableResult.has_errors
(self)
Показывает, если ли в результате ошибки
Показывает, если ли в результате ошибки
def has_errors(self) -> bool: """ Показывает, если ли в результате ошибки """ return bool(self.errors)
[ "def", "has_errors", "(", "self", ")", "->", "bool", ":", "return", "bool", "(", "self", ".", "errors", ")" ]
[ 47, 4 ]
[ 51, 32 ]
python
en
['en', 'error', 'th']
False
BaseRunnableResult.has_not_errors
(self)
Показывает, нет ли в результате ошибок
Показывает, нет ли в результате ошибок
def has_not_errors(self) -> bool: """ Показывает, нет ли в результате ошибок """ return not bool(self.errors)
[ "def", "has_not_errors", "(", "self", ")", "->", "bool", ":", "return", "not", "bool", "(", "self", ".", "errors", ")" ]
[ 54, 4 ]
[ 58, 36 ]
python
en
['en', 'error', 'th']
False
BaseRunnableResult.append_entity
(self, entity: Union[BaseError, 'BaseRunnableResult'])
Добавление сущности в результат
Добавление сущности в результат
def append_entity(self, entity: Union[BaseError, 'BaseRunnableResult']): """ Добавление сущности в результат """ if entity not in self._entities: self._entities.append(entity)
[ "def", "append_entity", "(", "self", ",", "entity", ":", "Union", "[", "BaseError", ",", "'BaseRunnableResult'", "]", ")", ":", "if", "entity", "not", "in", "self", ".", "_entities", ":", "self", ".", "_entities", ".", "append", "(", "entity", ")" ]
[ 76, 4 ]
[ 81, 41 ]
python
en
['en', 'error', 'th']
False
bind_table_action
(action_name)
Decorator to bind table region method to an actual table action button. Many table actions when started (by clicking a corresponding button in UI) lead to some form showing up. To further interact with this form, a Python/ Selenium wrapper needs to be created for it. It is very convenient to return thi...
Decorator to bind table region method to an actual table action button.
def bind_table_action(action_name): """Decorator to bind table region method to an actual table action button. Many table actions when started (by clicking a corresponding button in UI) lead to some form showing up. To further interact with this form, a Python/ Selenium wrapper needs to be created for ...
[ "def", "bind_table_action", "(", "action_name", ")", ":", "_actions_locator", "=", "(", "by", ".", "By", ".", "CSS_SELECTOR", ",", "'div.table_actions > button, a'", ")", "def", "decorator", "(", "method", ")", ":", "@", "functools", ".", "wraps", "(", "method...
[ 227, 0 ]
[ 261, 20 ]
python
en
['en', 'en', 'en']
True
bind_row_action
(action_name)
A decorator to bind table region method to an actual row action button. Many table actions when started (by clicking a corresponding button in UI) lead to some form showing up. To further interact with this form, a Python/ Selenium wrapper needs to be created for it. It is very convenient to return thi...
A decorator to bind table region method to an actual row action button.
def bind_row_action(action_name): """A decorator to bind table region method to an actual row action button. Many table actions when started (by clicking a corresponding button in UI) lead to some form showing up. To further interact with this form, a Python/ Selenium wrapper needs to be created for it...
[ "def", "bind_row_action", "(", "action_name", ")", ":", "# NOTE(tsufiev): button tag could be either <a> or <button> - target", "# both with *. Also primary action could be single as well, do not use", "# .btn-group because of that", "primary_action_locator", "=", "(", "by", ".", "By", ...
[ 264, 0 ]
[ 318, 20 ]
python
en
['en', 'en', 'en']
True
bind_row_anchor_column
(column_name)
A decorator to bind table region method to a anchor in a column. Typical examples of such tables are Project -> Compute -> Images, Admin -> System -> Flavors, Project -> Compute -> Instancies. The method can be used to follow the link in the anchor by the click.
A decorator to bind table region method to a anchor in a column.
def bind_row_anchor_column(column_name): """A decorator to bind table region method to a anchor in a column. Typical examples of such tables are Project -> Compute -> Images, Admin -> System -> Flavors, Project -> Compute -> Instancies. The method can be used to follow the link in the anchor by the cli...
[ "def", "bind_row_anchor_column", "(", "column_name", ")", ":", "def", "decorator", "(", "method", ")", ":", "@", "functools", ".", "wraps", "(", "method", ")", "def", "wrapper", "(", "table", ",", "row", ")", ":", "cell", "=", "row", ".", "cells", "[",...
[ 321, 0 ]
[ 338, 20 ]
python
en
['en', 'en', 'en']
True
TableRegion.get_row
(self, column_name, text, exact_match=True)
Get row that contains specified text in specified column. In case exact_match is set to True, text contained in row must equal searched text, otherwise occurrence of searched text in the column text will result in row match.
Get row that contains specified text in specified column.
def get_row(self, column_name, text, exact_match=True): """Get row that contains specified text in specified column. In case exact_match is set to True, text contained in row must equal searched text, otherwise occurrence of searched text in the column text will result in row match. ...
[ "def", "get_row", "(", "self", ",", "column_name", ",", "text", ",", "exact_match", "=", "True", ")", ":", "def", "get_text", "(", "element", ")", ":", "text", "=", "element", ".", "get_attribute", "(", "'data-selenium'", ")", "return", "text", "or", "el...
[ 116, 4 ]
[ 137, 19 ]
python
en
['en', 'en', 'en']
True
TableRegion.assert_definition
(self, expected_table_definition, sorting=False)
Checks that actual table is expected one. Items to compare: 'next' and 'prev' links, count of rows and names of elements in list :param expected_table_definition: expected values (dictionary) :param sorting: boolean arg specifying whether to sort actual names :return:
Checks that actual table is expected one.
def assert_definition(self, expected_table_definition, sorting=False): """Checks that actual table is expected one. Items to compare: 'next' and 'prev' links, count of rows and names of elements in list :param expected_table_definition: expected values (dictionary) :param sortin...
[ "def", "assert_definition", "(", "self", ",", "expected_table_definition", ",", "sorting", "=", "False", ")", ":", "names", "=", "[", "row", ".", "cells", "[", "'Name'", "]", ".", "text", "for", "row", "in", "self", ".", "rows", "]", "if", "sorting", "...
[ 208, 4 ]
[ 224, 69 ]
python
en
['en', 'en', 'en']
True
BuildEnvironment.check_requirements
(self, reqs)
Return 2 sets: - conflicting requirements: set of (installed, wanted) reqs tuples - missing requirements: set of reqs
Return 2 sets: - conflicting requirements: set of (installed, wanted) reqs tuples - missing requirements: set of reqs
def check_requirements(self, reqs): # type: (Iterable[str]) -> Tuple[Set[Tuple[str, str]], Set[str]] """Return 2 sets: - conflicting requirements: set of (installed, wanted) reqs tuples - missing requirements: set of reqs """ missing = set() conflicting = ...
[ "def", "check_requirements", "(", "self", ",", "reqs", ")", ":", "# type: (Iterable[str]) -> Tuple[Set[Tuple[str, str]], Set[str]]", "missing", "=", "set", "(", ")", "conflicting", "=", "set", "(", ")", "if", "reqs", ":", "ws", "=", "WorkingSet", "(", "self", "....
[ 141, 4 ]
[ 158, 35 ]
python
en
['en', 'da', 'en']
True
I2C.__init__
(self, bus_id=1)
Initialize the I2C bus.
Initialize the I2C bus.
def __init__(self, bus_id=1): """ Initialize the I2C bus. """ self._i2c = SMBus(bus_id)
[ "def", "__init__", "(", "self", ",", "bus_id", "=", "1", ")", ":", "self", ".", "_i2c", "=", "SMBus", "(", "bus_id", ")" ]
[ 13, 4 ]
[ 15, 33 ]
python
en
['en', 'en', 'en']
True
I2C.__del__
(self)
Clean up.
Clean up.
def __del__(self): """ Clean up. """ try: del(self._i2c) except: pass
[ "def", "__del__", "(", "self", ")", ":", "try", ":", "del", "(", "self", ".", "_i2c", ")", "except", ":", "pass" ]
[ 17, 4 ]
[ 22, 16 ]
python
en
['de', 'en', 'en']
False
I2C.write_register
(self, address, register, value)
Write a single byte to a I2C register. Return the value the register had before the write.
Write a single byte to a I2C register. Return the value the register had before the write.
def write_register(self, address, register, value): """ Write a single byte to a I2C register. Return the value the register had before the write. """ value_old = self.read_register(address, register) self._i2c.write_byte_data(address, register, value) return value_ol...
[ "def", "write_register", "(", "self", ",", "address", ",", "register", ",", "value", ")", ":", "value_old", "=", "self", ".", "read_register", "(", "address", ",", "register", ")", "self", ".", "_i2c", ".", "write_byte_data", "(", "address", ",", "register...
[ 24, 4 ]
[ 30, 24 ]
python
en
['en', 'en', 'en']
True
I2C.read_register
(self, address, register)
Read a single I2C register.
Read a single I2C register.
def read_register(self, address, register): """ Read a single I2C register. """ return self._i2c.read_byte_data(address, register)
[ "def", "read_register", "(", "self", ",", "address", ",", "register", ")", ":", "return", "self", ".", "_i2c", ".", "read_byte_data", "(", "address", ",", "register", ")" ]
[ 32, 4 ]
[ 34, 58 ]
python
en
['en', 'ca', 'en']
True
I2C.combine_lo_hi
(self, lo_byte, hi_byte)
Combine low and high bytes to an unsigned 16 bit value.
Combine low and high bytes to an unsigned 16 bit value.
def combine_lo_hi(self, lo_byte, hi_byte): """ Combine low and high bytes to an unsigned 16 bit value. """ return (hi_byte << 8) | lo_byte
[ "def", "combine_lo_hi", "(", "self", ",", "lo_byte", ",", "hi_byte", ")", ":", "return", "(", "hi_byte", "<<", "8", ")", "|", "lo_byte" ]
[ 36, 4 ]
[ 38, 39 ]
python
en
['en', 'en', 'en']
True
I2C.combine_signed_lo_hi
(self, lo_byte, hi_byte)
Combine low and high bytes to a signed 16 bit value.
Combine low and high bytes to a signed 16 bit value.
def combine_signed_lo_hi(self, lo_byte, hi_byte): """ Combine low and high bytes to a signed 16 bit value. """ combined = self.combine_lo_hi(lo_byte, hi_byte) return combined if combined < 32768 else (combined - 65536)
[ "def", "combine_signed_lo_hi", "(", "self", ",", "lo_byte", ",", "hi_byte", ")", ":", "combined", "=", "self", ".", "combine_lo_hi", "(", "lo_byte", ",", "hi_byte", ")", "return", "combined", "if", "combined", "<", "32768", "else", "(", "combined", "-", "6...
[ 40, 4 ]
[ 43, 67 ]
python
en
['en', 'en', 'en']
True
I2C.combine_xlo_lo_hi
(self, xlo_byte, lo_byte, hi_byte)
Combine extra low, low, and high bytes to an unsigned 24 bit value.
Combine extra low, low, and high bytes to an unsigned 24 bit value.
def combine_xlo_lo_hi(self, xlo_byte, lo_byte, hi_byte): """ Combine extra low, low, and high bytes to an unsigned 24 bit value. """ return (xlo_byte | lo_byte << 8 | hi_byte << 16)
[ "def", "combine_xlo_lo_hi", "(", "self", ",", "xlo_byte", ",", "lo_byte", ",", "hi_byte", ")", ":", "return", "(", "xlo_byte", "|", "lo_byte", "<<", "8", "|", "hi_byte", "<<", "16", ")" ]
[ 45, 4 ]
[ 49, 56 ]
python
en
['en', 'en', 'en']
True
I2C.combine_signed_xlo_lo_hi
(self, xlo_byte, lo_byte, hi_byte)
Combine extra low, low, and high bytes to a signed 24 bit value.
Combine extra low, low, and high bytes to a signed 24 bit value.
def combine_signed_xlo_lo_hi(self, xlo_byte, lo_byte, hi_byte): """ Combine extra low, low, and high bytes to a signed 24 bit value. """ combined = self.combine_xlo_lo_hi(xlo_byte, lo_byte, hi_byte) return combined if combined < 8388608 else (combined - 16777216)
[ "def", "combine_signed_xlo_lo_hi", "(", "self", ",", "xlo_byte", ",", "lo_byte", ",", "hi_byte", ")", ":", "combined", "=", "self", ".", "combine_xlo_lo_hi", "(", "xlo_byte", ",", "lo_byte", ",", "hi_byte", ")", "return", "combined", "if", "combined", "<", "...
[ 51, 4 ]
[ 54, 72 ]
python
en
['en', 'en', 'en']
True
I2C.read_1d_sensor
(self, address, registers)
Return a vector with the combined raw signed 24 bit values of the output registers of a 1d sensor.
Return a vector with the combined raw signed 24 bit values of the output registers of a 1d sensor.
def read_1d_sensor(self, address, registers): """ Return a vector with the combined raw signed 24 bit values of the output registers of a 1d sensor. """ xlo_byte = self.read_register(address, registers[0]) lo_byte = self.read_register(address, registers[1]) hi_byte =...
[ "def", "read_1d_sensor", "(", "self", ",", "address", ",", "registers", ")", ":", "xlo_byte", "=", "self", ".", "read_register", "(", "address", ",", "registers", "[", "0", "]", ")", "lo_byte", "=", "self", ".", "read_register", "(", "address", ",", "reg...
[ 56, 4 ]
[ 65, 72 ]
python
en
['en', 'en', 'en']
True
I2C.read_3d_sensor
(self, address, registers)
Return a vector with the combined raw signed 16 bit values of the output registers of a 3d sensor.
Return a vector with the combined raw signed 16 bit values of the output registers of a 3d sensor.
def read_3d_sensor(self, address, registers): """ Return a vector with the combined raw signed 16 bit values of the output registers of a 3d sensor. """ # Read register outputs and combine low and high byte values x_low = self.read_register(address, registers[0]) x_h...
[ "def", "read_3d_sensor", "(", "self", ",", "address", ",", "registers", ")", ":", "# Read register outputs and combine low and high byte values", "x_low", "=", "self", ".", "read_register", "(", "address", ",", "registers", "[", "0", "]", ")", "x_hi", "=", "self",...
[ 67, 4 ]
[ 84, 36 ]
python
en
['en', 'en', 'en']
True
clone
(old)
Returns a copy of an object.
Returns a copy of an object.
def clone(old): """Returns a copy of an object. """ new_kwargs = dict([(fld.name, getattr(old, fld.name)) for fld in old._meta.fields if not isinstance(fld, JeevesForeignKey)]) ans = old.__class__(**new_kwargs) for fld in old._meta.fields: if isins...
[ "def", "clone", "(", "old", ")", ":", "new_kwargs", "=", "dict", "(", "[", "(", "fld", ".", "name", ",", "getattr", "(", "old", ",", "fld", ".", "name", ")", ")", "for", "fld", "in", "old", ".", "_meta", ".", "fields", "if", "not", "isinstance", ...
[ 251, 0 ]
[ 261, 14 ]
python
en
['en', 'en', 'en']
True
get_one_differing_var
(vars1, vars2)
Checks to see if two sets of variables have one differing one??
Checks to see if two sets of variables have one differing one??
def get_one_differing_var(vars1, vars2): """Checks to see if two sets of variables have one differing one?? """ if len(vars1) != len(vars2): return None ans = None for var in vars1: if var in vars2: if vars1[var] != vars2[var]: if ans is None: ...
[ "def", "get_one_differing_var", "(", "vars1", ",", "vars2", ")", ":", "if", "len", "(", "vars1", ")", "!=", "len", "(", "vars2", ")", ":", "return", "None", "ans", "=", "None", "for", "var", "in", "vars1", ":", "if", "var", "in", "vars2", ":", "if"...
[ 288, 0 ]
[ 303, 14 ]
python
en
['en', 'en', 'en']
True
label_for
(*field_names)
The decorator for associating a label with a field.
The decorator for associating a label with a field.
def label_for(*field_names): """The decorator for associating a label with a field. """ def decorator(field): """Definition of the decorator itself. """ field._jeeves_label_for = field_names return field return decorator
[ "def", "label_for", "(", "*", "field_names", ")", ":", "def", "decorator", "(", "field", ")", ":", "\"\"\"Definition of the decorator itself.\n \"\"\"", "field", ".", "_jeeves_label_for", "=", "field_names", "return", "field", "return", "decorator" ]
[ 305, 0 ]
[ 313, 20 ]
python
en
['en', 'en', 'en']
True
evil_hack
(self, other)
Hack __eq__ that checks equality if we have FExprs and checks object ID equality otherwise.
Hack __eq__ that checks equality if we have FExprs and checks object ID equality otherwise.
def evil_hack(self, other): """Hack __eq__ that checks equality if we have FExprs and checks object ID equality otherwise. """ if isinstance(other, FExpr): return other == self return isinstance(other, self.__class__) and self.id == other.id
[ "def", "evil_hack", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "FExpr", ")", ":", "return", "other", "==", "self", "return", "isinstance", "(", "other", ",", "self", ".", "__class__", ")", "and", "self", ".", "id", "=...
[ 553, 0 ]
[ 559, 68 ]
python
en
['en', 'en', 'en']
True
JeevesQuerySet.get_jiter
(self)
Creates an iterator for the QuerySet. Returns a list (object, conditions) of rows and their conditions.
Creates an iterator for the QuerySet. Returns a list (object, conditions) of rows and their conditions.
def get_jiter(self): """Creates an iterator for the QuerySet. Returns a list (object, conditions) of rows and their conditions. """ self._fetch_all() def acquire_label_by_name(app_label, label_name, obj=None): """Gets a label by name. """ i...
[ "def", "get_jiter", "(", "self", ")", ":", "self", ".", "_fetch_all", "(", ")", "def", "acquire_label_by_name", "(", "app_label", ",", "label_name", ",", "obj", "=", "None", ")", ":", "\"\"\"Gets a label by name.\n \"\"\"", "if", "JeevesLib", ".", "do...
[ 22, 4 ]
[ 87, 22 ]
python
en
['en', 'en', 'en']
True
JeevesQuerySet.get
(self, use_base_env=False, **kwargs)
Fetches a JList of rows that match the conditions.
Fetches a JList of rows that match the conditions.
def get(self, use_base_env=False, **kwargs): """Fetches a JList of rows that match the conditions. """ matches = self.filter(**kwargs).get_jiter() if len(matches) == 0: return None for (row, _) in matches: if row.jeeves_id != matches[0][0].jeeves_id: ...
[ "def", "get", "(", "self", ",", "use_base_env", "=", "False", ",", "*", "*", "kwargs", ")", ":", "matches", "=", "self", ".", "filter", "(", "*", "*", "kwargs", ")", ".", "get_jiter", "(", ")", "if", "len", "(", "matches", ")", "==", "0", ":", ...
[ 89, 4 ]
[ 132, 58 ]
python
en
['en', 'en', 'en']
True
JeevesQuerySet.filter
(self, **kwargs)
Jelf implementation of filter.
Jelf implementation of filter.
def filter(self, **kwargs): """Jelf implementation of filter. """ related_names = [] for argname, _ in kwargs.iteritems(): related_name = argname.split('__') if len(related_name) > 1: related_names.append("__".join(related_name[:-1])) if le...
[ "def", "filter", "(", "self", ",", "*", "*", "kwargs", ")", ":", "related_names", "=", "[", "]", "for", "argname", ",", "_", "in", "kwargs", ".", "iteritems", "(", ")", ":", "related_name", "=", "argname", ".", "split", "(", "'__'", ")", "if", "len...
[ 134, 4 ]
[ 147, 63 ]
python
en
['en', 'da', 'en']
True
JeevesModel.do_delete
(self, vars_env)
A helper for delete?
A helper for delete?
def do_delete(self, vars_env): """A helper for delete? """ if len(vars_env) == 0: delete_query = self.__class__._objects_ordinary.filter( jeeves_id=self.jeeves_id) delete_query.delete() else: filter_query = self.__class__._o...
[ "def", "do_delete", "(", "self", ",", "vars_env", ")", ":", "if", "len", "(", "vars_env", ")", "==", "0", ":", "delete_query", "=", "self", ".", "__class__", ".", "_objects_ordinary", ".", "filter", "(", "jeeves_id", "=", "self", ".", "jeeves_id", ")", ...
[ 366, 4 ]
[ 396, 58 ]
python
da
['da', 'it', 'en']
False
JeevesModel.save
(self, *args, **kw)
Saves elements with the appropriate faceted labels.
Saves elements with the appropriate faceted labels.
def save(self, *args, **kw): """Saves elements with the appropriate faceted labels. """ def full_eval(val, env): """Evaluating a value in the context of an environment. """ eval_expr = val.partialEval(env) return eval_expr.v # TODO: OMG wh...
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "def", "full_eval", "(", "val", ",", "env", ")", ":", "\"\"\"Evaluating a value in the context of an environment.\n \"\"\"", "eval_expr", "=", "val", ".", "partialEval", "(",...
[ 412, 4 ]
[ 500, 61 ]
python
en
['en', 'en', 'en']
True
JeevesRelatedObjectDescriptor.get_cache
(self, instance)
Gets the... cache?
Gets the... cache?
def get_cache(self, instance): """Gets the... cache? """ cache_attr_name = self.cache_name if hasattr(instance, cache_attr_name): cache = getattr(instance, cache_attr_name) if not isinstance(cache, dict): jid = getattr(instance, self.field.get_attn...
[ "def", "get_cache", "(", "self", ",", "instance", ")", ":", "cache_attr_name", "=", "self", ".", "cache_name", "if", "hasattr", "(", "instance", ",", "cache_attr_name", ")", ":", "cache", "=", "getattr", "(", "instance", ",", "cache_attr_name", ")", "if", ...
[ 571, 4 ]
[ 585, 20 ]
python
en
['en', 'en', 'en']
True
JeevesRelatedObjectDescriptor.__get__
(self, instance, instance_type)
??
??
def __get__(self, instance, instance_type): """?? """ if instance is None: return self cache = self.get_cache(instance) def get_obj(jeeves_id): """?? """ if jeeves_id is None: return None if jeeves_id no...
[ "def", "__get__", "(", "self", ",", "instance", ",", "instance_type", ")", ":", "if", "instance", "is", "None", ":", "return", "self", "cache", "=", "self", ".", "get_cache", "(", "instance", ")", "def", "get_obj", "(", "jeeves_id", ")", ":", "\"\"\"??\n...
[ 588, 4 ]
[ 608, 74 ]
python
en
['en', 'ja', 'hi']
False
slack_workspace_to_realm
( domain_name: str, realm_id: int, user_list: List[ZerverFieldsT], realm_subdomain: str, slack_data_dir: str, custom_emoji_list: ZerverFieldsT, )
Returns: 1. realm, converted realm data 2. slack_user_id_to_zulip_user_id, which is a dictionary to map from Slack user id to Zulip user id 3. slack_recipient_name_to_zulip_recipient_id, which is a dictionary to map from Slack recipient name(channel names, mpim names, usernames, etc) to Zulip re...
Returns: 1. realm, converted realm data 2. slack_user_id_to_zulip_user_id, which is a dictionary to map from Slack user id to Zulip user id 3. slack_recipient_name_to_zulip_recipient_id, which is a dictionary to map from Slack recipient name(channel names, mpim names, usernames, etc) to Zulip re...
def slack_workspace_to_realm( domain_name: str, realm_id: int, user_list: List[ZerverFieldsT], realm_subdomain: str, slack_data_dir: str, custom_emoji_list: ZerverFieldsT, ) -> Tuple[ ZerverFieldsT, SlackToZulipUserIDT, SlackToZulipRecipientT, AddedChannelsT, AddedMPIMsT, ...
[ "def", "slack_workspace_to_realm", "(", "domain_name", ":", "str", ",", "realm_id", ":", "int", ",", "user_list", ":", "List", "[", "ZerverFieldsT", "]", ",", "realm_subdomain", ":", "str", ",", "slack_data_dir", ":", "str", ",", "custom_emoji_list", ":", "Zer...
[ 64, 0 ]
[ 134, 5 ]
python
en
['en', 'error', 'th']
False
users_to_zerver_userprofile
( slack_data_dir: str, users: List[ZerverFieldsT], realm_id: int, timestamp: Any, domain_name: str )
Returns: 1. zerver_userprofile, which is a list of user profile 2. avatar_list, which is list to map avatars to Zulip avatard records.json 3. slack_user_id_to_zulip_user_id, which is a dictionary to map from Slack user ID to Zulip user id 4. zerver_customprofilefield, which is a list of all ...
Returns: 1. zerver_userprofile, which is a list of user profile 2. avatar_list, which is list to map avatars to Zulip avatard records.json 3. slack_user_id_to_zulip_user_id, which is a dictionary to map from Slack user ID to Zulip user id 4. zerver_customprofilefield, which is a list of all ...
def users_to_zerver_userprofile( slack_data_dir: str, users: List[ZerverFieldsT], realm_id: int, timestamp: Any, domain_name: str ) -> Tuple[ List[ZerverFieldsT], List[ZerverFieldsT], SlackToZulipUserIDT, List[ZerverFieldsT], List[ZerverFieldsT], ]: """ Returns: 1. zerver_userprofile...
[ "def", "users_to_zerver_userprofile", "(", "slack_data_dir", ":", "str", ",", "users", ":", "List", "[", "ZerverFieldsT", "]", ",", "realm_id", ":", "int", ",", "timestamp", ":", "Any", ",", "domain_name", ":", "str", ")", "->", "Tuple", "[", "List", "[", ...
[ 161, 0 ]
[ 279, 5 ]
python
en
['en', 'error', 'th']
False
channels_to_zerver_stream
( slack_data_dir: str, realm_id: int, realm: Dict[str, Any], slack_user_id_to_zulip_user_id: SlackToZulipUserIDT, zerver_userprofile: List[ZerverFieldsT], )
Returns: 1. realm, converted realm data 2. added_channels, which is a dictionary to map from channel name to channel id, Zulip stream_id 3. added_mpims, which is a dictionary to map from MPIM(multiparty IM) name to MPIM id, Zulip huddle_id 4. dm_members, which is a dictionary to map from DM id to t...
Returns: 1. realm, converted realm data 2. added_channels, which is a dictionary to map from channel name to channel id, Zulip stream_id 3. added_mpims, which is a dictionary to map from MPIM(multiparty IM) name to MPIM id, Zulip huddle_id 4. dm_members, which is a dictionary to map from DM id to t...
def channels_to_zerver_stream( slack_data_dir: str, realm_id: int, realm: Dict[str, Any], slack_user_id_to_zulip_user_id: SlackToZulipUserIDT, zerver_userprofile: List[ZerverFieldsT], ) -> Tuple[ Dict[str, List[ZerverFieldsT]], AddedChannelsT, AddedMPIMsT, DMMembersT, SlackToZulipRecipientT ]: ...
[ "def", "channels_to_zerver_stream", "(", "slack_data_dir", ":", "str", ",", "realm_id", ":", "int", ",", "realm", ":", "Dict", "[", "str", ",", "Any", "]", ",", "slack_user_id_to_zulip_user_id", ":", "SlackToZulipUserIDT", ",", "zerver_userprofile", ":", "List", ...
[ 417, 0 ]
[ 585, 5 ]
python
en
['en', 'error', 'th']
False