hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0a678d8ba8986aa3adb90ad49402f8484b064476 | kilrau/lnbits-legend | lnbits/extensions/streamalerts/views_api.py | [
"MIT"
] | Python | api_get_access | <not_specific> | async def api_get_access(service_id, request: Request):
"""Redirect to Streamlabs' Approve/Decline page for API access for Service
with service_id
"""
service = await get_service(service_id)
if service:
redirect_uri = await get_service_redirect_uri(request, service_id)
params = {
... | Redirect to Streamlabs' Approve/Decline page for API access for Service
with service_id
| Redirect to Streamlabs' Approve/Decline page for API access for Service
with service_id | [
"Redirect",
"to",
"Streamlabs",
"'",
"Approve",
"/",
"Decline",
"page",
"for",
"API",
"access",
"for",
"Service",
"with",
"service_id"
] | async def api_get_access(service_id, request: Request):
service = await get_service(service_id)
if service:
redirect_uri = await get_service_redirect_uri(request, service_id)
params = {
"response_type": "code",
"client_id": service.client_id,
"redirect_uri": r... | [
"async",
"def",
"api_get_access",
"(",
"service_id",
",",
"request",
":",
"Request",
")",
":",
"service",
"=",
"await",
"get_service",
"(",
"service_id",
")",
"if",
"service",
":",
"redirect_uri",
"=",
"await",
"get_service_redirect_uri",
"(",
"request",
",",
... | Redirect to Streamlabs' Approve/Decline page for API access for Service
with service_id | [
"Redirect",
"to",
"Streamlabs",
"'",
"Approve",
"/",
"Decline",
"page",
"for",
"API",
"access",
"for",
"Service",
"with",
"service_id"
] | [
"\"\"\"Redirect to Streamlabs' Approve/Decline page for API access for Service\n with service_id\n \"\"\""
] | [
{
"param": "service_id",
"type": null
},
{
"param": "request",
"type": "Request"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "service_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "request",
"type": "Request",
"docstring": null,
"docstr... |
0a678d8ba8986aa3adb90ad49402f8484b064476 | kilrau/lnbits-legend | lnbits/extensions/streamalerts/views_api.py | [
"MIT"
] | Python | api_authenticate_service | <not_specific> | async def api_authenticate_service(
service_id, request: Request, code: str = Query(...), state: str = Query(...)
):
"""Endpoint visited via redirect during third party API authentication
If successful, an API access token will be added to the service, and
the user will be redirected to index.html.
... | Endpoint visited via redirect during third party API authentication
If successful, an API access token will be added to the service, and
the user will be redirected to index.html.
| Endpoint visited via redirect during third party API authentication
If successful, an API access token will be added to the service, and
the user will be redirected to index.html. | [
"Endpoint",
"visited",
"via",
"redirect",
"during",
"third",
"party",
"API",
"authentication",
"If",
"successful",
"an",
"API",
"access",
"token",
"will",
"be",
"added",
"to",
"the",
"service",
"and",
"the",
"user",
"will",
"be",
"redirected",
"to",
"index",
... | async def api_authenticate_service(
service_id, request: Request, code: str = Query(...), state: str = Query(...)
):
service = await get_service(service_id)
if service.state != state:
raise HTTPException(
status_code=HTTPStatus.BAD_REQUEST, detail="State doesn't match!"
)
red... | [
"async",
"def",
"api_authenticate_service",
"(",
"service_id",
",",
"request",
":",
"Request",
",",
"code",
":",
"str",
"=",
"Query",
"(",
"...",
")",
",",
"state",
":",
"str",
"=",
"Query",
"(",
"...",
")",
")",
":",
"service",
"=",
"await",
"get_serv... | Endpoint visited via redirect during third party API authentication
If successful, an API access token will be added to the service, and
the user will be redirected to index.html. | [
"Endpoint",
"visited",
"via",
"redirect",
"during",
"third",
"party",
"API",
"authentication",
"If",
"successful",
"an",
"API",
"access",
"token",
"will",
"be",
"added",
"to",
"the",
"service",
"and",
"the",
"user",
"will",
"be",
"redirected",
"to",
"index",
... | [
"\"\"\"Endpoint visited via redirect during third party API authentication\n\n If successful, an API access token will be added to the service, and\n the user will be redirected to index.html.\n \"\"\""
] | [
{
"param": "service_id",
"type": null
},
{
"param": "request",
"type": "Request"
},
{
"param": "code",
"type": "str"
},
{
"param": "state",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "service_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "request",
"type": "Request",
"docstring": null,
"docstr... |
0a678d8ba8986aa3adb90ad49402f8484b064476 | kilrau/lnbits-legend | lnbits/extensions/streamalerts/views_api.py | [
"MIT"
] | Python | api_create_donation | <not_specific> | async def api_create_donation(data: CreateDonation, request: Request):
"""Take data from donation form and return satspay charge"""
# Currency is hardcoded while frotnend is limited
cur_code = "USD"
sats = data.sats
message = data.message
# Fiat amount is calculated here while frontend is limite... | Take data from donation form and return satspay charge | Take data from donation form and return satspay charge | [
"Take",
"data",
"from",
"donation",
"form",
"and",
"return",
"satspay",
"charge"
] | async def api_create_donation(data: CreateDonation, request: Request):
cur_code = "USD"
sats = data.sats
message = data.message
price = await btc_price(cur_code)
amount = sats * (10 ** (-8)) * price
webhook_base = request.url.scheme + "://" + request.headers["Host"]
service_id = data.service... | [
"async",
"def",
"api_create_donation",
"(",
"data",
":",
"CreateDonation",
",",
"request",
":",
"Request",
")",
":",
"cur_code",
"=",
"\"USD\"",
"sats",
"=",
"data",
".",
"sats",
"message",
"=",
"data",
".",
"message",
"price",
"=",
"await",
"btc_price",
"... | Take data from donation form and return satspay charge | [
"Take",
"data",
"from",
"donation",
"form",
"and",
"return",
"satspay",
"charge"
] | [
"\"\"\"Take data from donation form and return satspay charge\"\"\"",
"# Currency is hardcoded while frotnend is limited",
"# Fiat amount is calculated here while frontend is limited"
] | [
{
"param": "data",
"type": "CreateDonation"
},
{
"param": "request",
"type": "Request"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": "CreateDonation",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "request",
"type": "Request",
"docstring": null,
"... |
0a678d8ba8986aa3adb90ad49402f8484b064476 | kilrau/lnbits-legend | lnbits/extensions/streamalerts/views_api.py | [
"MIT"
] | Python | api_post_donation | <not_specific> | async def api_post_donation(request: Request, data: ValidateDonation):
"""Post a paid donation to Stremalabs/StreamElements.
This endpoint acts as a webhook for the SatsPayServer extension."""
donation_id = data.id
charge = await get_charge(donation_id)
if charge and charge.paid:
return awa... | Post a paid donation to Stremalabs/StreamElements.
This endpoint acts as a webhook for the SatsPayServer extension. | Post a paid donation to Stremalabs/StreamElements.
This endpoint acts as a webhook for the SatsPayServer extension. | [
"Post",
"a",
"paid",
"donation",
"to",
"Stremalabs",
"/",
"StreamElements",
".",
"This",
"endpoint",
"acts",
"as",
"a",
"webhook",
"for",
"the",
"SatsPayServer",
"extension",
"."
] | async def api_post_donation(request: Request, data: ValidateDonation):
donation_id = data.id
charge = await get_charge(donation_id)
if charge and charge.paid:
return await post_donation(donation_id)
else:
raise HTTPException(
status_code=HTTPStatus.BAD_REQUEST, detail="Not a ... | [
"async",
"def",
"api_post_donation",
"(",
"request",
":",
"Request",
",",
"data",
":",
"ValidateDonation",
")",
":",
"donation_id",
"=",
"data",
".",
"id",
"charge",
"=",
"await",
"get_charge",
"(",
"donation_id",
")",
"if",
"charge",
"and",
"charge",
".",
... | Post a paid donation to Stremalabs/StreamElements. | [
"Post",
"a",
"paid",
"donation",
"to",
"Stremalabs",
"/",
"StreamElements",
"."
] | [
"\"\"\"Post a paid donation to Stremalabs/StreamElements.\n This endpoint acts as a webhook for the SatsPayServer extension.\"\"\""
] | [
{
"param": "request",
"type": "Request"
},
{
"param": "data",
"type": "ValidateDonation"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": "Request",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "ValidateDonation",
"docstring": null,
... |
0a678d8ba8986aa3adb90ad49402f8484b064476 | kilrau/lnbits-legend | lnbits/extensions/streamalerts/views_api.py | [
"MIT"
] | Python | api_get_services | <not_specific> | async def api_get_services(g: WalletTypeInfo = Depends(get_key_type)):
"""Return list of all services assigned to wallet with given invoice key"""
wallet_ids = (await get_user(g.wallet.user)).wallet_ids
services = []
for wallet_id in wallet_ids:
new_services = await get_services(wallet_id)
... | Return list of all services assigned to wallet with given invoice key | Return list of all services assigned to wallet with given invoice key | [
"Return",
"list",
"of",
"all",
"services",
"assigned",
"to",
"wallet",
"with",
"given",
"invoice",
"key"
] | async def api_get_services(g: WalletTypeInfo = Depends(get_key_type)):
wallet_ids = (await get_user(g.wallet.user)).wallet_ids
services = []
for wallet_id in wallet_ids:
new_services = await get_services(wallet_id)
services += new_services if new_services else []
return [service.dict() f... | [
"async",
"def",
"api_get_services",
"(",
"g",
":",
"WalletTypeInfo",
"=",
"Depends",
"(",
"get_key_type",
")",
")",
":",
"wallet_ids",
"=",
"(",
"await",
"get_user",
"(",
"g",
".",
"wallet",
".",
"user",
")",
")",
".",
"wallet_ids",
"services",
"=",
"[",... | Return list of all services assigned to wallet with given invoice key | [
"Return",
"list",
"of",
"all",
"services",
"assigned",
"to",
"wallet",
"with",
"given",
"invoice",
"key"
] | [
"\"\"\"Return list of all services assigned to wallet with given invoice key\"\"\""
] | [
{
"param": "g",
"type": "WalletTypeInfo"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "g",
"type": "WalletTypeInfo",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a678d8ba8986aa3adb90ad49402f8484b064476 | kilrau/lnbits-legend | lnbits/extensions/streamalerts/views_api.py | [
"MIT"
] | Python | api_get_donations | <not_specific> | async def api_get_donations(g: WalletTypeInfo = Depends(get_key_type)):
"""Return list of all donations assigned to wallet with given invoice
key
"""
wallet_ids = (await get_user(g.wallet.user)).wallet_ids
donations = []
for wallet_id in wallet_ids:
new_donations = await get_donations(wa... | Return list of all donations assigned to wallet with given invoice
key
| Return list of all donations assigned to wallet with given invoice
key | [
"Return",
"list",
"of",
"all",
"donations",
"assigned",
"to",
"wallet",
"with",
"given",
"invoice",
"key"
] | async def api_get_donations(g: WalletTypeInfo = Depends(get_key_type)):
wallet_ids = (await get_user(g.wallet.user)).wallet_ids
donations = []
for wallet_id in wallet_ids:
new_donations = await get_donations(wallet_id)
donations += new_donations if new_donations else []
return [donation.... | [
"async",
"def",
"api_get_donations",
"(",
"g",
":",
"WalletTypeInfo",
"=",
"Depends",
"(",
"get_key_type",
")",
")",
":",
"wallet_ids",
"=",
"(",
"await",
"get_user",
"(",
"g",
".",
"wallet",
".",
"user",
")",
")",
".",
"wallet_ids",
"donations",
"=",
"[... | Return list of all donations assigned to wallet with given invoice
key | [
"Return",
"list",
"of",
"all",
"donations",
"assigned",
"to",
"wallet",
"with",
"given",
"invoice",
"key"
] | [
"\"\"\"Return list of all donations assigned to wallet with given invoice\n key\n \"\"\""
] | [
{
"param": "g",
"type": "WalletTypeInfo"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "g",
"type": "WalletTypeInfo",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0a678d8ba8986aa3adb90ad49402f8484b064476 | kilrau/lnbits-legend | lnbits/extensions/streamalerts/views_api.py | [
"MIT"
] | Python | api_update_donation | <not_specific> | async def api_update_donation(
data: CreateDonation, donation_id=None, g: WalletTypeInfo = Depends(get_key_type)
):
"""Update a donation with the data given in the request"""
if donation_id:
donation = await get_donation(donation_id)
if not donation:
raise HTTPException(
... | Update a donation with the data given in the request | Update a donation with the data given in the request | [
"Update",
"a",
"donation",
"with",
"the",
"data",
"given",
"in",
"the",
"request"
] | async def api_update_donation(
data: CreateDonation, donation_id=None, g: WalletTypeInfo = Depends(get_key_type)
):
if donation_id:
donation = await get_donation(donation_id)
if not donation:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="Donation does... | [
"async",
"def",
"api_update_donation",
"(",
"data",
":",
"CreateDonation",
",",
"donation_id",
"=",
"None",
",",
"g",
":",
"WalletTypeInfo",
"=",
"Depends",
"(",
"get_key_type",
")",
")",
":",
"if",
"donation_id",
":",
"donation",
"=",
"await",
"get_donation",... | Update a donation with the data given in the request | [
"Update",
"a",
"donation",
"with",
"the",
"data",
"given",
"in",
"the",
"request"
] | [
"\"\"\"Update a donation with the data given in the request\"\"\""
] | [
{
"param": "data",
"type": "CreateDonation"
},
{
"param": "donation_id",
"type": null
},
{
"param": "g",
"type": "WalletTypeInfo"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": "CreateDonation",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "donation_id",
"type": null,
"docstring": null,
"d... |
0a678d8ba8986aa3adb90ad49402f8484b064476 | kilrau/lnbits-legend | lnbits/extensions/streamalerts/views_api.py | [
"MIT"
] | Python | api_update_service | <not_specific> | async def api_update_service(
data: CreateService, service_id=None, g: WalletTypeInfo = Depends(get_key_type)
):
"""Update a service with the data given in the request"""
if service_id:
service = await get_service(service_id)
if not service:
raise HTTPException(
... | Update a service with the data given in the request | Update a service with the data given in the request | [
"Update",
"a",
"service",
"with",
"the",
"data",
"given",
"in",
"the",
"request"
] | async def api_update_service(
data: CreateService, service_id=None, g: WalletTypeInfo = Depends(get_key_type)
):
if service_id:
service = await get_service(service_id)
if not service:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="Service does not exis... | [
"async",
"def",
"api_update_service",
"(",
"data",
":",
"CreateService",
",",
"service_id",
"=",
"None",
",",
"g",
":",
"WalletTypeInfo",
"=",
"Depends",
"(",
"get_key_type",
")",
")",
":",
"if",
"service_id",
":",
"service",
"=",
"await",
"get_service",
"("... | Update a service with the data given in the request | [
"Update",
"a",
"service",
"with",
"the",
"data",
"given",
"in",
"the",
"request"
] | [
"\"\"\"Update a service with the data given in the request\"\"\""
] | [
{
"param": "data",
"type": "CreateService"
},
{
"param": "service_id",
"type": null
},
{
"param": "g",
"type": "WalletTypeInfo"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": "CreateService",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "service_id",
"type": null,
"docstring": null,
"doc... |
0a678d8ba8986aa3adb90ad49402f8484b064476 | kilrau/lnbits-legend | lnbits/extensions/streamalerts/views_api.py | [
"MIT"
] | Python | api_delete_donation | null | async def api_delete_donation(donation_id, g: WalletTypeInfo = Depends(get_key_type)):
"""Delete the donation with the given donation_id"""
donation = await get_donation(donation_id)
if not donation:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="No donation with this ID!... | Delete the donation with the given donation_id | Delete the donation with the given donation_id | [
"Delete",
"the",
"donation",
"with",
"the",
"given",
"donation_id"
] | async def api_delete_donation(donation_id, g: WalletTypeInfo = Depends(get_key_type)):
donation = await get_donation(donation_id)
if not donation:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="No donation with this ID!"
)
if donation.wallet != g.wallet.id:
... | [
"async",
"def",
"api_delete_donation",
"(",
"donation_id",
",",
"g",
":",
"WalletTypeInfo",
"=",
"Depends",
"(",
"get_key_type",
")",
")",
":",
"donation",
"=",
"await",
"get_donation",
"(",
"donation_id",
")",
"if",
"not",
"donation",
":",
"raise",
"HTTPExcep... | Delete the donation with the given donation_id | [
"Delete",
"the",
"donation",
"with",
"the",
"given",
"donation_id"
] | [
"\"\"\"Delete the donation with the given donation_id\"\"\""
] | [
{
"param": "donation_id",
"type": null
},
{
"param": "g",
"type": "WalletTypeInfo"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "donation_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "g",
"type": "WalletTypeInfo",
"docstring": null,
"docs... |
0a678d8ba8986aa3adb90ad49402f8484b064476 | kilrau/lnbits-legend | lnbits/extensions/streamalerts/views_api.py | [
"MIT"
] | Python | api_delete_service | null | async def api_delete_service(service_id, g: WalletTypeInfo = Depends(get_key_type)):
"""Delete the service with the given service_id"""
service = await get_service(service_id)
if not service:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="No service with this ID!"
... | Delete the service with the given service_id | Delete the service with the given service_id | [
"Delete",
"the",
"service",
"with",
"the",
"given",
"service_id"
] | async def api_delete_service(service_id, g: WalletTypeInfo = Depends(get_key_type)):
service = await get_service(service_id)
if not service:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="No service with this ID!"
)
if service.wallet != g.wallet.id:
raise ... | [
"async",
"def",
"api_delete_service",
"(",
"service_id",
",",
"g",
":",
"WalletTypeInfo",
"=",
"Depends",
"(",
"get_key_type",
")",
")",
":",
"service",
"=",
"await",
"get_service",
"(",
"service_id",
")",
"if",
"not",
"service",
":",
"raise",
"HTTPException",... | Delete the service with the given service_id | [
"Delete",
"the",
"service",
"with",
"the",
"given",
"service_id"
] | [
"\"\"\"Delete the service with the given service_id\"\"\""
] | [
{
"param": "service_id",
"type": null
},
{
"param": "g",
"type": "WalletTypeInfo"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "service_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "g",
"type": "WalletTypeInfo",
"docstring": null,
"docst... |
fc3ec0b8abfc036829de0eac8883435ae2262c58 | heylakshya/youtubeRabbitHole | main.py | [
"MIT"
] | Python | crawl2 | <not_specific> | def crawl2(url, depth, first_call = 0, home_tags = None):
'''
Crawl the yt web graph and return relevance index
upto defined depth.
'''
print("---\tat depth = {}".format(depth))
if depth == 0:
return []
tags = home_tags
links = None
attempt=5
while (tags==None or links==None) and attempt>0:
attempt -= 1... |
Crawl the yt web graph and return relevance index
upto defined depth.
| Crawl the yt web graph and return relevance index
upto defined depth. | [
"Crawl",
"the",
"yt",
"web",
"graph",
"and",
"return",
"relevance",
"index",
"upto",
"defined",
"depth",
"."
] | def crawl2(url, depth, first_call = 0, home_tags = None):
print("---\tat depth = {}".format(depth))
if depth == 0:
return []
tags = home_tags
links = None
attempt=5
while (tags==None or links==None) and attempt>0:
attempt -= 1
tags, links = f.getDataFromUrl(url)
if tags == None or links == None:
print(... | [
"def",
"crawl2",
"(",
"url",
",",
"depth",
",",
"first_call",
"=",
"0",
",",
"home_tags",
"=",
"None",
")",
":",
"print",
"(",
"\"---\\tat depth = {}\"",
".",
"format",
"(",
"depth",
")",
")",
"if",
"depth",
"==",
"0",
":",
"return",
"[",
"]",
"tags"... | Crawl the yt web graph and return relevance index
upto defined depth. | [
"Crawl",
"the",
"yt",
"web",
"graph",
"and",
"return",
"relevance",
"index",
"upto",
"defined",
"depth",
"."
] | [
"'''\n\tCrawl the yt web graph and return relevance index\n\tupto defined depth.\n\t'''"
] | [
{
"param": "url",
"type": null
},
{
"param": "depth",
"type": null
},
{
"param": "first_call",
"type": null
},
{
"param": "home_tags",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": null,
"docstring": null,
"docstring_tokens": [... |
d100de3a4c7513d96be2974602fbb64c386f7788 | jakuta-tech/AutOSINT | AutOSINT.py | [
"MIT"
] | Python | banner | null | def banner(self):
"""verbosity flag to print logo and args"""
if self.args.verbose is True:
print('''
_ _ ___ ____ ___ _ _ _____
/ \ _ _| |_ / _ \/ ___|_ _| \ | |_ _|
/ _ \| | | | __| | | \___ \| || \| | | |
/ ___ \ |_| | |_| |_| |___) | || |\ | | |
/_/ ... | verbosity flag to print logo and args | verbosity flag to print logo and args | [
"verbosity",
"flag",
"to",
"print",
"logo",
"and",
"args"
] | def banner(self):
if self.args.verbose is True:
print('''
_ _ ___ ____ ___ _ _ _____
/ \ _ _| |_ / _ \/ ___|_ _| \ | |_ _|
/ _ \| | | | __| | | \___ \| || \| | | |
/ ___ \ |_| | |_| |_| |___) | || |\ | | |
/_/ \_\__,_|\__|\___/|____/___|_| \_| |_|\n''')
... | [
"def",
"banner",
"(",
"self",
")",
":",
"if",
"self",
".",
"args",
".",
"verbose",
"is",
"True",
":",
"print",
"(",
"'''\n _ _ ___ ____ ___ _ _ _____ \n / \\ _ _| |_ / _ \\/ ___|_ _| \\ | |_ _|\n / _ \\| | | | __| | | \\___ \\| || \\| | | | \n / ___ \\ |_... | verbosity flag to print logo and args | [
"verbosity",
"flag",
"to",
"print",
"logo",
"and",
"args"
] | [
"\"\"\"verbosity flag to print logo and args\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d100de3a4c7513d96be2974602fbb64c386f7788 | jakuta-tech/AutOSINT | AutOSINT.py | [
"MIT"
] | Python | check_arguments | null | def check_arguments(self):
"""check local dirs for reports, apikey and database"""
#require at least one argument
if not (self.args.domain):
print('[-] No OSINT reference provided, add domain(s) with -d\n')
parser.print_help()
sys.exit(0)
#check to se... | check local dirs for reports, apikey and database | check local dirs for reports, apikey and database | [
"check",
"local",
"dirs",
"for",
"reports",
"apikey",
"and",
"database"
] | def check_arguments(self):
if not (self.args.domain):
print('[-] No OSINT reference provided, add domain(s) with -d\n')
parser.print_help()
sys.exit(0)
if self.args.domain is not None:
for d in self.args.domain:
self.lookup_list = self.args... | [
"def",
"check_arguments",
"(",
"self",
")",
":",
"if",
"not",
"(",
"self",
".",
"args",
".",
"domain",
")",
":",
"print",
"(",
"'[-] No OSINT reference provided, add domain(s) with -d\\n'",
")",
"parser",
".",
"print_help",
"(",
")",
"sys",
".",
"exit",
"(",
... | check local dirs for reports, apikey and database | [
"check",
"local",
"dirs",
"for",
"reports",
"apikey",
"and",
"database"
] | [
"\"\"\"check local dirs for reports, apikey and database\"\"\"",
"#require at least one argument",
"#check to see if an ip or domain name was entered",
"#check for a supplied client name and exit if none provided",
"#strip out specials in client name"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d100de3a4c7513d96be2974602fbb64c386f7788 | jakuta-tech/AutOSINT | AutOSINT.py | [
"MIT"
] | Python | run_queries | null | def run_queries(self):
"""invoke all the queries. assumption is that every run will want all data"""
#verified
self.whois_result = self.whois_query_module.run(self.args, self.lookup_list, self.report_directory)
#verified
self.dns_result = self.dns_query_module.r... | invoke all the queries. assumption is that every run will want all data | invoke all the queries. assumption is that every run will want all data | [
"invoke",
"all",
"the",
"queries",
".",
"assumption",
"is",
"that",
"every",
"run",
"will",
"want",
"all",
"data"
] | def run_queries(self):
self.whois_result = self.whois_query_module.run(self.args, self.lookup_list, self.report_directory)
self.dns_result = self.dns_query_module.run(self.args, self.lookup_list, self.report_directory)
self.haveibeenpwned_result = self.haveibeenpwned_api_module.run(self.args, se... | [
"def",
"run_queries",
"(",
"self",
")",
":",
"self",
".",
"whois_result",
"=",
"self",
".",
"whois_query_module",
".",
"run",
"(",
"self",
".",
"args",
",",
"self",
".",
"lookup_list",
",",
"self",
".",
"report_directory",
")",
"self",
".",
"dns_result",
... | invoke all the queries. | [
"invoke",
"all",
"the",
"queries",
"."
] | [
"\"\"\"invoke all the queries. assumption is that every run will want all data\"\"\"",
"#verified",
"#verified",
"#needs work",
"#verified",
"#verified",
"#verified",
"#verified",
"#needs work",
"#pyfoca has to be present"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d100de3a4c7513d96be2974602fbb64c386f7788 | jakuta-tech/AutOSINT | AutOSINT.py | [
"MIT"
] | Python | report | null | def report(self):
"""run the docx report. text files happen in the respective functions"""
self.report_generator_module.run(\
self.args, \
self.report_directory, \
self.lookup_list, \
self.whois_result, \
self.dns_result, \
self.goo... | run the docx report. text files happen in the respective functions | run the docx report. text files happen in the respective functions | [
"run",
"the",
"docx",
"report",
".",
"text",
"files",
"happen",
"in",
"the",
"respective",
"functions"
] | def report(self):
self.report_generator_module.run(\
self.args, \
self.report_directory, \
self.lookup_list, \
self.whois_result, \
self.dns_result, \
self.google_dork_result, \
self.shodan_query_result, \
self.paste... | [
"def",
"report",
"(",
"self",
")",
":",
"self",
".",
"report_generator_module",
".",
"run",
"(",
"self",
".",
"args",
",",
"self",
".",
"report_directory",
",",
"self",
".",
"lookup_list",
",",
"self",
".",
"whois_result",
",",
"self",
".",
"dns_result",
... | run the docx report. | [
"run",
"the",
"docx",
"report",
"."
] | [
"\"\"\"run the docx report. text files happen in the respective functions\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6ec6ecab15e1d39a6e3e300c6c11174966de1d3 | munkm/npre247 | 20.00-python_intro/calculate_lambda.py | [
"CC-BY-4.0"
] | Python | calculate_lambda | <not_specific> | def calculate_lambda(N, N_o, t):
"""
This function will return a tuple with the value of lambda and the value
of t_0.5.
"""
decay_constant = math.log(N/N_o)/t
half_life = math.log(2)/decay_constant
return (decay_constant, half_life) |
This function will return a tuple with the value of lambda and the value
of t_0.5.
| This function will return a tuple with the value of lambda and the value
of t_0.5. | [
"This",
"function",
"will",
"return",
"a",
"tuple",
"with",
"the",
"value",
"of",
"lambda",
"and",
"the",
"value",
"of",
"t_0",
".",
"5",
"."
] | def calculate_lambda(N, N_o, t):
decay_constant = math.log(N/N_o)/t
half_life = math.log(2)/decay_constant
return (decay_constant, half_life) | [
"def",
"calculate_lambda",
"(",
"N",
",",
"N_o",
",",
"t",
")",
":",
"decay_constant",
"=",
"math",
".",
"log",
"(",
"N",
"/",
"N_o",
")",
"/",
"t",
"half_life",
"=",
"math",
".",
"log",
"(",
"2",
")",
"/",
"decay_constant",
"return",
"(",
"decay_c... | This function will return a tuple with the value of lambda and the value
of t_0.5. | [
"This",
"function",
"will",
"return",
"a",
"tuple",
"with",
"the",
"value",
"of",
"lambda",
"and",
"the",
"value",
"of",
"t_0",
".",
"5",
"."
] | [
"\"\"\"\n This function will return a tuple with the value of lambda and the value\n of t_0.5.\n \"\"\""
] | [
{
"param": "N",
"type": null
},
{
"param": "N_o",
"type": null
},
{
"param": "t",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "N",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "N_o",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
0f14cdd90d793595bdc886ba0395f574afcb4a2a | triangular-opensource/Taiyo | manage.py | [
"MIT"
] | Python | read_env | null | def read_env():
"""Reads local default environment variables from a .env file
located in the project root directory.
https://gist.github.com/bennylope/2999704
"""
try:
with open(".env") as f:
content = f.read()
except IOError:
content = ""
for line in content.spl... | Reads local default environment variables from a .env file
located in the project root directory.
https://gist.github.com/bennylope/2999704
| Reads local default environment variables from a .env file
located in the project root directory. | [
"Reads",
"local",
"default",
"environment",
"variables",
"from",
"a",
".",
"env",
"file",
"located",
"in",
"the",
"project",
"root",
"directory",
"."
] | def read_env():
try:
with open(".env") as f:
content = f.read()
except IOError:
content = ""
for line in content.splitlines():
m1 = re.match(r"\A([A-Za-z_0-9]+)=(.*)\Z", line)
if m1:
key, val = m1.group(1), m1.group(2)
m2 = re.match(r"\A'(.... | [
"def",
"read_env",
"(",
")",
":",
"try",
":",
"with",
"open",
"(",
"\".env\"",
")",
"as",
"f",
":",
"content",
"=",
"f",
".",
"read",
"(",
")",
"except",
"IOError",
":",
"content",
"=",
"\"\"",
"for",
"line",
"in",
"content",
".",
"splitlines",
"("... | Reads local default environment variables from a .env file
located in the project root directory. | [
"Reads",
"local",
"default",
"environment",
"variables",
"from",
"a",
".",
"env",
"file",
"located",
"in",
"the",
"project",
"root",
"directory",
"."
] | [
"\"\"\"Reads local default environment variables from a .env file\n located in the project root directory.\n https://gist.github.com/bennylope/2999704\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | on_disconnected | null | def on_disconnected(self, message):
"""The Viewer connection has just ended"""
# Reset the cursor to the default
self.unsetCursor()
# Display the disconnection reason, if any
if message:
box = QtGui.QMessageBox(QtGui.QMessageBox.NoIcon, "Error", message,
... | The Viewer connection has just ended | The Viewer connection has just ended | [
"The",
"Viewer",
"connection",
"has",
"just",
"ended"
] | def on_disconnected(self, message):
self.unsetCursor()
if message:
box = QtGui.QMessageBox(QtGui.QMessageBox.NoIcon, "Error", message,
buttons=QtGui.QMessageBox.Ok, parent=self)
box.exec_()
self.conn_disconnected = True
self.clo... | [
"def",
"on_disconnected",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"unsetCursor",
"(",
")",
"if",
"message",
":",
"box",
"=",
"QtGui",
".",
"QMessageBox",
"(",
"QtGui",
".",
"QMessageBox",
".",
"NoIcon",
",",
"\"Error\"",
",",
"message",
",",
... | The Viewer connection has just ended | [
"The",
"Viewer",
"connection",
"has",
"just",
"ended"
] | [
"\"\"\"The Viewer connection has just ended\"\"\"",
"# Reset the cursor to the default",
"# Display the disconnection reason, if any",
"# Close the window. Setting conn_disconnected prevents us subsequently",
"# calling disconnect() on the connection."
] | [
{
"param": "self",
"type": null
},
{
"param": "message",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "message",
"type": null,
"docstring": null,
"docstring_tokens"... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | on_framebuffer_updated | null | def on_framebuffer_updated(self):
"""The Viewer connection has received fresh data from the Server, so we
redraw the widget by triggering a Qt paint event.
"""
self.update() | The Viewer connection has received fresh data from the Server, so we
redraw the widget by triggering a Qt paint event.
| The Viewer connection has received fresh data from the Server, so we
redraw the widget by triggering a Qt paint event. | [
"The",
"Viewer",
"connection",
"has",
"received",
"fresh",
"data",
"from",
"the",
"Server",
"so",
"we",
"redraw",
"the",
"widget",
"by",
"triggering",
"a",
"Qt",
"paint",
"event",
"."
] | def on_framebuffer_updated(self):
self.update() | [
"def",
"on_framebuffer_updated",
"(",
"self",
")",
":",
"self",
".",
"update",
"(",
")"
] | The Viewer connection has received fresh data from the Server, so we
redraw the widget by triggering a Qt paint event. | [
"The",
"Viewer",
"connection",
"has",
"received",
"fresh",
"data",
"from",
"the",
"Server",
"so",
"we",
"redraw",
"the",
"widget",
"by",
"triggering",
"a",
"Qt",
"paint",
"event",
"."
] | [
"\"\"\"The Viewer connection has received fresh data from the Server, so we\n redraw the widget by triggering a Qt paint event.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | on_framebuffer_resized | null | def on_framebuffer_resized(self, width, height, stride, buffer,
resize_window):
"""The Server's framebuffer size has changed, so we reset our canvas to
use the new buffer and resize our window to match.
"""
# We take a reference to the buffer, to guarantee... | The Server's framebuffer size has changed, so we reset our canvas to
use the new buffer and resize our window to match.
| The Server's framebuffer size has changed, so we reset our canvas to
use the new buffer and resize our window to match. | [
"The",
"Server",
"'",
"s",
"framebuffer",
"size",
"has",
"changed",
"so",
"we",
"reset",
"our",
"canvas",
"to",
"use",
"the",
"new",
"buffer",
"and",
"resize",
"our",
"window",
"to",
"match",
"."
] | def on_framebuffer_resized(self, width, height, stride, buffer,
resize_window):
self.buffer = buffer
self.canvas = QtGui.QImage(
buffer,
width,
height,
stride * 4,
QtGui.QImage.Format_RGB32
)
if re... | [
"def",
"on_framebuffer_resized",
"(",
"self",
",",
"width",
",",
"height",
",",
"stride",
",",
"buffer",
",",
"resize_window",
")",
":",
"self",
".",
"buffer",
"=",
"buffer",
"self",
".",
"canvas",
"=",
"QtGui",
".",
"QImage",
"(",
"buffer",
",",
"width"... | The Server's framebuffer size has changed, so we reset our canvas to
use the new buffer and resize our window to match. | [
"The",
"Server",
"'",
"s",
"framebuffer",
"size",
"has",
"changed",
"so",
"we",
"reset",
"our",
"canvas",
"to",
"use",
"the",
"new",
"buffer",
"and",
"resize",
"our",
"window",
"to",
"match",
"."
] | [
"\"\"\"The Server's framebuffer size has changed, so we reset our canvas to\n use the new buffer and resize our window to match.\n \"\"\"",
"# We take a reference to the buffer, to guarantee that it stays valid",
"# for the lifetime of the QImage, which will use it as its backing",
"# buffer.",
... | [
{
"param": "self",
"type": null
},
{
"param": "width",
"type": null
},
{
"param": "height",
"type": null
},
{
"param": "stride",
"type": null
},
{
"param": "buffer",
"type": null
},
{
"param": "resize_window",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "width",
"type": null,
"docstring": null,
"docstring_tokens": ... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | on_server_name_changed | null | def on_server_name_changed(self, name):
"""The Server's desktop name has changed."""
self.setWindowTitle("{title} - {name}".format(
title=self.WINDOW_TITLE,
name=name
)) | The Server's desktop name has changed. | The Server's desktop name has changed. | [
"The",
"Server",
"'",
"s",
"desktop",
"name",
"has",
"changed",
"."
] | def on_server_name_changed(self, name):
self.setWindowTitle("{title} - {name}".format(
title=self.WINDOW_TITLE,
name=name
)) | [
"def",
"on_server_name_changed",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"setWindowTitle",
"(",
"\"{title} - {name}\"",
".",
"format",
"(",
"title",
"=",
"self",
".",
"WINDOW_TITLE",
",",
"name",
"=",
"name",
")",
")"
] | The Server's desktop name has changed. | [
"The",
"Server",
"'",
"s",
"desktop",
"name",
"has",
"changed",
"."
] | [
"\"\"\"The Server's desktop name has changed.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | closeEvent | null | def closeEvent(self, e):
"""The user has just attempted to close the Qt window."""
if not self.conn_disconnected:
vncsdk.EventLoop.run_on_loop(viewer_conn.on_closed)
# We don't shut the window immediately, it should stay open until
# the connection has been cleanly c... | The user has just attempted to close the Qt window. | The user has just attempted to close the Qt window. | [
"The",
"user",
"has",
"just",
"attempted",
"to",
"close",
"the",
"Qt",
"window",
"."
] | def closeEvent(self, e):
if not self.conn_disconnected:
vncsdk.EventLoop.run_on_loop(viewer_conn.on_closed)
e.ignore() | [
"def",
"closeEvent",
"(",
"self",
",",
"e",
")",
":",
"if",
"not",
"self",
".",
"conn_disconnected",
":",
"vncsdk",
".",
"EventLoop",
".",
"run_on_loop",
"(",
"viewer_conn",
".",
"on_closed",
")",
"e",
".",
"ignore",
"(",
")"
] | The user has just attempted to close the Qt window. | [
"The",
"user",
"has",
"just",
"attempted",
"to",
"close",
"the",
"Qt",
"window",
"."
] | [
"\"\"\"The user has just attempted to close the Qt window.\"\"\"",
"# We don't shut the window immediately, it should stay open until",
"# the connection has been cleanly closed, at which point we receive",
"# the on_disconnected() signal and exit the app."
] | [
{
"param": "self",
"type": null
},
{
"param": "e",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "e",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | paintEvent | <not_specific> | def paintEvent(self, e):
"""The Qt window must be redrawn, so we paint using our canvas."""
if not self.canvas:
# Ignore paint events before we've set up our canvas
return
painter = QtGui.QPainter(self)
painter.drawImage(0, 0, self.canvas) | The Qt window must be redrawn, so we paint using our canvas. | The Qt window must be redrawn, so we paint using our canvas. | [
"The",
"Qt",
"window",
"must",
"be",
"redrawn",
"so",
"we",
"paint",
"using",
"our",
"canvas",
"."
] | def paintEvent(self, e):
if not self.canvas:
return
painter = QtGui.QPainter(self)
painter.drawImage(0, 0, self.canvas) | [
"def",
"paintEvent",
"(",
"self",
",",
"e",
")",
":",
"if",
"not",
"self",
".",
"canvas",
":",
"return",
"painter",
"=",
"QtGui",
".",
"QPainter",
"(",
"self",
")",
"painter",
".",
"drawImage",
"(",
"0",
",",
"0",
",",
"self",
".",
"canvas",
")"
] | The Qt window must be redrawn, so we paint using our canvas. | [
"The",
"Qt",
"window",
"must",
"be",
"redrawn",
"so",
"we",
"paint",
"using",
"our",
"canvas",
"."
] | [
"\"\"\"The Qt window must be redrawn, so we paint using our canvas.\"\"\"",
"# Ignore paint events before we've set up our canvas"
] | [
{
"param": "self",
"type": null
},
{
"param": "e",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "e",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | resizeEvent | null | def resizeEvent(self, e):
"""The user has just attempted to resize the Qt window, or we have just
called resize() to match a change in the Server's screen size. We
distinguish these two cases using the ignore_next_resize_event flag.
"""
if self.ignore_next_resize_event:
... | The user has just attempted to resize the Qt window, or we have just
called resize() to match a change in the Server's screen size. We
distinguish these two cases using the ignore_next_resize_event flag.
| The user has just attempted to resize the Qt window, or we have just
called resize() to match a change in the Server's screen size. We
distinguish these two cases using the ignore_next_resize_event flag. | [
"The",
"user",
"has",
"just",
"attempted",
"to",
"resize",
"the",
"Qt",
"window",
"or",
"we",
"have",
"just",
"called",
"resize",
"()",
"to",
"match",
"a",
"change",
"in",
"the",
"Server",
"'",
"s",
"screen",
"size",
".",
"We",
"distinguish",
"these",
... | def resizeEvent(self, e):
if self.ignore_next_resize_event:
self.ignore_next_resize_event = False
else:
self.resize_event.clear()
vncsdk.EventLoop.run_on_loop(viewer_conn.on_widget_resized,
(e.size().width(), e.size().height(),... | [
"def",
"resizeEvent",
"(",
"self",
",",
"e",
")",
":",
"if",
"self",
".",
"ignore_next_resize_event",
":",
"self",
".",
"ignore_next_resize_event",
"=",
"False",
"else",
":",
"self",
".",
"resize_event",
".",
"clear",
"(",
")",
"vncsdk",
".",
"EventLoop",
... | The user has just attempted to resize the Qt window, or we have just
called resize() to match a change in the Server's screen size. | [
"The",
"user",
"has",
"just",
"attempted",
"to",
"resize",
"the",
"Qt",
"window",
"or",
"we",
"have",
"just",
"called",
"resize",
"()",
"to",
"match",
"a",
"change",
"in",
"the",
"Server",
"'",
"s",
"screen",
"size",
"."
] | [
"\"\"\"The user has just attempted to resize the Qt window, or we have just\n called resize() to match a change in the Server's screen size. We\n distinguish these two cases using the ignore_next_resize_event flag.\n \"\"\"",
"# Wait for the SDK thread to process the resize, to prevent us",
... | [
{
"param": "self",
"type": null
},
{
"param": "e",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "e",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | keyPressEvent | <not_specific> | def keyPressEvent(self, e):
"""The Qt window has been sent keyboard input, which we send to the
Server.
"""
# A mapping between the Qt non-printable keys and the SDK keysyms
key_map = {
int(QtCore.Qt.Key_Escape): vncsdk.Keyboard.XK_Escape,
int(QtCore.Qt.K... | The Qt window has been sent keyboard input, which we send to the
Server.
| The Qt window has been sent keyboard input, which we send to the
Server. | [
"The",
"Qt",
"window",
"has",
"been",
"sent",
"keyboard",
"input",
"which",
"we",
"send",
"to",
"the",
"Server",
"."
] | def keyPressEvent(self, e):
key_map = {
int(QtCore.Qt.Key_Escape): vncsdk.Keyboard.XK_Escape,
int(QtCore.Qt.Key_Return): vncsdk.Keyboard.XK_Return,
int(QtCore.Qt.Key_Enter): vncsdk.Keyboard.XK_KP_Enter,
int(QtCore.Qt.Key_Insert): vncsdk.Keyboard.XK_Insert,
... | [
"def",
"keyPressEvent",
"(",
"self",
",",
"e",
")",
":",
"key_map",
"=",
"{",
"int",
"(",
"QtCore",
".",
"Qt",
".",
"Key_Escape",
")",
":",
"vncsdk",
".",
"Keyboard",
".",
"XK_Escape",
",",
"int",
"(",
"QtCore",
".",
"Qt",
".",
"Key_Return",
")",
"... | The Qt window has been sent keyboard input, which we send to the
Server. | [
"The",
"Qt",
"window",
"has",
"been",
"sent",
"keyboard",
"input",
"which",
"we",
"send",
"to",
"the",
"Server",
"."
] | [
"\"\"\"The Qt window has been sent keyboard input, which we send to the\n Server.\n \"\"\"",
"# A mapping between the Qt non-printable keys and the SDK keysyms",
"# Mac OS X",
"# Try first to send the keycode as a keysym directly, to handle non-",
"# printing keycodes, which don't have associa... | [
{
"param": "self",
"type": null
},
{
"param": "e",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "e",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | keyReleaseEvent | null | def keyReleaseEvent(self, e):
"""The Qt window has been sent keyboard input, which we send to the
Server.
"""
keycode = e.key()
vncsdk.EventLoop.run_on_loop(viewer_conn.on_key_release, (keycode,)) | The Qt window has been sent keyboard input, which we send to the
Server.
| The Qt window has been sent keyboard input, which we send to the
Server. | [
"The",
"Qt",
"window",
"has",
"been",
"sent",
"keyboard",
"input",
"which",
"we",
"send",
"to",
"the",
"Server",
"."
] | def keyReleaseEvent(self, e):
keycode = e.key()
vncsdk.EventLoop.run_on_loop(viewer_conn.on_key_release, (keycode,)) | [
"def",
"keyReleaseEvent",
"(",
"self",
",",
"e",
")",
":",
"keycode",
"=",
"e",
".",
"key",
"(",
")",
"vncsdk",
".",
"EventLoop",
".",
"run_on_loop",
"(",
"viewer_conn",
".",
"on_key_release",
",",
"(",
"keycode",
",",
")",
")"
] | The Qt window has been sent keyboard input, which we send to the
Server. | [
"The",
"Qt",
"window",
"has",
"been",
"sent",
"keyboard",
"input",
"which",
"we",
"send",
"to",
"the",
"Server",
"."
] | [
"\"\"\"The Qt window has been sent keyboard input, which we send to the\n Server.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "e",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "e",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | mouseEvent | null | def mouseEvent(self, e):
"""The Qt window has been sent mouse input, which we send to the
Server. This method only handles click and move events, not scrollwheel
events.
"""
# A mapping between the Qt enumerations and the SDK enumerations
mouse_map = {
int(Qt... | The Qt window has been sent mouse input, which we send to the
Server. This method only handles click and move events, not scrollwheel
events.
| The Qt window has been sent mouse input, which we send to the
Server. This method only handles click and move events, not scrollwheel
events. | [
"The",
"Qt",
"window",
"has",
"been",
"sent",
"mouse",
"input",
"which",
"we",
"send",
"to",
"the",
"Server",
".",
"This",
"method",
"only",
"handles",
"click",
"and",
"move",
"events",
"not",
"scrollwheel",
"events",
"."
] | def mouseEvent(self, e):
mouse_map = {
int(QtCore.Qt.LeftButton):
vncsdk.Viewer.MouseButton.MOUSE_BUTTON_LEFT,
int(QtCore.Qt.RightButton):
vncsdk.Viewer.MouseButton.MOUSE_BUTTON_RIGHT,
int(QtCore.Qt.MiddleButton):
vncsdk.Viewer.... | [
"def",
"mouseEvent",
"(",
"self",
",",
"e",
")",
":",
"mouse_map",
"=",
"{",
"int",
"(",
"QtCore",
".",
"Qt",
".",
"LeftButton",
")",
":",
"vncsdk",
".",
"Viewer",
".",
"MouseButton",
".",
"MOUSE_BUTTON_LEFT",
",",
"int",
"(",
"QtCore",
".",
"Qt",
".... | The Qt window has been sent mouse input, which we send to the
Server. | [
"The",
"Qt",
"window",
"has",
"been",
"sent",
"mouse",
"input",
"which",
"we",
"send",
"to",
"the",
"Server",
"."
] | [
"\"\"\"The Qt window has been sent mouse input, which we send to the\n Server. This method only handles click and move events, not scrollwheel\n events.\n \"\"\"",
"# A mapping between the Qt enumerations and the SDK enumerations"
] | [
{
"param": "self",
"type": null
},
{
"param": "e",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "e",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | wheelEvent | null | def wheelEvent(self, e):
"""The Qt window has been sent mouse scroll input, which we send to the
Server.
"""
# Qt's units are scaled for high-resolution scrolling devices, whereas
# the SDK uses the more common Windows units, so we rescale the delta
# using Microsoft's "... | The Qt window has been sent mouse scroll input, which we send to the
Server.
| The Qt window has been sent mouse scroll input, which we send to the
Server. | [
"The",
"Qt",
"window",
"has",
"been",
"sent",
"mouse",
"scroll",
"input",
"which",
"we",
"send",
"to",
"the",
"Server",
"."
] | def wheelEvent(self, e):
delta = int(e.delta() / 120)
axis = vncsdk.Viewer.MouseWheel.MOUSE_WHEEL_VERTICAL
vncsdk.EventLoop.run_on_loop(viewer_conn.on_scroll_event,
(delta, axis)) | [
"def",
"wheelEvent",
"(",
"self",
",",
"e",
")",
":",
"delta",
"=",
"int",
"(",
"e",
".",
"delta",
"(",
")",
"/",
"120",
")",
"axis",
"=",
"vncsdk",
".",
"Viewer",
".",
"MouseWheel",
".",
"MOUSE_WHEEL_VERTICAL",
"vncsdk",
".",
"EventLoop",
".",
"run_... | The Qt window has been sent mouse scroll input, which we send to the
Server. | [
"The",
"Qt",
"window",
"has",
"been",
"sent",
"mouse",
"scroll",
"input",
"which",
"we",
"send",
"to",
"the",
"Server",
"."
] | [
"\"\"\"The Qt window has been sent mouse scroll input, which we send to the\n Server.\n \"\"\"",
"# Qt's units are scaled for high-resolution scrolling devices, whereas",
"# the SDK uses the more common Windows units, so we rescale the delta",
"# using Microsoft's \"WHEEL_DELTA\" factor of 120."... | [
{
"param": "self",
"type": null
},
{
"param": "e",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "e",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | viewer_fb_updated | null | def viewer_fb_updated(self, viewer, x, y, w, h):
"""The Server has sent fresh pixel data, so we signal the Qt window to
redraw.
"""
viewer_widget.signal_updated.emit() | The Server has sent fresh pixel data, so we signal the Qt window to
redraw.
| The Server has sent fresh pixel data, so we signal the Qt window to
redraw. | [
"The",
"Server",
"has",
"sent",
"fresh",
"pixel",
"data",
"so",
"we",
"signal",
"the",
"Qt",
"window",
"to",
"redraw",
"."
] | def viewer_fb_updated(self, viewer, x, y, w, h):
viewer_widget.signal_updated.emit() | [
"def",
"viewer_fb_updated",
"(",
"self",
",",
"viewer",
",",
"x",
",",
"y",
",",
"w",
",",
"h",
")",
":",
"viewer_widget",
".",
"signal_updated",
".",
"emit",
"(",
")"
] | The Server has sent fresh pixel data, so we signal the Qt window to
redraw. | [
"The",
"Server",
"has",
"sent",
"fresh",
"pixel",
"data",
"so",
"we",
"signal",
"the",
"Qt",
"window",
"to",
"redraw",
"."
] | [
"\"\"\"The Server has sent fresh pixel data, so we signal the Qt window to\n redraw.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "viewer",
"type": null
},
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
},
{
"param": "w",
"type": null
},
{
"param": "h",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "viewer",
"type": null,
"docstring": null,
"docstring_tokens":... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | server_fb_size_changed | null | def server_fb_size_changed(self, viewer, w, h):
"""The Server screen size has changed, so we signal the Qt window to
resize to match its aspect ratio.
"""
aspect_ratio = w / float(h)
w = self.viewer.get_viewer_fb_width()
h = int(w / aspect_ratio)
self._set_buffer(... | The Server screen size has changed, so we signal the Qt window to
resize to match its aspect ratio.
| The Server screen size has changed, so we signal the Qt window to
resize to match its aspect ratio. | [
"The",
"Server",
"screen",
"size",
"has",
"changed",
"so",
"we",
"signal",
"the",
"Qt",
"window",
"to",
"resize",
"to",
"match",
"its",
"aspect",
"ratio",
"."
] | def server_fb_size_changed(self, viewer, w, h):
aspect_ratio = w / float(h)
w = self.viewer.get_viewer_fb_width()
h = int(w / aspect_ratio)
self._set_buffer(w, h)
viewer_widget.signal_resized.emit(w, h, w, self.buffer, True) | [
"def",
"server_fb_size_changed",
"(",
"self",
",",
"viewer",
",",
"w",
",",
"h",
")",
":",
"aspect_ratio",
"=",
"w",
"/",
"float",
"(",
"h",
")",
"w",
"=",
"self",
".",
"viewer",
".",
"get_viewer_fb_width",
"(",
")",
"h",
"=",
"int",
"(",
"w",
"/",... | The Server screen size has changed, so we signal the Qt window to
resize to match its aspect ratio. | [
"The",
"Server",
"screen",
"size",
"has",
"changed",
"so",
"we",
"signal",
"the",
"Qt",
"window",
"to",
"resize",
"to",
"match",
"its",
"aspect",
"ratio",
"."
] | [
"\"\"\"The Server screen size has changed, so we signal the Qt window to\n resize to match its aspect ratio.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "viewer",
"type": null
},
{
"param": "w",
"type": null
},
{
"param": "h",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "viewer",
"type": null,
"docstring": null,
"docstring_tokens":... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | disconnected | null | def disconnected(self, viewer, reason, flags):
"""The Viewer's connection to the Server has ended."""
message = ""
if vncsdk.Viewer.DisconnectFlags.ALERT_USER in flags:
if not self.is_connected:
message = \
"Disconnected while attempting to establi... | The Viewer's connection to the Server has ended. | The Viewer's connection to the Server has ended. | [
"The",
"Viewer",
"'",
"s",
"connection",
"to",
"the",
"Server",
"has",
"ended",
"."
] | def disconnected(self, viewer, reason, flags):
message = ""
if vncsdk.Viewer.DisconnectFlags.ALERT_USER in flags:
if not self.is_connected:
message = \
"Disconnected while attempting to establish a connection"
message = "{msg}\nDisconnect reaso... | [
"def",
"disconnected",
"(",
"self",
",",
"viewer",
",",
"reason",
",",
"flags",
")",
":",
"message",
"=",
"\"\"",
"if",
"vncsdk",
".",
"Viewer",
".",
"DisconnectFlags",
".",
"ALERT_USER",
"in",
"flags",
":",
"if",
"not",
"self",
".",
"is_connected",
":",... | The Viewer's connection to the Server has ended. | [
"The",
"Viewer",
"'",
"s",
"connection",
"to",
"the",
"Server",
"has",
"ended",
"."
] | [
"\"\"\"The Viewer's connection to the Server has ended.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "viewer",
"type": null
},
{
"param": "reason",
"type": null
},
{
"param": "flags",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "viewer",
"type": null,
"docstring": null,
"docstring_tokens":... |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | extract_port_num | <not_specific> | def extract_port_num(arg):
"""Extract port number from command line argument."""
port = 0
try:
port = int(arg)
except ValueError:
print("Invalid port number\n")
return port | Extract port number from command line argument. | Extract port number from command line argument. | [
"Extract",
"port",
"number",
"from",
"command",
"line",
"argument",
"."
] | def extract_port_num(arg):
port = 0
try:
port = int(arg)
except ValueError:
print("Invalid port number\n")
return port | [
"def",
"extract_port_num",
"(",
"arg",
")",
":",
"port",
"=",
"0",
"try",
":",
"port",
"=",
"int",
"(",
"arg",
")",
"except",
"ValueError",
":",
"print",
"(",
"\"Invalid port number\\n\"",
")",
"return",
"port"
] | Extract port number from command line argument. | [
"Extract",
"port",
"number",
"from",
"command",
"line",
"argument",
"."
] | [
"\"\"\"Extract port number from command line argument.\"\"\""
] | [
{
"param": "arg",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arg",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | parse_command_line | null | def parse_command_line():
"""Parse the command line to obtain connectivity details to be used when
listening for incoming connections. A simplistic approach is adopted:
3 arguments - Cloud connectivity to be used
[LOCAL_CLOUD_ADDRESS LOCAL_CLOUD_PASSWORD PEER_CLOUD_ADDRESS]
2 argumen... | Parse the command line to obtain connectivity details to be used when
listening for incoming connections. A simplistic approach is adopted:
3 arguments - Cloud connectivity to be used
[LOCAL_CLOUD_ADDRESS LOCAL_CLOUD_PASSWORD PEER_CLOUD_ADDRESS]
2 arguments - Direct TCP connectivity to b... | Parse the command line to obtain connectivity details to be used when
listening for incoming connections. A simplistic approach is adopted.
3 arguments - Cloud connectivity to be used
[LOCAL_CLOUD_ADDRESS LOCAL_CLOUD_PASSWORD PEER_CLOUD_ADDRESS]
2 arguments - Direct TCP connectivity to be used
[TCP_ADDRESS TCP_PORT]
... | [
"Parse",
"the",
"command",
"line",
"to",
"obtain",
"connectivity",
"details",
"to",
"be",
"used",
"when",
"listening",
"for",
"incoming",
"connections",
".",
"A",
"simplistic",
"approach",
"is",
"adopted",
".",
"3",
"arguments",
"-",
"Cloud",
"connectivity",
"... | def parse_command_line():
global LOCAL_CLOUD_ADDRESS, LOCAL_CLOUD_PASSWORD, PEER_CLOUD_ADDRESS
global TCP_ADDRESS, TCP_PORT
global using_cloud
bad_args = False
argc = len(sys.argv)
if argc == 4 or argc == 3 or argc == 1:
if argc == 4:
LOCAL_CLOUD_ADDRESS = sys.argv[1]
... | [
"def",
"parse_command_line",
"(",
")",
":",
"global",
"LOCAL_CLOUD_ADDRESS",
",",
"LOCAL_CLOUD_PASSWORD",
",",
"PEER_CLOUD_ADDRESS",
"global",
"TCP_ADDRESS",
",",
"TCP_PORT",
"global",
"using_cloud",
"bad_args",
"=",
"False",
"argc",
"=",
"len",
"(",
"sys",
".",
"... | Parse the command line to obtain connectivity details to be used when
listening for incoming connections. | [
"Parse",
"the",
"command",
"line",
"to",
"obtain",
"connectivity",
"details",
"to",
"be",
"used",
"when",
"listening",
"for",
"incoming",
"connections",
"."
] | [
"\"\"\"Parse the command line to obtain connectivity details to be used when\n listening for incoming connections. A simplistic approach is adopted:\n\n 3 arguments - Cloud connectivity to be used\n [LOCAL_CLOUD_ADDRESS LOCAL_CLOUD_PASSWORD PEER_CLOUD_ADDRESS]\n\n 2 arguments - Direct TCP ... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
9244e59dc7615a84a15b603e240b2c9fdb7d83fe | SkyCloudSystems/skycloud-client-python | basicViewerPython.py | [
"Python-2.0",
"OLDAP-2.7"
] | Python | sdk_main | <not_specific> | def sdk_main():
"""sdk_main() is the main method for the SDK thread. It initializes the
SDK, creates the SDK objects, and runs the SDK event loop. When sdk_main()
exits, the SDK thread has finished.
"""
try:
global using_cloud, direct_tcp_add_on_code, viewer_conn
# Create a logger... | sdk_main() is the main method for the SDK thread. It initializes the
SDK, creates the SDK objects, and runs the SDK event loop. When sdk_main()
exits, the SDK thread has finished.
| sdk_main() is the main method for the SDK thread. It initializes the
SDK, creates the SDK objects, and runs the SDK event loop. When sdk_main()
exits, the SDK thread has finished. | [
"sdk_main",
"()",
"is",
"the",
"main",
"method",
"for",
"the",
"SDK",
"thread",
".",
"It",
"initializes",
"the",
"SDK",
"creates",
"the",
"SDK",
"objects",
"and",
"runs",
"the",
"SDK",
"event",
"loop",
".",
"When",
"sdk_main",
"()",
"exits",
"the",
"SDK"... | def sdk_main():
try:
global using_cloud, direct_tcp_add_on_code, viewer_conn
vncsdk.Logger.create_stderr_logger()
vncsdk.DataStore.create_file_store("dataStore.txt")
vncsdk.init()
if not using_cloud:
try:
vncsdk.enable_add_on(direct_tcp_add_on_code... | [
"def",
"sdk_main",
"(",
")",
":",
"try",
":",
"global",
"using_cloud",
",",
"direct_tcp_add_on_code",
",",
"viewer_conn",
"vncsdk",
".",
"Logger",
".",
"create_stderr_logger",
"(",
")",
"vncsdk",
".",
"DataStore",
".",
"create_file_store",
"(",
"\"dataStore.txt\""... | sdk_main() is the main method for the SDK thread. | [
"sdk_main",
"()",
"is",
"the",
"main",
"method",
"for",
"the",
"SDK",
"thread",
"."
] | [
"\"\"\"sdk_main() is the main method for the SDK thread. It initializes the\n SDK, creates the SDK objects, and runs the SDK event loop. When sdk_main()\n exits, the SDK thread has finished.\n \"\"\"",
"# Create a logger with outputs to sys.stderr",
"# Create a file DataStore for storing persistent d... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d6232b694027f62d86228bf86de0854ae62fdb54 | dwervin/pyhampel | pyhampel/src/filtering_with_dev.py | [
"MIT"
] | Python | hampel_filter_with_dev_df | pd.DataFrame | def hampel_filter_with_dev_df(df: pd.DataFrame, vals_col: str, time_col=None, win_size=30, num_dev=3,
center_win=True) -> pd.DataFrame:
"""
This function takes in dataframe containing time series of values, applies Hampel filter on
these values, and returns dataframe consisting... |
This function takes in dataframe containing time series of values, applies Hampel filter on
these values, and returns dataframe consisting of original values columns along with
the Hampel filtered data, outlier values, boolean flags where outliers found, values for lower
deviation from median, values f... | This function takes in dataframe containing time series of values, applies Hampel filter on
these values, and returns dataframe consisting of original values columns along with
the Hampel filtered data, outlier values, boolean flags where outliers found, values for lower
deviation from median, values for upper deviatio... | [
"This",
"function",
"takes",
"in",
"dataframe",
"containing",
"time",
"series",
"of",
"values",
"applies",
"Hampel",
"filter",
"on",
"these",
"values",
"and",
"returns",
"dataframe",
"consisting",
"of",
"original",
"values",
"columns",
"along",
"with",
"the",
"H... | def hampel_filter_with_dev_df(df: pd.DataFrame, vals_col: str, time_col=None, win_size=30, num_dev=3,
center_win=True) -> pd.DataFrame:
if (time_col != None):
if (time_col not in list(df.columns)):
raise Exception("Timestamp column '{}' is missing!".format(time_col)... | [
"def",
"hampel_filter_with_dev_df",
"(",
"df",
":",
"pd",
".",
"DataFrame",
",",
"vals_col",
":",
"str",
",",
"time_col",
"=",
"None",
",",
"win_size",
"=",
"30",
",",
"num_dev",
"=",
"3",
",",
"center_win",
"=",
"True",
")",
"->",
"pd",
".",
"DataFram... | This function takes in dataframe containing time series of values, applies Hampel filter on
these values, and returns dataframe consisting of original values columns along with
the Hampel filtered data, outlier values, boolean flags where outliers found, values for lower
deviation from median, values for upper deviatio... | [
"This",
"function",
"takes",
"in",
"dataframe",
"containing",
"time",
"series",
"of",
"values",
"applies",
"Hampel",
"filter",
"on",
"these",
"values",
"and",
"returns",
"dataframe",
"consisting",
"of",
"original",
"values",
"columns",
"along",
"with",
"the",
"H... | [
"\"\"\"\n This function takes in dataframe containing time series of values, applies Hampel filter on\n these values, and returns dataframe consisting of original values columns along with\n the Hampel filtered data, outlier values, boolean flags where outliers found, values for lower\n deviation from m... | [
{
"param": "df",
"type": "pd.DataFrame"
},
{
"param": "vals_col",
"type": "str"
},
{
"param": "time_col",
"type": null
},
{
"param": "win_size",
"type": null
},
{
"param": "num_dev",
"type": null
},
{
"param": "center_win",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "df",
"type": "pd.DataFrame",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vals_col",
"type": "str",
"docstring": null,
"docstri... |
d6232b694027f62d86228bf86de0854ae62fdb54 | dwervin/pyhampel | pyhampel/src/filtering_with_dev.py | [
"MIT"
] | Python | hampel_filter_dev_list_of_ts | <not_specific> | def hampel_filter_dev_list_of_ts(ts_list: list, vals_col: str, time_col=None,
win_size: int = 30, num_dev: int = 3, center_win: bool = True):
"""
Function returns a list of filtered dataframes, each consisting of original columns along with
the Hampel filtered data, outlier valu... |
Function returns a list of filtered dataframes, each consisting of original columns along with
the Hampel filtered data, outlier values and boolean flags where outliers found.
Parameters
----------
ts_list: list
List of time-series dataframes
vals_col: str
Single column name th... | Function returns a list of filtered dataframes, each consisting of original columns along with
the Hampel filtered data, outlier values and boolean flags where outliers found.
Parameters
list
List of time-series dataframes
vals_col: str
Single column name that contains values that need to be filtered.
time_col: str
N... | [
"Function",
"returns",
"a",
"list",
"of",
"filtered",
"dataframes",
"each",
"consisting",
"of",
"original",
"columns",
"along",
"with",
"the",
"Hampel",
"filtered",
"data",
"outlier",
"values",
"and",
"boolean",
"flags",
"where",
"outliers",
"found",
".",
"Param... | def hampel_filter_dev_list_of_ts(ts_list: list, vals_col: str, time_col=None,
win_size: int = 30, num_dev: int = 3, center_win: bool = True):
filtered_ts = []
for ts in ts_list:
filtered_ts.append(hampel_filter_with_dev_df(ts, vals_col, time_col, win_size, num_dev, center_wi... | [
"def",
"hampel_filter_dev_list_of_ts",
"(",
"ts_list",
":",
"list",
",",
"vals_col",
":",
"str",
",",
"time_col",
"=",
"None",
",",
"win_size",
":",
"int",
"=",
"30",
",",
"num_dev",
":",
"int",
"=",
"3",
",",
"center_win",
":",
"bool",
"=",
"True",
")... | Function returns a list of filtered dataframes, each consisting of original columns along with
the Hampel filtered data, outlier values and boolean flags where outliers found. | [
"Function",
"returns",
"a",
"list",
"of",
"filtered",
"dataframes",
"each",
"consisting",
"of",
"original",
"columns",
"along",
"with",
"the",
"Hampel",
"filtered",
"data",
"outlier",
"values",
"and",
"boolean",
"flags",
"where",
"outliers",
"found",
"."
] | [
"\"\"\"\n Function returns a list of filtered dataframes, each consisting of original columns along with\n the Hampel filtered data, outlier values and boolean flags where outliers found.\n\n Parameters\n ----------\n ts_list: list\n List of time-series dataframes\n vals_col: str\n S... | [
{
"param": "ts_list",
"type": "list"
},
{
"param": "vals_col",
"type": "str"
},
{
"param": "time_col",
"type": null
},
{
"param": "win_size",
"type": "int"
},
{
"param": "num_dev",
"type": "int"
},
{
"param": "center_win",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ts_list",
"type": "list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vals_col",
"type": "str",
"docstring": null,
"docstring_... |
0851795ad23e60504d52b1adbd42006ecb3a3504 | dwervin/pyhampel | pyhampel/utils/ts_utils.py | [
"MIT"
] | Python | gen_list_of_frames | <not_specific> | def gen_list_of_frames(df_ts: pd.DataFrame, grp_keys: list):
"""
This function takes a single dataframe of time-series data and groups them based
upon a key value for each distinct time series.
For example, if you have time series for 10 company's stocks, you can separate these 10 company's stock
t... |
This function takes a single dataframe of time-series data and groups them based
upon a key value for each distinct time series.
For example, if you have time series for 10 company's stocks, you can separate these 10 company's stock
time-series into a list of dataframes, where each dataframe is an ind... | This function takes a single dataframe of time-series data and groups them based
upon a key value for each distinct time series.
For example, if you have time series for 10 company's stocks, you can separate these 10 company's stock
time-series into a list of dataframes, where each dataframe is an individual time-seri... | [
"This",
"function",
"takes",
"a",
"single",
"dataframe",
"of",
"time",
"-",
"series",
"data",
"and",
"groups",
"them",
"based",
"upon",
"a",
"key",
"value",
"for",
"each",
"distinct",
"time",
"series",
".",
"For",
"example",
"if",
"you",
"have",
"time",
... | def gen_list_of_frames(df_ts: pd.DataFrame, grp_keys: list):
grp_list = []
df_groups = df_ts.groupby(grp_keys)
for name, df in df_groups:
grp_list.append(df)
return grp_list | [
"def",
"gen_list_of_frames",
"(",
"df_ts",
":",
"pd",
".",
"DataFrame",
",",
"grp_keys",
":",
"list",
")",
":",
"grp_list",
"=",
"[",
"]",
"df_groups",
"=",
"df_ts",
".",
"groupby",
"(",
"grp_keys",
")",
"for",
"name",
",",
"df",
"in",
"df_groups",
":"... | This function takes a single dataframe of time-series data and groups them based
upon a key value for each distinct time series. | [
"This",
"function",
"takes",
"a",
"single",
"dataframe",
"of",
"time",
"-",
"series",
"data",
"and",
"groups",
"them",
"based",
"upon",
"a",
"key",
"value",
"for",
"each",
"distinct",
"time",
"series",
"."
] | [
"\"\"\"\n This function takes a single dataframe of time-series data and groups them based\n upon a key value for each distinct time series.\n\n For example, if you have time series for 10 company's stocks, you can separate these 10 company's stock\n time-series into a list of dataframes, where each dat... | [
{
"param": "df_ts",
"type": "pd.DataFrame"
},
{
"param": "grp_keys",
"type": "list"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "df_ts",
"type": "pd.DataFrame",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "grp_keys",
"type": "list",
"docstring": null,
"doc... |
303fb444b64d667c53498fa007b5fea77d500644 | dwervin/pyhampel | pyhampel/dataviz/interactive_viz.py | [
"MIT"
] | Python | hampel_interactive | <not_specific> | def hampel_interactive(df_list: list, key_col, orig_col: str, filtered_col: str, outlier_col: str):
"""
Function to create interactive plots from list of Hampel filter dataframes
Parameters
----------
df_list: list(pd.DataFrame)
List of time series dataframes. Generally the output from ham... |
Function to create interactive plots from list of Hampel filter dataframes
Parameters
----------
df_list: list(pd.DataFrame)
List of time series dataframes. Generally the output from hampel_mp, but can also be individually
compiled list of time series dataframes as long as columns are... | Function to create interactive plots from list of Hampel filter dataframes
Parameters
list(pd.DataFrame)
List of time series dataframes. Generally the output from hampel_mp, but can also be individually
compiled list of time series dataframes as long as columns are consistently names in each one.
key_col: str
This is... | [
"Function",
"to",
"create",
"interactive",
"plots",
"from",
"list",
"of",
"Hampel",
"filter",
"dataframes",
"Parameters",
"list",
"(",
"pd",
".",
"DataFrame",
")",
"List",
"of",
"time",
"series",
"dataframes",
".",
"Generally",
"the",
"output",
"from",
"hampel... | def hampel_interactive(df_list: list, key_col, orig_col: str, filtered_col: str, outlier_col: str):
list_idx = widgets.IntSlider(value=1.0, min=1.0, max=len(df_list) - 1, step=1.0, description='List IDX:',
continuous_update=False)
recalc_outlier = widgets.Checkbox(description='R... | [
"def",
"hampel_interactive",
"(",
"df_list",
":",
"list",
",",
"key_col",
",",
"orig_col",
":",
"str",
",",
"filtered_col",
":",
"str",
",",
"outlier_col",
":",
"str",
")",
":",
"list_idx",
"=",
"widgets",
".",
"IntSlider",
"(",
"value",
"=",
"1.0",
",",... | Function to create interactive plots from list of Hampel filter dataframes
Parameters | [
"Function",
"to",
"create",
"interactive",
"plots",
"from",
"list",
"of",
"Hampel",
"filter",
"dataframes",
"Parameters"
] | [
"\"\"\"\n Function to create interactive plots from list of Hampel filter dataframes\n\n Parameters\n ----------\n df_list: list(pd.DataFrame)\n List of time series dataframes. Generally the output from hampel_mp, but can also be individually\n compiled list of time series dataframes as l... | [
{
"param": "df_list",
"type": "list"
},
{
"param": "key_col",
"type": null
},
{
"param": "orig_col",
"type": "str"
},
{
"param": "filtered_col",
"type": "str"
},
{
"param": "outlier_col",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "df_list",
"type": "list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "key_col",
"type": null,
"docstring": null,
"docstring_to... |
7d574a65f272347dc73f602f55ba5b3e8c74e738 | dwervin/pyhampel | pyhampel/src/multiproc_filtering_w_dev.py | [
"MIT"
] | Python | hampel_with_dev_mp | <not_specific> | def hampel_with_dev_mp(g_list: list, vals_col: str, time_col=None, win_size=30, num_dev=3, center_win=True):
"""
Parameters
----------
g_list: list(pd.DataFrame)
list of time series dataframes usually generated from gen_list_of_frames() function, but can also be
individually compiled li... |
Parameters
----------
g_list: list(pd.DataFrame)
list of time series dataframes usually generated from gen_list_of_frames() function, but can also be
individually compiled list of time series dataframes as long as columns are consistently named in each one.
vals_col: str
Name o... | Parameters
g_list: list(pd.DataFrame)
list of time series dataframes usually generated from gen_list_of_frames() function, but can also be
individually compiled list of time series dataframes as long as columns are consistently named in each one.
vals_col: str
Name of column containing the original values to be process... | [
"Parameters",
"g_list",
":",
"list",
"(",
"pd",
".",
"DataFrame",
")",
"list",
"of",
"time",
"series",
"dataframes",
"usually",
"generated",
"from",
"gen_list_of_frames",
"()",
"function",
"but",
"can",
"also",
"be",
"individually",
"compiled",
"list",
"of",
"... | def hampel_with_dev_mp(g_list: list, vals_col: str, time_col=None, win_size=30, num_dev=3, center_win=True):
from HampelWithDev import hampel_filter_with_dev_df
__name__ = '__main__'
global results
results = []
if __name__ == '__main__':
pool = mp.Pool(mp.cpu_count())
def collect_res... | [
"def",
"hampel_with_dev_mp",
"(",
"g_list",
":",
"list",
",",
"vals_col",
":",
"str",
",",
"time_col",
"=",
"None",
",",
"win_size",
"=",
"30",
",",
"num_dev",
"=",
"3",
",",
"center_win",
"=",
"True",
")",
":",
"from",
"HampelWithDev",
"import",
"hampel... | Parameters
g_list: list(pd.DataFrame)
list of time series dataframes usually generated from gen_list_of_frames() function, but can also be
individually compiled list of time series dataframes as long as columns are consistently named in each one. | [
"Parameters",
"g_list",
":",
"list",
"(",
"pd",
".",
"DataFrame",
")",
"list",
"of",
"time",
"series",
"dataframes",
"usually",
"generated",
"from",
"gen_list_of_frames",
"()",
"function",
"but",
"can",
"also",
"be",
"individually",
"compiled",
"list",
"of",
"... | [
"\"\"\"\n\n Parameters\n ----------\n g_list: list(pd.DataFrame)\n list of time series dataframes usually generated from gen_list_of_frames() function, but can also be\n individually compiled list of time series dataframes as long as columns are consistently named in each one.\n vals_col: ... | [
{
"param": "g_list",
"type": "list"
},
{
"param": "vals_col",
"type": "str"
},
{
"param": "time_col",
"type": null
},
{
"param": "win_size",
"type": null
},
{
"param": "num_dev",
"type": null
},
{
"param": "center_win",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "g_list",
"type": "list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vals_col",
"type": "str",
"docstring": null,
"docstring_t... |
4be5a045650adb198880559a675936d38de3252b | dwervin/pyhampel | pyhampel/ingestion/time_series_ingestion.py | [
"MIT"
] | Python | ingest_list_of_files | pd.DataFrame | def ingest_list_of_files(data_files: list, conv: dict, header: int = 0) -> pd.DataFrame:
"""
This function reads data contained in the list of files and returns a single dataframe
containing all the data.
Parameters
----------
data_files: list
list of data files to read. These files sh... |
This function reads data contained in the list of files and returns a single dataframe
containing all the data.
Parameters
----------
data_files: list
list of data files to read. These files should all have the same headers and number of columns
conv: dict
dictionary containin... | This function reads data contained in the list of files and returns a single dataframe
containing all the data.
Parameters
list
list of data files to read. These files should all have the same headers and number of columns
conv: dict
dictionary containing column names and data types for columns. This will override ... | [
"This",
"function",
"reads",
"data",
"contained",
"in",
"the",
"list",
"of",
"files",
"and",
"returns",
"a",
"single",
"dataframe",
"containing",
"all",
"the",
"data",
".",
"Parameters",
"list",
"list",
"of",
"data",
"files",
"to",
"read",
".",
"These",
"f... | def ingest_list_of_files(data_files: list, conv: dict, header: int = 0) -> pd.DataFrame:
li = []
cols = []
for filename in data_files:
frame = pd.read_csv(filename, index_col=None, header=header, converters=conv)
if len(cols) == 0:
cols = list(frame.columns)
elif set(cols... | [
"def",
"ingest_list_of_files",
"(",
"data_files",
":",
"list",
",",
"conv",
":",
"dict",
",",
"header",
":",
"int",
"=",
"0",
")",
"->",
"pd",
".",
"DataFrame",
":",
"li",
"=",
"[",
"]",
"cols",
"=",
"[",
"]",
"for",
"filename",
"in",
"data_files",
... | This function reads data contained in the list of files and returns a single dataframe
containing all the data. | [
"This",
"function",
"reads",
"data",
"contained",
"in",
"the",
"list",
"of",
"files",
"and",
"returns",
"a",
"single",
"dataframe",
"containing",
"all",
"the",
"data",
"."
] | [
"\"\"\"\n This function reads data contained in the list of files and returns a single dataframe\n containing all the data.\n\n Parameters\n ----------\n data_files: list\n list of data files to read. These files should all have the same headers and number of columns\n conv: dict\n ... | [
{
"param": "data_files",
"type": "list"
},
{
"param": "conv",
"type": "dict"
},
{
"param": "header",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data_files",
"type": "list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "conv",
"type": "dict",
"docstring": null,
"docstring_... |
6d9f56bbbf76a86bd3ea4679d58c6584f4f7029d | lewtun/nbdev | nbdev/cli.py | [
"Apache-2.0"
] | Python | _get_title | <not_specific> | def _get_title(fname):
"Grabs the title of html file `fname`"
with open(fname, 'r') as f: code = f.read()
src = _re_catch_title.search(code)
return fname.stem if src is None else src.groups()[0] | Grabs the title of html file `fname` | Grabs the title of html file `fname` | [
"Grabs",
"the",
"title",
"of",
"html",
"file",
"`",
"fname",
"`"
] | def _get_title(fname):
with open(fname, 'r') as f: code = f.read()
src = _re_catch_title.search(code)
return fname.stem if src is None else src.groups()[0] | [
"def",
"_get_title",
"(",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
",",
"'r'",
")",
"as",
"f",
":",
"code",
"=",
"f",
".",
"read",
"(",
")",
"src",
"=",
"_re_catch_title",
".",
"search",
"(",
"code",
")",
"return",
"fname",
".",
"stem",
"... | Grabs the title of html file `fname` | [
"Grabs",
"the",
"title",
"of",
"html",
"file",
"`",
"fname",
"`"
] | [
"\"Grabs the title of html file `fname`\""
] | [
{
"param": "fname",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fname",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6d9f56bbbf76a86bd3ea4679d58c6584f4f7029d | lewtun/nbdev | nbdev/cli.py | [
"Apache-2.0"
] | Python | create_default_sidebar | null | def create_default_sidebar():
"Create the default sidebar for the docs website"
dic = {"Overview": "/"}
files = [f for f in Config().nbs_path.glob('*.ipynb') if not f.name.startswith('_')]
fnames = [_nb2htmlfname(f) for f in sorted(files)]
dic.update({_get_title(f):f'/{f.stem}' for f in fnames if f.... | Create the default sidebar for the docs website | Create the default sidebar for the docs website | [
"Create",
"the",
"default",
"sidebar",
"for",
"the",
"docs",
"website"
] | def create_default_sidebar():
dic = {"Overview": "/"}
files = [f for f in Config().nbs_path.glob('*.ipynb') if not f.name.startswith('_')]
fnames = [_nb2htmlfname(f) for f in sorted(files)]
dic.update({_get_title(f):f'/{f.stem}' for f in fnames if f.stem!='index'})
dic = {Config().lib_name: dic}
... | [
"def",
"create_default_sidebar",
"(",
")",
":",
"dic",
"=",
"{",
"\"Overview\"",
":",
"\"/\"",
"}",
"files",
"=",
"[",
"f",
"for",
"f",
"in",
"Config",
"(",
")",
".",
"nbs_path",
".",
"glob",
"(",
"'*.ipynb'",
")",
"if",
"not",
"f",
".",
"name",
".... | Create the default sidebar for the docs website | [
"Create",
"the",
"default",
"sidebar",
"for",
"the",
"docs",
"website"
] | [
"\"Create the default sidebar for the docs website\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
6d9f56bbbf76a86bd3ea4679d58c6584f4f7029d | lewtun/nbdev | nbdev/cli.py | [
"Apache-2.0"
] | Python | make_sidebar | null | def make_sidebar():
"Making sidebar for the doc website form the content of `doc_folder/sidebar.json`"
if not (Config().doc_path/'sidebar.json').exists() or Config().custom_sidebar == 'False': create_default_sidebar()
sidebar_d = json.load(open(Config().doc_path/'sidebar.json', 'r'))
res = _side_dict('S... | Making sidebar for the doc website form the content of `doc_folder/sidebar.json` | Making sidebar for the doc website form the content of `doc_folder/sidebar.json` | [
"Making",
"sidebar",
"for",
"the",
"doc",
"website",
"form",
"the",
"content",
"of",
"`",
"doc_folder",
"/",
"sidebar",
".",
"json",
"`"
] | def make_sidebar():
if not (Config().doc_path/'sidebar.json').exists() or Config().custom_sidebar == 'False': create_default_sidebar()
sidebar_d = json.load(open(Config().doc_path/'sidebar.json', 'r'))
res = _side_dict('Sidebar', sidebar_d)
res = {'entries': [res]}
res_s = yaml.dump(res, default_flo... | [
"def",
"make_sidebar",
"(",
")",
":",
"if",
"not",
"(",
"Config",
"(",
")",
".",
"doc_path",
"/",
"'sidebar.json'",
")",
".",
"exists",
"(",
")",
"or",
"Config",
"(",
")",
".",
"custom_sidebar",
"==",
"'False'",
":",
"create_default_sidebar",
"(",
")",
... | Making sidebar for the doc website form the content of `doc_folder/sidebar.json` | [
"Making",
"sidebar",
"for",
"the",
"doc",
"website",
"form",
"the",
"content",
"of",
"`",
"doc_folder",
"/",
"sidebar",
".",
"json",
"`"
] | [
"\"Making sidebar for the doc website form the content of `doc_folder/sidebar.json`\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
6d9f56bbbf76a86bd3ea4679d58c6584f4f7029d | lewtun/nbdev | nbdev/cli.py | [
"Apache-2.0"
] | Python | make_readme | null | def make_readme():
"Convert the index notebook to README.md"
index_fn = None
for f in Config().nbs_path.glob('*.ipynb'):
if _re_index.match(f.name): index_fn = f
assert index_fn is not None, "Could not locate index notebook"
convert_md(index_fn, Config().config_file.parent, jekyll=False)
... | Convert the index notebook to README.md | Convert the index notebook to README.md | [
"Convert",
"the",
"index",
"notebook",
"to",
"README",
".",
"md"
] | def make_readme():
index_fn = None
for f in Config().nbs_path.glob('*.ipynb'):
if _re_index.match(f.name): index_fn = f
assert index_fn is not None, "Could not locate index notebook"
convert_md(index_fn, Config().config_file.parent, jekyll=False)
n = Config().config_file.parent/index_fn.with... | [
"def",
"make_readme",
"(",
")",
":",
"index_fn",
"=",
"None",
"for",
"f",
"in",
"Config",
"(",
")",
".",
"nbs_path",
".",
"glob",
"(",
"'*.ipynb'",
")",
":",
"if",
"_re_index",
".",
"match",
"(",
"f",
".",
"name",
")",
":",
"index_fn",
"=",
"f",
... | Convert the index notebook to README.md | [
"Convert",
"the",
"index",
"notebook",
"to",
"README",
".",
"md"
] | [
"\"Convert the index notebook to README.md\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
6d9f56bbbf76a86bd3ea4679d58c6584f4f7029d | lewtun/nbdev | nbdev/cli.py | [
"Apache-2.0"
] | Python | nbdev_nb2md | null | def nbdev_nb2md(fname:Param("A notebook file name to convert", str),
dest:Param("The destination folder", str)='.',
jekyll:Param("To use jekyll metadata for your markdown file or not", bool)=True,):
"Convert the notebook in `fname` to a markdown file"
convert_md(fname, dest, jeky... | Convert the notebook in `fname` to a markdown file | Convert the notebook in `fname` to a markdown file | [
"Convert",
"the",
"notebook",
"in",
"`",
"fname",
"`",
"to",
"a",
"markdown",
"file"
] | def nbdev_nb2md(fname:Param("A notebook file name to convert", str),
dest:Param("The destination folder", str)='.',
jekyll:Param("To use jekyll metadata for your markdown file or not", bool)=True,):
convert_md(fname, dest, jekyll=jekyll) | [
"def",
"nbdev_nb2md",
"(",
"fname",
":",
"Param",
"(",
"\"A notebook file name to convert\"",
",",
"str",
")",
",",
"dest",
":",
"Param",
"(",
"\"The destination folder\"",
",",
"str",
")",
"=",
"'.'",
",",
"jekyll",
":",
"Param",
"(",
"\"To use jekyll metadata ... | Convert the notebook in `fname` to a markdown file | [
"Convert",
"the",
"notebook",
"in",
"`",
"fname",
"`",
"to",
"a",
"markdown",
"file"
] | [
"\"Convert the notebook in `fname` to a markdown file\""
] | [
{
"param": "fname",
"type": "Param(\"A notebook file name to convert\", str)"
},
{
"param": "dest",
"type": "Param(\"The destination folder\", str)"
},
{
"param": "jekyll",
"type": "Param(\"To use jekyll metadata for your markdown file or not\", bool)"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fname",
"type": "Param(\"A notebook file name to convert\", str)",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest",
"type": "Param(\"The... |
6d9f56bbbf76a86bd3ea4679d58c6584f4f7029d | lewtun/nbdev | nbdev/cli.py | [
"Apache-2.0"
] | Python | nbdev_install_git_hooks | null | def nbdev_install_git_hooks():
"Install git hooks to clean/trust notebooks automatically"
path = Config().config_file.parent
fn = path/'.git'/'hooks'/'post-merge'
#Trust notebooks after merge
with open(fn, 'w') as f:
f.write("""#!/bin/bash
echo "Trusting notebooks"
nbdev_trust_nbs
"""
... | Install git hooks to clean/trust notebooks automatically | Install git hooks to clean/trust notebooks automatically | [
"Install",
"git",
"hooks",
"to",
"clean",
"/",
"trust",
"notebooks",
"automatically"
] | def nbdev_install_git_hooks():
path = Config().config_file.parent
fn = path/'.git'/'hooks'/'post-merge'
with open(fn, 'w') as f:
f.write("""#!/bin/bash
echo "Trusting notebooks"
nbdev_trust_nbs
"""
)
os.chmod(fn, os.stat(fn).st_mode | stat.S_IEXEC)
with open(path/'.gitconfig', 'w') a... | [
"def",
"nbdev_install_git_hooks",
"(",
")",
":",
"path",
"=",
"Config",
"(",
")",
".",
"config_file",
".",
"parent",
"fn",
"=",
"path",
"/",
"'.git'",
"/",
"'hooks'",
"/",
"'post-merge'",
"with",
"open",
"(",
"fn",
",",
"'w'",
")",
"as",
"f",
":",
"f... | Install git hooks to clean/trust notebooks automatically | [
"Install",
"git",
"hooks",
"to",
"clean",
"/",
"trust",
"notebooks",
"automatically"
] | [
"\"Install git hooks to clean/trust notebooks automatically\"",
"#Trust notebooks after merge",
"#Clean notebooks on commit/diff"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
310792598290b253e9e2555ebc0f04adc480314f | pearsedoolin/covpy | covpy/__init__.py | [
"MIT"
] | Python | _get_df | null | def _get_df(self, force_new=False):
""" Checks if data has already been downloaded for today's date, and
if is has not been, it is downloaded.
Args:
lookback (int): The number of days to look back for data if today's
data is not available.
force_new (boo... | Checks if data has already been downloaded for today's date, and
if is has not been, it is downloaded.
Args:
lookback (int): The number of days to look back for data if today's
data is not available.
force_new (bool): Force data to be redownloaded from the ECDC... | Checks if data has already been downloaded for today's date, and
if is has not been, it is downloaded.
lookback (int): The number of days to look back for data if today's
data is not available.
force_new (bool): Force data to be redownloaded from the ECDC's website | [
"Checks",
"if",
"data",
"has",
"already",
"been",
"downloaded",
"for",
"today",
"'",
"s",
"date",
"and",
"if",
"is",
"has",
"not",
"been",
"it",
"is",
"downloaded",
".",
"lookback",
"(",
"int",
")",
":",
"The",
"number",
"of",
"days",
"to",
"look",
"... | def _get_df(self, force_new=False):
today = datetime.date.today()
if (force_new or self._df.empty or self._df_date != today):
url = "https://www.ecdc.europa.eu/sites/default/files/documents/COVID-19-geographic-disbtribution-worldwide.xlsx"
self._df = pd.read_excel(url)
... | [
"def",
"_get_df",
"(",
"self",
",",
"force_new",
"=",
"False",
")",
":",
"today",
"=",
"datetime",
".",
"date",
".",
"today",
"(",
")",
"if",
"(",
"force_new",
"or",
"self",
".",
"_df",
".",
"empty",
"or",
"self",
".",
"_df_date",
"!=",
"today",
")... | Checks if data has already been downloaded for today's date, and
if is has not been, it is downloaded. | [
"Checks",
"if",
"data",
"has",
"already",
"been",
"downloaded",
"for",
"today",
"'",
"s",
"date",
"and",
"if",
"is",
"has",
"not",
"been",
"it",
"is",
"downloaded",
"."
] | [
"\"\"\" Checks if data has already been downloaded for today's date, and\n if is has not been, it is downloaded.\n\n Args:\n lookback (int): The number of days to look back for data if today's\n data is not available.\n\n force_new (bool): Force data to be redownlo... | [
{
"param": "self",
"type": null
},
{
"param": "force_new",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "force_new",
"type": null,
"docstring": null,
"docstring_token... |
c63577d751c1c3aa17771768734363855dea1bd0 | mvsaha/pykey | keycodes.py | [
"MIT"
] | Python | build_remap_command | <not_specific> | def build_remap_command(*, remappings=None, swaps=None):
"""Build a command that will perform a remapping using macos' `hidutil`.
Parameters
----------
remappings : dict(int: int)
Multiple rules that remap one physical key into another.
These mappings are one way. Each key item of t... | Build a command that will perform a remapping using macos' `hidutil`.
Parameters
----------
remappings : dict(int: int)
Multiple rules that remap one physical key into another.
These mappings are one way. Each key item of the dictionary will
be mapped to its corresponding value,... | Build a command that will perform a remapping using macos' `hidutil`.
Parameters
remappings : dict(int: int)
Multiple rules that remap one physical key into another.
These mappings are one way. Each key item of the dictionary will
be mapped to its corresponding value, but the value key will
not be remapped.
swaps : l... | [
"Build",
"a",
"command",
"that",
"will",
"perform",
"a",
"remapping",
"using",
"macos",
"'",
"`",
"hidutil",
"`",
".",
"Parameters",
"remappings",
":",
"dict",
"(",
"int",
":",
"int",
")",
"Multiple",
"rules",
"that",
"remap",
"one",
"physical",
"key",
"... | def build_remap_command(*, remappings=None, swaps=None):
remappings = remappings or dict()
assert type(remappings) is dict
remappings = set(remappings.items())
swaps = swaps or []
swaps = set(s for s in swaps) | set(tuple(reversed(s)) for s in swaps)
rules = sorted(remappings | swaps)
rules ... | [
"def",
"build_remap_command",
"(",
"*",
",",
"remappings",
"=",
"None",
",",
"swaps",
"=",
"None",
")",
":",
"remappings",
"=",
"remappings",
"or",
"dict",
"(",
")",
"assert",
"type",
"(",
"remappings",
")",
"is",
"dict",
"remappings",
"=",
"set",
"(",
... | Build a command that will perform a remapping using macos' `hidutil`. | [
"Build",
"a",
"command",
"that",
"will",
"perform",
"a",
"remapping",
"using",
"macos",
"'",
"`",
"hidutil",
"`",
"."
] | [
"\"\"\"Build a command that will perform a remapping using macos' `hidutil`.\n \n Parameters\n ----------\n remappings : dict(int: int)\n Multiple rules that remap one physical key into another.\n These mappings are one way. Each key item of the dictionary will\n be mapped to its co... | [
{
"param": "remappings",
"type": null
},
{
"param": "swaps",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "remappings",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "swaps",
"type": null,
"docstring": null,
"docstring_tok... |
a96052a3ae502662546a44889d3ee10c067c021b | digimatronics/tensorflow1 | tensorflow/python/feature_column/feature_column.py | [
"Apache-2.0"
] | Python | categorical_column_with_hash_bucket | <not_specific> | def categorical_column_with_hash_bucket(key,
hash_bucket_size,
dtype=dtypes.string):
"""Represents sparse feature where ids are set by hashing.
Use this when your sparse features are in string or integer format where you
want to dist... | Represents sparse feature where ids are set by hashing.
Use this when your sparse features are in string or integer format where you
want to distribute your inputs into a finite number of buckets by hashing.
output_id = Hash(input_feature_string) % bucket_size
Example:
```python
keywords = categorical_co... | Represents sparse feature where ids are set by hashing.
Use this when your sparse features are in string or integer format where you
want to distribute your inputs into a finite number of buckets by hashing. | [
"Represents",
"sparse",
"feature",
"where",
"ids",
"are",
"set",
"by",
"hashing",
".",
"Use",
"this",
"when",
"your",
"sparse",
"features",
"are",
"in",
"string",
"or",
"integer",
"format",
"where",
"you",
"want",
"to",
"distribute",
"your",
"inputs",
"into"... | def categorical_column_with_hash_bucket(key,
hash_bucket_size,
dtype=dtypes.string):
if hash_bucket_size is None:
raise ValueError('hash_bucket_size must be set. ' 'key: {}'.format(key))
if hash_bucket_size < 1:
raise ValueError... | [
"def",
"categorical_column_with_hash_bucket",
"(",
"key",
",",
"hash_bucket_size",
",",
"dtype",
"=",
"dtypes",
".",
"string",
")",
":",
"if",
"hash_bucket_size",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'hash_bucket_size must be set. '",
"'key: {}'",
".",
"f... | Represents sparse feature where ids are set by hashing. | [
"Represents",
"sparse",
"feature",
"where",
"ids",
"are",
"set",
"by",
"hashing",
"."
] | [
"\"\"\"Represents sparse feature where ids are set by hashing.\n\n Use this when your sparse features are in string or integer format where you\n want to distribute your inputs into a finite number of buckets by hashing.\n output_id = Hash(input_feature_string) % bucket_size\n\n Example:\n\n ```python\n keywo... | [
{
"param": "key",
"type": null
},
{
"param": "hash_bucket_size",
"type": null
},
{
"param": "dtype",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [
{
"docstring": "`hash_bucket_size` is not greater than 1.",
"docstring_tokens": [
"`",
"hash_bucket_size",
"`",
"is",
"n... |
d40db6137abe5262ff90c7ebf4876394811f075b | Sundaybrian/Picasso | gallery/models.py | [
"MIT"
] | Python | save_loc | null | def save_loc(self):
'''
method to save a category to db
'''
self.save() |
method to save a category to db
| method to save a category to db | [
"method",
"to",
"save",
"a",
"category",
"to",
"db"
] | def save_loc(self):
self.save() | [
"def",
"save_loc",
"(",
"self",
")",
":",
"self",
".",
"save",
"(",
")"
] | method to save a category to db | [
"method",
"to",
"save",
"a",
"category",
"to",
"db"
] | [
"'''\n method to save a category to db\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d40db6137abe5262ff90c7ebf4876394811f075b | Sundaybrian/Picasso | gallery/models.py | [
"MIT"
] | Python | delete_loc | null | def delete_loc(self):
'''
method to delete a category from db
'''
self.delete() |
method to delete a category from db
| method to delete a category from db | [
"method",
"to",
"delete",
"a",
"category",
"from",
"db"
] | def delete_loc(self):
self.delete() | [
"def",
"delete_loc",
"(",
"self",
")",
":",
"self",
".",
"delete",
"(",
")"
] | method to delete a category from db | [
"method",
"to",
"delete",
"a",
"category",
"from",
"db"
] | [
"'''\n method to delete a category from db\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f8602801e78404376410dec5a5ef9d99d4636b04 | datasoftsrl/ssh-poweroff | sshpoff.py | [
"MIT"
] | Python | _random_colors | null | def _random_colors():
"""
Returns a generators with names of random colors.
"""
colors = [
'red',
'pink',
'deep-purple',
'indigo',
'blue',
'light-blue',
'cyan',
'teal',
'green',
'light-green',
'orange',
'deep-orange',
'brown',
'blue-grey'
]
random.shu... |
Returns a generators with names of random colors.
| Returns a generators with names of random colors. | [
"Returns",
"a",
"generators",
"with",
"names",
"of",
"random",
"colors",
"."
] | def _random_colors():
colors = [
'red',
'pink',
'deep-purple',
'indigo',
'blue',
'light-blue',
'cyan',
'teal',
'green',
'light-green',
'orange',
'deep-orange',
'brown',
'blue-grey'
]
random.shuffle(colors)
count = 0
length = len(colors)
while True:
... | [
"def",
"_random_colors",
"(",
")",
":",
"colors",
"=",
"[",
"'red'",
",",
"'pink'",
",",
"'deep-purple'",
",",
"'indigo'",
",",
"'blue'",
",",
"'light-blue'",
",",
"'cyan'",
",",
"'teal'",
",",
"'green'",
",",
"'light-green'",
",",
"'orange'",
",",
"'deep-... | Returns a generators with names of random colors. | [
"Returns",
"a",
"generators",
"with",
"names",
"of",
"random",
"colors",
"."
] | [
"\"\"\"\n Returns a generators with names of random colors.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f8602801e78404376410dec5a5ef9d99d4636b04 | datasoftsrl/ssh-poweroff | sshpoff.py | [
"MIT"
] | Python | command | <not_specific> | def command():
"""
Executes a command to a given device (form field 'id') when triggered.
"""
global config, devices
if request.method == 'POST':
name = request.form['id']
try:
properties = devices[name]
ssh = pxssh()
ssh.force_password = True
ssh.options['StrictHostKeyCheckin... |
Executes a command to a given device (form field 'id') when triggered.
| Executes a command to a given device (form field 'id') when triggered. | [
"Executes",
"a",
"command",
"to",
"a",
"given",
"device",
"(",
"form",
"field",
"'",
"id",
"'",
")",
"when",
"triggered",
"."
] | def command():
global config, devices
if request.method == 'POST':
name = request.form['id']
try:
properties = devices[name]
ssh = pxssh()
ssh.force_password = True
ssh.options['StrictHostKeyChecking'] = 'no'
ssh.login(
server = properties['host'],
username = pr... | [
"def",
"command",
"(",
")",
":",
"global",
"config",
",",
"devices",
"if",
"request",
".",
"method",
"==",
"'POST'",
":",
"name",
"=",
"request",
".",
"form",
"[",
"'id'",
"]",
"try",
":",
"properties",
"=",
"devices",
"[",
"name",
"]",
"ssh",
"=",
... | Executes a command to a given device (form field 'id') when triggered. | [
"Executes",
"a",
"command",
"to",
"a",
"given",
"device",
"(",
"form",
"field",
"'",
"id",
"'",
")",
"when",
"triggered",
"."
] | [
"\"\"\"\n Executes a command to a given device (form field 'id') when triggered.\n \"\"\"",
"# log",
"# user tried to launch a command on an unexistent device",
"# ssh connection failed"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
cad38cc5d74d95545ccfd785d6f763a2efbbab74 | pabloalarconm/PERSEO | pyperseo/functions.py | [
"MIT"
] | Python | nt2ttl | null | def nt2ttl(path_file):
"""
Data transformation from .nt file to .ttl
"""
g = Graph()
g.parse(str(path_file), format="turtle")
g.namespace_manager.bind('this', URIRef("http://example.org/data/"))
g.namespace_manager.bind('sio', URIRef("http://semanticscience.org/resource/"))
g.namespace... |
Data transformation from .nt file to .ttl
| Data transformation from .nt file to .ttl | [
"Data",
"transformation",
"from",
".",
"nt",
"file",
"to",
".",
"ttl"
] | def nt2ttl(path_file):
g = Graph()
g.parse(str(path_file), format="turtle")
g.namespace_manager.bind('this', URIRef("http://example.org/data/"))
g.namespace_manager.bind('sio', URIRef("http://semanticscience.org/resource/"))
g.namespace_manager.bind('obo', URIRef("http://purl.obolibrary.org/obo/"))
... | [
"def",
"nt2ttl",
"(",
"path_file",
")",
":",
"g",
"=",
"Graph",
"(",
")",
"g",
".",
"parse",
"(",
"str",
"(",
"path_file",
")",
",",
"format",
"=",
"\"turtle\"",
")",
"g",
".",
"namespace_manager",
".",
"bind",
"(",
"'this'",
",",
"URIRef",
"(",
"\... | Data transformation from .nt file to .ttl | [
"Data",
"transformation",
"from",
".",
"nt",
"file",
"to",
".",
"ttl"
] | [
"\"\"\"\n Data transformation from .nt file to .ttl\n \"\"\"",
"#all_ns = [n for n in g.namespace_manager.namespaces()]",
"#print(all_ns)"
] | [
{
"param": "path_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cad38cc5d74d95545ccfd785d6f763a2efbbab74 | pabloalarconm/PERSEO | pyperseo/functions.py | [
"MIT"
] | Python | uniqid | null | def uniqid(path_file):
"""
Creates unique identifier column based on milisecond timestamp.
"""
data = pd.read_csv(path_file)
data['uniqid'] = ""
for i in data.index:
data.at[i, "uniqid"] = milisec()
print(data['uniqid'])
data.to_csv(path_file, sep="," , index=False) |
Creates unique identifier column based on milisecond timestamp.
| Creates unique identifier column based on milisecond timestamp. | [
"Creates",
"unique",
"identifier",
"column",
"based",
"on",
"milisecond",
"timestamp",
"."
] | def uniqid(path_file):
data = pd.read_csv(path_file)
data['uniqid'] = ""
for i in data.index:
data.at[i, "uniqid"] = milisec()
print(data['uniqid'])
data.to_csv(path_file, sep="," , index=False) | [
"def",
"uniqid",
"(",
"path_file",
")",
":",
"data",
"=",
"pd",
".",
"read_csv",
"(",
"path_file",
")",
"data",
"[",
"'uniqid'",
"]",
"=",
"\"\"",
"for",
"i",
"in",
"data",
".",
"index",
":",
"data",
".",
"at",
"[",
"i",
",",
"\"uniqid\"",
"]",
"... | Creates unique identifier column based on milisecond timestamp. | [
"Creates",
"unique",
"identifier",
"column",
"based",
"on",
"milisecond",
"timestamp",
"."
] | [
"\"\"\"\n Creates unique identifier column based on milisecond timestamp.\n \"\"\""
] | [
{
"param": "path_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bea25f1ff7fc16636b18d109ebe10734af16fa60 | Honny1/purkQuiz | _bot/run.py | [
"Beerware"
] | Python | startPlay | null | def startPlay(self):
""" this method start the quiz by clicking an PLAY button"""
self.htmlButton = self.driver.find_element_by_id("play") # identify play button
self.htmlButton.click()
time.sleep(2) # we must wait while page content get changed
self.vote() | this method start the quiz by clicking an PLAY button | this method start the quiz by clicking an PLAY button | [
"this",
"method",
"start",
"the",
"quiz",
"by",
"clicking",
"an",
"PLAY",
"button"
] | def startPlay(self):
self.htmlButton = self.driver.find_element_by_id("play")
self.htmlButton.click()
time.sleep(2)
self.vote() | [
"def",
"startPlay",
"(",
"self",
")",
":",
"self",
".",
"htmlButton",
"=",
"self",
".",
"driver",
".",
"find_element_by_id",
"(",
"\"play\"",
")",
"self",
".",
"htmlButton",
".",
"click",
"(",
")",
"time",
".",
"sleep",
"(",
"2",
")",
"self",
".",
"v... | this method start the quiz by clicking an PLAY button | [
"this",
"method",
"start",
"the",
"quiz",
"by",
"clicking",
"an",
"PLAY",
"button"
] | [
"\"\"\" this method start the quiz by clicking an PLAY button\"\"\"",
"# identify play button",
"# we must wait while page content get changed"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bea25f1ff7fc16636b18d109ebe10734af16fa60 | Honny1/purkQuiz | _bot/run.py | [
"Beerware"
] | Python | vote | null | def vote(self):
""" this method voting in the quiz"""
self.questionNumber = 1 # variable for console log
while True:
try:
self.randomChoose = self.d[random.randint(1,4)] # variable for vote and console log
self.htmlButtonInGame = self.driver.find_eleme... | this method voting in the quiz | this method voting in the quiz | [
"this",
"method",
"voting",
"in",
"the",
"quiz"
] | def vote(self):
self.questionNumber = 1
while True:
try:
self.randomChoose = self.d[random.randint(1,4)]
self.htmlButtonInGame = self.driver.find_element_by_id(self.randomChoose)
self.htmlButtonInGame.click()
self.waitToNext ... | [
"def",
"vote",
"(",
"self",
")",
":",
"self",
".",
"questionNumber",
"=",
"1",
"while",
"True",
":",
"try",
":",
"self",
".",
"randomChoose",
"=",
"self",
".",
"d",
"[",
"random",
".",
"randint",
"(",
"1",
",",
"4",
")",
"]",
"self",
".",
"htmlBu... | this method voting in the quiz | [
"this",
"method",
"voting",
"in",
"the",
"quiz"
] | [
"\"\"\" this method voting in the quiz\"\"\"",
"# variable for console log",
"# variable for vote and console log",
"# identify answer button",
"# printing some log to console",
"#2.0875) # we must wait while page content get changed",
"# this conditial will happen everytime, when the bot voted for ever... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d36365e7cfd2c356efa841b0aef3ca11d225614d | Lkxz/categorical-kernels | experiments/runners.py | [
"MIT"
] | Python | _single_run | null | def _single_run(self, kernels, **kwargs):
"""Generate a dataset an train/test all the kernels on it."""
if self.verbose:
print("#{} {}".format(self.state, time.asctime()))
# Generate the appropiate dataset:
dataset = self._generate_dataset(**kwargs)
# Split the data i... | Generate a dataset an train/test all the kernels on it. | Generate a dataset an train/test all the kernels on it. | [
"Generate",
"a",
"dataset",
"an",
"train",
"/",
"test",
"all",
"the",
"kernels",
"on",
"it",
"."
] | def _single_run(self, kernels, **kwargs):
if self.verbose:
print("#{} {}".format(self.state, time.asctime()))
dataset = self._generate_dataset(**kwargs)
X_train, X_test, y_train, y_test = dataset.train_test_split(
train_size=kwargs['train_size'],
test_size=kwa... | [
"def",
"_single_run",
"(",
"self",
",",
"kernels",
",",
"**",
"kwargs",
")",
":",
"if",
"self",
".",
"verbose",
":",
"print",
"(",
"\"#{} {}\"",
".",
"format",
"(",
"self",
".",
"state",
",",
"time",
".",
"asctime",
"(",
")",
")",
")",
"dataset",
"... | Generate a dataset an train/test all the kernels on it. | [
"Generate",
"a",
"dataset",
"an",
"train",
"/",
"test",
"all",
"the",
"kernels",
"on",
"it",
"."
] | [
"\"\"\"Generate a dataset an train/test all the kernels on it.\"\"\"",
"# Generate the appropiate dataset:",
"# Split the data in train and test:",
"# Cross validation folds:",
"# Test preformance with every kernel:",
"# Instantiate the model:",
"# Train the model:",
"# Test the model:",
"# Update r... | [
{
"param": "self",
"type": null
},
{
"param": "kernels",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "kernels",
"type": null,
"docstring": null,
"docstring_tokens"... |
8fd776af920693d2ce9445dbd1bac6ec7470cdf5 | Lkxz/categorical-kernels | kcat/utils.py | [
"MIT"
] | Python | pgen | <not_specific> | def pgen(X):
"""Returns a function that applies `pgen` to each element in `X`.
:param X: Matrix where each row is an example and each column a categorical
attribute.
:returns: Function that applies pgen to any matrix.
"""
pgen = get_pgen(X)
return lambda Y: apply_pgen(pgen, Y) | Returns a function that applies `pgen` to each element in `X`.
:param X: Matrix where each row is an example and each column a categorical
attribute.
:returns: Function that applies pgen to any matrix.
| Returns a function that applies `pgen` to each element in `X`. | [
"Returns",
"a",
"function",
"that",
"applies",
"`",
"pgen",
"`",
"to",
"each",
"element",
"in",
"`",
"X",
"`",
"."
] | def pgen(X):
pgen = get_pgen(X)
return lambda Y: apply_pgen(pgen, Y) | [
"def",
"pgen",
"(",
"X",
")",
":",
"pgen",
"=",
"get_pgen",
"(",
"X",
")",
"return",
"lambda",
"Y",
":",
"apply_pgen",
"(",
"pgen",
",",
"Y",
")"
] | Returns a function that applies `pgen` to each element in `X`. | [
"Returns",
"a",
"function",
"that",
"applies",
"`",
"pgen",
"`",
"to",
"each",
"element",
"in",
"`",
"X",
"`",
"."
] | [
"\"\"\"Returns a function that applies `pgen` to each element in `X`.\n\n :param X: Matrix where each row is an example and each column a categorical\n attribute.\n\n :returns: Function that applies pgen to any matrix.\n \"\"\""
] | [
{
"param": "X",
"type": null
}
] | {
"returns": [
{
"docstring": "Function that applies pgen to any matrix.",
"docstring_tokens": [
"Function",
"that",
"applies",
"pgen",
"to",
"any",
"matrix",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
... |
ab4e4bd4b306b6462971ce163118b4b6561bad65 | Lkxz/categorical-kernels | kcat/kernels/search.py | [
"MIT"
] | Python | kernel | <not_specific> | def kernel(cls, *args, **kwargs):
"""Calls the kernel function associated with the current class."""
if cls.kernel_function is None:
return args[0]
else:
return cls.kernel_function(*args, **kwargs) | Calls the kernel function associated with the current class. | Calls the kernel function associated with the current class. | [
"Calls",
"the",
"kernel",
"function",
"associated",
"with",
"the",
"current",
"class",
"."
] | def kernel(cls, *args, **kwargs):
if cls.kernel_function is None:
return args[0]
else:
return cls.kernel_function(*args, **kwargs) | [
"def",
"kernel",
"(",
"cls",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"if",
"cls",
".",
"kernel_function",
"is",
"None",
":",
"return",
"args",
"[",
"0",
"]",
"else",
":",
"return",
"cls",
".",
"kernel_function",
"(",
"*",
"args",
",",
"**"... | Calls the kernel function associated with the current class. | [
"Calls",
"the",
"kernel",
"function",
"associated",
"with",
"the",
"current",
"class",
"."
] | [
"\"\"\"Calls the kernel function associated with the current class.\"\"\""
] | [
{
"param": "cls",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ab4e4bd4b306b6462971ce163118b4b6561bad65 | Lkxz/categorical-kernels | kcat/kernels/search.py | [
"MIT"
] | Python | details | <not_specific> | def details(self):
"""A dictionary with the found parameters and error."""
details = {
'train_score': self.best_score_,
'best_parameters': {},
}
details['best_parameters'].update(self.best_params_)
details['best_parameters'].update(self.best_kparams_)
... | A dictionary with the found parameters and error. | A dictionary with the found parameters and error. | [
"A",
"dictionary",
"with",
"the",
"found",
"parameters",
"and",
"error",
"."
] | def details(self):
details = {
'train_score': self.best_score_,
'best_parameters': {},
}
details['best_parameters'].update(self.best_params_)
details['best_parameters'].update(self.best_kparams_)
return details | [
"def",
"details",
"(",
"self",
")",
":",
"details",
"=",
"{",
"'train_score'",
":",
"self",
".",
"best_score_",
",",
"'best_parameters'",
":",
"{",
"}",
",",
"}",
"details",
"[",
"'best_parameters'",
"]",
".",
"update",
"(",
"self",
".",
"best_params_",
... | A dictionary with the found parameters and error. | [
"A",
"dictionary",
"with",
"the",
"found",
"parameters",
"and",
"error",
"."
] | [
"\"\"\"A dictionary with the found parameters and error.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
35c63590cb6efd61ae273273698f6db527dba239 | fwj867/xiaomi_miot_raw | custom_components/xiaomi_miot_raw/media_player.py | [
"Apache-2.0"
] | Python | async_setup_platform | null | async def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the fan from config."""
if DATA_KEY not in hass.data:
hass.data[DATA_KEY] = {}
host = config.get(CONF_HOST)
token = config.get(CONF_TOKEN)
mapping = config.get(CONF_MAPPING)
params = config.... | Set up the fan from config. | Set up the fan from config. | [
"Set",
"up",
"the",
"fan",
"from",
"config",
"."
] | async def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
if DATA_KEY not in hass.data:
hass.data[DATA_KEY] = {}
host = config.get(CONF_HOST)
token = config.get(CONF_TOKEN)
mapping = config.get(CONF_MAPPING)
params = config.get(CONF_CONTROL_PARAMS)
mappingnew ... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_devices",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"DATA_KEY",
"not",
"in",
"hass",
".",
"data",
":",
"hass",
".",
"data",
"[",
"DATA_KEY",
"]",
"=",
"{",
"}",... | Set up the fan from config. | [
"Set",
"up",
"the",
"fan",
"from",
"config",
"."
] | [
"\"\"\"Set up the fan from config.\"\"\""
] | [
{
"param": "hass",
"type": null
},
{
"param": "config",
"type": null
},
{
"param": "async_add_devices",
"type": null
},
{
"param": "discovery_info",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "hass",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config",
"type": null,
"docstring": null,
"docstring_tokens":... |
35c63590cb6efd61ae273273698f6db527dba239 | fwj867/xiaomi_miot_raw | custom_components/xiaomi_miot_raw/media_player.py | [
"Apache-2.0"
] | Python | sound_mode_list | <not_specific> | def sound_mode_list(self):
"""Return a list of available sound modes."""
if s := self._ctrl_params.get('mp_sound_mode'):
return list(s)
return [] | Return a list of available sound modes. | Return a list of available sound modes. | [
"Return",
"a",
"list",
"of",
"available",
"sound",
"modes",
"."
] | def sound_mode_list(self):
if s := self._ctrl_params.get('mp_sound_mode'):
return list(s)
return [] | [
"def",
"sound_mode_list",
"(",
"self",
")",
":",
"if",
"s",
":=",
"self",
".",
"_ctrl_params",
".",
"get",
"(",
"'mp_sound_mode'",
")",
":",
"return",
"list",
"(",
"s",
")",
"return",
"[",
"]"
] | Return a list of available sound modes. | [
"Return",
"a",
"list",
"of",
"available",
"sound",
"modes",
"."
] | [
"\"\"\"Return a list of available sound modes.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8fc7a3e791aa48c91aa05d56407df1feb691b39b | fwj867/xiaomi_miot_raw | custom_components/xiaomi_miot_raw/__init__.py | [
"Apache-2.0"
] | Python | async_setup_entry | <not_specific> | async def async_setup_entry(hass, entry):
"""Set up shopping list from config flow."""
hass.data.setdefault(DOMAIN, {})
# entry for MiCloud login
if 'username' in entry.data:
return await _setup_micloud_entry(hass, entry)
config = {}
for item in [CONF_NAME,
CONF_HOST,
... | Set up shopping list from config flow. | Set up shopping list from config flow. | [
"Set",
"up",
"shopping",
"list",
"from",
"config",
"flow",
"."
] | async def async_setup_entry(hass, entry):
hass.data.setdefault(DOMAIN, {})
if 'username' in entry.data:
return await _setup_micloud_entry(hass, entry)
config = {}
for item in [CONF_NAME,
CONF_HOST,
CONF_TOKEN,
CONF_CLOUD,
'cloud... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
")",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"if",
"'username'",
"in",
"entry",
".",
"data",
":",
"return",
"await",
"_setup_micloud_entry",
"(",
"has... | Set up shopping list from config flow. | [
"Set",
"up",
"shopping",
"list",
"from",
"config",
"flow",
"."
] | [
"\"\"\"Set up shopping list from config flow.\"\"\"",
"# entry for MiCloud login"
] | [
{
"param": "hass",
"type": null
},
{
"param": "entry",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "hass",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": null,
"docstring": null,
"docstring_tokens": ... |
8fc7a3e791aa48c91aa05d56407df1feb691b39b | fwj867/xiaomi_miot_raw | custom_components/xiaomi_miot_raw/__init__.py | [
"Apache-2.0"
] | Python | _try_command | <not_specific> | async def _try_command(self, mask_error, func, *args, **kwargs):
"""Call a device command handling error messages."""
try:
result = await self.hass.async_add_job(partial(func, *args, **kwargs))
_LOGGER.info("Response received from %s: %s", self._name, result)
# This ... | Call a device command handling error messages. | Call a device command handling error messages. | [
"Call",
"a",
"device",
"command",
"handling",
"error",
"messages",
"."
] | async def _try_command(self, mask_error, func, *args, **kwargs):
try:
result = await self.hass.async_add_job(partial(func, *args, **kwargs))
_LOGGER.info("Response received from %s: %s", self._name, result)
if 'aiid' in result:
return True if result['code'] ==... | [
"async",
"def",
"_try_command",
"(",
"self",
",",
"mask_error",
",",
"func",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"try",
":",
"result",
"=",
"await",
"self",
".",
"hass",
".",
"async_add_job",
"(",
"partial",
"(",
"func",
",",
"*",
"args"... | Call a device command handling error messages. | [
"Call",
"a",
"device",
"command",
"handling",
"error",
"messages",
"."
] | [
"\"\"\"Call a device command handling error messages.\"\"\"",
"# This is a workaround. The action should not only return whether operation succeed, but also the 'out'."
] | [
{
"param": "self",
"type": null
},
{
"param": "mask_error",
"type": null
},
{
"param": "func",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mask_error",
"type": null,
"docstring": null,
"docstring_toke... |
8fc7a3e791aa48c91aa05d56407df1feb691b39b | fwj867/xiaomi_miot_raw | custom_components/xiaomi_miot_raw/__init__.py | [
"Apache-2.0"
] | Python | async_update | <not_specific> | async def async_update(self):
"""Fetch state from the device."""
def pre_process_data(key, value):
try:
if key in self._ctrl_params_new:
if f := self._ctrl_params_new[key].get('value_ratio'):
return round(value * f , 3)
... | Fetch state from the device. | Fetch state from the device. | [
"Fetch",
"state",
"from",
"the",
"device",
"."
] | async def async_update(self):
def pre_process_data(key, value):
try:
if key in self._ctrl_params_new:
if f := self._ctrl_params_new[key].get('value_ratio'):
return round(value * f , 3)
if 'value_list' in self._ctrl_param... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"def",
"pre_process_data",
"(",
"key",
",",
"value",
")",
":",
"try",
":",
"if",
"key",
"in",
"self",
".",
"_ctrl_params_new",
":",
"if",
"f",
":=",
"self",
".",
"_ctrl_params_new",
"[",
"key",
"]"... | Fetch state from the device. | [
"Fetch",
"state",
"from",
"the",
"device",
"."
] | [
"\"\"\"Fetch state from the device.\"\"\"",
"# On state change some devices doesn't provide the new state immediately.",
"# _LOGGER.warn(\"设备不支持状态反馈\")",
"# TODO handle -704030013 (Unreadable property)"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8fc7a3e791aa48c91aa05d56407df1feb691b39b | fwj867/xiaomi_miot_raw | custom_components/xiaomi_miot_raw/__init__.py | [
"Apache-2.0"
] | Python | async_added_to_hass | None | async def async_added_to_hass(self) -> None:
"""When entity is added to hass."""
if UPDATE_BETA_FLAG and self.coordinator:
self.async_on_remove(
self.coordinator.async_add_listener(self._handle_coordinator_update)
) | When entity is added to hass. | When entity is added to hass. | [
"When",
"entity",
"is",
"added",
"to",
"hass",
"."
] | async def async_added_to_hass(self) -> None:
if UPDATE_BETA_FLAG and self.coordinator:
self.async_on_remove(
self.coordinator.async_add_listener(self._handle_coordinator_update)
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"if",
"UPDATE_BETA_FLAG",
"and",
"self",
".",
"coordinator",
":",
"self",
".",
"async_on_remove",
"(",
"self",
".",
"coordinator",
".",
"async_add_listener",
"(",
"self",
".",
"_handle... | When entity is added to hass. | [
"When",
"entity",
"is",
"added",
"to",
"hass",
"."
] | [
"\"\"\"When entity is added to hass.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8fc7a3e791aa48c91aa05d56407df1feb691b39b | fwj867/xiaomi_miot_raw | custom_components/xiaomi_miot_raw/__init__.py | [
"Apache-2.0"
] | Python | _handle_coordinator_update | None | def _handle_coordinator_update(self) -> None:
"""Handle updated data from the coordinator."""
dict1 = {}
statedict = {}
if self._cloud['did'] in self.coordinator.data:
if all(item['code'] == -704042011 for item in self.coordinator.data[self._cloud['did']]):
if... | Handle updated data from the coordinator. | Handle updated data from the coordinator. | [
"Handle",
"updated",
"data",
"from",
"the",
"coordinator",
"."
] | def _handle_coordinator_update(self) -> None:
dict1 = {}
statedict = {}
if self._cloud['did'] in self.coordinator.data:
if all(item['code'] == -704042011 for item in self.coordinator.data[self._cloud['did']]):
if self._available == True or self._available == None:
... | [
"def",
"_handle_coordinator_update",
"(",
"self",
")",
"->",
"None",
":",
"dict1",
"=",
"{",
"}",
"statedict",
"=",
"{",
"}",
"if",
"self",
".",
"_cloud",
"[",
"'did'",
"]",
"in",
"self",
".",
"coordinator",
".",
"data",
":",
"if",
"all",
"(",
"item"... | Handle updated data from the coordinator. | [
"Handle",
"updated",
"data",
"from",
"the",
"coordinator",
"."
] | [
"\"\"\"Handle updated data from the coordinator.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8fc7a3e791aa48c91aa05d56407df1feb691b39b | fwj867/xiaomi_miot_raw | custom_components/xiaomi_miot_raw/__init__.py | [
"Apache-2.0"
] | Python | async_service_handler | null | def async_service_handler(self, service):
"""Map services to methods on XiaomiMiioDevice."""
method = SERVICE_TO_METHOD.get(service.service)
params = {
key: value for key, value in service.data.items() if key != ATTR_ENTITY_ID
}
entity_ids = service.data.get(ATTR_ENTI... | Map services to methods on XiaomiMiioDevice. | Map services to methods on XiaomiMiioDevice. | [
"Map",
"services",
"to",
"methods",
"on",
"XiaomiMiioDevice",
"."
] | def async_service_handler(self, service):
method = SERVICE_TO_METHOD.get(service.service)
params = {
key: value for key, value in service.data.items() if key != ATTR_ENTITY_ID
}
entity_ids = service.data.get(ATTR_ENTITY_ID)
if entity_ids:
devices = [
... | [
"def",
"async_service_handler",
"(",
"self",
",",
"service",
")",
":",
"method",
"=",
"SERVICE_TO_METHOD",
".",
"get",
"(",
"service",
".",
"service",
")",
"params",
"=",
"{",
"key",
":",
"value",
"for",
"key",
",",
"value",
"in",
"service",
".",
"data",... | Map services to methods on XiaomiMiioDevice. | [
"Map",
"services",
"to",
"methods",
"on",
"XiaomiMiioDevice",
"."
] | [
"\"\"\"Map services to methods on XiaomiMiioDevice.\"\"\"",
"# devices = hass.data[DOMAIN]['entities'].values()"
] | [
{
"param": "self",
"type": null
},
{
"param": "service",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "service",
"type": null,
"docstring": null,
"docstring_tokens"... |
ae8531d950277ef8ad591bcc086b0c73db72f04c | vdyc/fake-logs | fake_logs/fake_logs_cli.py | [
"MIT"
] | Python | run_from_cli | null | def run_from_cli(fake_tokens=None):
"""Parse command-line options and run 'Fake Logs'."""
line_pattern = LinePattern(args.pattern, date_pattern=args.date_pattern, file_format=args.format, fake_tokens=fake_tokens, log_freq=args.log_freq)
FakeLogs(
filename=args.output,
num_lines=args.num_lines,
sleep=args.sleep... | Parse command-line options and run 'Fake Logs'. | Parse command-line options and run 'Fake Logs'. | [
"Parse",
"command",
"-",
"line",
"options",
"and",
"run",
"'",
"Fake",
"Logs",
"'",
"."
] | def run_from_cli(fake_tokens=None):
line_pattern = LinePattern(args.pattern, date_pattern=args.date_pattern, file_format=args.format, fake_tokens=fake_tokens, log_freq=args.log_freq)
FakeLogs(
filename=args.output,
num_lines=args.num_lines,
sleep=args.sleep,
line_pattern=line_pattern,
file_format=args.forma... | [
"def",
"run_from_cli",
"(",
"fake_tokens",
"=",
"None",
")",
":",
"line_pattern",
"=",
"LinePattern",
"(",
"args",
".",
"pattern",
",",
"date_pattern",
"=",
"args",
".",
"date_pattern",
",",
"file_format",
"=",
"args",
".",
"format",
",",
"fake_tokens",
"=",... | Parse command-line options and run 'Fake Logs'. | [
"Parse",
"command",
"-",
"line",
"options",
"and",
"run",
"'",
"Fake",
"Logs",
"'",
"."
] | [
"\"\"\"Parse command-line options and run 'Fake Logs'.\"\"\""
] | [
{
"param": "fake_tokens",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fake_tokens",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d22545b051f0e9343043fa8cd7f2411252bbfa31 | vdyc/fake-logs | fake_logs/util.py | [
"MIT"
] | Python | append_debug_level_to_file | null | def append_debug_level_to_file(path_name):
"""
Add debug level and Tag to the front of each line
"""
def write_to_file(file_name):
lines = []
base_name = os.path.basename(file_name)
with open(file_name, "r", encoding='utf-8') as f:
for i, line in enumerate(f):
debug_level = WeightedChoice(["V", "D", "I... |
Add debug level and Tag to the front of each line
| Add debug level and Tag to the front of each line | [
"Add",
"debug",
"level",
"and",
"Tag",
"to",
"the",
"front",
"of",
"each",
"line"
] | def append_debug_level_to_file(path_name):
def write_to_file(file_name):
lines = []
base_name = os.path.basename(file_name)
with open(file_name, "r", encoding='utf-8') as f:
for i, line in enumerate(f):
debug_level = WeightedChoice(["V", "D", "I", "W", "E", "F"], [0.5, 0.35, 0.06, 0.04, 0.02, 0.03])
l... | [
"def",
"append_debug_level_to_file",
"(",
"path_name",
")",
":",
"def",
"write_to_file",
"(",
"file_name",
")",
":",
"lines",
"=",
"[",
"]",
"base_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"file_name",
")",
"with",
"open",
"(",
"file_name",
",",... | Add debug level and Tag to the front of each line | [
"Add",
"debug",
"level",
"and",
"Tag",
"to",
"the",
"front",
"of",
"each",
"line"
] | [
"\"\"\"\n\tAdd debug level and Tag to the front of each line\n\t\"\"\""
] | [
{
"param": "path_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4c53f7daca14a7882a9f431389c3fe2e0e478b1c | alessandrome/udacity-nanodegree-data-structures-n-algorithms-basic-algorithms | src/p2_search_rotated.py | [
"MIT"
] | Python | rotated_array_search | <not_specific> | def rotated_array_search(input_list, number):
"""
Find the index by searching in a rotated sorted array
Args:
input_list(array), number(int): Input array to search and the target
Returns:
int: Index or -1
"""
if len(input_list) == 0:
return -1
list_len = len(input_list... |
Find the index by searching in a rotated sorted array
Args:
input_list(array), number(int): Input array to search and the target
Returns:
int: Index or -1
| Find the index by searching in a rotated sorted array | [
"Find",
"the",
"index",
"by",
"searching",
"in",
"a",
"rotated",
"sorted",
"array"
] | def rotated_array_search(input_list, number):
if len(input_list) == 0:
return -1
list_len = len(input_list)
left_index = 0
right_index = list_len - 1
while not left_index > right_index:
mid = (left_index + right_index) // 2
if input_list[mid] == number:
return mid... | [
"def",
"rotated_array_search",
"(",
"input_list",
",",
"number",
")",
":",
"if",
"len",
"(",
"input_list",
")",
"==",
"0",
":",
"return",
"-",
"1",
"list_len",
"=",
"len",
"(",
"input_list",
")",
"left_index",
"=",
"0",
"right_index",
"=",
"list_len",
"-... | Find the index by searching in a rotated sorted array | [
"Find",
"the",
"index",
"by",
"searching",
"in",
"a",
"rotated",
"sorted",
"array"
] | [
"\"\"\"\n Find the index by searching in a rotated sorted array\n\n Args:\n input_list(array), number(int): Input array to search and the target\n Returns:\n int: Index or -1\n \"\"\"",
"# left -> mid is sorted i can continue as a binary search",
"# As this subarray is sorted, we can qui... | [
{
"param": "input_list",
"type": null
},
{
"param": "number",
"type": null
}
] | {
"returns": [
{
"docstring": "Index or -1",
"docstring_tokens": [
"Index",
"or",
"-",
"1"
],
"type": "int"
}
],
"raises": [],
"params": [
{
"identifier": "input_list",
"type": null,
"docstring": "Input array to search and the... |
4e6e8d3ec945d133f4f70f73c105c6b3b51a8997 | alessandrome/udacity-nanodegree-data-structures-n-algorithms-basic-algorithms | src/p3_rearrange_array_digits.py | [
"MIT"
] | Python | rearrange_digits | <not_specific> | def rearrange_digits(input_list):
"""
Rearrange Array Elements so as to form two number such that their sum is maximum.
Args:
input_list(list): Input List
Returns:
(int),(int): Two maximum sums
"""
list_len = len(input_list)
# If list doesn't have at least 2 element is not pos... |
Rearrange Array Elements so as to form two number such that their sum is maximum.
Args:
input_list(list): Input List
Returns:
(int),(int): Two maximum sums
| Rearrange Array Elements so as to form two number such that their sum is maximum. | [
"Rearrange",
"Array",
"Elements",
"so",
"as",
"to",
"form",
"two",
"number",
"such",
"that",
"their",
"sum",
"is",
"maximum",
"."
] | def rearrange_digits(input_list):
list_len = len(input_list)
if list_len < 2:
return []
return_list = [0, 0]
heapsort(input_list)
return_index = 0
multiplier = 1
for i in range(list_len):
return_list[return_index] += input_list[i] * multiplier
if return_index == 1:
... | [
"def",
"rearrange_digits",
"(",
"input_list",
")",
":",
"list_len",
"=",
"len",
"(",
"input_list",
")",
"if",
"list_len",
"<",
"2",
":",
"return",
"[",
"]",
"return_list",
"=",
"[",
"0",
",",
"0",
"]",
"heapsort",
"(",
"input_list",
")",
"return_index",
... | Rearrange Array Elements so as to form two number such that their sum is maximum. | [
"Rearrange",
"Array",
"Elements",
"so",
"as",
"to",
"form",
"two",
"number",
"such",
"that",
"their",
"sum",
"is",
"maximum",
"."
] | [
"\"\"\"\n Rearrange Array Elements so as to form two number such that their sum is maximum.\n\n Args:\n input_list(list): Input List\n Returns:\n (int),(int): Two maximum sums\n \"\"\"",
"# If list doesn't have at least 2 element is not possible made sum between two number"
] | [
{
"param": "input_list",
"type": null
}
] | {
"returns": [
{
"docstring": "Two maximum sums",
"docstring_tokens": [
"Two",
"maximum",
"sums"
],
"type": "(int),(int)"
}
],
"raises": [],
"params": [
{
"identifier": "input_list",
"type": null,
"docstring": null,
"docstring_t... |
e50d1ee26ded5f2c5a37961aba6bb5aebd002b54 | dmgav/docs | source/_cookbook/grid_in_grid.py | [
"BSD-2-Clause"
] | Python | grid_in_grid | null | def grid_in_grid(samples):
"""
Scan a grid around the neighborhood of each sample.
Parameters
----------
sample : dict
mapping each sample's name to its (x, y) position
"""
# In this example we hard-code the hardware and other parameters. For more
# flexibility, they could ... |
Scan a grid around the neighborhood of each sample.
Parameters
----------
sample : dict
mapping each sample's name to its (x, y) position
| Scan a grid around the neighborhood of each sample.
Parameters
sample : dict
mapping each sample's name to its (x, y) position | [
"Scan",
"a",
"grid",
"around",
"the",
"neighborhood",
"of",
"each",
"sample",
".",
"Parameters",
"sample",
":",
"dict",
"mapping",
"each",
"sample",
"'",
"s",
"name",
"to",
"its",
"(",
"x",
"y",
")",
"position"
] | def grid_in_grid(samples):
detector = det4
x = motor1
y = motor2
x_range = y_range = 0.2
x_num = y_num = 5
@subs_decorator([LiveTable([detector, x, y]),
LivePlot('motor2', 'motor1')])
def plan():
for name, position in samples.items():
md = {'sample': ... | [
"def",
"grid_in_grid",
"(",
"samples",
")",
":",
"detector",
"=",
"det4",
"x",
"=",
"motor1",
"y",
"=",
"motor2",
"x_range",
"=",
"y_range",
"=",
"0.2",
"x_num",
"=",
"y_num",
"=",
"5",
"@",
"subs_decorator",
"(",
"[",
"LiveTable",
"(",
"[",
"detector"... | Scan a grid around the neighborhood of each sample. | [
"Scan",
"a",
"grid",
"around",
"the",
"neighborhood",
"of",
"each",
"sample",
"."
] | [
"\"\"\"\n Scan a grid around the neighborhood of each sample.\n\n Parameters\n ----------\n sample : dict\n mapping each sample's name to its (x, y) position\n \"\"\"",
"# In this example we hard-code the hardware and other parameters. For more",
"# flexibility, they could instead be param... | [
{
"param": "samples",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "samples",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9b9863258cef5fcf6b8dda7d088e4fe1b08d0c3b | nokome/repo2docker | repo2docker/contentproviders/base.py | [
"BSD-3-Clause"
] | Python | detect | null | def detect(self, repo, ref=None, extra_args=None):
"""Determine compatibility between source and this provider.
If the provider knows how to fetch this source it will return a
`spec` that can be passed to `fetch`. The arguments are the `repo`
string passed on the command-line, the value... | Determine compatibility between source and this provider.
If the provider knows how to fetch this source it will return a
`spec` that can be passed to `fetch`. The arguments are the `repo`
string passed on the command-line, the value of the --ref parameter,
if provided and any provider ... | Determine compatibility between source and this provider.
If the provider knows how to fetch this source it will return a
`spec` that can be passed to `fetch`. The arguments are the `repo`
string passed on the command-line, the value of the --ref parameter,
if provided and any provider specific arguments provided on th... | [
"Determine",
"compatibility",
"between",
"source",
"and",
"this",
"provider",
".",
"If",
"the",
"provider",
"knows",
"how",
"to",
"fetch",
"this",
"source",
"it",
"will",
"return",
"a",
"`",
"spec",
"`",
"that",
"can",
"be",
"passed",
"to",
"`",
"fetch",
... | def detect(self, repo, ref=None, extra_args=None):
raise NotImplementedError() | [
"def",
"detect",
"(",
"self",
",",
"repo",
",",
"ref",
"=",
"None",
",",
"extra_args",
"=",
"None",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | Determine compatibility between source and this provider. | [
"Determine",
"compatibility",
"between",
"source",
"and",
"this",
"provider",
"."
] | [
"\"\"\"Determine compatibility between source and this provider.\n\n If the provider knows how to fetch this source it will return a\n `spec` that can be passed to `fetch`. The arguments are the `repo`\n string passed on the command-line, the value of the --ref parameter,\n if provided a... | [
{
"param": "self",
"type": null
},
{
"param": "repo",
"type": null
},
{
"param": "ref",
"type": null
},
{
"param": "extra_args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "repo",
"type": null,
"docstring": null,
"docstring_tokens": [... |
9b9863258cef5fcf6b8dda7d088e4fe1b08d0c3b | nokome/repo2docker | repo2docker/contentproviders/base.py | [
"BSD-3-Clause"
] | Python | fetch | null | def fetch(self, spec, output_dir, yield_output=False):
"""Provide the contents of given spec to output_dir
This generator yields logging information if `yield_output=True`,
otherwise log output is printed to stdout.
Arguments:
spec -- Dict specification understood by this C... | Provide the contents of given spec to output_dir
This generator yields logging information if `yield_output=True`,
otherwise log output is printed to stdout.
Arguments:
spec -- Dict specification understood by this ContentProvider
output_dir {string} -- Path to output d... | Provide the contents of given spec to output_dir
This generator yields logging information if `yield_output=True`,
otherwise log output is printed to stdout.
| [
"Provide",
"the",
"contents",
"of",
"given",
"spec",
"to",
"output_dir",
"This",
"generator",
"yields",
"logging",
"information",
"if",
"`",
"yield_output",
"=",
"True",
"`",
"otherwise",
"log",
"output",
"is",
"printed",
"to",
"stdout",
"."
] | def fetch(self, spec, output_dir, yield_output=False):
raise NotImplementedError() | [
"def",
"fetch",
"(",
"self",
",",
"spec",
",",
"output_dir",
",",
"yield_output",
"=",
"False",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | Provide the contents of given spec to output_dir
This generator yields logging information if `yield_output=True`,
otherwise log output is printed to stdout. | [
"Provide",
"the",
"contents",
"of",
"given",
"spec",
"to",
"output_dir",
"This",
"generator",
"yields",
"logging",
"information",
"if",
"`",
"yield_output",
"=",
"True",
"`",
"otherwise",
"log",
"output",
"is",
"printed",
"to",
"stdout",
"."
] | [
"\"\"\"Provide the contents of given spec to output_dir\n\n This generator yields logging information if `yield_output=True`,\n otherwise log output is printed to stdout.\n\n Arguments:\n spec -- Dict specification understood by this ContentProvider\n output_dir {string} -... | [
{
"param": "self",
"type": null
},
{
"param": "spec",
"type": null
},
{
"param": "output_dir",
"type": null
},
{
"param": "yield_output",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "spec",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ea4038139b598a7204ea40167680cde04feac59e | nokome/repo2docker | repo2docker/app.py | [
"BSD-3-Clause"
] | Python | fetch | null | def fetch(self, url, ref, checkout_path):
"""Check out a repo using url and ref to the checkout_path locationself.
Iterate through possible content providers until a valid provider,
based on URL, is found.
"""
picked_content_provider = None
for ContentProvider in self.co... | Check out a repo using url and ref to the checkout_path locationself.
Iterate through possible content providers until a valid provider,
based on URL, is found.
| Check out a repo using url and ref to the checkout_path locationself.
Iterate through possible content providers until a valid provider,
based on URL, is found. | [
"Check",
"out",
"a",
"repo",
"using",
"url",
"and",
"ref",
"to",
"the",
"checkout_path",
"locationself",
".",
"Iterate",
"through",
"possible",
"content",
"providers",
"until",
"a",
"valid",
"provider",
"based",
"on",
"URL",
"is",
"found",
"."
] | def fetch(self, url, ref, checkout_path):
picked_content_provider = None
for ContentProvider in self.content_providers:
cp = ContentProvider()
spec = cp.detect(url, ref=ref)
if spec is not None:
picked_content_provider = cp
self.log.inf... | [
"def",
"fetch",
"(",
"self",
",",
"url",
",",
"ref",
",",
"checkout_path",
")",
":",
"picked_content_provider",
"=",
"None",
"for",
"ContentProvider",
"in",
"self",
".",
"content_providers",
":",
"cp",
"=",
"ContentProvider",
"(",
")",
"spec",
"=",
"cp",
"... | Check out a repo using url and ref to the checkout_path locationself. | [
"Check",
"out",
"a",
"repo",
"using",
"url",
"and",
"ref",
"to",
"the",
"checkout_path",
"locationself",
"."
] | [
"\"\"\"Check out a repo using url and ref to the checkout_path locationself.\n\n Iterate through possible content providers until a valid provider,\n based on URL, is found.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "url",
"type": null
},
{
"param": "ref",
"type": null
},
{
"param": "checkout_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": []... |
ea4038139b598a7204ea40167680cde04feac59e | nokome/repo2docker | repo2docker/app.py | [
"BSD-3-Clause"
] | Python | validate_image_name | <not_specific> | def validate_image_name(self, image_name):
"""
Validate image_name read by argparse
Note: Container names must start with an alphanumeric character and
can then use _ . or - in addition to alphanumeric.
[a-zA-Z0-9][a-zA-Z0-9_.-]+
Args:
image_name (string): a... |
Validate image_name read by argparse
Note: Container names must start with an alphanumeric character and
can then use _ . or - in addition to alphanumeric.
[a-zA-Z0-9][a-zA-Z0-9_.-]+
Args:
image_name (string): argument read by the argument parser
Returns:
... | Validate image_name read by argparse
Note: Container names must start with an alphanumeric character and
can then use _ . or - in addition to alphanumeric. | [
"Validate",
"image_name",
"read",
"by",
"argparse",
"Note",
":",
"Container",
"names",
"must",
"start",
"with",
"an",
"alphanumeric",
"character",
"and",
"can",
"then",
"use",
"_",
".",
"or",
"-",
"in",
"addition",
"to",
"alphanumeric",
"."
] | def validate_image_name(self, image_name):
if not is_valid_docker_image_name(image_name):
msg = ("%r is not a valid docker image name. Image name"
"must start with an alphanumeric character and"
"can then use _ . or - in addition to alphanumeric." % image_name)
... | [
"def",
"validate_image_name",
"(",
"self",
",",
"image_name",
")",
":",
"if",
"not",
"is_valid_docker_image_name",
"(",
"image_name",
")",
":",
"msg",
"=",
"(",
"\"%r is not a valid docker image name. Image name\"",
"\"must start with an alphanumeric character and\"",
"\"can ... | Validate image_name read by argparse
Note: Container names must start with an alphanumeric character and
can then use _ . | [
"Validate",
"image_name",
"read",
"by",
"argparse",
"Note",
":",
"Container",
"names",
"must",
"start",
"with",
"an",
"alphanumeric",
"character",
"and",
"can",
"then",
"use",
"_",
"."
] | [
"\"\"\"\n Validate image_name read by argparse\n\n Note: Container names must start with an alphanumeric character and\n can then use _ . or - in addition to alphanumeric.\n [a-zA-Z0-9][a-zA-Z0-9_.-]+\n\n Args:\n image_name (string): argument read by the argument parser... | [
{
"param": "self",
"type": null
},
{
"param": "image_name",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [
{
"docstring": "if image_name contains characters that do not\nmeet the logic that container names must start\nwith an alphanumeric character and can then\nuse _ . or... |
ea4038139b598a7204ea40167680cde04feac59e | nokome/repo2docker | repo2docker/app.py | [
"BSD-3-Clause"
] | Python | start_container | <not_specific> | def start_container(self):
"""Start docker container from built image
Returns running container
"""
client = docker.from_env(version='auto')
docker_host = os.environ.get('DOCKER_HOST')
if docker_host:
host_name = urlparse(docker_host).hostname
else:
... | Start docker container from built image
Returns running container
| Start docker container from built image
Returns running container | [
"Start",
"docker",
"container",
"from",
"built",
"image",
"Returns",
"running",
"container"
] | def start_container(self):
client = docker.from_env(version='auto')
docker_host = os.environ.get('DOCKER_HOST')
if docker_host:
host_name = urlparse(docker_host).hostname
else:
host_name = '127.0.0.1'
self.hostname = host_name
if not self.run_cmd:
... | [
"def",
"start_container",
"(",
"self",
")",
":",
"client",
"=",
"docker",
".",
"from_env",
"(",
"version",
"=",
"'auto'",
")",
"docker_host",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'DOCKER_HOST'",
")",
"if",
"docker_host",
":",
"host_name",
"=",
"u... | Start docker container from built image
Returns running container | [
"Start",
"docker",
"container",
"from",
"built",
"image",
"Returns",
"running",
"container"
] | [
"\"\"\"Start docker container from built image\n\n Returns running container\n \"\"\"",
"# To use the option --NotebookApp.custom_display_url",
"# make sure the base-notebook image is updated:",
"# docker pull jupyter/base-notebook",
"# run_cmd given by user, if port is also given then pass it... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bbc1ff2fee9a76a3c47b2c719cdfd5e22eb451c1 | EmmaW8/BEAL | utils/metrics.py | [
"MIT"
] | Python | dice_coeff_2label | <not_specific> | def dice_coeff_2label(pred, target):
"""This definition generalize to real valued pred and target vector.
This should be differentiable.
pred: tensor with first dimension as batch
target: tensor with first dimension as batch
"""
target = target.data.cpu()
pred = torch.sigmoid(pred)
pred... | This definition generalize to real valued pred and target vector.
This should be differentiable.
pred: tensor with first dimension as batch
target: tensor with first dimension as batch
| This definition generalize to real valued pred and target vector.
This should be differentiable.
pred: tensor with first dimension as batch
target: tensor with first dimension as batch | [
"This",
"definition",
"generalize",
"to",
"real",
"valued",
"pred",
"and",
"target",
"vector",
".",
"This",
"should",
"be",
"differentiable",
".",
"pred",
":",
"tensor",
"with",
"first",
"dimension",
"as",
"batch",
"target",
":",
"tensor",
"with",
"first",
"... | def dice_coeff_2label(pred, target):
target = target.data.cpu()
pred = torch.sigmoid(pred)
pred = pred.data.cpu()
pred[pred > 0.75] = 1
pred[pred <= 0.75] = 0
return dice_coefficient_numpy(pred[:, 0, ...], target[:, 0, ...]), dice_coefficient_numpy(pred[:, 1, ...], target[:, 1, ...]) | [
"def",
"dice_coeff_2label",
"(",
"pred",
",",
"target",
")",
":",
"target",
"=",
"target",
".",
"data",
".",
"cpu",
"(",
")",
"pred",
"=",
"torch",
".",
"sigmoid",
"(",
"pred",
")",
"pred",
"=",
"pred",
".",
"data",
".",
"cpu",
"(",
")",
"pred",
... | This definition generalize to real valued pred and target vector. | [
"This",
"definition",
"generalize",
"to",
"real",
"valued",
"pred",
"and",
"target",
"vector",
"."
] | [
"\"\"\"This definition generalize to real valued pred and target vector.\n This should be differentiable.\n pred: tensor with first dimension as batch\n target: tensor with first dimension as batch\n \"\"\"",
"# print target.shape",
"# print pred.shape"
] | [
{
"param": "pred",
"type": null
},
{
"param": "target",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pred",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "target",
"type": null,
"docstring": null,
"docstring_tokens":... |
8604e74cb57d7d5d47f8ebf8b084f24879fa8a4b | Mahmuttalemdar/TicTacToe.AI | scripts/upload_services/transferwee.py | [
"MIT"
] | Python | download_url | str | def download_url(url: str) -> str:
"""Given a wetransfer.com download URL download return the downloadable URL.
The URL should be of the form `https://we.tl/' or
`https://wetransfer.com/downloads/'. If it is a short URL (i.e. `we.tl')
the redirect is followed in order to retrieve the corresponding
... | Given a wetransfer.com download URL download return the downloadable URL.
The URL should be of the form `https://we.tl/' or
`https://wetransfer.com/downloads/'. If it is a short URL (i.e. `we.tl')
the redirect is followed in order to retrieve the corresponding
`wetransfer.com/downloads/' URL.
The ... | Given a wetransfer.com download URL download return the downloadable URL.
Return the download URL (AKA `direct_link') as a str or None if the URL
could not be parsed. | [
"Given",
"a",
"wetransfer",
".",
"com",
"download",
"URL",
"download",
"return",
"the",
"downloadable",
"URL",
".",
"Return",
"the",
"download",
"URL",
"(",
"AKA",
"`",
"direct_link",
"'",
")",
"as",
"a",
"str",
"or",
"None",
"if",
"the",
"URL",
"could",... | def download_url(url: str) -> str:
if url.startswith('https://we.tl/'):
r = requests.head(url, allow_redirects=True)
url = r.url
recipient_id = None
params = urllib.parse.urlparse(url).path.split('/')[2:]
if len(params) == 2:
transfer_id, security_hash = params
elif len(param... | [
"def",
"download_url",
"(",
"url",
":",
"str",
")",
"->",
"str",
":",
"if",
"url",
".",
"startswith",
"(",
"'https://we.tl/'",
")",
":",
"r",
"=",
"requests",
".",
"head",
"(",
"url",
",",
"allow_redirects",
"=",
"True",
")",
"url",
"=",
"r",
".",
... | Given a wetransfer.com download URL download return the downloadable URL. | [
"Given",
"a",
"wetransfer",
".",
"com",
"download",
"URL",
"download",
"return",
"the",
"downloadable",
"URL",
"."
] | [
"\"\"\"Given a wetransfer.com download URL download return the downloadable URL.\n\n The URL should be of the form `https://we.tl/' or\n `https://wetransfer.com/downloads/'. If it is a short URL (i.e. `we.tl')\n the redirect is followed in order to retrieve the corresponding\n `wetransfer.com/downloads/... | [
{
"param": "url",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "url",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8604e74cb57d7d5d47f8ebf8b084f24879fa8a4b | Mahmuttalemdar/TicTacToe.AI | scripts/upload_services/transferwee.py | [
"MIT"
] | Python | _prepare_email_upload | str | def _prepare_email_upload(filenames: List[str], message: str,
sender: str, recipients: List[str],
session: requests.Session) -> str:
"""Given a list of filenames, message a sender and recipients prepare for
the email upload.
Return the parsed JSON respons... | Given a list of filenames, message a sender and recipients prepare for
the email upload.
Return the parsed JSON response.
| Given a list of filenames, message a sender and recipients prepare for
the email upload.
Return the parsed JSON response. | [
"Given",
"a",
"list",
"of",
"filenames",
"message",
"a",
"sender",
"and",
"recipients",
"prepare",
"for",
"the",
"email",
"upload",
".",
"Return",
"the",
"parsed",
"JSON",
"response",
"."
] | def _prepare_email_upload(filenames: List[str], message: str,
sender: str, recipients: List[str],
session: requests.Session) -> str:
j = {
"files": [_file_name_and_size(f) for f in filenames],
"from": sender,
"message": message,
"re... | [
"def",
"_prepare_email_upload",
"(",
"filenames",
":",
"List",
"[",
"str",
"]",
",",
"message",
":",
"str",
",",
"sender",
":",
"str",
",",
"recipients",
":",
"List",
"[",
"str",
"]",
",",
"session",
":",
"requests",
".",
"Session",
")",
"->",
"str",
... | Given a list of filenames, message a sender and recipients prepare for
the email upload. | [
"Given",
"a",
"list",
"of",
"filenames",
"message",
"a",
"sender",
"and",
"recipients",
"prepare",
"for",
"the",
"email",
"upload",
"."
] | [
"\"\"\"Given a list of filenames, message a sender and recipients prepare for\n the email upload.\n\n Return the parsed JSON response.\n \"\"\""
] | [
{
"param": "filenames",
"type": "List[str]"
},
{
"param": "message",
"type": "str"
},
{
"param": "sender",
"type": "str"
},
{
"param": "recipients",
"type": "List[str]"
},
{
"param": "session",
"type": "requests.Session"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filenames",
"type": "List[str]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "message",
"type": "str",
"docstring": null,
"docs... |
8604e74cb57d7d5d47f8ebf8b084f24879fa8a4b | Mahmuttalemdar/TicTacToe.AI | scripts/upload_services/transferwee.py | [
"MIT"
] | Python | _verify_email_upload | str | def _verify_email_upload(transfer_id: str, session: requests.Session) -> str:
"""Given a transfer_id, read the code from standard input.
Return the parsed JSON response.
"""
code = input('Code:')
j = {
"code": code,
"expire_in": WETRANSFER_EXPIRE_IN,
}
r = session.post(WET... | Given a transfer_id, read the code from standard input.
Return the parsed JSON response.
| Given a transfer_id, read the code from standard input.
Return the parsed JSON response. | [
"Given",
"a",
"transfer_id",
"read",
"the",
"code",
"from",
"standard",
"input",
".",
"Return",
"the",
"parsed",
"JSON",
"response",
"."
] | def _verify_email_upload(transfer_id: str, session: requests.Session) -> str:
code = input('Code:')
j = {
"code": code,
"expire_in": WETRANSFER_EXPIRE_IN,
}
r = session.post(WETRANSFER_VERIFY_URL.format(transfer_id=transfer_id),
json=j)
return r.json() | [
"def",
"_verify_email_upload",
"(",
"transfer_id",
":",
"str",
",",
"session",
":",
"requests",
".",
"Session",
")",
"->",
"str",
":",
"code",
"=",
"input",
"(",
"'Code:'",
")",
"j",
"=",
"{",
"\"code\"",
":",
"code",
",",
"\"expire_in\"",
":",
"WETRANSF... | Given a transfer_id, read the code from standard input. | [
"Given",
"a",
"transfer_id",
"read",
"the",
"code",
"from",
"standard",
"input",
"."
] | [
"\"\"\"Given a transfer_id, read the code from standard input.\n\n Return the parsed JSON response.\n \"\"\""
] | [
{
"param": "transfer_id",
"type": "str"
},
{
"param": "session",
"type": "requests.Session"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "transfer_id",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "session",
"type": "requests.Session",
"docstring": null,
... |
8604e74cb57d7d5d47f8ebf8b084f24879fa8a4b | Mahmuttalemdar/TicTacToe.AI | scripts/upload_services/transferwee.py | [
"MIT"
] | Python | _prepare_link_upload | str | def _prepare_link_upload(filenames: List[str], message: str,
session: requests.Session) -> str:
"""Given a list of filenames and a message prepare for the link upload.
Return the parsed JSON response.
"""
j = {
"files": [_file_name_and_size(f) for f in filenames],
... | Given a list of filenames and a message prepare for the link upload.
Return the parsed JSON response.
| Given a list of filenames and a message prepare for the link upload.
Return the parsed JSON response. | [
"Given",
"a",
"list",
"of",
"filenames",
"and",
"a",
"message",
"prepare",
"for",
"the",
"link",
"upload",
".",
"Return",
"the",
"parsed",
"JSON",
"response",
"."
] | def _prepare_link_upload(filenames: List[str], message: str,
session: requests.Session) -> str:
j = {
"files": [_file_name_and_size(f) for f in filenames],
"message": message,
"ui_language": "en",
}
r = session.post(WETRANSFER_UPLOAD_LINK_URL, json=j)
ret... | [
"def",
"_prepare_link_upload",
"(",
"filenames",
":",
"List",
"[",
"str",
"]",
",",
"message",
":",
"str",
",",
"session",
":",
"requests",
".",
"Session",
")",
"->",
"str",
":",
"j",
"=",
"{",
"\"files\"",
":",
"[",
"_file_name_and_size",
"(",
"f",
")... | Given a list of filenames and a message prepare for the link upload. | [
"Given",
"a",
"list",
"of",
"filenames",
"and",
"a",
"message",
"prepare",
"for",
"the",
"link",
"upload",
"."
] | [
"\"\"\"Given a list of filenames and a message prepare for the link upload.\n\n Return the parsed JSON response.\n \"\"\""
] | [
{
"param": "filenames",
"type": "List[str]"
},
{
"param": "message",
"type": "str"
},
{
"param": "session",
"type": "requests.Session"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filenames",
"type": "List[str]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "message",
"type": "str",
"docstring": null,
"docs... |
8604e74cb57d7d5d47f8ebf8b084f24879fa8a4b | Mahmuttalemdar/TicTacToe.AI | scripts/upload_services/transferwee.py | [
"MIT"
] | Python | _prepare_file_upload | str | def _prepare_file_upload(transfer_id: str, file: str,
session: requests.Session) -> str:
"""Given a transfer_id and file prepare it for the upload.
Return the parsed JSON response.
"""
j = _file_name_and_size(file)
r = session.post(WETRANSFER_FILES_URL.format(transfer_id=tr... | Given a transfer_id and file prepare it for the upload.
Return the parsed JSON response.
| Given a transfer_id and file prepare it for the upload.
Return the parsed JSON response. | [
"Given",
"a",
"transfer_id",
"and",
"file",
"prepare",
"it",
"for",
"the",
"upload",
".",
"Return",
"the",
"parsed",
"JSON",
"response",
"."
] | def _prepare_file_upload(transfer_id: str, file: str,
session: requests.Session) -> str:
j = _file_name_and_size(file)
r = session.post(WETRANSFER_FILES_URL.format(transfer_id=transfer_id),
json=j)
return r.json() | [
"def",
"_prepare_file_upload",
"(",
"transfer_id",
":",
"str",
",",
"file",
":",
"str",
",",
"session",
":",
"requests",
".",
"Session",
")",
"->",
"str",
":",
"j",
"=",
"_file_name_and_size",
"(",
"file",
")",
"r",
"=",
"session",
".",
"post",
"(",
"W... | Given a transfer_id and file prepare it for the upload. | [
"Given",
"a",
"transfer_id",
"and",
"file",
"prepare",
"it",
"for",
"the",
"upload",
"."
] | [
"\"\"\"Given a transfer_id and file prepare it for the upload.\n\n Return the parsed JSON response.\n \"\"\""
] | [
{
"param": "transfer_id",
"type": "str"
},
{
"param": "file",
"type": "str"
},
{
"param": "session",
"type": "requests.Session"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "transfer_id",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": "str",
"docstring": null,
"docstring_t... |
8604e74cb57d7d5d47f8ebf8b084f24879fa8a4b | Mahmuttalemdar/TicTacToe.AI | scripts/upload_services/transferwee.py | [
"MIT"
] | Python | _upload_chunks | str | def _upload_chunks(transfer_id: str, file_id: str, file: str,
session: requests.Session,
default_chunk_size: int = WETRANSFER_DEFAULT_CHUNK_SIZE) -> str:
"""Given a transfer_id, file_id and file upload it.
Return the parsed JSON response.
"""
f = open(file, 'rb')
... | Given a transfer_id, file_id and file upload it.
Return the parsed JSON response.
| Given a transfer_id, file_id and file upload it.
Return the parsed JSON response. | [
"Given",
"a",
"transfer_id",
"file_id",
"and",
"file",
"upload",
"it",
".",
"Return",
"the",
"parsed",
"JSON",
"response",
"."
] | def _upload_chunks(transfer_id: str, file_id: str, file: str,
session: requests.Session,
default_chunk_size: int = WETRANSFER_DEFAULT_CHUNK_SIZE) -> str:
f = open(file, 'rb')
chunk_number = 0
while True:
chunk = f.read(default_chunk_size)
chunk_size = le... | [
"def",
"_upload_chunks",
"(",
"transfer_id",
":",
"str",
",",
"file_id",
":",
"str",
",",
"file",
":",
"str",
",",
"session",
":",
"requests",
".",
"Session",
",",
"default_chunk_size",
":",
"int",
"=",
"WETRANSFER_DEFAULT_CHUNK_SIZE",
")",
"->",
"str",
":",... | Given a transfer_id, file_id and file upload it. | [
"Given",
"a",
"transfer_id",
"file_id",
"and",
"file",
"upload",
"it",
"."
] | [
"\"\"\"Given a transfer_id, file_id and file upload it.\n\n Return the parsed JSON response.\n \"\"\""
] | [
{
"param": "transfer_id",
"type": "str"
},
{
"param": "file_id",
"type": "str"
},
{
"param": "file",
"type": "str"
},
{
"param": "session",
"type": "requests.Session"
},
{
"param": "default_chunk_size",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "transfer_id",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file_id",
"type": "str",
"docstring": null,
"docstrin... |
8604e74cb57d7d5d47f8ebf8b084f24879fa8a4b | Mahmuttalemdar/TicTacToe.AI | scripts/upload_services/transferwee.py | [
"MIT"
] | Python | _finalize_upload | str | def _finalize_upload(transfer_id: str, session: requests.Session) -> str:
"""Given a transfer_id finalize the upload.
Return the parsed JSON response.
"""
r = session.put(WETRANSFER_FINALIZE_URL.format(transfer_id=transfer_id))
return r.json() | Given a transfer_id finalize the upload.
Return the parsed JSON response.
| Given a transfer_id finalize the upload.
Return the parsed JSON response. | [
"Given",
"a",
"transfer_id",
"finalize",
"the",
"upload",
".",
"Return",
"the",
"parsed",
"JSON",
"response",
"."
] | def _finalize_upload(transfer_id: str, session: requests.Session) -> str:
r = session.put(WETRANSFER_FINALIZE_URL.format(transfer_id=transfer_id))
return r.json() | [
"def",
"_finalize_upload",
"(",
"transfer_id",
":",
"str",
",",
"session",
":",
"requests",
".",
"Session",
")",
"->",
"str",
":",
"r",
"=",
"session",
".",
"put",
"(",
"WETRANSFER_FINALIZE_URL",
".",
"format",
"(",
"transfer_id",
"=",
"transfer_id",
")",
... | Given a transfer_id finalize the upload. | [
"Given",
"a",
"transfer_id",
"finalize",
"the",
"upload",
"."
] | [
"\"\"\"Given a transfer_id finalize the upload.\n\n Return the parsed JSON response.\n \"\"\""
] | [
{
"param": "transfer_id",
"type": "str"
},
{
"param": "session",
"type": "requests.Session"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "transfer_id",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "session",
"type": "requests.Session",
"docstring": null,
... |
8604e74cb57d7d5d47f8ebf8b084f24879fa8a4b | Mahmuttalemdar/TicTacToe.AI | scripts/upload_services/transferwee.py | [
"MIT"
] | Python | upload | str | def upload(files: List[str], message: str = '', sender: str = None,
recipients: List[str] = []) -> str:
"""Given a list of files upload them and return the corresponding URL.
Also accepts optional parameters:
- `message': message used as a description of the transfer
- `sender': email addr... | Given a list of files upload them and return the corresponding URL.
Also accepts optional parameters:
- `message': message used as a description of the transfer
- `sender': email address used to receive an ACK if the upload is
successful. For every download by the recipients an email
... | Given a list of files upload them and return the corresponding URL.
Also accepts optional parameters:
`message': message used as a description of the transfer
`sender': email address used to receive an ACK if the upload is
successful. For every download by the recipients an email
will be also sent
`recipients': list of... | [
"Given",
"a",
"list",
"of",
"files",
"upload",
"them",
"and",
"return",
"the",
"corresponding",
"URL",
".",
"Also",
"accepts",
"optional",
"parameters",
":",
"`",
"message",
"'",
":",
"message",
"used",
"as",
"a",
"description",
"of",
"the",
"transfer",
"`... | def upload(files: List[str], message: str = '', sender: str = None,
recipients: List[str] = []) -> str:
for f in files:
if not os.path.exists(f):
raise FileNotFoundError(f)
filenames = [os.path.basename(f) for f in files]
if len(files) != len(set(filenames)):
raise Fil... | [
"def",
"upload",
"(",
"files",
":",
"List",
"[",
"str",
"]",
",",
"message",
":",
"str",
"=",
"''",
",",
"sender",
":",
"str",
"=",
"None",
",",
"recipients",
":",
"List",
"[",
"str",
"]",
"=",
"[",
"]",
")",
"->",
"str",
":",
"for",
"f",
"in... | Given a list of files upload them and return the corresponding URL. | [
"Given",
"a",
"list",
"of",
"files",
"upload",
"them",
"and",
"return",
"the",
"corresponding",
"URL",
"."
] | [
"\"\"\"Given a list of files upload them and return the corresponding URL.\n\n Also accepts optional parameters:\n - `message': message used as a description of the transfer\n - `sender': email address used to receive an ACK if the upload is\n successful. For every download by the recipie... | [
{
"param": "files",
"type": "List[str]"
},
{
"param": "message",
"type": "str"
},
{
"param": "sender",
"type": "str"
},
{
"param": "recipients",
"type": "List[str]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "files",
"type": "List[str]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "message",
"type": "str",
"docstring": null,
"docstrin... |
a0dc4dcd09b891ff5a6a571878647efdf7dcc88c | saulocbarreto/bgslibrary | setup.py | [
"MIT"
] | Python | run | null | def run(self):
"""
Copy libraries from the bin directory and place them as appropriate
"""
self.announce("Moving library files", level=3)
# We have already built the libraries in the previous build_ext step
self.skip_build = True
if hasattr(self.distribution, 'bin... |
Copy libraries from the bin directory and place them as appropriate
| Copy libraries from the bin directory and place them as appropriate | [
"Copy",
"libraries",
"from",
"the",
"bin",
"directory",
"and",
"place",
"them",
"as",
"appropriate"
] | def run(self):
self.announce("Moving library files", level=3)
self.skip_build = True
if hasattr(self.distribution, 'bin_dir'):
bin_dir = self.distribution.bin_dir
else:
bin_dir = os.path.join(self.build_dir)
libs = [os.path.join(bin_dir, _lib) for _lib in ... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"announce",
"(",
"\"Moving library files\"",
",",
"level",
"=",
"3",
")",
"self",
".",
"skip_build",
"=",
"True",
"if",
"hasattr",
"(",
"self",
".",
"distribution",
",",
"'bin_dir'",
")",
":",
"bin_dir",
... | Copy libraries from the bin directory and place them as appropriate | [
"Copy",
"libraries",
"from",
"the",
"bin",
"directory",
"and",
"place",
"them",
"as",
"appropriate"
] | [
"\"\"\"\n Copy libraries from the bin directory and place them as appropriate\n \"\"\"",
"# We have already built the libraries in the previous build_ext step",
"# Depending on the files that are generated from your cmake",
"# build chain, you may need to change the below code, such that",
"# ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0dc4dcd09b891ff5a6a571878647efdf7dcc88c | saulocbarreto/bgslibrary | setup.py | [
"MIT"
] | Python | run | null | def run(self):
"""
Copy the required directory to the build directory and super().run()
"""
self.announce("Moving scripts files", level=3)
# Scripts were already built in a previous step
self.skip_build = True
bin_dir = self.distribution.bin_dir
scripts_di... |
Copy the required directory to the build directory and super().run()
| Copy the required directory to the build directory and super().run() | [
"Copy",
"the",
"required",
"directory",
"to",
"the",
"build",
"directory",
"and",
"super",
"()",
".",
"run",
"()"
] | def run(self):
self.announce("Moving scripts files", level=3)
self.skip_build = True
bin_dir = self.distribution.bin_dir
scripts_dirs = [os.path.join(bin_dir, _dir) for _dir in
os.listdir(bin_dir) if
os.path.isdir(os.path.join(bin_dir, _dir... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"announce",
"(",
"\"Moving scripts files\"",
",",
"level",
"=",
"3",
")",
"self",
".",
"skip_build",
"=",
"True",
"bin_dir",
"=",
"self",
".",
"distribution",
".",
"bin_dir",
"scripts_dirs",
"=",
"[",
"os... | Copy the required directory to the build directory and super().run() | [
"Copy",
"the",
"required",
"directory",
"to",
"the",
"build",
"directory",
"and",
"super",
"()",
".",
"run",
"()"
] | [
"\"\"\"\n Copy the required directory to the build directory and super().run()\n \"\"\"",
"# Scripts were already built in a previous step",
"# Mark the scripts for installation, adding them to ",
"# distribution.scripts seems to ensure that the setuptools' record ",
"# writer appends them to ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0dc4dcd09b891ff5a6a571878647efdf7dcc88c | saulocbarreto/bgslibrary | setup.py | [
"MIT"
] | Python | run | null | def run(self):
"""
Perform build_cmake before doing the 'normal' stuff
"""
for extension in self.extensions:
self.build_cmake(extension)
super(BuildCMakeExt, self).run() |
Perform build_cmake before doing the 'normal' stuff
| Perform build_cmake before doing the 'normal' stuff | [
"Perform",
"build_cmake",
"before",
"doing",
"the",
"'",
"normal",
"'",
"stuff"
] | def run(self):
for extension in self.extensions:
self.build_cmake(extension)
super(BuildCMakeExt, self).run() | [
"def",
"run",
"(",
"self",
")",
":",
"for",
"extension",
"in",
"self",
".",
"extensions",
":",
"self",
".",
"build_cmake",
"(",
"extension",
")",
"super",
"(",
"BuildCMakeExt",
",",
"self",
")",
".",
"run",
"(",
")"
] | Perform build_cmake before doing the 'normal' stuff | [
"Perform",
"build_cmake",
"before",
"doing",
"the",
"'",
"normal",
"'",
"stuff"
] | [
"\"\"\"\n Perform build_cmake before doing the 'normal' stuff\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a0dc4dcd09b891ff5a6a571878647efdf7dcc88c | saulocbarreto/bgslibrary | setup.py | [
"MIT"
] | Python | build_cmake | null | def build_cmake(self, extension):
"""
The steps required to build the extension
"""
self.announce("Preparing the build environment", level=3)
build_dir = os.path.join(self.build_temp)
extension_path = os.path.abspath(os.path.dirname(self.get_ext_fullpath(extension.name)))... |
The steps required to build the extension
| The steps required to build the extension | [
"The",
"steps",
"required",
"to",
"build",
"the",
"extension"
] | def build_cmake(self, extension):
self.announce("Preparing the build environment", level=3)
build_dir = os.path.join(self.build_temp)
extension_path = os.path.abspath(os.path.dirname(self.get_ext_fullpath(extension.name)))
os.makedirs(build_dir)
os.makedirs(extension_path)
... | [
"def",
"build_cmake",
"(",
"self",
",",
"extension",
")",
":",
"self",
".",
"announce",
"(",
"\"Preparing the build environment\"",
",",
"level",
"=",
"3",
")",
"build_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"build_temp",
")",
"extensi... | The steps required to build the extension | [
"The",
"steps",
"required",
"to",
"build",
"the",
"extension"
] | [
"\"\"\"\n The steps required to build the extension\n \"\"\"",
"# Now that the necessary directories are created, build",
"# Build finished, now copy the files into the copy directory",
"# The copy directory is the parent directory of the extension (.pyd)",
"# After build_ext is run, the follo... | [
{
"param": "self",
"type": null
},
{
"param": "extension",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "extension",
"type": null,
"docstring": null,
"docstring_token... |
a39562cdf4f3fecaf082010fb3e3ef4b19fb3ad6 | Imlucky883/Text-Summarization-Web-Application | summarizer.py | [
"MIT"
] | Python | estimated_reading_time | <not_specific> | def estimated_reading_time(text):
'''Calculating reading speed by dividing
text length by average reading speed (avg words per pm)'''
mins = int(len(text)/200)
seconds = int((float(len(text)/200) - mins)*60)
return "( Estimated reading time: {} mins, {} seconds )".format(str(mins),str(seconds)) | Calculating reading speed by dividing
text length by average reading speed (avg words per pm) | Calculating reading speed by dividing
text length by average reading speed (avg words per pm) | [
"Calculating",
"reading",
"speed",
"by",
"dividing",
"text",
"length",
"by",
"average",
"reading",
"speed",
"(",
"avg",
"words",
"per",
"pm",
")"
] | def estimated_reading_time(text):
mins = int(len(text)/200)
seconds = int((float(len(text)/200) - mins)*60)
return "( Estimated reading time: {} mins, {} seconds )".format(str(mins),str(seconds)) | [
"def",
"estimated_reading_time",
"(",
"text",
")",
":",
"mins",
"=",
"int",
"(",
"len",
"(",
"text",
")",
"/",
"200",
")",
"seconds",
"=",
"int",
"(",
"(",
"float",
"(",
"len",
"(",
"text",
")",
"/",
"200",
")",
"-",
"mins",
")",
"*",
"60",
")"... | Calculating reading speed by dividing
text length by average reading speed (avg words per pm) | [
"Calculating",
"reading",
"speed",
"by",
"dividing",
"text",
"length",
"by",
"average",
"reading",
"speed",
"(",
"avg",
"words",
"per",
"pm",
")"
] | [
"'''Calculating reading speed by dividing \n text length by average reading speed (avg words per pm)'''"
] | [
{
"param": "text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a39562cdf4f3fecaf082010fb3e3ef4b19fb3ad6 | Imlucky883/Text-Summarization-Web-Application | summarizer.py | [
"MIT"
] | Python | summarizer | <not_specific> | def summarizer(text):
'''Summarizes text by tokenizing, creating a word frequency list,
finding sentence scores, and then selecting sentences with
highest sentence scores'''
stopwords = list(STOP_WORDS)
#print(stopwords)
# Loading model for tokenization
nlp = spacy.load('en_core_... | Summarizes text by tokenizing, creating a word frequency list,
finding sentence scores, and then selecting sentences with
highest sentence scores | Summarizes text by tokenizing, creating a word frequency list,
finding sentence scores, and then selecting sentences with
highest sentence scores | [
"Summarizes",
"text",
"by",
"tokenizing",
"creating",
"a",
"word",
"frequency",
"list",
"finding",
"sentence",
"scores",
"and",
"then",
"selecting",
"sentences",
"with",
"highest",
"sentence",
"scores"
] | def summarizer(text):
stopwords = list(STOP_WORDS)
nlp = spacy.load('en_core_web_sm')
doc = nlp(text)
tokens = [token.text for token in doc]
word_frequencies = {}
for word in doc:
if word.text.lower() not in stopwords:
if word.text.lower() not in punctuation:
... | [
"def",
"summarizer",
"(",
"text",
")",
":",
"stopwords",
"=",
"list",
"(",
"STOP_WORDS",
")",
"nlp",
"=",
"spacy",
".",
"load",
"(",
"'en_core_web_sm'",
")",
"doc",
"=",
"nlp",
"(",
"text",
")",
"tokens",
"=",
"[",
"token",
".",
"text",
"for",
"token... | Summarizes text by tokenizing, creating a word frequency list,
finding sentence scores, and then selecting sentences with
highest sentence scores | [
"Summarizes",
"text",
"by",
"tokenizing",
"creating",
"a",
"word",
"frequency",
"list",
"finding",
"sentence",
"scores",
"and",
"then",
"selecting",
"sentences",
"with",
"highest",
"sentence",
"scores"
] | [
"'''Summarizes text by tokenizing, creating a word frequency list, \n finding sentence scores, and then selecting sentences with \n highest sentence scores'''",
"#print(stopwords)",
"# Loading model for tokenization",
"# Tokenizing text with spacy",
"#print(tokens)",
"# Finding Word Frequenc... | [
{
"param": "text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
53810fa3ccc4d45a75ebdc5ad33c37fa1a7697c7 | timheap/wagtail | wagtail/wagtailadmin/views/pages.py | [
"BSD-3-Clause"
] | Python | preview | <not_specific> | def preview(request):
"""
The HTML of a previewed page is written to the destination browser window using document.write.
This overwrites any previous content in the window, while keeping its URL intact. This in turn
means that any content we insert that happens to trigger an HTTP request, such as an im... |
The HTML of a previewed page is written to the destination browser window using document.write.
This overwrites any previous content in the window, while keeping its URL intact. This in turn
means that any content we insert that happens to trigger an HTTP request, such as an image or
stylesheet tag, wi... | The HTML of a previewed page is written to the destination browser window using document.write.
This overwrites any previous content in the window, while keeping its URL intact. This in turn
means that any content we insert that happens to trigger an HTTP request, such as an image or
stylesheet tag, will report that or... | [
"The",
"HTML",
"of",
"a",
"previewed",
"page",
"is",
"written",
"to",
"the",
"destination",
"browser",
"window",
"using",
"document",
".",
"write",
".",
"This",
"overwrites",
"any",
"previous",
"content",
"in",
"the",
"window",
"while",
"keeping",
"its",
"UR... | def preview(request):
return render(request, 'wagtailadmin/pages/preview.html') | [
"def",
"preview",
"(",
"request",
")",
":",
"return",
"render",
"(",
"request",
",",
"'wagtailadmin/pages/preview.html'",
")"
] | The HTML of a previewed page is written to the destination browser window using document.write. | [
"The",
"HTML",
"of",
"a",
"previewed",
"page",
"is",
"written",
"to",
"the",
"destination",
"browser",
"window",
"using",
"document",
".",
"write",
"."
] | [
"\"\"\"\n The HTML of a previewed page is written to the destination browser window using document.write.\n This overwrites any previous content in the window, while keeping its URL intact. This in turn\n means that any content we insert that happens to trigger an HTTP request, such as an image or\n sty... | [
{
"param": "request",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
53810fa3ccc4d45a75ebdc5ad33c37fa1a7697c7 | timheap/wagtail | wagtail/wagtailadmin/views/pages.py | [
"BSD-3-Clause"
] | Python | preview_loading | <not_specific> | def preview_loading(request):
"""
This page is blank, but must be real HTML so its DOM can be written to once the preview of the page has rendered
"""
return HttpResponse("<html><head><title></title></head><body></body></html>") |
This page is blank, but must be real HTML so its DOM can be written to once the preview of the page has rendered
| This page is blank, but must be real HTML so its DOM can be written to once the preview of the page has rendered | [
"This",
"page",
"is",
"blank",
"but",
"must",
"be",
"real",
"HTML",
"so",
"its",
"DOM",
"can",
"be",
"written",
"to",
"once",
"the",
"preview",
"of",
"the",
"page",
"has",
"rendered"
] | def preview_loading(request):
return HttpResponse("<html><head><title></title></head><body></body></html>") | [
"def",
"preview_loading",
"(",
"request",
")",
":",
"return",
"HttpResponse",
"(",
"\"<html><head><title></title></head><body></body></html>\"",
")"
] | This page is blank, but must be real HTML so its DOM can be written to once the preview of the page has rendered | [
"This",
"page",
"is",
"blank",
"but",
"must",
"be",
"real",
"HTML",
"so",
"its",
"DOM",
"can",
"be",
"written",
"to",
"once",
"the",
"preview",
"of",
"the",
"page",
"has",
"rendered"
] | [
"\"\"\"\n This page is blank, but must be real HTML so its DOM can be written to once the preview of the page has rendered\n \"\"\""
] | [
{
"param": "request",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
abd7c06a7073584cb1df88e04b4dea3928b2979e | timheap/wagtail | wagtail/wagtailimages/models.py | [
"BSD-3-Clause"
] | Python | process_image | <not_specific> | def process_image(self, input_file, output_file=None, focal_point=None, backend_name='default'):
"""
Run this filter on the given image file then write the result into output_file and return it
If output_file is not given, a new BytesIO will be used instead
"""
# Get backend
... |
Run this filter on the given image file then write the result into output_file and return it
If output_file is not given, a new BytesIO will be used instead
| Run this filter on the given image file then write the result into output_file and return it
If output_file is not given, a new BytesIO will be used instead | [
"Run",
"this",
"filter",
"on",
"the",
"given",
"image",
"file",
"then",
"write",
"the",
"result",
"into",
"output_file",
"and",
"return",
"it",
"If",
"output_file",
"is",
"not",
"given",
"a",
"new",
"BytesIO",
"will",
"be",
"used",
"instead"
] | def process_image(self, input_file, output_file=None, focal_point=None, backend_name='default'):
backend = get_image_backend(backend_name)
method_name, method_arg = self._method
input_file.open('rb')
image = backend.open_image(input_file)
file_format = image.format
method... | [
"def",
"process_image",
"(",
"self",
",",
"input_file",
",",
"output_file",
"=",
"None",
",",
"focal_point",
"=",
"None",
",",
"backend_name",
"=",
"'default'",
")",
":",
"backend",
"=",
"get_image_backend",
"(",
"backend_name",
")",
"method_name",
",",
"metho... | Run this filter on the given image file then write the result into output_file and return it
If output_file is not given, a new BytesIO will be used instead | [
"Run",
"this",
"filter",
"on",
"the",
"given",
"image",
"file",
"then",
"write",
"the",
"result",
"into",
"output_file",
"and",
"return",
"it",
"If",
"output_file",
"is",
"not",
"given",
"a",
"new",
"BytesIO",
"will",
"be",
"used",
"instead"
] | [
"\"\"\"\n Run this filter on the given image file then write the result into output_file and return it\n If output_file is not given, a new BytesIO will be used instead\n \"\"\"",
"# Get backend",
"# Parse spec string",
"# Open image",
"# Process image",
"# Make sure we have an output... | [
{
"param": "self",
"type": null
},
{
"param": "input_file",
"type": null
},
{
"param": "output_file",
"type": null
},
{
"param": "focal_point",
"type": null
},
{
"param": "backend_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_file",
"type": null,
"docstring": null,
"docstring_toke... |
fdc45c3e5bc671f098e4530eaf326692dfbc53ff | xlrtx/JsonAnalysis | src/json_analysis.py | [
"MIT"
] | Python | check_same_type | <not_specific> | def check_same_type(func):
"""
Check wrapper for debugging
last two args should share same type
:param func:
:return:
"""
def inner(*args, **kwargs):
if DEBUG:
assert type(args[-1]) == type(args[-2])
return func(*args, **kwargs)
return inner |
Check wrapper for debugging
last two args should share same type
:param func:
:return:
| Check wrapper for debugging
last two args should share same type | [
"Check",
"wrapper",
"for",
"debugging",
"last",
"two",
"args",
"should",
"share",
"same",
"type"
] | def check_same_type(func):
def inner(*args, **kwargs):
if DEBUG:
assert type(args[-1]) == type(args[-2])
return func(*args, **kwargs)
return inner | [
"def",
"check_same_type",
"(",
"func",
")",
":",
"def",
"inner",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"if",
"DEBUG",
":",
"assert",
"type",
"(",
"args",
"[",
"-",
"1",
"]",
")",
"==",
"type",
"(",
"args",
"[",
"-",
"2",
"]",
")",
... | Check wrapper for debugging
last two args should share same type | [
"Check",
"wrapper",
"for",
"debugging",
"last",
"two",
"args",
"should",
"share",
"same",
"type"
] | [
"\"\"\"\n Check wrapper for debugging\n last two args should share same type\n :param func:\n :return:\n \"\"\""
] | [
{
"param": "func",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "func",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
fdc45c3e5bc671f098e4530eaf326692dfbc53ff | xlrtx/JsonAnalysis | src/json_analysis.py | [
"MIT"
] | Python | check_is_type | <not_specific> | def check_is_type(type_):
"""
Check wrapper for debugging
type checking for last arg
:param type_:
:return:
"""
def wrapper(func):
def inner(*args, **kwargs):
if DEBUG:
assert isinstance(args[-1], type_)
return func(*args, **kwargs)
r... |
Check wrapper for debugging
type checking for last arg
:param type_:
:return:
| Check wrapper for debugging
type checking for last arg | [
"Check",
"wrapper",
"for",
"debugging",
"type",
"checking",
"for",
"last",
"arg"
] | def check_is_type(type_):
def wrapper(func):
def inner(*args, **kwargs):
if DEBUG:
assert isinstance(args[-1], type_)
return func(*args, **kwargs)
return inner
return wrapper | [
"def",
"check_is_type",
"(",
"type_",
")",
":",
"def",
"wrapper",
"(",
"func",
")",
":",
"def",
"inner",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"if",
"DEBUG",
":",
"assert",
"isinstance",
"(",
"args",
"[",
"-",
"1",
"]",
",",
"type_",
"... | Check wrapper for debugging
type checking for last arg | [
"Check",
"wrapper",
"for",
"debugging",
"type",
"checking",
"for",
"last",
"arg"
] | [
"\"\"\"\n Check wrapper for debugging\n type checking for last arg\n :param type_:\n :return:\n \"\"\""
] | [
{
"param": "type_",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "type_",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
fdc45c3e5bc671f098e4530eaf326692dfbc53ff | xlrtx/JsonAnalysis | src/json_analysis.py | [
"MIT"
] | Python | list_to_dict | <not_specific> | def list_to_dict(list_, comp):
"""
Transform a list into dict, item as val, comp(item) as key,
items in each given list should yield unique value by calling comp(item).
:param list_:
:param comp:
:return:
"""
dict_ = {}
for item in list_:
item_type = comp(item)
if DEB... |
Transform a list into dict, item as val, comp(item) as key,
items in each given list should yield unique value by calling comp(item).
:param list_:
:param comp:
:return:
| Transform a list into dict, item as val, comp(item) as key,
items in each given list should yield unique value by calling comp(item). | [
"Transform",
"a",
"list",
"into",
"dict",
"item",
"as",
"val",
"comp",
"(",
"item",
")",
"as",
"key",
"items",
"in",
"each",
"given",
"list",
"should",
"yield",
"unique",
"value",
"by",
"calling",
"comp",
"(",
"item",
")",
"."
] | def list_to_dict(list_, comp):
dict_ = {}
for item in list_:
item_type = comp(item)
if DEBUG and dict_.get(item_type):
raise TypeError("Two items with same type occurred in single list.")
dict_[item_type] = item
return dict_ | [
"def",
"list_to_dict",
"(",
"list_",
",",
"comp",
")",
":",
"dict_",
"=",
"{",
"}",
"for",
"item",
"in",
"list_",
":",
"item_type",
"=",
"comp",
"(",
"item",
")",
"if",
"DEBUG",
"and",
"dict_",
".",
"get",
"(",
"item_type",
")",
":",
"raise",
"Type... | Transform a list into dict, item as val, comp(item) as key,
items in each given list should yield unique value by calling comp(item). | [
"Transform",
"a",
"list",
"into",
"dict",
"item",
"as",
"val",
"comp",
"(",
"item",
")",
"as",
"key",
"items",
"in",
"each",
"given",
"list",
"should",
"yield",
"unique",
"value",
"by",
"calling",
"comp",
"(",
"item",
")",
"."
] | [
"\"\"\"\n Transform a list into dict, item as val, comp(item) as key,\n items in each given list should yield unique value by calling comp(item).\n :param list_:\n :param comp:\n :return:\n \"\"\""
] | [
{
"param": "list_",
"type": null
},
{
"param": "comp",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "list_",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.