body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def _datetime_object_to_rfc_date_str(datetime_obj): ' Returns a date string to the RFC 3339 standard ' return datetime_obj.strftime(_RFC3339_DATE_FORMAT)
-6,955,022,055,545,367,000
Returns a date string to the RFC 3339 standard
precisionmapper/__init__.py
_datetime_object_to_rfc_date_str
tducret/precisionmapper-python
python
def _datetime_object_to_rfc_date_str(datetime_obj): ' ' return datetime_obj.strftime(_RFC3339_DATE_FORMAT)
def _rfc_date_str_to_datetime_object(rfc_date_str): ' Returns a date string to the RFC 3339 standard ' return datetime.strptime(rfc_date_str, _RFC3339_DATE_FORMAT)
-4,682,690,617,751,041,000
Returns a date string to the RFC 3339 standard
precisionmapper/__init__.py
_rfc_date_str_to_datetime_object
tducret/precisionmapper-python
python
def _rfc_date_str_to_datetime_object(rfc_date_str): ' ' return datetime.strptime(rfc_date_str, _RFC3339_DATE_FORMAT)
def _datetime_object_to_short_date_str(datetime_obj): ' Returns a short date string ' return datetime_obj.strftime(_SHORT_DATE_FORMAT)
4,117,565,389,665,448,000
Returns a short date string
precisionmapper/__init__.py
_datetime_object_to_short_date_str
tducret/precisionmapper-python
python
def _datetime_object_to_short_date_str(datetime_obj): ' ' return datetime_obj.strftime(_SHORT_DATE_FORMAT)
def get_authenticity_token(self, url=_SIGNIN_URL): ' Returns an authenticity_token, mandatory for signing in ' res = self.client._get(url=url, expected_status_code=200) soup = BeautifulSoup(res.text, _DEFAULT_BEAUTIFULSOUP_PARSER) selection = soup.select(_AUTHENTICITY_TOKEN_SELECTOR) try: au...
2,306,949,847,597,205,500
Returns an authenticity_token, mandatory for signing in
precisionmapper/__init__.py
get_authenticity_token
tducret/precisionmapper-python
python
def get_authenticity_token(self, url=_SIGNIN_URL): ' ' res = self.client._get(url=url, expected_status_code=200) soup = BeautifulSoup(res.text, _DEFAULT_BEAUTIFULSOUP_PARSER) selection = soup.select(_AUTHENTICITY_TOKEN_SELECTOR) try: authenticity_token = selection[0].get('content') exce...
def get_surveys(self, url=_SURVEYS_URL): ' Function to get the surveys for the account ' res = self.client._get(url=url, expected_status_code=200) soup = BeautifulSoup(res.text, _DEFAULT_BEAUTIFULSOUP_PARSER) surveys_soup = soup.select(_SURVEYS_SELECTOR) survey_list = [] for survey_soup in surve...
-8,596,098,261,441,833,000
Function to get the surveys for the account
precisionmapper/__init__.py
get_surveys
tducret/precisionmapper-python
python
def get_surveys(self, url=_SURVEYS_URL): ' ' res = self.client._get(url=url, expected_status_code=200) soup = BeautifulSoup(res.text, _DEFAULT_BEAUTIFULSOUP_PARSER) surveys_soup = soup.select(_SURVEYS_SELECTOR) survey_list = [] for survey_soup in surveys_soup: survey_name = _css_select(...
def test_download_wheel_bad_output(mocker, for_py_version, session_app_data): 'if the download contains no match for what wheel was downloaded, pick one that matches from target' distribution = 'setuptools' p_open = mocker.MagicMock() mocker.patch('virtualenv.seed.wheels.acquire.Popen', return_value=p_o...
-8,604,230,394,771,363,000
if the download contains no match for what wheel was downloaded, pick one that matches from target
tests/unit/seed/wheels/test_acquire.py
test_download_wheel_bad_output
MShaffar19/virtualenv
python
def test_download_wheel_bad_output(mocker, for_py_version, session_app_data): distribution = 'setuptools' p_open = mocker.MagicMock() mocker.patch('virtualenv.seed.wheels.acquire.Popen', return_value=p_open) p_open.communicate.return_value = (, ) p_open.returncode = 0 embed = get_embed_whee...
@transactional_session def add_identity(identity, type, email, password=None, session=None): '\n Creates a user identity.\n\n :param identity: The identity key name. For example x509 DN, or a username.\n :param type: The type of the authentication (x509, gss, userpass, ssh, saml)\n :param email: The Ema...
-3,860,912,868,457,641,500
Creates a user identity. :param identity: The identity key name. For example x509 DN, or a username. :param type: The type of the authentication (x509, gss, userpass, ssh, saml) :param email: The Email address associated with the identity. :param password: If type==userpass, this sets the password. :param session: The...
lib/rucio/core/identity.py
add_identity
Pranay144/rucio
python
@transactional_session def add_identity(identity, type, email, password=None, session=None): '\n Creates a user identity.\n\n :param identity: The identity key name. For example x509 DN, or a username.\n :param type: The type of the authentication (x509, gss, userpass, ssh, saml)\n :param email: The Ema...
@transactional_session def del_identity(identity, type, session=None): '\n Deletes a user identity.\n\n :param identity: The identity key name. For example x509 DN, or a username.\n :param type: The type of the authentication (x509, gss, userpass, saml).\n :param session: The database session in use.\n ...
-5,832,953,435,856,953,000
Deletes a user identity. :param identity: The identity key name. For example x509 DN, or a username. :param type: The type of the authentication (x509, gss, userpass, saml). :param session: The database session in use.
lib/rucio/core/identity.py
del_identity
Pranay144/rucio
python
@transactional_session def del_identity(identity, type, session=None): '\n Deletes a user identity.\n\n :param identity: The identity key name. For example x509 DN, or a username.\n :param type: The type of the authentication (x509, gss, userpass, saml).\n :param session: The database session in use.\n ...
@transactional_session def add_account_identity(identity, type, account, email, default=False, password=None, session=None): '\n Adds a membership association between identity and account.\n\n :param identity: The identity key name. For example x509 DN, or a username.\n :param type: The type of the authent...
5,409,784,752,029,731,000
Adds a membership association between identity and account. :param identity: The identity key name. For example x509 DN, or a username. :param type: The type of the authentication (x509, gss, userpass, ssh, saml). :param account: The account name. :param email: The Email address associated with the identity. :param de...
lib/rucio/core/identity.py
add_account_identity
Pranay144/rucio
python
@transactional_session def add_account_identity(identity, type, account, email, default=False, password=None, session=None): '\n Adds a membership association between identity and account.\n\n :param identity: The identity key name. For example x509 DN, or a username.\n :param type: The type of the authent...
@read_session def get_default_account(identity, type, session=None): '\n Retrieves the default account mapped to an identity.\n\n :param identity: The identity key name. For example, x509DN, or a username.\n :param type: The type of the authentication (x509, gss, userpass, saml).\n :param session: The d...
-9,161,338,177,434,302,000
Retrieves the default account mapped to an identity. :param identity: The identity key name. For example, x509DN, or a username. :param type: The type of the authentication (x509, gss, userpass, saml). :param session: The database session to use. :returns: The default account name, None otherwise.
lib/rucio/core/identity.py
get_default_account
Pranay144/rucio
python
@read_session def get_default_account(identity, type, session=None): '\n Retrieves the default account mapped to an identity.\n\n :param identity: The identity key name. For example, x509DN, or a username.\n :param type: The type of the authentication (x509, gss, userpass, saml).\n :param session: The d...
@transactional_session def del_account_identity(identity, type, account, session=None): '\n Removes a membership association between identity and account.\n\n :param identity: The identity key name. For example x509 DN, or a username.\n :param type: The type of the authentication (x509, gss, userpass, saml...
-4,375,022,618,797,144,000
Removes a membership association between identity and account. :param identity: The identity key name. For example x509 DN, or a username. :param type: The type of the authentication (x509, gss, userpass, saml). :param account: The account name. :param session: The database session in use.
lib/rucio/core/identity.py
del_account_identity
Pranay144/rucio
python
@transactional_session def del_account_identity(identity, type, account, session=None): '\n Removes a membership association between identity and account.\n\n :param identity: The identity key name. For example x509 DN, or a username.\n :param type: The type of the authentication (x509, gss, userpass, saml...
@read_session def list_identities(session=None, **kwargs): '\n Returns a list of all identities.\n\n :param session: The database session in use.\n\n returns: A list of all identities.\n ' id_list = [] for id in session.query(models.Identity).order_by(models.Identity.identity): id_list.a...
-8,399,802,736,883,936,000
Returns a list of all identities. :param session: The database session in use. returns: A list of all identities.
lib/rucio/core/identity.py
list_identities
Pranay144/rucio
python
@read_session def list_identities(session=None, **kwargs): '\n Returns a list of all identities.\n\n :param session: The database session in use.\n\n returns: A list of all identities.\n ' id_list = [] for id in session.query(models.Identity).order_by(models.Identity.identity): id_list.a...
@read_session def list_accounts_for_identity(identity, type, session=None): '\n Returns a list of all accounts for an identity.\n\n :param identity: The identity key name. For example x509 DN, or a username.\n :param type: The type of the authentication (x509, gss, userpass, saml).\n :param session: The...
7,104,951,005,997,469,000
Returns a list of all accounts for an identity. :param identity: The identity key name. For example x509 DN, or a username. :param type: The type of the authentication (x509, gss, userpass, saml). :param session: The database session in use. returns: A list of all accounts for the identity.
lib/rucio/core/identity.py
list_accounts_for_identity
Pranay144/rucio
python
@read_session def list_accounts_for_identity(identity, type, session=None): '\n Returns a list of all accounts for an identity.\n\n :param identity: The identity key name. For example x509 DN, or a username.\n :param type: The type of the authentication (x509, gss, userpass, saml).\n :param session: The...
def test_plain_ansi(self): '\n Test that printable characters do not get mangled.\n ' irc_ansi = irc.parse_ansi_to_irc(string.printable) ansi_irc = irc.parse_irc_to_ansi(string.printable) self.assertEqual(irc_ansi, string.printable) self.assertEqual(ansi_irc, string.printable)
2,886,767,279,122,754,000
Test that printable characters do not get mangled.
evennia/server/portal/tests.py
test_plain_ansi
Antrare/evennia
python
def test_plain_ansi(self): '\n \n ' irc_ansi = irc.parse_ansi_to_irc(string.printable) ansi_irc = irc.parse_irc_to_ansi(string.printable) self.assertEqual(irc_ansi, string.printable) self.assertEqual(ansi_irc, string.printable)
def test_identity(self): '\n Test that the composition of the function and\n its inverse gives the correct string.\n ' s = '|wthis|Xis|gis|Ma|C|complex|*string' self.assertEqual(irc.parse_irc_to_ansi(irc.parse_ansi_to_irc(s)), s)
-7,974,552,474,826,718,000
Test that the composition of the function and its inverse gives the correct string.
evennia/server/portal/tests.py
test_identity
Antrare/evennia
python
def test_identity(self): '\n Test that the composition of the function and\n its inverse gives the correct string.\n ' s = '|wthis|Xis|gis|Ma|C|complex|*string' self.assertEqual(irc.parse_irc_to_ansi(irc.parse_ansi_to_irc(s)), s)
def test_find_start_codons(): 'New test to test the function to find start codons' assert (DNA('ATGGTACATGCGA').find_start_codons() == [0, 7])
5,244,507,483,773,776,000
New test to test the function to find start codons
tests/test_dna.py
test_find_start_codons
nickdelgrosso/genomics_workshop_demo
python
def test_find_start_codons(): assert (DNA('ATGGTACATGCGA').find_start_codons() == [0, 7])