repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
i3visio/osrframework | osrframework/utils/general.py | expandEntitiesFromEmail | def expandEntitiesFromEmail(e):
"""
Method that receives an email an creates linked entities
Args:
-----
e: Email to verify.
Returns:
--------
Three different values: email, alias and domain in a list.
"""
# Grabbing the email
email = {}
email["type"] = "i3vis... | python | def expandEntitiesFromEmail(e):
"""
Method that receives an email an creates linked entities
Args:
-----
e: Email to verify.
Returns:
--------
Three different values: email, alias and domain in a list.
"""
# Grabbing the email
email = {}
email["type"] = "i3vis... | [
"def",
"expandEntitiesFromEmail",
"(",
"e",
")",
":",
"email",
"=",
"{",
"}",
"email",
"[",
"\"type\"",
"]",
"=",
"\"i3visio.email\"",
"email",
"[",
"\"value\"",
"]",
"=",
"e",
"email",
"[",
"\"attributes\"",
"]",
"=",
"[",
"]",
"alias",
"=",
"{",
"}",... | Method that receives an email an creates linked entities
Args:
-----
e: Email to verify.
Returns:
--------
Three different values: email, alias and domain in a list. | [
"Method",
"that",
"receives",
"an",
"email",
"an",
"creates",
"linked",
"entities"
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/general.py#L842-L872 | train |
i3visio/osrframework | osrframework/domainfy.py | getNumberTLD | def getNumberTLD():
"""
Counting the total number of TLD being processed.
"""
total = 0
for typeTld in TLD.keys():
total+= len(TLD[typeTld])
return total | python | def getNumberTLD():
"""
Counting the total number of TLD being processed.
"""
total = 0
for typeTld in TLD.keys():
total+= len(TLD[typeTld])
return total | [
"def",
"getNumberTLD",
"(",
")",
":",
"total",
"=",
"0",
"for",
"typeTld",
"in",
"TLD",
".",
"keys",
"(",
")",
":",
"total",
"+=",
"len",
"(",
"TLD",
"[",
"typeTld",
"]",
")",
"return",
"total"
] | Counting the total number of TLD being processed. | [
"Counting",
"the",
"total",
"number",
"of",
"TLD",
"being",
"processed",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/domainfy.py#L63-L70 | train |
i3visio/osrframework | osrframework/domainfy.py | getWhoisInfo | def getWhoisInfo(domain):
"""
Method that trie to recover the whois info from a domain.
Args:
-----
domain: The domain to verify.
Returns:
--------
dict: A dictionary containing the result as an i3visio entity with its
`value`, `type` and `attributes`.
"""
n... | python | def getWhoisInfo(domain):
"""
Method that trie to recover the whois info from a domain.
Args:
-----
domain: The domain to verify.
Returns:
--------
dict: A dictionary containing the result as an i3visio entity with its
`value`, `type` and `attributes`.
"""
n... | [
"def",
"getWhoisInfo",
"(",
"domain",
")",
":",
"new",
"=",
"[",
"]",
"try",
":",
"emails",
"=",
"{",
"}",
"emails",
"[",
"\"type\"",
"]",
"=",
"\"i3visio.alias\"",
"emails",
"[",
"\"value\"",
"]",
"=",
"str",
"(",
"domain",
".",
"split",
"(",
"\".\"... | Method that trie to recover the whois info from a domain.
Args:
-----
domain: The domain to verify.
Returns:
--------
dict: A dictionary containing the result as an i3visio entity with its
`value`, `type` and `attributes`. | [
"Method",
"that",
"trie",
"to",
"recover",
"the",
"whois",
"info",
"from",
"a",
"domain",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/domainfy.py#L73-L150 | train |
i3visio/osrframework | osrframework/domainfy.py | createDomains | def createDomains(tlds, nicks=None, nicksFile=None):
"""
Method that globally permits to generate the domains to be checked.
Args:
-----
tlds: List of tlds.
nicks: List of aliases.
nicksFile: The filepath to the aliases file.
Returns:
--------
list: list of doma... | python | def createDomains(tlds, nicks=None, nicksFile=None):
"""
Method that globally permits to generate the domains to be checked.
Args:
-----
tlds: List of tlds.
nicks: List of aliases.
nicksFile: The filepath to the aliases file.
Returns:
--------
list: list of doma... | [
"def",
"createDomains",
"(",
"tlds",
",",
"nicks",
"=",
"None",
",",
"nicksFile",
"=",
"None",
")",
":",
"domain_candidates",
"=",
"[",
"]",
"if",
"nicks",
"!=",
"None",
":",
"for",
"n",
"in",
"nicks",
":",
"for",
"t",
"in",
"tlds",
":",
"tmp",
"="... | Method that globally permits to generate the domains to be checked.
Args:
-----
tlds: List of tlds.
nicks: List of aliases.
nicksFile: The filepath to the aliases file.
Returns:
--------
list: list of domains to be checked. | [
"Method",
"that",
"globally",
"permits",
"to",
"generate",
"the",
"domains",
"to",
"be",
"checked",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/domainfy.py#L153-L188 | train |
i3visio/osrframework | osrframework/mailfy.py | weCanCheckTheseDomains | def weCanCheckTheseDomains(email):
"""
Method that verifies if a domain can be safely verified.
Args:
-----
email: the email whose domain will be verified.
Returns:
--------
bool: it represents whether the domain can be verified.
"""
# Known platform not to be working..... | python | def weCanCheckTheseDomains(email):
"""
Method that verifies if a domain can be safely verified.
Args:
-----
email: the email whose domain will be verified.
Returns:
--------
bool: it represents whether the domain can be verified.
"""
# Known platform not to be working..... | [
"def",
"weCanCheckTheseDomains",
"(",
"email",
")",
":",
"notWorking",
"=",
"[",
"\"@aol.com\"",
",",
"\"@bk.ru\"",
",",
"\"@breakthru.com\"",
",",
"\"@gmx.\"",
",",
"\"@hotmail.co\"",
",",
"\"@inbox.com\"",
",",
"\"@latinmail.com\"",
",",
"\"@libero.it\"",
",",
"\"... | Method that verifies if a domain can be safely verified.
Args:
-----
email: the email whose domain will be verified.
Returns:
--------
bool: it represents whether the domain can be verified. | [
"Method",
"that",
"verifies",
"if",
"a",
"domain",
"can",
"be",
"safely",
"verified",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/mailfy.py#L112-L161 | train |
i3visio/osrframework | osrframework/mailfy.py | grabEmails | def grabEmails(emails=None, emailsFile=None, nicks=None, nicksFile=None, domains=EMAIL_DOMAINS, excludeDomains=[]):
"""
Method that generates a list of emails.
Args:
-----
emails: Any premade list of emails.
emailsFile: Filepath to the emails file (one per line).
nicks: A list o... | python | def grabEmails(emails=None, emailsFile=None, nicks=None, nicksFile=None, domains=EMAIL_DOMAINS, excludeDomains=[]):
"""
Method that generates a list of emails.
Args:
-----
emails: Any premade list of emails.
emailsFile: Filepath to the emails file (one per line).
nicks: A list o... | [
"def",
"grabEmails",
"(",
"emails",
"=",
"None",
",",
"emailsFile",
"=",
"None",
",",
"nicks",
"=",
"None",
",",
"nicksFile",
"=",
"None",
",",
"domains",
"=",
"EMAIL_DOMAINS",
",",
"excludeDomains",
"=",
"[",
"]",
")",
":",
"email_candidates",
"=",
"[",... | Method that generates a list of emails.
Args:
-----
emails: Any premade list of emails.
emailsFile: Filepath to the emails file (one per line).
nicks: A list of aliases.
nicksFile: Filepath to the aliases file (one per line).
domains: Domains where the aliases will be te... | [
"Method",
"that",
"generates",
"a",
"list",
"of",
"emails",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/mailfy.py#L164-L206 | train |
i3visio/osrframework | osrframework/mailfy.py | processMailList | def processMailList(platformNames=[], emails=[]):
"""
Method to perform the email search.
Args:
-----
platformNames: List of names of the platforms.
emails: List of numbers to be queried.
Return:
-------
A list of verified emails.
"""
# Grabbing the <Platform> o... | python | def processMailList(platformNames=[], emails=[]):
"""
Method to perform the email search.
Args:
-----
platformNames: List of names of the platforms.
emails: List of numbers to be queried.
Return:
-------
A list of verified emails.
"""
# Grabbing the <Platform> o... | [
"def",
"processMailList",
"(",
"platformNames",
"=",
"[",
"]",
",",
"emails",
"=",
"[",
"]",
")",
":",
"platforms",
"=",
"platform_selection",
".",
"getPlatformsByName",
"(",
"platformNames",
",",
"mode",
"=",
"\"mailfy\"",
")",
"results",
"=",
"[",
"]",
"... | Method to perform the email search.
Args:
-----
platformNames: List of names of the platforms.
emails: List of numbers to be queried.
Return:
-------
A list of verified emails. | [
"Method",
"to",
"perform",
"the",
"email",
"search",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/mailfy.py#L209-L232 | train |
i3visio/osrframework | osrframework/mailfy.py | pool_function | def pool_function(args):
"""
A wrapper for being able to launch all the threads.
We will use python-emailahoy library for the verification.
Args:
-----
args: reception of the parameters for getPageWrapper as a tuple.
Returns:
--------
A dictionary representing whether the ... | python | def pool_function(args):
"""
A wrapper for being able to launch all the threads.
We will use python-emailahoy library for the verification.
Args:
-----
args: reception of the parameters for getPageWrapper as a tuple.
Returns:
--------
A dictionary representing whether the ... | [
"def",
"pool_function",
"(",
"args",
")",
":",
"is_valid",
"=",
"True",
"try",
":",
"checker",
"=",
"emailahoy",
".",
"VerifyEmail",
"(",
")",
"status",
",",
"message",
"=",
"checker",
".",
"verify_email_smtp",
"(",
"args",
",",
"from_host",
"=",
"'gmail.c... | A wrapper for being able to launch all the threads.
We will use python-emailahoy library for the verification.
Args:
-----
args: reception of the parameters for getPageWrapper as a tuple.
Returns:
--------
A dictionary representing whether the verification was ended
succes... | [
"A",
"wrapper",
"for",
"being",
"able",
"to",
"launch",
"all",
"the",
"threads",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/mailfy.py#L235-L283 | train |
i3visio/osrframework | osrframework/utils/browser.py | Browser.recoverURL | def recoverURL(self, url):
"""
Public method to recover a resource.
Args:
-----
url: The URL to be collected.
Returns:
--------
Returns a resource that has to be read, for instance, with html = self.br.read()
"""
# Configuring use... | python | def recoverURL(self, url):
"""
Public method to recover a resource.
Args:
-----
url: The URL to be collected.
Returns:
--------
Returns a resource that has to be read, for instance, with html = self.br.read()
"""
# Configuring use... | [
"def",
"recoverURL",
"(",
"self",
",",
"url",
")",
":",
"self",
".",
"setUserAgent",
"(",
")",
"if",
"\"https://\"",
"in",
"url",
":",
"self",
".",
"setProxy",
"(",
"protocol",
"=",
"\"https\"",
")",
"else",
":",
"self",
".",
"setProxy",
"(",
"protocol... | Public method to recover a resource.
Args:
-----
url: The URL to be collected.
Returns:
--------
Returns a resource that has to be read, for instance, with html = self.br.read() | [
"Public",
"method",
"to",
"recover",
"a",
"resource",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/browser.py#L141-L182 | train |
i3visio/osrframework | osrframework/utils/browser.py | Browser.setNewPassword | def setNewPassword(self, url, username, password):
"""
Public method to manually set the credentials for a url in the browser.
"""
self.br.add_password(url, username, password) | python | def setNewPassword(self, url, username, password):
"""
Public method to manually set the credentials for a url in the browser.
"""
self.br.add_password(url, username, password) | [
"def",
"setNewPassword",
"(",
"self",
",",
"url",
",",
"username",
",",
"password",
")",
":",
"self",
".",
"br",
".",
"add_password",
"(",
"url",
",",
"username",
",",
"password",
")"
] | Public method to manually set the credentials for a url in the browser. | [
"Public",
"method",
"to",
"manually",
"set",
"the",
"credentials",
"for",
"a",
"url",
"in",
"the",
"browser",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/browser.py#L184-L188 | train |
i3visio/osrframework | osrframework/utils/browser.py | Browser.setProxy | def setProxy(self, protocol="http"):
"""
Public method to set a proxy for the browser.
"""
# Setting proxy
try:
new = { protocol: self.proxies[protocol]}
self.br.set_proxies( new )
except:
# No proxy defined for that protocol
... | python | def setProxy(self, protocol="http"):
"""
Public method to set a proxy for the browser.
"""
# Setting proxy
try:
new = { protocol: self.proxies[protocol]}
self.br.set_proxies( new )
except:
# No proxy defined for that protocol
... | [
"def",
"setProxy",
"(",
"self",
",",
"protocol",
"=",
"\"http\"",
")",
":",
"try",
":",
"new",
"=",
"{",
"protocol",
":",
"self",
".",
"proxies",
"[",
"protocol",
"]",
"}",
"self",
".",
"br",
".",
"set_proxies",
"(",
"new",
")",
"except",
":",
"pas... | Public method to set a proxy for the browser. | [
"Public",
"method",
"to",
"set",
"a",
"proxy",
"for",
"the",
"browser",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/browser.py#L190-L200 | train |
i3visio/osrframework | osrframework/utils/browser.py | Browser.setUserAgent | def setUserAgent(self, uA=None):
"""
This method will be called whenever a new query will be executed.
:param uA: Any User Agent that was needed to be inserted. This parameter is optional.
:return: Returns True if a User Agent was inserted and False if no User Agent c... | python | def setUserAgent(self, uA=None):
"""
This method will be called whenever a new query will be executed.
:param uA: Any User Agent that was needed to be inserted. This parameter is optional.
:return: Returns True if a User Agent was inserted and False if no User Agent c... | [
"def",
"setUserAgent",
"(",
"self",
",",
"uA",
"=",
"None",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"\"osrframework.utils\"",
")",
"if",
"not",
"uA",
":",
"if",
"self",
".",
"userAgents",
":",
"logger",
"=",
"logging",
".",
"debug",
... | This method will be called whenever a new query will be executed.
:param uA: Any User Agent that was needed to be inserted. This parameter is optional.
:return: Returns True if a User Agent was inserted and False if no User Agent could be inserted. | [
"This",
"method",
"will",
"be",
"called",
"whenever",
"a",
"new",
"query",
"will",
"be",
"executed",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/browser.py#L202-L228 | train |
i3visio/osrframework | osrframework/api/twitter_api.py | main | def main(args):
"""
Query manager.
"""
# Creating the instance
tAW = TwitterAPIWrapper()
# Selecting the query to be launched
if args.type == "get_all_docs":
results = tAW.get_all_docs(args.query)
elif args.type == "get_user":
results = tAW.get_user(args.query)
... | python | def main(args):
"""
Query manager.
"""
# Creating the instance
tAW = TwitterAPIWrapper()
# Selecting the query to be launched
if args.type == "get_all_docs":
results = tAW.get_all_docs(args.query)
elif args.type == "get_user":
results = tAW.get_user(args.query)
... | [
"def",
"main",
"(",
"args",
")",
":",
"tAW",
"=",
"TwitterAPIWrapper",
"(",
")",
"if",
"args",
".",
"type",
"==",
"\"get_all_docs\"",
":",
"results",
"=",
"tAW",
".",
"get_all_docs",
"(",
"args",
".",
"query",
")",
"elif",
"args",
".",
"type",
"==",
... | Query manager. | [
"Query",
"manager",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/api/twitter_api.py#L775-L811 | train |
i3visio/osrframework | osrframework/api/twitter_api.py | TwitterAPIWrapper._rate_limit_status | def _rate_limit_status(self, api=None, mode=None):
"""
Verifying the API limits
"""
if api == None:
api = self.connectToAPI()
if mode == None:
print json.dumps(api.rate_limit_status(), indent=2)
raw_input("<Press ENTER>")
else:
... | python | def _rate_limit_status(self, api=None, mode=None):
"""
Verifying the API limits
"""
if api == None:
api = self.connectToAPI()
if mode == None:
print json.dumps(api.rate_limit_status(), indent=2)
raw_input("<Press ENTER>")
else:
... | [
"def",
"_rate_limit_status",
"(",
"self",
",",
"api",
"=",
"None",
",",
"mode",
"=",
"None",
")",
":",
"if",
"api",
"==",
"None",
":",
"api",
"=",
"self",
".",
"connectToAPI",
"(",
")",
"if",
"mode",
"==",
"None",
":",
"print",
"json",
".",
"dumps"... | Verifying the API limits | [
"Verifying",
"the",
"API",
"limits"
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/api/twitter_api.py#L62-L113 | train |
i3visio/osrframework | osrframework/api/twitter_api.py | TwitterAPIWrapper.get_followers | def get_followers(self, query):
"""
Method to get the followers of a user.
:param query: Query to be performed.
:return: List of ids.
"""
# Connecting to the API
api = self._connectToAPI()
# Verifying the limits of the API
self.... | python | def get_followers(self, query):
"""
Method to get the followers of a user.
:param query: Query to be performed.
:return: List of ids.
"""
# Connecting to the API
api = self._connectToAPI()
# Verifying the limits of the API
self.... | [
"def",
"get_followers",
"(",
"self",
",",
"query",
")",
":",
"api",
"=",
"self",
".",
"_connectToAPI",
"(",
")",
"self",
".",
"_rate_limit_status",
"(",
"api",
"=",
"api",
",",
"mode",
"=",
"\"get_followers\"",
")",
"try",
":",
"friends_ids",
"=",
"api",... | Method to get the followers of a user.
:param query: Query to be performed.
:return: List of ids. | [
"Method",
"to",
"get",
"the",
"followers",
"of",
"a",
"user",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/api/twitter_api.py#L641-L667 | train |
i3visio/osrframework | osrframework/api/twitter_api.py | TwitterAPIWrapper.get_friends | def get_friends(self, query):
"""
Method to get the friends of a user.
:param query: Query to be performed.
:return: List of users.
"""
# Connecting to the API
api = self._connectToAPI()
# Verifying the limits of the API
self._r... | python | def get_friends(self, query):
"""
Method to get the friends of a user.
:param query: Query to be performed.
:return: List of users.
"""
# Connecting to the API
api = self._connectToAPI()
# Verifying the limits of the API
self._r... | [
"def",
"get_friends",
"(",
"self",
",",
"query",
")",
":",
"api",
"=",
"self",
".",
"_connectToAPI",
"(",
")",
"self",
".",
"_rate_limit_status",
"(",
"api",
"=",
"api",
",",
"mode",
"=",
"\"get_friends\"",
")",
"try",
":",
"friends_ids",
"=",
"api",
"... | Method to get the friends of a user.
:param query: Query to be performed.
:return: List of users. | [
"Method",
"to",
"get",
"the",
"friends",
"of",
"a",
"user",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/api/twitter_api.py#L669-L695 | train |
i3visio/osrframework | osrframework/api/twitter_api.py | TwitterAPIWrapper.get_user | def get_user(self, screen_name):
"""
Method to perform the usufy searches.
:param screen_name: nickname to be searched.
:return: User.
"""
# Connecting to the API
api = self._connectToAPI()
# Verifying the limits of the API
self._... | python | def get_user(self, screen_name):
"""
Method to perform the usufy searches.
:param screen_name: nickname to be searched.
:return: User.
"""
# Connecting to the API
api = self._connectToAPI()
# Verifying the limits of the API
self._... | [
"def",
"get_user",
"(",
"self",
",",
"screen_name",
")",
":",
"api",
"=",
"self",
".",
"_connectToAPI",
"(",
")",
"self",
".",
"_rate_limit_status",
"(",
"api",
"=",
"api",
",",
"mode",
"=",
"\"get_user\"",
")",
"aux",
"=",
"[",
"]",
"try",
":",
"use... | Method to perform the usufy searches.
:param screen_name: nickname to be searched.
:return: User. | [
"Method",
"to",
"perform",
"the",
"usufy",
"searches",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/api/twitter_api.py#L698-L724 | train |
i3visio/osrframework | osrframework/api/twitter_api.py | TwitterAPIWrapper.search_users | def search_users(self, query, n=20, maxUsers=60):
"""
Method to perform the searchfy searches.
:param query: Query to be performed.
:param n: Number of results per query.
:param maxUsers: Max. number of users to be recovered.
:return: List ... | python | def search_users(self, query, n=20, maxUsers=60):
"""
Method to perform the searchfy searches.
:param query: Query to be performed.
:param n: Number of results per query.
:param maxUsers: Max. number of users to be recovered.
:return: List ... | [
"def",
"search_users",
"(",
"self",
",",
"query",
",",
"n",
"=",
"20",
",",
"maxUsers",
"=",
"60",
")",
":",
"api",
"=",
"self",
".",
"_connectToAPI",
"(",
")",
"self",
".",
"_rate_limit_status",
"(",
"api",
"=",
"api",
",",
"mode",
"=",
"\"search_us... | Method to perform the searchfy searches.
:param query: Query to be performed.
:param n: Number of results per query.
:param maxUsers: Max. number of users to be recovered.
:return: List of users | [
"Method",
"to",
"perform",
"the",
"searchfy",
"searches",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/api/twitter_api.py#L726-L772 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/source.py | Source.validate_categories | def validate_categories(categories):
"""Take an iterable of source categories and raise ValueError if some
of them are invalid."""
if not set(categories) <= Source.categories:
invalid = list(set(categories) - Source.categories)
raise ValueError('Invalid categories: %s' %... | python | def validate_categories(categories):
"""Take an iterable of source categories and raise ValueError if some
of them are invalid."""
if not set(categories) <= Source.categories:
invalid = list(set(categories) - Source.categories)
raise ValueError('Invalid categories: %s' %... | [
"def",
"validate_categories",
"(",
"categories",
")",
":",
"if",
"not",
"set",
"(",
"categories",
")",
"<=",
"Source",
".",
"categories",
":",
"invalid",
"=",
"list",
"(",
"set",
"(",
"categories",
")",
"-",
"Source",
".",
"categories",
")",
"raise",
"Va... | Take an iterable of source categories and raise ValueError if some
of them are invalid. | [
"Take",
"an",
"iterable",
"of",
"source",
"categories",
"and",
"raise",
"ValueError",
"if",
"some",
"of",
"them",
"are",
"invalid",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/source.py#L50-L55 | train |
i3visio/osrframework | osrframework/thirdparties/md5db_net/checkIfHashIsCracked.py | checkIfHashIsCracked | def checkIfHashIsCracked(hash=None):
"""
Method that checks if the given hash is stored in the md5db.net website.
:param hash: hash to verify.
:return: Resolved hash. If nothing was found, it will return an empty list.
"""
apiURL = "http://md5db.net/api/" + str(hash).lower()
try:
# Getting the result ... | python | def checkIfHashIsCracked(hash=None):
"""
Method that checks if the given hash is stored in the md5db.net website.
:param hash: hash to verify.
:return: Resolved hash. If nothing was found, it will return an empty list.
"""
apiURL = "http://md5db.net/api/" + str(hash).lower()
try:
# Getting the result ... | [
"def",
"checkIfHashIsCracked",
"(",
"hash",
"=",
"None",
")",
":",
"apiURL",
"=",
"\"http://md5db.net/api/\"",
"+",
"str",
"(",
"hash",
")",
".",
"lower",
"(",
")",
"try",
":",
"data",
"=",
"urllib2",
".",
"urlopen",
"(",
"apiURL",
")",
".",
"read",
"(... | Method that checks if the given hash is stored in the md5db.net website.
:param hash: hash to verify.
:return: Resolved hash. If nothing was found, it will return an empty list. | [
"Method",
"that",
"checks",
"if",
"the",
"given",
"hash",
"is",
"stored",
"in",
"the",
"md5db",
".",
"net",
"website",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/md5db_net/checkIfHashIsCracked.py#L26-L46 | train |
i3visio/osrframework | osrframework/usufy.py | fuzzUsufy | def fuzzUsufy(fDomains = None, fFuzzStruct = None):
"""
Method to guess the usufy path against a list of domains or subdomains.
Args:
-----
fDomains: A list to strings containing the domains and (optionally) a
nick.
fFuzzStruct: A list to strings containing the transforms to... | python | def fuzzUsufy(fDomains = None, fFuzzStruct = None):
"""
Method to guess the usufy path against a list of domains or subdomains.
Args:
-----
fDomains: A list to strings containing the domains and (optionally) a
nick.
fFuzzStruct: A list to strings containing the transforms to... | [
"def",
"fuzzUsufy",
"(",
"fDomains",
"=",
"None",
",",
"fFuzzStruct",
"=",
"None",
")",
":",
"if",
"fFuzzStruct",
"==",
"None",
":",
"fuzzingStructures",
"=",
"[",
"\"http://<DOMAIN>/<USERNAME>\"",
",",
"\"http://<DOMAIN>/~<USERNAME>\"",
",",
"\"http://<DOMAIN>/?actio... | Method to guess the usufy path against a list of domains or subdomains.
Args:
-----
fDomains: A list to strings containing the domains and (optionally) a
nick.
fFuzzStruct: A list to strings containing the transforms to be
performed.
Returns:
--------
di... | [
"Method",
"to",
"guess",
"the",
"usufy",
"path",
"against",
"a",
"list",
"of",
"domains",
"or",
"subdomains",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/usufy.py#L50-L145 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/search.py | SearchAPIRequest._prepare_filtering_params | def _prepare_filtering_params(domain=None, category=None,
sponsored_source=None, has_field=None,
has_fields=None, query_params_match=None,
query_person_match=None, **kwargs):
"""Transform the params to th... | python | def _prepare_filtering_params(domain=None, category=None,
sponsored_source=None, has_field=None,
has_fields=None, query_params_match=None,
query_person_match=None, **kwargs):
"""Transform the params to th... | [
"def",
"_prepare_filtering_params",
"(",
"domain",
"=",
"None",
",",
"category",
"=",
"None",
",",
"sponsored_source",
"=",
"None",
",",
"has_field",
"=",
"None",
",",
"has_fields",
"=",
"None",
",",
"query_params_match",
"=",
"None",
",",
"query_person_match",
... | Transform the params to the API format, return a list of params. | [
"Transform",
"the",
"params",
"to",
"the",
"API",
"format",
"return",
"a",
"list",
"of",
"params",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/search.py#L180-L207 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/search.py | SearchAPIRequest.validate_query_params | def validate_query_params(self, strict=True):
"""Check if the request is valid and can be sent, raise ValueError if
not.
`strict` is a boolean argument that defaults to True which means an
exception is raised on every invalid query parameter, if set to False
an e... | python | def validate_query_params(self, strict=True):
"""Check if the request is valid and can be sent, raise ValueError if
not.
`strict` is a boolean argument that defaults to True which means an
exception is raised on every invalid query parameter, if set to False
an e... | [
"def",
"validate_query_params",
"(",
"self",
",",
"strict",
"=",
"True",
")",
":",
"if",
"not",
"(",
"self",
".",
"api_key",
"or",
"default_api_key",
")",
":",
"raise",
"ValueError",
"(",
"'API key is missing'",
")",
"if",
"strict",
"and",
"self",
".",
"qu... | Check if the request is valid and can be sent, raise ValueError if
not.
`strict` is a boolean argument that defaults to True which means an
exception is raised on every invalid query parameter, if set to False
an exception is raised only when the search request cannot be ... | [
"Check",
"if",
"the",
"request",
"is",
"valid",
"and",
"can",
"be",
"sent",
"raise",
"ValueError",
"if",
"not",
".",
"strict",
"is",
"a",
"boolean",
"argument",
"that",
"defaults",
"to",
"True",
"which",
"means",
"an",
"exception",
"is",
"raised",
"on",
... | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/search.py#L322-L340 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/search.py | SearchAPIResponse.group_records_by_domain | def group_records_by_domain(self):
"""Return the records grouped by the domain they came from.
The return value is a dict, a key in this dict is a domain
and the value is a list of all the records with this domain.
"""
key_function = lambda record: record... | python | def group_records_by_domain(self):
"""Return the records grouped by the domain they came from.
The return value is a dict, a key in this dict is a domain
and the value is a list of all the records with this domain.
"""
key_function = lambda record: record... | [
"def",
"group_records_by_domain",
"(",
"self",
")",
":",
"key_function",
"=",
"lambda",
"record",
":",
"record",
".",
"source",
".",
"domain",
"return",
"self",
".",
"group_records",
"(",
"key_function",
")"
] | Return the records grouped by the domain they came from.
The return value is a dict, a key in this dict is a domain
and the value is a list of all the records with this domain. | [
"Return",
"the",
"records",
"grouped",
"by",
"the",
"domain",
"they",
"came",
"from",
".",
"The",
"return",
"value",
"is",
"a",
"dict",
"a",
"key",
"in",
"this",
"dict",
"is",
"a",
"domain",
"and",
"the",
"value",
"is",
"a",
"list",
"of",
"all",
"the... | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/search.py#L532-L540 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/search.py | SearchAPIResponse.group_records_by_category | def group_records_by_category(self):
"""Return the records grouped by the category of their source.
The return value is a dict, a key in this dict is a category
and the value is a list of all the records with this category.
"""
Source.validate_categories(... | python | def group_records_by_category(self):
"""Return the records grouped by the category of their source.
The return value is a dict, a key in this dict is a category
and the value is a list of all the records with this category.
"""
Source.validate_categories(... | [
"def",
"group_records_by_category",
"(",
"self",
")",
":",
"Source",
".",
"validate_categories",
"(",
"categories",
")",
"key_function",
"=",
"lambda",
"record",
":",
"record",
".",
"source",
".",
"category",
"return",
"self",
".",
"group_records",
"(",
"key_fun... | Return the records grouped by the category of their source.
The return value is a dict, a key in this dict is a category
and the value is a list of all the records with this category. | [
"Return",
"the",
"records",
"grouped",
"by",
"the",
"category",
"of",
"their",
"source",
".",
"The",
"return",
"value",
"is",
"a",
"dict",
"a",
"key",
"in",
"this",
"dict",
"is",
"a",
"category",
"and",
"the",
"value",
"is",
"a",
"list",
"of",
"all",
... | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/search.py#L542-L551 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/search.py | SearchAPIResponse.from_dict | def from_dict(d):
"""Transform the dict to a response object and return the response."""
warnings_ = d.get('warnings', [])
query = d.get('query') or None
if query:
query = Person.from_dict(query)
person = d.get('person') or None
if person:
... | python | def from_dict(d):
"""Transform the dict to a response object and return the response."""
warnings_ = d.get('warnings', [])
query = d.get('query') or None
if query:
query = Person.from_dict(query)
person = d.get('person') or None
if person:
... | [
"def",
"from_dict",
"(",
"d",
")",
":",
"warnings_",
"=",
"d",
".",
"get",
"(",
"'warnings'",
",",
"[",
"]",
")",
"query",
"=",
"d",
".",
"get",
"(",
"'query'",
")",
"or",
"None",
"if",
"query",
":",
"query",
"=",
"Person",
".",
"from_dict",
"(",... | Transform the dict to a response object and return the response. | [
"Transform",
"the",
"dict",
"to",
"a",
"response",
"object",
"and",
"return",
"the",
"response",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/search.py#L576-L594 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/search.py | SearchAPIResponse.to_dict | def to_dict(self):
"""Return a dict representation of the response."""
d = {}
if self.warnings:
d['warnings'] = self.warnings
if self.query is not None:
d['query'] = self.query.to_dict()
if self.person is not None:
d['person'] = self.pe... | python | def to_dict(self):
"""Return a dict representation of the response."""
d = {}
if self.warnings:
d['warnings'] = self.warnings
if self.query is not None:
d['query'] = self.query.to_dict()
if self.person is not None:
d['person'] = self.pe... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"}",
"if",
"self",
".",
"warnings",
":",
"d",
"[",
"'warnings'",
"]",
"=",
"self",
".",
"warnings",
"if",
"self",
".",
"query",
"is",
"not",
"None",
":",
"d",
"[",
"'query'",
"]",
"=",
"se... | Return a dict representation of the response. | [
"Return",
"a",
"dict",
"representation",
"of",
"the",
"response",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/search.py#L596-L610 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | Field.from_dict | def from_dict(cls, d):
"""Transform the dict to a field object and return the field."""
kwargs = {}
for key, val in d.iteritems():
if key.startswith('display'): # includes phone.display_international
continue
if key.startswith('@'):
... | python | def from_dict(cls, d):
"""Transform the dict to a field object and return the field."""
kwargs = {}
for key, val in d.iteritems():
if key.startswith('display'): # includes phone.display_international
continue
if key.startswith('@'):
... | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"kwargs",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"d",
".",
"iteritems",
"(",
")",
":",
"if",
"key",
".",
"startswith",
"(",
"'display'",
")",
":",
"continue",
"if",
"key",
".",
"startswi... | Transform the dict to a field object and return the field. | [
"Transform",
"the",
"dict",
"to",
"a",
"field",
"object",
"and",
"return",
"the",
"field",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L87-L102 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | Field.to_dict | def to_dict(self):
"""Return a dict representation of the field."""
d = {}
if self.valid_since is not None:
d['@valid_since'] = datetime_to_str(self.valid_since)
for attr_list, prefix in [(self.attributes, '@'), (self.children, '')]:
for attr in attr_list:
... | python | def to_dict(self):
"""Return a dict representation of the field."""
d = {}
if self.valid_since is not None:
d['@valid_since'] = datetime_to_str(self.valid_since)
for attr_list, prefix in [(self.attributes, '@'), (self.children, '')]:
for attr in attr_list:
... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"}",
"if",
"self",
".",
"valid_since",
"is",
"not",
"None",
":",
"d",
"[",
"'@valid_since'",
"]",
"=",
"datetime_to_str",
"(",
"self",
".",
"valid_since",
")",
"for",
"attr_list",
",",
"prefix",
... | Return a dict representation of the field. | [
"Return",
"a",
"dict",
"representation",
"of",
"the",
"field",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L104-L118 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | Name.is_searchable | def is_searchable(self):
"""A bool value that indicates whether the name is a valid name to
search by."""
first = alpha_chars(self.first or u'')
last = alpha_chars(self.last or u'')
raw = alpha_chars(self.raw or u'')
return (len(first) >= 2 and len(last) >= 2) or l... | python | def is_searchable(self):
"""A bool value that indicates whether the name is a valid name to
search by."""
first = alpha_chars(self.first or u'')
last = alpha_chars(self.last or u'')
raw = alpha_chars(self.raw or u'')
return (len(first) >= 2 and len(last) >= 2) or l... | [
"def",
"is_searchable",
"(",
"self",
")",
":",
"first",
"=",
"alpha_chars",
"(",
"self",
".",
"first",
"or",
"u''",
")",
"last",
"=",
"alpha_chars",
"(",
"self",
".",
"last",
"or",
"u''",
")",
"raw",
"=",
"alpha_chars",
"(",
"self",
".",
"raw",
"or",... | A bool value that indicates whether the name is a valid name to
search by. | [
"A",
"bool",
"value",
"that",
"indicates",
"whether",
"the",
"name",
"is",
"a",
"valid",
"name",
"to",
"search",
"by",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L163-L169 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | Address.is_searchable | def is_searchable(self):
"""A bool value that indicates whether the address is a valid address
to search by."""
return self.raw or (self.is_valid_country and
(not self.state or self.is_valid_state)) | python | def is_searchable(self):
"""A bool value that indicates whether the address is a valid address
to search by."""
return self.raw or (self.is_valid_country and
(not self.state or self.is_valid_state)) | [
"def",
"is_searchable",
"(",
"self",
")",
":",
"return",
"self",
".",
"raw",
"or",
"(",
"self",
".",
"is_valid_country",
"and",
"(",
"not",
"self",
".",
"state",
"or",
"self",
".",
"is_valid_state",
")",
")"
] | A bool value that indicates whether the address is a valid address
to search by. | [
"A",
"bool",
"value",
"that",
"indicates",
"whether",
"the",
"address",
"is",
"a",
"valid",
"address",
"to",
"search",
"by",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L233-L237 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | Address.is_valid_state | def is_valid_state(self):
"""A bool value that indicates whether the object's state is a valid
state code."""
return self.is_valid_country and self.country.upper() in STATES and \
self.state is not None and \
self.state.upper() in STATES[self.country.upper()] | python | def is_valid_state(self):
"""A bool value that indicates whether the object's state is a valid
state code."""
return self.is_valid_country and self.country.upper() in STATES and \
self.state is not None and \
self.state.upper() in STATES[self.country.upper()] | [
"def",
"is_valid_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"is_valid_country",
"and",
"self",
".",
"country",
".",
"upper",
"(",
")",
"in",
"STATES",
"and",
"self",
".",
"state",
"is",
"not",
"None",
"and",
"self",
".",
"state",
".",
"upper... | A bool value that indicates whether the object's state is a valid
state code. | [
"A",
"bool",
"value",
"that",
"indicates",
"whether",
"the",
"object",
"s",
"state",
"is",
"a",
"valid",
"state",
"code",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L246-L251 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | Phone.to_dict | def to_dict(self):
"""Extend Field.to_dict, take the display_international attribute."""
d = Field.to_dict(self)
if self.display_international:
d['display_international'] = self.display_international
return d | python | def to_dict(self):
"""Extend Field.to_dict, take the display_international attribute."""
d = Field.to_dict(self)
if self.display_international:
d['display_international'] = self.display_international
return d | [
"def",
"to_dict",
"(",
"self",
")",
":",
"d",
"=",
"Field",
".",
"to_dict",
"(",
"self",
")",
"if",
"self",
".",
"display_international",
":",
"d",
"[",
"'display_international'",
"]",
"=",
"self",
".",
"display_international",
"return",
"d"
] | Extend Field.to_dict, take the display_international attribute. | [
"Extend",
"Field",
".",
"to_dict",
"take",
"the",
"display_international",
"attribute",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L345-L350 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | Email.is_valid_email | def is_valid_email(self):
"""A bool value that indicates whether the address is a valid
email address.
Note that the check is done be matching to the regular expression
at Email.re_email which is very basic and far from covering end-cases...
"""
... | python | def is_valid_email(self):
"""A bool value that indicates whether the address is a valid
email address.
Note that the check is done be matching to the regular expression
at Email.re_email which is very basic and far from covering end-cases...
"""
... | [
"def",
"is_valid_email",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"address",
"and",
"Email",
".",
"re_email",
".",
"match",
"(",
"self",
".",
"address",
")",
")"
] | A bool value that indicates whether the address is a valid
email address.
Note that the check is done be matching to the regular expression
at Email.re_email which is very basic and far from covering end-cases... | [
"A",
"bool",
"value",
"that",
"indicates",
"whether",
"the",
"address",
"is",
"a",
"valid",
"email",
"address",
".",
"Note",
"that",
"the",
"check",
"is",
"done",
"be",
"matching",
"to",
"the",
"regular",
"expression",
"at",
"Email",
".",
"re_email",
"whic... | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L383-L391 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | DOB.age | def age(self):
"""int, the estimated age of the person.
Note that A DOB object is based on a date-range and the exact date is
usually unknown so for age calculation the the middle of the range is
assumed to be the real date-of-birth.
"""
if se... | python | def age(self):
"""int, the estimated age of the person.
Note that A DOB object is based on a date-range and the exact date is
usually unknown so for age calculation the the middle of the range is
assumed to be the real date-of-birth.
"""
if se... | [
"def",
"age",
"(",
"self",
")",
":",
"if",
"self",
".",
"date_range",
"is",
"None",
":",
"return",
"dob",
"=",
"self",
".",
"date_range",
".",
"middle",
"today",
"=",
"datetime",
".",
"date",
".",
"today",
"(",
")",
"if",
"(",
"today",
".",
"month"... | int, the estimated age of the person.
Note that A DOB object is based on a date-range and the exact date is
usually unknown so for age calculation the the middle of the range is
assumed to be the real date-of-birth. | [
"int",
"the",
"estimated",
"age",
"of",
"the",
"person",
".",
"Note",
"that",
"A",
"DOB",
"object",
"is",
"based",
"on",
"a",
"date",
"-",
"range",
"and",
"the",
"exact",
"date",
"is",
"usually",
"unknown",
"so",
"for",
"age",
"calculation",
"the",
"th... | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L619-L634 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | DOB.age_range | def age_range(self):
"""A tuple of two ints - the minimum and maximum age of the person."""
if self.date_range is None:
return None, None
start_date = DateRange(self.date_range.start, self.date_range.start)
end_date = DateRange(self.date_range.end, self.date_range.end)
... | python | def age_range(self):
"""A tuple of two ints - the minimum and maximum age of the person."""
if self.date_range is None:
return None, None
start_date = DateRange(self.date_range.start, self.date_range.start)
end_date = DateRange(self.date_range.end, self.date_range.end)
... | [
"def",
"age_range",
"(",
"self",
")",
":",
"if",
"self",
".",
"date_range",
"is",
"None",
":",
"return",
"None",
",",
"None",
"start_date",
"=",
"DateRange",
"(",
"self",
".",
"date_range",
".",
"start",
",",
"self",
".",
"date_range",
".",
"start",
")... | A tuple of two ints - the minimum and maximum age of the person. | [
"A",
"tuple",
"of",
"two",
"ints",
"-",
"the",
"minimum",
"and",
"maximum",
"age",
"of",
"the",
"person",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L637-L645 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | DOB.from_age_range | def from_age_range(start_age, end_age):
"""Take a person's minimal and maximal age and return a new DOB object
suitable for him."""
if start_age < 0 or end_age < 0:
raise ValueError('start_age and end_age can\'t be negative')
if start_age > end_age:
... | python | def from_age_range(start_age, end_age):
"""Take a person's minimal and maximal age and return a new DOB object
suitable for him."""
if start_age < 0 or end_age < 0:
raise ValueError('start_age and end_age can\'t be negative')
if start_age > end_age:
... | [
"def",
"from_age_range",
"(",
"start_age",
",",
"end_age",
")",
":",
"if",
"start_age",
"<",
"0",
"or",
"end_age",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'start_age and end_age can\\'t be negative'",
")",
"if",
"start_age",
">",
"end_age",
":",
"start_age",... | Take a person's minimal and maximal age and return a new DOB object
suitable for him. | [
"Take",
"a",
"person",
"s",
"minimal",
"and",
"maximal",
"age",
"and",
"return",
"a",
"new",
"DOB",
"object",
"suitable",
"for",
"him",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L672-L695 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | Relationship.from_dict | def from_dict(cls, d):
"""Extend Field.from_dict and also load the name from the dict."""
relationship = super(cls, cls).from_dict(d)
if relationship.name is not None:
relationship.name = Name.from_dict(relationship.name)
return relationship | python | def from_dict(cls, d):
"""Extend Field.from_dict and also load the name from the dict."""
relationship = super(cls, cls).from_dict(d)
if relationship.name is not None:
relationship.name = Name.from_dict(relationship.name)
return relationship | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"relationship",
"=",
"super",
"(",
"cls",
",",
"cls",
")",
".",
"from_dict",
"(",
"d",
")",
"if",
"relationship",
".",
"name",
"is",
"not",
"None",
":",
"relationship",
".",
"name",
"=",
"Name",
"... | Extend Field.from_dict and also load the name from the dict. | [
"Extend",
"Field",
".",
"from_dict",
"and",
"also",
"load",
"the",
"name",
"from",
"the",
"dict",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L762-L767 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | DateRange.from_dict | def from_dict(d):
"""Transform the dict to a DateRange object."""
start = d.get('start')
end = d.get('end')
if not (start and end):
raise ValueError('DateRange must have both start and end')
start = str_to_date(start)
end = str_to_date(end)
ret... | python | def from_dict(d):
"""Transform the dict to a DateRange object."""
start = d.get('start')
end = d.get('end')
if not (start and end):
raise ValueError('DateRange must have both start and end')
start = str_to_date(start)
end = str_to_date(end)
ret... | [
"def",
"from_dict",
"(",
"d",
")",
":",
"start",
"=",
"d",
".",
"get",
"(",
"'start'",
")",
"end",
"=",
"d",
".",
"get",
"(",
"'end'",
")",
"if",
"not",
"(",
"start",
"and",
"end",
")",
":",
"raise",
"ValueError",
"(",
"'DateRange must have both star... | Transform the dict to a DateRange object. | [
"Transform",
"the",
"dict",
"to",
"a",
"DateRange",
"object",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L854-L862 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/fields.py | DateRange.to_dict | def to_dict(self):
"""Transform the date-range to a dict."""
d = {}
d['start'] = date_to_str(self.start)
d['end'] = date_to_str(self.end)
return d | python | def to_dict(self):
"""Transform the date-range to a dict."""
d = {}
d['start'] = date_to_str(self.start)
d['end'] = date_to_str(self.end)
return d | [
"def",
"to_dict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"}",
"d",
"[",
"'start'",
"]",
"=",
"date_to_str",
"(",
"self",
".",
"start",
")",
"d",
"[",
"'end'",
"]",
"=",
"date_to_str",
"(",
"self",
".",
"end",
")",
"return",
"d"
] | Transform the date-range to a dict. | [
"Transform",
"the",
"date",
"-",
"range",
"to",
"a",
"dict",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/fields.py#L864-L869 | train |
i3visio/osrframework | osrframework/enumeration.py | enumerateURL | def enumerateURL(urlDict, outputFolder, startIndex= 0, maxErrors = 100):
"""
Function that performs the enumeration itself.
"""
for i, url in enumerate(urlDict.keys()):
# Grabbing domain name:
domain = re.findall("://(.*)/", url)[0]
# Defining the starting index
... | python | def enumerateURL(urlDict, outputFolder, startIndex= 0, maxErrors = 100):
"""
Function that performs the enumeration itself.
"""
for i, url in enumerate(urlDict.keys()):
# Grabbing domain name:
domain = re.findall("://(.*)/", url)[0]
# Defining the starting index
... | [
"def",
"enumerateURL",
"(",
"urlDict",
",",
"outputFolder",
",",
"startIndex",
"=",
"0",
",",
"maxErrors",
"=",
"100",
")",
":",
"for",
"i",
",",
"url",
"in",
"enumerate",
"(",
"urlDict",
".",
"keys",
"(",
")",
")",
":",
"domain",
"=",
"re",
".",
"... | Function that performs the enumeration itself. | [
"Function",
"that",
"performs",
"the",
"enumeration",
"itself",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/enumeration.py#L36-L78 | train |
i3visio/osrframework | osrframework/thirdparties/haveibeenpwned_com/hibp.py | checkIfEmailWasHacked | def checkIfEmailWasHacked(email=None, sleepSeconds=1):
"""
Method that checks if the given email is stored in the HIBP website.
This function automatically waits a second to avoid problems with the API
rate limit. An example of the json received:
```
[{"Title":"Adobe","Name":"Adobe","Domain... | python | def checkIfEmailWasHacked(email=None, sleepSeconds=1):
"""
Method that checks if the given email is stored in the HIBP website.
This function automatically waits a second to avoid problems with the API
rate limit. An example of the json received:
```
[{"Title":"Adobe","Name":"Adobe","Domain... | [
"def",
"checkIfEmailWasHacked",
"(",
"email",
"=",
"None",
",",
"sleepSeconds",
"=",
"1",
")",
":",
"time",
".",
"sleep",
"(",
"sleepSeconds",
")",
"print",
"(",
"\"\\t[*] Bypassing Cloudflare Restriction...\"",
")",
"ua",
"=",
"'osrframework 0.18'",
"useragent",
... | Method that checks if the given email is stored in the HIBP website.
This function automatically waits a second to avoid problems with the API
rate limit. An example of the json received:
```
[{"Title":"Adobe","Name":"Adobe","Domain":"adobe.com","BreachDate":"2013-10-4","AddedDate":"2013-12-04T00:1... | [
"Method",
"that",
"checks",
"if",
"the",
"given",
"email",
"is",
"stored",
"in",
"the",
"HIBP",
"website",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/haveibeenpwned_com/hibp.py#L30-L124 | train |
i3visio/osrframework | osrframework/searchengines/google.py | get_page | def get_page(url):
"""
Request the given URL and return the response page, using the cookie jar.
@type url: str
@param url: URL to retrieve.
@rtype: str
@return: Web page retrieved for the given URL.
@raise IOError: An exception is raised on error.
@raise urllib2.URLError... | python | def get_page(url):
"""
Request the given URL and return the response page, using the cookie jar.
@type url: str
@param url: URL to retrieve.
@rtype: str
@return: Web page retrieved for the given URL.
@raise IOError: An exception is raised on error.
@raise urllib2.URLError... | [
"def",
"get_page",
"(",
"url",
")",
":",
"request",
"=",
"Request",
"(",
"url",
")",
"request",
".",
"add_header",
"(",
"'User-Agent'",
",",
"'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)'",
")",
"cookie_jar",
".",
"add_cookie_header",
"(",
"request",
")",
"... | Request the given URL and return the response page, using the cookie jar.
@type url: str
@param url: URL to retrieve.
@rtype: str
@return: Web page retrieved for the given URL.
@raise IOError: An exception is raised on error.
@raise urllib2.URLError: An exception is raised on error... | [
"Request",
"the",
"given",
"URL",
"and",
"return",
"the",
"response",
"page",
"using",
"the",
"cookie",
"jar",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/searchengines/google.py#L62-L85 | train |
i3visio/osrframework | osrframework/searchengines/google.py | search | def search(query, tld='com', lang='en', num=10, start=0, stop=None, pause=2.0,
only_standard=False):
"""
Search the given query string using Google.
@type query: str
@param query: Query string. Must NOT be url-encoded.
@type tld: str
@param tld: Top level domain.
@... | python | def search(query, tld='com', lang='en', num=10, start=0, stop=None, pause=2.0,
only_standard=False):
"""
Search the given query string using Google.
@type query: str
@param query: Query string. Must NOT be url-encoded.
@type tld: str
@param tld: Top level domain.
@... | [
"def",
"search",
"(",
"query",
",",
"tld",
"=",
"'com'",
",",
"lang",
"=",
"'en'",
",",
"num",
"=",
"10",
",",
"start",
"=",
"0",
",",
"stop",
"=",
"None",
",",
"pause",
"=",
"2.0",
",",
"only_standard",
"=",
"False",
")",
":",
"global",
"Beautif... | Search the given query string using Google.
@type query: str
@param query: Query string. Must NOT be url-encoded.
@type tld: str
@param tld: Top level domain.
@type lang: str
@param lang: Languaje.
@type num: int
@param num: Number of results per page.
@type s... | [
"Search",
"the",
"given",
"query",
"string",
"using",
"Google",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/searchengines/google.py#L114-L234 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/containers.py | FieldsContainer.add_fields | def add_fields(self, fields):
"""Add the fields to their corresponding container.
`fields` is an iterable of field objects from osrframework.thirdparties.pipl_com.lib.fields.
"""
for field in fields:
cls = field.__class__
try:
con... | python | def add_fields(self, fields):
"""Add the fields to their corresponding container.
`fields` is an iterable of field objects from osrframework.thirdparties.pipl_com.lib.fields.
"""
for field in fields:
cls = field.__class__
try:
con... | [
"def",
"add_fields",
"(",
"self",
",",
"fields",
")",
":",
"for",
"field",
"in",
"fields",
":",
"cls",
"=",
"field",
".",
"__class__",
"try",
":",
"container",
"=",
"FieldsContainer",
".",
"class_container",
"[",
"cls",
"]",
"except",
"KeyError",
":",
"r... | Add the fields to their corresponding container.
`fields` is an iterable of field objects from osrframework.thirdparties.pipl_com.lib.fields. | [
"Add",
"the",
"fields",
"to",
"their",
"corresponding",
"container",
".",
"fields",
"is",
"an",
"iterable",
"of",
"field",
"objects",
"from",
"osrframework",
".",
"thirdparties",
".",
"pipl_com",
".",
"lib",
".",
"fields",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/containers.py#L48-L60 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/containers.py | FieldsContainer.all_fields | def all_fields(self):
"""A list with all the fields contained in this object."""
return [field
for container in FieldsContainer.class_container.values()
for field in getattr(self, container)] | python | def all_fields(self):
"""A list with all the fields contained in this object."""
return [field
for container in FieldsContainer.class_container.values()
for field in getattr(self, container)] | [
"def",
"all_fields",
"(",
"self",
")",
":",
"return",
"[",
"field",
"for",
"container",
"in",
"FieldsContainer",
".",
"class_container",
".",
"values",
"(",
")",
"for",
"field",
"in",
"getattr",
"(",
"self",
",",
"container",
")",
"]"
] | A list with all the fields contained in this object. | [
"A",
"list",
"with",
"all",
"the",
"fields",
"contained",
"in",
"this",
"object",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/containers.py#L63-L67 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/containers.py | FieldsContainer.fields_from_dict | def fields_from_dict(d):
"""Load the fields from the dict, return a list with all the fields."""
class_container = FieldsContainer.class_container
fields = [field_cls.from_dict(field_dict)
for field_cls, container in class_container.iteritems()
for field_dict... | python | def fields_from_dict(d):
"""Load the fields from the dict, return a list with all the fields."""
class_container = FieldsContainer.class_container
fields = [field_cls.from_dict(field_dict)
for field_cls, container in class_container.iteritems()
for field_dict... | [
"def",
"fields_from_dict",
"(",
"d",
")",
":",
"class_container",
"=",
"FieldsContainer",
".",
"class_container",
"fields",
"=",
"[",
"field_cls",
".",
"from_dict",
"(",
"field_dict",
")",
"for",
"field_cls",
",",
"container",
"in",
"class_container",
".",
"iter... | Load the fields from the dict, return a list with all the fields. | [
"Load",
"the",
"fields",
"from",
"the",
"dict",
"return",
"a",
"list",
"with",
"all",
"the",
"fields",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/containers.py#L70-L76 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/containers.py | FieldsContainer.fields_to_dict | def fields_to_dict(self):
"""Transform the object to a dict and return the dict."""
d = {}
for container in FieldsContainer.class_container.values():
fields = getattr(self, container)
if fields:
d[container] = [field.to_dict() for field in fields]
... | python | def fields_to_dict(self):
"""Transform the object to a dict and return the dict."""
d = {}
for container in FieldsContainer.class_container.values():
fields = getattr(self, container)
if fields:
d[container] = [field.to_dict() for field in fields]
... | [
"def",
"fields_to_dict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"}",
"for",
"container",
"in",
"FieldsContainer",
".",
"class_container",
".",
"values",
"(",
")",
":",
"fields",
"=",
"getattr",
"(",
"self",
",",
"container",
")",
"if",
"fields",
":",
"d... | Transform the object to a dict and return the dict. | [
"Transform",
"the",
"object",
"to",
"a",
"dict",
"and",
"return",
"the",
"dict",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/containers.py#L78-L85 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/containers.py | Record.from_dict | def from_dict(d):
"""Transform the dict to a record object and return the record."""
query_params_match = d.get('@query_params_match')
query_person_match = d.get('@query_person_match')
valid_since = d.get('@valid_since')
if valid_since:
valid_since = str_to_datetime(v... | python | def from_dict(d):
"""Transform the dict to a record object and return the record."""
query_params_match = d.get('@query_params_match')
query_person_match = d.get('@query_person_match')
valid_since = d.get('@valid_since')
if valid_since:
valid_since = str_to_datetime(v... | [
"def",
"from_dict",
"(",
"d",
")",
":",
"query_params_match",
"=",
"d",
".",
"get",
"(",
"'@query_params_match'",
")",
"query_person_match",
"=",
"d",
".",
"get",
"(",
"'@query_person_match'",
")",
"valid_since",
"=",
"d",
".",
"get",
"(",
"'@valid_since'",
... | Transform the dict to a record object and return the record. | [
"Transform",
"the",
"dict",
"to",
"a",
"record",
"object",
"and",
"return",
"the",
"record",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/containers.py#L145-L157 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/containers.py | Record.to_dict | def to_dict(self):
"""Return a dict representation of the record."""
d = {}
if self.query_params_match is not None:
d['@query_params_match'] = self.query_params_match
if self.query_person_match is not None:
d['@query_person_match'] = self.query_person_match
... | python | def to_dict(self):
"""Return a dict representation of the record."""
d = {}
if self.query_params_match is not None:
d['@query_params_match'] = self.query_params_match
if self.query_person_match is not None:
d['@query_person_match'] = self.query_person_match
... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"}",
"if",
"self",
".",
"query_params_match",
"is",
"not",
"None",
":",
"d",
"[",
"'@query_params_match'",
"]",
"=",
"self",
".",
"query_params_match",
"if",
"self",
".",
"query_person_match",
"is",
... | Return a dict representation of the record. | [
"Return",
"a",
"dict",
"representation",
"of",
"the",
"record",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/containers.py#L159-L171 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/containers.py | Person.is_searchable | def is_searchable(self):
"""A bool value that indicates whether the person has enough data and
can be sent as a query to the API."""
filter_func = lambda field: field.is_searchable
return bool(filter(filter_func, self.names) or
filter(filter_func, self.emails) or
... | python | def is_searchable(self):
"""A bool value that indicates whether the person has enough data and
can be sent as a query to the API."""
filter_func = lambda field: field.is_searchable
return bool(filter(filter_func, self.names) or
filter(filter_func, self.emails) or
... | [
"def",
"is_searchable",
"(",
"self",
")",
":",
"filter_func",
"=",
"lambda",
"field",
":",
"field",
".",
"is_searchable",
"return",
"bool",
"(",
"filter",
"(",
"filter_func",
",",
"self",
".",
"names",
")",
"or",
"filter",
"(",
"filter_func",
",",
"self",
... | A bool value that indicates whether the person has enough data and
can be sent as a query to the API. | [
"A",
"bool",
"value",
"that",
"indicates",
"whether",
"the",
"person",
"has",
"enough",
"data",
"and",
"can",
"be",
"sent",
"as",
"a",
"query",
"to",
"the",
"API",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/containers.py#L222-L229 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/containers.py | Person.from_dict | def from_dict(d):
"""Transform the dict to a person object and return the person."""
query_params_match = d.get('@query_params_match')
sources = [Source.from_dict(source) for source in d.get('sources', [])]
fields = Person.fields_from_dict(d)
return Person(fields=fields, sources=... | python | def from_dict(d):
"""Transform the dict to a person object and return the person."""
query_params_match = d.get('@query_params_match')
sources = [Source.from_dict(source) for source in d.get('sources', [])]
fields = Person.fields_from_dict(d)
return Person(fields=fields, sources=... | [
"def",
"from_dict",
"(",
"d",
")",
":",
"query_params_match",
"=",
"d",
".",
"get",
"(",
"'@query_params_match'",
")",
"sources",
"=",
"[",
"Source",
".",
"from_dict",
"(",
"source",
")",
"for",
"source",
"in",
"d",
".",
"get",
"(",
"'sources'",
",",
"... | Transform the dict to a person object and return the person. | [
"Transform",
"the",
"dict",
"to",
"a",
"person",
"object",
"and",
"return",
"the",
"person",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/containers.py#L248-L254 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/containers.py | Person.to_dict | def to_dict(self):
"""Return a dict representation of the person."""
d = {}
if self.query_params_match is not None:
d['@query_params_match'] = self.query_params_match
if self.sources:
d['sources'] = [source.to_dict() for source in self.sources]
d.update(se... | python | def to_dict(self):
"""Return a dict representation of the person."""
d = {}
if self.query_params_match is not None:
d['@query_params_match'] = self.query_params_match
if self.sources:
d['sources'] = [source.to_dict() for source in self.sources]
d.update(se... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"}",
"if",
"self",
".",
"query_params_match",
"is",
"not",
"None",
":",
"d",
"[",
"'@query_params_match'",
"]",
"=",
"self",
".",
"query_params_match",
"if",
"self",
".",
"sources",
":",
"d",
"[",... | Return a dict representation of the person. | [
"Return",
"a",
"dict",
"representation",
"of",
"the",
"person",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/containers.py#L256-L264 | train |
i3visio/osrframework | osrframework/phonefy.py | processPhoneList | def processPhoneList(platformNames=[], numbers=[], excludePlatformNames=[]):
"""
Method to perform searchs on a series of numbers.
Args:
-----
platformNames: List of names of the platforms.
numbers: List of numbers to be queried.
excludePlatformNames: A list of platforms not to ... | python | def processPhoneList(platformNames=[], numbers=[], excludePlatformNames=[]):
"""
Method to perform searchs on a series of numbers.
Args:
-----
platformNames: List of names of the platforms.
numbers: List of numbers to be queried.
excludePlatformNames: A list of platforms not to ... | [
"def",
"processPhoneList",
"(",
"platformNames",
"=",
"[",
"]",
",",
"numbers",
"=",
"[",
"]",
",",
"excludePlatformNames",
"=",
"[",
"]",
")",
":",
"platforms",
"=",
"platform_selection",
".",
"getPlatformsByName",
"(",
"platformNames",
",",
"mode",
"=",
"\... | Method to perform searchs on a series of numbers.
Args:
-----
platformNames: List of names of the platforms.
numbers: List of numbers to be queried.
excludePlatformNames: A list of platforms not to be searched.
Return:
-------
A list of verified emails. | [
"Method",
"to",
"perform",
"searchs",
"on",
"a",
"series",
"of",
"numbers",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/phonefy.py#L37-L61 | train |
i3visio/osrframework | osrframework/utils/platforms.py | Platform.createURL | def createURL(self, word, mode="phonefy"):
"""
Method to create the URL replacing the word in the appropriate URL.
Args:
-----
word: Word to be searched.
mode: Mode to be executed.
Return:
-------
The URL to be queried.
"""
... | python | def createURL(self, word, mode="phonefy"):
"""
Method to create the URL replacing the word in the appropriate URL.
Args:
-----
word: Word to be searched.
mode: Mode to be executed.
Return:
-------
The URL to be queried.
"""
... | [
"def",
"createURL",
"(",
"self",
",",
"word",
",",
"mode",
"=",
"\"phonefy\"",
")",
":",
"try",
":",
"return",
"self",
".",
"modes",
"[",
"mode",
"]",
"[",
"\"url\"",
"]",
".",
"format",
"(",
"placeholder",
"=",
"urllib",
".",
"pathname2url",
"(",
"w... | Method to create the URL replacing the word in the appropriate URL.
Args:
-----
word: Word to be searched.
mode: Mode to be executed.
Return:
-------
The URL to be queried. | [
"Method",
"to",
"create",
"the",
"URL",
"replacing",
"the",
"word",
"in",
"the",
"appropriate",
"URL",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/platforms.py#L86-L112 | train |
i3visio/osrframework | osrframework/utils/platforms.py | Platform.launchQueryForMode | def launchQueryForMode(self, query=None, mode=None):
"""
Method that launches an i3Browser to collect data.
Args:
-----
query: The query to be performed
mode: The mode to be used to build the query.
Return:
-------
A string containing... | python | def launchQueryForMode(self, query=None, mode=None):
"""
Method that launches an i3Browser to collect data.
Args:
-----
query: The query to be performed
mode: The mode to be used to build the query.
Return:
-------
A string containing... | [
"def",
"launchQueryForMode",
"(",
"self",
",",
"query",
"=",
"None",
",",
"mode",
"=",
"None",
")",
":",
"qURL",
"=",
"self",
".",
"createURL",
"(",
"word",
"=",
"query",
",",
"mode",
"=",
"mode",
")",
"i3Browser",
"=",
"browser",
".",
"Browser",
"("... | Method that launches an i3Browser to collect data.
Args:
-----
query: The query to be performed
mode: The mode to be used to build the query.
Return:
-------
A string containing the recovered data or None. | [
"Method",
"that",
"launches",
"an",
"i3Browser",
"to",
"collect",
"data",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/platforms.py#L115-L144 | train |
i3visio/osrframework | osrframework/utils/platforms.py | Platform.getInfo | def getInfo(self, query=None, process=False, mode="phonefy", qURI=None):
"""
Method that checks the presence of a given query and recovers the first list of complains.
Args:
-----
query: Query to verify.
process: Calling the processing function.
mode:... | python | def getInfo(self, query=None, process=False, mode="phonefy", qURI=None):
"""
Method that checks the presence of a given query and recovers the first list of complains.
Args:
-----
query: Query to verify.
process: Calling the processing function.
mode:... | [
"def",
"getInfo",
"(",
"self",
",",
"query",
"=",
"None",
",",
"process",
"=",
"False",
",",
"mode",
"=",
"\"phonefy\"",
",",
"qURI",
"=",
"None",
")",
":",
"results",
"=",
"[",
"]",
"data",
"=",
"\"\"",
"if",
"self",
".",
"_modeIsValid",
"(",
"mod... | Method that checks the presence of a given query and recovers the first list of complains.
Args:
-----
query: Query to verify.
process: Calling the processing function.
mode: Mode to be executed.
qURI: A query to be checked.
Return:
-----... | [
"Method",
"that",
"checks",
"the",
"presence",
"of",
"a",
"given",
"query",
"and",
"recovers",
"the",
"first",
"list",
"of",
"complains",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/platforms.py#L147-L178 | train |
i3visio/osrframework | osrframework/utils/platforms.py | Platform._modeIsValid | def _modeIsValid(self, mode):
"""
Verification of whether the mode is a correct option to be used.
Args:
-----
mode: Mode to be executed.
Return:
-------
True if the mode exists in the three main folders.
"""
try:
# Su... | python | def _modeIsValid(self, mode):
"""
Verification of whether the mode is a correct option to be used.
Args:
-----
mode: Mode to be executed.
Return:
-------
True if the mode exists in the three main folders.
"""
try:
# Su... | [
"def",
"_modeIsValid",
"(",
"self",
",",
"mode",
")",
":",
"try",
":",
"return",
"mode",
"in",
"self",
".",
"modes",
".",
"keys",
"(",
")",
"except",
"AttributeError",
"as",
"e",
":",
"if",
"mode",
"in",
"self",
".",
"isValidMode",
".",
"keys",
"(",
... | Verification of whether the mode is a correct option to be used.
Args:
-----
mode: Mode to be executed.
Return:
-------
True if the mode exists in the three main folders. | [
"Verification",
"of",
"whether",
"the",
"mode",
"is",
"a",
"correct",
"option",
"to",
"be",
"used",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/platforms.py#L181-L201 | train |
i3visio/osrframework | osrframework/utils/platforms.py | Platform._getAuthenticated | def _getAuthenticated(self, browser, url):
"""
Getting authenticated.
This method may be overwritten.
TODO: update to version 2 of the wrappers.
Args:
-----
browser: The browser in which the user will be authenticated.
url: The URL to get authen... | python | def _getAuthenticated(self, browser, url):
"""
Getting authenticated.
This method may be overwritten.
TODO: update to version 2 of the wrappers.
Args:
-----
browser: The browser in which the user will be authenticated.
url: The URL to get authen... | [
"def",
"_getAuthenticated",
"(",
"self",
",",
"browser",
",",
"url",
")",
":",
"try",
":",
"if",
"len",
"(",
"self",
".",
"creds",
")",
">",
"0",
":",
"c",
"=",
"random",
".",
"choice",
"(",
"self",
".",
"creds",
")",
"[",
"0",
"]",
"browser",
... | Getting authenticated.
This method may be overwritten.
TODO: update to version 2 of the wrappers.
Args:
-----
browser: The browser in which the user will be authenticated.
url: The URL to get authenticated in.
Return:
-------
True o... | [
"Getting",
"authenticated",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/platforms.py#L234-L267 | train |
i3visio/osrframework | osrframework/utils/platforms.py | Platform._isValidQuery | def _isValidQuery(self, query, mode="phonefy"):
"""
Method to verify if a given query is processable by the platform.
The system looks for the forbidden characters in self.Forbidden list.
Args:
-----
query: The query to be launched.
mode: To be chosen am... | python | def _isValidQuery(self, query, mode="phonefy"):
"""
Method to verify if a given query is processable by the platform.
The system looks for the forbidden characters in self.Forbidden list.
Args:
-----
query: The query to be launched.
mode: To be chosen am... | [
"def",
"_isValidQuery",
"(",
"self",
",",
"query",
",",
"mode",
"=",
"\"phonefy\"",
")",
":",
"try",
":",
"validator",
"=",
"self",
".",
"modes",
"[",
"mode",
"]",
".",
"get",
"(",
"\"query_validator\"",
")",
"if",
"validator",
":",
"try",
":",
"compil... | Method to verify if a given query is processable by the platform.
The system looks for the forbidden characters in self.Forbidden list.
Args:
-----
query: The query to be launched.
mode: To be chosen amongst mailfy, phonefy, usufy, searchfy.
Return:
----... | [
"Method",
"to",
"verify",
"if",
"a",
"given",
"query",
"is",
"processable",
"by",
"the",
"platform",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/platforms.py#L270-L301 | train |
i3visio/osrframework | osrframework/utils/platforms.py | Platform._somethingFound | def _somethingFound(self, data, mode="phonefy"):
"""
Verifying if something was found.
Args:
-----
data: Data where the self.notFoundText will be searched.
mode: Mode to be executed.
Return:
-------
True if exists.
"""
... | python | def _somethingFound(self, data, mode="phonefy"):
"""
Verifying if something was found.
Args:
-----
data: Data where the self.notFoundText will be searched.
mode: Mode to be executed.
Return:
-------
True if exists.
"""
... | [
"def",
"_somethingFound",
"(",
"self",
",",
"data",
",",
"mode",
"=",
"\"phonefy\"",
")",
":",
"if",
"data",
":",
"try",
":",
"for",
"text",
"in",
"self",
".",
"notFoundText",
"[",
"mode",
"]",
":",
"if",
"text",
"in",
"data",
":",
"return",
"False",... | Verifying if something was found.
Args:
-----
data: Data where the self.notFoundText will be searched.
mode: Mode to be executed.
Return:
-------
True if exists. | [
"Verifying",
"if",
"something",
"was",
"found",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/platforms.py#L304-L331 | train |
i3visio/osrframework | osrframework/utils/platforms.py | Platform.do_phonefy | def do_phonefy(self, query, **kwargs):
"""
Verifying a phonefy query in this platform.
This might be redefined in any class inheriting from Platform.
Args:
-----
query: The element to be searched.
Return:
-------
A list of elements to be... | python | def do_phonefy(self, query, **kwargs):
"""
Verifying a phonefy query in this platform.
This might be redefined in any class inheriting from Platform.
Args:
-----
query: The element to be searched.
Return:
-------
A list of elements to be... | [
"def",
"do_phonefy",
"(",
"self",
",",
"query",
",",
"**",
"kwargs",
")",
":",
"results",
"=",
"[",
"]",
"test",
"=",
"self",
".",
"check_phonefy",
"(",
"query",
",",
"kwargs",
")",
"if",
"test",
":",
"r",
"=",
"{",
"\"type\"",
":",
"\"i3visio.phone\... | Verifying a phonefy query in this platform.
This might be redefined in any class inheriting from Platform.
Args:
-----
query: The element to be searched.
Return:
-------
A list of elements to be appended. | [
"Verifying",
"a",
"phonefy",
"query",
"in",
"this",
"platform",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/platforms.py#L541-L587 | train |
i3visio/osrframework | osrframework/utils/platforms.py | Platform.process_usufy | def process_usufy(self, data):
"""
Method to process and extract the entities of a usufy
Args:
-----
data: The information from which the info will be extracted.
Return:
-------
A list of the entities found.
"""
mode ... | python | def process_usufy(self, data):
"""
Method to process and extract the entities of a usufy
Args:
-----
data: The information from which the info will be extracted.
Return:
-------
A list of the entities found.
"""
mode ... | [
"def",
"process_usufy",
"(",
"self",
",",
"data",
")",
":",
"mode",
"=",
"\"usufy\"",
"info",
"=",
"[",
"]",
"try",
":",
"verifier",
"=",
"self",
".",
"modes",
".",
"get",
"(",
"mode",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"extra_fields\"",
",",
... | Method to process and extract the entities of a usufy
Args:
-----
data: The information from which the info will be extracted.
Return:
-------
A list of the entities found. | [
"Method",
"to",
"process",
"and",
"extract",
"the",
"entities",
"of",
"a",
"usufy"
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/platforms.py#L723-L783 | train |
i3visio/osrframework | osrframework/utils/benchmark.py | doBenchmark | def doBenchmark(plats):
'''
Perform the benchmark...
'''
logger = logging.getLogger("osrframework.utils")
# defining the results dict
res = {}
# args
args = []
#for p in plats:
# args.append( (str(p),) )
# selecting the number of tries to be performed
tries = [1, 4, 8 ,16, 24, 32, 40, 48, 56, 64]
... | python | def doBenchmark(plats):
'''
Perform the benchmark...
'''
logger = logging.getLogger("osrframework.utils")
# defining the results dict
res = {}
# args
args = []
#for p in plats:
# args.append( (str(p),) )
# selecting the number of tries to be performed
tries = [1, 4, 8 ,16, 24, 32, 40, 48, 56, 64]
... | [
"def",
"doBenchmark",
"(",
"plats",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"\"osrframework.utils\"",
")",
"res",
"=",
"{",
"}",
"args",
"=",
"[",
"]",
"tries",
"=",
"[",
"1",
",",
"4",
",",
"8",
",",
"16",
",",
"24",
",",
"32"... | Perform the benchmark... | [
"Perform",
"the",
"benchmark",
"..."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/benchmark.py#L55-L90 | train |
i3visio/osrframework | osrframework/utils/configuration.py | changePermissionsRecursively | def changePermissionsRecursively(path, uid, gid):
"""
Function to recursively change the user id and group id.
It sets 700 permissions.
"""
os.chown(path, uid, gid)
for item in os.listdir(path):
itempath = os.path.join(path, item)
if os.path.isfile(itempath):
# Setti... | python | def changePermissionsRecursively(path, uid, gid):
"""
Function to recursively change the user id and group id.
It sets 700 permissions.
"""
os.chown(path, uid, gid)
for item in os.listdir(path):
itempath = os.path.join(path, item)
if os.path.isfile(itempath):
# Setti... | [
"def",
"changePermissionsRecursively",
"(",
"path",
",",
"uid",
",",
"gid",
")",
":",
"os",
".",
"chown",
"(",
"path",
",",
"uid",
",",
"gid",
")",
"for",
"item",
"in",
"os",
".",
"listdir",
"(",
"path",
")",
":",
"itempath",
"=",
"os",
".",
"path"... | Function to recursively change the user id and group id.
It sets 700 permissions. | [
"Function",
"to",
"recursively",
"change",
"the",
"user",
"id",
"and",
"group",
"id",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/configuration.py#L33-L63 | train |
i3visio/osrframework | osrframework/utils/configuration.py | getConfigPath | def getConfigPath(configFileName = None):
"""
Auxiliar function to get the configuration paths depending on the system
Args:
-----
configFileName: TODO.
Returns:
--------
A dictionary with the following keys: appPath, appPathDefaults,
appPathTransforms, appPathPlugi... | python | def getConfigPath(configFileName = None):
"""
Auxiliar function to get the configuration paths depending on the system
Args:
-----
configFileName: TODO.
Returns:
--------
A dictionary with the following keys: appPath, appPathDefaults,
appPathTransforms, appPathPlugi... | [
"def",
"getConfigPath",
"(",
"configFileName",
"=",
"None",
")",
":",
"paths",
"=",
"{",
"}",
"applicationPath",
"=",
"\"./\"",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"applicationPath",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"os",
"... | Auxiliar function to get the configuration paths depending on the system
Args:
-----
configFileName: TODO.
Returns:
--------
A dictionary with the following keys: appPath, appPathDefaults,
appPathTransforms, appPathPlugins, appPathPatterns, appPathPatterns. | [
"Auxiliar",
"function",
"to",
"get",
"the",
"configuration",
"paths",
"depending",
"on",
"the",
"system"
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/configuration.py#L66-L103 | train |
i3visio/osrframework | osrframework/utils/configuration.py | returnListOfConfigurationValues | def returnListOfConfigurationValues(util):
"""
Method that recovers the configuration information about each program
TODO: Grab the default file from the package data instead of storing it in
the main folder.
Args:
-----
util: Any of the utils that are contained in the framework: domai... | python | def returnListOfConfigurationValues(util):
"""
Method that recovers the configuration information about each program
TODO: Grab the default file from the package data instead of storing it in
the main folder.
Args:
-----
util: Any of the utils that are contained in the framework: domai... | [
"def",
"returnListOfConfigurationValues",
"(",
"util",
")",
":",
"VALUES",
"=",
"{",
"}",
"configPath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"getConfigPath",
"(",
")",
"[",
"\"appPath\"",
"]",
",",
"\"general.cfg\"",
")",
"if",
"not",
"os",
".",
"pa... | Method that recovers the configuration information about each program
TODO: Grab the default file from the package data instead of storing it in
the main folder.
Args:
-----
util: Any of the utils that are contained in the framework: domainfy,
entify, mailfy, phonefy, searchfy, usu... | [
"Method",
"that",
"recovers",
"the",
"configuration",
"information",
"about",
"each",
"program"
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/configuration.py#L106-L195 | train |
i3visio/osrframework | osrframework/searchfy.py | performSearch | def performSearch(platformNames=[], queries=[], process=False, excludePlatformNames=[]):
"""
Method to perform the search itself on the different platforms.
Args:
-----
platforms: List of <Platform> objects.
queries: List of queries to be performed.
process: Whether to process a... | python | def performSearch(platformNames=[], queries=[], process=False, excludePlatformNames=[]):
"""
Method to perform the search itself on the different platforms.
Args:
-----
platforms: List of <Platform> objects.
queries: List of queries to be performed.
process: Whether to process a... | [
"def",
"performSearch",
"(",
"platformNames",
"=",
"[",
"]",
",",
"queries",
"=",
"[",
"]",
",",
"process",
"=",
"False",
",",
"excludePlatformNames",
"=",
"[",
"]",
")",
":",
"platforms",
"=",
"platform_selection",
".",
"getPlatformsByName",
"(",
"platformN... | Method to perform the search itself on the different platforms.
Args:
-----
platforms: List of <Platform> objects.
queries: List of queries to be performed.
process: Whether to process all the profiles... SLOW!
Returns:
--------
A list with the entities collected. | [
"Method",
"to",
"perform",
"the",
"search",
"itself",
"on",
"the",
"different",
"platforms",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/searchfy.py#L37-L60 | train |
i3visio/osrframework | osrframework/utils/platform_selection.py | getAllPlatformNames | def getAllPlatformNames(mode):
"""Method that defines the whole list of available parameters.
:param mode: The mode of the search. The following can be chosen: ["phonefy", "usufy", "searchfy"].
Return values:
Returns a list [] of strings for the platform objects.
"""
# Recov... | python | def getAllPlatformNames(mode):
"""Method that defines the whole list of available parameters.
:param mode: The mode of the search. The following can be chosen: ["phonefy", "usufy", "searchfy"].
Return values:
Returns a list [] of strings for the platform objects.
"""
# Recov... | [
"def",
"getAllPlatformNames",
"(",
"mode",
")",
":",
"platOptions",
"=",
"[",
"]",
"if",
"mode",
"in",
"[",
"\"phonefy\"",
",",
"\"usufy\"",
",",
"\"searchfy\"",
",",
"\"mailfy\"",
"]",
":",
"allPlatforms",
"=",
"getAllPlatformObjects",
"(",
"mode",
"=",
"mo... | Method that defines the whole list of available parameters.
:param mode: The mode of the search. The following can be chosen: ["phonefy", "usufy", "searchfy"].
Return values:
Returns a list [] of strings for the platform objects. | [
"Method",
"that",
"defines",
"the",
"whole",
"list",
"of",
"available",
"parameters",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/utils/platform_selection.py#L35-L62 | train |
i3visio/osrframework | osrframework/thirdparties/pipl_com/lib/utils.py | Serializable.from_json | def from_json(cls, json_str):
"""Deserialize the object from a JSON string."""
d = json.loads(json_str)
return cls.from_dict(d) | python | def from_json(cls, json_str):
"""Deserialize the object from a JSON string."""
d = json.loads(json_str)
return cls.from_dict(d) | [
"def",
"from_json",
"(",
"cls",
",",
"json_str",
")",
":",
"d",
"=",
"json",
".",
"loads",
"(",
"json_str",
")",
"return",
"cls",
".",
"from_dict",
"(",
"d",
")"
] | Deserialize the object from a JSON string. | [
"Deserialize",
"the",
"object",
"from",
"a",
"JSON",
"string",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/utils.py#L33-L36 | train |
i3visio/osrframework | osrframework/checkfy.py | createEmails | def createEmails(nicks=None, nicksFile=None):
"""
Method that globally permits to generate the emails to be checked.
Args:
-----
nicks: List of aliases.
nicksFile: The filepath to the aliases file.
Returns:
--------
list: list of emails to be checked.
"""
candid... | python | def createEmails(nicks=None, nicksFile=None):
"""
Method that globally permits to generate the emails to be checked.
Args:
-----
nicks: List of aliases.
nicksFile: The filepath to the aliases file.
Returns:
--------
list: list of emails to be checked.
"""
candid... | [
"def",
"createEmails",
"(",
"nicks",
"=",
"None",
",",
"nicksFile",
"=",
"None",
")",
":",
"candidate_emails",
"=",
"set",
"(",
")",
"if",
"nicks",
"!=",
"None",
":",
"for",
"n",
"in",
"nicks",
":",
"for",
"e",
"in",
"email_providers",
".",
"domains",
... | Method that globally permits to generate the emails to be checked.
Args:
-----
nicks: List of aliases.
nicksFile: The filepath to the aliases file.
Returns:
--------
list: list of emails to be checked. | [
"Method",
"that",
"globally",
"permits",
"to",
"generate",
"the",
"emails",
"to",
"be",
"checked",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/checkfy.py#L39-L63 | train |
i3visio/osrframework | osrframework/thirdparties/resolvethem_com/processing.py | checkIPFromAlias | def checkIPFromAlias(alias=None):
'''
Method that checks if the given alias is currently connected to Skype and returns its IP address.
:param alias: Alias to be searched.
:return: Python structure for the Json received. It has the following structure:
{
"type": "i3visio.ip",
... | python | def checkIPFromAlias(alias=None):
'''
Method that checks if the given alias is currently connected to Skype and returns its IP address.
:param alias: Alias to be searched.
:return: Python structure for the Json received. It has the following structure:
{
"type": "i3visio.ip",
... | [
"def",
"checkIPFromAlias",
"(",
"alias",
"=",
"None",
")",
":",
"headers",
"=",
"{",
"\"Content-type\"",
":",
"\"text/html\"",
",",
"\"Accept\"",
":",
"\"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\"",
",",
"\"Accept-Encoding\"",
":",
"\" gzip, deflate\"... | Method that checks if the given alias is currently connected to Skype and returns its IP address.
:param alias: Alias to be searched.
:return: Python structure for the Json received. It has the following structure:
{
"type": "i3visio.ip",
"value": "1.1.1.1",
"at... | [
"Method",
"that",
"checks",
"if",
"the",
"given",
"alias",
"is",
"currently",
"connected",
"to",
"Skype",
"and",
"returns",
"its",
"IP",
"address",
"."
] | 83437f4c14c9c08cb80a896bd9834c77f6567871 | https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/resolvethem_com/processing.py#L26-L65 | train |
jrief/djangocms-cascade | cmsplugin_cascade/sharable/forms.py | SharableGlossaryMixin.get_form | def get_form(self, request, obj=None, **kwargs):
"""
Extend the form for the given plugin with the form SharableCascadeForm
"""
Form = type(str('ExtSharableForm'), (SharableCascadeForm, kwargs.pop('form', self.form)), {})
Form.base_fields['shared_glossary'].limit_choices_to = dic... | python | def get_form(self, request, obj=None, **kwargs):
"""
Extend the form for the given plugin with the form SharableCascadeForm
"""
Form = type(str('ExtSharableForm'), (SharableCascadeForm, kwargs.pop('form', self.form)), {})
Form.base_fields['shared_glossary'].limit_choices_to = dic... | [
"def",
"get_form",
"(",
"self",
",",
"request",
",",
"obj",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"Form",
"=",
"type",
"(",
"str",
"(",
"'ExtSharableForm'",
")",
",",
"(",
"SharableCascadeForm",
",",
"kwargs",
".",
"pop",
"(",
"'form'",
",",
"s... | Extend the form for the given plugin with the form SharableCascadeForm | [
"Extend",
"the",
"form",
"for",
"the",
"given",
"plugin",
"with",
"the",
"form",
"SharableCascadeForm"
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/sharable/forms.py#L122-L129 | train |
jrief/djangocms-cascade | cmsplugin_cascade/bootstrap4/grid.py | Bootstrap4Column.get_min_max_bounds | def get_min_max_bounds(self):
"""
Return a dict of min- and max-values for the given column.
This is required to estimate the bounds of images.
"""
bound = Bound(999999.0, 0.0)
for bp in Breakpoint:
bound.extend(self.get_bound(bp))
return {'min': bound... | python | def get_min_max_bounds(self):
"""
Return a dict of min- and max-values for the given column.
This is required to estimate the bounds of images.
"""
bound = Bound(999999.0, 0.0)
for bp in Breakpoint:
bound.extend(self.get_bound(bp))
return {'min': bound... | [
"def",
"get_min_max_bounds",
"(",
"self",
")",
":",
"bound",
"=",
"Bound",
"(",
"999999.0",
",",
"0.0",
")",
"for",
"bp",
"in",
"Breakpoint",
":",
"bound",
".",
"extend",
"(",
"self",
".",
"get_bound",
"(",
"bp",
")",
")",
"return",
"{",
"'min'",
":"... | Return a dict of min- and max-values for the given column.
This is required to estimate the bounds of images. | [
"Return",
"a",
"dict",
"of",
"min",
"-",
"and",
"max",
"-",
"values",
"for",
"the",
"given",
"column",
".",
"This",
"is",
"required",
"to",
"estimate",
"the",
"bounds",
"of",
"images",
"."
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/bootstrap4/grid.py#L306-L314 | train |
jrief/djangocms-cascade | cmsplugin_cascade/plugin_base.py | create_proxy_model | def create_proxy_model(name, model_mixins, base_model, attrs=None, module=None):
"""
Create a Django Proxy Model on the fly, to be used by any Cascade Plugin.
"""
from django.apps import apps
class Meta:
proxy = True
app_label = 'cmsplugin_cascade'
name = str(name + 'Model')
... | python | def create_proxy_model(name, model_mixins, base_model, attrs=None, module=None):
"""
Create a Django Proxy Model on the fly, to be used by any Cascade Plugin.
"""
from django.apps import apps
class Meta:
proxy = True
app_label = 'cmsplugin_cascade'
name = str(name + 'Model')
... | [
"def",
"create_proxy_model",
"(",
"name",
",",
"model_mixins",
",",
"base_model",
",",
"attrs",
"=",
"None",
",",
"module",
"=",
"None",
")",
":",
"from",
"django",
".",
"apps",
"import",
"apps",
"class",
"Meta",
":",
"proxy",
"=",
"True",
"app_label",
"... | Create a Django Proxy Model on the fly, to be used by any Cascade Plugin. | [
"Create",
"a",
"Django",
"Proxy",
"Model",
"on",
"the",
"fly",
"to",
"be",
"used",
"by",
"any",
"Cascade",
"Plugin",
"."
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/plugin_base.py#L35-L53 | train |
jrief/djangocms-cascade | cmsplugin_cascade/plugin_base.py | CascadePluginBase._get_parent_classes_transparent | def _get_parent_classes_transparent(cls, slot, page, instance=None):
"""
Return all parent classes including those marked as "transparent".
"""
parent_classes = super(CascadePluginBase, cls).get_parent_classes(slot, page, instance)
if parent_classes is None:
if cls.ge... | python | def _get_parent_classes_transparent(cls, slot, page, instance=None):
"""
Return all parent classes including those marked as "transparent".
"""
parent_classes = super(CascadePluginBase, cls).get_parent_classes(slot, page, instance)
if parent_classes is None:
if cls.ge... | [
"def",
"_get_parent_classes_transparent",
"(",
"cls",
",",
"slot",
",",
"page",
",",
"instance",
"=",
"None",
")",
":",
"parent_classes",
"=",
"super",
"(",
"CascadePluginBase",
",",
"cls",
")",
".",
"get_parent_classes",
"(",
"slot",
",",
"page",
",",
"inst... | Return all parent classes including those marked as "transparent". | [
"Return",
"all",
"parent",
"classes",
"including",
"those",
"marked",
"as",
"transparent",
"."
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/plugin_base.py#L282-L295 | train |
jrief/djangocms-cascade | cmsplugin_cascade/plugin_base.py | CascadePluginBase.extend_children | def extend_children(self, parent, wanted_children, child_class, child_glossary=None):
"""
Extend the number of children so that the parent object contains wanted children.
No child will be removed if wanted_children is smaller than the current number of children.
"""
from cms.api... | python | def extend_children(self, parent, wanted_children, child_class, child_glossary=None):
"""
Extend the number of children so that the parent object contains wanted children.
No child will be removed if wanted_children is smaller than the current number of children.
"""
from cms.api... | [
"def",
"extend_children",
"(",
"self",
",",
"parent",
",",
"wanted_children",
",",
"child_class",
",",
"child_glossary",
"=",
"None",
")",
":",
"from",
"cms",
".",
"api",
"import",
"add_plugin",
"current_children",
"=",
"parent",
".",
"get_num_children",
"(",
... | Extend the number of children so that the parent object contains wanted children.
No child will be removed if wanted_children is smaller than the current number of children. | [
"Extend",
"the",
"number",
"of",
"children",
"so",
"that",
"the",
"parent",
"object",
"contains",
"wanted",
"children",
".",
"No",
"child",
"will",
"be",
"removed",
"if",
"wanted_children",
"is",
"smaller",
"than",
"the",
"current",
"number",
"of",
"children",... | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/plugin_base.py#L360-L371 | train |
jrief/djangocms-cascade | cmsplugin_cascade/plugin_base.py | CascadePluginBase.get_parent_instance | def get_parent_instance(self, request=None, obj=None):
"""
Get the parent model instance corresponding to this plugin. When adding a new plugin, the
parent might not be available. Therefore as fallback, pass in the request object.
"""
try:
parent_id = obj.parent_id
... | python | def get_parent_instance(self, request=None, obj=None):
"""
Get the parent model instance corresponding to this plugin. When adding a new plugin, the
parent might not be available. Therefore as fallback, pass in the request object.
"""
try:
parent_id = obj.parent_id
... | [
"def",
"get_parent_instance",
"(",
"self",
",",
"request",
"=",
"None",
",",
"obj",
"=",
"None",
")",
":",
"try",
":",
"parent_id",
"=",
"obj",
".",
"parent_id",
"except",
"AttributeError",
":",
"try",
":",
"parent_id",
"=",
"self",
".",
"parent",
".",
... | Get the parent model instance corresponding to this plugin. When adding a new plugin, the
parent might not be available. Therefore as fallback, pass in the request object. | [
"Get",
"the",
"parent",
"model",
"instance",
"corresponding",
"to",
"this",
"plugin",
".",
"When",
"adding",
"a",
"new",
"plugin",
"the",
"parent",
"might",
"not",
"be",
"available",
".",
"Therefore",
"as",
"fallback",
"pass",
"in",
"the",
"request",
"object... | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/plugin_base.py#L403-L432 | train |
jrief/djangocms-cascade | cmsplugin_cascade/plugin_base.py | CascadePluginBase.in_edit_mode | def in_edit_mode(self, request, placeholder):
"""
Returns True, if the plugin is in "edit mode".
"""
toolbar = getattr(request, 'toolbar', None)
edit_mode = getattr(toolbar, 'edit_mode', False) and getattr(placeholder, 'is_editable', True)
if edit_mode:
edit_m... | python | def in_edit_mode(self, request, placeholder):
"""
Returns True, if the plugin is in "edit mode".
"""
toolbar = getattr(request, 'toolbar', None)
edit_mode = getattr(toolbar, 'edit_mode', False) and getattr(placeholder, 'is_editable', True)
if edit_mode:
edit_m... | [
"def",
"in_edit_mode",
"(",
"self",
",",
"request",
",",
"placeholder",
")",
":",
"toolbar",
"=",
"getattr",
"(",
"request",
",",
"'toolbar'",
",",
"None",
")",
"edit_mode",
"=",
"getattr",
"(",
"toolbar",
",",
"'edit_mode'",
",",
"False",
")",
"and",
"g... | Returns True, if the plugin is in "edit mode". | [
"Returns",
"True",
"if",
"the",
"plugin",
"is",
"in",
"edit",
"mode",
"."
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/plugin_base.py#L480-L488 | train |
jrief/djangocms-cascade | cmsplugin_cascade/segmentation/cms_plugins.py | SegmentPlugin._get_previous_open_tag | def _get_previous_open_tag(self, obj):
"""
Return the open tag of the previous sibling
"""
prev_instance = self.get_previous_instance(obj)
if prev_instance and prev_instance.plugin_type == self.__class__.__name__:
return prev_instance.glossary.get('open_tag') | python | def _get_previous_open_tag(self, obj):
"""
Return the open tag of the previous sibling
"""
prev_instance = self.get_previous_instance(obj)
if prev_instance and prev_instance.plugin_type == self.__class__.__name__:
return prev_instance.glossary.get('open_tag') | [
"def",
"_get_previous_open_tag",
"(",
"self",
",",
"obj",
")",
":",
"prev_instance",
"=",
"self",
".",
"get_previous_instance",
"(",
"obj",
")",
"if",
"prev_instance",
"and",
"prev_instance",
".",
"plugin_type",
"==",
"self",
".",
"__class__",
".",
"__name__",
... | Return the open tag of the previous sibling | [
"Return",
"the",
"open",
"tag",
"of",
"the",
"previous",
"sibling"
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/segmentation/cms_plugins.py#L170-L176 | train |
jrief/djangocms-cascade | cmsplugin_cascade/generic/mixins.py | SectionForm.check_unique_element_id | def check_unique_element_id(cls, instance, element_id):
"""
Check for uniqueness of the given element_id for the current page.
Return None if instance is not yet associated with a page.
"""
try:
element_ids = instance.placeholder.page.cascadepage.glossary.get('element... | python | def check_unique_element_id(cls, instance, element_id):
"""
Check for uniqueness of the given element_id for the current page.
Return None if instance is not yet associated with a page.
"""
try:
element_ids = instance.placeholder.page.cascadepage.glossary.get('element... | [
"def",
"check_unique_element_id",
"(",
"cls",
",",
"instance",
",",
"element_id",
")",
":",
"try",
":",
"element_ids",
"=",
"instance",
".",
"placeholder",
".",
"page",
".",
"cascadepage",
".",
"glossary",
".",
"get",
"(",
"'element_ids'",
",",
"{",
"}",
"... | Check for uniqueness of the given element_id for the current page.
Return None if instance is not yet associated with a page. | [
"Check",
"for",
"uniqueness",
"of",
"the",
"given",
"element_id",
"for",
"the",
"current",
"page",
".",
"Return",
"None",
"if",
"instance",
"is",
"not",
"yet",
"associated",
"with",
"a",
"page",
"."
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/generic/mixins.py#L20-L34 | train |
jrief/djangocms-cascade | cmsplugin_cascade/utils.py | rectify_partial_form_field | def rectify_partial_form_field(base_field, partial_form_fields):
"""
In base_field reset the attributes label and help_text, since they are overriden by the
partial field. Additionally, from the list, or list of lists of partial_form_fields
append the bound validator methods to the given base field.
... | python | def rectify_partial_form_field(base_field, partial_form_fields):
"""
In base_field reset the attributes label and help_text, since they are overriden by the
partial field. Additionally, from the list, or list of lists of partial_form_fields
append the bound validator methods to the given base field.
... | [
"def",
"rectify_partial_form_field",
"(",
"base_field",
",",
"partial_form_fields",
")",
":",
"base_field",
".",
"label",
"=",
"''",
"base_field",
".",
"help_text",
"=",
"''",
"for",
"fieldset",
"in",
"partial_form_fields",
":",
"if",
"not",
"isinstance",
"(",
"... | In base_field reset the attributes label and help_text, since they are overriden by the
partial field. Additionally, from the list, or list of lists of partial_form_fields
append the bound validator methods to the given base field. | [
"In",
"base_field",
"reset",
"the",
"attributes",
"label",
"and",
"help_text",
"since",
"they",
"are",
"overriden",
"by",
"the",
"partial",
"field",
".",
"Additionally",
"from",
"the",
"list",
"or",
"list",
"of",
"lists",
"of",
"partial_form_fields",
"append",
... | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/utils.py#L16-L28 | train |
jrief/djangocms-cascade | cmsplugin_cascade/utils.py | validate_link | def validate_link(link_data):
"""
Check if the given model exists, otherwise raise a Validation error
"""
from django.apps import apps
try:
Model = apps.get_model(*link_data['model'].split('.'))
Model.objects.get(pk=link_data['pk'])
except Model.DoesNotExist:
raise Valid... | python | def validate_link(link_data):
"""
Check if the given model exists, otherwise raise a Validation error
"""
from django.apps import apps
try:
Model = apps.get_model(*link_data['model'].split('.'))
Model.objects.get(pk=link_data['pk'])
except Model.DoesNotExist:
raise Valid... | [
"def",
"validate_link",
"(",
"link_data",
")",
":",
"from",
"django",
".",
"apps",
"import",
"apps",
"try",
":",
"Model",
"=",
"apps",
".",
"get_model",
"(",
"*",
"link_data",
"[",
"'model'",
"]",
".",
"split",
"(",
"'.'",
")",
")",
"Model",
".",
"ob... | Check if the given model exists, otherwise raise a Validation error | [
"Check",
"if",
"the",
"given",
"model",
"exists",
"otherwise",
"raise",
"a",
"Validation",
"error"
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/utils.py#L30-L40 | train |
jrief/djangocms-cascade | cmsplugin_cascade/utils.py | parse_responsive_length | def parse_responsive_length(responsive_length):
"""
Takes a string containing a length definition in pixels or percent and parses it to obtain
a computational length. It returns a tuple where the first element is the length in pixels and
the second element is its length in percent divided by 100.
No... | python | def parse_responsive_length(responsive_length):
"""
Takes a string containing a length definition in pixels or percent and parses it to obtain
a computational length. It returns a tuple where the first element is the length in pixels and
the second element is its length in percent divided by 100.
No... | [
"def",
"parse_responsive_length",
"(",
"responsive_length",
")",
":",
"responsive_length",
"=",
"responsive_length",
".",
"strip",
"(",
")",
"if",
"responsive_length",
".",
"endswith",
"(",
"'px'",
")",
":",
"return",
"(",
"int",
"(",
"responsive_length",
".",
"... | Takes a string containing a length definition in pixels or percent and parses it to obtain
a computational length. It returns a tuple where the first element is the length in pixels and
the second element is its length in percent divided by 100.
Note that one of both returned elements is None. | [
"Takes",
"a",
"string",
"containing",
"a",
"length",
"definition",
"in",
"pixels",
"or",
"percent",
"and",
"parses",
"it",
"to",
"obtain",
"a",
"computational",
"length",
".",
"It",
"returns",
"a",
"tuple",
"where",
"the",
"first",
"element",
"is",
"the",
... | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/utils.py#L71-L83 | train |
jrief/djangocms-cascade | cmsplugin_cascade/mixins.py | CascadePluginMixin.get_css_classes | def get_css_classes(cls, instance):
"""
Returns a list of CSS classes to be added as class="..." to the current HTML tag.
"""
css_classes = []
if hasattr(cls, 'default_css_class'):
css_classes.append(cls.default_css_class)
for attr in getattr(cls, 'default_css... | python | def get_css_classes(cls, instance):
"""
Returns a list of CSS classes to be added as class="..." to the current HTML tag.
"""
css_classes = []
if hasattr(cls, 'default_css_class'):
css_classes.append(cls.default_css_class)
for attr in getattr(cls, 'default_css... | [
"def",
"get_css_classes",
"(",
"cls",
",",
"instance",
")",
":",
"css_classes",
"=",
"[",
"]",
"if",
"hasattr",
"(",
"cls",
",",
"'default_css_class'",
")",
":",
"css_classes",
".",
"append",
"(",
"cls",
".",
"default_css_class",
")",
"for",
"attr",
"in",
... | Returns a list of CSS classes to be added as class="..." to the current HTML tag. | [
"Returns",
"a",
"list",
"of",
"CSS",
"classes",
"to",
"be",
"added",
"as",
"class",
"=",
"...",
"to",
"the",
"current",
"HTML",
"tag",
"."
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/mixins.py#L27-L40 | train |
jrief/djangocms-cascade | cmsplugin_cascade/mixins.py | CascadePluginMixin.get_inline_styles | def get_inline_styles(cls, instance):
"""
Returns a dictionary of CSS attributes to be added as style="..." to the current HTML tag.
"""
inline_styles = getattr(cls, 'default_inline_styles', {})
css_style = instance.glossary.get('inline_styles')
if css_style:
... | python | def get_inline_styles(cls, instance):
"""
Returns a dictionary of CSS attributes to be added as style="..." to the current HTML tag.
"""
inline_styles = getattr(cls, 'default_inline_styles', {})
css_style = instance.glossary.get('inline_styles')
if css_style:
... | [
"def",
"get_inline_styles",
"(",
"cls",
",",
"instance",
")",
":",
"inline_styles",
"=",
"getattr",
"(",
"cls",
",",
"'default_inline_styles'",
",",
"{",
"}",
")",
"css_style",
"=",
"instance",
".",
"glossary",
".",
"get",
"(",
"'inline_styles'",
")",
"if",
... | Returns a dictionary of CSS attributes to be added as style="..." to the current HTML tag. | [
"Returns",
"a",
"dictionary",
"of",
"CSS",
"attributes",
"to",
"be",
"added",
"as",
"style",
"=",
"...",
"to",
"the",
"current",
"HTML",
"tag",
"."
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/mixins.py#L43-L51 | train |
jrief/djangocms-cascade | cmsplugin_cascade/mixins.py | CascadePluginMixin.get_html_tag_attributes | def get_html_tag_attributes(cls, instance):
"""
Returns a dictionary of attributes, which shall be added to the current HTML tag.
This method normally is called by the models's property method ``html_tag_ attributes``,
which enriches the HTML tag with those attributes converted to a list... | python | def get_html_tag_attributes(cls, instance):
"""
Returns a dictionary of attributes, which shall be added to the current HTML tag.
This method normally is called by the models's property method ``html_tag_ attributes``,
which enriches the HTML tag with those attributes converted to a list... | [
"def",
"get_html_tag_attributes",
"(",
"cls",
",",
"instance",
")",
":",
"attributes",
"=",
"getattr",
"(",
"cls",
",",
"'html_tag_attributes'",
",",
"{",
"}",
")",
"return",
"dict",
"(",
"(",
"attr",
",",
"instance",
".",
"glossary",
".",
"get",
"(",
"k... | Returns a dictionary of attributes, which shall be added to the current HTML tag.
This method normally is called by the models's property method ``html_tag_ attributes``,
which enriches the HTML tag with those attributes converted to a list as
``attr1="val1" attr2="val2" ...``. | [
"Returns",
"a",
"dictionary",
"of",
"attributes",
"which",
"shall",
"be",
"added",
"to",
"the",
"current",
"HTML",
"tag",
".",
"This",
"method",
"normally",
"is",
"called",
"by",
"the",
"models",
"s",
"property",
"method",
"html_tag_",
"attributes",
"which",
... | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/mixins.py#L54-L62 | train |
jrief/djangocms-cascade | cmsplugin_cascade/widgets.py | CascadingSizeWidgetMixin.compile_validation_pattern | def compile_validation_pattern(self, units=None):
"""
Assure that passed in units are valid size units, or if missing, use all possible units.
Return a tuple with a regular expression to be used for validating and an error message
in case this validation failed.
"""
if un... | python | def compile_validation_pattern(self, units=None):
"""
Assure that passed in units are valid size units, or if missing, use all possible units.
Return a tuple with a regular expression to be used for validating and an error message
in case this validation failed.
"""
if un... | [
"def",
"compile_validation_pattern",
"(",
"self",
",",
"units",
"=",
"None",
")",
":",
"if",
"units",
"is",
"None",
":",
"units",
"=",
"list",
"(",
"self",
".",
"POSSIBLE_UNITS",
")",
"else",
":",
"for",
"u",
"in",
"units",
":",
"if",
"u",
"not",
"in... | Assure that passed in units are valid size units, or if missing, use all possible units.
Return a tuple with a regular expression to be used for validating and an error message
in case this validation failed. | [
"Assure",
"that",
"passed",
"in",
"units",
"are",
"valid",
"size",
"units",
"or",
"if",
"missing",
"use",
"all",
"possible",
"units",
".",
"Return",
"a",
"tuple",
"with",
"a",
"regular",
"expression",
"to",
"be",
"used",
"for",
"validating",
"and",
"an",
... | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/widgets.py#L108-L123 | train |
jrief/djangocms-cascade | cmsplugin_cascade/link/forms.py | LinkForm.unset_required_for | def unset_required_for(cls, sharable_fields):
"""
Fields borrowed by `SharedGlossaryAdmin` to build its temporary change form, only are
required if they are declared in `sharable_fields`. Otherwise just deactivate them.
"""
if 'link_content' in cls.base_fields and 'link_content' ... | python | def unset_required_for(cls, sharable_fields):
"""
Fields borrowed by `SharedGlossaryAdmin` to build its temporary change form, only are
required if they are declared in `sharable_fields`. Otherwise just deactivate them.
"""
if 'link_content' in cls.base_fields and 'link_content' ... | [
"def",
"unset_required_for",
"(",
"cls",
",",
"sharable_fields",
")",
":",
"if",
"'link_content'",
"in",
"cls",
".",
"base_fields",
"and",
"'link_content'",
"not",
"in",
"sharable_fields",
":",
"cls",
".",
"base_fields",
"[",
"'link_content'",
"]",
".",
"require... | Fields borrowed by `SharedGlossaryAdmin` to build its temporary change form, only are
required if they are declared in `sharable_fields`. Otherwise just deactivate them. | [
"Fields",
"borrowed",
"by",
"SharedGlossaryAdmin",
"to",
"build",
"its",
"temporary",
"change",
"form",
"only",
"are",
"required",
"if",
"they",
"are",
"declared",
"in",
"sharable_fields",
".",
"Otherwise",
"just",
"deactivate",
"them",
"."
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/link/forms.py#L260-L268 | train |
jrief/djangocms-cascade | cmsplugin_cascade/models.py | CascadePage.assure_relation | def assure_relation(cls, cms_page):
"""
Assure that we have a foreign key relation, pointing from CascadePage onto CMSPage.
"""
try:
cms_page.cascadepage
except cls.DoesNotExist:
cls.objects.create(extended_object=cms_page) | python | def assure_relation(cls, cms_page):
"""
Assure that we have a foreign key relation, pointing from CascadePage onto CMSPage.
"""
try:
cms_page.cascadepage
except cls.DoesNotExist:
cls.objects.create(extended_object=cms_page) | [
"def",
"assure_relation",
"(",
"cls",
",",
"cms_page",
")",
":",
"try",
":",
"cms_page",
".",
"cascadepage",
"except",
"cls",
".",
"DoesNotExist",
":",
"cls",
".",
"objects",
".",
"create",
"(",
"extended_object",
"=",
"cms_page",
")"
] | Assure that we have a foreign key relation, pointing from CascadePage onto CMSPage. | [
"Assure",
"that",
"we",
"have",
"a",
"foreign",
"key",
"relation",
"pointing",
"from",
"CascadePage",
"onto",
"CMSPage",
"."
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/models.py#L371-L378 | train |
jrief/djangocms-cascade | cmsplugin_cascade/bootstrap3/utils.py | compute_media_queries | def compute_media_queries(element):
"""
For e given Cascade element, compute the current media queries for each breakpoint,
even for nested containers, rows and columns.
"""
parent_glossary = element.get_parent_glossary()
# compute the max width and the required media queries for each chosen bre... | python | def compute_media_queries(element):
"""
For e given Cascade element, compute the current media queries for each breakpoint,
even for nested containers, rows and columns.
"""
parent_glossary = element.get_parent_glossary()
# compute the max width and the required media queries for each chosen bre... | [
"def",
"compute_media_queries",
"(",
"element",
")",
":",
"parent_glossary",
"=",
"element",
".",
"get_parent_glossary",
"(",
")",
"element",
".",
"glossary",
"[",
"'container_max_widths'",
"]",
"=",
"max_widths",
"=",
"{",
"}",
"element",
".",
"glossary",
"[",
... | For e given Cascade element, compute the current media queries for each breakpoint,
even for nested containers, rows and columns. | [
"For",
"e",
"given",
"Cascade",
"element",
"compute",
"the",
"current",
"media",
"queries",
"for",
"each",
"breakpoint",
"even",
"for",
"nested",
"containers",
"rows",
"and",
"columns",
"."
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/bootstrap3/utils.py#L63-L90 | train |
jrief/djangocms-cascade | cmsplugin_cascade/fields.py | GlossaryField.get_element_ids | def get_element_ids(self, prefix_id):
"""
Returns a single or a list of element ids, one for each input widget of this field
"""
if isinstance(self.widget, widgets.MultiWidget):
ids = ['{0}_{1}_{2}'.format(prefix_id, self.name, field_name) for field_name in self.widget]
... | python | def get_element_ids(self, prefix_id):
"""
Returns a single or a list of element ids, one for each input widget of this field
"""
if isinstance(self.widget, widgets.MultiWidget):
ids = ['{0}_{1}_{2}'.format(prefix_id, self.name, field_name) for field_name in self.widget]
... | [
"def",
"get_element_ids",
"(",
"self",
",",
"prefix_id",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"widget",
",",
"widgets",
".",
"MultiWidget",
")",
":",
"ids",
"=",
"[",
"'{0}_{1}_{2}'",
".",
"format",
"(",
"prefix_id",
",",
"self",
".",
"name",
... | Returns a single or a list of element ids, one for each input widget of this field | [
"Returns",
"a",
"single",
"or",
"a",
"list",
"of",
"element",
"ids",
"one",
"for",
"each",
"input",
"widget",
"of",
"this",
"field"
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/fields.py#L50-L60 | train |
jrief/djangocms-cascade | cmsplugin_cascade/segmentation/mixins.py | EmulateUserModelMixin.get_context_override | def get_context_override(self, request):
"""
Override the request object with an emulated user.
"""
context_override = super(EmulateUserModelMixin, self).get_context_override(request)
try:
if request.user.is_staff:
user = self.UserModel.objects.get(pk=... | python | def get_context_override(self, request):
"""
Override the request object with an emulated user.
"""
context_override = super(EmulateUserModelMixin, self).get_context_override(request)
try:
if request.user.is_staff:
user = self.UserModel.objects.get(pk=... | [
"def",
"get_context_override",
"(",
"self",
",",
"request",
")",
":",
"context_override",
"=",
"super",
"(",
"EmulateUserModelMixin",
",",
"self",
")",
".",
"get_context_override",
"(",
"request",
")",
"try",
":",
"if",
"request",
".",
"user",
".",
"is_staff",... | Override the request object with an emulated user. | [
"Override",
"the",
"request",
"object",
"with",
"an",
"emulated",
"user",
"."
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/segmentation/mixins.py#L48-L59 | train |
jrief/djangocms-cascade | cmsplugin_cascade/segmentation/mixins.py | EmulateUserAdminMixin.emulate_users | def emulate_users(self, request):
"""
The list view
"""
def display_as_link(self, obj):
try:
identifier = getattr(user_model_admin, list_display_link)(obj)
except AttributeError:
identifier = admin.utils.lookup_field(list_display_li... | python | def emulate_users(self, request):
"""
The list view
"""
def display_as_link(self, obj):
try:
identifier = getattr(user_model_admin, list_display_link)(obj)
except AttributeError:
identifier = admin.utils.lookup_field(list_display_li... | [
"def",
"emulate_users",
"(",
"self",
",",
"request",
")",
":",
"def",
"display_as_link",
"(",
"self",
",",
"obj",
")",
":",
"try",
":",
"identifier",
"=",
"getattr",
"(",
"user_model_admin",
",",
"list_display_link",
")",
"(",
"obj",
")",
"except",
"Attrib... | The list view | [
"The",
"list",
"view"
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/segmentation/mixins.py#L88-L159 | train |
jrief/djangocms-cascade | cmsplugin_cascade/apps.py | CascadeConfig.pre_migrate | def pre_migrate(cls, sender=None, **kwargs):
"""
Iterate over contenttypes and remove those not in proxy models
"""
ContentType = apps.get_model('contenttypes', 'ContentType')
try:
queryset = ContentType.objects.filter(app_label=sender.label)
for ctype in ... | python | def pre_migrate(cls, sender=None, **kwargs):
"""
Iterate over contenttypes and remove those not in proxy models
"""
ContentType = apps.get_model('contenttypes', 'ContentType')
try:
queryset = ContentType.objects.filter(app_label=sender.label)
for ctype in ... | [
"def",
"pre_migrate",
"(",
"cls",
",",
"sender",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"ContentType",
"=",
"apps",
".",
"get_model",
"(",
"'contenttypes'",
",",
"'ContentType'",
")",
"try",
":",
"queryset",
"=",
"ContentType",
".",
"objects",
".",
... | Iterate over contenttypes and remove those not in proxy models | [
"Iterate",
"over",
"contenttypes",
"and",
"remove",
"those",
"not",
"in",
"proxy",
"models"
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/apps.py#L29-L42 | train |
jrief/djangocms-cascade | cmsplugin_cascade/apps.py | CascadeConfig.post_migrate | def post_migrate(cls, sender=None, **kwargs):
"""
Iterate over fake_proxy_models and add contenttypes and permissions for missing proxy
models, if this has not been done by Django yet
"""
ContentType = apps.get_model('contenttypes', 'ContentType')
for model_name, proxy_m... | python | def post_migrate(cls, sender=None, **kwargs):
"""
Iterate over fake_proxy_models and add contenttypes and permissions for missing proxy
models, if this has not been done by Django yet
"""
ContentType = apps.get_model('contenttypes', 'ContentType')
for model_name, proxy_m... | [
"def",
"post_migrate",
"(",
"cls",
",",
"sender",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"ContentType",
"=",
"apps",
".",
"get_model",
"(",
"'contenttypes'",
",",
"'ContentType'",
")",
"for",
"model_name",
",",
"proxy_model",
"in",
"sender",
".",
"get... | Iterate over fake_proxy_models and add contenttypes and permissions for missing proxy
models, if this has not been done by Django yet | [
"Iterate",
"over",
"fake_proxy_models",
"and",
"add",
"contenttypes",
"and",
"permissions",
"for",
"missing",
"proxy",
"models",
"if",
"this",
"has",
"not",
"been",
"done",
"by",
"Django",
"yet"
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/apps.py#L45-L55 | train |
jrief/djangocms-cascade | cmsplugin_cascade/apps.py | CascadeConfig.grant_permissions | def grant_permissions(self, proxy_model):
"""
Create the default permissions for the just added proxy model
"""
ContentType = apps.get_model('contenttypes', 'ContentType')
try:
Permission = apps.get_model('auth', 'Permission')
except LookupError:
r... | python | def grant_permissions(self, proxy_model):
"""
Create the default permissions for the just added proxy model
"""
ContentType = apps.get_model('contenttypes', 'ContentType')
try:
Permission = apps.get_model('auth', 'Permission')
except LookupError:
r... | [
"def",
"grant_permissions",
"(",
"self",
",",
"proxy_model",
")",
":",
"ContentType",
"=",
"apps",
".",
"get_model",
"(",
"'contenttypes'",
",",
"'ContentType'",
")",
"try",
":",
"Permission",
"=",
"apps",
".",
"get_model",
"(",
"'auth'",
",",
"'Permission'",
... | Create the default permissions for the just added proxy model | [
"Create",
"the",
"default",
"permissions",
"for",
"the",
"just",
"added",
"proxy",
"model"
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/apps.py#L67-L95 | train |
jrief/djangocms-cascade | cmsplugin_cascade/apps.py | CascadeConfig.revoke_permissions | def revoke_permissions(self, ctype):
"""
Remove all permissions for the content type to be removed
"""
ContentType = apps.get_model('contenttypes', 'ContentType')
try:
Permission = apps.get_model('auth', 'Permission')
except LookupError:
return
... | python | def revoke_permissions(self, ctype):
"""
Remove all permissions for the content type to be removed
"""
ContentType = apps.get_model('contenttypes', 'ContentType')
try:
Permission = apps.get_model('auth', 'Permission')
except LookupError:
return
... | [
"def",
"revoke_permissions",
"(",
"self",
",",
"ctype",
")",
":",
"ContentType",
"=",
"apps",
".",
"get_model",
"(",
"'contenttypes'",
",",
"'ContentType'",
")",
"try",
":",
"Permission",
"=",
"apps",
".",
"get_model",
"(",
"'auth'",
",",
"'Permission'",
")"... | Remove all permissions for the content type to be removed | [
"Remove",
"all",
"permissions",
"for",
"the",
"content",
"type",
"to",
"be",
"removed"
] | 58996f990c4068e5d50f0db6030a5c0e06b682e5 | https://github.com/jrief/djangocms-cascade/blob/58996f990c4068e5d50f0db6030a5c0e06b682e5/cmsplugin_cascade/apps.py#L97-L110 | train |
adamreeve/npTDMS | nptdms/writer.py | to_file | def to_file(file, array):
"""Wrapper around ndarray.tofile to support any file-like object"""
try:
array.tofile(file)
except (TypeError, IOError, UnsupportedOperation):
# tostring actually returns bytes
file.write(array.tostring()) | python | def to_file(file, array):
"""Wrapper around ndarray.tofile to support any file-like object"""
try:
array.tofile(file)
except (TypeError, IOError, UnsupportedOperation):
# tostring actually returns bytes
file.write(array.tostring()) | [
"def",
"to_file",
"(",
"file",
",",
"array",
")",
":",
"try",
":",
"array",
".",
"tofile",
"(",
"file",
")",
"except",
"(",
"TypeError",
",",
"IOError",
",",
"UnsupportedOperation",
")",
":",
"file",
".",
"write",
"(",
"array",
".",
"tostring",
"(",
... | Wrapper around ndarray.tofile to support any file-like object | [
"Wrapper",
"around",
"ndarray",
".",
"tofile",
"to",
"support",
"any",
"file",
"-",
"like",
"object"
] | d7d6632d4ebc2e78ed941477c2f1c56bd7493d74 | https://github.com/adamreeve/npTDMS/blob/d7d6632d4ebc2e78ed941477c2f1c56bd7493d74/nptdms/writer.py#L317-L324 | train |
adamreeve/npTDMS | nptdms/writer.py | TdmsWriter.write_segment | def write_segment(self, objects):
""" Write a segment of data to a TDMS file
:param objects: A list of TdmsObject instances to write
"""
segment = TdmsSegment(objects)
segment.write(self._file) | python | def write_segment(self, objects):
""" Write a segment of data to a TDMS file
:param objects: A list of TdmsObject instances to write
"""
segment = TdmsSegment(objects)
segment.write(self._file) | [
"def",
"write_segment",
"(",
"self",
",",
"objects",
")",
":",
"segment",
"=",
"TdmsSegment",
"(",
"objects",
")",
"segment",
".",
"write",
"(",
"self",
".",
"_file",
")"
] | Write a segment of data to a TDMS file
:param objects: A list of TdmsObject instances to write | [
"Write",
"a",
"segment",
"of",
"data",
"to",
"a",
"TDMS",
"file"
] | d7d6632d4ebc2e78ed941477c2f1c56bd7493d74 | https://github.com/adamreeve/npTDMS/blob/d7d6632d4ebc2e78ed941477c2f1c56bd7493d74/nptdms/writer.py#L63-L69 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.