Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
pi | (maxK=70, prec=1008, disp=1007) |
maxK: nuber of iterations
prec: precision of decimal places
disp: number of decimal places shown
|
maxK: nuber of iterations
prec: precision of decimal places
disp: number of decimal places shown
| def pi(maxK=70, prec=1008, disp=1007):
"""
maxK: nuber of iterations
prec: precision of decimal places
disp: number of decimal places shown
"""
from decimal import Decimal as Dec, getcontext as gc
gc().prec = prec
K, M, L, X, S = 6, 1, 13591409, 1, 13591409
for k in range(1, maxK + 1... | [
"def",
"pi",
"(",
"maxK",
"=",
"70",
",",
"prec",
"=",
"1008",
",",
"disp",
"=",
"1007",
")",
":",
"from",
"decimal",
"import",
"Decimal",
"as",
"Dec",
",",
"getcontext",
"as",
"gc",
"gc",
"(",
")",
".",
"prec",
"=",
"prec",
"K",
",",
"M",
",",... | [
42,
0
] | [
59,
13
] | python | en | ['en', 'error', 'th'] | False |
isPrime | (number) |
input: positive integer 'number'
returns true if 'number' is prime otherwise false.
|
input: positive integer 'number'
returns true if 'number' is prime otherwise false.
| def isPrime(number):
"""
input: positive integer 'number'
returns true if 'number' is prime otherwise false.
"""
# precondition
assert isinstance(number, int) and (number >= 0), \
"'number' must been an int and positive"
# 0 and 1 are none primes.
if number <= 3:
... | [
"def",
"isPrime",
"(",
"number",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"number",
",",
"int",
")",
"and",
"(",
"number",
">=",
"0",
")",
",",
"\"'number' must been an int and positive\"",
"# 0 and 1 are none primes. ",
"if",
"number",
"<=",
"3",
... | [
62,
0
] | [
84,
15
] | python | en | ['en', 'error', 'th'] | False |
sieveEr | (N) |
input: positive integer 'N' > 2
returns a list of prime numbers from 2 up to N.
This function implements the algorithm called
sieve of erathostenes.
|
input: positive integer 'N' > 2
returns a list of prime numbers from 2 up to N.
This function implements the algorithm called
sieve of erathostenes.
| def sieveEr(N):
"""
input: positive integer 'N' > 2
returns a list of prime numbers from 2 up to N.
This function implements the algorithm called
sieve of erathostenes.
"""
from math import sqrt
# precondition
assert isinstance(N, int) and ... | [
"def",
"sieveEr",
"(",
"N",
")",
":",
"from",
"math",
"import",
"sqrt",
"# precondition",
"assert",
"isinstance",
"(",
"N",
",",
"int",
")",
"and",
"(",
"N",
">",
"2",
")",
",",
"\"'N' must been an int and > 2\"",
"primes",
"=",
"[",
"True",
"for",
"x",
... | [
88,
0
] | [
115,
14
] | python | en | ['en', 'error', 'th'] | False |
getPrimeNumbers | (N) |
input: positive integer 'N' > 2
returns a list of prime numbers from 2 up to N (inclusive)
This function is more efficient as function 'sieveEr(...)'
|
input: positive integer 'N' > 2
returns a list of prime numbers from 2 up to N (inclusive)
This function is more efficient as function 'sieveEr(...)'
| def getPrimeNumbers(N):
"""
input: positive integer 'N' > 2
returns a list of prime numbers from 2 up to N (inclusive)
This function is more efficient as function 'sieveEr(...)'
"""
# precondition
assert isinstance(N, int) and (N > 2), "'N' must been an int and > 2"
ans = [... | [
"def",
"getPrimeNumbers",
"(",
"N",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"N",
",",
"int",
")",
"and",
"(",
"N",
">",
"2",
")",
",",
"\"'N' must been an int and > 2\"",
"ans",
"=",
"[",
"]",
"# iterates over all numbers between 2 up to N+1 ",
... | [
120,
0
] | [
142,
14
] | python | en | ['en', 'error', 'th'] | False |
primeFactorization | (number) |
input: positive integer 'number'
returns a list of the prime number factors of 'number'
|
input: positive integer 'number'
returns a list of the prime number factors of 'number'
| def primeFactorization(number):
"""
input: positive integer 'number'
returns a list of the prime number factors of 'number'
"""
# precondition
assert isinstance(number, int) and number >= 0, \
"'number' must been an int and >= 0"
ans = [] # this list will be returns of th... | [
"def",
"primeFactorization",
"(",
"number",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"number",
",",
"int",
")",
"and",
"number",
">=",
"0",
",",
"\"'number' must been an int and >= 0\"",
"ans",
"=",
"[",
"]",
"# this list will be returns of the functio... | [
147,
0
] | [
186,
14
] | python | en | ['en', 'error', 'th'] | False |
greatestPrimeFactor | (number) |
input: positive integer 'number' >= 0
returns the greatest prime number factor of 'number'
|
input: positive integer 'number' >= 0
returns the greatest prime number factor of 'number'
| def greatestPrimeFactor(number):
"""
input: positive integer 'number' >= 0
returns the greatest prime number factor of 'number'
"""
# precondition
assert isinstance(number, int) and (number >= 0), \
"'number' bust been an int and >= 0"
ans = 0
# prime factorization of ... | [
"def",
"greatestPrimeFactor",
"(",
"number",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"number",
",",
"int",
")",
"and",
"(",
"number",
">=",
"0",
")",
",",
"\"'number' bust been an int and >= 0\"",
"ans",
"=",
"0",
"# prime factorization of 'number'"... | [
191,
0
] | [
211,
14
] | python | en | ['en', 'error', 'th'] | False |
smallestPrimeFactor | (number) |
input: integer 'number' >= 0
returns the smallest prime number factor of 'number'
|
input: integer 'number' >= 0
returns the smallest prime number factor of 'number'
| def smallestPrimeFactor(number):
"""
input: integer 'number' >= 0
returns the smallest prime number factor of 'number'
"""
# precondition
assert isinstance(number, int) and (number >= 0), \
"'number' bust been an int and >= 0"
ans = 0
# prime factorization of 'number'
... | [
"def",
"smallestPrimeFactor",
"(",
"number",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"number",
",",
"int",
")",
"and",
"(",
"number",
">=",
"0",
")",
",",
"\"'number' bust been an int and >= 0\"",
"ans",
"=",
"0",
"# prime factorization of 'number'"... | [
217,
0
] | [
237,
14
] | python | en | ['en', 'error', 'th'] | False |
isEven | (number) |
input: integer 'number'
returns true if 'number' is even, otherwise false.
|
input: integer 'number'
returns true if 'number' is even, otherwise false.
| def isEven(number):
"""
input: integer 'number'
returns true if 'number' is even, otherwise false.
"""
# precondition
assert isinstance(number, int), "'number' must been an int"
assert isinstance(number % 2 == 0, bool), "compare bust been from type bool"
return number % 2 == 0 | [
"def",
"isEven",
"(",
"number",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"number",
",",
"int",
")",
",",
"\"'number' must been an int\"",
"assert",
"isinstance",
"(",
"number",
"%",
"2",
"==",
"0",
",",
"bool",
")",
",",
"\"compare bust been fr... | [
242,
0
] | [
252,
26
] | python | en | ['en', 'error', 'th'] | False |
isOdd | (number) |
input: integer 'number'
returns true if 'number' is odd, otherwise false.
|
input: integer 'number'
returns true if 'number' is odd, otherwise false.
| def isOdd(number):
"""
input: integer 'number'
returns true if 'number' is odd, otherwise false.
"""
# precondition
assert isinstance(number, int), "'number' must been an int"
assert isinstance(number % 2 != 0, bool), "compare bust been from type bool"
return number % 2 != 0 | [
"def",
"isOdd",
"(",
"number",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"number",
",",
"int",
")",
",",
"\"'number' must been an int\"",
"assert",
"isinstance",
"(",
"number",
"%",
"2",
"!=",
"0",
",",
"bool",
")",
",",
"\"compare bust been fro... | [
257,
0
] | [
267,
26
] | python | en | ['en', 'error', 'th'] | False |
goldbach | (number) |
Goldbach's assumption
input: a even positive integer 'number' > 2
returns a list of two prime numbers whose sum is equal to 'number'
|
Goldbach's assumption
input: a even positive integer 'number' > 2
returns a list of two prime numbers whose sum is equal to 'number'
| def goldbach(number):
"""
Goldbach's assumption
input: a even positive integer 'number' > 2
returns a list of two prime numbers whose sum is equal to 'number'
"""
# precondition
assert isinstance(number, int) and (number > 2) and isEven(number), \
"'number' must been an ... | [
"def",
"goldbach",
"(",
"number",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"number",
",",
"int",
")",
"and",
"(",
"number",
">",
"2",
")",
"and",
"isEven",
"(",
"number",
")",
",",
"\"'number' must been an int, even and > 2\"",
"ans",
"=",
"[... | [
273,
0
] | [
317,
14
] | python | en | ['en', 'error', 'th'] | False |
gcd | (number1, number2) |
Greatest common divisor
input: two positive integer 'number1' and 'number2'
returns the greatest common divisor of 'number1' and 'number2'
|
Greatest common divisor
input: two positive integer 'number1' and 'number2'
returns the greatest common divisor of 'number1' and 'number2'
| def gcd(number1, number2):
"""
Greatest common divisor
input: two positive integer 'number1' and 'number2'
returns the greatest common divisor of 'number1' and 'number2'
"""
# precondition
assert isinstance(number1, int) and isinstance(number2, int) \
and (number1 >= ... | [
"def",
"gcd",
"(",
"number1",
",",
"number2",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"number1",
",",
"int",
")",
"and",
"isinstance",
"(",
"number2",
",",
"int",
")",
"and",
"(",
"number1",
">=",
"0",
")",
"and",
"(",
"number2",
">=",... | [
322,
0
] | [
345,
18
] | python | en | ['en', 'error', 'th'] | False |
kgV | (number1, number2) |
Least common multiple
input: two positive integer 'number1' and 'number2'
returns the least common multiple of 'number1' and 'number2'
|
Least common multiple
input: two positive integer 'number1' and 'number2'
returns the least common multiple of 'number1' and 'number2'
| def kgV(number1, number2):
"""
Least common multiple
input: two positive integer 'number1' and 'number2'
returns the least common multiple of 'number1' and 'number2'
"""
# precondition
assert isinstance(number1, int) and isinstance(number2, int) \
and (number1 >= 1) a... | [
"def",
"kgV",
"(",
"number1",
",",
"number2",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"number1",
",",
"int",
")",
"and",
"isinstance",
"(",
"number2",
",",
"int",
")",
"and",
"(",
"number1",
">=",
"1",
")",
"and",
"(",
"number2",
">=",... | [
350,
0
] | [
420,
14
] | python | en | ['en', 'error', 'th'] | False |
getPrime | (n) |
Gets the n-th prime number.
input: positive integer 'n' >= 0
returns the n-th prime number, beginning at index 0
|
Gets the n-th prime number.
input: positive integer 'n' >= 0
returns the n-th prime number, beginning at index 0
| def getPrime(n):
"""
Gets the n-th prime number.
input: positive integer 'n' >= 0
returns the n-th prime number, beginning at index 0
"""
# precondition
assert isinstance(n, int) and (n >= 0), "'number' must been a positive int"
index = 0
ans = 2 # this variable holds ... | [
"def",
"getPrime",
"(",
"n",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"n",
",",
"int",
")",
"and",
"(",
"n",
">=",
"0",
")",
",",
"\"'number' must been a positive int\"",
"index",
"=",
"0",
"ans",
"=",
"2",
"# this variable holds the answer",
... | [
425,
0
] | [
453,
14
] | python | en | ['en', 'error', 'th'] | False |
getPrimesBetween | (pNumber1, pNumber2) |
input: prime numbers 'pNumber1' and 'pNumber2'
pNumber1 < pNumber2
returns a list of all prime numbers between 'pNumber1' (exclusiv)
and 'pNumber2' (exclusiv)
|
input: prime numbers 'pNumber1' and 'pNumber2'
pNumber1 < pNumber2
returns a list of all prime numbers between 'pNumber1' (exclusiv)
and 'pNumber2' (exclusiv)
| def getPrimesBetween(pNumber1, pNumber2):
"""
input: prime numbers 'pNumber1' and 'pNumber2'
pNumber1 < pNumber2
returns a list of all prime numbers between 'pNumber1' (exclusiv)
and 'pNumber2' (exclusiv)
"""
# precondition
assert isPrime(pNumber1) and i... | [
"def",
"getPrimesBetween",
"(",
"pNumber1",
",",
"pNumber2",
")",
":",
"# precondition",
"assert",
"isPrime",
"(",
"pNumber1",
")",
"and",
"isPrime",
"(",
"pNumber2",
")",
"and",
"(",
"pNumber1",
"<",
"pNumber2",
")",
",",
"\"The arguments must been prime numbers ... | [
458,
0
] | [
495,
14
] | python | en | ['en', 'error', 'th'] | False |
getDivisors | (n) |
input: positive integer 'n' >= 1
returns all divisors of n (inclusive 1 and 'n')
|
input: positive integer 'n' >= 1
returns all divisors of n (inclusive 1 and 'n')
| def getDivisors(n):
"""
input: positive integer 'n' >= 1
returns all divisors of n (inclusive 1 and 'n')
"""
# precondition
assert isinstance(n, int) and (n >= 1), "'n' must been int and >= 1"
ans = [] # will be returned.
for divisor in range(1, n + 1):
if n % diviso... | [
"def",
"getDivisors",
"(",
"n",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"n",
",",
"int",
")",
"and",
"(",
"n",
">=",
"1",
")",
",",
"\"'n' must been int and >= 1\"",
"ans",
"=",
"[",
"]",
"# will be returned.",
"for",
"divisor",
"in",
"ran... | [
500,
0
] | [
520,
14
] | python | en | ['en', 'error', 'th'] | False |
isPerfectNumber | (number) |
input: positive integer 'number' > 1
returns true if 'number' is a perfect number otherwise false.
|
input: positive integer 'number' > 1
returns true if 'number' is a perfect number otherwise false.
| def isPerfectNumber(number):
"""
input: positive integer 'number' > 1
returns true if 'number' is a perfect number otherwise false.
"""
# precondition
assert isinstance(number, int) and (number > 1), \
"'number' must been an int and >= 1"
divisors = getDivisors(number)
... | [
"def",
"isPerfectNumber",
"(",
"number",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"number",
",",
"int",
")",
"and",
"(",
"number",
">",
"1",
")",
",",
"\"'number' must been an int and >= 1\"",
"divisors",
"=",
"getDivisors",
"(",
"number",
")",
... | [
526,
0
] | [
544,
39
] | python | en | ['en', 'error', 'th'] | False |
simplifyFraction | (numerator, denominator) |
input: two integer 'numerator' and 'denominator'
assumes: 'denominator' != 0
returns: a tuple with simplify numerator and denominator.
|
input: two integer 'numerator' and 'denominator'
assumes: 'denominator' != 0
returns: a tuple with simplify numerator and denominator.
| def simplifyFraction(numerator, denominator):
"""
input: two integer 'numerator' and 'denominator'
assumes: 'denominator' != 0
returns: a tuple with simplify numerator and denominator.
"""
# precondition
assert isinstance(numerator, int) and isinstance(denominator, int) \
... | [
"def",
"simplifyFraction",
"(",
"numerator",
",",
"denominator",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"numerator",
",",
"int",
")",
"and",
"isinstance",
"(",
"denominator",
",",
"int",
")",
"and",
"(",
"denominator",
"!=",
"0",
")",
",",
... | [
549,
0
] | [
569,
69
] | python | en | ['en', 'error', 'th'] | False |
factorial | (n) |
input: positive integer 'n'
returns the factorial of 'n' (n!)
|
input: positive integer 'n'
returns the factorial of 'n' (n!)
| def factorial(n):
"""
input: positive integer 'n'
returns the factorial of 'n' (n!)
"""
# precondition
assert isinstance(n, int) and (n >= 0), "'n' must been a int and >= 0"
ans = 1 # this will be return.
for factor in range(1, n + 1):
ans *= factor
return ans | [
"def",
"factorial",
"(",
"n",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"n",
",",
"int",
")",
"and",
"(",
"n",
">=",
"0",
")",
",",
"\"'n' must been a int and >= 0\"",
"ans",
"=",
"1",
"# this will be return.",
"for",
"factor",
"in",
"range",
... | [
574,
0
] | [
588,
14
] | python | en | ['en', 'error', 'th'] | False |
fib | (n) |
input: positive integer 'n'
returns the n-th fibonacci term , indexing by 0
|
input: positive integer 'n'
returns the n-th fibonacci term , indexing by 0
| def fib(n):
"""
input: positive integer 'n'
returns the n-th fibonacci term , indexing by 0
"""
# precondition
assert isinstance(n, int) and (n >= 0), "'n' must been an int and >= 0"
tmp = 0
fib1 = 1
ans = 1 # this will be return
for i in range(n - 1):
tmp = a... | [
"def",
"fib",
"(",
"n",
")",
":",
"# precondition",
"assert",
"isinstance",
"(",
"n",
",",
"int",
")",
"and",
"(",
"n",
">=",
"0",
")",
",",
"\"'n' must been an int and >= 0\"",
"tmp",
"=",
"0",
"fib1",
"=",
"1",
"ans",
"=",
"1",
"# this will be return",... | [
593,
0
] | [
611,
14
] | python | en | ['en', 'error', 'th'] | False |
JsonParser.convert_json_to_python | (self, par_json_file) |
this function to convert any json file format to dictionary
args: the json file
return: dictionary contains json file data
|
this function to convert any json file format to dictionary
args: the json file
return: dictionary contains json file data
| def convert_json_to_python(self, par_json_file):
"""
this function to convert any json file format to dictionary
args: the json file
return: dictionary contains json file data
"""
with open(par_json_file) as json_file:
data_dic = json.load(json_file)
r... | [
"def",
"convert_json_to_python",
"(",
"self",
",",
"par_json_file",
")",
":",
"with",
"open",
"(",
"par_json_file",
")",
"as",
"json_file",
":",
"data_dic",
"=",
"json",
".",
"load",
"(",
"json_file",
")",
"return",
"data_dic"
] | [
8,
4
] | [
16,
23
] | python | en | ['en', 'error', 'th'] | False |
JsonParser.convert_python_to_json | (self, par_data_dic, par_json_file="") |
this function converts dictionary of data to json string and store it in json file if
json file pass provided if not it only returns the json string
args:
par_data_dic: dictionary of data
par_json_file: the output json file
return: json string
|
this function converts dictionary of data to json string and store it in json file if
json file pass provided if not it only returns the json string
args:
par_data_dic: dictionary of data
par_json_file: the output json file
return: json string
| def convert_python_to_json(self, par_data_dic, par_json_file=""):
"""
this function converts dictionary of data to json string and store it in json file if
json file pass provided if not it only returns the json string
args:
par_data_dic: dictionary of data
par_... | [
"def",
"convert_python_to_json",
"(",
"self",
",",
"par_data_dic",
",",
"par_json_file",
"=",
"\"\"",
")",
":",
"if",
"par_json_file",
":",
"with",
"open",
"(",
"par_json_file",
",",
"'w'",
")",
"as",
"outfile",
":",
"return",
"json",
".",
"dump",
"(",
"pa... | [
18,
4
] | [
31,
42
] | python | en | ['en', 'error', 'th'] | False |
JsonParser.get_json_value | (self, par_value, par_json_file) |
this function gets specific dictionary key value from json file
args:
par_value: dictionary key value
par_json_file: json file
return: value result
|
this function gets specific dictionary key value from json file
args:
par_value: dictionary key value
par_json_file: json file
return: value result
| def get_json_value(self, par_value, par_json_file):
"""
this function gets specific dictionary key value from json file
args:
par_value: dictionary key value
par_json_file: json file
return: value result
"""
data_dic = self.convert_json_to_p... | [
"def",
"get_json_value",
"(",
"self",
",",
"par_value",
",",
"par_json_file",
")",
":",
"data_dic",
"=",
"self",
".",
"convert_json_to_python",
"(",
"par_json_file",
")",
"return",
"data_dic",
"[",
"par_value",
"]"
] | [
33,
4
] | [
42,
34
] | python | en | ['en', 'error', 'th'] | False |
Fetcher.__init__ | (self, ec2=None, autoscaling=None) | Initializes aws sdk clients | Initializes aws sdk clients | def __init__(self, ec2=None, autoscaling=None):
""" Initializes aws sdk clients """
self.ec2 = ec2 or boto3.client('ec2', config=Config(retries={'max_attempts': BOTO3_RETRIES}))
self.asg = autoscaling or boto3.client('autoscaling') | [
"def",
"__init__",
"(",
"self",
",",
"ec2",
"=",
"None",
",",
"autoscaling",
"=",
"None",
")",
":",
"self",
".",
"ec2",
"=",
"ec2",
"or",
"boto3",
".",
"client",
"(",
"'ec2'",
",",
"config",
"=",
"Config",
"(",
"retries",
"=",
"{",
"'max_attempts'",
... | [
15,
4
] | [
20,
61
] | python | en | ['en', 'en', 'nl'] | True |
Fetcher.fetch_available_amis | (self) | Retrieve from your aws account your custom AMIs | Retrieve from your aws account your custom AMIs | def fetch_available_amis(self):
""" Retrieve from your aws account your custom AMIs"""
available_amis = dict()
my_custom_images = self.ec2.describe_images(Owners=['self'])
for image_json in my_custom_images.get('Images'):
ami = AMI.object_with_json(image_json)
... | [
"def",
"fetch_available_amis",
"(",
"self",
")",
":",
"available_amis",
"=",
"dict",
"(",
")",
"my_custom_images",
"=",
"self",
".",
"ec2",
".",
"describe_images",
"(",
"Owners",
"=",
"[",
"'self'",
"]",
")",
"for",
"image_json",
"in",
"my_custom_images",
".... | [
22,
4
] | [
33,
29
] | python | en | ['en', 'ga', 'en'] | True |
Fetcher.fetch_unattached_lc | (self) |
Find AMIs for launch configurations unattached
to autoscaling groups
|
Find AMIs for launch configurations unattached
to autoscaling groups
| def fetch_unattached_lc(self):
"""
Find AMIs for launch configurations unattached
to autoscaling groups
"""
resp = self.asg.describe_auto_scaling_groups()
used_lc = (asg.get("LaunchConfigurationName", "")
for asg in resp.get("AutoScalingGroups", []))
... | [
"def",
"fetch_unattached_lc",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"asg",
".",
"describe_auto_scaling_groups",
"(",
")",
"used_lc",
"=",
"(",
"asg",
".",
"get",
"(",
"\"LaunchConfigurationName\"",
",",
"\"\"",
")",
"for",
"asg",
"in",
"resp",
"... | [
35,
4
] | [
58,
19
] | python | en | ['en', 'error', 'th'] | False |
Fetcher.fetch_zeroed_asg | (self) |
Find AMIs for autoscaling groups who's desired capacity is set to 0
|
Find AMIs for autoscaling groups who's desired capacity is set to 0
| def fetch_zeroed_asg(self):
"""
Find AMIs for autoscaling groups who's desired capacity is set to 0
"""
resp = self.asg.describe_auto_scaling_groups()
zeroed_lcs = [asg.get("LaunchConfigurationName", "")
for asg in resp.get("AutoScalingGroups", [])
... | [
"def",
"fetch_zeroed_asg",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"asg",
".",
"describe_auto_scaling_groups",
"(",
")",
"zeroed_lcs",
"=",
"[",
"asg",
".",
"get",
"(",
"\"LaunchConfigurationName\"",
",",
"\"\"",
")",
"for",
"asg",
"in",
"resp",
"... | [
60,
4
] | [
78,
19
] | python | en | ['en', 'error', 'th'] | False |
Fetcher.fetch_instances | (self) | Find AMIs for not terminated EC2 instances | Find AMIs for not terminated EC2 instances | def fetch_instances(self):
""" Find AMIs for not terminated EC2 instances """
resp = self.ec2.describe_instances(
Filters=[
{
'Name': 'instance-state-name',
'Values': [
'pending',
'runni... | [
"def",
"fetch_instances",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"ec2",
".",
"describe_instances",
"(",
"Filters",
"=",
"[",
"{",
"'Name'",
":",
"'instance-state-name'",
",",
"'Values'",
":",
"[",
"'pending'",
",",
"'running'",
",",
"'shutting-down... | [
80,
4
] | [
102,
19
] | python | en | ['en', 'en', 'en'] | True |
MeshBaseDataset._get_db | (self, ann_file) | Load dataset. | Load dataset. | def _get_db(self, ann_file):
"""Load dataset."""
data = np.load(ann_file)
tmpl = dict(
image_file=None,
center=None,
scale=None,
rotation=0,
joints_2d=None,
joints_2d_visible=None,
joints_3d=None,
joi... | [
"def",
"_get_db",
"(",
"self",
",",
"ann_file",
")",
":",
"data",
"=",
"np",
".",
"load",
"(",
"ann_file",
")",
"tmpl",
"=",
"dict",
"(",
"image_file",
"=",
"None",
",",
"center",
"=",
"None",
",",
"scale",
"=",
"None",
",",
"rotation",
"=",
"0",
... | [
65,
4
] | [
144,
20
] | python | da | ['es', 'da', 'it'] | False |
MeshBaseDataset.__len__ | (self, ) | Get the size of the dataset. | Get the size of the dataset. | def __len__(self, ):
"""Get the size of the dataset."""
return len(self.db) | [
"def",
"__len__",
"(",
"self",
",",
")",
":",
"return",
"len",
"(",
"self",
".",
"db",
")"
] | [
146,
4
] | [
148,
27
] | python | en | ['en', 'en', 'en'] | True |
MeshBaseDataset.__getitem__ | (self, idx) | Get the sample given index. | Get the sample given index. | def __getitem__(self, idx):
"""Get the sample given index."""
results = cp.deepcopy(self.db[idx])
results['ann_info'] = self.ann_info
return self.pipeline(results) | [
"def",
"__getitem__",
"(",
"self",
",",
"idx",
")",
":",
"results",
"=",
"cp",
".",
"deepcopy",
"(",
"self",
".",
"db",
"[",
"idx",
"]",
")",
"results",
"[",
"'ann_info'",
"]",
"=",
"self",
".",
"ann_info",
"return",
"self",
".",
"pipeline",
"(",
"... | [
150,
4
] | [
154,
37
] | python | en | ['en', 'en', 'en'] | True |
_add_keepdims | (func) | hack in keepdims behavior into a function taking an axis | hack in keepdims behavior into a function taking an axis | def _add_keepdims(func):
""" hack in keepdims behavior into a function taking an axis """
@functools.wraps(func)
def wrapped(a, axis, **kwargs):
res = func(a, axis=axis, **kwargs)
if axis is None:
axis = 0 # res is now a scalar, so we can insert this anywhere
return np.e... | [
"def",
"_add_keepdims",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapped",
"(",
"a",
",",
"axis",
",",
"*",
"*",
"kwargs",
")",
":",
"res",
"=",
"func",
"(",
"a",
",",
"axis",
"=",
"axis",
",",
"*",
"*",
... | [
21,
0
] | [
29,
18
] | python | en | ['en', 'en', 'en'] | True |
TestTakeAlongAxis.test_argequivalent | (self) | Test it translates from arg<func> to <func> | Test it translates from arg<func> to <func> | def test_argequivalent(self):
""" Test it translates from arg<func> to <func> """
from numpy.random import rand
a = rand(3, 4, 5)
funcs = [
(np.sort, np.argsort, dict()),
(_add_keepdims(np.min), _add_keepdims(np.argmin), dict()),
(_add_keepdims(np.max... | [
"def",
"test_argequivalent",
"(",
"self",
")",
":",
"from",
"numpy",
".",
"random",
"import",
"rand",
"a",
"=",
"rand",
"(",
"3",
",",
"4",
",",
"5",
")",
"funcs",
"=",
"[",
"(",
"np",
".",
"sort",
",",
"np",
".",
"argsort",
",",
"dict",
"(",
"... | [
33,
4
] | [
49,
76
] | python | en | ['en', 'en', 'en'] | True |
TestTakeAlongAxis.test_invalid | (self) | Test it errors when indices has too few dimensions | Test it errors when indices has too few dimensions | def test_invalid(self):
""" Test it errors when indices has too few dimensions """
a = np.ones((10, 10))
ai = np.ones((10, 2), dtype=np.intp)
# sanity check
take_along_axis(a, ai, axis=1)
# not enough indices
assert_raises(ValueError, take_along_axis, a, np.arra... | [
"def",
"test_invalid",
"(",
"self",
")",
":",
"a",
"=",
"np",
".",
"ones",
"(",
"(",
"10",
",",
"10",
")",
")",
"ai",
"=",
"np",
".",
"ones",
"(",
"(",
"10",
",",
"2",
")",
",",
"dtype",
"=",
"np",
".",
"intp",
")",
"# sanity check",
"take_al... | [
51,
4
] | [
66,
68
] | python | en | ['en', 'en', 'en'] | True |
TestTakeAlongAxis.test_empty | (self) | Test everything is ok with empty results, even with inserted dims | Test everything is ok with empty results, even with inserted dims | def test_empty(self):
""" Test everything is ok with empty results, even with inserted dims """
a = np.ones((3, 4, 5))
ai = np.ones((3, 0, 5), dtype=np.intp)
actual = take_along_axis(a, ai, axis=1)
assert_equal(actual.shape, ai.shape) | [
"def",
"test_empty",
"(",
"self",
")",
":",
"a",
"=",
"np",
".",
"ones",
"(",
"(",
"3",
",",
"4",
",",
"5",
")",
")",
"ai",
"=",
"np",
".",
"ones",
"(",
"(",
"3",
",",
"0",
",",
"5",
")",
",",
"dtype",
"=",
"np",
".",
"intp",
")",
"actu... | [
68,
4
] | [
74,
44
] | python | en | ['en', 'en', 'en'] | True |
TestTakeAlongAxis.test_broadcast | (self) | Test that non-indexing dimensions are broadcast in both directions | Test that non-indexing dimensions are broadcast in both directions | def test_broadcast(self):
""" Test that non-indexing dimensions are broadcast in both directions """
a = np.ones((3, 4, 1))
ai = np.ones((1, 2, 5), dtype=np.intp)
actual = take_along_axis(a, ai, axis=1)
assert_equal(actual.shape, (3, 2, 5)) | [
"def",
"test_broadcast",
"(",
"self",
")",
":",
"a",
"=",
"np",
".",
"ones",
"(",
"(",
"3",
",",
"4",
",",
"1",
")",
")",
"ai",
"=",
"np",
".",
"ones",
"(",
"(",
"1",
",",
"2",
",",
"5",
")",
",",
"dtype",
"=",
"np",
".",
"intp",
")",
"... | [
76,
4
] | [
81,
45
] | python | en | ['en', 'en', 'en'] | True |
TestPutAlongAxis.test_broadcast | (self) | Test that non-indexing dimensions are broadcast in both directions | Test that non-indexing dimensions are broadcast in both directions | def test_broadcast(self):
""" Test that non-indexing dimensions are broadcast in both directions """
a = np.ones((3, 4, 1))
ai = np.arange(10, dtype=np.intp).reshape((1, 2, 5)) % 4
put_along_axis(a, ai, 20, axis=1)
assert_equal(take_along_axis(a, ai, axis=1), 20) | [
"def",
"test_broadcast",
"(",
"self",
")",
":",
"a",
"=",
"np",
".",
"ones",
"(",
"(",
"3",
",",
"4",
",",
"1",
")",
")",
"ai",
"=",
"np",
".",
"arange",
"(",
"10",
",",
"dtype",
"=",
"np",
".",
"intp",
")",
".",
"reshape",
"(",
"(",
"1",
... | [
101,
4
] | [
106,
56
] | python | en | ['en', 'en', 'en'] | True |
TestArraySplit.test_integer_split_2D_default | (self) | This will fail if we change default axis
| This will fail if we change default axis
| def test_integer_split_2D_default(self):
""" This will fail if we change default axis
"""
a = np.array([np.arange(10), np.arange(10)])
res = array_split(a, 3)
tgt = [np.array([np.arange(10)]), np.array([np.arange(10)]),
np.zeros((0, 10))]
compare_result... | [
"def",
"test_integer_split_2D_default",
"(",
"self",
")",
":",
"a",
"=",
"np",
".",
"array",
"(",
"[",
"np",
".",
"arange",
"(",
"10",
")",
",",
"np",
".",
"arange",
"(",
"10",
")",
"]",
")",
"res",
"=",
"array_split",
"(",
"a",
",",
"3",
")",
... | [
399,
4
] | [
407,
51
] | python | en | ['en', 'en', 'en'] | True |
get_directory_from_package | (package) | Get directory path from package name or full qualified message name
Args:
package: the full qualified name of package or message.
| Get directory path from package name or full qualified message name | def get_directory_from_package(package):
"""Get directory path from package name or full qualified message name
Args:
package: the full qualified name of package or message.
"""
return '/'.join(s for s in package.split('.') if s and s[0].islower()) | [
"def",
"get_directory_from_package",
"(",
"package",
")",
":",
"return",
"'/'",
".",
"join",
"(",
"s",
"for",
"s",
"in",
"package",
".",
"split",
"(",
"'.'",
")",
"if",
"s",
"and",
"s",
"[",
"0",
"]",
".",
"islower",
"(",
")",
")"
] | [
71,
0
] | [
77,
74
] | python | en | ['en', 'en', 'en'] | True |
get_destination_path | (src) | Obtain destination path from a proto file path by reading its package statement.
Args:
src: source path
| Obtain destination path from a proto file path by reading its package statement. | def get_destination_path(src):
"""Obtain destination path from a proto file path by reading its package statement.
Args:
src: source path
"""
src_path = pathlib.Path(src)
contents = src_path.read_text(encoding='utf8')
matches = re.findall(PACKAGE_REGEX, contents)
if len(matches) != ... | [
"def",
"get_destination_path",
"(",
"src",
")",
":",
"src_path",
"=",
"pathlib",
".",
"Path",
"(",
"src",
")",
"contents",
"=",
"src_path",
".",
"read_text",
"(",
"encoding",
"=",
"'utf8'",
")",
"matches",
"=",
"re",
".",
"findall",
"(",
"PACKAGE_REGEX",
... | [
80,
0
] | [
93,
69
] | python | en | ['en', 'en', 'en'] | True |
get_abs_rel_destination_path | (dst_root, src) | Obtain absolute path from a proto file path combined with destination root.
Creates the parent directory if necessary.
Args:
dst_root: destination root path.
src: source path.
| Obtain absolute path from a proto file path combined with destination root. | def get_abs_rel_destination_path(dst_root, src):
"""Obtain absolute path from a proto file path combined with destination root.
Creates the parent directory if necessary.
Args:
dst_root: destination root path.
src: source path.
"""
rel_dst_path = get_destination_path(src)
dst =... | [
"def",
"get_abs_rel_destination_path",
"(",
"dst_root",
",",
"src",
")",
":",
"rel_dst_path",
"=",
"get_destination_path",
"(",
"src",
")",
"dst",
"=",
"dst_root",
".",
"joinpath",
"(",
"rel_dst_path",
")",
"dst",
".",
"parent",
".",
"mkdir",
"(",
"0o755",
"... | [
96,
0
] | [
108,
28
] | python | en | ['en', 'en', 'en'] | True |
proto_print | (src, dst) | Pretty-print FileDescriptorProto to a destination file.
Args:
src: source path for FileDescriptorProto.
dst: destination path for formatted proto.
| Pretty-print FileDescriptorProto to a destination file. | def proto_print(src, dst):
"""Pretty-print FileDescriptorProto to a destination file.
Args:
src: source path for FileDescriptorProto.
dst: destination path for formatted proto.
"""
print('proto_print %s' % dst)
subprocess.check_output([
'bazel-bin/tools/protoxform/protoprint... | [
"def",
"proto_print",
"(",
"src",
",",
"dst",
")",
":",
"print",
"(",
"'proto_print %s'",
"%",
"dst",
")",
"subprocess",
".",
"check_output",
"(",
"[",
"'bazel-bin/tools/protoxform/protoprint'",
",",
"src",
",",
"str",
"(",
"dst",
")",
",",
"'./bazel-bin/tools... | [
111,
0
] | [
124,
6
] | python | it | ['it', 'it', 'en'] | True |
merge_active_shadow | (active_src, shadow_src, dst) | Merge active/shadow FileDescriptorProto to a destination file.
Args:
active_src: source path for active FileDescriptorProto.
shadow_src: source path for active FileDescriptorProto.
dst: destination path for FileDescriptorProto.
| Merge active/shadow FileDescriptorProto to a destination file. | def merge_active_shadow(active_src, shadow_src, dst):
"""Merge active/shadow FileDescriptorProto to a destination file.
Args:
active_src: source path for active FileDescriptorProto.
shadow_src: source path for active FileDescriptorProto.
dst: destination path for FileDescriptorProto.
... | [
"def",
"merge_active_shadow",
"(",
"active_src",
",",
"shadow_src",
",",
"dst",
")",
":",
"print",
"(",
"'merge_active_shadow %s'",
"%",
"dst",
")",
"subprocess",
".",
"check_output",
"(",
"[",
"'bazel-bin/tools/protoxform/merge_active_shadow'",
",",
"active_src",
","... | [
127,
0
] | [
141,
6
] | python | en | ['en', 'gl', 'en'] | True |
sync_proto_file | (dst_srcs) | Pretty-print a proto descriptor from protoxform.py Bazel cache artifacts."
In the case where we are generating an Envoy internal shadow, it may be
necessary to combine the current active proto, subject to hand editing, with
shadow artifacts from the previous verion; this is done via
merge_active_shadow... | Pretty-print a proto descriptor from protoxform.py Bazel cache artifacts." | def sync_proto_file(dst_srcs):
"""Pretty-print a proto descriptor from protoxform.py Bazel cache artifacts."
In the case where we are generating an Envoy internal shadow, it may be
necessary to combine the current active proto, subject to hand editing, with
shadow artifacts from the previous verion; th... | [
"def",
"sync_proto_file",
"(",
"dst_srcs",
")",
":",
"dst",
",",
"srcs",
"=",
"dst_srcs",
"assert",
"(",
"len",
"(",
"srcs",
")",
">",
"0",
")",
"# If we only have one candidate source for a destination, just pretty-print.",
"if",
"len",
"(",
"srcs",
")",
"==",
... | [
144,
0
] | [
180,
50
] | python | en | ['en', 'it', 'en'] | True |
get_import_deps | (proto_path) | Obtain the Bazel dependencies for the import paths from a .proto file.
Args:
proto_path: path to .proto.
Returns:
A list of Bazel targets reflecting the imports in the .proto at proto_path.
| Obtain the Bazel dependencies for the import paths from a .proto file. | def get_import_deps(proto_path):
"""Obtain the Bazel dependencies for the import paths from a .proto file.
Args:
proto_path: path to .proto.
Returns:
A list of Bazel targets reflecting the imports in the .proto at proto_path.
"""
imports = []
with open(proto_path, 'r', encoding... | [
"def",
"get_import_deps",
"(",
"proto_path",
")",
":",
"imports",
"=",
"[",
"]",
"with",
"open",
"(",
"proto_path",
",",
"'r'",
",",
"encoding",
"=",
"'utf8'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"match",
"=",
"re",
".",
"match",
"(... | [
183,
0
] | [
223,
18
] | python | en | ['en', 'en', 'en'] | True |
get_previous_message_type_deps | (proto_path) | Obtain the Bazel dependencies for the previous version of messages in a .proto file.
We need to link in earlier proto descriptors to support Envoy reflection upgrades.
Args:
proto_path: path to .proto.
Returns:
A list of Bazel targets reflecting the previous message types in the .proto at... | Obtain the Bazel dependencies for the previous version of messages in a .proto file. | def get_previous_message_type_deps(proto_path):
"""Obtain the Bazel dependencies for the previous version of messages in a .proto file.
We need to link in earlier proto descriptors to support Envoy reflection upgrades.
Args:
proto_path: path to .proto.
Returns:
A list of Bazel targets... | [
"def",
"get_previous_message_type_deps",
"(",
"proto_path",
")",
":",
"contents",
"=",
"pathlib",
".",
"Path",
"(",
"proto_path",
")",
".",
"read_text",
"(",
"encoding",
"=",
"'utf8'",
")",
"matches",
"=",
"re",
".",
"findall",
"(",
"PREVIOUS_MESSAGE_TYPE_REGEX"... | [
226,
0
] | [
243,
15
] | python | en | ['en', 'en', 'en'] | True |
has_services | (proto_path) | Does a .proto file have any service definitions?
Args:
proto_path: path to .proto.
Returns:
True iff there are service definitions in the .proto at proto_path.
| Does a .proto file have any service definitions? | def has_services(proto_path):
"""Does a .proto file have any service definitions?
Args:
proto_path: path to .proto.
Returns:
True iff there are service definitions in the .proto at proto_path.
"""
with open(proto_path, 'r', encoding='utf8') as f:
for line in f:
... | [
"def",
"has_services",
"(",
"proto_path",
")",
":",
"with",
"open",
"(",
"proto_path",
",",
"'r'",
",",
"encoding",
"=",
"'utf8'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"if",
"re",
".",
"match",
"(",
"SERVICE_REGEX",
",",
"line",
")",
... | [
246,
0
] | [
259,
16
] | python | en | ['en', 'en', 'en'] | True |
build_file_contents | (root, files) | Compute the canonical BUILD contents for an api/ proto directory.
Args:
root: base path to directory.
files: a list of files in the directory.
Returns:
A string containing the canonical BUILD file content for root.
| Compute the canonical BUILD contents for an api/ proto directory. | def build_file_contents(root, files):
"""Compute the canonical BUILD contents for an api/ proto directory.
Args:
root: base path to directory.
files: a list of files in the directory.
Returns:
A string containing the canonical BUILD file content for root.
"""
import_deps = ... | [
"def",
"build_file_contents",
"(",
"root",
",",
"files",
")",
":",
"import_deps",
"=",
"set",
"(",
"sum",
"(",
"[",
"get_import_deps",
"(",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"f",
")",
")",
"for",
"f",
"in",
"files",
"]",
",",
"[",
... | [
267,
0
] | [
293,
66
] | python | en | ['en', 'en', 'en'] | True |
sync_build_files | (cmd, dst_root) | Diff or in-place update api/ BUILD files.
Args:
cmd: 'check' or 'fix'.
| Diff or in-place update api/ BUILD files. | def sync_build_files(cmd, dst_root):
"""Diff or in-place update api/ BUILD files.
Args:
cmd: 'check' or 'fix'.
"""
for root, dirs, files in os.walk(str(dst_root)):
is_proto_dir = any(f.endswith('.proto') for f in files)
if not is_proto_dir:
continue
build_con... | [
"def",
"sync_build_files",
"(",
"cmd",
",",
"dst_root",
")",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"str",
"(",
"dst_root",
")",
")",
":",
"is_proto_dir",
"=",
"any",
"(",
"f",
".",
"endswith",
"(",
"'.proto'",
... | [
296,
0
] | [
309,
35
] | python | en | ['en', 'en', 'en'] | True |
generate_current_api_dir | (api_dir, dst_dir) | Helper function to generate original API repository to be compared with diff.
This copies the original API repository and deletes file we don't want to compare.
Args:
api_dir: the original api directory
dst_dir: the api directory to be compared in temporary directory
| Helper function to generate original API repository to be compared with diff.
This copies the original API repository and deletes file we don't want to compare. | def generate_current_api_dir(api_dir, dst_dir):
"""Helper function to generate original API repository to be compared with diff.
This copies the original API repository and deletes file we don't want to compare.
Args:
api_dir: the original api directory
dst_dir: the api directory to be comp... | [
"def",
"generate_current_api_dir",
"(",
"api_dir",
",",
"dst_dir",
")",
":",
"dst",
"=",
"dst_dir",
".",
"joinpath",
"(",
"\"envoy\"",
")",
"shutil",
".",
"copytree",
"(",
"str",
"(",
"api_dir",
".",
"joinpath",
"(",
"\"envoy\"",
")",
")",
",",
"str",
"(... | [
312,
0
] | [
327,
66
] | python | en | ['en', 'en', 'en'] | True |
git_modified_files | (path, suffix) | Obtain a list of modified files since the last commit merged by GitHub.
Args:
path: path to examine.
suffix: path suffix to filter with.
Return:
A list of strings providing the paths of modified files in the repo.
| Obtain a list of modified files since the last commit merged by GitHub. | def git_modified_files(path, suffix):
"""Obtain a list of modified files since the last commit merged by GitHub.
Args:
path: path to examine.
suffix: path suffix to filter with.
Return:
A list of strings providing the paths of modified files in the repo.
"""
try:
mod... | [
"def",
"git_modified_files",
"(",
"path",
",",
"suffix",
")",
":",
"try",
":",
"modified_files",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'tools/git/modified_since_last_github_commit.sh'",
",",
"'api'",
",",
"'proto'",
"]",
")",
".",
"decode",
"(",
")"... | [
334,
0
] | [
350,
13
] | python | en | ['en', 'en', 'en'] | True |
poly2lag | (pol) |
poly2lag(pol)
Convert a polynomial to a Laguerre series.
Convert an array representing the coefficients of a polynomial (relative
to the "standard" basis) ordered from lowest degree to highest, to an
array of the coefficients of the equivalent Laguerre series, ordered
from lowest to highest d... |
poly2lag(pol) | def poly2lag(pol):
"""
poly2lag(pol)
Convert a polynomial to a Laguerre series.
Convert an array representing the coefficients of a polynomial (relative
to the "standard" basis) ordered from lowest degree to highest, to an
array of the coefficients of the equivalent Laguerre series, ordered
... | [
"def",
"poly2lag",
"(",
"pol",
")",
":",
"[",
"pol",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"pol",
"]",
")",
"deg",
"=",
"len",
"(",
"pol",
")",
"-",
"1",
"res",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"deg",
",",
"-",
"1",
",",
"-... | [
81,
0
] | [
124,
14
] | python | en | ['en', 'error', 'th'] | False |
lag2poly | (c) |
Convert a Laguerre series to a polynomial.
Convert an array representing the coefficients of a Laguerre series,
ordered from lowest degree to highest, to an array of the coefficients
of the equivalent polynomial (relative to the "standard" basis) ordered
from lowest to highest degree.
Paramet... |
Convert a Laguerre series to a polynomial. | def lag2poly(c):
"""
Convert a Laguerre series to a polynomial.
Convert an array representing the coefficients of a Laguerre series,
ordered from lowest degree to highest, to an array of the coefficients
of the equivalent polynomial (relative to the "standard" basis) ordered
from lowest to high... | [
"def",
"lag2poly",
"(",
"c",
")",
":",
"from",
".",
"polynomial",
"import",
"polyadd",
",",
"polysub",
",",
"polymulx",
"[",
"c",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c",
"]",
")",
"n",
"=",
"len",
"(",
"c",
")",
"if",
"n",
"==",
"1",
... | [
127,
0
] | [
179,
53
] | python | en | ['en', 'error', 'th'] | False |
lagline | (off, scl) |
Laguerre series whose graph is a straight line.
Parameters
----------
off, scl : scalars
The specified line is given by ``off + scl*x``.
Returns
-------
y : ndarray
This module's representation of the Laguerre series for
``off + scl*x``.
See Also
-------... |
Laguerre series whose graph is a straight line. | def lagline(off, scl):
"""
Laguerre series whose graph is a straight line.
Parameters
----------
off, scl : scalars
The specified line is given by ``off + scl*x``.
Returns
-------
y : ndarray
This module's representation of the Laguerre series for
``off + scl*... | [
"def",
"lagline",
"(",
"off",
",",
"scl",
")",
":",
"if",
"scl",
"!=",
"0",
":",
"return",
"np",
".",
"array",
"(",
"[",
"off",
"+",
"scl",
",",
"-",
"scl",
"]",
")",
"else",
":",
"return",
"np",
".",
"array",
"(",
"[",
"off",
"]",
")"
] | [
199,
0
] | [
232,
30
] | python | en | ['en', 'error', 'th'] | False |
lagfromroots | (roots) |
Generate a Laguerre series with given roots.
The function returns the coefficients of the polynomial
.. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n),
in Laguerre form, where the `r_n` are the roots specified in `roots`.
If a zero has multiplicity n, then it must appear in `roots` n time... |
Generate a Laguerre series with given roots. | def lagfromroots(roots):
"""
Generate a Laguerre series with given roots.
The function returns the coefficients of the polynomial
.. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n),
in Laguerre form, where the `r_n` are the roots specified in `roots`.
If a zero has multiplicity n, then ... | [
"def",
"lagfromroots",
"(",
"roots",
")",
":",
"return",
"pu",
".",
"_fromroots",
"(",
"lagline",
",",
"lagmul",
",",
"roots",
")"
] | [
235,
0
] | [
284,
48
] | python | en | ['en', 'error', 'th'] | False |
lagadd | (c1, c2) |
Add one Laguerre series to another.
Returns the sum of two Laguerre series `c1` + `c2`. The arguments
are sequences of coefficients ordered from lowest order term to
highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``.
Parameters
----------
c1, c2 : array_like
1-... |
Add one Laguerre series to another. | def lagadd(c1, c2):
"""
Add one Laguerre series to another.
Returns the sum of two Laguerre series `c1` + `c2`. The arguments
are sequences of coefficients ordered from lowest order term to
highest, i.e., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``.
Parameters
----------
c1,... | [
"def",
"lagadd",
"(",
"c1",
",",
"c2",
")",
":",
"return",
"pu",
".",
"_add",
"(",
"c1",
",",
"c2",
")"
] | [
287,
0
] | [
325,
26
] | python | en | ['en', 'error', 'th'] | False |
lagsub | (c1, c2) |
Subtract one Laguerre series from another.
Returns the difference of two Laguerre series `c1` - `c2`. The
sequences of coefficients are from lowest order term to highest, i.e.,
[1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``.
Parameters
----------
c1, c2 : array_like
1-D ar... |
Subtract one Laguerre series from another. | def lagsub(c1, c2):
"""
Subtract one Laguerre series from another.
Returns the difference of two Laguerre series `c1` - `c2`. The
sequences of coefficients are from lowest order term to highest, i.e.,
[1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``.
Parameters
----------
c1, c2 ... | [
"def",
"lagsub",
"(",
"c1",
",",
"c2",
")",
":",
"return",
"pu",
".",
"_sub",
"(",
"c1",
",",
"c2",
")"
] | [
328,
0
] | [
365,
26
] | python | en | ['en', 'error', 'th'] | False |
lagmulx | (c) | Multiply a Laguerre series by x.
Multiply the Laguerre series `c` by x, where x is the independent
variable.
Parameters
----------
c : array_like
1-D array of Laguerre series coefficients ordered from low to
high.
Returns
-------
out : ndarray
Array representi... | Multiply a Laguerre series by x. | def lagmulx(c):
"""Multiply a Laguerre series by x.
Multiply the Laguerre series `c` by x, where x is the independent
variable.
Parameters
----------
c : array_like
1-D array of Laguerre series coefficients ordered from low to
high.
Returns
-------
out : ndarray
... | [
"def",
"lagmulx",
"(",
"c",
")",
":",
"# c is a trimmed copy",
"[",
"c",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c",
"]",
")",
"# The zero series needs special treatment",
"if",
"len",
"(",
"c",
")",
"==",
"1",
"and",
"c",
"[",
"0",
"]",
"==",
"... | [
368,
0
] | [
419,
14
] | python | en | ['en', 'en', 'en'] | True |
lagmul | (c1, c2) |
Multiply one Laguerre series by another.
Returns the product of two Laguerre series `c1` * `c2`. The arguments
are sequences of coefficients, from lowest order "term" to highest,
e.g., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``.
Parameters
----------
c1, c2 : array_like
... |
Multiply one Laguerre series by another. | def lagmul(c1, c2):
"""
Multiply one Laguerre series by another.
Returns the product of two Laguerre series `c1` * `c2`. The arguments
are sequences of coefficients, from lowest order "term" to highest,
e.g., [1,2,3] represents the series ``P_0 + 2*P_1 + 3*P_2``.
Parameters
----------
... | [
"def",
"lagmul",
"(",
"c1",
",",
"c2",
")",
":",
"# s1, s2 are trimmed copies",
"[",
"c1",
",",
"c2",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c1",
",",
"c2",
"]",
")",
"if",
"len",
"(",
"c1",
")",
">",
"len",
"(",
"c2",
")",
":",
"c",
"=... | [
422,
0
] | [
485,
46
] | python | en | ['en', 'error', 'th'] | False |
lagdiv | (c1, c2) |
Divide one Laguerre series by another.
Returns the quotient-with-remainder of two Laguerre series
`c1` / `c2`. The arguments are sequences of coefficients from lowest
order "term" to highest, e.g., [1,2,3] represents the series
``P_0 + 2*P_1 + 3*P_2``.
Parameters
----------
c1, c2 : ... |
Divide one Laguerre series by another. | def lagdiv(c1, c2):
"""
Divide one Laguerre series by another.
Returns the quotient-with-remainder of two Laguerre series
`c1` / `c2`. The arguments are sequences of coefficients from lowest
order "term" to highest, e.g., [1,2,3] represents the series
``P_0 + 2*P_1 + 3*P_2``.
Parameters
... | [
"def",
"lagdiv",
"(",
"c1",
",",
"c2",
")",
":",
"return",
"pu",
".",
"_div",
"(",
"lagmul",
",",
"c1",
",",
"c2",
")"
] | [
488,
0
] | [
531,
34
] | python | en | ['en', 'error', 'th'] | False |
lagpow | (c, pow, maxpower=16) | Raise a Laguerre series to a power.
Returns the Laguerre series `c` raised to the power `pow`. The
argument `c` is a sequence of coefficients ordered from low to high.
i.e., [1,2,3] is the series ``P_0 + 2*P_1 + 3*P_2.``
Parameters
----------
c : array_like
1-D array of Laguerre serie... | Raise a Laguerre series to a power. | def lagpow(c, pow, maxpower=16):
"""Raise a Laguerre series to a power.
Returns the Laguerre series `c` raised to the power `pow`. The
argument `c` is a sequence of coefficients ordered from low to high.
i.e., [1,2,3] is the series ``P_0 + 2*P_1 + 3*P_2.``
Parameters
----------
c : array_... | [
"def",
"lagpow",
"(",
"c",
",",
"pow",
",",
"maxpower",
"=",
"16",
")",
":",
"return",
"pu",
".",
"_pow",
"(",
"lagmul",
",",
"c",
",",
"pow",
",",
"maxpower",
")"
] | [
534,
0
] | [
568,
44
] | python | en | ['en', 'gd', 'pt'] | False |
lagder | (c, m=1, scl=1, axis=0) |
Differentiate a Laguerre series.
Returns the Laguerre series coefficients `c` differentiated `m` times
along `axis`. At each iteration the result is multiplied by `scl` (the
scaling factor is for use in a linear change of variable). The argument
`c` is an array of coefficients from low to high de... |
Differentiate a Laguerre series. | def lagder(c, m=1, scl=1, axis=0):
"""
Differentiate a Laguerre series.
Returns the Laguerre series coefficients `c` differentiated `m` times
along `axis`. At each iteration the result is multiplied by `scl` (the
scaling factor is for use in a linear change of variable). The argument
`c` is an... | [
"def",
"lagder",
"(",
"c",
",",
"m",
"=",
"1",
",",
"scl",
"=",
"1",
",",
"axis",
"=",
"0",
")",
":",
"c",
"=",
"np",
".",
"array",
"(",
"c",
",",
"ndmin",
"=",
"1",
",",
"copy",
"=",
"1",
")",
"if",
"c",
".",
"dtype",
".",
"char",
"in"... | [
571,
0
] | [
654,
12
] | python | en | ['en', 'error', 'th'] | False |
lagint | (c, m=1, k=[], lbnd=0, scl=1, axis=0) |
Integrate a Laguerre series.
Returns the Laguerre series coefficients `c` integrated `m` times from
`lbnd` along `axis`. At each iteration the resulting series is
**multiplied** by `scl` and an integration constant, `k`, is added.
The scaling factor is for use in a linear change of variable. ("Bu... |
Integrate a Laguerre series. | def lagint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
"""
Integrate a Laguerre series.
Returns the Laguerre series coefficients `c` integrated `m` times from
`lbnd` along `axis`. At each iteration the resulting series is
**multiplied** by `scl` and an integration constant, `k`, is added.
The scaling... | [
"def",
"lagint",
"(",
"c",
",",
"m",
"=",
"1",
",",
"k",
"=",
"[",
"]",
",",
"lbnd",
"=",
"0",
",",
"scl",
"=",
"1",
",",
"axis",
"=",
"0",
")",
":",
"c",
"=",
"np",
".",
"array",
"(",
"c",
",",
"ndmin",
"=",
"1",
",",
"copy",
"=",
"1... | [
657,
0
] | [
778,
12
] | python | en | ['en', 'error', 'th'] | False |
lagval | (x, c, tensor=True) |
Evaluate a Laguerre series at points x.
If `c` is of length `n + 1`, this function returns the value:
.. math:: p(x) = c_0 * L_0(x) + c_1 * L_1(x) + ... + c_n * L_n(x)
The parameter `x` is converted to an array only if it is a tuple or a
list, otherwise it is treated as a scalar. In either case,... |
Evaluate a Laguerre series at points x. | def lagval(x, c, tensor=True):
"""
Evaluate a Laguerre series at points x.
If `c` is of length `n + 1`, this function returns the value:
.. math:: p(x) = c_0 * L_0(x) + c_1 * L_1(x) + ... + c_n * L_n(x)
The parameter `x` is converted to an array only if it is a tuple or a
list, otherwise it i... | [
"def",
"lagval",
"(",
"x",
",",
"c",
",",
"tensor",
"=",
"True",
")",
":",
"c",
"=",
"np",
".",
"array",
"(",
"c",
",",
"ndmin",
"=",
"1",
",",
"copy",
"=",
"0",
")",
"if",
"c",
".",
"dtype",
".",
"char",
"in",
"'?bBhHiIlLqQpP'",
":",
"c",
... | [
781,
0
] | [
873,
26
] | python | en | ['en', 'error', 'th'] | False |
lagval2d | (x, y, c) |
Evaluate a 2-D Laguerre series at points (x, y).
This function returns the values:
.. math:: p(x,y) = \\sum_{i,j} c_{i,j} * L_i(x) * L_j(y)
The parameters `x` and `y` are converted to arrays only if they are
tuples or a lists, otherwise they are treated as a scalars and they
must have the sa... |
Evaluate a 2-D Laguerre series at points (x, y). | def lagval2d(x, y, c):
"""
Evaluate a 2-D Laguerre series at points (x, y).
This function returns the values:
.. math:: p(x,y) = \\sum_{i,j} c_{i,j} * L_i(x) * L_j(y)
The parameters `x` and `y` are converted to arrays only if they are
tuples or a lists, otherwise they are treated as a scalars... | [
"def",
"lagval2d",
"(",
"x",
",",
"y",
",",
"c",
")",
":",
"return",
"pu",
".",
"_valnd",
"(",
"lagval",
",",
"c",
",",
"x",
",",
"y",
")"
] | [
876,
0
] | [
922,
37
] | python | en | ['en', 'error', 'th'] | False |
laggrid2d | (x, y, c) |
Evaluate a 2-D Laguerre series on the Cartesian product of x and y.
This function returns the values:
.. math:: p(a,b) = \\sum_{i,j} c_{i,j} * L_i(a) * L_j(b)
where the points `(a, b)` consist of all pairs formed by taking
`a` from `x` and `b` from `y`. The resulting points form a grid with
... |
Evaluate a 2-D Laguerre series on the Cartesian product of x and y. | def laggrid2d(x, y, c):
"""
Evaluate a 2-D Laguerre series on the Cartesian product of x and y.
This function returns the values:
.. math:: p(a,b) = \\sum_{i,j} c_{i,j} * L_i(a) * L_j(b)
where the points `(a, b)` consist of all pairs formed by taking
`a` from `x` and `b` from `y`. The resulti... | [
"def",
"laggrid2d",
"(",
"x",
",",
"y",
",",
"c",
")",
":",
"return",
"pu",
".",
"_gridnd",
"(",
"lagval",
",",
"c",
",",
"x",
",",
"y",
")"
] | [
925,
0
] | [
975,
38
] | python | en | ['en', 'error', 'th'] | False |
lagval3d | (x, y, z, c) |
Evaluate a 3-D Laguerre series at points (x, y, z).
This function returns the values:
.. math:: p(x,y,z) = \\sum_{i,j,k} c_{i,j,k} * L_i(x) * L_j(y) * L_k(z)
The parameters `x`, `y`, and `z` are converted to arrays only if
they are tuples or a lists, otherwise they are treated as a scalars and
... |
Evaluate a 3-D Laguerre series at points (x, y, z). | def lagval3d(x, y, z, c):
"""
Evaluate a 3-D Laguerre series at points (x, y, z).
This function returns the values:
.. math:: p(x,y,z) = \\sum_{i,j,k} c_{i,j,k} * L_i(x) * L_j(y) * L_k(z)
The parameters `x`, `y`, and `z` are converted to arrays only if
they are tuples or a lists, otherwise th... | [
"def",
"lagval3d",
"(",
"x",
",",
"y",
",",
"z",
",",
"c",
")",
":",
"return",
"pu",
".",
"_valnd",
"(",
"lagval",
",",
"c",
",",
"x",
",",
"y",
",",
"z",
")"
] | [
978,
0
] | [
1026,
40
] | python | en | ['en', 'error', 'th'] | False |
laggrid3d | (x, y, z, c) |
Evaluate a 3-D Laguerre series on the Cartesian product of x, y, and z.
This function returns the values:
.. math:: p(a,b,c) = \\sum_{i,j,k} c_{i,j,k} * L_i(a) * L_j(b) * L_k(c)
where the points `(a, b, c)` consist of all triples formed by taking
`a` from `x`, `b` from `y`, and `c` from `z`. The... |
Evaluate a 3-D Laguerre series on the Cartesian product of x, y, and z. | def laggrid3d(x, y, z, c):
"""
Evaluate a 3-D Laguerre series on the Cartesian product of x, y, and z.
This function returns the values:
.. math:: p(a,b,c) = \\sum_{i,j,k} c_{i,j,k} * L_i(a) * L_j(b) * L_k(c)
where the points `(a, b, c)` consist of all triples formed by taking
`a` from `x`, `... | [
"def",
"laggrid3d",
"(",
"x",
",",
"y",
",",
"z",
",",
"c",
")",
":",
"return",
"pu",
".",
"_gridnd",
"(",
"lagval",
",",
"c",
",",
"x",
",",
"y",
",",
"z",
")"
] | [
1029,
0
] | [
1082,
41
] | python | en | ['en', 'error', 'th'] | False |
lagvander | (x, deg) | Pseudo-Vandermonde matrix of given degree.
Returns the pseudo-Vandermonde matrix of degree `deg` and sample points
`x`. The pseudo-Vandermonde matrix is defined by
.. math:: V[..., i] = L_i(x)
where `0 <= i <= deg`. The leading indices of `V` index the elements of
`x` and the last index is the de... | Pseudo-Vandermonde matrix of given degree. | def lagvander(x, deg):
"""Pseudo-Vandermonde matrix of given degree.
Returns the pseudo-Vandermonde matrix of degree `deg` and sample points
`x`. The pseudo-Vandermonde matrix is defined by
.. math:: V[..., i] = L_i(x)
where `0 <= i <= deg`. The leading indices of `V` index the elements of
`x... | [
"def",
"lagvander",
"(",
"x",
",",
"deg",
")",
":",
"ideg",
"=",
"pu",
".",
"_deprecate_as_int",
"(",
"deg",
",",
"\"deg\"",
")",
"if",
"ideg",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"deg must be non-negative\"",
")",
"x",
"=",
"np",
".",
"array"... | [
1085,
0
] | [
1142,
32
] | python | ca | ['nl', 'ca', 'en'] | False |
lagvander2d | (x, y, deg) | Pseudo-Vandermonde matrix of given degrees.
Returns the pseudo-Vandermonde matrix of degrees `deg` and sample
points `(x, y)`. The pseudo-Vandermonde matrix is defined by
.. math:: V[..., (deg[1] + 1)*i + j] = L_i(x) * L_j(y),
where `0 <= i <= deg[0]` and `0 <= j <= deg[1]`. The leading indices of
... | Pseudo-Vandermonde matrix of given degrees. | def lagvander2d(x, y, deg):
"""Pseudo-Vandermonde matrix of given degrees.
Returns the pseudo-Vandermonde matrix of degrees `deg` and sample
points `(x, y)`. The pseudo-Vandermonde matrix is defined by
.. math:: V[..., (deg[1] + 1)*i + j] = L_i(x) * L_j(y),
where `0 <= i <= deg[0]` and `0 <= j <=... | [
"def",
"lagvander2d",
"(",
"x",
",",
"y",
",",
"deg",
")",
":",
"return",
"pu",
".",
"_vander2d",
"(",
"lagvander",
",",
"x",
",",
"y",
",",
"deg",
")"
] | [
1145,
0
] | [
1195,
45
] | python | ca | ['nl', 'ca', 'en'] | False |
lagvander3d | (x, y, z, deg) | Pseudo-Vandermonde matrix of given degrees.
Returns the pseudo-Vandermonde matrix of degrees `deg` and sample
points `(x, y, z)`. If `l, m, n` are the given degrees in `x, y, z`,
then The pseudo-Vandermonde matrix is defined by
.. math:: V[..., (m+1)(n+1)i + (n+1)j + k] = L_i(x)*L_j(y)*L_k(z),
wh... | Pseudo-Vandermonde matrix of given degrees. | def lagvander3d(x, y, z, deg):
"""Pseudo-Vandermonde matrix of given degrees.
Returns the pseudo-Vandermonde matrix of degrees `deg` and sample
points `(x, y, z)`. If `l, m, n` are the given degrees in `x, y, z`,
then The pseudo-Vandermonde matrix is defined by
.. math:: V[..., (m+1)(n+1)i + (n+1)... | [
"def",
"lagvander3d",
"(",
"x",
",",
"y",
",",
"z",
",",
"deg",
")",
":",
"return",
"pu",
".",
"_vander3d",
"(",
"lagvander",
",",
"x",
",",
"y",
",",
"z",
",",
"deg",
")"
] | [
1198,
0
] | [
1249,
48
] | python | ca | ['nl', 'ca', 'en'] | False |
lagfit | (x, y, deg, rcond=None, full=False, w=None) |
Least squares fit of Laguerre series to data.
Return the coefficients of a Laguerre series of degree `deg` that is the
least squares fit to the data values `y` given at points `x`. If `y` is
1-D the returned coefficients will also be 1-D. If `y` is 2-D multiple
fits are done, one for each column o... |
Least squares fit of Laguerre series to data. | def lagfit(x, y, deg, rcond=None, full=False, w=None):
"""
Least squares fit of Laguerre series to data.
Return the coefficients of a Laguerre series of degree `deg` that is the
least squares fit to the data values `y` given at points `x`. If `y` is
1-D the returned coefficients will also be 1-D. I... | [
"def",
"lagfit",
"(",
"x",
",",
"y",
",",
"deg",
",",
"rcond",
"=",
"None",
",",
"full",
"=",
"False",
",",
"w",
"=",
"None",
")",
":",
"return",
"pu",
".",
"_fit",
"(",
"lagvander",
",",
"x",
",",
"y",
",",
"deg",
",",
"rcond",
",",
"full",
... | [
1252,
0
] | [
1376,
56
] | python | en | ['en', 'error', 'th'] | False |
lagcompanion | (c) |
Return the companion matrix of c.
The usual companion matrix of the Laguerre polynomials is already
symmetric when `c` is a basis Laguerre polynomial, so no scaling is
applied.
Parameters
----------
c : array_like
1-D array of Laguerre series coefficients ordered from low to high
... |
Return the companion matrix of c. | def lagcompanion(c):
"""
Return the companion matrix of c.
The usual companion matrix of the Laguerre polynomials is already
symmetric when `c` is a basis Laguerre polynomial, so no scaling is
applied.
Parameters
----------
c : array_like
1-D array of Laguerre series coefficien... | [
"def",
"lagcompanion",
"(",
"c",
")",
":",
"# c is a trimmed copy",
"[",
"c",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c",
"]",
")",
"if",
"len",
"(",
"c",
")",
"<",
"2",
":",
"raise",
"ValueError",
"(",
"'Series must have maximum degree of at least 1.... | [
1379,
0
] | [
1420,
14
] | python | en | ['en', 'error', 'th'] | False |
lagroots | (c) |
Compute the roots of a Laguerre series.
Return the roots (a.k.a. "zeros") of the polynomial
.. math:: p(x) = \\sum_i c[i] * L_i(x).
Parameters
----------
c : 1-D array_like
1-D array of coefficients.
Returns
-------
out : ndarray
Array of the roots of the series.... |
Compute the roots of a Laguerre series. | def lagroots(c):
"""
Compute the roots of a Laguerre series.
Return the roots (a.k.a. "zeros") of the polynomial
.. math:: p(x) = \\sum_i c[i] * L_i(x).
Parameters
----------
c : 1-D array_like
1-D array of coefficients.
Returns
-------
out : ndarray
Array of ... | [
"def",
"lagroots",
"(",
"c",
")",
":",
"# c is a trimmed copy",
"[",
"c",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c",
"]",
")",
"if",
"len",
"(",
"c",
")",
"<=",
"1",
":",
"return",
"np",
".",
"array",
"(",
"[",
"]",
",",
"dtype",
"=",
"... | [
1423,
0
] | [
1480,
12
] | python | en | ['en', 'error', 'th'] | False |
laggauss | (deg) |
Gauss-Laguerre quadrature.
Computes the sample points and weights for Gauss-Laguerre quadrature.
These sample points and weights will correctly integrate polynomials of
degree :math:`2*deg - 1` or less over the interval :math:`[0, \\inf]`
with the weight function :math:`f(x) = \\exp(-x)`.
Par... |
Gauss-Laguerre quadrature. | def laggauss(deg):
"""
Gauss-Laguerre quadrature.
Computes the sample points and weights for Gauss-Laguerre quadrature.
These sample points and weights will correctly integrate polynomials of
degree :math:`2*deg - 1` or less over the interval :math:`[0, \\inf]`
with the weight function :math:`f... | [
"def",
"laggauss",
"(",
"deg",
")",
":",
"ideg",
"=",
"pu",
".",
"_deprecate_as_int",
"(",
"deg",
",",
"\"deg\"",
")",
"if",
"ideg",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"deg must be a positive integer\"",
")",
"# first approximation of roots. We use the ... | [
1483,
0
] | [
1544,
15
] | python | en | ['en', 'error', 'th'] | False |
lagweight | (x) | Weight function of the Laguerre polynomials.
The weight function is :math:`exp(-x)` and the interval of integration
is :math:`[0, \\inf]`. The Laguerre polynomials are orthogonal, but not
normalized, with respect to this weight function.
Parameters
----------
x : array_like
Values at wh... | Weight function of the Laguerre polynomials. | def lagweight(x):
"""Weight function of the Laguerre polynomials.
The weight function is :math:`exp(-x)` and the interval of integration
is :math:`[0, \\inf]`. The Laguerre polynomials are orthogonal, but not
normalized, with respect to this weight function.
Parameters
----------
x : array... | [
"def",
"lagweight",
"(",
"x",
")",
":",
"w",
"=",
"np",
".",
"exp",
"(",
"-",
"x",
")",
"return",
"w"
] | [
1547,
0
] | [
1571,
12
] | python | en | ['en', 'en', 'en'] | True |
create_mlp | (input_shape: Tuple[int], n_actions: int, hidden_size: int = 128) |
Simple Multi-Layer Perceptron network
|
Simple Multi-Layer Perceptron network
| def create_mlp(input_shape: Tuple[int], n_actions: int, hidden_size: int = 128):
"""
Simple Multi-Layer Perceptron network
"""
network = nn.Sequential(
nn.Linear(input_shape[0], hidden_size),
nn.ReLU(),
nn.Linear(hidden_size, hidden_size),
nn.ReLU(),
nn.Linear(hid... | [
"def",
"create_mlp",
"(",
"input_shape",
":",
"Tuple",
"[",
"int",
"]",
",",
"n_actions",
":",
"int",
",",
"hidden_size",
":",
"int",
"=",
"128",
")",
":",
"network",
"=",
"nn",
".",
"Sequential",
"(",
"nn",
".",
"Linear",
"(",
"input_shape",
"[",
"0... | [
43,
0
] | [
55,
18
] | python | en | ['en', 'error', 'th'] | False |
ActorCategorical.__init__ | (self, actor_net) |
Args:
input_shape: observation shape of the environment
n_actions: number of discrete actions available in the environment
|
Args:
input_shape: observation shape of the environment
n_actions: number of discrete actions available in the environment
| def __init__(self, actor_net):
"""
Args:
input_shape: observation shape of the environment
n_actions: number of discrete actions available in the environment
"""
super().__init__()
self.actor_net = actor_net | [
"def",
"__init__",
"(",
"self",
",",
"actor_net",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"actor_net",
"=",
"actor_net"
] | [
64,
4
] | [
72,
34
] | python | en | ['en', 'error', 'th'] | False |
ActorCategorical.get_log_prob | (self, pi: Categorical, actions: torch.Tensor) |
Takes in a distribution and actions and returns log prob of actions under the distribution
Args:
pi: torch distribution
actions: actions taken by distribution
Returns:
log probability of the acition under pi
|
Takes in a distribution and actions and returns log prob of actions under the distribution | def get_log_prob(self, pi: Categorical, actions: torch.Tensor):
"""
Takes in a distribution and actions and returns log prob of actions under the distribution
Args:
pi: torch distribution
actions: actions taken by distribution
Returns:
log probabilit... | [
"def",
"get_log_prob",
"(",
"self",
",",
"pi",
":",
"Categorical",
",",
"actions",
":",
"torch",
".",
"Tensor",
")",
":",
"return",
"pi",
".",
"log_prob",
"(",
"actions",
")"
] | [
81,
4
] | [
92,
35
] | python | en | ['en', 'error', 'th'] | False |
ActorContinous.__init__ | (self, actor_net, act_dim) |
Args:
input_shape: observation shape of the environment
n_actions: number of discrete actions available in the environment
|
Args:
input_shape: observation shape of the environment
n_actions: number of discrete actions available in the environment
| def __init__(self, actor_net, act_dim):
"""
Args:
input_shape: observation shape of the environment
n_actions: number of discrete actions available in the environment
"""
super().__init__()
self.actor_net = actor_net
log_std = -0.5 * torch.ones(act... | [
"def",
"__init__",
"(",
"self",
",",
"actor_net",
",",
"act_dim",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"actor_net",
"=",
"actor_net",
"log_std",
"=",
"-",
"0.5",
"*",
"torch",
".",
"ones",
"(",
"act_dim",
",",
"dtype",... | [
101,
4
] | [
110,
44
] | python | en | ['en', 'error', 'th'] | False |
ActorContinous.get_log_prob | (self, pi: Normal, actions: torch.Tensor) |
Takes in a distribution and actions and returns log prob of actions under the distribution
Args:
pi: torch distribution
actions: actions taken by distribution
Returns:
log probability of the acition under pi
|
Takes in a distribution and actions and returns log prob of actions under the distribution | def get_log_prob(self, pi: Normal, actions: torch.Tensor):
"""
Takes in a distribution and actions and returns log prob of actions under the distribution
Args:
pi: torch distribution
actions: actions taken by distribution
Returns:
log probability of ... | [
"def",
"get_log_prob",
"(",
"self",
",",
"pi",
":",
"Normal",
",",
"actions",
":",
"torch",
".",
"Tensor",
")",
":",
"return",
"pi",
".",
"log_prob",
"(",
"actions",
")",
".",
"sum",
"(",
"axis",
"=",
"-",
"1",
")"
] | [
120,
4
] | [
131,
48
] | python | en | ['en', 'error', 'th'] | False |
PPOLightning.__init__ | (
self,
env: str,
gamma: float = 0.99,
lam: float = 0.95,
lr_actor: float = 3e-4,
lr_critic: float = 1e-3,
max_episode_len: float = 200,
batch_size: int = 512,
steps_per_epoch: int = 2048,
nb_optim_iters: int = 4,
clip_ratio: float ... |
Args:
env: gym environment tag
gamma: discount factor
lam: advantage discount factor (lambda in the paper)
lr_actor: learning rate of actor network
lr_critic: learning rate of critic network
max_episode_len: maximum number interactions (ac... |
Args:
env: gym environment tag
gamma: discount factor
lam: advantage discount factor (lambda in the paper)
lr_actor: learning rate of actor network
lr_critic: learning rate of critic network
max_episode_len: maximum number interactions (ac... | def __init__(
self,
env: str,
gamma: float = 0.99,
lam: float = 0.95,
lr_actor: float = 3e-4,
lr_critic: float = 1e-3,
max_episode_len: float = 200,
batch_size: int = 512,
steps_per_epoch: int = 2048,
nb_optim_iters: int = 4,
clip_r... | [
"def",
"__init__",
"(",
"self",
",",
"env",
":",
"str",
",",
"gamma",
":",
"float",
"=",
"0.99",
",",
"lam",
":",
"float",
"=",
"0.95",
",",
"lr_actor",
":",
"float",
"=",
"3e-4",
",",
"lr_critic",
":",
"float",
"=",
"1e-3",
",",
"max_episode_len",
... | [
162,
4
] | [
235,
56
] | python | en | ['en', 'error', 'th'] | False |
PPOLightning.forward | (self, x: torch.Tensor) |
Passes in a state x through the network and returns the policy and a sampled action
Args:
x: environment state
Returns:
Tuple of policy and action
|
Passes in a state x through the network and returns the policy and a sampled action | def forward(self, x: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
"""
Passes in a state x through the network and returns the policy and a sampled action
Args:
x: environment state
Returns:
Tuple of policy and action
"""
pi, ... | [
"def",
"forward",
"(",
"self",
",",
"x",
":",
"torch",
".",
"Tensor",
")",
"->",
"Tuple",
"[",
"torch",
".",
"Tensor",
",",
"torch",
".",
"Tensor",
",",
"torch",
".",
"Tensor",
"]",
":",
"pi",
",",
"action",
"=",
"self",
".",
"actor",
"(",
"x",
... | [
237,
4
] | [
250,
32
] | python | en | ['en', 'error', 'th'] | False |
PPOLightning.discount_rewards | (self, rewards: List[float], discount: float) | Calculate the discounted rewards of all rewards in list
Args:
rewards: list of rewards/advantages
Returns:
list of discounted rewards/advantages
| Calculate the discounted rewards of all rewards in list | def discount_rewards(self, rewards: List[float], discount: float) -> List[float]:
"""Calculate the discounted rewards of all rewards in list
Args:
rewards: list of rewards/advantages
Returns:
list of discounted rewards/advantages
"""
assert isinstance(re... | [
"def",
"discount_rewards",
"(",
"self",
",",
"rewards",
":",
"List",
"[",
"float",
"]",
",",
"discount",
":",
"float",
")",
"->",
"List",
"[",
"float",
"]",
":",
"assert",
"isinstance",
"(",
"rewards",
"[",
"0",
"]",
",",
"float",
")",
"cumul_reward",
... | [
252,
4
] | [
270,
43
] | python | en | ['en', 'en', 'en'] | True |
PPOLightning.calc_advantage | (self, rewards: List[float], values: List[float], last_value: float) | Calculate the advantage given rewards, state values, and the last value of episode
Args:
rewards: list of episode rewards
values: list of state values from critic
last_value: value of last state of episode
Returns:
list of advantages
| Calculate the advantage given rewards, state values, and the last value of episode | def calc_advantage(self, rewards: List[float], values: List[float], last_value: float) -> List[float]:
"""Calculate the advantage given rewards, state values, and the last value of episode
Args:
rewards: list of episode rewards
values: list of state values from critic
... | [
"def",
"calc_advantage",
"(",
"self",
",",
"rewards",
":",
"List",
"[",
"float",
"]",
",",
"values",
":",
"List",
"[",
"float",
"]",
",",
"last_value",
":",
"float",
")",
"->",
"List",
"[",
"float",
"]",
":",
"rews",
"=",
"rewards",
"+",
"[",
"last... | [
272,
4
] | [
289,
18
] | python | en | ['en', 'en', 'en'] | True |
PPOLightning.generate_trajectory_samples | (self) |
Contains the logic for generating trajectory data to train policy and value network
Yield:
Tuple of Lists containing tensors for states, actions, log probs, qvals and advantage
|
Contains the logic for generating trajectory data to train policy and value network
Yield:
Tuple of Lists containing tensors for states, actions, log probs, qvals and advantage
| def generate_trajectory_samples(self) -> Tuple[List[torch.Tensor], List[torch.Tensor], List[torch.Tensor]]:
"""
Contains the logic for generating trajectory data to train policy and value network
Yield:
Tuple of Lists containing tensors for states, actions, log probs, qvals and advant... | [
"def",
"generate_trajectory_samples",
"(",
"self",
")",
"->",
"Tuple",
"[",
"List",
"[",
"torch",
".",
"Tensor",
"]",
",",
"List",
"[",
"torch",
".",
"Tensor",
"]",
",",
"List",
"[",
"torch",
".",
"Tensor",
"]",
"]",
":",
"for",
"step",
"in",
"range"... | [
291,
4
] | [
373,
42
] | python | en | ['en', 'error', 'th'] | False |
PPOLightning.training_step | (self, batch: Tuple[torch.Tensor, torch.Tensor], batch_idx, optimizer_idx) |
Carries out a single update to actor and critic network from a batch of replay buffer.
Args:
batch: batch of replay buffer/trajectory data
batch_idx: not used
optimizer_idx: idx that controls optimizing actor or critic network
Returns:
loss
... |
Carries out a single update to actor and critic network from a batch of replay buffer. | def training_step(self, batch: Tuple[torch.Tensor, torch.Tensor], batch_idx, optimizer_idx):
"""
Carries out a single update to actor and critic network from a batch of replay buffer.
Args:
batch: batch of replay buffer/trajectory data
batch_idx: not used
opt... | [
"def",
"training_step",
"(",
"self",
",",
"batch",
":",
"Tuple",
"[",
"torch",
".",
"Tensor",
",",
"torch",
".",
"Tensor",
"]",
",",
"batch_idx",
",",
"optimizer_idx",
")",
":",
"state",
",",
"action",
",",
"old_logp",
",",
"qval",
",",
"adv",
"=",
"... | [
388,
4
] | [
419,
30
] | python | en | ['en', 'error', 'th'] | False |
PPOLightning.configure_optimizers | (self) | Initialize Adam optimizer | Initialize Adam optimizer | def configure_optimizers(self) -> List[Optimizer]:
""" Initialize Adam optimizer"""
optimizer_actor = torch.optim.Adam(self.actor.parameters(), lr=self.lr_actor)
optimizer_critic = torch.optim.Adam(self.critic.parameters(), lr=self.lr_critic)
return optimizer_actor, optimizer_critic | [
"def",
"configure_optimizers",
"(",
"self",
")",
"->",
"List",
"[",
"Optimizer",
"]",
":",
"optimizer_actor",
"=",
"torch",
".",
"optim",
".",
"Adam",
"(",
"self",
".",
"actor",
".",
"parameters",
"(",
")",
",",
"lr",
"=",
"self",
".",
"lr_actor",
")",... | [
421,
4
] | [
426,
48
] | python | de | ['de', 'la', 'it'] | False |
PPOLightning.optimizer_step | (self, *args, **kwargs) |
Run 'nb_optim_iters' number of iterations of gradient descent on actor and critic
for each data sample.
|
Run 'nb_optim_iters' number of iterations of gradient descent on actor and critic
for each data sample.
| def optimizer_step(self, *args, **kwargs):
"""
Run 'nb_optim_iters' number of iterations of gradient descent on actor and critic
for each data sample.
"""
for _ in range(self.nb_optim_iters):
super().optimizer_step(*args, **kwargs) | [
"def",
"optimizer_step",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"_",
"in",
"range",
"(",
"self",
".",
"nb_optim_iters",
")",
":",
"super",
"(",
")",
".",
"optimizer_step",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",... | [
428,
4
] | [
434,
51
] | python | en | ['en', 'error', 'th'] | False |
PPOLightning._dataloader | (self) | Initialize the Replay Buffer dataset used for retrieving experiences | Initialize the Replay Buffer dataset used for retrieving experiences | def _dataloader(self) -> DataLoader:
"""Initialize the Replay Buffer dataset used for retrieving experiences"""
dataset = ExperienceSourceDataset(self.generate_trajectory_samples)
dataloader = DataLoader(dataset=dataset, batch_size=self.batch_size)
return dataloader | [
"def",
"_dataloader",
"(",
"self",
")",
"->",
"DataLoader",
":",
"dataset",
"=",
"ExperienceSourceDataset",
"(",
"self",
".",
"generate_trajectory_samples",
")",
"dataloader",
"=",
"DataLoader",
"(",
"dataset",
"=",
"dataset",
",",
"batch_size",
"=",
"self",
"."... | [
436,
4
] | [
440,
25
] | python | en | ['en', 'en', 'en'] | True |
PPOLightning.train_dataloader | (self) | Get train loader | Get train loader | def train_dataloader(self) -> DataLoader:
"""Get train loader"""
return self._dataloader() | [
"def",
"train_dataloader",
"(",
"self",
")",
"->",
"DataLoader",
":",
"return",
"self",
".",
"_dataloader",
"(",
")"
] | [
442,
4
] | [
444,
33
] | python | en | ['en', 'da', 'en'] | True |
test_loggers_fit_test_all | (tmpdir, monkeypatch) | Verify that basic functionality of all loggers. | Verify that basic functionality of all loggers. | def test_loggers_fit_test_all(tmpdir, monkeypatch):
""" Verify that basic functionality of all loggers. """
_test_loggers_fit_test(tmpdir, TensorBoardLogger)
with mock.patch('pytorch_lightning.loggers.comet.comet_ml'), \
mock.patch('pytorch_lightning.loggers.comet.CometOfflineExperiment'):
... | [
"def",
"test_loggers_fit_test_all",
"(",
"tmpdir",
",",
"monkeypatch",
")",
":",
"_test_loggers_fit_test",
"(",
"tmpdir",
",",
"TensorBoardLogger",
")",
"with",
"mock",
".",
"patch",
"(",
"'pytorch_lightning.loggers.comet.comet_ml'",
")",
",",
"mock",
".",
"patch",
... | [
58,
0
] | [
81,
51
] | python | en | ['en', 'en', 'en'] | True |
test_loggers_save_dir_and_weights_save_path_all | (tmpdir, monkeypatch) | Test the combinations of save_dir, weights_save_path and default_root_dir. | Test the combinations of save_dir, weights_save_path and default_root_dir. | def test_loggers_save_dir_and_weights_save_path_all(tmpdir, monkeypatch):
""" Test the combinations of save_dir, weights_save_path and default_root_dir. """
_test_loggers_save_dir_and_weights_save_path(tmpdir, TensorBoardLogger)
with mock.patch('pytorch_lightning.loggers.comet.comet_ml'), \
mock.... | [
"def",
"test_loggers_save_dir_and_weights_save_path_all",
"(",
"tmpdir",
",",
"monkeypatch",
")",
":",
"_test_loggers_save_dir_and_weights_save_path",
"(",
"tmpdir",
",",
"TensorBoardLogger",
")",
"with",
"mock",
".",
"patch",
"(",
"'pytorch_lightning.loggers.comet.comet_ml'",
... | [
162,
0
] | [
180,
73
] | python | en | ['en', 'en', 'en'] | True |
test_loggers_pickle_all | (tmpdir, monkeypatch, logger_class) | Test that the logger objects can be pickled. This test only makes sense if the packages are installed. | Test that the logger objects can be pickled. This test only makes sense if the packages are installed. | def test_loggers_pickle_all(tmpdir, monkeypatch, logger_class):
""" Test that the logger objects can be pickled. This test only makes sense if the packages are installed. """
_patch_comet_atexit(monkeypatch)
try:
_test_loggers_pickle(tmpdir, monkeypatch, logger_class)
except (ImportError, Module... | [
"def",
"test_loggers_pickle_all",
"(",
"tmpdir",
",",
"monkeypatch",
",",
"logger_class",
")",
":",
"_patch_comet_atexit",
"(",
"monkeypatch",
")",
"try",
":",
"_test_loggers_pickle",
"(",
"tmpdir",
",",
"monkeypatch",
",",
"logger_class",
")",
"except",
"(",
"Imp... | [
243,
0
] | [
249,
100
] | python | en | ['en', 'en', 'en'] | True |
_test_loggers_pickle | (tmpdir, monkeypatch, logger_class) | Verify that pickling trainer with logger works. | Verify that pickling trainer with logger works. | def _test_loggers_pickle(tmpdir, monkeypatch, logger_class):
"""Verify that pickling trainer with logger works."""
_patch_comet_atexit(monkeypatch)
logger_args = _get_logger_args(logger_class, tmpdir)
logger = logger_class(**logger_args)
# this can cause pickle error if the experiment object is no... | [
"def",
"_test_loggers_pickle",
"(",
"tmpdir",
",",
"monkeypatch",
",",
"logger_class",
")",
":",
"_patch_comet_atexit",
"(",
"monkeypatch",
")",
"logger_args",
"=",
"_get_logger_args",
"(",
"logger_class",
",",
"tmpdir",
")",
"logger",
"=",
"logger_class",
"(",
"*... | [
252,
0
] | [
277,
54
] | python | en | ['en', 'en', 'en'] | True |
test_logger_reset_correctly | (tmpdir, extra_params) | Test that the tuners do not alter the logger reference | Test that the tuners do not alter the logger reference | def test_logger_reset_correctly(tmpdir, extra_params):
""" Test that the tuners do not alter the logger reference """
class CustomModel(BoringModel):
def __init__(self, lr=0.1, batch_size=1):
super().__init__()
self.save_hyperparameters()
tutils.reset_seed()
model = Cu... | [
"def",
"test_logger_reset_correctly",
"(",
"tmpdir",
",",
"extra_params",
")",
":",
"class",
"CustomModel",
"(",
"BoringModel",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"lr",
"=",
"0.1",
",",
"batch_size",
"=",
"1",
")",
":",
"super",
"(",
")",
"."... | [
286,
0
] | [
309,
44
] | python | en | ['en', 'en', 'en'] | True |
test_logger_created_on_rank_zero_only | (tmpdir, monkeypatch, logger_class) | Test that loggers get replaced by dummy loggers on global rank > 0 | Test that loggers get replaced by dummy loggers on global rank > 0 | def test_logger_created_on_rank_zero_only(tmpdir, monkeypatch, logger_class):
""" Test that loggers get replaced by dummy loggers on global rank > 0"""
_patch_comet_atexit(monkeypatch)
try:
_test_logger_created_on_rank_zero_only(tmpdir, logger_class)
except (ImportError, ModuleNotFoundError):
... | [
"def",
"test_logger_created_on_rank_zero_only",
"(",
"tmpdir",
",",
"monkeypatch",
",",
"logger_class",
")",
":",
"_patch_comet_atexit",
"(",
"monkeypatch",
")",
"try",
":",
"_test_logger_created_on_rank_zero_only",
"(",
"tmpdir",
",",
"logger_class",
")",
"except",
"("... | [
335,
0
] | [
341,
107
] | python | en | ['en', 'en', 'en'] | True |
test_logger_with_prefix_all | (tmpdir, monkeypatch) |
Test that prefix is added at the beginning of the metric keys.
|
Test that prefix is added at the beginning of the metric keys.
| def test_logger_with_prefix_all(tmpdir, monkeypatch):
"""
Test that prefix is added at the beginning of the metric keys.
"""
prefix = 'tmp'
# Comet
with mock.patch('pytorch_lightning.loggers.comet.comet_ml'), \
mock.patch('pytorch_lightning.loggers.comet.CometOfflineExperiment'):
... | [
"def",
"test_logger_with_prefix_all",
"(",
"tmpdir",
",",
"monkeypatch",
")",
":",
"prefix",
"=",
"'tmp'",
"# Comet",
"with",
"mock",
".",
"patch",
"(",
"'pytorch_lightning.loggers.comet.comet_ml'",
")",
",",
"mock",
".",
"patch",
"(",
"'pytorch_lightning.loggers.come... | [
361,
0
] | [
406,
80
] | python | en | ['en', 'error', 'th'] | False |
make_divisible | (value, divisor, min_value=None, min_ratio=0.9) | Make divisible function.
This function rounds the channel number down to the nearest value that can
be divisible by the divisor.
Args:
value (int): The original channel number.
divisor (int): The divisor to fully divide the channel number.
min_value (int, optional): The minimum val... | Make divisible function. | def make_divisible(value, divisor, min_value=None, min_ratio=0.9):
"""Make divisible function.
This function rounds the channel number down to the nearest value that can
be divisible by the divisor.
Args:
value (int): The original channel number.
divisor (int): The divisor to fully div... | [
"def",
"make_divisible",
"(",
"value",
",",
"divisor",
",",
"min_value",
"=",
"None",
",",
"min_ratio",
"=",
"0.9",
")",
":",
"if",
"min_value",
"is",
"None",
":",
"min_value",
"=",
"divisor",
"new_value",
"=",
"max",
"(",
"min_value",
",",
"int",
"(",
... | [
0,
0
] | [
23,
20
] | python | en | ['en', 'en', 'en'] | True |
roc | (
preds: torch.Tensor,
target: torch.Tensor,
num_classes: Optional[int] = None,
pos_label: Optional[int] = None,
sample_weights: Optional[Sequence] = None,
) |
Computes the Receiver Operating Characteristic (ROC).
Args:
preds: predictions from model (logits or probabilities)
target: ground truth values
num_classes: integer with number of classes. Not nessesary to provide
for binary problems.
pos_label: integer determining ... |
Computes the Receiver Operating Characteristic (ROC). | def roc(
preds: torch.Tensor,
target: torch.Tensor,
num_classes: Optional[int] = None,
pos_label: Optional[int] = None,
sample_weights: Optional[Sequence] = None,
) -> Union[Tuple[torch.Tensor, torch.Tensor, torch.Tensor], Tuple[List[torch.Tensor], List[torch.Tensor],
... | [
"def",
"roc",
"(",
"preds",
":",
"torch",
".",
"Tensor",
",",
"target",
":",
"torch",
".",
"Tensor",
",",
"num_classes",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"pos_label",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"sample_weig... | [
79,
0
] | [
146,
78
] | python | en | ['en', 'error', 'th'] | False |
DependencyInfo.deps_by_use_category | (self, use_category) | Find the set of external dependencies in a given use_category.
Args:
use_category: string providing use_category.
Returns:
Set of dependency identifiers that match use_category.
| Find the set of external dependencies in a given use_category. | def deps_by_use_category(self, use_category):
"""Find the set of external dependencies in a given use_category.
Args:
use_category: string providing use_category.
Returns:
Set of dependency identifiers that match use_category.
"""
return set(
name for name, metadata... | [
"def",
"deps_by_use_category",
"(",
"self",
",",
"use_category",
")",
":",
"return",
"set",
"(",
"name",
"for",
"name",
",",
"metadata",
"in",
"REPOSITORY_LOCATIONS_SPEC",
".",
"items",
"(",
")",
"if",
"use_category",
"in",
"metadata",
"[",
"'use_category'",
"... | [
75,
4
] | [
86,
56
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.