body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
6581742dcbbb916144c6dde05e69912a0330bda22917043ecd8e6a679bf5d75e | @property
def status(self):
'Return the process status as a constant\n\n - RUNNING\n - DEAD_OR_ZOMBIE\n - UNEXISTING\n - OTHER\n '
try:
if (self._worker.status in (STATUS_ZOMBIE, STATUS_DEAD)):
return DEAD_OR_ZOMBIE
except NoSuchProcess:
return ... | Return the process status as a constant
- RUNNING
- DEAD_OR_ZOMBIE
- UNEXISTING
- OTHER | circus/process.py | status | cdgz/circus | 0 | python | @property
def status(self):
'Return the process status as a constant\n\n - RUNNING\n - DEAD_OR_ZOMBIE\n - UNEXISTING\n - OTHER\n '
try:
if (self._worker.status in (STATUS_ZOMBIE, STATUS_DEAD)):
return DEAD_OR_ZOMBIE
except NoSuchProcess:
return ... | @property
def status(self):
'Return the process status as a constant\n\n - RUNNING\n - DEAD_OR_ZOMBIE\n - UNEXISTING\n - OTHER\n '
try:
if (self._worker.status in (STATUS_ZOMBIE, STATUS_DEAD)):
return DEAD_OR_ZOMBIE
except NoSuchProcess:
return ... |
52fd1c878a7e0503a0dd8e161e72751ceef7ec008a4142094120508e11d5b7ca | @property
def pid(self):
'Return the *pid*'
return self._worker.pid | Return the *pid* | circus/process.py | pid | cdgz/circus | 0 | python | @property
def pid(self):
return self._worker.pid | @property
def pid(self):
return self._worker.pid<|docstring|>Return the *pid*<|endoftext|> |
cf0703f3e3072761c1564c36378a432980ce456c84f17ada62c64f6ed0f70332 | @property
def stdout(self):
'Return the *stdout* stream'
return self._worker.stdout | Return the *stdout* stream | circus/process.py | stdout | cdgz/circus | 0 | python | @property
def stdout(self):
return self._worker.stdout | @property
def stdout(self):
return self._worker.stdout<|docstring|>Return the *stdout* stream<|endoftext|> |
90f45cda9cce848493ef34bd329cf854a4ddc7b2e8bae5a6e8d7d516a0124b53 | @property
def stderr(self):
'Return the *stdout* stream'
return self._worker.stderr | Return the *stdout* stream | circus/process.py | stderr | cdgz/circus | 0 | python | @property
def stderr(self):
return self._worker.stderr | @property
def stderr(self):
return self._worker.stderr<|docstring|>Return the *stdout* stream<|endoftext|> |
b0a7a39fd453ae078c57291ddd1ee42cc3b173bd8b327f0ba94360340f839ce8 | def call_func_in_py(func):
" Call a function and capture it's stdout.\n "
loop.integrate(reset=True)
orig_stdout = sys.stdout
orig_stderr = sys.stderr
fake_stdout = FakeStream()
sys.stdout = sys.stderr = fake_stdout
try:
func()
finally:
sys.stdout = orig_stdout
... | Call a function and capture it's stdout. | flexx/event/both_tester.py | call_func_in_py | levinbgu/flexx | 1,662 | python | def call_func_in_py(func):
" \n "
loop.integrate(reset=True)
orig_stdout = sys.stdout
orig_stderr = sys.stderr
fake_stdout = FakeStream()
sys.stdout = sys.stderr = fake_stdout
try:
func()
finally:
sys.stdout = orig_stdout
sys.stderr = orig_stderr
loop.reset... | def call_func_in_py(func):
" \n "
loop.integrate(reset=True)
orig_stdout = sys.stdout
orig_stderr = sys.stderr
fake_stdout = FakeStream()
sys.stdout = sys.stderr = fake_stdout
try:
func()
finally:
sys.stdout = orig_stdout
sys.stderr = orig_stderr
loop.reset... |
c5016f1666d59f6745dcad94440a35097d328fb4c7fd9f8b4d7787d6f930add8 | def smart_compare(func, *comparations):
' Compare multiple text-pairs, raising an error that shows where\n the texts differ for each of the mismatching pairs.\n Each comparison should be (name, text, reference).\n '
err_msgs = []
has_errors = False
for comp in comparations:
err_msg = va... | Compare multiple text-pairs, raising an error that shows where
the texts differ for each of the mismatching pairs.
Each comparison should be (name, text, reference). | flexx/event/both_tester.py | smart_compare | levinbgu/flexx | 1,662 | python | def smart_compare(func, *comparations):
' Compare multiple text-pairs, raising an error that shows where\n the texts differ for each of the mismatching pairs.\n Each comparison should be (name, text, reference).\n '
err_msgs = []
has_errors = False
for comp in comparations:
err_msg = va... | def smart_compare(func, *comparations):
' Compare multiple text-pairs, raising an error that shows where\n the texts differ for each of the mismatching pairs.\n Each comparison should be (name, text, reference).\n '
err_msgs = []
has_errors = False
for comp in comparations:
err_msg = va... |
55bd8498257bf4e14b77511e10dc3b324817a4557abf848868293c2c61bfb2f6 | def validate_text(name, text, reference):
' Compare text with a reference. Returns None if they match, and otherwise\n an error message that outlines where they differ.\n '
lines1 = text.split('\n')
lines2 = reference.split('\n')
n = max(len(lines1), len(lines2))
for i in range(len(lines1)):
... | Compare text with a reference. Returns None if they match, and otherwise
an error message that outlines where they differ. | flexx/event/both_tester.py | validate_text | levinbgu/flexx | 1,662 | python | def validate_text(name, text, reference):
' Compare text with a reference. Returns None if they match, and otherwise\n an error message that outlines where they differ.\n '
lines1 = text.split('\n')
lines2 = reference.split('\n')
n = max(len(lines1), len(lines2))
for i in range(len(lines1)):
... | def validate_text(name, text, reference):
' Compare text with a reference. Returns None if they match, and otherwise\n an error message that outlines where they differ.\n '
lines1 = text.split('\n')
lines2 = reference.split('\n')
n = max(len(lines1), len(lines2))
for i in range(len(lines1)):
... |
be5bca171bb60d0904c17697fe908e370607f482cfc3ce40a5b0254e3355316a | def run_in_both(*classes, js=True, py=True, extra_nodejs_args=None):
' Decorator to run a test in both Python and JS.\n\n The decorator should be provided with any Component classes that\n you want to use in the test.\n\n The function docstring should match the stdout + stderr of the test (case\n insens... | Decorator to run a test in both Python and JS.
The decorator should be provided with any Component classes that
you want to use in the test.
The function docstring should match the stdout + stderr of the test (case
insensitive). To provide separate reference outputs for Python and
JavaScript, use a delimiter of at le... | flexx/event/both_tester.py | run_in_both | levinbgu/flexx | 1,662 | python | def run_in_both(*classes, js=True, py=True, extra_nodejs_args=None):
' Decorator to run a test in both Python and JS.\n\n The decorator should be provided with any Component classes that\n you want to use in the test.\n\n The function docstring should match the stdout + stderr of the test (case\n insens... | def run_in_both(*classes, js=True, py=True, extra_nodejs_args=None):
' Decorator to run a test in both Python and JS.\n\n The decorator should be provided with any Component classes that\n you want to use in the test.\n\n The function docstring should match the stdout + stderr of the test (case\n insens... |
a3667fed7683e587749b9600697111e77041e817545344b7ee0b6010d1f2fb3a | @staticmethod
def parse_feed(url, entries=0):
'\n Parses the given url, returns a list containing all available entries\n '
if (1 <= entries <= 10):
feed = feedparser.parse(url)
return feed.entries[:entries]
else:
feed = feedparser.parse(url)
if feed.entries:
... | Parses the given url, returns a list containing all available entries | rss/feedhandler.py | parse_feed | balemessenger/rss_reader_bot | 0 | python | @staticmethod
def parse_feed(url, entries=0):
'\n \n '
if (1 <= entries <= 10):
feed = feedparser.parse(url)
return feed.entries[:entries]
else:
feed = feedparser.parse(url)
if feed.entries:
return feed.entries[:BotConfig.rss_count]
return No... | @staticmethod
def parse_feed(url, entries=0):
'\n \n '
if (1 <= entries <= 10):
feed = feedparser.parse(url)
return feed.entries[:entries]
else:
feed = feedparser.parse(url)
if feed.entries:
return feed.entries[:BotConfig.rss_count]
return No... |
5642481389c7e44f9cb72fb091f820ac8e50cc127fca37d68d69b22f73c4b7be | @staticmethod
def is_parsable(url):
'\n Checks wether the given url provides a news feed. Return True if news are available, else False\n '
url_pattern = re.compile('((http(s?))):\\/\\/.*')
if (not url_pattern.match(url)):
return False
feed = feedparser.parse(url)
if (not feed.... | Checks wether the given url provides a news feed. Return True if news are available, else False | rss/feedhandler.py | is_parsable | balemessenger/rss_reader_bot | 0 | python | @staticmethod
def is_parsable(url):
'\n \n '
url_pattern = re.compile('((http(s?))):\\/\\/.*')
if (not url_pattern.match(url)):
return False
feed = feedparser.parse(url)
if (not feed.entries):
return False
for post in feed.entries:
if (not hasattr(post, 'upd... | @staticmethod
def is_parsable(url):
'\n \n '
url_pattern = re.compile('((http(s?))):\\/\\/.*')
if (not url_pattern.match(url)):
return False
feed = feedparser.parse(url)
if (not feed.entries):
return False
for post in feed.entries:
if (not hasattr(post, 'upd... |
1722feb46860091049120d4fff705d2ab6f4c552cf7a3a23f60180800e17fcef | @staticmethod
def format_url_string(string):
'\n Formats a given url as string so it matches http(s)://adress.domain.\n This should be called before parsing the url, to make sure it is parsable\n '
string = string.lower()
url_pattern = re.compile('((http(s?))):\\/\\/.*')
if (not url... | Formats a given url as string so it matches http(s)://adress.domain.
This should be called before parsing the url, to make sure it is parsable | rss/feedhandler.py | format_url_string | balemessenger/rss_reader_bot | 0 | python | @staticmethod
def format_url_string(string):
'\n Formats a given url as string so it matches http(s)://adress.domain.\n This should be called before parsing the url, to make sure it is parsable\n '
string = string.lower()
url_pattern = re.compile('((http(s?))):\\/\\/.*')
if (not url... | @staticmethod
def format_url_string(string):
'\n Formats a given url as string so it matches http(s)://adress.domain.\n This should be called before parsing the url, to make sure it is parsable\n '
string = string.lower()
url_pattern = re.compile('((http(s?))):\\/\\/.*')
if (not url... |
78628f54f62c2d150794e48834f0e7a53421a3009d541648e9b37c13a8dfa735 | def __init__(self, channel: int, logging: bool=True):
'\n :param channel: The ID of the channel.\n :param logging: If True, log messages.\n '
self.channel: int = int(channel)
self.mishnah = loads(Path(resource_filename(__name__, 'data/mishnah.json')).read_text())
self.logging: bool ... | :param channel: The ID of the channel.
:param logging: If True, log messages. | mishnabot/bot.py | __init__ | subalterngames/mishnahbot | 0 | python | def __init__(self, channel: int, logging: bool=True):
'\n :param channel: The ID of the channel.\n :param logging: If True, log messages.\n '
self.channel: int = int(channel)
self.mishnah = loads(Path(resource_filename(__name__, 'data/mishnah.json')).read_text())
self.logging: bool ... | def __init__(self, channel: int, logging: bool=True):
'\n :param channel: The ID of the channel.\n :param logging: If True, log messages.\n '
self.channel: int = int(channel)
self.mishnah = loads(Path(resource_filename(__name__, 'data/mishnah.json')).read_text())
self.logging: bool ... |
1e6545b76ae6ce4877b231c16131cd651acf9034cd897fdfdce8e5e88add43c9 | def log(self, message: str) -> None:
'\n Log a message.\n\n :param message: The message.\n '
if self.logging:
with Path(getcwd()).joinpath('log.txt').open('at') as f:
f.write((message + '\n')) | Log a message.
:param message: The message. | mishnabot/bot.py | log | subalterngames/mishnahbot | 0 | python | def log(self, message: str) -> None:
'\n Log a message.\n\n :param message: The message.\n '
if self.logging:
with Path(getcwd()).joinpath('log.txt').open('at') as f:
f.write((message + '\n')) | def log(self, message: str) -> None:
'\n Log a message.\n\n :param message: The message.\n '
if self.logging:
with Path(getcwd()).joinpath('log.txt').open('at') as f:
f.write((message + '\n'))<|docstring|>Log a message.
:param message: The message.<|endoftext|> |
36df627d5c64eca549a73549bfa53e7650d0b14a72aa8310c24e6736557d2688 | def nlist(length):
'\n creates a list (length) long of empty lists.\n This is probably redundant with a built-in python/numpy/scipy function,\n so consider replacing in future.\n Input:\n :param length: number of empty lists in list\n Returns:\n a list of [] x length\n\n '
return... | creates a list (length) long of empty lists.
This is probably redundant with a built-in python/numpy/scipy function,
so consider replacing in future.
Input:
:param length: number of empty lists in list
Returns:
a list of [] x length | history/nmrmath_old.py | nlist | sametz/nmrtools | 0 | python | def nlist(length):
'\n creates a list (length) long of empty lists.\n This is probably redundant with a built-in python/numpy/scipy function,\n so consider replacing in future.\n Input:\n :param length: number of empty lists in list\n Returns:\n a list of [] x length\n\n '
return... | def nlist(length):
'\n creates a list (length) long of empty lists.\n This is probably redundant with a built-in python/numpy/scipy function,\n so consider replacing in future.\n Input:\n :param length: number of empty lists in list\n Returns:\n a list of [] x length\n\n '
return... |
619168d69c44d18cd43e2d3d34181f2890ce7ef60877b59e257c7d7afd46e5d2 | def popcount(n=0):
'\n Computes the popcount (binary Hamming weight) of integer n\n input:\n :param n: an integer\n returns:\n popcount of integer (binary Hamming weight)\n\n '
return bin(n).count('1') | Computes the popcount (binary Hamming weight) of integer n
input:
:param n: an integer
returns:
popcount of integer (binary Hamming weight) | history/nmrmath_old.py | popcount | sametz/nmrtools | 0 | python | def popcount(n=0):
'\n Computes the popcount (binary Hamming weight) of integer n\n input:\n :param n: an integer\n returns:\n popcount of integer (binary Hamming weight)\n\n '
return bin(n).count('1') | def popcount(n=0):
'\n Computes the popcount (binary Hamming weight) of integer n\n input:\n :param n: an integer\n returns:\n popcount of integer (binary Hamming weight)\n\n '
return bin(n).count('1')<|docstring|>Computes the popcount (binary Hamming weight) of integer n
input:
:p... |
9746249c0d8d93e0c33419c1e3bddda7e45a88585449d3fe6b2d994679eff099 | def is_allowed(m=0, n=0):
'\n determines if a transition between two spin states is allowed or forbidden.\n The transition is allowed if one and only one spin (i.e. bit) changes\n input: integers whose binary codes for a spin state\n :param n:\n :param m:\n output: 1 = allowed, 0 = forbidd... | determines if a transition between two spin states is allowed or forbidden.
The transition is allowed if one and only one spin (i.e. bit) changes
input: integers whose binary codes for a spin state
:param n:
:param m:
output: 1 = allowed, 0 = forbidden | history/nmrmath_old.py | is_allowed | sametz/nmrtools | 0 | python | def is_allowed(m=0, n=0):
'\n determines if a transition between two spin states is allowed or forbidden.\n The transition is allowed if one and only one spin (i.e. bit) changes\n input: integers whose binary codes for a spin state\n :param n:\n :param m:\n output: 1 = allowed, 0 = forbidd... | def is_allowed(m=0, n=0):
'\n determines if a transition between two spin states is allowed or forbidden.\n The transition is allowed if one and only one spin (i.e. bit) changes\n input: integers whose binary codes for a spin state\n :param n:\n :param m:\n output: 1 = allowed, 0 = forbidd... |
ce0bebd128ae58b4c31a40d2405ef5204474e63767db9b14560439b50c572798 | def transition_matrix(n):
'\n Creates a matrix of allowed transitions.\n The integers 0-n, in their binary form, code for a spin state (alpha/beta).\n The (i,j) cells in the matrix indicate whether a transition from spin state\n i to spin state j is allowed or forbidden.\n See the is_allowed function... | Creates a matrix of allowed transitions.
The integers 0-n, in their binary form, code for a spin state (alpha/beta).
The (i,j) cells in the matrix indicate whether a transition from spin state
i to spin state j is allowed or forbidden.
See the is_allowed function for more information.
input:
:param n: size of the ... | history/nmrmath_old.py | transition_matrix | sametz/nmrtools | 0 | python | def transition_matrix(n):
'\n Creates a matrix of allowed transitions.\n The integers 0-n, in their binary form, code for a spin state (alpha/beta).\n The (i,j) cells in the matrix indicate whether a transition from spin state\n i to spin state j is allowed or forbidden.\n See the is_allowed function... | def transition_matrix(n):
'\n Creates a matrix of allowed transitions.\n The integers 0-n, in their binary form, code for a spin state (alpha/beta).\n The (i,j) cells in the matrix indicate whether a transition from spin state\n i to spin state j is allowed or forbidden.\n See the is_allowed function... |
34e1a4c148cfc7679ff4d9f3b059fab6a323e140debde02cfcc64cadffb21def | def hamiltonian(freqlist, couplings):
'\n Computes the spin Hamiltonian for spin-1/2 nuclei.\n inputs for n nuclei:\n :param freqlist: a list of frequencies in Hz of length n\n :param couplings: a sparse n x n matrix of coupling constants in Hz\n Returns: a sparse Hamiltonian matrix\n '
... | Computes the spin Hamiltonian for spin-1/2 nuclei.
inputs for n nuclei:
:param freqlist: a list of frequencies in Hz of length n
:param couplings: a sparse n x n matrix of coupling constants in Hz
Returns: a sparse Hamiltonian matrix | history/nmrmath_old.py | hamiltonian | sametz/nmrtools | 0 | python | def hamiltonian(freqlist, couplings):
'\n Computes the spin Hamiltonian for spin-1/2 nuclei.\n inputs for n nuclei:\n :param freqlist: a list of frequencies in Hz of length n\n :param couplings: a sparse n x n matrix of coupling constants in Hz\n Returns: a sparse Hamiltonian matrix\n '
... | def hamiltonian(freqlist, couplings):
'\n Computes the spin Hamiltonian for spin-1/2 nuclei.\n inputs for n nuclei:\n :param freqlist: a list of frequencies in Hz of length n\n :param couplings: a sparse n x n matrix of coupling constants in Hz\n Returns: a sparse Hamiltonian matrix\n '
... |
0ded2f552e4dcf2d4e5d8f7db5fd84f41b3b7f7e54a177646ebd5bfacd50bad8 | def simsignals(H, nspins):
'\n Solves the spin Hamiltonian H and returns a list of (frequency, intensity)\n tuples. Nuclei must be spin-1/2.\n Inputs:\n :param H: a sparse spin Hamiltonian\n :param nspins: number of nuclei\n Returns:\n peaklist: a list of (frequency, intensity) tupl... | Solves the spin Hamiltonian H and returns a list of (frequency, intensity)
tuples. Nuclei must be spin-1/2.
Inputs:
:param H: a sparse spin Hamiltonian
:param nspins: number of nuclei
Returns:
peaklist: a list of (frequency, intensity) tuples. | history/nmrmath_old.py | simsignals | sametz/nmrtools | 0 | python | def simsignals(H, nspins):
'\n Solves the spin Hamiltonian H and returns a list of (frequency, intensity)\n tuples. Nuclei must be spin-1/2.\n Inputs:\n :param H: a sparse spin Hamiltonian\n :param nspins: number of nuclei\n Returns:\n peaklist: a list of (frequency, intensity) tupl... | def simsignals(H, nspins):
'\n Solves the spin Hamiltonian H and returns a list of (frequency, intensity)\n tuples. Nuclei must be spin-1/2.\n Inputs:\n :param H: a sparse spin Hamiltonian\n :param nspins: number of nuclei\n Returns:\n peaklist: a list of (frequency, intensity) tupl... |
0c1c1715538fb657cf1f23623f54de333a373dc281f0730307cef74977f0f32a | def nspinspec(freqs, couplings):
'\n Function that calculates a spectrum for n spin-half nuclei.\n Inputs:\n :param freqs: a list of n nuclei frequencies in Hz\n :param couplings: an n x n sparse matrix of couplings in Hz. The order\n of nuclei in the list corresponds to the column and ro... | Function that calculates a spectrum for n spin-half nuclei.
Inputs:
:param freqs: a list of n nuclei frequencies in Hz
:param couplings: an n x n sparse matrix of couplings in Hz. The order
of nuclei in the list corresponds to the column and row order in the
matrix, e.g. couplings[0][1] and [1]0] are th... | history/nmrmath_old.py | nspinspec | sametz/nmrtools | 0 | python | def nspinspec(freqs, couplings):
'\n Function that calculates a spectrum for n spin-half nuclei.\n Inputs:\n :param freqs: a list of n nuclei frequencies in Hz\n :param couplings: an n x n sparse matrix of couplings in Hz. The order\n of nuclei in the list corresponds to the column and ro... | def nspinspec(freqs, couplings):
'\n Function that calculates a spectrum for n spin-half nuclei.\n Inputs:\n :param freqs: a list of n nuclei frequencies in Hz\n :param couplings: an n x n sparse matrix of couplings in Hz. The order\n of nuclei in the list corresponds to the column and ro... |
04571937f750900666457f110b8dec504ecda0be752ce898f334ccf6a4258a76 | def __init__(self, x=None, y=None):
'\n Initializes a 2D point object with x and y coordinates.\n '
if (x is None):
x = randint(0, 50)
if (y is None):
y = randint(0, 50)
self.x = x
self.y = y | Initializes a 2D point object with x and y coordinates. | Helper/point_cloud.py | __init__ | Baumwollboebele/python_algorithms | 0 | python | def __init__(self, x=None, y=None):
'\n \n '
if (x is None):
x = randint(0, 50)
if (y is None):
y = randint(0, 50)
self.x = x
self.y = y | def __init__(self, x=None, y=None):
'\n \n '
if (x is None):
x = randint(0, 50)
if (y is None):
y = randint(0, 50)
self.x = x
self.y = y<|docstring|>Initializes a 2D point object with x and y coordinates.<|endoftext|> |
fdcc3a124c13c5a615c0a3d65f2765ddbd3d8d29054b6f4e1a63344336712ced | def __init__(self, x=None, y=None, z=None):
'\n Initializes a 3D point object wit x,y and z coordinates.\n\n Args:\n x (integer, optional): X coordinate. Defaults to randint(0, 50).\n y (integer, optional): Y coordinate. Defaults to randint(0, 50).\n z (integer, option... | Initializes a 3D point object wit x,y and z coordinates.
Args:
x (integer, optional): X coordinate. Defaults to randint(0, 50).
y (integer, optional): Y coordinate. Defaults to randint(0, 50).
z (integer, optional):Z. Defaults to randint(0, 50). | Helper/point_cloud.py | __init__ | Baumwollboebele/python_algorithms | 0 | python | def __init__(self, x=None, y=None, z=None):
'\n Initializes a 3D point object wit x,y and z coordinates.\n\n Args:\n x (integer, optional): X coordinate. Defaults to randint(0, 50).\n y (integer, optional): Y coordinate. Defaults to randint(0, 50).\n z (integer, option... | def __init__(self, x=None, y=None, z=None):
'\n Initializes a 3D point object wit x,y and z coordinates.\n\n Args:\n x (integer, optional): X coordinate. Defaults to randint(0, 50).\n y (integer, optional): Y coordinate. Defaults to randint(0, 50).\n z (integer, option... |
3a315d72401d7644107f9d3057d48cfb8f7b70f1fe56c0bbd489519018a84086 | def get_x_values(self):
'\n Returns x values of all points.\n\n Returns:\n list: x-axis values\n '
values = []
for point in self.point_cloud:
values.append(point.x)
return values | Returns x values of all points.
Returns:
list: x-axis values | Helper/point_cloud.py | get_x_values | Baumwollboebele/python_algorithms | 0 | python | def get_x_values(self):
'\n Returns x values of all points.\n\n Returns:\n list: x-axis values\n '
values = []
for point in self.point_cloud:
values.append(point.x)
return values | def get_x_values(self):
'\n Returns x values of all points.\n\n Returns:\n list: x-axis values\n '
values = []
for point in self.point_cloud:
values.append(point.x)
return values<|docstring|>Returns x values of all points.
Returns:
list: x-axis values<|endoft... |
31f5839ef34a20c3897f4019c9250c2177e8025baa7b782bf77ae12889344af7 | def get_y_values(self):
'\n Returns y values of all points.\n\n Returns:\n list: y-axis values\n '
values = []
for point in self.point_cloud:
values.append(point.y)
return values | Returns y values of all points.
Returns:
list: y-axis values | Helper/point_cloud.py | get_y_values | Baumwollboebele/python_algorithms | 0 | python | def get_y_values(self):
'\n Returns y values of all points.\n\n Returns:\n list: y-axis values\n '
values = []
for point in self.point_cloud:
values.append(point.y)
return values | def get_y_values(self):
'\n Returns y values of all points.\n\n Returns:\n list: y-axis values\n '
values = []
for point in self.point_cloud:
values.append(point.y)
return values<|docstring|>Returns y values of all points.
Returns:
list: y-axis values<|endoft... |
4cc8c82310957aa5495490594596489332419d9bd96aa43393fe7e13084cbb31 | def __init__(self, size):
'\n Initializes a random Point cloud within a 2D coordinate system.\n\n Args:\n size (integer): number of points\n '
super().__init__(size)
for _ in range(size):
self.point_cloud.append(_Point2D()) | Initializes a random Point cloud within a 2D coordinate system.
Args:
size (integer): number of points | Helper/point_cloud.py | __init__ | Baumwollboebele/python_algorithms | 0 | python | def __init__(self, size):
'\n Initializes a random Point cloud within a 2D coordinate system.\n\n Args:\n size (integer): number of points\n '
super().__init__(size)
for _ in range(size):
self.point_cloud.append(_Point2D()) | def __init__(self, size):
'\n Initializes a random Point cloud within a 2D coordinate system.\n\n Args:\n size (integer): number of points\n '
super().__init__(size)
for _ in range(size):
self.point_cloud.append(_Point2D())<|docstring|>Initializes a random Point cloud within a 2D coo... |
485c6b1e492208359aef140e4c023f69e36ef39a9bd8f6ed8955f8f5c73221d3 | def rotate(self, rotation):
'\n Rotation of the point cloud around the z axis\n with the angle [rotation].\n\n Args:\n rotation (integer | float): angle of rotation\n '
rotation = radians(rotation)
for point in self.point_cloud:
x = point.x
y = point.y
... | Rotation of the point cloud around the z axis
with the angle [rotation].
Args:
rotation (integer | float): angle of rotation | Helper/point_cloud.py | rotate | Baumwollboebele/python_algorithms | 0 | python | def rotate(self, rotation):
'\n Rotation of the point cloud around the z axis\n with the angle [rotation].\n\n Args:\n rotation (integer | float): angle of rotation\n '
rotation = radians(rotation)
for point in self.point_cloud:
x = point.x
y = point.y
... | def rotate(self, rotation):
'\n Rotation of the point cloud around the z axis\n with the angle [rotation].\n\n Args:\n rotation (integer | float): angle of rotation\n '
rotation = radians(rotation)
for point in self.point_cloud:
x = point.x
y = point.y
... |
7bbba5ff1f86f83d8fe768b3f190d0fe62dc8d18db7fe868dfcdd8551f78f90e | def translate(self, x, y):
'\n Translate the coordinates of the point cloud by x and y.\n\n Args:\n x (integer | float): translation by x\n y (integer | float ): translation by y\n '
for point in self.point_cloud:
point.x += x
point.y += y
return | Translate the coordinates of the point cloud by x and y.
Args:
x (integer | float): translation by x
y (integer | float ): translation by y | Helper/point_cloud.py | translate | Baumwollboebele/python_algorithms | 0 | python | def translate(self, x, y):
'\n Translate the coordinates of the point cloud by x and y.\n\n Args:\n x (integer | float): translation by x\n y (integer | float ): translation by y\n '
for point in self.point_cloud:
point.x += x
point.y += y
return | def translate(self, x, y):
'\n Translate the coordinates of the point cloud by x and y.\n\n Args:\n x (integer | float): translation by x\n y (integer | float ): translation by y\n '
for point in self.point_cloud:
point.x += x
point.y += y
return<|d... |
d1e0f1b503c23e8e339dbfd7cff7ee1b81d6d574149964391219940797a94bc2 | def random_rotation(self):
'\n Applies a random rotation to the point cloud.\n '
self.rotate(randint(0, 360))
return | Applies a random rotation to the point cloud. | Helper/point_cloud.py | random_rotation | Baumwollboebele/python_algorithms | 0 | python | def random_rotation(self):
'\n \n '
self.rotate(randint(0, 360))
return | def random_rotation(self):
'\n \n '
self.rotate(randint(0, 360))
return<|docstring|>Applies a random rotation to the point cloud.<|endoftext|> |
01de7eaeaa30e6a0aba8257d2e1cde5042d027cb85661757cfeaefbe4d21ebcc | def random_translation(self):
'\n Applies a random translation to the point cloud.\n '
self.translate(randint(0, 5), randint(0, 5))
return | Applies a random translation to the point cloud. | Helper/point_cloud.py | random_translation | Baumwollboebele/python_algorithms | 0 | python | def random_translation(self):
'\n \n '
self.translate(randint(0, 5), randint(0, 5))
return | def random_translation(self):
'\n \n '
self.translate(randint(0, 5), randint(0, 5))
return<|docstring|>Applies a random translation to the point cloud.<|endoftext|> |
0ee30d48ed409bee71723a2bad321c8e25b37ae41e8be1ecd814aa801c82c439 | def randomize(self):
'\n Applize random translation and rotation to the point cloud.\n '
self.random_translation()
self.random_rotation()
return | Applize random translation and rotation to the point cloud. | Helper/point_cloud.py | randomize | Baumwollboebele/python_algorithms | 0 | python | def randomize(self):
'\n \n '
self.random_translation()
self.random_rotation()
return | def randomize(self):
'\n \n '
self.random_translation()
self.random_rotation()
return<|docstring|>Applize random translation and rotation to the point cloud.<|endoftext|> |
fdc283f1c1e3b0d6937e7f997fa46e3cdb8b1bf6445eeb2d1803a71a8bfa0503 | def __init__(self, size):
'\n Initializes a random Point cloud within a 3D coordinate system.\n\n Args:\n size (integer): number of points\n '
super().__init__(size)
for _ in range(size):
self.point_cloud.append(_Point3D()) | Initializes a random Point cloud within a 3D coordinate system.
Args:
size (integer): number of points | Helper/point_cloud.py | __init__ | Baumwollboebele/python_algorithms | 0 | python | def __init__(self, size):
'\n Initializes a random Point cloud within a 3D coordinate system.\n\n Args:\n size (integer): number of points\n '
super().__init__(size)
for _ in range(size):
self.point_cloud.append(_Point3D()) | def __init__(self, size):
'\n Initializes a random Point cloud within a 3D coordinate system.\n\n Args:\n size (integer): number of points\n '
super().__init__(size)
for _ in range(size):
self.point_cloud.append(_Point3D())<|docstring|>Initializes a random Point cloud... |
93793a92cf49d5467f9f5670d0c24a3093a1c9cda968a2eeeeaffe9a8e6ff39f | def get_z_values(self):
'\n Returns z values of all points.\n\n Returns:\n list: z-axis values\n '
values = []
for point in self.point_cloud:
values.append(point.z)
return values | Returns z values of all points.
Returns:
list: z-axis values | Helper/point_cloud.py | get_z_values | Baumwollboebele/python_algorithms | 0 | python | def get_z_values(self):
'\n Returns z values of all points.\n\n Returns:\n list: z-axis values\n '
values = []
for point in self.point_cloud:
values.append(point.z)
return values | def get_z_values(self):
'\n Returns z values of all points.\n\n Returns:\n list: z-axis values\n '
values = []
for point in self.point_cloud:
values.append(point.z)
return values<|docstring|>Returns z values of all points.
Returns:
list: z-axis values<|endoft... |
27dbce03a9e884a96fe1de6dc9c655154292f4ef659cc417f04cdc7129cfd210 | def rotate_x_axis(self, rotation):
'\n Rotation of the Point Cloud around the X-Axis.\n\n Args:\n rotation (integer): angle of rotation\n '
rotation = radians(rotation)
for point in self.point_cloud:
point.y = round(((point.y * cos(rotation)) - (point.z * sin(rotation... | Rotation of the Point Cloud around the X-Axis.
Args:
rotation (integer): angle of rotation | Helper/point_cloud.py | rotate_x_axis | Baumwollboebele/python_algorithms | 0 | python | def rotate_x_axis(self, rotation):
'\n Rotation of the Point Cloud around the X-Axis.\n\n Args:\n rotation (integer): angle of rotation\n '
rotation = radians(rotation)
for point in self.point_cloud:
point.y = round(((point.y * cos(rotation)) - (point.z * sin(rotation... | def rotate_x_axis(self, rotation):
'\n Rotation of the Point Cloud around the X-Axis.\n\n Args:\n rotation (integer): angle of rotation\n '
rotation = radians(rotation)
for point in self.point_cloud:
point.y = round(((point.y * cos(rotation)) - (point.z * sin(rotation... |
dd55218fd5fa942a2d3d4ca2c0aae4ecd6dd2f6004c074ca4d537c839a4c09be | def rotate_y_axis(self, rotation):
'\n Rotation of the Point Cloud around the Y-Axis\n\n Args:\n rotation (integer): angle of rotation\n '
rotation = radians(rotation)
for point in self.point_cloud:
point.x = round(((point.x * cos(rotation)) + (point.z * sin(rotation)... | Rotation of the Point Cloud around the Y-Axis
Args:
rotation (integer): angle of rotation | Helper/point_cloud.py | rotate_y_axis | Baumwollboebele/python_algorithms | 0 | python | def rotate_y_axis(self, rotation):
'\n Rotation of the Point Cloud around the Y-Axis\n\n Args:\n rotation (integer): angle of rotation\n '
rotation = radians(rotation)
for point in self.point_cloud:
point.x = round(((point.x * cos(rotation)) + (point.z * sin(rotation)... | def rotate_y_axis(self, rotation):
'\n Rotation of the Point Cloud around the Y-Axis\n\n Args:\n rotation (integer): angle of rotation\n '
rotation = radians(rotation)
for point in self.point_cloud:
point.x = round(((point.x * cos(rotation)) + (point.z * sin(rotation)... |
2ef7abccf405e92811747b92a6ecb5171290c7fe63ba2c444651b202e06a3b5a | def translate(self, x, y, z):
'\n Translate the coordinates of the point cloud by x and y.\n\n Args:\n x (integer | float): translation by x\n y (integer | float): translation by y\n z (integer | float): translation by z\n '
for point in self.point_cloud:
... | Translate the coordinates of the point cloud by x and y.
Args:
x (integer | float): translation by x
y (integer | float): translation by y
z (integer | float): translation by z | Helper/point_cloud.py | translate | Baumwollboebele/python_algorithms | 0 | python | def translate(self, x, y, z):
'\n Translate the coordinates of the point cloud by x and y.\n\n Args:\n x (integer | float): translation by x\n y (integer | float): translation by y\n z (integer | float): translation by z\n '
for point in self.point_cloud:
... | def translate(self, x, y, z):
'\n Translate the coordinates of the point cloud by x and y.\n\n Args:\n x (integer | float): translation by x\n y (integer | float): translation by y\n z (integer | float): translation by z\n '
for point in self.point_cloud:
... |
86cc72476ede10071746620b26e05a62c71327f7ab5c92899780e75a1e509ef7 | def random_rotation(self):
'\n Applies a random rotation to the point cloud.\n '
self.rotate_x_axis(randint(0, 360))
self.rotate_y_axis(randint(0, 360))
self.rotate_z_axis(randint(0, 360))
return | Applies a random rotation to the point cloud. | Helper/point_cloud.py | random_rotation | Baumwollboebele/python_algorithms | 0 | python | def random_rotation(self):
'\n \n '
self.rotate_x_axis(randint(0, 360))
self.rotate_y_axis(randint(0, 360))
self.rotate_z_axis(randint(0, 360))
return | def random_rotation(self):
'\n \n '
self.rotate_x_axis(randint(0, 360))
self.rotate_y_axis(randint(0, 360))
self.rotate_z_axis(randint(0, 360))
return<|docstring|>Applies a random rotation to the point cloud.<|endoftext|> |
43e1350dbe1d8d3ce9a1a61bb760d9ef64574194f81bb07b485c0262a944762e | def random_translation(self):
'\n Applies a random translation to the point cloud.\n '
self.translate(randint(0, 5), randint(0, 5), randint(0, 5))
return | Applies a random translation to the point cloud. | Helper/point_cloud.py | random_translation | Baumwollboebele/python_algorithms | 0 | python | def random_translation(self):
'\n \n '
self.translate(randint(0, 5), randint(0, 5), randint(0, 5))
return | def random_translation(self):
'\n \n '
self.translate(randint(0, 5), randint(0, 5), randint(0, 5))
return<|docstring|>Applies a random translation to the point cloud.<|endoftext|> |
0ee30d48ed409bee71723a2bad321c8e25b37ae41e8be1ecd814aa801c82c439 | def randomize(self):
'\n Applize random translation and rotation to the point cloud.\n '
self.random_translation()
self.random_rotation()
return | Applize random translation and rotation to the point cloud. | Helper/point_cloud.py | randomize | Baumwollboebele/python_algorithms | 0 | python | def randomize(self):
'\n \n '
self.random_translation()
self.random_rotation()
return | def randomize(self):
'\n \n '
self.random_translation()
self.random_rotation()
return<|docstring|>Applize random translation and rotation to the point cloud.<|endoftext|> |
4a141ebe38c4c6c2797af3540bb4a77fa46f686964a8a4c2607e38a90bad9296 | def update_p(file_name_dir, precomp_dir, pickle_file, tol, max_iter, multi, lamu):
'\n users can provide constraints for the value range of elements in connectivity matrices, A and B. This\n can be easily done by modifying "update" functions. For example, if the negative diagonal value is required,\n we ca... | users can provide constraints for the value range of elements in connectivity matrices, A and B. This
can be easily done by modifying "update" functions. For example, if the negative diagonal value is required,
we can add additional constraints on that.
The main algorithm, updating parameter for a defined problem
Par... | cdn/main_computation.py | update_p | xuefeicao/CDN | 11 | python | def update_p(file_name_dir, precomp_dir, pickle_file, tol, max_iter, multi, lamu):
'\n users can provide constraints for the value range of elements in connectivity matrices, A and B. This\n can be easily done by modifying "update" functions. For example, if the negative diagonal value is required,\n we ca... | def update_p(file_name_dir, precomp_dir, pickle_file, tol, max_iter, multi, lamu):
'\n users can provide constraints for the value range of elements in connectivity matrices, A and B. This\n can be easily done by modifying "update" functions. For example, if the negative diagonal value is required,\n we ca... |
acc7755e5321bfa755570677c507ebf0827413a9d221fc65198bdae58ce5194d | def select_lamu(lam, mu, lam_1, file_name_dir, pickle_file, precomp_dir, val_data_dir=None, val_precomp_dir=None, num_cores=1, tol=0.01, max_iter=100):
'\n wrapper for selecting the tuning parameters of one subject\n See function update_p for details of variables meaning\n\n Parameters\n -----------\n ... | wrapper for selecting the tuning parameters of one subject
See function update_p for details of variables meaning
Parameters
-----------
num_cores : int, allow multi-processing, default None
Returns
-----------
An instance of Modelconfig, including all summaries of estimation for one subject | cdn/main_computation.py | select_lamu | xuefeicao/CDN | 11 | python | def select_lamu(lam, mu, lam_1, file_name_dir, pickle_file, precomp_dir, val_data_dir=None, val_precomp_dir=None, num_cores=1, tol=0.01, max_iter=100):
'\n wrapper for selecting the tuning parameters of one subject\n See function update_p for details of variables meaning\n\n Parameters\n -----------\n ... | def select_lamu(lam, mu, lam_1, file_name_dir, pickle_file, precomp_dir, val_data_dir=None, val_precomp_dir=None, num_cores=1, tol=0.01, max_iter=100):
'\n wrapper for selecting the tuning parameters of one subject\n See function update_p for details of variables meaning\n\n Parameters\n -----------\n ... |
18b9fa412c3fb3824cd3f94cdd90f7284bf7c0b0d0b5e7acf141734bf3785230 | def update_all_3(gamma, mu=0):
'\n Second step for updating A, B, C\n\n Parameters\n -----------\n gamma: numpy array, \n mu : this is an extra tuning parameter which is not used in paper, but provided for people who are interested to add penalty \n to the l2 norm of A, B, ... | Second step for updating A, B, C
Parameters
-----------
gamma: numpy array,
mu : this is an extra tuning parameter which is not used in paper, but provided for people who are interested to add penalty
to the l2 norm of A, B, C | cdn/main_computation.py | update_all_3 | xuefeicao/CDN | 11 | python | def update_all_3(gamma, mu=0):
'\n Second step for updating A, B, C\n\n Parameters\n -----------\n gamma: numpy array, \n mu : this is an extra tuning parameter which is not used in paper, but provided for people who are interested to add penalty \n to the l2 norm of A, B, ... | def update_all_3(gamma, mu=0):
'\n Second step for updating A, B, C\n\n Parameters\n -----------\n gamma: numpy array, \n mu : this is an extra tuning parameter which is not used in paper, but provided for people who are interested to add penalty \n to the l2 norm of A, B, ... |
42fda253420237c97a80138661564e98544ab97181faab974b30908b792d490d | def update_all_2(gamma, mu):
'\n For the case when B = 0\n '
n_all = ((n_area + J) + 1)
Y_tmp = np.zeros((n_area, n_all))
X_tmp = np.zeros((n_all, n_all))
I_tmp = np.zeros((n_all, n_all))
W_A = np.zeros((n_area, n_area))
for i in range(n_area):
W_A[(i, i)] = np.dot(np.d... | For the case when B = 0 | cdn/main_computation.py | update_all_2 | xuefeicao/CDN | 11 | python | def update_all_2(gamma, mu):
'\n \n '
n_all = ((n_area + J) + 1)
Y_tmp = np.zeros((n_area, n_all))
X_tmp = np.zeros((n_all, n_all))
I_tmp = np.zeros((n_all, n_all))
W_A = np.zeros((n_area, n_area))
for i in range(n_area):
W_A[(i, i)] = np.dot(np.dot(gamma[(i, :)], P5), ... | def update_all_2(gamma, mu):
'\n \n '
n_all = ((n_area + J) + 1)
Y_tmp = np.zeros((n_area, n_all))
X_tmp = np.zeros((n_all, n_all))
I_tmp = np.zeros((n_all, n_all))
W_A = np.zeros((n_area, n_area))
for i in range(n_area):
W_A[(i, i)] = np.dot(np.dot(gamma[(i, :)], P5), ... |
e314d65fbdcae8609f3980f3cffba5e978cfc94e3c642c312264128c757a7d5b | def update_all_1(gamma, mu):
'\n For the case B = 0 and C = 0\n '
n_all = (n_area + 1)
Y_tmp = np.zeros((n_area, n_all))
X_tmp = np.zeros((n_all, n_all))
I_tmp = np.zeros((n_all, n_all))
W_A = np.zeros((n_area, n_area))
for i in range(n_area):
W_A[(i, i)] = np.dot(np.do... | For the case B = 0 and C = 0 | cdn/main_computation.py | update_all_1 | xuefeicao/CDN | 11 | python | def update_all_1(gamma, mu):
'\n \n '
n_all = (n_area + 1)
Y_tmp = np.zeros((n_area, n_all))
X_tmp = np.zeros((n_all, n_all))
I_tmp = np.zeros((n_all, n_all))
W_A = np.zeros((n_area, n_area))
for i in range(n_area):
W_A[(i, i)] = np.dot(np.dot(gamma[(i, :)], P5), np.tra... | def update_all_1(gamma, mu):
'\n \n '
n_all = (n_area + 1)
Y_tmp = np.zeros((n_area, n_all))
X_tmp = np.zeros((n_all, n_all))
I_tmp = np.zeros((n_all, n_all))
W_A = np.zeros((n_area, n_area))
for i in range(n_area):
W_A[(i, i)] = np.dot(np.dot(gamma[(i, :)], P5), np.tra... |
bdbcce7caa17eebf93c4fbf94f65da5951ab0f615baeb88ea3be01231de64d82 | def ini_select(y, lam_1, P12=P12, Omega=Omega):
'\n selecting an initial for gamma which may help to avoid local minimum\n\n Parameters\n ------------- \n lam_1: scalar, penalty for the second derivative of neuronal activities x. \n '
gamma_0 = np.zeros((n_area, p))
gamma_... | selecting an initial for gamma which may help to avoid local minimum
Parameters
-------------
lam_1: scalar, penalty for the second derivative of neuronal activities x. | cdn/main_computation.py | ini_select | xuefeicao/CDN | 11 | python | def ini_select(y, lam_1, P12=P12, Omega=Omega):
'\n selecting an initial for gamma which may help to avoid local minimum\n\n Parameters\n ------------- \n lam_1: scalar, penalty for the second derivative of neuronal activities x. \n '
gamma_0 = np.zeros((n_area, p))
gamma_... | def ini_select(y, lam_1, P12=P12, Omega=Omega):
'\n selecting an initial for gamma which may help to avoid local minimum\n\n Parameters\n ------------- \n lam_1: scalar, penalty for the second derivative of neuronal activities x. \n '
gamma_0 = np.zeros((n_area, p))
gamma_... |
c71f6e97a287a48a5358b31992c3b2887e23d5d0a9f90cd9c388565a8bda2c09 | def get_cast(device: Optional[str]=None) -> Tuple[(pychromecast.Chromecast, CCInfo)]:
'\n Attempt to connect with requested device (or any device if none has been specified).\n\n :param device: Can be an ip-address or a name.\n :type device: str\n :returns: Chromecast object for use in a CastController,... | Attempt to connect with requested device (or any device if none has been specified).
:param device: Can be an ip-address or a name.
:type device: str
:returns: Chromecast object for use in a CastController,
and CCInfo object for use in setup_cast and StreamInfo
:rtype: (pychromecast.Chromecast, CCInfo) | catt/controllers.py | get_cast | erdeiattila/catt | 1 | python | def get_cast(device: Optional[str]=None) -> Tuple[(pychromecast.Chromecast, CCInfo)]:
'\n Attempt to connect with requested device (or any device if none has been specified).\n\n :param device: Can be an ip-address or a name.\n :type device: str\n :returns: Chromecast object for use in a CastController,... | def get_cast(device: Optional[str]=None) -> Tuple[(pychromecast.Chromecast, CCInfo)]:
'\n Attempt to connect with requested device (or any device if none has been specified).\n\n :param device: Can be an ip-address or a name.\n :type device: str\n :returns: Chromecast object for use in a CastController,... |
2fae5ab6aac464acf27ce8841249fa1e60b6a5d300088295060d60269c4a4760 | def prep_app(self):
'Make sure desired chromecast app is running.'
if (not self._cast_listener.app_ready.is_set()):
self._cast.start_app(self._cast_listener.app_id)
self._cast_listener.app_ready.wait() | Make sure desired chromecast app is running. | catt/controllers.py | prep_app | erdeiattila/catt | 1 | python | def prep_app(self):
if (not self._cast_listener.app_ready.is_set()):
self._cast.start_app(self._cast_listener.app_id)
self._cast_listener.app_ready.wait() | def prep_app(self):
if (not self._cast_listener.app_ready.is_set()):
self._cast.start_app(self._cast_listener.app_id)
self._cast_listener.app_ready.wait()<|docstring|>Make sure desired chromecast app is running.<|endoftext|> |
ca1ad5f95a38ecf7a1ad6c1c47b9dec5d79916b2bd34c31628e096fd1820ceb9 | def prep_control(self):
'Make sure chromecast is not inactive or idle.'
self._check_inactive()
self._update_status()
if self._is_idle:
raise CastError('Nothing is currently playing') | Make sure chromecast is not inactive or idle. | catt/controllers.py | prep_control | erdeiattila/catt | 1 | python | def prep_control(self):
self._check_inactive()
self._update_status()
if self._is_idle:
raise CastError('Nothing is currently playing') | def prep_control(self):
self._check_inactive()
self._update_status()
if self._is_idle:
raise CastError('Nothing is currently playing')<|docstring|>Make sure chromecast is not inactive or idle.<|endoftext|> |
4b9cbfd79e6dae36b7c50a84465bc7bffeb8e8acec9052b12692a000fc707ff4 | def prep_info(self):
'Make sure chromecast is not inactive.'
self._check_inactive()
self._update_status() | Make sure chromecast is not inactive. | catt/controllers.py | prep_info | erdeiattila/catt | 1 | python | def prep_info(self):
self._check_inactive()
self._update_status() | def prep_info(self):
self._check_inactive()
self._update_status()<|docstring|>Make sure chromecast is not inactive.<|endoftext|> |
5e491c2378bbb853e6bd2fd55dfda1439e31ef1e59f39fc69f7e02c975b5f652 | def kill(self, idle_only=False, force=False):
'\n Kills current Chromecast session.\n\n :param idle_only: If set, session is only killed if the active Chromecast app\n is idle. Use to avoid killing an active streaming session\n when catt fails with cer... | Kills current Chromecast session.
:param idle_only: If set, session is only killed if the active Chromecast app
is idle. Use to avoid killing an active streaming session
when catt fails with certain invalid actions (such as trying
to cast an empty playlist).
:type ... | catt/controllers.py | kill | erdeiattila/catt | 1 | python | def kill(self, idle_only=False, force=False):
'\n Kills current Chromecast session.\n\n :param idle_only: If set, session is only killed if the active Chromecast app\n is idle. Use to avoid killing an active streaming session\n when catt fails with cer... | def kill(self, idle_only=False, force=False):
'\n Kills current Chromecast session.\n\n :param idle_only: If set, session is only killed if the active Chromecast app\n is idle. Use to avoid killing an active streaming session\n when catt fails with cer... |
f2f64d5577b9069eb011472c201ba07a4714dfefab6fa72976d2c7838b4389eb | def prep_app(self):
'Make sure desired chromecast app is running.'
self._cast.start_app(self._cast_listener.app_id, force_launch=True)
self._cast_listener.app_ready.wait() | Make sure desired chromecast app is running. | catt/controllers.py | prep_app | erdeiattila/catt | 1 | python | def prep_app(self):
self._cast.start_app(self._cast_listener.app_id, force_launch=True)
self._cast_listener.app_ready.wait() | def prep_app(self):
self._cast.start_app(self._cast_listener.app_id, force_launch=True)
self._cast_listener.app_ready.wait()<|docstring|>Make sure desired chromecast app is running.<|endoftext|> |
771c062b4885c666c1674b8cebeed1e8d3786d9d0cae18fa20b1dd50bba0e8fa | def set_ppr_template_data(report_data):
'Set up the PPR search data for the report, modifying the original for the template output.'
set_addresses(report_data)
set_date_times(report_data)
set_vehicle_collateral(report_data)
set_general_collateral(report_data) | Set up the PPR search data for the report, modifying the original for the template output. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_ppr_template_data | cameron-freshworks/ppr | 0 | python | def set_ppr_template_data(report_data):
set_addresses(report_data)
set_date_times(report_data)
set_vehicle_collateral(report_data)
set_general_collateral(report_data) | def set_ppr_template_data(report_data):
set_addresses(report_data)
set_date_times(report_data)
set_vehicle_collateral(report_data)
set_general_collateral(report_data)<|docstring|>Set up the PPR search data for the report, modifying the original for the template output.<|endoftext|> |
0076b520a54b599e372af38598787f8899e52df9763c5fa77cd3ab28275d37d7 | def format_address(address):
'Replace address country code with description.'
if (('country' in address) and address['country']):
country = address['country']
if (country == 'CA'):
address['country'] = 'Canada'
elif (country == 'US'):
address['country'] = 'United ... | Replace address country code with description. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | format_address | cameron-freshworks/ppr | 0 | python | def format_address(address):
if (('country' in address) and address['country']):
country = address['country']
if (country == 'CA'):
address['country'] = 'Canada'
elif (country == 'US'):
address['country'] = 'United States of America'
else:
try... | def format_address(address):
if (('country' in address) and address['country']):
country = address['country']
if (country == 'CA'):
address['country'] = 'Canada'
elif (country == 'US'):
address['country'] = 'United States of America'
else:
try... |
ca9a53585f881d1ed37b2c37af918e31c767e1902c0b9e88f42199bb67778b31 | def set_financing_addresses(statement):
'Replace financing statement addresses country code with description.'
format_address(statement['registeringParty']['address'])
for secured_party in statement['securedParties']:
format_address(secured_party['address'])
for debtor in statement['debtors']:
... | Replace financing statement addresses country code with description. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_financing_addresses | cameron-freshworks/ppr | 0 | python | def set_financing_addresses(statement):
format_address(statement['registeringParty']['address'])
for secured_party in statement['securedParties']:
format_address(secured_party['address'])
for debtor in statement['debtors']:
format_address(debtor['address']) | def set_financing_addresses(statement):
format_address(statement['registeringParty']['address'])
for secured_party in statement['securedParties']:
format_address(secured_party['address'])
for debtor in statement['debtors']:
format_address(debtor['address'])<|docstring|>Replace financing... |
2218ff9e34735ea9fe8c6a42f27de5a35983bb0530cec100641b396dc6f0be1b | def set_amend_change_addresses(statement):
'Replace amendment/change statement address country code with description.'
format_address(statement['registeringParty']['address'])
if ('deleteSecuredParties' in statement):
for delete_secured in statement['deleteSecuredParties']:
format_addres... | Replace amendment/change statement address country code with description. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_amend_change_addresses | cameron-freshworks/ppr | 0 | python | def set_amend_change_addresses(statement):
format_address(statement['registeringParty']['address'])
if ('deleteSecuredParties' in statement):
for delete_secured in statement['deleteSecuredParties']:
format_address(delete_secured['address'])
if ('addSecuredParties' in statement):
... | def set_amend_change_addresses(statement):
format_address(statement['registeringParty']['address'])
if ('deleteSecuredParties' in statement):
for delete_secured in statement['deleteSecuredParties']:
format_address(delete_secured['address'])
if ('addSecuredParties' in statement):
... |
1648c552109face352809c60e430fa745fdfc36a5f634bddb900c11dcb480991 | def set_modified_party(add_party, delete_parties):
'Set the update flags for a single party .'
for delete_party in delete_parties:
if (('reg_id' in add_party) and ('reg_id' in delete_party) and (add_party['reg_id'] == delete_party['reg_id']) and ('edit' not in delete_party)):
if (add_party['... | Set the update flags for a single party . | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_modified_party | cameron-freshworks/ppr | 0 | python | def set_modified_party(add_party, delete_parties):
for delete_party in delete_parties:
if (('reg_id' in add_party) and ('reg_id' in delete_party) and (add_party['reg_id'] == delete_party['reg_id']) and ('edit' not in delete_party)):
if (add_party['address'] == delete_party['address']):
... | def set_modified_party(add_party, delete_parties):
for delete_party in delete_parties:
if (('reg_id' in add_party) and ('reg_id' in delete_party) and (add_party['reg_id'] == delete_party['reg_id']) and ('edit' not in delete_party)):
if (add_party['address'] == delete_party['address']):
... |
e79ad47f5b1d729ca742214b1ca76810814d421f0819953996cea14fb0e6242f | def set_modified_parties(statement):
'Replace amendment or change address country code with description. Set if party edited.'
set_amend_change_addresses(statement)
if (('deleteSecuredParties' in statement) and ('addSecuredParties' in statement)):
for add_secured in statement['addSecuredParties']:
... | Replace amendment or change address country code with description. Set if party edited. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_modified_parties | cameron-freshworks/ppr | 0 | python | def set_modified_parties(statement):
set_amend_change_addresses(statement)
if (('deleteSecuredParties' in statement) and ('addSecuredParties' in statement)):
for add_secured in statement['addSecuredParties']:
if statement['deleteSecuredParties']:
set_modified_party(add_s... | def set_modified_parties(statement):
set_amend_change_addresses(statement)
if (('deleteSecuredParties' in statement) and ('addSecuredParties' in statement)):
for add_secured in statement['addSecuredParties']:
if statement['deleteSecuredParties']:
set_modified_party(add_s... |
aa564841bc93a007076902263a107d48c38af1695539502e30661fcd92ef3a05 | def set_addresses(report_data):
'Replace search results addresses country code with description.'
set_financing_addresses(report_data)
if ('changes' in report_data):
for change in report_data['changes']:
if (change['statementType'] == 'CHANGE_STATEMENT'):
set_modified_par... | Replace search results addresses country code with description. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_addresses | cameron-freshworks/ppr | 0 | python | def set_addresses(report_data):
set_financing_addresses(report_data)
if ('changes' in report_data):
for change in report_data['changes']:
if (change['statementType'] == 'CHANGE_STATEMENT'):
set_modified_parties(change)
elif (change['statementType'] == 'AMENDM... | def set_addresses(report_data):
set_financing_addresses(report_data)
if ('changes' in report_data):
for change in report_data['changes']:
if (change['statementType'] == 'CHANGE_STATEMENT'):
set_modified_parties(change)
elif (change['statementType'] == 'AMENDM... |
94374062c0cdbd754b1af2e1d1ded830bf6ac68b44fb28021704e8a4c12ff9ff | def to_report_datetime(date_time: str, include_time: bool=True, expiry: bool=False):
'Convert ISO formatted date time or date string to report format.'
local_datetime = model_utils.to_local_timestamp(model_utils.ts_from_iso_format(date_time))
if (expiry and (local_datetime.hour != 23)):
offset = (23... | Convert ISO formatted date time or date string to report format. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | to_report_datetime | cameron-freshworks/ppr | 0 | python | def to_report_datetime(date_time: str, include_time: bool=True, expiry: bool=False):
local_datetime = model_utils.to_local_timestamp(model_utils.ts_from_iso_format(date_time))
if (expiry and (local_datetime.hour != 23)):
offset = (23 - local_datetime.hour)
local_datetime = (local_datetime +... | def to_report_datetime(date_time: str, include_time: bool=True, expiry: bool=False):
local_datetime = model_utils.to_local_timestamp(model_utils.ts_from_iso_format(date_time))
if (expiry and (local_datetime.hour != 23)):
offset = (23 - local_datetime.hour)
local_datetime = (local_datetime +... |
37a035b8fe8a8e9aeb8d1eaf5428116f3bfff3dc1e756e1a236506b5d9567756 | def to_report_datetime_expiry(date_time: str):
'Convert ISO formatted date time or date string to report expiry date format.'
local_datetime = model_utils.to_local_expiry_report(date_time)
if (local_datetime.hour != 23):
offset = (23 - local_datetime.hour)
local_datetime = (local_datetime + ... | Convert ISO formatted date time or date string to report expiry date format. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | to_report_datetime_expiry | cameron-freshworks/ppr | 0 | python | def to_report_datetime_expiry(date_time: str):
local_datetime = model_utils.to_local_expiry_report(date_time)
if (local_datetime.hour != 23):
offset = (23 - local_datetime.hour)
local_datetime = (local_datetime + timedelta(hours=offset))
timestamp = local_datetime.strftime('%B %-d, %Y a... | def to_report_datetime_expiry(date_time: str):
local_datetime = model_utils.to_local_expiry_report(date_time)
if (local_datetime.hour != 23):
offset = (23 - local_datetime.hour)
local_datetime = (local_datetime + timedelta(hours=offset))
timestamp = local_datetime.strftime('%B %-d, %Y a... |
f4b37583055258a0da4408b3e489dba121e0a9b6b99d7f28af71f427603008ca | def set_financing_date_time(statement):
'Replace financing statement API ISO UTC strings with local report format strings.'
statement['createDateTime'] = to_report_datetime(statement['createDateTime'])
if (('expiryDate' in statement) and (len(statement['expiryDate']) > 10)):
statement['expiryDate'] ... | Replace financing statement API ISO UTC strings with local report format strings. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_financing_date_time | cameron-freshworks/ppr | 0 | python | def set_financing_date_time(statement):
statement['createDateTime'] = to_report_datetime(statement['createDateTime'])
if (('expiryDate' in statement) and (len(statement['expiryDate']) > 10)):
statement['expiryDate'] = to_report_datetime_expiry(statement['expiryDate'])
if ('surrenderDate' in sta... | def set_financing_date_time(statement):
statement['createDateTime'] = to_report_datetime(statement['createDateTime'])
if (('expiryDate' in statement) and (len(statement['expiryDate']) > 10)):
statement['expiryDate'] = to_report_datetime_expiry(statement['expiryDate'])
if ('surrenderDate' in sta... |
f7e6f50bee4226a6e6ffca201c8b2899366a4f61a509462ebcc44097a35dc862 | def set_change_date_time(statement):
'Replace non-financing statement API ISO UTC strings with local report format strings.'
statement['createDateTime'] = to_report_datetime(statement['createDateTime'])
if (('courtOrderInformation' in statement) and ('orderDate' in statement['courtOrderInformation'])):
... | Replace non-financing statement API ISO UTC strings with local report format strings. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_change_date_time | cameron-freshworks/ppr | 0 | python | def set_change_date_time(statement):
statement['createDateTime'] = to_report_datetime(statement['createDateTime'])
if (('courtOrderInformation' in statement) and ('orderDate' in statement['courtOrderInformation'])):
order_date = to_report_datetime(statement['courtOrderInformation']['orderDate'], Fa... | def set_change_date_time(statement):
statement['createDateTime'] = to_report_datetime(statement['createDateTime'])
if (('courtOrderInformation' in statement) and ('orderDate' in statement['courtOrderInformation'])):
order_date = to_report_datetime(statement['courtOrderInformation']['orderDate'], Fa... |
8141298203fcd83149f23e22a1ad7e3f794ef2de42990d29fc125ba74d88607c | def set_date_times(report_data):
'Replace API ISO UTC strings with local report format strings.'
set_financing_date_time(report_data)
if ('changes' in report_data):
for change in report_data['changes']:
set_change_date_time(change) | Replace API ISO UTC strings with local report format strings. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_date_times | cameron-freshworks/ppr | 0 | python | def set_date_times(report_data):
set_financing_date_time(report_data)
if ('changes' in report_data):
for change in report_data['changes']:
set_change_date_time(change) | def set_date_times(report_data):
set_financing_date_time(report_data)
if ('changes' in report_data):
for change in report_data['changes']:
set_change_date_time(change)<|docstring|>Replace API ISO UTC strings with local report format strings.<|endoftext|> |
d33d31722da0ac1fb59a0edc489a8a46c57c3c56de5011fdaf253bacb53632c2 | def set_financing_vehicle_collateral(statement):
'Replace financing statement vehicle collateral type code with description.'
if ('vehicleCollateral' in statement):
mh_count = 0
for collateral in statement['vehicleCollateral']:
if (collateral['type'] == 'MH'):
mh_coun... | Replace financing statement vehicle collateral type code with description. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_financing_vehicle_collateral | cameron-freshworks/ppr | 0 | python | def set_financing_vehicle_collateral(statement):
if ('vehicleCollateral' in statement):
mh_count = 0
for collateral in statement['vehicleCollateral']:
if (collateral['type'] == 'MH'):
mh_count += 1
desc = TO_VEHICLE_TYPE_DESCRIPTION[collateral['type']]
... | def set_financing_vehicle_collateral(statement):
if ('vehicleCollateral' in statement):
mh_count = 0
for collateral in statement['vehicleCollateral']:
if (collateral['type'] == 'MH'):
mh_count += 1
desc = TO_VEHICLE_TYPE_DESCRIPTION[collateral['type']]
... |
128383aefb89649ad0c8ff02e37dbc205ee752a14639daed88313dbab0af4450 | def set_amend_change_vehicle_collateral(statement):
'Replace amendment/change statement vehicle collateral type code with description.'
if (('deleteVehicleCollateral' in statement) or ('addVehicleCollateral' in statement)):
mh_count = 0
if ('deleteVehicleCollateral' in statement):
fo... | Replace amendment/change statement vehicle collateral type code with description. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_amend_change_vehicle_collateral | cameron-freshworks/ppr | 0 | python | def set_amend_change_vehicle_collateral(statement):
if (('deleteVehicleCollateral' in statement) or ('addVehicleCollateral' in statement)):
mh_count = 0
if ('deleteVehicleCollateral' in statement):
for delete_collateral in statement['deleteVehicleCollateral']:
if (de... | def set_amend_change_vehicle_collateral(statement):
if (('deleteVehicleCollateral' in statement) or ('addVehicleCollateral' in statement)):
mh_count = 0
if ('deleteVehicleCollateral' in statement):
for delete_collateral in statement['deleteVehicleCollateral']:
if (de... |
d71b0b1dee6f4f6318e3c9d800a1d839f1b19d2b3b922eafd488e3a309af92ac | def set_amend_vehicle_collateral(statement):
'Replace amendment statement vehicle collateral type code with description. Set if change is an edit.'
set_amend_change_vehicle_collateral(statement)
if (('deleteVehicleCollateral' in statement) and ('addVehicleCollateral' in statement)):
for add in state... | Replace amendment statement vehicle collateral type code with description. Set if change is an edit. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_amend_vehicle_collateral | cameron-freshworks/ppr | 0 | python | def set_amend_vehicle_collateral(statement):
set_amend_change_vehicle_collateral(statement)
if (('deleteVehicleCollateral' in statement) and ('addVehicleCollateral' in statement)):
for add in statement['addVehicleCollateral']:
for delete in statement['deleteVehicleCollateral']:
... | def set_amend_vehicle_collateral(statement):
set_amend_change_vehicle_collateral(statement)
if (('deleteVehicleCollateral' in statement) and ('addVehicleCollateral' in statement)):
for add in statement['addVehicleCollateral']:
for delete in statement['deleteVehicleCollateral']:
... |
41d5324f0d8ef8ac1ceca04b3ed16297c60248dbf9d4e4e429843905cc8ae08b | def set_vehicle_collateral(report_data):
'Replace search results vehicle collateral type codes with descriptions.'
set_financing_vehicle_collateral(report_data)
if ('changes' in report_data):
for change in report_data['changes']:
if (change['statementType'] == 'CHANGE_STATEMENT'):
... | Replace search results vehicle collateral type codes with descriptions. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_vehicle_collateral | cameron-freshworks/ppr | 0 | python | def set_vehicle_collateral(report_data):
set_financing_vehicle_collateral(report_data)
if ('changes' in report_data):
for change in report_data['changes']:
if (change['statementType'] == 'CHANGE_STATEMENT'):
set_amend_change_vehicle_collateral(change)
elif (c... | def set_vehicle_collateral(report_data):
set_financing_vehicle_collateral(report_data)
if ('changes' in report_data):
for change in report_data['changes']:
if (change['statementType'] == 'CHANGE_STATEMENT'):
set_amend_change_vehicle_collateral(change)
elif (c... |
c3e35a8f3d2698f1a124b8299eff1d9b5b451024db1299169770f3a18152ca8a | def set_financing_general_collateral(statement):
'Replace report newline characters in financing statement general collateral descriptions.'
if ('generalCollateral' in statement):
for collateral in statement['generalCollateral']:
if ('description' in collateral):
collateral['... | Replace report newline characters in financing statement general collateral descriptions. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_financing_general_collateral | cameron-freshworks/ppr | 0 | python | def set_financing_general_collateral(statement):
if ('generalCollateral' in statement):
for collateral in statement['generalCollateral']:
if ('description' in collateral):
collateral['description'] = collateral['description'].replace('/r/n', '<br>')
collatera... | def set_financing_general_collateral(statement):
if ('generalCollateral' in statement):
for collateral in statement['generalCollateral']:
if ('description' in collateral):
collateral['description'] = collateral['description'].replace('/r/n', '<br>')
collatera... |
47d062707e65e180545b45df07c2745623dd312dd7d00f73cef7c6ec7ffdd7b5 | def set_amend_change_general_collateral(statement):
'Replace report newline characters in amendment statement general collateral description.'
if ('deleteGeneralCollateral' in statement):
for collateral in statement['deleteGeneralCollateral']:
if ('description' in collateral):
... | Replace report newline characters in amendment statement general collateral description. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_amend_change_general_collateral | cameron-freshworks/ppr | 0 | python | def set_amend_change_general_collateral(statement):
if ('deleteGeneralCollateral' in statement):
for collateral in statement['deleteGeneralCollateral']:
if ('description' in collateral):
collateral['description'] = collateral['description'].replace('/r/n', '<br>')
... | def set_amend_change_general_collateral(statement):
if ('deleteGeneralCollateral' in statement):
for collateral in statement['deleteGeneralCollateral']:
if ('description' in collateral):
collateral['description'] = collateral['description'].replace('/r/n', '<br>')
... |
b6064601539588c013139b680572888dd6a896c164bc0afbc3abb2c560a852fc | def set_general_collateral(report_data):
'Replace report newline characters in search general collateral descriptions.'
set_financing_general_collateral(report_data)
if ('changes' in report_data):
for change in report_data['changes']:
if (change['statementType'] in ('CHANGE_STATEMENT', '... | Replace report newline characters in search general collateral descriptions. | mhr_api/src/mhr_api/reports/ppr_report_utils.py | set_general_collateral | cameron-freshworks/ppr | 0 | python | def set_general_collateral(report_data):
set_financing_general_collateral(report_data)
if ('changes' in report_data):
for change in report_data['changes']:
if (change['statementType'] in ('CHANGE_STATEMENT', 'AMENDMENT_STATEMENT')):
set_amend_change_general_collateral(ch... | def set_general_collateral(report_data):
set_financing_general_collateral(report_data)
if ('changes' in report_data):
for change in report_data['changes']:
if (change['statementType'] in ('CHANGE_STATEMENT', 'AMENDMENT_STATEMENT')):
set_amend_change_general_collateral(ch... |
7eb170caaf1bca92cfb34d9a368f93195517ddd156db941cd44bb411024cea1f | def evaluate(model, X, y, p_ids, num_runs=10, valid_only=True, return_raw=False, scale_data=False):
'\n This function is used to evaluate the performance of your model\n Parameters\n ----------\n model\n X\n y\n p_ids\n num_runs\n valid_only\n return_raw\n\n Returns\n -------\n\n... | This function is used to evaluate the performance of your model
Parameters
----------
model
X
y
p_ids
num_runs
valid_only
return_raw
Returns
------- | minder_utils/sleep_data_test.py | evaluate | alexcapstick/minder_utils | 0 | python | def evaluate(model, X, y, p_ids, num_runs=10, valid_only=True, return_raw=False, scale_data=False):
'\n This function is used to evaluate the performance of your model\n Parameters\n ----------\n model\n X\n y\n p_ids\n num_runs\n valid_only\n return_raw\n\n Returns\n -------\n\n... | def evaluate(model, X, y, p_ids, num_runs=10, valid_only=True, return_raw=False, scale_data=False):
'\n This function is used to evaluate the performance of your model\n Parameters\n ----------\n model\n X\n y\n p_ids\n num_runs\n valid_only\n return_raw\n\n Returns\n -------\n\n... |
c0c90f6487b90307595f2f05d399e851172454046568f6f809c373f66c238379 | def get_description(self):
'\n A description of the Chebyshev (arcsine) distribution.\n\n :param Chebyshev self:\n An instance of the Chebyshev (arcsine) class.\n :return:\n A string describing the Chebyshev (arcsine) distribution.\n '
text = (((('is a Chebyshev... | A description of the Chebyshev (arcsine) distribution.
:param Chebyshev self:
An instance of the Chebyshev (arcsine) class.
:return:
A string describing the Chebyshev (arcsine) distribution. | equadratures/distributions/chebyshev.py | get_description | psesh/Efficient-Quadratures | 59 | python | def get_description(self):
'\n A description of the Chebyshev (arcsine) distribution.\n\n :param Chebyshev self:\n An instance of the Chebyshev (arcsine) class.\n :return:\n A string describing the Chebyshev (arcsine) distribution.\n '
text = (((('is a Chebyshev... | def get_description(self):
'\n A description of the Chebyshev (arcsine) distribution.\n\n :param Chebyshev self:\n An instance of the Chebyshev (arcsine) class.\n :return:\n A string describing the Chebyshev (arcsine) distribution.\n '
text = (((('is a Chebyshev... |
89e38d66099019efe476751d3c91092559e1520820d6b484df035d8fbea4798e | def get_pdf(self, points=None):
'\n A Chebyshev probability density function.\n\n :param Chebyshev self:\n An instance of the Chebyshev (arcsine) class.\n :param points:\n Matrix of points for defining the probability density function.\n :return:\n An arr... | A Chebyshev probability density function.
:param Chebyshev self:
An instance of the Chebyshev (arcsine) class.
:param points:
Matrix of points for defining the probability density function.
:return:
An array of N the support of the Chebyshev (arcsine) distribution.
:return:
Probability density values a... | equadratures/distributions/chebyshev.py | get_pdf | psesh/Efficient-Quadratures | 59 | python | def get_pdf(self, points=None):
'\n A Chebyshev probability density function.\n\n :param Chebyshev self:\n An instance of the Chebyshev (arcsine) class.\n :param points:\n Matrix of points for defining the probability density function.\n :return:\n An arr... | def get_pdf(self, points=None):
'\n A Chebyshev probability density function.\n\n :param Chebyshev self:\n An instance of the Chebyshev (arcsine) class.\n :param points:\n Matrix of points for defining the probability density function.\n :return:\n An arr... |
a1b04b22b482ab6852b0a0bcc5f20a75fc03ab52eaa3cd31f5a29d90137f57d4 | def get_cdf(self, points=None):
'\n A Chebyshev cumulative density function.\n\n :param Chebyshev self:\n An instance of the Chebyshev class.\n :param points:\n Matrix of points for defining the cumulative density function.\n :return:\n An array of N valu... | A Chebyshev cumulative density function.
:param Chebyshev self:
An instance of the Chebyshev class.
:param points:
Matrix of points for defining the cumulative density function.
:return:
An array of N values over the support of the Chebyshev (arcsine) distribution.
:return:
Cumulative density values al... | equadratures/distributions/chebyshev.py | get_cdf | psesh/Efficient-Quadratures | 59 | python | def get_cdf(self, points=None):
'\n A Chebyshev cumulative density function.\n\n :param Chebyshev self:\n An instance of the Chebyshev class.\n :param points:\n Matrix of points for defining the cumulative density function.\n :return:\n An array of N valu... | def get_cdf(self, points=None):
'\n A Chebyshev cumulative density function.\n\n :param Chebyshev self:\n An instance of the Chebyshev class.\n :param points:\n Matrix of points for defining the cumulative density function.\n :return:\n An array of N valu... |
d5fdb9fe223cc2bd83112e6edd7f78ad6cbe6c6d4320b41d75382eafd1739302 | def get_recurrence_coefficients(self, order):
'\n Recurrence coefficients for the Chebyshev distribution.\n\n :param Chebyshev self:\n An instance of the Chebyshev class.\n :param array order:\n The order of the recurrence coefficients desired.\n :return:\n ... | Recurrence coefficients for the Chebyshev distribution.
:param Chebyshev self:
An instance of the Chebyshev class.
:param array order:
The order of the recurrence coefficients desired.
:return:
Recurrence coefficients associated with the Chebyshev distribution. | equadratures/distributions/chebyshev.py | get_recurrence_coefficients | psesh/Efficient-Quadratures | 59 | python | def get_recurrence_coefficients(self, order):
'\n Recurrence coefficients for the Chebyshev distribution.\n\n :param Chebyshev self:\n An instance of the Chebyshev class.\n :param array order:\n The order of the recurrence coefficients desired.\n :return:\n ... | def get_recurrence_coefficients(self, order):
'\n Recurrence coefficients for the Chebyshev distribution.\n\n :param Chebyshev self:\n An instance of the Chebyshev class.\n :param array order:\n The order of the recurrence coefficients desired.\n :return:\n ... |
81711e29badbf7b511e214d2ef10bbd0e2d575703ba3ddb1b89f2ca7d2cb2a3d | def get_icdf(self, xx):
'\n A Arcisine inverse cumulative density function.\n\n :param Arcsine self:\n An instance of Arcisine class.\n :param xx:\n A matrix of points at which the inverse cumulative density function needs to be evaluated.\n :return:\n In... | A Arcisine inverse cumulative density function.
:param Arcsine self:
An instance of Arcisine class.
:param xx:
A matrix of points at which the inverse cumulative density function needs to be evaluated.
:return:
Inverse cumulative density function values of the Arcisine distribution. | equadratures/distributions/chebyshev.py | get_icdf | psesh/Efficient-Quadratures | 59 | python | def get_icdf(self, xx):
'\n A Arcisine inverse cumulative density function.\n\n :param Arcsine self:\n An instance of Arcisine class.\n :param xx:\n A matrix of points at which the inverse cumulative density function needs to be evaluated.\n :return:\n In... | def get_icdf(self, xx):
'\n A Arcisine inverse cumulative density function.\n\n :param Arcsine self:\n An instance of Arcisine class.\n :param xx:\n A matrix of points at which the inverse cumulative density function needs to be evaluated.\n :return:\n In... |
98b3cb6fa033cb527cece9c6b64bd4f0331b33e5d49e059fd411374760405300 | def get_samples(self, m=None):
'\n Generates samples from the Arcsine distribution.\n\n :param arcsine self:\n An instance of Arcsine class.\n :param integer m:\n Number of random samples. If not provided, a default of 5e05 is assumed.\n\n '
if (m is not None):
... | Generates samples from the Arcsine distribution.
:param arcsine self:
An instance of Arcsine class.
:param integer m:
Number of random samples. If not provided, a default of 5e05 is assumed. | equadratures/distributions/chebyshev.py | get_samples | psesh/Efficient-Quadratures | 59 | python | def get_samples(self, m=None):
'\n Generates samples from the Arcsine distribution.\n\n :param arcsine self:\n An instance of Arcsine class.\n :param integer m:\n Number of random samples. If not provided, a default of 5e05 is assumed.\n\n '
if (m is not None):
... | def get_samples(self, m=None):
'\n Generates samples from the Arcsine distribution.\n\n :param arcsine self:\n An instance of Arcsine class.\n :param integer m:\n Number of random samples. If not provided, a default of 5e05 is assumed.\n\n '
if (m is not None):
... |
f0499ecb1737b90ebac1e77da100215c681bfdc02a7fa056513748365b7fc093 | def main(tspoint, f, grad, hessian, dirname, SHSrank, SHSroot, SHScomm, const):
'\n main: main part of the calculation of minimum path\n Args:\n tspoint : Coordinate of ts point\n f : function to calculate potential as f(x)\n grad : function to calculate gradient as grad(x)\n ... | main: main part of the calculation of minimum path
Args:
tspoint : Coordinate of ts point
f : function to calculate potential as f(x)
grad : function to calculate gradient as grad(x)
hessian : function to calculate hessian as hessian(x)
dirname : name of directory to calculate minimum path
... | SHS4py/MinimumPath.py | main | YukiMitsuta/shs4py | 2 | python | def main(tspoint, f, grad, hessian, dirname, SHSrank, SHSroot, SHScomm, const):
'\n main: main part of the calculation of minimum path\n Args:\n tspoint : Coordinate of ts point\n f : function to calculate potential as f(x)\n grad : function to calculate gradient as grad(x)\n ... | def main(tspoint, f, grad, hessian, dirname, SHSrank, SHSroot, SHScomm, const):
'\n main: main part of the calculation of minimum path\n Args:\n tspoint : Coordinate of ts point\n f : function to calculate potential as f(x)\n grad : function to calculate gradient as grad(x)\n ... |
4191de6d125095ad8554b0b71377fe5366d763dc3b84c3060205c061b5f4ea1d | def get_training_and_validation_and_testing_generators25d(data_file, batch_size, n_labels, training_keys_file, validation_keys_file, testing_keys_file, data_split=0.8, overwrite=False, labels=None, patch_shape=None, validation_patch_overlap=0, training_patch_start_offset=None, validation_batch_size=None, patch_overlap=... | Creates the training and validation generators that can be used when training the model.
:param skip_blank: If True, any blank (all-zero) label images/patches will be skipped by the data generator.
:param validation_batch_size: Batch size for the validation data.
:param training_patch_start_offset: Tuple of length 3 co... | unet25d/generator.py | get_training_and_validation_and_testing_generators25d | vuhoangminh/3DUnetCNN | 1 | python | def get_training_and_validation_and_testing_generators25d(data_file, batch_size, n_labels, training_keys_file, validation_keys_file, testing_keys_file, data_split=0.8, overwrite=False, labels=None, patch_shape=None, validation_patch_overlap=0, training_patch_start_offset=None, validation_batch_size=None, patch_overlap=... | def get_training_and_validation_and_testing_generators25d(data_file, batch_size, n_labels, training_keys_file, validation_keys_file, testing_keys_file, data_split=0.8, overwrite=False, labels=None, patch_shape=None, validation_patch_overlap=0, training_patch_start_offset=None, validation_batch_size=None, patch_overlap=... |
307ca7a1e471266d6977241e5ec66f3e0617d7bace91fd1cd1c0652e3038a140 | def move_hat(self, direction):
' DPad is interpreted as a hat. Values are 0-7 where N is 0, and the\n directions move clockwise. 8 is centered. '
self._hat_position = direction
self._send() | DPad is interpreted as a hat. Values are 0-7 where N is 0, and the
directions move clockwise. 8 is centered. | ofs.py | move_hat | SleepUnit/OpenStickFirmware | 17 | python | def move_hat(self, direction):
' DPad is interpreted as a hat. Values are 0-7 where N is 0, and the\n directions move clockwise. 8 is centered. '
self._hat_position = direction
self._send() | def move_hat(self, direction):
' DPad is interpreted as a hat. Values are 0-7 where N is 0, and the\n directions move clockwise. 8 is centered. '
self._hat_position = direction
self._send()<|docstring|>DPad is interpreted as a hat. Values are 0-7 where N is 0, and the
directions move clockwise. 8 is ce... |
8b00f0bef3a10e7d5071b6616d94f14cf64ee167f04d6b8bd6dadb0d08dac0cf | def reset_all(self):
'Return the fightstick to a neutral state'
self._buttons_state = 0
self._hat_position = 8
self._joy_x = 0
self._joy_y = 0
self._joy_z = 0
self._joy_r_z = 0
self._send(always=True) | Return the fightstick to a neutral state | ofs.py | reset_all | SleepUnit/OpenStickFirmware | 17 | python | def reset_all(self):
self._buttons_state = 0
self._hat_position = 8
self._joy_x = 0
self._joy_y = 0
self._joy_z = 0
self._joy_r_z = 0
self._send(always=True) | def reset_all(self):
self._buttons_state = 0
self._hat_position = 8
self._joy_x = 0
self._joy_y = 0
self._joy_z = 0
self._joy_r_z = 0
self._send(always=True)<|docstring|>Return the fightstick to a neutral state<|endoftext|> |
51ffc18cbc9a6701b56dd0f0c83cafc47d9114b3e19b183cffcd5d352f1a0d72 | def _send(self, always=False):
'Send a report with all the existing settings.\n If ``always`` is ``False`` (the default), send only if there have been changes.\n '
struct.pack_into('<HBbbbb', self._report, 0, self._buttons_state, self._hat_position, self._joy_x, self._joy_y, self._joy_z, self._joy... | Send a report with all the existing settings.
If ``always`` is ``False`` (the default), send only if there have been changes. | ofs.py | _send | SleepUnit/OpenStickFirmware | 17 | python | def _send(self, always=False):
'Send a report with all the existing settings.\n If ``always`` is ``False`` (the default), send only if there have been changes.\n '
struct.pack_into('<HBbbbb', self._report, 0, self._buttons_state, self._hat_position, self._joy_x, self._joy_y, self._joy_z, self._joy... | def _send(self, always=False):
'Send a report with all the existing settings.\n If ``always`` is ``False`` (the default), send only if there have been changes.\n '
struct.pack_into('<HBbbbb', self._report, 0, self._buttons_state, self._hat_position, self._joy_x, self._joy_y, self._joy_z, self._joy... |
6030a733b4af46114f9c4d3d82a42dc5b09d87a81f61fb1fb0ee93c2fdaf75b5 | def convert_names_to_model_inputs(names: Union[(list, np.ndarray)]) -> torch.Tensor:
'\n Return a torch tensor of names, where each name has been converted to a sequence of ids and the ids have been one-hot encoded.\n Also return the tensor where the names have been converted to a sequence of ids but before t... | Return a torch tensor of names, where each name has been converted to a sequence of ids and the ids have been one-hot encoded.
Also return the tensor where the names have been converted to a sequence of ids but before the ids have been one-hot encoded.
:param names: list of names to encode
:param char_to_idx_map: map c... | src/models/swivel_encoder.py | convert_names_to_model_inputs | rootsdev/nama | 0 | python | def convert_names_to_model_inputs(names: Union[(list, np.ndarray)]) -> torch.Tensor:
'\n Return a torch tensor of names, where each name has been converted to a sequence of ids and the ids have been one-hot encoded.\n Also return the tensor where the names have been converted to a sequence of ids but before t... | def convert_names_to_model_inputs(names: Union[(list, np.ndarray)]) -> torch.Tensor:
'\n Return a torch tensor of names, where each name has been converted to a sequence of ids and the ids have been one-hot encoded.\n Also return the tensor where the names have been converted to a sequence of ids but before t... |
9a63606ec6ac39742249ac42590ae5d4f5b4fd8b68d5bd70760a8f11466c912e | def train_swivel_encoder(model, X_train, X_targets, num_epochs=100, batch_size=64, lr=0.01, use_adam_opt=False, use_mse_loss=False, verbose=True, optimizer=None, checkpoint_path=None):
'\n Train the SwivelEncoder\n :param model: SwivelEncoder model\n :param X_train: list of names\n :param X_targets: lis... | Train the SwivelEncoder
:param model: SwivelEncoder model
:param X_train: list of names
:param X_targets: list of embeddings
:param num_epochs: number of epochs
:param batch_size: batch size
:param lr: learning rate
:param use_adam_opt: if True, use Adam optimizer; otherwise use Adagrad optimizer
:param use_mse_loss: i... | src/models/swivel_encoder.py | train_swivel_encoder | rootsdev/nama | 0 | python | def train_swivel_encoder(model, X_train, X_targets, num_epochs=100, batch_size=64, lr=0.01, use_adam_opt=False, use_mse_loss=False, verbose=True, optimizer=None, checkpoint_path=None):
'\n Train the SwivelEncoder\n :param model: SwivelEncoder model\n :param X_train: list of names\n :param X_targets: lis... | def train_swivel_encoder(model, X_train, X_targets, num_epochs=100, batch_size=64, lr=0.01, use_adam_opt=False, use_mse_loss=False, verbose=True, optimizer=None, checkpoint_path=None):
'\n Train the SwivelEncoder\n :param model: SwivelEncoder model\n :param X_train: list of names\n :param X_targets: lis... |
201df119c138e3ecd19fdd56e889bb79abb0da533de3cc69b9b2520eacde8811 | def forward(self, X):
'\n Generate embeddings for X\n :param X: [batch size, seq length]\n :return: [batch size, seq embedding]\n '
X = X.to(device=self.device)
(batch_size, seq_len) = X.size()
hidden = (torch.randn((self.n_layers * self.n_directions), batch_size, self.n_hidd... | Generate embeddings for X
:param X: [batch size, seq length]
:return: [batch size, seq embedding] | src/models/swivel_encoder.py | forward | rootsdev/nama | 0 | python | def forward(self, X):
'\n Generate embeddings for X\n :param X: [batch size, seq length]\n :return: [batch size, seq embedding]\n '
X = X.to(device=self.device)
(batch_size, seq_len) = X.size()
hidden = (torch.randn((self.n_layers * self.n_directions), batch_size, self.n_hidd... | def forward(self, X):
'\n Generate embeddings for X\n :param X: [batch size, seq length]\n :return: [batch size, seq embedding]\n '
X = X.to(device=self.device)
(batch_size, seq_len) = X.size()
hidden = (torch.randn((self.n_layers * self.n_directions), batch_size, self.n_hidd... |
99a2215f6de40a753c6cf926f95d09447eb85cff1398ff00bd7d52037af25fbd | def __init__(self, **kwargs):
'\n Initializes a new UserAssessmentBaseLineDetails object with values from keyword arguments.\n The following keyword arguments are supported (corresponding to the getters/setters of this class):\n\n :param assessment_ids:\n The value to assign to the a... | Initializes a new UserAssessmentBaseLineDetails object with values from keyword arguments.
The following keyword arguments are supported (corresponding to the getters/setters of this class):
:param assessment_ids:
The value to assign to the assessment_ids property of this UserAssessmentBaseLineDetails.
:type asses... | src/oci/data_safe/models/user_assessment_base_line_details.py | __init__ | Manny27nyc/oci-python-sdk | 249 | python | def __init__(self, **kwargs):
'\n Initializes a new UserAssessmentBaseLineDetails object with values from keyword arguments.\n The following keyword arguments are supported (corresponding to the getters/setters of this class):\n\n :param assessment_ids:\n The value to assign to the a... | def __init__(self, **kwargs):
'\n Initializes a new UserAssessmentBaseLineDetails object with values from keyword arguments.\n The following keyword arguments are supported (corresponding to the getters/setters of this class):\n\n :param assessment_ids:\n The value to assign to the a... |
93c51beb9f6ef2087b085d1f4d4a8fc49b55c53fe9c7a673e4c73ad1e78f4700 | @property
def assessment_ids(self):
'\n Gets the assessment_ids of this UserAssessmentBaseLineDetails.\n The list of user assessment OCIDs that need to be updated while setting the baseline.\n\n\n :return: The assessment_ids of this UserAssessmentBaseLineDetails.\n :rtype: list[str]\n ... | Gets the assessment_ids of this UserAssessmentBaseLineDetails.
The list of user assessment OCIDs that need to be updated while setting the baseline.
:return: The assessment_ids of this UserAssessmentBaseLineDetails.
:rtype: list[str] | src/oci/data_safe/models/user_assessment_base_line_details.py | assessment_ids | Manny27nyc/oci-python-sdk | 249 | python | @property
def assessment_ids(self):
'\n Gets the assessment_ids of this UserAssessmentBaseLineDetails.\n The list of user assessment OCIDs that need to be updated while setting the baseline.\n\n\n :return: The assessment_ids of this UserAssessmentBaseLineDetails.\n :rtype: list[str]\n ... | @property
def assessment_ids(self):
'\n Gets the assessment_ids of this UserAssessmentBaseLineDetails.\n The list of user assessment OCIDs that need to be updated while setting the baseline.\n\n\n :return: The assessment_ids of this UserAssessmentBaseLineDetails.\n :rtype: list[str]\n ... |
92ff6dad637874be2064e7f91c23ec8b6bb8eff9fd860436f179168e5ab0cfa0 | @assessment_ids.setter
def assessment_ids(self, assessment_ids):
'\n Sets the assessment_ids of this UserAssessmentBaseLineDetails.\n The list of user assessment OCIDs that need to be updated while setting the baseline.\n\n\n :param assessment_ids: The assessment_ids of this UserAssessmentBaseL... | Sets the assessment_ids of this UserAssessmentBaseLineDetails.
The list of user assessment OCIDs that need to be updated while setting the baseline.
:param assessment_ids: The assessment_ids of this UserAssessmentBaseLineDetails.
:type: list[str] | src/oci/data_safe/models/user_assessment_base_line_details.py | assessment_ids | Manny27nyc/oci-python-sdk | 249 | python | @assessment_ids.setter
def assessment_ids(self, assessment_ids):
'\n Sets the assessment_ids of this UserAssessmentBaseLineDetails.\n The list of user assessment OCIDs that need to be updated while setting the baseline.\n\n\n :param assessment_ids: The assessment_ids of this UserAssessmentBaseL... | @assessment_ids.setter
def assessment_ids(self, assessment_ids):
'\n Sets the assessment_ids of this UserAssessmentBaseLineDetails.\n The list of user assessment OCIDs that need to be updated while setting the baseline.\n\n\n :param assessment_ids: The assessment_ids of this UserAssessmentBaseL... |
ab8009a65305111cebe768c0af084e07beff90fd91c737d9f1876ce81910b9ce | def is_uuid(string):
"检查字符串是不是合法的 UUID。validate if string is a valid uuid.\n\n Examples::\n\n if is_uuid('wrong string'): ...\n\n :rtype: bool\n "
try:
return bool((string and (uuid.UUID(string).hex == string)))
except ValueError:
return False | 检查字符串是不是合法的 UUID。validate if string is a valid uuid.
Examples::
if is_uuid('wrong string'): ...
:rtype: bool | hutils/validators.py | is_uuid | zaihui/hutils | 30 | python | def is_uuid(string):
"检查字符串是不是合法的 UUID。validate if string is a valid uuid.\n\n Examples::\n\n if is_uuid('wrong string'): ...\n\n :rtype: bool\n "
try:
return bool((string and (uuid.UUID(string).hex == string)))
except ValueError:
return False | def is_uuid(string):
"检查字符串是不是合法的 UUID。validate if string is a valid uuid.\n\n Examples::\n\n if is_uuid('wrong string'): ...\n\n :rtype: bool\n "
try:
return bool((string and (uuid.UUID(string).hex == string)))
except ValueError:
return False<|docstring|>检查字符串是不是合法的 UUID。val... |
173a71f74f749aa343fd0749db8e752a1bb895f734e490c065a0b9175cfb656f | def is_int(string):
"检查字符串是不是合法的 int. validate if string is a valid int.\n\n Examples::\n\n if is_int('wrong string'): ...\n\n :rtype: bool\n "
try:
int(string)
return True
except ValueError:
return False | 检查字符串是不是合法的 int. validate if string is a valid int.
Examples::
if is_int('wrong string'): ...
:rtype: bool | hutils/validators.py | is_int | zaihui/hutils | 30 | python | def is_int(string):
"检查字符串是不是合法的 int. validate if string is a valid int.\n\n Examples::\n\n if is_int('wrong string'): ...\n\n :rtype: bool\n "
try:
int(string)
return True
except ValueError:
return False | def is_int(string):
"检查字符串是不是合法的 int. validate if string is a valid int.\n\n Examples::\n\n if is_int('wrong string'): ...\n\n :rtype: bool\n "
try:
int(string)
return True
except ValueError:
return False<|docstring|>检查字符串是不是合法的 int. validate if string is a valid int.... |
8194982494e81da0c5d849dbc0561a053dffc73498a693e1316983fd8d33355e | def is_chinese_phone(string):
"检查字符串是不是合法的大陆手机号。validate if string is a valid chinese mainland phone number.\n\n Examples::\n\n if is_chinese_phone('12345678910'): ...\n\n :rtype: bool\n "
return bool(CHINESE_PHONE_REGEX.match(string)) | 检查字符串是不是合法的大陆手机号。validate if string is a valid chinese mainland phone number.
Examples::
if is_chinese_phone('12345678910'): ...
:rtype: bool | hutils/validators.py | is_chinese_phone | zaihui/hutils | 30 | python | def is_chinese_phone(string):
"检查字符串是不是合法的大陆手机号。validate if string is a valid chinese mainland phone number.\n\n Examples::\n\n if is_chinese_phone('12345678910'): ...\n\n :rtype: bool\n "
return bool(CHINESE_PHONE_REGEX.match(string)) | def is_chinese_phone(string):
"检查字符串是不是合法的大陆手机号。validate if string is a valid chinese mainland phone number.\n\n Examples::\n\n if is_chinese_phone('12345678910'): ...\n\n :rtype: bool\n "
return bool(CHINESE_PHONE_REGEX.match(string))<|docstring|>检查字符串是不是合法的大陆手机号。validate if string is a valid c... |
68daf6bec344bc35476ca10d38c28f82c5635b902552570c9ae0b71cb236a8d0 | def is_singapore_phone(string):
"检查字符串是不是合法的新加坡手机号。validate if string is a valid singapore phone number.\n\n Examples::\n\n if is_singapore_phone('12345678910'): ...\n\n :rtype: bool\n "
return bool(SINGAPORE_PHONE_REGEX.match(string)) | 检查字符串是不是合法的新加坡手机号。validate if string is a valid singapore phone number.
Examples::
if is_singapore_phone('12345678910'): ...
:rtype: bool | hutils/validators.py | is_singapore_phone | zaihui/hutils | 30 | python | def is_singapore_phone(string):
"检查字符串是不是合法的新加坡手机号。validate if string is a valid singapore phone number.\n\n Examples::\n\n if is_singapore_phone('12345678910'): ...\n\n :rtype: bool\n "
return bool(SINGAPORE_PHONE_REGEX.match(string)) | def is_singapore_phone(string):
"检查字符串是不是合法的新加坡手机号。validate if string is a valid singapore phone number.\n\n Examples::\n\n if is_singapore_phone('12345678910'): ...\n\n :rtype: bool\n "
return bool(SINGAPORE_PHONE_REGEX.match(string))<|docstring|>检查字符串是不是合法的新加坡手机号。validate if string is a valid ... |
7af030753ae6c90fc07e4ddc4978d0ded4d9c933494026eaa677376c0f847255 | def is_phone(string):
"检查字符串是不是合法的手机号 validate if string is a valid phone number.\n\n Examples::\n\n if is_phone('12345678910'): ...\n\n :rtype: bool\n "
return any([is_chinese_phone(string), is_singapore_phone(string)]) | 检查字符串是不是合法的手机号 validate if string is a valid phone number.
Examples::
if is_phone('12345678910'): ...
:rtype: bool | hutils/validators.py | is_phone | zaihui/hutils | 30 | python | def is_phone(string):
"检查字符串是不是合法的手机号 validate if string is a valid phone number.\n\n Examples::\n\n if is_phone('12345678910'): ...\n\n :rtype: bool\n "
return any([is_chinese_phone(string), is_singapore_phone(string)]) | def is_phone(string):
"检查字符串是不是合法的手机号 validate if string is a valid phone number.\n\n Examples::\n\n if is_phone('12345678910'): ...\n\n :rtype: bool\n "
return any([is_chinese_phone(string), is_singapore_phone(string)])<|docstring|>检查字符串是不是合法的手机号 validate if string is a valid phone number.
Exa... |
933d17d3ac0e4081dfeee8083f2394556e7c85657d4d5d70a2669b402d7f8840 | def weighted_hamming_distance(s1: List[int], s2: List[int], missing_state_indicator=(- 1), weights: Optional[Dict[(int, Dict[(int, float)])]]=None) -> float:
'Computes the weighted hamming distance between samples.\n\n Evaluates the dissimilarity of two phylogenetic samples on the basis of\n their shared inde... | Computes the weighted hamming distance between samples.
Evaluates the dissimilarity of two phylogenetic samples on the basis of
their shared indel states and the probability of these indel states
occurring. Specifically, for a given character, if two states are identical
we decrement the dissimilarity by the probabili... | cassiopeia/solver/dissimilarity_functions.py | weighted_hamming_distance | YosefLab/Cassiopeia | 52 | python | def weighted_hamming_distance(s1: List[int], s2: List[int], missing_state_indicator=(- 1), weights: Optional[Dict[(int, Dict[(int, float)])]]=None) -> float:
'Computes the weighted hamming distance between samples.\n\n Evaluates the dissimilarity of two phylogenetic samples on the basis of\n their shared inde... | def weighted_hamming_distance(s1: List[int], s2: List[int], missing_state_indicator=(- 1), weights: Optional[Dict[(int, Dict[(int, float)])]]=None) -> float:
'Computes the weighted hamming distance between samples.\n\n Evaluates the dissimilarity of two phylogenetic samples on the basis of\n their shared inde... |
7ddc65d954467861a231f066afbeb71623991d1850341c936e92eeaec68adbe5 | def hamming_similarity_without_missing(s1: List[int], s2: List[int], missing_state_indicator: int, weights: Optional[Dict[(int, Dict[(int, float)])]]=None) -> float:
'A function to return the number of (non-missing) character/state\n mutations shared by two samples.\n\n Args:\n s1: Character states of ... | A function to return the number of (non-missing) character/state
mutations shared by two samples.
Args:
s1: Character states of the first sample
s2: Character states of the second sample
missing_state_indicator: The character representing missing values
weights: A set of optional weights to weight the ... | cassiopeia/solver/dissimilarity_functions.py | hamming_similarity_without_missing | YosefLab/Cassiopeia | 52 | python | def hamming_similarity_without_missing(s1: List[int], s2: List[int], missing_state_indicator: int, weights: Optional[Dict[(int, Dict[(int, float)])]]=None) -> float:
'A function to return the number of (non-missing) character/state\n mutations shared by two samples.\n\n Args:\n s1: Character states of ... | def hamming_similarity_without_missing(s1: List[int], s2: List[int], missing_state_indicator: int, weights: Optional[Dict[(int, Dict[(int, float)])]]=None) -> float:
'A function to return the number of (non-missing) character/state\n mutations shared by two samples.\n\n Args:\n s1: Character states of ... |
f691888bf9ff56cf7f4ab0aa2187019669a4b634262807471b83835b7167d9cb | def hamming_similarity_normalized_over_missing(s1: List[int], s2: List[int], missing_state_indicator: int, weights: Optional[Dict[(int, Dict[(int, float)])]]=None) -> float:
'\n A function to return the number of (non-missing) character/state mutations\n shared by two samples, normalized over the amount of mi... | A function to return the number of (non-missing) character/state mutations
shared by two samples, normalized over the amount of missing data.
Args:
s1: Character states of the first sample
s2: Character states of the second sample
missing_state_indicator: The character representing missing values
weigh... | cassiopeia/solver/dissimilarity_functions.py | hamming_similarity_normalized_over_missing | YosefLab/Cassiopeia | 52 | python | def hamming_similarity_normalized_over_missing(s1: List[int], s2: List[int], missing_state_indicator: int, weights: Optional[Dict[(int, Dict[(int, float)])]]=None) -> float:
'\n A function to return the number of (non-missing) character/state mutations\n shared by two samples, normalized over the amount of mi... | def hamming_similarity_normalized_over_missing(s1: List[int], s2: List[int], missing_state_indicator: int, weights: Optional[Dict[(int, Dict[(int, float)])]]=None) -> float:
'\n A function to return the number of (non-missing) character/state mutations\n shared by two samples, normalized over the amount of mi... |
6f25e4a8c45486c84717155e21f7ef74bde51489acaa2869767d15d7affeecce | @numba.jit(nopython=True)
def hamming_distance(s1: np.array(int), s2: np.array(int), ignore_missing_state: bool=False, missing_state_indicator: int=(- 1)) -> int:
'Computes the vanilla hamming distance between two samples.\n\n Counts the number of positions that two samples disagree at. A user can\n optionall... | Computes the vanilla hamming distance between two samples.
Counts the number of positions that two samples disagree at. A user can
optionally specify to ignore missing data.
Args:
s1: The first sample
s2: The second sample
ignore_missing_state: Ignore comparisons where one is the missing state
ind... | cassiopeia/solver/dissimilarity_functions.py | hamming_distance | YosefLab/Cassiopeia | 52 | python | @numba.jit(nopython=True)
def hamming_distance(s1: np.array(int), s2: np.array(int), ignore_missing_state: bool=False, missing_state_indicator: int=(- 1)) -> int:
'Computes the vanilla hamming distance between two samples.\n\n Counts the number of positions that two samples disagree at. A user can\n optionall... | @numba.jit(nopython=True)
def hamming_distance(s1: np.array(int), s2: np.array(int), ignore_missing_state: bool=False, missing_state_indicator: int=(- 1)) -> int:
'Computes the vanilla hamming distance between two samples.\n\n Counts the number of positions that two samples disagree at. A user can\n optionall... |
09cee579294092e972ef0a95730a3c6820fea23f216fc4ff7a32430c0064c326 | def weighted_hamming_similarity(s1: List[int], s2: List[int], missing_state_indicator: int, weights: Optional[Dict[(int, Dict[(int, float)])]]=None) -> float:
'A function to return the weighted number of (non-missing) character/state\n mutations shared by two samples.\n\n Args:\n s1: Character states o... | A function to return the weighted number of (non-missing) character/state
mutations shared by two samples.
Args:
s1: Character states of the first sample
s2: Character states of the second sample
missing_state_indicator: The character representing missing values
weights: A set of optional weights to we... | cassiopeia/solver/dissimilarity_functions.py | weighted_hamming_similarity | YosefLab/Cassiopeia | 52 | python | def weighted_hamming_similarity(s1: List[int], s2: List[int], missing_state_indicator: int, weights: Optional[Dict[(int, Dict[(int, float)])]]=None) -> float:
'A function to return the weighted number of (non-missing) character/state\n mutations shared by two samples.\n\n Args:\n s1: Character states o... | def weighted_hamming_similarity(s1: List[int], s2: List[int], missing_state_indicator: int, weights: Optional[Dict[(int, Dict[(int, float)])]]=None) -> float:
'A function to return the weighted number of (non-missing) character/state\n mutations shared by two samples.\n\n Args:\n s1: Character states o... |
9d8966dcfaf3efe4dbdc2761fc79ef7adc542a92771989ea6042f2d46d1eab07 | def cluster_dissimilarity(dissimilarity_function: Callable[([List[int], List[int], int, Dict[(int, Dict[(int, float)])]], float)], s1: Union[(List[int], List[Tuple[(int, ...)]])], s2: Union[(List[int], List[Tuple[(int, ...)]])], missing_state_indicator: int, weights: Optional[Dict[(int, Dict[(int, float)])]]=None, link... | Compute the dissimilarity between (possibly) ambiguous character strings.
An ambiguous character string is a character string in
which each character contains an tuple of possible states, and such a
character string is represented as a list of tuples of integers.
A naive implementation is to first disambiguate each o... | cassiopeia/solver/dissimilarity_functions.py | cluster_dissimilarity | YosefLab/Cassiopeia | 52 | python | def cluster_dissimilarity(dissimilarity_function: Callable[([List[int], List[int], int, Dict[(int, Dict[(int, float)])]], float)], s1: Union[(List[int], List[Tuple[(int, ...)]])], s2: Union[(List[int], List[Tuple[(int, ...)]])], missing_state_indicator: int, weights: Optional[Dict[(int, Dict[(int, float)])]]=None, link... | def cluster_dissimilarity(dissimilarity_function: Callable[([List[int], List[int], int, Dict[(int, Dict[(int, float)])]], float)], s1: Union[(List[int], List[Tuple[(int, ...)]])], s2: Union[(List[int], List[Tuple[(int, ...)]])], missing_state_indicator: int, weights: Optional[Dict[(int, Dict[(int, float)])]]=None, link... |
4bff8b8d065290e11cf96eac686697dfbdde9903dc2e26e4f48ca174a2a0caa1 | @pytest.fixture(scope='session')
def logger():
'Logger object with log file and colorful console output'
return LOGGER | Logger object with log file and colorful console output | tests/conftest.py | logger | DeFi-Coder-News-Letter/StormSurge-pydex | 28 | python | @pytest.fixture(scope='session')
def logger():
return LOGGER | @pytest.fixture(scope='session')
def logger():
return LOGGER<|docstring|>Logger object with log file and colorful console output<|endoftext|> |
84d1f6609924ebb42502f59b19fb07f6f93483346c219331ed2f7f399f9a82d6 | @pytest.fixture(scope='session')
def asset_infos():
'A convenience object for holding all asset info needed for testing.\n Ideally, need to enhance this later to dynamically pull this information\n from the configured network.\n '
class AssetInfos():
'Convenience class holding asset info'
... | A convenience object for holding all asset info needed for testing.
Ideally, need to enhance this later to dynamically pull this information
from the configured network. | tests/conftest.py | asset_infos | DeFi-Coder-News-Letter/StormSurge-pydex | 28 | python | @pytest.fixture(scope='session')
def asset_infos():
'A convenience object for holding all asset info needed for testing.\n Ideally, need to enhance this later to dynamically pull this information\n from the configured network.\n '
class AssetInfos():
'Convenience class holding asset info'
... | @pytest.fixture(scope='session')
def asset_infos():
'A convenience object for holding all asset info needed for testing.\n Ideally, need to enhance this later to dynamically pull this information\n from the configured network.\n '
class AssetInfos():
'Convenience class holding asset info'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.