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
14daa325ca4d15df21524a64fff5f095a48b1a11696e8b986ff787c6a4dfad88
@fresh_jwt_required def demand_lists(): '获取需求列表\n\n GET /api/demand/list\n ' demand_list = Demand.select().where((Demand.status == 0)).dicts().get() return list(demand_list)
获取需求列表 GET /api/demand/list
api/controller/demand.py
demand_lists
preservance717/pms
27
python
@fresh_jwt_required def demand_lists(): '获取需求列表\n\n GET /api/demand/list\n ' demand_list = Demand.select().where((Demand.status == 0)).dicts().get() return list(demand_list)
@fresh_jwt_required def demand_lists(): '获取需求列表\n\n GET /api/demand/list\n ' demand_list = Demand.select().where((Demand.status == 0)).dicts().get() return list(demand_list)<|docstring|>获取需求列表 GET /api/demand/list<|endoftext|>
10fc10767a0d067800853cd0b943fb158cf68597ce656d5f49fe0f5ea1090b99
def __init__(self): '\n Initialize your data structure here.\n ' self.nums = [] self.is_sorted = False
Initialize your data structure here.
Arrays/170. Two Sum III - Data structure design.py
__init__
thewires2/Leetcode
1
python
def __init__(self): '\n \n ' self.nums = [] self.is_sorted = False
def __init__(self): '\n \n ' self.nums = [] self.is_sorted = False<|docstring|>Initialize your data structure here.<|endoftext|>
2931a619bc86badc0c3de693ec58b7695b80a77408971fd2e4f445b60fd24dd1
def add(self, number): '\n Add the number to an internal data structure..\n :type number: int\n :rtype: None\n ' self.nums.append(number) self.is_sorted = False
Add the number to an internal data structure.. :type number: int :rtype: None
Arrays/170. Two Sum III - Data structure design.py
add
thewires2/Leetcode
1
python
def add(self, number): '\n Add the number to an internal data structure..\n :type number: int\n :rtype: None\n ' self.nums.append(number) self.is_sorted = False
def add(self, number): '\n Add the number to an internal data structure..\n :type number: int\n :rtype: None\n ' self.nums.append(number) self.is_sorted = False<|docstring|>Add the number to an internal data structure.. :type number: int :rtype: None<|endoftext|>
46c5c2cae08d4141aad35d57078c7c09e73eb305039ba85f0b9c0d516c3910b2
def find(self, value): '\n Find if there exists any pair of numbers which sum is equal to the value.\n :type value: int\n :rtype: bool\n ' if (not self.is_sorted): self.nums.sort() self.is_sorted = True (low, high) = (0, (len(self.nums) - 1)) while (low < high): currSum = (self.nums[low] + self.nums[high]) if (currSum < value): low += 1 elif (currSum > value): high -= 1 else: return True return False
Find if there exists any pair of numbers which sum is equal to the value. :type value: int :rtype: bool
Arrays/170. Two Sum III - Data structure design.py
find
thewires2/Leetcode
1
python
def find(self, value): '\n Find if there exists any pair of numbers which sum is equal to the value.\n :type value: int\n :rtype: bool\n ' if (not self.is_sorted): self.nums.sort() self.is_sorted = True (low, high) = (0, (len(self.nums) - 1)) while (low < high): currSum = (self.nums[low] + self.nums[high]) if (currSum < value): low += 1 elif (currSum > value): high -= 1 else: return True return False
def find(self, value): '\n Find if there exists any pair of numbers which sum is equal to the value.\n :type value: int\n :rtype: bool\n ' if (not self.is_sorted): self.nums.sort() self.is_sorted = True (low, high) = (0, (len(self.nums) - 1)) while (low < high): currSum = (self.nums[low] + self.nums[high]) if (currSum < value): low += 1 elif (currSum > value): high -= 1 else: return True return False<|docstring|>Find if there exists any pair of numbers which sum is equal to the value. :type value: int :rtype: bool<|endoftext|>
d4d3945bc26ec1b76e8991931b20de6551cf06fbef3061488d4f0de42d15a8c4
def test_basic_init(self): 'TODO.' task = Task('Runnable', module=__name__) result = 'result' for task_result in (TaskResult(task, result, True, None, None), TaskResult(task, result, True, 'msg', None), TaskResult(task, result, True, None, [Task('Runnable', module=__name__)])): serialized = task_result.dumps() new_task_result = TaskResult().loads(serialized) for attr in ('_result', 'status', '_reason', '_uid'): task_result_attr = getattr(task_result, attr) new_task_result_attr = getattr(new_task_result, attr) assert (task_result_attr == new_task_result_attr) assert (task_result._task._uid == new_task_result._task._uid) if (task_result.follow is None): assert (task_result.follow == new_task_result.follow) else: assert (len(task_result.follow) == len(new_task_result.follow)) for (idx, task) in enumerate(task_result.follow): assert (task._uid == new_task_result.follow[idx]._uid)
TODO.
tests/unit/testplan/runners/pools/tasks/test_task_results.py
test_basic_init
Pyifan/testplan
96
python
def test_basic_init(self): task = Task('Runnable', module=__name__) result = 'result' for task_result in (TaskResult(task, result, True, None, None), TaskResult(task, result, True, 'msg', None), TaskResult(task, result, True, None, [Task('Runnable', module=__name__)])): serialized = task_result.dumps() new_task_result = TaskResult().loads(serialized) for attr in ('_result', 'status', '_reason', '_uid'): task_result_attr = getattr(task_result, attr) new_task_result_attr = getattr(new_task_result, attr) assert (task_result_attr == new_task_result_attr) assert (task_result._task._uid == new_task_result._task._uid) if (task_result.follow is None): assert (task_result.follow == new_task_result.follow) else: assert (len(task_result.follow) == len(new_task_result.follow)) for (idx, task) in enumerate(task_result.follow): assert (task._uid == new_task_result.follow[idx]._uid)
def test_basic_init(self): task = Task('Runnable', module=__name__) result = 'result' for task_result in (TaskResult(task, result, True, None, None), TaskResult(task, result, True, 'msg', None), TaskResult(task, result, True, None, [Task('Runnable', module=__name__)])): serialized = task_result.dumps() new_task_result = TaskResult().loads(serialized) for attr in ('_result', 'status', '_reason', '_uid'): task_result_attr = getattr(task_result, attr) new_task_result_attr = getattr(new_task_result, attr) assert (task_result_attr == new_task_result_attr) assert (task_result._task._uid == new_task_result._task._uid) if (task_result.follow is None): assert (task_result.follow == new_task_result.follow) else: assert (len(task_result.follow) == len(new_task_result.follow)) for (idx, task) in enumerate(task_result.follow): assert (task._uid == new_task_result.follow[idx]._uid)<|docstring|>TODO.<|endoftext|>
694528fce879a5881ea58556151d7fb796a70b747d9cb4c17bf2e5944f95a881
def query_etym_online(query: str, verbose: bool=False) -> str: 'Perform lookup on etymonline.com.' r = requests.get('https://www.etymonline.com/index.php?search={}'.format(query)) soup = BeautifulSoup(r.content, features='html.parser') try: hit = soup.find_all('p')[0].contents except IndexError: raise NoResultsFound(query) s = beautify(hit) if (s == 'links'): raise NoResultsFound(query) return s
Perform lookup on etymonline.com.
etym/utils.py
query_etym_online
conorsch/etym
13
python
def query_etym_online(query: str, verbose: bool=False) -> str: r = requests.get('https://www.etymonline.com/index.php?search={}'.format(query)) soup = BeautifulSoup(r.content, features='html.parser') try: hit = soup.find_all('p')[0].contents except IndexError: raise NoResultsFound(query) s = beautify(hit) if (s == 'links'): raise NoResultsFound(query) return s
def query_etym_online(query: str, verbose: bool=False) -> str: r = requests.get('https://www.etymonline.com/index.php?search={}'.format(query)) soup = BeautifulSoup(r.content, features='html.parser') try: hit = soup.find_all('p')[0].contents except IndexError: raise NoResultsFound(query) s = beautify(hit) if (s == 'links'): raise NoResultsFound(query) return s<|docstring|>Perform lookup on etymonline.com.<|endoftext|>
8610596937d39b56b697d6a1998f06944770174acd05321e81b24dc7f8a96eac
def beautify(soup: BeautifulSoup, rich_terminal: bool=True) -> str: "\n Cleans up the raw HTML so it's more presentable.\n Parse BeautifulSoup HTML and return prettified string\n " beautifiedText = str() for i in soup: if rich_terminal: term = Terminal() span_sub = '{t.italic}\\1{t.normal}'.format(t=term) strong_sub = '{t.bold}\\1{t.normal}'.format(t=term) else: span_sub = '\\1' strong_sub = '\\1' i = re.sub('<span class="\\w+">(.+)</span>', span_sub, str(i)) i = re.sub('<strong>(.+)</strong>', strong_sub, str(i)) beautifiedText += (' ' + i) beautifiedText = re.sub('^\\s+', '', beautifiedText) beautifiedText = re.sub('\\s{2,}', ' ', beautifiedText) beautifiedText = re.sub('\\s+([,\\)\\].;:])', '\\g<1>', beautifiedText) beautifiedText = re.sub('([\\(])\\s+', '\\g<1>', beautifiedText) return beautifiedText
Cleans up the raw HTML so it's more presentable. Parse BeautifulSoup HTML and return prettified string
etym/utils.py
beautify
conorsch/etym
13
python
def beautify(soup: BeautifulSoup, rich_terminal: bool=True) -> str: "\n Cleans up the raw HTML so it's more presentable.\n Parse BeautifulSoup HTML and return prettified string\n " beautifiedText = str() for i in soup: if rich_terminal: term = Terminal() span_sub = '{t.italic}\\1{t.normal}'.format(t=term) strong_sub = '{t.bold}\\1{t.normal}'.format(t=term) else: span_sub = '\\1' strong_sub = '\\1' i = re.sub('<span class="\\w+">(.+)</span>', span_sub, str(i)) i = re.sub('<strong>(.+)</strong>', strong_sub, str(i)) beautifiedText += (' ' + i) beautifiedText = re.sub('^\\s+', , beautifiedText) beautifiedText = re.sub('\\s{2,}', ' ', beautifiedText) beautifiedText = re.sub('\\s+([,\\)\\].;:])', '\\g<1>', beautifiedText) beautifiedText = re.sub('([\\(])\\s+', '\\g<1>', beautifiedText) return beautifiedText
def beautify(soup: BeautifulSoup, rich_terminal: bool=True) -> str: "\n Cleans up the raw HTML so it's more presentable.\n Parse BeautifulSoup HTML and return prettified string\n " beautifiedText = str() for i in soup: if rich_terminal: term = Terminal() span_sub = '{t.italic}\\1{t.normal}'.format(t=term) strong_sub = '{t.bold}\\1{t.normal}'.format(t=term) else: span_sub = '\\1' strong_sub = '\\1' i = re.sub('<span class="\\w+">(.+)</span>', span_sub, str(i)) i = re.sub('<strong>(.+)</strong>', strong_sub, str(i)) beautifiedText += (' ' + i) beautifiedText = re.sub('^\\s+', , beautifiedText) beautifiedText = re.sub('\\s{2,}', ' ', beautifiedText) beautifiedText = re.sub('\\s+([,\\)\\].;:])', '\\g<1>', beautifiedText) beautifiedText = re.sub('([\\(])\\s+', '\\g<1>', beautifiedText) return beautifiedText<|docstring|>Cleans up the raw HTML so it's more presentable. Parse BeautifulSoup HTML and return prettified string<|endoftext|>
d08da78a1e3ca50bb813b1bea144eb1a003ffe60f1f467f6d27fb94b67f023e7
async def set_permissions(self, *, server_permissions: Optional[ServerPermissions]=None, channel_permissions: Optional[ChannelPermissions]=None) -> None: 'Sets the permissions for a role in a server.' if ((not server_permissions) and (not channel_permissions)): return server_value = (server_permissions or self.server_permissions).value channel_value = (channel_permissions or self.channel_permissions).value (await self._cache.api.set_role_permissions(self.server.id, self.id, server_value, channel_value))
Sets the permissions for a role in a server.
pyvolt/models/role.py
set_permissions
Gael-devv/Pyvolt
0
python
async def set_permissions(self, *, server_permissions: Optional[ServerPermissions]=None, channel_permissions: Optional[ChannelPermissions]=None) -> None: if ((not server_permissions) and (not channel_permissions)): return server_value = (server_permissions or self.server_permissions).value channel_value = (channel_permissions or self.channel_permissions).value (await self._cache.api.set_role_permissions(self.server.id, self.id, server_value, channel_value))
async def set_permissions(self, *, server_permissions: Optional[ServerPermissions]=None, channel_permissions: Optional[ChannelPermissions]=None) -> None: if ((not server_permissions) and (not channel_permissions)): return server_value = (server_permissions or self.server_permissions).value channel_value = (channel_permissions or self.channel_permissions).value (await self._cache.api.set_role_permissions(self.server.id, self.id, server_value, channel_value))<|docstring|>Sets the permissions for a role in a server.<|endoftext|>
248abaaca361f4ec9825c91fd0a3cd2dc8bbf07858a1e26c5d7fbe25df92ec2d
async def delete(self) -> None: 'Deletes the role' (await self._cache.api.delete_role(self.server.id, self.id))
Deletes the role
pyvolt/models/role.py
delete
Gael-devv/Pyvolt
0
python
async def delete(self) -> None: (await self._cache.api.delete_role(self.server.id, self.id))
async def delete(self) -> None: (await self._cache.api.delete_role(self.server.id, self.id))<|docstring|>Deletes the role<|endoftext|>
ba491cd7b38f035707b54dd565d547f70fc3419cf58b9b2f6af2b4e98a24b750
async def edit(self, **kwargs) -> None: 'Edits the role' if (kwargs.get('colour', MISSING) == None): kwargs['remove_colour'] = True (await self._cache.api.edit_role(self.server.id, self.id, **kwargs))
Edits the role
pyvolt/models/role.py
edit
Gael-devv/Pyvolt
0
python
async def edit(self, **kwargs) -> None: if (kwargs.get('colour', MISSING) == None): kwargs['remove_colour'] = True (await self._cache.api.edit_role(self.server.id, self.id, **kwargs))
async def edit(self, **kwargs) -> None: if (kwargs.get('colour', MISSING) == None): kwargs['remove_colour'] = True (await self._cache.api.edit_role(self.server.id, self.id, **kwargs))<|docstring|>Edits the role<|endoftext|>
a21f0beed325b5cb44d2b3621f1d9e2d13aec42e599ef0fd02b5535d9b7b94f4
def save_admin(session, c_user, fb_dtsg, thread_id, admin_id, add): '\n Only for group thread.\n\n thread_id: `str`\n\n admin_id: `str` or `list`\n\n add: `bool`. make admin or remove\n ' referer = 'https://www.messenger.com/t/{}'.format(thread_id) header = Header.create('origin', 'accept-language', 'user-agent', 'content-type', others={'accept-encoding': 'gzip, deflate', 'x-msgr-region': 'ATN', 'cache-control': 'no-cache', 'referer': referer}) payload = {'thread_fbid': thread_id, 'add': add, '__user': c_user, '__a': 1, '__dyn': Payload.DYN, '__req': '1h', '__be': (- 1), '__pc': 'PHASED:messengerdotcom_pkg', '__rev': 4056466, 'fb_dtsg': fb_dtsg, 'jazoest': Payload.JAZOEST} pamars = {'dpr': 1.5} if (type(admin_id) is str): admin_id = [admin_id] for (i, a_id) in enumerate(admin_id): payload['admin_ids[{}]'.format(i)] = a_id try: r = session.post('https://www.messenger.com/messaging/save_admins/', headers=header, data=payload, params=pamars) return utils.check_result(r.text, 'You might not be a admin.') except exceptions.RequestException: logging.warning('{} fail'.format(save_admin.__name__))
Only for group thread. thread_id: `str` admin_id: `str` or `list` add: `bool`. make admin or remove
messenger/setting/admin.py
save_admin
brian41005/Python-Messenger-Wrapper
9
python
def save_admin(session, c_user, fb_dtsg, thread_id, admin_id, add): '\n Only for group thread.\n\n thread_id: `str`\n\n admin_id: `str` or `list`\n\n add: `bool`. make admin or remove\n ' referer = 'https://www.messenger.com/t/{}'.format(thread_id) header = Header.create('origin', 'accept-language', 'user-agent', 'content-type', others={'accept-encoding': 'gzip, deflate', 'x-msgr-region': 'ATN', 'cache-control': 'no-cache', 'referer': referer}) payload = {'thread_fbid': thread_id, 'add': add, '__user': c_user, '__a': 1, '__dyn': Payload.DYN, '__req': '1h', '__be': (- 1), '__pc': 'PHASED:messengerdotcom_pkg', '__rev': 4056466, 'fb_dtsg': fb_dtsg, 'jazoest': Payload.JAZOEST} pamars = {'dpr': 1.5} if (type(admin_id) is str): admin_id = [admin_id] for (i, a_id) in enumerate(admin_id): payload['admin_ids[{}]'.format(i)] = a_id try: r = session.post('https://www.messenger.com/messaging/save_admins/', headers=header, data=payload, params=pamars) return utils.check_result(r.text, 'You might not be a admin.') except exceptions.RequestException: logging.warning('{} fail'.format(save_admin.__name__))
def save_admin(session, c_user, fb_dtsg, thread_id, admin_id, add): '\n Only for group thread.\n\n thread_id: `str`\n\n admin_id: `str` or `list`\n\n add: `bool`. make admin or remove\n ' referer = 'https://www.messenger.com/t/{}'.format(thread_id) header = Header.create('origin', 'accept-language', 'user-agent', 'content-type', others={'accept-encoding': 'gzip, deflate', 'x-msgr-region': 'ATN', 'cache-control': 'no-cache', 'referer': referer}) payload = {'thread_fbid': thread_id, 'add': add, '__user': c_user, '__a': 1, '__dyn': Payload.DYN, '__req': '1h', '__be': (- 1), '__pc': 'PHASED:messengerdotcom_pkg', '__rev': 4056466, 'fb_dtsg': fb_dtsg, 'jazoest': Payload.JAZOEST} pamars = {'dpr': 1.5} if (type(admin_id) is str): admin_id = [admin_id] for (i, a_id) in enumerate(admin_id): payload['admin_ids[{}]'.format(i)] = a_id try: r = session.post('https://www.messenger.com/messaging/save_admins/', headers=header, data=payload, params=pamars) return utils.check_result(r.text, 'You might not be a admin.') except exceptions.RequestException: logging.warning('{} fail'.format(save_admin.__name__))<|docstring|>Only for group thread. thread_id: `str` admin_id: `str` or `list` add: `bool`. make admin or remove<|endoftext|>
54f30b80e263784324da052d4d56cb68a19145cc41f364ad0412dc5c5e56f88c
def make_token(payload, expires_in=600): 'Encode an arbitrary payload into a JWT token.' secret = current_app.config.get('JWT_SECRET_KEY') if (secret is None): raise RuntimeError('application must have JWT_SECRET_KEY set') return _jwt_token(payload, secret, expires_in=expires_in).decode('ascii')
Encode an arbitrary payload into a JWT token.
cubbie/auth.py
make_token
rjw57/cubbie
0
python
def make_token(payload, expires_in=600): secret = current_app.config.get('JWT_SECRET_KEY') if (secret is None): raise RuntimeError('application must have JWT_SECRET_KEY set') return _jwt_token(payload, secret, expires_in=expires_in).decode('ascii')
def make_token(payload, expires_in=600): secret = current_app.config.get('JWT_SECRET_KEY') if (secret is None): raise RuntimeError('application must have JWT_SECRET_KEY set') return _jwt_token(payload, secret, expires_in=expires_in).decode('ascii')<|docstring|>Encode an arbitrary payload into a JWT token.<|endoftext|>
b68ebd38f42be0093d8589336d963811d2400e503cbdf08b833cadce22d0a52b
def make_user_token(user, expires_in=3600): 'Generate an authorization token for the given user. The user must be an\n instance of cubbie.model.User.\n\n ' return make_token(dict(user=user.id), expires_in=expires_in)
Generate an authorization token for the given user. The user must be an instance of cubbie.model.User.
cubbie/auth.py
make_user_token
rjw57/cubbie
0
python
def make_user_token(user, expires_in=3600): 'Generate an authorization token for the given user. The user must be an\n instance of cubbie.model.User.\n\n ' return make_token(dict(user=user.id), expires_in=expires_in)
def make_user_token(user, expires_in=3600): 'Generate an authorization token for the given user. The user must be an\n instance of cubbie.model.User.\n\n ' return make_token(dict(user=user.id), expires_in=expires_in)<|docstring|>Generate an authorization token for the given user. The user must be an instance of cubbie.model.User.<|endoftext|>
802f683a07bb4b3d71894232d0611bc0c9208282a6c4803d0b357fa0d4039a9b
def _to_numeric(dt): 'Convert a datetime instance to a numeric date as per JWT spec.' return int((dt - datetime.datetime.utcfromtimestamp(0)).total_seconds())
Convert a datetime instance to a numeric date as per JWT spec.
cubbie/auth.py
_to_numeric
rjw57/cubbie
0
python
def _to_numeric(dt): return int((dt - datetime.datetime.utcfromtimestamp(0)).total_seconds())
def _to_numeric(dt): return int((dt - datetime.datetime.utcfromtimestamp(0)).total_seconds())<|docstring|>Convert a datetime instance to a numeric date as per JWT spec.<|endoftext|>
9d35901ab55143a52ba7fdc1ade50d0b692a7e85e5d7632bb5cb016bc758af7c
def _jwt_token(payload, secret, expires_in=30, with_times=True, **kwargs): "Return a JWT with the given payload. Any remaining keyword args are\n passed to jwt.encode().\n\n If payload is None, an empty payload is used.\n\n If headers is None, no headers are added beyond 'exp' and 'nbf'.\n\n The standard 'exp' and 'nbf' claims are added. In addition, the 'exp' claim\n is added into the header. The 'exp' time is now plus the number of seconds\n specified as expires_in.\n\n Note that if the passed payload has 'exp' and/or 'nbf' claims, these are\n used in preference.\n\n " if (payload is None): payload = {} headers = kwargs.get('headers', {}) if ('headers' in kwargs): del kwargs['headers'] if (secret is None): raise ValueError('Bad secret') if with_times: ext_payload = dict(exp=_to_numeric((datetime.datetime.utcnow() + datetime.timedelta(seconds=expires_in))), nbf=_to_numeric(datetime.datetime.utcnow())) ext_payload.update(payload) payload = ext_payload if ('exp' not in headers): headers['exp'] = ext_payload['exp'] return jwt.encode(payload, secret, headers=headers, **kwargs)
Return a JWT with the given payload. Any remaining keyword args are passed to jwt.encode(). If payload is None, an empty payload is used. If headers is None, no headers are added beyond 'exp' and 'nbf'. The standard 'exp' and 'nbf' claims are added. In addition, the 'exp' claim is added into the header. The 'exp' time is now plus the number of seconds specified as expires_in. Note that if the passed payload has 'exp' and/or 'nbf' claims, these are used in preference.
cubbie/auth.py
_jwt_token
rjw57/cubbie
0
python
def _jwt_token(payload, secret, expires_in=30, with_times=True, **kwargs): "Return a JWT with the given payload. Any remaining keyword args are\n passed to jwt.encode().\n\n If payload is None, an empty payload is used.\n\n If headers is None, no headers are added beyond 'exp' and 'nbf'.\n\n The standard 'exp' and 'nbf' claims are added. In addition, the 'exp' claim\n is added into the header. The 'exp' time is now plus the number of seconds\n specified as expires_in.\n\n Note that if the passed payload has 'exp' and/or 'nbf' claims, these are\n used in preference.\n\n " if (payload is None): payload = {} headers = kwargs.get('headers', {}) if ('headers' in kwargs): del kwargs['headers'] if (secret is None): raise ValueError('Bad secret') if with_times: ext_payload = dict(exp=_to_numeric((datetime.datetime.utcnow() + datetime.timedelta(seconds=expires_in))), nbf=_to_numeric(datetime.datetime.utcnow())) ext_payload.update(payload) payload = ext_payload if ('exp' not in headers): headers['exp'] = ext_payload['exp'] return jwt.encode(payload, secret, headers=headers, **kwargs)
def _jwt_token(payload, secret, expires_in=30, with_times=True, **kwargs): "Return a JWT with the given payload. Any remaining keyword args are\n passed to jwt.encode().\n\n If payload is None, an empty payload is used.\n\n If headers is None, no headers are added beyond 'exp' and 'nbf'.\n\n The standard 'exp' and 'nbf' claims are added. In addition, the 'exp' claim\n is added into the header. The 'exp' time is now plus the number of seconds\n specified as expires_in.\n\n Note that if the passed payload has 'exp' and/or 'nbf' claims, these are\n used in preference.\n\n " if (payload is None): payload = {} headers = kwargs.get('headers', {}) if ('headers' in kwargs): del kwargs['headers'] if (secret is None): raise ValueError('Bad secret') if with_times: ext_payload = dict(exp=_to_numeric((datetime.datetime.utcnow() + datetime.timedelta(seconds=expires_in))), nbf=_to_numeric(datetime.datetime.utcnow())) ext_payload.update(payload) payload = ext_payload if ('exp' not in headers): headers['exp'] = ext_payload['exp'] return jwt.encode(payload, secret, headers=headers, **kwargs)<|docstring|>Return a JWT with the given payload. Any remaining keyword args are passed to jwt.encode(). If payload is None, an empty payload is used. If headers is None, no headers are added beyond 'exp' and 'nbf'. The standard 'exp' and 'nbf' claims are added. In addition, the 'exp' claim is added into the header. The 'exp' time is now plus the number of seconds specified as expires_in. Note that if the passed payload has 'exp' and/or 'nbf' claims, these are used in preference.<|endoftext|>
fc229a415f0965df869fb50a46d4d7a1a6937c831a122628342bc9df98cad294
@property def can_authenticate(self) -> bool: '\n Test whether the user can authenticate.\n Even if authentication service is configured, user authentication\n may still be optional. In this case the server will publish\n the resources configured to be free for everyone.\n ' return bool(self.authentication.get('Domain'))
Test whether the user can authenticate. Even if authentication service is configured, user authentication may still be optional. In this case the server will publish the resources configured to be free for everyone.
xcube/webapi/context.py
can_authenticate
bcdev/xcube
0
python
@property def can_authenticate(self) -> bool: '\n Test whether the user can authenticate.\n Even if authentication service is configured, user authentication\n may still be optional. In this case the server will publish\n the resources configured to be free for everyone.\n ' return bool(self.authentication.get('Domain'))
@property def can_authenticate(self) -> bool: '\n Test whether the user can authenticate.\n Even if authentication service is configured, user authentication\n may still be optional. In this case the server will publish\n the resources configured to be free for everyone.\n ' return bool(self.authentication.get('Domain'))<|docstring|>Test whether the user can authenticate. Even if authentication service is configured, user authentication may still be optional. In this case the server will publish the resources configured to be free for everyone.<|endoftext|>
7fe97483e001ede83b6314485d872b21a8ce4f5092133329a54ab2b51361308b
@property def must_authenticate(self) -> bool: '\n Test whether the user must authenticate.\n ' return (self.can_authenticate and self.authentication.get('IsRequired', False))
Test whether the user must authenticate.
xcube/webapi/context.py
must_authenticate
bcdev/xcube
0
python
@property def must_authenticate(self) -> bool: '\n \n ' return (self.can_authenticate and self.authentication.get('IsRequired', False))
@property def must_authenticate(self) -> bool: '\n \n ' return (self.can_authenticate and self.authentication.get('IsRequired', False))<|docstring|>Test whether the user must authenticate.<|endoftext|>
8d33091658ca93ee1db2afa1a8577506d517fbf3dfac6d46986cc115862abce3
def print_table(tablefmt, data_dict={}, record=None): '\n\treturns colored table output\n\t' headers = [] table = [] if (not data_dict): return click.echo('Invalid data !!!') if data_dict['headers']: headers = data_dict['headers'] if (not isinstance(headers, list)): return click.echo('Invalid headers !!!') headers = [click.style(str(each_element), bold=True, fg='red') for each_element in headers] if data_dict['table_data']: table_data = data_dict['table_data'] if (not all((isinstance(each_list, list) for each_list in table_data))): return click.echo('Invlaid table data !!!') table = [[click.style(str(each_element), fg='green') for each_element in each_list] for each_list in table_data] return click.echo(tabulate(table, headers, tablefmt=tablefmt)) click.echo() return click.echo(('No %s records found for your account' % record))
returns colored table output
docli/commands/base_request.py
print_table
yspanchal/docli
39
python
def print_table(tablefmt, data_dict={}, record=None): '\n\t\n\t' headers = [] table = [] if (not data_dict): return click.echo('Invalid data !!!') if data_dict['headers']: headers = data_dict['headers'] if (not isinstance(headers, list)): return click.echo('Invalid headers !!!') headers = [click.style(str(each_element), bold=True, fg='red') for each_element in headers] if data_dict['table_data']: table_data = data_dict['table_data'] if (not all((isinstance(each_list, list) for each_list in table_data))): return click.echo('Invlaid table data !!!') table = [[click.style(str(each_element), fg='green') for each_element in each_list] for each_list in table_data] return click.echo(tabulate(table, headers, tablefmt=tablefmt)) click.echo() return click.echo(('No %s records found for your account' % record))
def print_table(tablefmt, data_dict={}, record=None): '\n\t\n\t' headers = [] table = [] if (not data_dict): return click.echo('Invalid data !!!') if data_dict['headers']: headers = data_dict['headers'] if (not isinstance(headers, list)): return click.echo('Invalid headers !!!') headers = [click.style(str(each_element), bold=True, fg='red') for each_element in headers] if data_dict['table_data']: table_data = data_dict['table_data'] if (not all((isinstance(each_list, list) for each_list in table_data))): return click.echo('Invlaid table data !!!') table = [[click.style(str(each_element), fg='green') for each_element in each_list] for each_list in table_data] return click.echo(tabulate(table, headers, tablefmt=tablefmt)) click.echo() return click.echo(('No %s records found for your account' % record))<|docstring|>returns colored table output<|endoftext|>
9714d68fdc20bd229cb03b58a3dc332640b0b9e7f94bb02ee9d83b44feef015c
def explicit_euler(ode_func, y0, x0, step_size, x_end): "\n Calculate numeric solution at each step to an ODE using Euler's Method\n\n https://en.wikipedia.org/wiki/Euler_method\n\n Arguments:\n ode_func -- The ode as a function of x and y\n y0 -- the initial value for y\n x0 -- the initial value for x\n stepsize -- the increment value for x\n x_end -- the end value for x\n\n >>> # the exact solution is math.exp(x)\n >>> def f(x, y):\n ... return y\n >>> y0 = 1\n >>> y = explicit_euler(f, y0, 0.0, 0.01, 5)\n >>> y[-1]\n 144.77277243257308\n " N = int(np.ceil(((x_end - x0) / step_size))) y = np.zeros(((N + 1),)) y[0] = y0 x = x0 for k in range(N): y[(k + 1)] = (y[k] + (step_size * ode_func(x, y[k]))) x += step_size return y
Calculate numeric solution at each step to an ODE using Euler's Method https://en.wikipedia.org/wiki/Euler_method Arguments: ode_func -- The ode as a function of x and y y0 -- the initial value for y x0 -- the initial value for x stepsize -- the increment value for x x_end -- the end value for x >>> # the exact solution is math.exp(x) >>> def f(x, y): ... return y >>> y0 = 1 >>> y = explicit_euler(f, y0, 0.0, 0.01, 5) >>> y[-1] 144.77277243257308
maths/explicit_euler.py
explicit_euler
kc8055/Python
21
python
def explicit_euler(ode_func, y0, x0, step_size, x_end): "\n Calculate numeric solution at each step to an ODE using Euler's Method\n\n https://en.wikipedia.org/wiki/Euler_method\n\n Arguments:\n ode_func -- The ode as a function of x and y\n y0 -- the initial value for y\n x0 -- the initial value for x\n stepsize -- the increment value for x\n x_end -- the end value for x\n\n >>> # the exact solution is math.exp(x)\n >>> def f(x, y):\n ... return y\n >>> y0 = 1\n >>> y = explicit_euler(f, y0, 0.0, 0.01, 5)\n >>> y[-1]\n 144.77277243257308\n " N = int(np.ceil(((x_end - x0) / step_size))) y = np.zeros(((N + 1),)) y[0] = y0 x = x0 for k in range(N): y[(k + 1)] = (y[k] + (step_size * ode_func(x, y[k]))) x += step_size return y
def explicit_euler(ode_func, y0, x0, step_size, x_end): "\n Calculate numeric solution at each step to an ODE using Euler's Method\n\n https://en.wikipedia.org/wiki/Euler_method\n\n Arguments:\n ode_func -- The ode as a function of x and y\n y0 -- the initial value for y\n x0 -- the initial value for x\n stepsize -- the increment value for x\n x_end -- the end value for x\n\n >>> # the exact solution is math.exp(x)\n >>> def f(x, y):\n ... return y\n >>> y0 = 1\n >>> y = explicit_euler(f, y0, 0.0, 0.01, 5)\n >>> y[-1]\n 144.77277243257308\n " N = int(np.ceil(((x_end - x0) / step_size))) y = np.zeros(((N + 1),)) y[0] = y0 x = x0 for k in range(N): y[(k + 1)] = (y[k] + (step_size * ode_func(x, y[k]))) x += step_size return y<|docstring|>Calculate numeric solution at each step to an ODE using Euler's Method https://en.wikipedia.org/wiki/Euler_method Arguments: ode_func -- The ode as a function of x and y y0 -- the initial value for y x0 -- the initial value for x stepsize -- the increment value for x x_end -- the end value for x >>> # the exact solution is math.exp(x) >>> def f(x, y): ... return y >>> y0 = 1 >>> y = explicit_euler(f, y0, 0.0, 0.01, 5) >>> y[-1] 144.77277243257308<|endoftext|>
d7913e131b709402a9ec6eaa940cbbf88faf34e43d7ade865336656fad75c70c
def __init__(self, capacity=10.0, aep=2500.0, static_investment=68000.0, price=0.3779, capital_ratio=0.25, working_ratio=0.3, equipment_cost=0.0, equipment_ratio=0.65, loan_rate=0.054, working_rate=0.0435, rate_discount=1.0, income_tax_rate=0.25, build_tax_rate=0.05, vat_rate=0.13, vat_refund_rate=0.5, edu_surcharge_rate=0.05, workers=10, labor_cost=16.0, in_repair_rate=0.005, out_repair_rate=0.015, warranty=5.0, insurance_rate=0.0025, material_quota=10.0, other_quota=30.0, working_quota=30.0, provident_rate=0.1, operate_period=20, build_period=1.0, loan_period=13, grace_period=1, residual_rate=0.04): '\n 初始化类变量\n ' self.capacity = capacity self.aep = aep self.static_investment = static_investment self.price = price self.capital_ratio = capital_ratio self.working_ratio = working_ratio self.equipment_ratio = equipment_ratio if (equipment_cost == 0.0): self.equipment_cost = (self.static_investment * self.equipment_ratio) else: self.equipment_cost = equipment_cost self.loan_rate = loan_rate self.working_rate = working_rate self.rate_discount = rate_discount self.income_tax_rate = income_tax_rate self.vat_rate = vat_rate self.vat_refund_rate = vat_refund_rate self.build_tax_rate = build_tax_rate self.edu_surcharge_rate = edu_surcharge_rate self.workers = workers self.labor_cost = labor_cost self.in_repair_rate = in_repair_rate self.out_repair_rate = out_repair_rate self.warranty = int(warranty) self.insurance_rate = insurance_rate self.material_quota = material_quota self.other_quota = other_quota self.working_quota = working_quota self.provident_rate = provident_rate self.build_period = build_period self.operate_period = operate_period self.loan_period = loan_period self.grace_period = grace_period self.residual_rate = residual_rate
初始化类变量
finance/base.py
__init__
path2019/Finance
0
python
def __init__(self, capacity=10.0, aep=2500.0, static_investment=68000.0, price=0.3779, capital_ratio=0.25, working_ratio=0.3, equipment_cost=0.0, equipment_ratio=0.65, loan_rate=0.054, working_rate=0.0435, rate_discount=1.0, income_tax_rate=0.25, build_tax_rate=0.05, vat_rate=0.13, vat_refund_rate=0.5, edu_surcharge_rate=0.05, workers=10, labor_cost=16.0, in_repair_rate=0.005, out_repair_rate=0.015, warranty=5.0, insurance_rate=0.0025, material_quota=10.0, other_quota=30.0, working_quota=30.0, provident_rate=0.1, operate_period=20, build_period=1.0, loan_period=13, grace_period=1, residual_rate=0.04): '\n \n ' self.capacity = capacity self.aep = aep self.static_investment = static_investment self.price = price self.capital_ratio = capital_ratio self.working_ratio = working_ratio self.equipment_ratio = equipment_ratio if (equipment_cost == 0.0): self.equipment_cost = (self.static_investment * self.equipment_ratio) else: self.equipment_cost = equipment_cost self.loan_rate = loan_rate self.working_rate = working_rate self.rate_discount = rate_discount self.income_tax_rate = income_tax_rate self.vat_rate = vat_rate self.vat_refund_rate = vat_refund_rate self.build_tax_rate = build_tax_rate self.edu_surcharge_rate = edu_surcharge_rate self.workers = workers self.labor_cost = labor_cost self.in_repair_rate = in_repair_rate self.out_repair_rate = out_repair_rate self.warranty = int(warranty) self.insurance_rate = insurance_rate self.material_quota = material_quota self.other_quota = other_quota self.working_quota = working_quota self.provident_rate = provident_rate self.build_period = build_period self.operate_period = operate_period self.loan_period = loan_period self.grace_period = grace_period self.residual_rate = residual_rate
def __init__(self, capacity=10.0, aep=2500.0, static_investment=68000.0, price=0.3779, capital_ratio=0.25, working_ratio=0.3, equipment_cost=0.0, equipment_ratio=0.65, loan_rate=0.054, working_rate=0.0435, rate_discount=1.0, income_tax_rate=0.25, build_tax_rate=0.05, vat_rate=0.13, vat_refund_rate=0.5, edu_surcharge_rate=0.05, workers=10, labor_cost=16.0, in_repair_rate=0.005, out_repair_rate=0.015, warranty=5.0, insurance_rate=0.0025, material_quota=10.0, other_quota=30.0, working_quota=30.0, provident_rate=0.1, operate_period=20, build_period=1.0, loan_period=13, grace_period=1, residual_rate=0.04): '\n \n ' self.capacity = capacity self.aep = aep self.static_investment = static_investment self.price = price self.capital_ratio = capital_ratio self.working_ratio = working_ratio self.equipment_ratio = equipment_ratio if (equipment_cost == 0.0): self.equipment_cost = (self.static_investment * self.equipment_ratio) else: self.equipment_cost = equipment_cost self.loan_rate = loan_rate self.working_rate = working_rate self.rate_discount = rate_discount self.income_tax_rate = income_tax_rate self.vat_rate = vat_rate self.vat_refund_rate = vat_refund_rate self.build_tax_rate = build_tax_rate self.edu_surcharge_rate = edu_surcharge_rate self.workers = workers self.labor_cost = labor_cost self.in_repair_rate = in_repair_rate self.out_repair_rate = out_repair_rate self.warranty = int(warranty) self.insurance_rate = insurance_rate self.material_quota = material_quota self.other_quota = other_quota self.working_quota = working_quota self.provident_rate = provident_rate self.build_period = build_period self.operate_period = operate_period self.loan_period = loan_period self.grace_period = grace_period self.residual_rate = residual_rate<|docstring|>初始化类变量<|endoftext|>
951a449f5cbc5079c5d99e5b143ddf11edab259d484c71cd7e09148a96a7327f
def com_finance(self, mode=False): '\n 计算类实例所抽象出的项目(边界)的(财务、资本金等)现金流序列。\n\n 输入参数:\n ----------\n mode: bool, default = False\n 财务计算过程结果(表)返回标识,若为True,则将财评过程结果 com_result 返回;\n 若为False,则结果不返回;默认值为 Fasle,即默认不返回财评过程结果。\n\n 返回结果:\n ----------\n 1. 若 mode 为 False:\n (pre_pro_netflow, after_pro_netflow, cap_netflow): (np.array<float>,np.array<float>,np.array<float>)\n 税前财务现金流量、税后财务现金流量和资本金现金流量组成的元表,每个流量序列不含总计值\n 2. 若 mode 为 True:\n (pre_pro_netflow, after_pro_netflow, cap_netflow, com_result): (np.array<float>,np.array<float>,np.array<float>,list)\n 前三个参数同上,com_result 为财评过程数据表,三维列表[表页[表单]]\n\n 备注:\n ----------\n 1. 本方法是类对象的核心算法,会涉及到较大量的有效中间计算结果,需梳理好临时变量,以便能将结果输出;\n 2. 注意临时变量的分类和初始化工作;\n 3. 第一阶段默认建设期为 1 年,运营期(含建设期)为 21 年,后续再行扩充可变建设期和运营期。\n ' build_cells = math.ceil(self.build_period) row_cells = ((self.operate_period + build_cells) + 1) total_investment = np.zeros(row_cells) build_investment = np.zeros(row_cells) build_interest = np.zeros(row_cells) working_capital = np.zeros(row_cells) finance = np.zeros(row_cells) capital = np.zeros(row_cells) debt = np.zeros(row_cells) long_loan = np.zeros(row_cells) working_loan = np.zeros(row_cells) material = np.zeros(row_cells) wage = np.zeros(row_cells) maintenance = np.zeros(row_cells) insurance = np.zeros(row_cells) other_expense = np.zeros(row_cells) operate_cost = np.zeros(row_cells) depreciation = np.zeros(row_cells) amortization = np.zeros(row_cells) interest = np.zeros(row_cells) fix_cost = np.zeros(row_cells) var_cost = np.zeros(row_cells) total_cost = np.zeros(row_cells) long_opening = np.zeros(row_cells) long_return = np.zeros(row_cells) long_principal = np.zeros(row_cells) long_interest = np.zeros(row_cells) long_ending = np.zeros(row_cells) working_interest = np.zeros(row_cells) working_principal = np.zeros(row_cells) working_return = np.zeros(row_cells) total_return = np.zeros(row_cells) income = np.zeros(row_cells) intax_balance = np.zeros(row_cells) operate_tax = np.zeros(row_cells) build_tax = np.zeros(row_cells) edu_surcharge = np.zeros(row_cells) subside = np.zeros(row_cells) vat_return = np.zeros(row_cells) vat_turn = np.zeros(row_cells) profit = np.zeros(row_cells) offset_loss = np.zeros(row_cells) tax_income = np.zeros(row_cells) income_tax = np.zeros(row_cells) net_profit = np.zeros(row_cells) provident = np.zeros(row_cells) distribute_profit = np.zeros(row_cells) ebit = np.zeros(row_cells) pro_inflow = np.zeros(row_cells) recover_asset = np.zeros(row_cells) recover_pro_working = np.zeros(row_cells) pro_outflow = np.zeros(row_cells) pre_pro_netflow = np.zeros(row_cells) after_pro_netflow = np.zeros(row_cells) cap_inflow = np.zeros(row_cells) recover_cap_working = np.zeros(row_cells) cap_outflow = np.zeros(row_cells) cap_netflow = np.zeros(row_cells) build_investment[1] = self.static_investment build_interest[1] = (((build_investment[1] * self.loan_rate) * self.rate_discount) / 2) working_capital[(build_cells + 1)] = (self.capacity * self.working_quota) build_investment[0] = np.sum(build_investment) build_interest[0] = np.sum(build_interest) working_capital[0] = np.sum(working_capital) total_investment = ((build_investment + build_interest) + working_capital) capital[1] = (total_investment[1] * self.capital_ratio) capital[(build_cells + 1)] = (total_investment[(build_cells + 1)] * self.working_ratio) long_loan[1] = (total_investment[1] - capital[1]) working_loan[(build_cells + 1)] = (total_investment[(build_cells + 1)] - capital[(build_cells + 1)]) capital[0] = np.sum(capital) long_loan[0] = np.sum(long_loan) working_loan[0] = np.sum(working_loan) debt = (total_investment - capital) finance = (capital + debt) vat_deduction = ((self.equipment_cost / (1 + self.vat_rate)) * self.vat_rate) fix_assets = (total_investment[1] - vat_deduction) output_vat = ((((self.capacity * self.aep) * self.price) * self.vat_rate) / (1 + self.vat_rate)) material[(build_cells + 1):] = (self.capacity * self.material_quota) wage[(build_cells + 1):] = (self.workers * self.labor_cost) maintenance[(build_cells + 1):((build_cells + 1) + self.warranty)] = (fix_assets * self.in_repair_rate) maintenance[((build_cells + 1) + self.warranty):] = (fix_assets * self.out_repair_rate) insurance[(build_cells + 1):] = (fix_assets * self.insurance_rate) other_expense[(build_cells + 1):] = (self.capacity * self.other_quota) depreciation[(build_cells + 1):] = ((fix_assets * (1 - self.residual_rate)) / self.operate_period) depreciation[0] = np.sum(depreciation) maintenance[0] = np.sum(maintenance) wage[0] = np.sum(wage) insurance[0] = np.sum(insurance) material[0] = np.sum(material) other_expense[0] = np.sum(other_expense) amortization[0] = np.sum(amortization) var_cost = material operate_cost = ((((maintenance + wage) + insurance) + material) + other_expense) long_principal[(build_cells + 1):((build_cells + self.loan_period) + 1)] = (long_loan[1] / self.loan_period) for i in range(self.loan_period): long_opening[((build_cells + i) + 1)] = (long_loan[1] - (i * long_principal[(build_cells + i)])) long_ending[(build_cells + 1):(build_cells + self.loan_period)] = long_opening[(build_cells + 2):((build_cells + self.loan_period) + 1)] long_interest = ((long_opening * self.loan_rate) * self.rate_discount) long_interest[0] = np.sum(long_interest) long_principal[0] = np.sum(long_principal) long_return = (long_principal + long_interest) working_interest[(build_cells + 1):] = (working_loan[(build_cells + 1)] * self.working_rate) working_principal[(row_cells - 1)] = working_loan[(build_cells + 1)] working_interest[0] = np.sum(working_interest) working_principal = np.sum(working_principal) working_return = (working_interest + working_principal) interest = (long_interest + working_interest) total_return = (long_return + working_return) fix_cost = (((((depreciation + maintenance) + wage) + insurance) + interest) + other_expense) total_cost = (((((((depreciation + maintenance) + wage) + insurance) + material) + amortization) + interest) + other_expense) income[(build_cells + 1):] = (((self.capacity * self.aep) * self.price) / (1 + self.vat_rate)) income[0] = np.sum(income) for i in range(self.operate_period): intax_balance[((build_cells + 1) + i)] = (vat_deduction - (i * output_vat)) if (intax_balance[((build_cells + 1) + i)] <= 0): build_tax[((build_cells + 1) + i)] = (output_vat * self.build_tax_rate) edu_surcharge[((build_cells + 1) + i)] = (output_vat * self.edu_surcharge_rate) elif ((intax_balance[((build_cells + 1) + i)] > 0) and ((vat_deduction - ((i + 1) * output_vat)) <= 0)): build_tax[((build_cells + 1) + i)] = ((output_vat - intax_balance[((build_cells + 1) + i)]) * self.build_tax_rate) edu_surcharge[((build_cells + 1) + i)] = ((output_vat - intax_balance[((build_cells + 1) + i)]) * self.edu_surcharge_rate) else: build_tax[((build_cells + 1) + i)] = 0 edu_surcharge[((build_cells + 1) + i)] = 0 build_tax[0] = np.sum(build_tax) edu_surcharge[0] = np.sum(edu_surcharge) operate_tax = (build_tax + edu_surcharge) vat_return = ((build_tax * self.vat_refund_rate) / self.build_tax_rate) for i in range((build_cells + 1), self.operate_period): if (intax_balance[i] < 0): vat_turn[i] = 0 elif (intax_balance[i] >= output_vat): vat_turn[i] = output_vat else: vat_turn[i] = intax_balance[i] vat_turn[0] = np.sum(vat_turn) subside = (vat_return + vat_turn) profit = (((income - operate_tax) - total_cost) + vat_return) tax_income = (profit - offset_loss) for i in range(self.operate_period): if (i < 3): income_tax[((build_cells + 1) + i)] = 0 elif (tax_income[((build_cells + 1) + i)] <= 0): income_tax[((build_cells + 1) + i)] = 0 elif (i < 6): income_tax[((build_cells + 1) + i)] = ((tax_income[((build_cells + 1) + i)] * self.income_tax_rate) / 2) else: income_tax[((build_cells + 1) + i)] = (tax_income[((build_cells + 1) + i)] * self.income_tax_rate) income_tax[0] = np.sum(income_tax) net_profit = (profit - income_tax) provident = (net_profit * self.provident_rate) distribute_profit = (net_profit - provident) ebit = (profit + interest) recover_asset[(build_cells + self.operate_period)] = (fix_assets * self.residual_rate) recover_pro_working[(build_cells + self.operate_period)] = working_capital[(build_cells + 1)] recover_asset[0] = np.sum(recover_asset) recover_pro_working[0] = np.sum(recover_pro_working) pro_inflow = (((income + subside) + recover_asset) + recover_pro_working) pro_outflow = (((build_investment + working_capital) + operate_cost) + operate_tax) pre_pro_netflow = (pro_inflow - pro_outflow) after_pro_netflow = (pre_pro_netflow - income_tax) recover_cap_working[[0, (build_cells + self.operate_period)]] = (working_capital[(build_cells + 1)] * self.working_ratio) cap_inflow = (((income + subside) + recover_asset) + recover_cap_working) cap_outflow = (((((capital + long_principal) + interest) + operate_cost) + operate_tax) + income_tax) cap_netflow = (cap_inflow - cap_outflow) if (mode == True): investment_finance = [total_investment[:(build_cells + 2)], build_investment[:(build_cells + 2)], build_interest[:(build_cells + 2)], working_capital[:(build_cells + 2)], finance[:(build_cells + 2)], capital[:(build_cells + 2)], debt[:(build_cells + 2)], long_loan[:(build_cells + 2)], working_loan[:(build_cells + 2)]] cost_finance = [material, wage, maintenance, insurance, other_expense, operate_cost, depreciation, amortization, interest, total_cost, var_cost, fix_cost] return_finance = [long_loan, long_opening, long_return, long_principal, long_interest, long_ending, working_loan, working_loan, working_return, working_principal, working_interest, (working_loan - working_principal), (long_loan + working_loan), (long_opening + working_loan), total_return, (long_principal + working_principal), (long_interest + working_interest)] profit_finance = [income, operate_tax, build_tax, edu_surcharge, total_cost, subside, vat_return, vat_turn, profit, offset_loss, tax_income, income_tax, net_profit, provident, ebit] pro_flow = [pro_inflow, income, subside, recover_asset, recover_pro_working, pro_outflow, build_investment, working_capital, operate_cost, operate_tax, pre_pro_netflow, income_tax, after_pro_netflow] cap_flow = [cap_inflow, income, subside, recover_asset, recover_cap_working, cap_outflow, capital, long_return, interest, operate_cost, operate_tax, income_tax, cap_netflow] com_result = [investment_finance, cost_finance, return_finance, profit_finance, pro_flow, cap_flow] if mode: return (pre_pro_netflow[1:], after_pro_netflow[1:], cap_netflow[1:], com_result) else: return (pre_pro_netflow[1:], after_pro_netflow[1:], cap_netflow[1:])
计算类实例所抽象出的项目(边界)的(财务、资本金等)现金流序列。 输入参数: ---------- mode: bool, default = False 财务计算过程结果(表)返回标识,若为True,则将财评过程结果 com_result 返回; 若为False,则结果不返回;默认值为 Fasle,即默认不返回财评过程结果。 返回结果: ---------- 1. 若 mode 为 False: (pre_pro_netflow, after_pro_netflow, cap_netflow): (np.array<float>,np.array<float>,np.array<float>) 税前财务现金流量、税后财务现金流量和资本金现金流量组成的元表,每个流量序列不含总计值 2. 若 mode 为 True: (pre_pro_netflow, after_pro_netflow, cap_netflow, com_result): (np.array<float>,np.array<float>,np.array<float>,list) 前三个参数同上,com_result 为财评过程数据表,三维列表[表页[表单]] 备注: ---------- 1. 本方法是类对象的核心算法,会涉及到较大量的有效中间计算结果,需梳理好临时变量,以便能将结果输出; 2. 注意临时变量的分类和初始化工作; 3. 第一阶段默认建设期为 1 年,运营期(含建设期)为 21 年,后续再行扩充可变建设期和运营期。
finance/base.py
com_finance
path2019/Finance
0
python
def com_finance(self, mode=False): '\n 计算类实例所抽象出的项目(边界)的(财务、资本金等)现金流序列。\n\n 输入参数:\n ----------\n mode: bool, default = False\n 财务计算过程结果(表)返回标识,若为True,则将财评过程结果 com_result 返回;\n 若为False,则结果不返回;默认值为 Fasle,即默认不返回财评过程结果。\n\n 返回结果:\n ----------\n 1. 若 mode 为 False:\n (pre_pro_netflow, after_pro_netflow, cap_netflow): (np.array<float>,np.array<float>,np.array<float>)\n 税前财务现金流量、税后财务现金流量和资本金现金流量组成的元表,每个流量序列不含总计值\n 2. 若 mode 为 True:\n (pre_pro_netflow, after_pro_netflow, cap_netflow, com_result): (np.array<float>,np.array<float>,np.array<float>,list)\n 前三个参数同上,com_result 为财评过程数据表,三维列表[表页[表单]]\n\n 备注:\n ----------\n 1. 本方法是类对象的核心算法,会涉及到较大量的有效中间计算结果,需梳理好临时变量,以便能将结果输出;\n 2. 注意临时变量的分类和初始化工作;\n 3. 第一阶段默认建设期为 1 年,运营期(含建设期)为 21 年,后续再行扩充可变建设期和运营期。\n ' build_cells = math.ceil(self.build_period) row_cells = ((self.operate_period + build_cells) + 1) total_investment = np.zeros(row_cells) build_investment = np.zeros(row_cells) build_interest = np.zeros(row_cells) working_capital = np.zeros(row_cells) finance = np.zeros(row_cells) capital = np.zeros(row_cells) debt = np.zeros(row_cells) long_loan = np.zeros(row_cells) working_loan = np.zeros(row_cells) material = np.zeros(row_cells) wage = np.zeros(row_cells) maintenance = np.zeros(row_cells) insurance = np.zeros(row_cells) other_expense = np.zeros(row_cells) operate_cost = np.zeros(row_cells) depreciation = np.zeros(row_cells) amortization = np.zeros(row_cells) interest = np.zeros(row_cells) fix_cost = np.zeros(row_cells) var_cost = np.zeros(row_cells) total_cost = np.zeros(row_cells) long_opening = np.zeros(row_cells) long_return = np.zeros(row_cells) long_principal = np.zeros(row_cells) long_interest = np.zeros(row_cells) long_ending = np.zeros(row_cells) working_interest = np.zeros(row_cells) working_principal = np.zeros(row_cells) working_return = np.zeros(row_cells) total_return = np.zeros(row_cells) income = np.zeros(row_cells) intax_balance = np.zeros(row_cells) operate_tax = np.zeros(row_cells) build_tax = np.zeros(row_cells) edu_surcharge = np.zeros(row_cells) subside = np.zeros(row_cells) vat_return = np.zeros(row_cells) vat_turn = np.zeros(row_cells) profit = np.zeros(row_cells) offset_loss = np.zeros(row_cells) tax_income = np.zeros(row_cells) income_tax = np.zeros(row_cells) net_profit = np.zeros(row_cells) provident = np.zeros(row_cells) distribute_profit = np.zeros(row_cells) ebit = np.zeros(row_cells) pro_inflow = np.zeros(row_cells) recover_asset = np.zeros(row_cells) recover_pro_working = np.zeros(row_cells) pro_outflow = np.zeros(row_cells) pre_pro_netflow = np.zeros(row_cells) after_pro_netflow = np.zeros(row_cells) cap_inflow = np.zeros(row_cells) recover_cap_working = np.zeros(row_cells) cap_outflow = np.zeros(row_cells) cap_netflow = np.zeros(row_cells) build_investment[1] = self.static_investment build_interest[1] = (((build_investment[1] * self.loan_rate) * self.rate_discount) / 2) working_capital[(build_cells + 1)] = (self.capacity * self.working_quota) build_investment[0] = np.sum(build_investment) build_interest[0] = np.sum(build_interest) working_capital[0] = np.sum(working_capital) total_investment = ((build_investment + build_interest) + working_capital) capital[1] = (total_investment[1] * self.capital_ratio) capital[(build_cells + 1)] = (total_investment[(build_cells + 1)] * self.working_ratio) long_loan[1] = (total_investment[1] - capital[1]) working_loan[(build_cells + 1)] = (total_investment[(build_cells + 1)] - capital[(build_cells + 1)]) capital[0] = np.sum(capital) long_loan[0] = np.sum(long_loan) working_loan[0] = np.sum(working_loan) debt = (total_investment - capital) finance = (capital + debt) vat_deduction = ((self.equipment_cost / (1 + self.vat_rate)) * self.vat_rate) fix_assets = (total_investment[1] - vat_deduction) output_vat = ((((self.capacity * self.aep) * self.price) * self.vat_rate) / (1 + self.vat_rate)) material[(build_cells + 1):] = (self.capacity * self.material_quota) wage[(build_cells + 1):] = (self.workers * self.labor_cost) maintenance[(build_cells + 1):((build_cells + 1) + self.warranty)] = (fix_assets * self.in_repair_rate) maintenance[((build_cells + 1) + self.warranty):] = (fix_assets * self.out_repair_rate) insurance[(build_cells + 1):] = (fix_assets * self.insurance_rate) other_expense[(build_cells + 1):] = (self.capacity * self.other_quota) depreciation[(build_cells + 1):] = ((fix_assets * (1 - self.residual_rate)) / self.operate_period) depreciation[0] = np.sum(depreciation) maintenance[0] = np.sum(maintenance) wage[0] = np.sum(wage) insurance[0] = np.sum(insurance) material[0] = np.sum(material) other_expense[0] = np.sum(other_expense) amortization[0] = np.sum(amortization) var_cost = material operate_cost = ((((maintenance + wage) + insurance) + material) + other_expense) long_principal[(build_cells + 1):((build_cells + self.loan_period) + 1)] = (long_loan[1] / self.loan_period) for i in range(self.loan_period): long_opening[((build_cells + i) + 1)] = (long_loan[1] - (i * long_principal[(build_cells + i)])) long_ending[(build_cells + 1):(build_cells + self.loan_period)] = long_opening[(build_cells + 2):((build_cells + self.loan_period) + 1)] long_interest = ((long_opening * self.loan_rate) * self.rate_discount) long_interest[0] = np.sum(long_interest) long_principal[0] = np.sum(long_principal) long_return = (long_principal + long_interest) working_interest[(build_cells + 1):] = (working_loan[(build_cells + 1)] * self.working_rate) working_principal[(row_cells - 1)] = working_loan[(build_cells + 1)] working_interest[0] = np.sum(working_interest) working_principal = np.sum(working_principal) working_return = (working_interest + working_principal) interest = (long_interest + working_interest) total_return = (long_return + working_return) fix_cost = (((((depreciation + maintenance) + wage) + insurance) + interest) + other_expense) total_cost = (((((((depreciation + maintenance) + wage) + insurance) + material) + amortization) + interest) + other_expense) income[(build_cells + 1):] = (((self.capacity * self.aep) * self.price) / (1 + self.vat_rate)) income[0] = np.sum(income) for i in range(self.operate_period): intax_balance[((build_cells + 1) + i)] = (vat_deduction - (i * output_vat)) if (intax_balance[((build_cells + 1) + i)] <= 0): build_tax[((build_cells + 1) + i)] = (output_vat * self.build_tax_rate) edu_surcharge[((build_cells + 1) + i)] = (output_vat * self.edu_surcharge_rate) elif ((intax_balance[((build_cells + 1) + i)] > 0) and ((vat_deduction - ((i + 1) * output_vat)) <= 0)): build_tax[((build_cells + 1) + i)] = ((output_vat - intax_balance[((build_cells + 1) + i)]) * self.build_tax_rate) edu_surcharge[((build_cells + 1) + i)] = ((output_vat - intax_balance[((build_cells + 1) + i)]) * self.edu_surcharge_rate) else: build_tax[((build_cells + 1) + i)] = 0 edu_surcharge[((build_cells + 1) + i)] = 0 build_tax[0] = np.sum(build_tax) edu_surcharge[0] = np.sum(edu_surcharge) operate_tax = (build_tax + edu_surcharge) vat_return = ((build_tax * self.vat_refund_rate) / self.build_tax_rate) for i in range((build_cells + 1), self.operate_period): if (intax_balance[i] < 0): vat_turn[i] = 0 elif (intax_balance[i] >= output_vat): vat_turn[i] = output_vat else: vat_turn[i] = intax_balance[i] vat_turn[0] = np.sum(vat_turn) subside = (vat_return + vat_turn) profit = (((income - operate_tax) - total_cost) + vat_return) tax_income = (profit - offset_loss) for i in range(self.operate_period): if (i < 3): income_tax[((build_cells + 1) + i)] = 0 elif (tax_income[((build_cells + 1) + i)] <= 0): income_tax[((build_cells + 1) + i)] = 0 elif (i < 6): income_tax[((build_cells + 1) + i)] = ((tax_income[((build_cells + 1) + i)] * self.income_tax_rate) / 2) else: income_tax[((build_cells + 1) + i)] = (tax_income[((build_cells + 1) + i)] * self.income_tax_rate) income_tax[0] = np.sum(income_tax) net_profit = (profit - income_tax) provident = (net_profit * self.provident_rate) distribute_profit = (net_profit - provident) ebit = (profit + interest) recover_asset[(build_cells + self.operate_period)] = (fix_assets * self.residual_rate) recover_pro_working[(build_cells + self.operate_period)] = working_capital[(build_cells + 1)] recover_asset[0] = np.sum(recover_asset) recover_pro_working[0] = np.sum(recover_pro_working) pro_inflow = (((income + subside) + recover_asset) + recover_pro_working) pro_outflow = (((build_investment + working_capital) + operate_cost) + operate_tax) pre_pro_netflow = (pro_inflow - pro_outflow) after_pro_netflow = (pre_pro_netflow - income_tax) recover_cap_working[[0, (build_cells + self.operate_period)]] = (working_capital[(build_cells + 1)] * self.working_ratio) cap_inflow = (((income + subside) + recover_asset) + recover_cap_working) cap_outflow = (((((capital + long_principal) + interest) + operate_cost) + operate_tax) + income_tax) cap_netflow = (cap_inflow - cap_outflow) if (mode == True): investment_finance = [total_investment[:(build_cells + 2)], build_investment[:(build_cells + 2)], build_interest[:(build_cells + 2)], working_capital[:(build_cells + 2)], finance[:(build_cells + 2)], capital[:(build_cells + 2)], debt[:(build_cells + 2)], long_loan[:(build_cells + 2)], working_loan[:(build_cells + 2)]] cost_finance = [material, wage, maintenance, insurance, other_expense, operate_cost, depreciation, amortization, interest, total_cost, var_cost, fix_cost] return_finance = [long_loan, long_opening, long_return, long_principal, long_interest, long_ending, working_loan, working_loan, working_return, working_principal, working_interest, (working_loan - working_principal), (long_loan + working_loan), (long_opening + working_loan), total_return, (long_principal + working_principal), (long_interest + working_interest)] profit_finance = [income, operate_tax, build_tax, edu_surcharge, total_cost, subside, vat_return, vat_turn, profit, offset_loss, tax_income, income_tax, net_profit, provident, ebit] pro_flow = [pro_inflow, income, subside, recover_asset, recover_pro_working, pro_outflow, build_investment, working_capital, operate_cost, operate_tax, pre_pro_netflow, income_tax, after_pro_netflow] cap_flow = [cap_inflow, income, subside, recover_asset, recover_cap_working, cap_outflow, capital, long_return, interest, operate_cost, operate_tax, income_tax, cap_netflow] com_result = [investment_finance, cost_finance, return_finance, profit_finance, pro_flow, cap_flow] if mode: return (pre_pro_netflow[1:], after_pro_netflow[1:], cap_netflow[1:], com_result) else: return (pre_pro_netflow[1:], after_pro_netflow[1:], cap_netflow[1:])
def com_finance(self, mode=False): '\n 计算类实例所抽象出的项目(边界)的(财务、资本金等)现金流序列。\n\n 输入参数:\n ----------\n mode: bool, default = False\n 财务计算过程结果(表)返回标识,若为True,则将财评过程结果 com_result 返回;\n 若为False,则结果不返回;默认值为 Fasle,即默认不返回财评过程结果。\n\n 返回结果:\n ----------\n 1. 若 mode 为 False:\n (pre_pro_netflow, after_pro_netflow, cap_netflow): (np.array<float>,np.array<float>,np.array<float>)\n 税前财务现金流量、税后财务现金流量和资本金现金流量组成的元表,每个流量序列不含总计值\n 2. 若 mode 为 True:\n (pre_pro_netflow, after_pro_netflow, cap_netflow, com_result): (np.array<float>,np.array<float>,np.array<float>,list)\n 前三个参数同上,com_result 为财评过程数据表,三维列表[表页[表单]]\n\n 备注:\n ----------\n 1. 本方法是类对象的核心算法,会涉及到较大量的有效中间计算结果,需梳理好临时变量,以便能将结果输出;\n 2. 注意临时变量的分类和初始化工作;\n 3. 第一阶段默认建设期为 1 年,运营期(含建设期)为 21 年,后续再行扩充可变建设期和运营期。\n ' build_cells = math.ceil(self.build_period) row_cells = ((self.operate_period + build_cells) + 1) total_investment = np.zeros(row_cells) build_investment = np.zeros(row_cells) build_interest = np.zeros(row_cells) working_capital = np.zeros(row_cells) finance = np.zeros(row_cells) capital = np.zeros(row_cells) debt = np.zeros(row_cells) long_loan = np.zeros(row_cells) working_loan = np.zeros(row_cells) material = np.zeros(row_cells) wage = np.zeros(row_cells) maintenance = np.zeros(row_cells) insurance = np.zeros(row_cells) other_expense = np.zeros(row_cells) operate_cost = np.zeros(row_cells) depreciation = np.zeros(row_cells) amortization = np.zeros(row_cells) interest = np.zeros(row_cells) fix_cost = np.zeros(row_cells) var_cost = np.zeros(row_cells) total_cost = np.zeros(row_cells) long_opening = np.zeros(row_cells) long_return = np.zeros(row_cells) long_principal = np.zeros(row_cells) long_interest = np.zeros(row_cells) long_ending = np.zeros(row_cells) working_interest = np.zeros(row_cells) working_principal = np.zeros(row_cells) working_return = np.zeros(row_cells) total_return = np.zeros(row_cells) income = np.zeros(row_cells) intax_balance = np.zeros(row_cells) operate_tax = np.zeros(row_cells) build_tax = np.zeros(row_cells) edu_surcharge = np.zeros(row_cells) subside = np.zeros(row_cells) vat_return = np.zeros(row_cells) vat_turn = np.zeros(row_cells) profit = np.zeros(row_cells) offset_loss = np.zeros(row_cells) tax_income = np.zeros(row_cells) income_tax = np.zeros(row_cells) net_profit = np.zeros(row_cells) provident = np.zeros(row_cells) distribute_profit = np.zeros(row_cells) ebit = np.zeros(row_cells) pro_inflow = np.zeros(row_cells) recover_asset = np.zeros(row_cells) recover_pro_working = np.zeros(row_cells) pro_outflow = np.zeros(row_cells) pre_pro_netflow = np.zeros(row_cells) after_pro_netflow = np.zeros(row_cells) cap_inflow = np.zeros(row_cells) recover_cap_working = np.zeros(row_cells) cap_outflow = np.zeros(row_cells) cap_netflow = np.zeros(row_cells) build_investment[1] = self.static_investment build_interest[1] = (((build_investment[1] * self.loan_rate) * self.rate_discount) / 2) working_capital[(build_cells + 1)] = (self.capacity * self.working_quota) build_investment[0] = np.sum(build_investment) build_interest[0] = np.sum(build_interest) working_capital[0] = np.sum(working_capital) total_investment = ((build_investment + build_interest) + working_capital) capital[1] = (total_investment[1] * self.capital_ratio) capital[(build_cells + 1)] = (total_investment[(build_cells + 1)] * self.working_ratio) long_loan[1] = (total_investment[1] - capital[1]) working_loan[(build_cells + 1)] = (total_investment[(build_cells + 1)] - capital[(build_cells + 1)]) capital[0] = np.sum(capital) long_loan[0] = np.sum(long_loan) working_loan[0] = np.sum(working_loan) debt = (total_investment - capital) finance = (capital + debt) vat_deduction = ((self.equipment_cost / (1 + self.vat_rate)) * self.vat_rate) fix_assets = (total_investment[1] - vat_deduction) output_vat = ((((self.capacity * self.aep) * self.price) * self.vat_rate) / (1 + self.vat_rate)) material[(build_cells + 1):] = (self.capacity * self.material_quota) wage[(build_cells + 1):] = (self.workers * self.labor_cost) maintenance[(build_cells + 1):((build_cells + 1) + self.warranty)] = (fix_assets * self.in_repair_rate) maintenance[((build_cells + 1) + self.warranty):] = (fix_assets * self.out_repair_rate) insurance[(build_cells + 1):] = (fix_assets * self.insurance_rate) other_expense[(build_cells + 1):] = (self.capacity * self.other_quota) depreciation[(build_cells + 1):] = ((fix_assets * (1 - self.residual_rate)) / self.operate_period) depreciation[0] = np.sum(depreciation) maintenance[0] = np.sum(maintenance) wage[0] = np.sum(wage) insurance[0] = np.sum(insurance) material[0] = np.sum(material) other_expense[0] = np.sum(other_expense) amortization[0] = np.sum(amortization) var_cost = material operate_cost = ((((maintenance + wage) + insurance) + material) + other_expense) long_principal[(build_cells + 1):((build_cells + self.loan_period) + 1)] = (long_loan[1] / self.loan_period) for i in range(self.loan_period): long_opening[((build_cells + i) + 1)] = (long_loan[1] - (i * long_principal[(build_cells + i)])) long_ending[(build_cells + 1):(build_cells + self.loan_period)] = long_opening[(build_cells + 2):((build_cells + self.loan_period) + 1)] long_interest = ((long_opening * self.loan_rate) * self.rate_discount) long_interest[0] = np.sum(long_interest) long_principal[0] = np.sum(long_principal) long_return = (long_principal + long_interest) working_interest[(build_cells + 1):] = (working_loan[(build_cells + 1)] * self.working_rate) working_principal[(row_cells - 1)] = working_loan[(build_cells + 1)] working_interest[0] = np.sum(working_interest) working_principal = np.sum(working_principal) working_return = (working_interest + working_principal) interest = (long_interest + working_interest) total_return = (long_return + working_return) fix_cost = (((((depreciation + maintenance) + wage) + insurance) + interest) + other_expense) total_cost = (((((((depreciation + maintenance) + wage) + insurance) + material) + amortization) + interest) + other_expense) income[(build_cells + 1):] = (((self.capacity * self.aep) * self.price) / (1 + self.vat_rate)) income[0] = np.sum(income) for i in range(self.operate_period): intax_balance[((build_cells + 1) + i)] = (vat_deduction - (i * output_vat)) if (intax_balance[((build_cells + 1) + i)] <= 0): build_tax[((build_cells + 1) + i)] = (output_vat * self.build_tax_rate) edu_surcharge[((build_cells + 1) + i)] = (output_vat * self.edu_surcharge_rate) elif ((intax_balance[((build_cells + 1) + i)] > 0) and ((vat_deduction - ((i + 1) * output_vat)) <= 0)): build_tax[((build_cells + 1) + i)] = ((output_vat - intax_balance[((build_cells + 1) + i)]) * self.build_tax_rate) edu_surcharge[((build_cells + 1) + i)] = ((output_vat - intax_balance[((build_cells + 1) + i)]) * self.edu_surcharge_rate) else: build_tax[((build_cells + 1) + i)] = 0 edu_surcharge[((build_cells + 1) + i)] = 0 build_tax[0] = np.sum(build_tax) edu_surcharge[0] = np.sum(edu_surcharge) operate_tax = (build_tax + edu_surcharge) vat_return = ((build_tax * self.vat_refund_rate) / self.build_tax_rate) for i in range((build_cells + 1), self.operate_period): if (intax_balance[i] < 0): vat_turn[i] = 0 elif (intax_balance[i] >= output_vat): vat_turn[i] = output_vat else: vat_turn[i] = intax_balance[i] vat_turn[0] = np.sum(vat_turn) subside = (vat_return + vat_turn) profit = (((income - operate_tax) - total_cost) + vat_return) tax_income = (profit - offset_loss) for i in range(self.operate_period): if (i < 3): income_tax[((build_cells + 1) + i)] = 0 elif (tax_income[((build_cells + 1) + i)] <= 0): income_tax[((build_cells + 1) + i)] = 0 elif (i < 6): income_tax[((build_cells + 1) + i)] = ((tax_income[((build_cells + 1) + i)] * self.income_tax_rate) / 2) else: income_tax[((build_cells + 1) + i)] = (tax_income[((build_cells + 1) + i)] * self.income_tax_rate) income_tax[0] = np.sum(income_tax) net_profit = (profit - income_tax) provident = (net_profit * self.provident_rate) distribute_profit = (net_profit - provident) ebit = (profit + interest) recover_asset[(build_cells + self.operate_period)] = (fix_assets * self.residual_rate) recover_pro_working[(build_cells + self.operate_period)] = working_capital[(build_cells + 1)] recover_asset[0] = np.sum(recover_asset) recover_pro_working[0] = np.sum(recover_pro_working) pro_inflow = (((income + subside) + recover_asset) + recover_pro_working) pro_outflow = (((build_investment + working_capital) + operate_cost) + operate_tax) pre_pro_netflow = (pro_inflow - pro_outflow) after_pro_netflow = (pre_pro_netflow - income_tax) recover_cap_working[[0, (build_cells + self.operate_period)]] = (working_capital[(build_cells + 1)] * self.working_ratio) cap_inflow = (((income + subside) + recover_asset) + recover_cap_working) cap_outflow = (((((capital + long_principal) + interest) + operate_cost) + operate_tax) + income_tax) cap_netflow = (cap_inflow - cap_outflow) if (mode == True): investment_finance = [total_investment[:(build_cells + 2)], build_investment[:(build_cells + 2)], build_interest[:(build_cells + 2)], working_capital[:(build_cells + 2)], finance[:(build_cells + 2)], capital[:(build_cells + 2)], debt[:(build_cells + 2)], long_loan[:(build_cells + 2)], working_loan[:(build_cells + 2)]] cost_finance = [material, wage, maintenance, insurance, other_expense, operate_cost, depreciation, amortization, interest, total_cost, var_cost, fix_cost] return_finance = [long_loan, long_opening, long_return, long_principal, long_interest, long_ending, working_loan, working_loan, working_return, working_principal, working_interest, (working_loan - working_principal), (long_loan + working_loan), (long_opening + working_loan), total_return, (long_principal + working_principal), (long_interest + working_interest)] profit_finance = [income, operate_tax, build_tax, edu_surcharge, total_cost, subside, vat_return, vat_turn, profit, offset_loss, tax_income, income_tax, net_profit, provident, ebit] pro_flow = [pro_inflow, income, subside, recover_asset, recover_pro_working, pro_outflow, build_investment, working_capital, operate_cost, operate_tax, pre_pro_netflow, income_tax, after_pro_netflow] cap_flow = [cap_inflow, income, subside, recover_asset, recover_cap_working, cap_outflow, capital, long_return, interest, operate_cost, operate_tax, income_tax, cap_netflow] com_result = [investment_finance, cost_finance, return_finance, profit_finance, pro_flow, cap_flow] if mode: return (pre_pro_netflow[1:], after_pro_netflow[1:], cap_netflow[1:], com_result) else: return (pre_pro_netflow[1:], after_pro_netflow[1:], cap_netflow[1:])<|docstring|>计算类实例所抽象出的项目(边界)的(财务、资本金等)现金流序列。 输入参数: ---------- mode: bool, default = False 财务计算过程结果(表)返回标识,若为True,则将财评过程结果 com_result 返回; 若为False,则结果不返回;默认值为 Fasle,即默认不返回财评过程结果。 返回结果: ---------- 1. 若 mode 为 False: (pre_pro_netflow, after_pro_netflow, cap_netflow): (np.array<float>,np.array<float>,np.array<float>) 税前财务现金流量、税后财务现金流量和资本金现金流量组成的元表,每个流量序列不含总计值 2. 若 mode 为 True: (pre_pro_netflow, after_pro_netflow, cap_netflow, com_result): (np.array<float>,np.array<float>,np.array<float>,list) 前三个参数同上,com_result 为财评过程数据表,三维列表[表页[表单]] 备注: ---------- 1. 本方法是类对象的核心算法,会涉及到较大量的有效中间计算结果,需梳理好临时变量,以便能将结果输出; 2. 注意临时变量的分类和初始化工作; 3. 第一阶段默认建设期为 1 年,运营期(含建设期)为 21 年,后续再行扩充可变建设期和运营期。<|endoftext|>
9b54e5b63475da0e335649ab13e1a31b4da041c458364e57236ac5d1ffe5e1bf
@staticmethod def com_payback(cash_array): '\n 根据现金流量数组,计算对应的回收期。\n\n 输入参数:\n -----------\n cash_array: np.array<>\n 现金流量数组,一维 np.array 数组\n \n 返回结果:\n ----------\n payback_period: float\n 与现金流量表对应的项目某种回收期,单位为“年”\n \n 备注:\n ----------\n 1. 为扩大方法的使用范围,将方法设置为类方法;\n 2. 第一阶段暂不考虑输入参数无效的检查和处理;\n 3. 注意对特殊情况,即项目回收期无限大,即项目无法收回投资的处理。\n\n ' pass
根据现金流量数组,计算对应的回收期。 输入参数: ----------- cash_array: np.array<> 现金流量数组,一维 np.array 数组 返回结果: ---------- payback_period: float 与现金流量表对应的项目某种回收期,单位为“年” 备注: ---------- 1. 为扩大方法的使用范围,将方法设置为类方法; 2. 第一阶段暂不考虑输入参数无效的检查和处理; 3. 注意对特殊情况,即项目回收期无限大,即项目无法收回投资的处理。
finance/base.py
com_payback
path2019/Finance
0
python
@staticmethod def com_payback(cash_array): '\n 根据现金流量数组,计算对应的回收期。\n\n 输入参数:\n -----------\n cash_array: np.array<>\n 现金流量数组,一维 np.array 数组\n \n 返回结果:\n ----------\n payback_period: float\n 与现金流量表对应的项目某种回收期,单位为“年”\n \n 备注:\n ----------\n 1. 为扩大方法的使用范围,将方法设置为类方法;\n 2. 第一阶段暂不考虑输入参数无效的检查和处理;\n 3. 注意对特殊情况,即项目回收期无限大,即项目无法收回投资的处理。\n\n ' pass
@staticmethod def com_payback(cash_array): '\n 根据现金流量数组,计算对应的回收期。\n\n 输入参数:\n -----------\n cash_array: np.array<>\n 现金流量数组,一维 np.array 数组\n \n 返回结果:\n ----------\n payback_period: float\n 与现金流量表对应的项目某种回收期,单位为“年”\n \n 备注:\n ----------\n 1. 为扩大方法的使用范围,将方法设置为类方法;\n 2. 第一阶段暂不考虑输入参数无效的检查和处理;\n 3. 注意对特殊情况,即项目回收期无限大,即项目无法收回投资的处理。\n\n ' pass<|docstring|>根据现金流量数组,计算对应的回收期。 输入参数: ----------- cash_array: np.array<> 现金流量数组,一维 np.array 数组 返回结果: ---------- payback_period: float 与现金流量表对应的项目某种回收期,单位为“年” 备注: ---------- 1. 为扩大方法的使用范围,将方法设置为类方法; 2. 第一阶段暂不考虑输入参数无效的检查和处理; 3. 注意对特殊情况,即项目回收期无限大,即项目无法收回投资的处理。<|endoftext|>
b4711a9f955076847b60a07ba0d07e8657c76c731dd97660964c8f7907e87cef
@staticmethod def com_irr(cash_array): '\n 根据输入的现金流量数组,计算对应的内部收益率。\n\n 输入参数:\n ----------\n cash_array: np.array<>\n 现金流量数组,一维 np.array 数组\n\n 返回结果:\n ----------\n irr: float\n 现金流量数组所对应的项目某个内部收益率\n\n 备注:\n ----------\n 1. 为扩大方法的使用范围,将方法设置为类方法;\n 2. 第一阶段暂不考虑输入参数无效的检查和处理;\n 3. 注意极端情况的考虑。\n ' return npf.irr(cash_array)
根据输入的现金流量数组,计算对应的内部收益率。 输入参数: ---------- cash_array: np.array<> 现金流量数组,一维 np.array 数组 返回结果: ---------- irr: float 现金流量数组所对应的项目某个内部收益率 备注: ---------- 1. 为扩大方法的使用范围,将方法设置为类方法; 2. 第一阶段暂不考虑输入参数无效的检查和处理; 3. 注意极端情况的考虑。
finance/base.py
com_irr
path2019/Finance
0
python
@staticmethod def com_irr(cash_array): '\n 根据输入的现金流量数组,计算对应的内部收益率。\n\n 输入参数:\n ----------\n cash_array: np.array<>\n 现金流量数组,一维 np.array 数组\n\n 返回结果:\n ----------\n irr: float\n 现金流量数组所对应的项目某个内部收益率\n\n 备注:\n ----------\n 1. 为扩大方法的使用范围,将方法设置为类方法;\n 2. 第一阶段暂不考虑输入参数无效的检查和处理;\n 3. 注意极端情况的考虑。\n ' return npf.irr(cash_array)
@staticmethod def com_irr(cash_array): '\n 根据输入的现金流量数组,计算对应的内部收益率。\n\n 输入参数:\n ----------\n cash_array: np.array<>\n 现金流量数组,一维 np.array 数组\n\n 返回结果:\n ----------\n irr: float\n 现金流量数组所对应的项目某个内部收益率\n\n 备注:\n ----------\n 1. 为扩大方法的使用范围,将方法设置为类方法;\n 2. 第一阶段暂不考虑输入参数无效的检查和处理;\n 3. 注意极端情况的考虑。\n ' return npf.irr(cash_array)<|docstring|>根据输入的现金流量数组,计算对应的内部收益率。 输入参数: ---------- cash_array: np.array<> 现金流量数组,一维 np.array 数组 返回结果: ---------- irr: float 现金流量数组所对应的项目某个内部收益率 备注: ---------- 1. 为扩大方法的使用范围,将方法设置为类方法; 2. 第一阶段暂不考虑输入参数无效的检查和处理; 3. 注意极端情况的考虑。<|endoftext|>
d1dd126016eb2530d376e394988d6839bb008c257c3603ee3655ca1092608cf5
@staticmethod def com_present(cash_array, discount_rate=0.05): '\n 根据所给的现金流量数组和折现率,计算对应的项目净现值。\n\n 输入参数:\n ----------\n cash_array: np.array<>\n 现金流量数组,一维 np.array 数组\n\n discount_rate: float\n 折现率,默认值为 5 %\n\n 返回结果:\n ----------\n present_value: float\n 与所给的现金流量数组和折现率对应的项目净现值\n \n 备注:\n -----------\n 1. 为扩大方法的使用范围,将方法设置为类方法;\n 2. 第一阶段暂不考虑输入参数无效的检查和处理;\n 3. 注意特殊情况的考虑。 \n\n ' return np.npv(discount_rate, cash_array)
根据所给的现金流量数组和折现率,计算对应的项目净现值。 输入参数: ---------- cash_array: np.array<> 现金流量数组,一维 np.array 数组 discount_rate: float 折现率,默认值为 5 % 返回结果: ---------- present_value: float 与所给的现金流量数组和折现率对应的项目净现值 备注: ----------- 1. 为扩大方法的使用范围,将方法设置为类方法; 2. 第一阶段暂不考虑输入参数无效的检查和处理; 3. 注意特殊情况的考虑。
finance/base.py
com_present
path2019/Finance
0
python
@staticmethod def com_present(cash_array, discount_rate=0.05): '\n 根据所给的现金流量数组和折现率,计算对应的项目净现值。\n\n 输入参数:\n ----------\n cash_array: np.array<>\n 现金流量数组,一维 np.array 数组\n\n discount_rate: float\n 折现率,默认值为 5 %\n\n 返回结果:\n ----------\n present_value: float\n 与所给的现金流量数组和折现率对应的项目净现值\n \n 备注:\n -----------\n 1. 为扩大方法的使用范围,将方法设置为类方法;\n 2. 第一阶段暂不考虑输入参数无效的检查和处理;\n 3. 注意特殊情况的考虑。 \n\n ' return np.npv(discount_rate, cash_array)
@staticmethod def com_present(cash_array, discount_rate=0.05): '\n 根据所给的现金流量数组和折现率,计算对应的项目净现值。\n\n 输入参数:\n ----------\n cash_array: np.array<>\n 现金流量数组,一维 np.array 数组\n\n discount_rate: float\n 折现率,默认值为 5 %\n\n 返回结果:\n ----------\n present_value: float\n 与所给的现金流量数组和折现率对应的项目净现值\n \n 备注:\n -----------\n 1. 为扩大方法的使用范围,将方法设置为类方法;\n 2. 第一阶段暂不考虑输入参数无效的检查和处理;\n 3. 注意特殊情况的考虑。 \n\n ' return np.npv(discount_rate, cash_array)<|docstring|>根据所给的现金流量数组和折现率,计算对应的项目净现值。 输入参数: ---------- cash_array: np.array<> 现金流量数组,一维 np.array 数组 discount_rate: float 折现率,默认值为 5 % 返回结果: ---------- present_value: float 与所给的现金流量数组和折现率对应的项目净现值 备注: ----------- 1. 为扩大方法的使用范围,将方法设置为类方法; 2. 第一阶段暂不考虑输入参数无效的检查和处理; 3. 注意特殊情况的考虑。<|endoftext|>
4eff87cbb75531b897e58094490cb43e81a8daec985dfbf33a46cee80436e132
@staticmethod def com_lcoe(cost_array, power, discount_rate): '\n 根据所给的总费用数组、总发电量和折现率,计算对应的LCOE(平准化度电成本)。\n\n 输入参数:\n ----------\n cost_array: np.array<>\n 项目总费用流量数组,一维 np.array 数组\n\n power: float\n 运营期内总发电量\n\n discount_rate: float\n 折现率\n\n 返回结果:\n ----------\n lcoe: float\n 对应所给总费用流量数组、总发电量和折现率的平准化度电成本\n\n 备注:\n ----------\n 1. 为扩大方法的使用范围,将方法设置为类方法;\n 2. 第一阶段暂不考虑输入参数无效的检查和处理;\n 3. 注意特殊情况的考虑。 \n\n ' pass
根据所给的总费用数组、总发电量和折现率,计算对应的LCOE(平准化度电成本)。 输入参数: ---------- cost_array: np.array<> 项目总费用流量数组,一维 np.array 数组 power: float 运营期内总发电量 discount_rate: float 折现率 返回结果: ---------- lcoe: float 对应所给总费用流量数组、总发电量和折现率的平准化度电成本 备注: ---------- 1. 为扩大方法的使用范围,将方法设置为类方法; 2. 第一阶段暂不考虑输入参数无效的检查和处理; 3. 注意特殊情况的考虑。
finance/base.py
com_lcoe
path2019/Finance
0
python
@staticmethod def com_lcoe(cost_array, power, discount_rate): '\n 根据所给的总费用数组、总发电量和折现率,计算对应的LCOE(平准化度电成本)。\n\n 输入参数:\n ----------\n cost_array: np.array<>\n 项目总费用流量数组,一维 np.array 数组\n\n power: float\n 运营期内总发电量\n\n discount_rate: float\n 折现率\n\n 返回结果:\n ----------\n lcoe: float\n 对应所给总费用流量数组、总发电量和折现率的平准化度电成本\n\n 备注:\n ----------\n 1. 为扩大方法的使用范围,将方法设置为类方法;\n 2. 第一阶段暂不考虑输入参数无效的检查和处理;\n 3. 注意特殊情况的考虑。 \n\n ' pass
@staticmethod def com_lcoe(cost_array, power, discount_rate): '\n 根据所给的总费用数组、总发电量和折现率,计算对应的LCOE(平准化度电成本)。\n\n 输入参数:\n ----------\n cost_array: np.array<>\n 项目总费用流量数组,一维 np.array 数组\n\n power: float\n 运营期内总发电量\n\n discount_rate: float\n 折现率\n\n 返回结果:\n ----------\n lcoe: float\n 对应所给总费用流量数组、总发电量和折现率的平准化度电成本\n\n 备注:\n ----------\n 1. 为扩大方法的使用范围,将方法设置为类方法;\n 2. 第一阶段暂不考虑输入参数无效的检查和处理;\n 3. 注意特殊情况的考虑。 \n\n ' pass<|docstring|>根据所给的总费用数组、总发电量和折现率,计算对应的LCOE(平准化度电成本)。 输入参数: ---------- cost_array: np.array<> 项目总费用流量数组,一维 np.array 数组 power: float 运营期内总发电量 discount_rate: float 折现率 返回结果: ---------- lcoe: float 对应所给总费用流量数组、总发电量和折现率的平准化度电成本 备注: ---------- 1. 为扩大方法的使用范围,将方法设置为类方法; 2. 第一阶段暂不考虑输入参数无效的检查和处理; 3. 注意特殊情况的考虑。<|endoftext|>
730c5d962e7b29e98620785b38fd1b856e9c049251530102517b49ac1f2b16f4
def load_json_data(json_url): '\n :param json_url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson"\n :return: Earthquakes json data\n ' data = requests.get(json_url).json() return data
:param json_url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson" :return: Earthquakes json data
read_json_url_requests.py
load_json_data
arturosolutions/earthquakes
0
python
def load_json_data(json_url): '\n :param json_url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson"\n :return: Earthquakes json data\n ' data = requests.get(json_url).json() return data
def load_json_data(json_url): '\n :param json_url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson"\n :return: Earthquakes json data\n ' data = requests.get(json_url).json() return data<|docstring|>:param json_url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson" :return: Earthquakes json data<|endoftext|>
1e8aaf063e0dfb7fd4479ad9adbbd2ee0741cfaf29926d6e4a4ec34a73b39bbd
def get_place_and_magnitude(data): '\n :param data: Earthquakes json data\n :return: List of places and magnitudes, where magnitude is greater than 1.0.\n ' start = time.time() data = load_json_data(url) for dictionary in data['features']: place = dictionary['properties']['place'] magnitude = dictionary['properties']['mag'] if (magnitude > 1.0): print(place, '|', magnitude) end = time.time() print('Time spent', (end - start), 'seconds')
:param data: Earthquakes json data :return: List of places and magnitudes, where magnitude is greater than 1.0.
read_json_url_requests.py
get_place_and_magnitude
arturosolutions/earthquakes
0
python
def get_place_and_magnitude(data): '\n :param data: Earthquakes json data\n :return: List of places and magnitudes, where magnitude is greater than 1.0.\n ' start = time.time() data = load_json_data(url) for dictionary in data['features']: place = dictionary['properties']['place'] magnitude = dictionary['properties']['mag'] if (magnitude > 1.0): print(place, '|', magnitude) end = time.time() print('Time spent', (end - start), 'seconds')
def get_place_and_magnitude(data): '\n :param data: Earthquakes json data\n :return: List of places and magnitudes, where magnitude is greater than 1.0.\n ' start = time.time() data = load_json_data(url) for dictionary in data['features']: place = dictionary['properties']['place'] magnitude = dictionary['properties']['mag'] if (magnitude > 1.0): print(place, '|', magnitude) end = time.time() print('Time spent', (end - start), 'seconds')<|docstring|>:param data: Earthquakes json data :return: List of places and magnitudes, where magnitude is greater than 1.0.<|endoftext|>
cd7897d90a29a134cab8991ab1a91a5ce7783001430ac931abc576ea41ac4aae
def do(*l, kernel=None): '\n Simply create a chain of operations. Useful inside of if statements\n (do (X 0) (X 1))\n ' return do_template.format('\n'.join(l)).split(' ')
Simply create a chain of operations. Useful inside of if statements (do (X 0) (X 1))
qurry/libraries/standard_library/constructs/do.py
do
LSaldyt/curry
11
python
def do(*l, kernel=None): '\n Simply create a chain of operations. Useful inside of if statements\n (do (X 0) (X 1))\n ' return do_template.format('\n'.join(l)).split(' ')
def do(*l, kernel=None): '\n Simply create a chain of operations. Useful inside of if statements\n (do (X 0) (X 1))\n ' return do_template.format('\n'.join(l)).split(' ')<|docstring|>Simply create a chain of operations. Useful inside of if statements (do (X 0) (X 1))<|endoftext|>
41996488a883d37a5b334a6f00c7dd6e8fd3538549cacfc03d519a657211794b
def test_sparse(self): ' test sparse fields. ' record = self.env['sparse_fields.test'].create({}) self.assertFalse(record.data) partner = self.env.ref('base.main_partner') values = [('boolean', True), ('integer', 42), ('float', 3.14), ('char', 'John'), ('selection', 'two'), ('partner', partner.id)] for (n, (key, val)) in enumerate(values): record.write({key: val}) self.assertEqual(record.data, dict(values[:(n + 1)])) for (key, val) in values[:(- 1)]: self.assertEqual(record[key], val) self.assertEqual(record.partner, partner) for (n, (key, val)) in enumerate(values): record.write({key: False}) self.assertEqual(record.data, dict(values[(n + 1):])) names = [name for (name, _) in values] domain = [('model', '=', 'sparse_fields.test'), ('name', 'in', names)] fields = self.env['ir.model.fields'].search(domain) self.assertEqual(len(fields), len(names)) for field in fields: self.assertEqual(field.serialization_field_id.name, 'data')
test sparse fields.
addons/base_sparse_field/tests/test_sparse_fields.py
test_sparse
SHIVJITH/Odoo_Machine_Test
0
python
def test_sparse(self): ' ' record = self.env['sparse_fields.test'].create({}) self.assertFalse(record.data) partner = self.env.ref('base.main_partner') values = [('boolean', True), ('integer', 42), ('float', 3.14), ('char', 'John'), ('selection', 'two'), ('partner', partner.id)] for (n, (key, val)) in enumerate(values): record.write({key: val}) self.assertEqual(record.data, dict(values[:(n + 1)])) for (key, val) in values[:(- 1)]: self.assertEqual(record[key], val) self.assertEqual(record.partner, partner) for (n, (key, val)) in enumerate(values): record.write({key: False}) self.assertEqual(record.data, dict(values[(n + 1):])) names = [name for (name, _) in values] domain = [('model', '=', 'sparse_fields.test'), ('name', 'in', names)] fields = self.env['ir.model.fields'].search(domain) self.assertEqual(len(fields), len(names)) for field in fields: self.assertEqual(field.serialization_field_id.name, 'data')
def test_sparse(self): ' ' record = self.env['sparse_fields.test'].create({}) self.assertFalse(record.data) partner = self.env.ref('base.main_partner') values = [('boolean', True), ('integer', 42), ('float', 3.14), ('char', 'John'), ('selection', 'two'), ('partner', partner.id)] for (n, (key, val)) in enumerate(values): record.write({key: val}) self.assertEqual(record.data, dict(values[:(n + 1)])) for (key, val) in values[:(- 1)]: self.assertEqual(record[key], val) self.assertEqual(record.partner, partner) for (n, (key, val)) in enumerate(values): record.write({key: False}) self.assertEqual(record.data, dict(values[(n + 1):])) names = [name for (name, _) in values] domain = [('model', '=', 'sparse_fields.test'), ('name', 'in', names)] fields = self.env['ir.model.fields'].search(domain) self.assertEqual(len(fields), len(names)) for field in fields: self.assertEqual(field.serialization_field_id.name, 'data')<|docstring|>test sparse fields.<|endoftext|>
49197ca777c7b27ef45f8ece0349088b5f5d95632af99259b457581bab9108a1
def __init__(self, module): '\n Constructor\n ' if (not HAS_PYSNOW): module.fail_json(msg=missing_required_lib('pysnow'), exception=PYSNOW_IMP_ERR) self.module = module self.params = module.params self.client_id = self.params['client_id'] self.client_secret = self.params['client_secret'] self.username = self.params['username'] self.password = self.params['password'] self.instance = self.params['instance'] self.session = {'token': None} self.conn = None
Constructor
ansible/venv/lib/python2.7/site-packages/ansible/module_utils/service_now.py
__init__
gvashchenkolineate/gvashchenkolineate_infra_trytravis
17
python
def __init__(self, module): '\n \n ' if (not HAS_PYSNOW): module.fail_json(msg=missing_required_lib('pysnow'), exception=PYSNOW_IMP_ERR) self.module = module self.params = module.params self.client_id = self.params['client_id'] self.client_secret = self.params['client_secret'] self.username = self.params['username'] self.password = self.params['password'] self.instance = self.params['instance'] self.session = {'token': None} self.conn = None
def __init__(self, module): '\n \n ' if (not HAS_PYSNOW): module.fail_json(msg=missing_required_lib('pysnow'), exception=PYSNOW_IMP_ERR) self.module = module self.params = module.params self.client_id = self.params['client_id'] self.client_secret = self.params['client_secret'] self.username = self.params['username'] self.password = self.params['password'] self.instance = self.params['instance'] self.session = {'token': None} self.conn = None<|docstring|>Constructor<|endoftext|>
fa40b02a58e78835c8f705f779ae53f7766c0a02589f2390f8da55526e6974e0
def __init__(self, pubchem=None, drugbank=None, chembl=None, chebi=None, hmdb=None, mychem_info=None): 'CompoundInfoIdentifiers - a model defined in OpenAPI\n\n :param pubchem: The pubchem of this CompoundInfoIdentifiers. # noqa: E501\n :type pubchem: str\n :param drugbank: The drugbank of this CompoundInfoIdentifiers. # noqa: E501\n :type drugbank: str\n :param chembl: The chembl of this CompoundInfoIdentifiers. # noqa: E501\n :type chembl: str\n :param chebi: The chebi of this CompoundInfoIdentifiers. # noqa: E501\n :type chebi: str\n :param hmdb: The hmdb of this CompoundInfoIdentifiers. # noqa: E501\n :type hmdb: str\n :param mychem_info: The mychem_info of this CompoundInfoIdentifiers. # noqa: E501\n :type mychem_info: str\n ' self.openapi_types = {'pubchem': str, 'drugbank': str, 'chembl': str, 'chebi': str, 'hmdb': str, 'mychem_info': str} self.attribute_map = {'pubchem': 'pubchem', 'drugbank': 'drugbank', 'chembl': 'chembl', 'chebi': 'chebi', 'hmdb': 'hmdb', 'mychem_info': 'mychem_info'} self._pubchem = pubchem self._drugbank = drugbank self._chembl = chembl self._chebi = chebi self._hmdb = hmdb self._mychem_info = mychem_info
CompoundInfoIdentifiers - a model defined in OpenAPI :param pubchem: The pubchem of this CompoundInfoIdentifiers. # noqa: E501 :type pubchem: str :param drugbank: The drugbank of this CompoundInfoIdentifiers. # noqa: E501 :type drugbank: str :param chembl: The chembl of this CompoundInfoIdentifiers. # noqa: E501 :type chembl: str :param chebi: The chebi of this CompoundInfoIdentifiers. # noqa: E501 :type chebi: str :param hmdb: The hmdb of this CompoundInfoIdentifiers. # noqa: E501 :type hmdb: str :param mychem_info: The mychem_info of this CompoundInfoIdentifiers. # noqa: E501 :type mychem_info: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
__init__
pahmadi8740/molecular-data-provider
5
python
def __init__(self, pubchem=None, drugbank=None, chembl=None, chebi=None, hmdb=None, mychem_info=None): 'CompoundInfoIdentifiers - a model defined in OpenAPI\n\n :param pubchem: The pubchem of this CompoundInfoIdentifiers. # noqa: E501\n :type pubchem: str\n :param drugbank: The drugbank of this CompoundInfoIdentifiers. # noqa: E501\n :type drugbank: str\n :param chembl: The chembl of this CompoundInfoIdentifiers. # noqa: E501\n :type chembl: str\n :param chebi: The chebi of this CompoundInfoIdentifiers. # noqa: E501\n :type chebi: str\n :param hmdb: The hmdb of this CompoundInfoIdentifiers. # noqa: E501\n :type hmdb: str\n :param mychem_info: The mychem_info of this CompoundInfoIdentifiers. # noqa: E501\n :type mychem_info: str\n ' self.openapi_types = {'pubchem': str, 'drugbank': str, 'chembl': str, 'chebi': str, 'hmdb': str, 'mychem_info': str} self.attribute_map = {'pubchem': 'pubchem', 'drugbank': 'drugbank', 'chembl': 'chembl', 'chebi': 'chebi', 'hmdb': 'hmdb', 'mychem_info': 'mychem_info'} self._pubchem = pubchem self._drugbank = drugbank self._chembl = chembl self._chebi = chebi self._hmdb = hmdb self._mychem_info = mychem_info
def __init__(self, pubchem=None, drugbank=None, chembl=None, chebi=None, hmdb=None, mychem_info=None): 'CompoundInfoIdentifiers - a model defined in OpenAPI\n\n :param pubchem: The pubchem of this CompoundInfoIdentifiers. # noqa: E501\n :type pubchem: str\n :param drugbank: The drugbank of this CompoundInfoIdentifiers. # noqa: E501\n :type drugbank: str\n :param chembl: The chembl of this CompoundInfoIdentifiers. # noqa: E501\n :type chembl: str\n :param chebi: The chebi of this CompoundInfoIdentifiers. # noqa: E501\n :type chebi: str\n :param hmdb: The hmdb of this CompoundInfoIdentifiers. # noqa: E501\n :type hmdb: str\n :param mychem_info: The mychem_info of this CompoundInfoIdentifiers. # noqa: E501\n :type mychem_info: str\n ' self.openapi_types = {'pubchem': str, 'drugbank': str, 'chembl': str, 'chebi': str, 'hmdb': str, 'mychem_info': str} self.attribute_map = {'pubchem': 'pubchem', 'drugbank': 'drugbank', 'chembl': 'chembl', 'chebi': 'chebi', 'hmdb': 'hmdb', 'mychem_info': 'mychem_info'} self._pubchem = pubchem self._drugbank = drugbank self._chembl = chembl self._chebi = chebi self._hmdb = hmdb self._mychem_info = mychem_info<|docstring|>CompoundInfoIdentifiers - a model defined in OpenAPI :param pubchem: The pubchem of this CompoundInfoIdentifiers. # noqa: E501 :type pubchem: str :param drugbank: The drugbank of this CompoundInfoIdentifiers. # noqa: E501 :type drugbank: str :param chembl: The chembl of this CompoundInfoIdentifiers. # noqa: E501 :type chembl: str :param chebi: The chebi of this CompoundInfoIdentifiers. # noqa: E501 :type chebi: str :param hmdb: The hmdb of this CompoundInfoIdentifiers. # noqa: E501 :type hmdb: str :param mychem_info: The mychem_info of this CompoundInfoIdentifiers. # noqa: E501 :type mychem_info: str<|endoftext|>
b433c0f23523cd4ab7e7a1f88f237183082e8ffa03929b937ef04a0c1ac1516d
@classmethod def from_dict(cls, dikt) -> 'CompoundInfoIdentifiers': 'Returns the dict as a model\n\n :param dikt: A dict.\n :type: dict\n :return: The compound_info_identifiers of this CompoundInfoIdentifiers. # noqa: E501\n :rtype: CompoundInfoIdentifiers\n ' return util.deserialize_model(dikt, cls)
Returns the dict as a model :param dikt: A dict. :type: dict :return: The compound_info_identifiers of this CompoundInfoIdentifiers. # noqa: E501 :rtype: CompoundInfoIdentifiers
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
from_dict
pahmadi8740/molecular-data-provider
5
python
@classmethod def from_dict(cls, dikt) -> 'CompoundInfoIdentifiers': 'Returns the dict as a model\n\n :param dikt: A dict.\n :type: dict\n :return: The compound_info_identifiers of this CompoundInfoIdentifiers. # noqa: E501\n :rtype: CompoundInfoIdentifiers\n ' return util.deserialize_model(dikt, cls)
@classmethod def from_dict(cls, dikt) -> 'CompoundInfoIdentifiers': 'Returns the dict as a model\n\n :param dikt: A dict.\n :type: dict\n :return: The compound_info_identifiers of this CompoundInfoIdentifiers. # noqa: E501\n :rtype: CompoundInfoIdentifiers\n ' return util.deserialize_model(dikt, cls)<|docstring|>Returns the dict as a model :param dikt: A dict. :type: dict :return: The compound_info_identifiers of this CompoundInfoIdentifiers. # noqa: E501 :rtype: CompoundInfoIdentifiers<|endoftext|>
b37aa65400b4a8671c4699f1b798a0cac710e04e216f7c54fc2c64fa8184c81b
@property def pubchem(self): 'Gets the pubchem of this CompoundInfoIdentifiers.\n\n PubChem CID of the compound (CURIE). # noqa: E501\n\n :return: The pubchem of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._pubchem
Gets the pubchem of this CompoundInfoIdentifiers. PubChem CID of the compound (CURIE). # noqa: E501 :return: The pubchem of this CompoundInfoIdentifiers. :rtype: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
pubchem
pahmadi8740/molecular-data-provider
5
python
@property def pubchem(self): 'Gets the pubchem of this CompoundInfoIdentifiers.\n\n PubChem CID of the compound (CURIE). # noqa: E501\n\n :return: The pubchem of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._pubchem
@property def pubchem(self): 'Gets the pubchem of this CompoundInfoIdentifiers.\n\n PubChem CID of the compound (CURIE). # noqa: E501\n\n :return: The pubchem of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._pubchem<|docstring|>Gets the pubchem of this CompoundInfoIdentifiers. PubChem CID of the compound (CURIE). # noqa: E501 :return: The pubchem of this CompoundInfoIdentifiers. :rtype: str<|endoftext|>
362d03029c91952897faba36dbe457fd72c16f740e0589a5b7233007ddc7cda7
@pubchem.setter def pubchem(self, pubchem): 'Sets the pubchem of this CompoundInfoIdentifiers.\n\n PubChem CID of the compound (CURIE). # noqa: E501\n\n :param pubchem: The pubchem of this CompoundInfoIdentifiers.\n :type pubchem: str\n ' self._pubchem = pubchem
Sets the pubchem of this CompoundInfoIdentifiers. PubChem CID of the compound (CURIE). # noqa: E501 :param pubchem: The pubchem of this CompoundInfoIdentifiers. :type pubchem: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
pubchem
pahmadi8740/molecular-data-provider
5
python
@pubchem.setter def pubchem(self, pubchem): 'Sets the pubchem of this CompoundInfoIdentifiers.\n\n PubChem CID of the compound (CURIE). # noqa: E501\n\n :param pubchem: The pubchem of this CompoundInfoIdentifiers.\n :type pubchem: str\n ' self._pubchem = pubchem
@pubchem.setter def pubchem(self, pubchem): 'Sets the pubchem of this CompoundInfoIdentifiers.\n\n PubChem CID of the compound (CURIE). # noqa: E501\n\n :param pubchem: The pubchem of this CompoundInfoIdentifiers.\n :type pubchem: str\n ' self._pubchem = pubchem<|docstring|>Sets the pubchem of this CompoundInfoIdentifiers. PubChem CID of the compound (CURIE). # noqa: E501 :param pubchem: The pubchem of this CompoundInfoIdentifiers. :type pubchem: str<|endoftext|>
24f1c001fe1b322575f266f4cc9cd2325cb1ae51bcd0730e95f1cde5ecc38e89
@property def drugbank(self): 'Gets the drugbank of this CompoundInfoIdentifiers.\n\n DrugBank id of the compound (CURIE). # noqa: E501\n\n :return: The drugbank of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._drugbank
Gets the drugbank of this CompoundInfoIdentifiers. DrugBank id of the compound (CURIE). # noqa: E501 :return: The drugbank of this CompoundInfoIdentifiers. :rtype: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
drugbank
pahmadi8740/molecular-data-provider
5
python
@property def drugbank(self): 'Gets the drugbank of this CompoundInfoIdentifiers.\n\n DrugBank id of the compound (CURIE). # noqa: E501\n\n :return: The drugbank of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._drugbank
@property def drugbank(self): 'Gets the drugbank of this CompoundInfoIdentifiers.\n\n DrugBank id of the compound (CURIE). # noqa: E501\n\n :return: The drugbank of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._drugbank<|docstring|>Gets the drugbank of this CompoundInfoIdentifiers. DrugBank id of the compound (CURIE). # noqa: E501 :return: The drugbank of this CompoundInfoIdentifiers. :rtype: str<|endoftext|>
95197a4b1f87b9a1c797793b2e6492e6a527578b7c329d641c5d94f771b01200
@drugbank.setter def drugbank(self, drugbank): 'Sets the drugbank of this CompoundInfoIdentifiers.\n\n DrugBank id of the compound (CURIE). # noqa: E501\n\n :param drugbank: The drugbank of this CompoundInfoIdentifiers.\n :type drugbank: str\n ' self._drugbank = drugbank
Sets the drugbank of this CompoundInfoIdentifiers. DrugBank id of the compound (CURIE). # noqa: E501 :param drugbank: The drugbank of this CompoundInfoIdentifiers. :type drugbank: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
drugbank
pahmadi8740/molecular-data-provider
5
python
@drugbank.setter def drugbank(self, drugbank): 'Sets the drugbank of this CompoundInfoIdentifiers.\n\n DrugBank id of the compound (CURIE). # noqa: E501\n\n :param drugbank: The drugbank of this CompoundInfoIdentifiers.\n :type drugbank: str\n ' self._drugbank = drugbank
@drugbank.setter def drugbank(self, drugbank): 'Sets the drugbank of this CompoundInfoIdentifiers.\n\n DrugBank id of the compound (CURIE). # noqa: E501\n\n :param drugbank: The drugbank of this CompoundInfoIdentifiers.\n :type drugbank: str\n ' self._drugbank = drugbank<|docstring|>Sets the drugbank of this CompoundInfoIdentifiers. DrugBank id of the compound (CURIE). # noqa: E501 :param drugbank: The drugbank of this CompoundInfoIdentifiers. :type drugbank: str<|endoftext|>
1641915563b922e9a2c6cc911edc592fc0a089a393bcc85212efee9e903cb90b
@property def chembl(self): 'Gets the chembl of this CompoundInfoIdentifiers.\n\n ChEMBL id of the compound (CURIE). # noqa: E501\n\n :return: The chembl of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._chembl
Gets the chembl of this CompoundInfoIdentifiers. ChEMBL id of the compound (CURIE). # noqa: E501 :return: The chembl of this CompoundInfoIdentifiers. :rtype: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
chembl
pahmadi8740/molecular-data-provider
5
python
@property def chembl(self): 'Gets the chembl of this CompoundInfoIdentifiers.\n\n ChEMBL id of the compound (CURIE). # noqa: E501\n\n :return: The chembl of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._chembl
@property def chembl(self): 'Gets the chembl of this CompoundInfoIdentifiers.\n\n ChEMBL id of the compound (CURIE). # noqa: E501\n\n :return: The chembl of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._chembl<|docstring|>Gets the chembl of this CompoundInfoIdentifiers. ChEMBL id of the compound (CURIE). # noqa: E501 :return: The chembl of this CompoundInfoIdentifiers. :rtype: str<|endoftext|>
ae0b9b6eb8cdac10200f24f98201d22e67d606284c6cd7c9adda31d8dee96392
@chembl.setter def chembl(self, chembl): 'Sets the chembl of this CompoundInfoIdentifiers.\n\n ChEMBL id of the compound (CURIE). # noqa: E501\n\n :param chembl: The chembl of this CompoundInfoIdentifiers.\n :type chembl: str\n ' self._chembl = chembl
Sets the chembl of this CompoundInfoIdentifiers. ChEMBL id of the compound (CURIE). # noqa: E501 :param chembl: The chembl of this CompoundInfoIdentifiers. :type chembl: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
chembl
pahmadi8740/molecular-data-provider
5
python
@chembl.setter def chembl(self, chembl): 'Sets the chembl of this CompoundInfoIdentifiers.\n\n ChEMBL id of the compound (CURIE). # noqa: E501\n\n :param chembl: The chembl of this CompoundInfoIdentifiers.\n :type chembl: str\n ' self._chembl = chembl
@chembl.setter def chembl(self, chembl): 'Sets the chembl of this CompoundInfoIdentifiers.\n\n ChEMBL id of the compound (CURIE). # noqa: E501\n\n :param chembl: The chembl of this CompoundInfoIdentifiers.\n :type chembl: str\n ' self._chembl = chembl<|docstring|>Sets the chembl of this CompoundInfoIdentifiers. ChEMBL id of the compound (CURIE). # noqa: E501 :param chembl: The chembl of this CompoundInfoIdentifiers. :type chembl: str<|endoftext|>
d8a15712b85bc3b8d55c881b9bf00f5ed17c78a1adcfe53e56068f192b99d2b2
@property def chebi(self): 'Gets the chebi of this CompoundInfoIdentifiers.\n\n ChEBI id of the compound (CURIE). # noqa: E501\n\n :return: The chebi of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._chebi
Gets the chebi of this CompoundInfoIdentifiers. ChEBI id of the compound (CURIE). # noqa: E501 :return: The chebi of this CompoundInfoIdentifiers. :rtype: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
chebi
pahmadi8740/molecular-data-provider
5
python
@property def chebi(self): 'Gets the chebi of this CompoundInfoIdentifiers.\n\n ChEBI id of the compound (CURIE). # noqa: E501\n\n :return: The chebi of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._chebi
@property def chebi(self): 'Gets the chebi of this CompoundInfoIdentifiers.\n\n ChEBI id of the compound (CURIE). # noqa: E501\n\n :return: The chebi of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._chebi<|docstring|>Gets the chebi of this CompoundInfoIdentifiers. ChEBI id of the compound (CURIE). # noqa: E501 :return: The chebi of this CompoundInfoIdentifiers. :rtype: str<|endoftext|>
4810dda84c55bd577f2956d86eea38897209c77d11c0f8c181d28a2a604223ef
@chebi.setter def chebi(self, chebi): 'Sets the chebi of this CompoundInfoIdentifiers.\n\n ChEBI id of the compound (CURIE). # noqa: E501\n\n :param chebi: The chebi of this CompoundInfoIdentifiers.\n :type chebi: str\n ' self._chebi = chebi
Sets the chebi of this CompoundInfoIdentifiers. ChEBI id of the compound (CURIE). # noqa: E501 :param chebi: The chebi of this CompoundInfoIdentifiers. :type chebi: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
chebi
pahmadi8740/molecular-data-provider
5
python
@chebi.setter def chebi(self, chebi): 'Sets the chebi of this CompoundInfoIdentifiers.\n\n ChEBI id of the compound (CURIE). # noqa: E501\n\n :param chebi: The chebi of this CompoundInfoIdentifiers.\n :type chebi: str\n ' self._chebi = chebi
@chebi.setter def chebi(self, chebi): 'Sets the chebi of this CompoundInfoIdentifiers.\n\n ChEBI id of the compound (CURIE). # noqa: E501\n\n :param chebi: The chebi of this CompoundInfoIdentifiers.\n :type chebi: str\n ' self._chebi = chebi<|docstring|>Sets the chebi of this CompoundInfoIdentifiers. ChEBI id of the compound (CURIE). # noqa: E501 :param chebi: The chebi of this CompoundInfoIdentifiers. :type chebi: str<|endoftext|>
64f137d5dd14047725ce88133ef39a441af6517a2744f154f579c2820be39f67
@property def hmdb(self): 'Gets the hmdb of this CompoundInfoIdentifiers.\n\n HMDB id of the compound (CURIE). # noqa: E501\n\n :return: The hmdb of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._hmdb
Gets the hmdb of this CompoundInfoIdentifiers. HMDB id of the compound (CURIE). # noqa: E501 :return: The hmdb of this CompoundInfoIdentifiers. :rtype: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
hmdb
pahmadi8740/molecular-data-provider
5
python
@property def hmdb(self): 'Gets the hmdb of this CompoundInfoIdentifiers.\n\n HMDB id of the compound (CURIE). # noqa: E501\n\n :return: The hmdb of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._hmdb
@property def hmdb(self): 'Gets the hmdb of this CompoundInfoIdentifiers.\n\n HMDB id of the compound (CURIE). # noqa: E501\n\n :return: The hmdb of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._hmdb<|docstring|>Gets the hmdb of this CompoundInfoIdentifiers. HMDB id of the compound (CURIE). # noqa: E501 :return: The hmdb of this CompoundInfoIdentifiers. :rtype: str<|endoftext|>
f59a46754dff88b93a716ccdf7197b46d2e1917677e294caea52ee89cb40a8a3
@hmdb.setter def hmdb(self, hmdb): 'Sets the hmdb of this CompoundInfoIdentifiers.\n\n HMDB id of the compound (CURIE). # noqa: E501\n\n :param hmdb: The hmdb of this CompoundInfoIdentifiers.\n :type hmdb: str\n ' self._hmdb = hmdb
Sets the hmdb of this CompoundInfoIdentifiers. HMDB id of the compound (CURIE). # noqa: E501 :param hmdb: The hmdb of this CompoundInfoIdentifiers. :type hmdb: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
hmdb
pahmadi8740/molecular-data-provider
5
python
@hmdb.setter def hmdb(self, hmdb): 'Sets the hmdb of this CompoundInfoIdentifiers.\n\n HMDB id of the compound (CURIE). # noqa: E501\n\n :param hmdb: The hmdb of this CompoundInfoIdentifiers.\n :type hmdb: str\n ' self._hmdb = hmdb
@hmdb.setter def hmdb(self, hmdb): 'Sets the hmdb of this CompoundInfoIdentifiers.\n\n HMDB id of the compound (CURIE). # noqa: E501\n\n :param hmdb: The hmdb of this CompoundInfoIdentifiers.\n :type hmdb: str\n ' self._hmdb = hmdb<|docstring|>Sets the hmdb of this CompoundInfoIdentifiers. HMDB id of the compound (CURIE). # noqa: E501 :param hmdb: The hmdb of this CompoundInfoIdentifiers. :type hmdb: str<|endoftext|>
1505cdd13332004072372b06f7e5bef753ef0cf3135b35df733c070d94a2ac5f
@property def mychem_info(self): 'Gets the mychem_info of this CompoundInfoIdentifiers.\n\n myChem.info id of the compound. # noqa: E501\n\n :return: The mychem_info of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._mychem_info
Gets the mychem_info of this CompoundInfoIdentifiers. myChem.info id of the compound. # noqa: E501 :return: The mychem_info of this CompoundInfoIdentifiers. :rtype: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
mychem_info
pahmadi8740/molecular-data-provider
5
python
@property def mychem_info(self): 'Gets the mychem_info of this CompoundInfoIdentifiers.\n\n myChem.info id of the compound. # noqa: E501\n\n :return: The mychem_info of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._mychem_info
@property def mychem_info(self): 'Gets the mychem_info of this CompoundInfoIdentifiers.\n\n myChem.info id of the compound. # noqa: E501\n\n :return: The mychem_info of this CompoundInfoIdentifiers.\n :rtype: str\n ' return self._mychem_info<|docstring|>Gets the mychem_info of this CompoundInfoIdentifiers. myChem.info id of the compound. # noqa: E501 :return: The mychem_info of this CompoundInfoIdentifiers. :rtype: str<|endoftext|>
0f241f364025177caca63913b17cd38e97a9c554c53272cee3e33d650d2e76e8
@mychem_info.setter def mychem_info(self, mychem_info): 'Sets the mychem_info of this CompoundInfoIdentifiers.\n\n myChem.info id of the compound. # noqa: E501\n\n :param mychem_info: The mychem_info of this CompoundInfoIdentifiers.\n :type mychem_info: str\n ' self._mychem_info = mychem_info
Sets the mychem_info of this CompoundInfoIdentifiers. myChem.info id of the compound. # noqa: E501 :param mychem_info: The mychem_info of this CompoundInfoIdentifiers. :type mychem_info: str
transformers/pubchem/python-flask-server/openapi_server/models/compound_info_identifiers.py
mychem_info
pahmadi8740/molecular-data-provider
5
python
@mychem_info.setter def mychem_info(self, mychem_info): 'Sets the mychem_info of this CompoundInfoIdentifiers.\n\n myChem.info id of the compound. # noqa: E501\n\n :param mychem_info: The mychem_info of this CompoundInfoIdentifiers.\n :type mychem_info: str\n ' self._mychem_info = mychem_info
@mychem_info.setter def mychem_info(self, mychem_info): 'Sets the mychem_info of this CompoundInfoIdentifiers.\n\n myChem.info id of the compound. # noqa: E501\n\n :param mychem_info: The mychem_info of this CompoundInfoIdentifiers.\n :type mychem_info: str\n ' self._mychem_info = mychem_info<|docstring|>Sets the mychem_info of this CompoundInfoIdentifiers. myChem.info id of the compound. # noqa: E501 :param mychem_info: The mychem_info of this CompoundInfoIdentifiers. :type mychem_info: str<|endoftext|>
393112421766e64935e057a7ebe91854e6140266c290294953650368454e0348
def __init__(self, env): '\n envs: list of gym environments to run in subprocesses\n ' self.env = env self.remotes = [0]
envs: list of gym environments to run in subprocesses
common/FakeVecEnv.py
__init__
neverdie88/collective-planning
1
python
def __init__(self, env): '\n \n ' self.env = env self.remotes = [0]
def __init__(self, env): '\n \n ' self.env = env self.remotes = [0]<|docstring|>envs: list of gym environments to run in subprocesses<|endoftext|>
415b17435a6cd23000ee3e0d3c99121de6fe7810b5e394741135318fc59699e9
def check_params(self): '\n Validate some of the parameters.\n ' if (not (((self.xM_size * self.yN_size) % self.N) == 0)): raise ValueError
Validate some of the parameters.
src/fourier_transform/algorithm_parameters.py
check_params
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
def check_params(self): '\n \n ' if (not (((self.xM_size * self.yN_size) % self.N) == 0)): raise ValueError
def check_params(self): '\n \n ' if (not (((self.xM_size * self.yN_size) % self.N) == 0)): raise ValueError<|docstring|>Validate some of the parameters.<|endoftext|>
940e0938623a9f8bf87ec7097afde10054dc2de52f4e9471873738b057fbcb3d
def calculate_facet_off(self): '\n Calculate facet offset array\n ' facet_off = (self.yB_size * numpy.arange(self.nfacet)) return facet_off
Calculate facet offset array
src/fourier_transform/algorithm_parameters.py
calculate_facet_off
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
def calculate_facet_off(self): '\n \n ' facet_off = (self.yB_size * numpy.arange(self.nfacet)) return facet_off
def calculate_facet_off(self): '\n \n ' facet_off = (self.yB_size * numpy.arange(self.nfacet)) return facet_off<|docstring|>Calculate facet offset array<|endoftext|>
f48c879af7376b43242903b15603de1706c67f62df417073be8810b9e99f53fa
def calculate_subgrid_off(self): '\n Calculate subgrid offset array\n ' subgrid_off = ((self.xA_size * numpy.arange(self.nsubgrid)) + self.Nx) return subgrid_off
Calculate subgrid offset array
src/fourier_transform/algorithm_parameters.py
calculate_subgrid_off
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
def calculate_subgrid_off(self): '\n \n ' subgrid_off = ((self.xA_size * numpy.arange(self.nsubgrid)) + self.Nx) return subgrid_off
def calculate_subgrid_off(self): '\n \n ' subgrid_off = ((self.xA_size * numpy.arange(self.nsubgrid)) + self.Nx) return subgrid_off<|docstring|>Calculate subgrid offset array<|endoftext|>
881fb19f3f246b2e43f28159b4211041526f7883af2cc60b52e3b8d604c5431e
def _generate_mask(self, mask_size, offsets): '\n Determine the appropriate masks for cutting out subgrids/facets.\n For each offset in offsets, a mask is generated of size mask_size.\n The mask is centred around the specific offset.\n\n :param mask_size: size of the required mask (xA_size or yB_size)\n :param offsets: array of subgrid or facet offsets\n (subgrid_off or facet_off)\n\n :return: mask (subgrid_A or facet_B)\n ' mask = numpy.zeros((len(offsets), mask_size), dtype=int) border = ((offsets + numpy.hstack([offsets[1:], [(self.N + offsets[0])]])) // 2) for (i, offset) in enumerate(offsets): left = (((border[(i - 1)] - offset) + (mask_size // 2)) % self.N) right = ((border[i] - offset) + (mask_size // 2)) if ((not (left >= 0)) and (right <= mask_size)): raise ValueError('Mask size not large enough to cover subgrids / facets!') mask[(i, left:right)] = 1 return mask
Determine the appropriate masks for cutting out subgrids/facets. For each offset in offsets, a mask is generated of size mask_size. The mask is centred around the specific offset. :param mask_size: size of the required mask (xA_size or yB_size) :param offsets: array of subgrid or facet offsets (subgrid_off or facet_off) :return: mask (subgrid_A or facet_B)
src/fourier_transform/algorithm_parameters.py
_generate_mask
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
def _generate_mask(self, mask_size, offsets): '\n Determine the appropriate masks for cutting out subgrids/facets.\n For each offset in offsets, a mask is generated of size mask_size.\n The mask is centred around the specific offset.\n\n :param mask_size: size of the required mask (xA_size or yB_size)\n :param offsets: array of subgrid or facet offsets\n (subgrid_off or facet_off)\n\n :return: mask (subgrid_A or facet_B)\n ' mask = numpy.zeros((len(offsets), mask_size), dtype=int) border = ((offsets + numpy.hstack([offsets[1:], [(self.N + offsets[0])]])) // 2) for (i, offset) in enumerate(offsets): left = (((border[(i - 1)] - offset) + (mask_size // 2)) % self.N) right = ((border[i] - offset) + (mask_size // 2)) if ((not (left >= 0)) and (right <= mask_size)): raise ValueError('Mask size not large enough to cover subgrids / facets!') mask[(i, left:right)] = 1 return mask
def _generate_mask(self, mask_size, offsets): '\n Determine the appropriate masks for cutting out subgrids/facets.\n For each offset in offsets, a mask is generated of size mask_size.\n The mask is centred around the specific offset.\n\n :param mask_size: size of the required mask (xA_size or yB_size)\n :param offsets: array of subgrid or facet offsets\n (subgrid_off or facet_off)\n\n :return: mask (subgrid_A or facet_B)\n ' mask = numpy.zeros((len(offsets), mask_size), dtype=int) border = ((offsets + numpy.hstack([offsets[1:], [(self.N + offsets[0])]])) // 2) for (i, offset) in enumerate(offsets): left = (((border[(i - 1)] - offset) + (mask_size // 2)) % self.N) right = ((border[i] - offset) + (mask_size // 2)) if ((not (left >= 0)) and (right <= mask_size)): raise ValueError('Mask size not large enough to cover subgrids / facets!') mask[(i, left:right)] = 1 return mask<|docstring|>Determine the appropriate masks for cutting out subgrids/facets. For each offset in offsets, a mask is generated of size mask_size. The mask is centred around the specific offset. :param mask_size: size of the required mask (xA_size or yB_size) :param offsets: array of subgrid or facet offsets (subgrid_off or facet_off) :return: mask (subgrid_A or facet_B)<|endoftext|>
99102ca93893d0dc9e72473f3c3dfda8d60c7afb836d038c882b7617b92a0bab
def calculate_facet_B(self): '\n Calculate facet mask\n ' facet_B = self._generate_mask(self.yB_size, self.facet_off) return facet_B
Calculate facet mask
src/fourier_transform/algorithm_parameters.py
calculate_facet_B
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
def calculate_facet_B(self): '\n \n ' facet_B = self._generate_mask(self.yB_size, self.facet_off) return facet_B
def calculate_facet_B(self): '\n \n ' facet_B = self._generate_mask(self.yB_size, self.facet_off) return facet_B<|docstring|>Calculate facet mask<|endoftext|>
1a290f454d13b84a100b1f95b859a69163297667804b929ca322b9120bc3efb4
def calculate_subgrid_A(self): '\n Calculate subgrid mask\n ' subgrid_A = self._generate_mask(self.xA_size, self.subgrid_off) return subgrid_A
Calculate subgrid mask
src/fourier_transform/algorithm_parameters.py
calculate_subgrid_A
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
def calculate_subgrid_A(self): '\n \n ' subgrid_A = self._generate_mask(self.xA_size, self.subgrid_off) return subgrid_A
def calculate_subgrid_A(self): '\n \n ' subgrid_A = self._generate_mask(self.xA_size, self.subgrid_off) return subgrid_A<|docstring|>Calculate subgrid mask<|endoftext|>
c3bdb95a4242af31d6d708668343641539945c2e398488e7c60e2d460f768411
def calculate_Fb(self): '\n Calculate the Fourier transform of grid correction function\n ' Fb = (1 / extract_mid(self.pswf, self.yB_size, axis=0)) return Fb
Calculate the Fourier transform of grid correction function
src/fourier_transform/algorithm_parameters.py
calculate_Fb
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
def calculate_Fb(self): '\n \n ' Fb = (1 / extract_mid(self.pswf, self.yB_size, axis=0)) return Fb
def calculate_Fb(self): '\n \n ' Fb = (1 / extract_mid(self.pswf, self.yB_size, axis=0)) return Fb<|docstring|>Calculate the Fourier transform of grid correction function<|endoftext|>
598f895b02e34385a3d750215f90b537b2648efc5aac65c04beaede98c8d5787
def calculate_Fn(self): '\n Calculate the Fourier transform of gridding function\n ' Fn = self.pswf[((self.yN_size // 2) % int((self.N / self.xM_size)))::int((self.N / self.xM_size))] return Fn
Calculate the Fourier transform of gridding function
src/fourier_transform/algorithm_parameters.py
calculate_Fn
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
def calculate_Fn(self): '\n \n ' Fn = self.pswf[((self.yN_size // 2) % int((self.N / self.xM_size)))::int((self.N / self.xM_size))] return Fn
def calculate_Fn(self): '\n \n ' Fn = self.pswf[((self.yN_size // 2) % int((self.N / self.xM_size)))::int((self.N / self.xM_size))] return Fn<|docstring|>Calculate the Fourier transform of gridding function<|endoftext|>
c11a7d8fc4b4c8ffb09af334aaa0c3b9ed91f7e9b843692fb8721ef44abb303d
def calculate_facet_m0_trunc(self): '\n Calculate the mask truncated to a facet (image space)\n ' temp_facet_m0_trunc = (self.pswf * numpy.sinc((((coordinates(self.yN_size) * self.xM_size) / self.N) * self.yN_size))) facet_m0_trunc = (((self.xM_size * self.yP_size) / self.N) * extract_mid(ifft(pad_mid(temp_facet_m0_trunc, self.yP_size, axis=0), axis=0), self.xMxN_yP_size, axis=0).real) return facet_m0_trunc
Calculate the mask truncated to a facet (image space)
src/fourier_transform/algorithm_parameters.py
calculate_facet_m0_trunc
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
def calculate_facet_m0_trunc(self): '\n \n ' temp_facet_m0_trunc = (self.pswf * numpy.sinc((((coordinates(self.yN_size) * self.xM_size) / self.N) * self.yN_size))) facet_m0_trunc = (((self.xM_size * self.yP_size) / self.N) * extract_mid(ifft(pad_mid(temp_facet_m0_trunc, self.yP_size, axis=0), axis=0), self.xMxN_yP_size, axis=0).real) return facet_m0_trunc
def calculate_facet_m0_trunc(self): '\n \n ' temp_facet_m0_trunc = (self.pswf * numpy.sinc((((coordinates(self.yN_size) * self.xM_size) / self.N) * self.yN_size))) facet_m0_trunc = (((self.xM_size * self.yP_size) / self.N) * extract_mid(ifft(pad_mid(temp_facet_m0_trunc, self.yP_size, axis=0), axis=0), self.xMxN_yP_size, axis=0).real) return facet_m0_trunc<|docstring|>Calculate the mask truncated to a facet (image space)<|endoftext|>
80d0666e2482a8353e1256b79b044d2fbfbfb40fe90f954915bc2920612974b3
def calculate_pswf(self): '\n Calculate 1D PSWF (prolate-spheroidal wave function) at the\n full required resolution (facet size)\n\n See also: VLA Scientific Memoranda 129, 131, 132\n ' alpha = 0 pswf = scipy.special.pro_ang1(alpha, alpha, ((numpy.pi * self.W) / 2), (2 * coordinates(self.yN_size)))[0] pswf[0] = 0 pswf = pswf.real pswf /= numpy.prod(numpy.arange(((2 * alpha) - 1), 0, (- 2), dtype=float)) return pswf
Calculate 1D PSWF (prolate-spheroidal wave function) at the full required resolution (facet size) See also: VLA Scientific Memoranda 129, 131, 132
src/fourier_transform/algorithm_parameters.py
calculate_pswf
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
def calculate_pswf(self): '\n Calculate 1D PSWF (prolate-spheroidal wave function) at the\n full required resolution (facet size)\n\n See also: VLA Scientific Memoranda 129, 131, 132\n ' alpha = 0 pswf = scipy.special.pro_ang1(alpha, alpha, ((numpy.pi * self.W) / 2), (2 * coordinates(self.yN_size)))[0] pswf[0] = 0 pswf = pswf.real pswf /= numpy.prod(numpy.arange(((2 * alpha) - 1), 0, (- 2), dtype=float)) return pswf
def calculate_pswf(self): '\n Calculate 1D PSWF (prolate-spheroidal wave function) at the\n full required resolution (facet size)\n\n See also: VLA Scientific Memoranda 129, 131, 132\n ' alpha = 0 pswf = scipy.special.pro_ang1(alpha, alpha, ((numpy.pi * self.W) / 2), (2 * coordinates(self.yN_size)))[0] pswf[0] = 0 pswf = pswf.real pswf /= numpy.prod(numpy.arange(((2 * alpha) - 1), 0, (- 2), dtype=float)) return pswf<|docstring|>Calculate 1D PSWF (prolate-spheroidal wave function) at the full required resolution (facet size) See also: VLA Scientific Memoranda 129, 131, 132<|endoftext|>
26beb9ea2ba5756773551c718209885a8da24cd3878795f21f353e1985fc2275
@dask_wrapper def prepare_facet(self, facet, axis, Fb, **kwargs): '\n Calculate the inverse FFT of a padded facet element multiplied by Fb\n (Fb: Fourier transform of grid correction function)\n\n :param facet: single facet element\n :param axis: axis along which operations are performed (0 or 1)\n :param Fb: Fourier transform of grid correction function\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: TODO: BF? prepared facet\n ' BF = pad_mid((facet * broadcast(Fb, len(facet.shape), axis)), self.yP_size, axis) BF = ifft(BF, axis) return BF
Calculate the inverse FFT of a padded facet element multiplied by Fb (Fb: Fourier transform of grid correction function) :param facet: single facet element :param axis: axis along which operations are performed (0 or 1) :param Fb: Fourier transform of grid correction function :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: TODO: BF? prepared facet
src/fourier_transform/algorithm_parameters.py
prepare_facet
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
@dask_wrapper def prepare_facet(self, facet, axis, Fb, **kwargs): '\n Calculate the inverse FFT of a padded facet element multiplied by Fb\n (Fb: Fourier transform of grid correction function)\n\n :param facet: single facet element\n :param axis: axis along which operations are performed (0 or 1)\n :param Fb: Fourier transform of grid correction function\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: TODO: BF? prepared facet\n ' BF = pad_mid((facet * broadcast(Fb, len(facet.shape), axis)), self.yP_size, axis) BF = ifft(BF, axis) return BF
@dask_wrapper def prepare_facet(self, facet, axis, Fb, **kwargs): '\n Calculate the inverse FFT of a padded facet element multiplied by Fb\n (Fb: Fourier transform of grid correction function)\n\n :param facet: single facet element\n :param axis: axis along which operations are performed (0 or 1)\n :param Fb: Fourier transform of grid correction function\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: TODO: BF? prepared facet\n ' BF = pad_mid((facet * broadcast(Fb, len(facet.shape), axis)), self.yP_size, axis) BF = ifft(BF, axis) return BF<|docstring|>Calculate the inverse FFT of a padded facet element multiplied by Fb (Fb: Fourier transform of grid correction function) :param facet: single facet element :param axis: axis along which operations are performed (0 or 1) :param Fb: Fourier transform of grid correction function :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: TODO: BF? prepared facet<|endoftext|>
73c8549d516c9b1ad937dc9a82fafd2b9b979e0a8b9e0939aacb8712539a05b7
@dask_wrapper def extract_facet_contrib_to_subgrid(self, BF, axis, subgrid_off_elem, facet_m0_trunc, Fn, **kwargs): '\n Extract the facet contribution to a subgrid.\n\n :param BF: TODO: ? prepared facet\n :param axis: axis along which the operations are performed (0 or 1)\n :param subgrid_off_elem: single subgrid offset element\n :param facet_m0_trunc: mask truncated to a facet (image space)\n :param Fn: Fourier transform of gridding function\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: contribution of facet to subgrid\n ' dims = len(BF.shape) BF_mid = extract_mid(numpy.roll(BF, (((- subgrid_off_elem) * self.yP_size) // self.N), axis), self.xMxN_yP_size, axis) MBF = (broadcast(facet_m0_trunc, dims, axis) * BF_mid) MBF_sum = numpy.array(extract_mid(MBF, self.xM_yP_size, axis)) xN_yP_size = (self.xMxN_yP_size - self.xM_yP_size) slc1 = create_slice(slice(None), slice((xN_yP_size // 2)), dims, axis) slc2 = create_slice(slice(None), slice(((- xN_yP_size) // 2), None), dims, axis) MBF_sum[slc1] += MBF[slc2] MBF_sum[slc2] += MBF[slc1] return (broadcast(Fn, len(BF.shape), axis) * extract_mid(fft(MBF_sum, axis), self.xM_yN_size, axis))
Extract the facet contribution to a subgrid. :param BF: TODO: ? prepared facet :param axis: axis along which the operations are performed (0 or 1) :param subgrid_off_elem: single subgrid offset element :param facet_m0_trunc: mask truncated to a facet (image space) :param Fn: Fourier transform of gridding function :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: contribution of facet to subgrid
src/fourier_transform/algorithm_parameters.py
extract_facet_contrib_to_subgrid
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
@dask_wrapper def extract_facet_contrib_to_subgrid(self, BF, axis, subgrid_off_elem, facet_m0_trunc, Fn, **kwargs): '\n Extract the facet contribution to a subgrid.\n\n :param BF: TODO: ? prepared facet\n :param axis: axis along which the operations are performed (0 or 1)\n :param subgrid_off_elem: single subgrid offset element\n :param facet_m0_trunc: mask truncated to a facet (image space)\n :param Fn: Fourier transform of gridding function\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: contribution of facet to subgrid\n ' dims = len(BF.shape) BF_mid = extract_mid(numpy.roll(BF, (((- subgrid_off_elem) * self.yP_size) // self.N), axis), self.xMxN_yP_size, axis) MBF = (broadcast(facet_m0_trunc, dims, axis) * BF_mid) MBF_sum = numpy.array(extract_mid(MBF, self.xM_yP_size, axis)) xN_yP_size = (self.xMxN_yP_size - self.xM_yP_size) slc1 = create_slice(slice(None), slice((xN_yP_size // 2)), dims, axis) slc2 = create_slice(slice(None), slice(((- xN_yP_size) // 2), None), dims, axis) MBF_sum[slc1] += MBF[slc2] MBF_sum[slc2] += MBF[slc1] return (broadcast(Fn, len(BF.shape), axis) * extract_mid(fft(MBF_sum, axis), self.xM_yN_size, axis))
@dask_wrapper def extract_facet_contrib_to_subgrid(self, BF, axis, subgrid_off_elem, facet_m0_trunc, Fn, **kwargs): '\n Extract the facet contribution to a subgrid.\n\n :param BF: TODO: ? prepared facet\n :param axis: axis along which the operations are performed (0 or 1)\n :param subgrid_off_elem: single subgrid offset element\n :param facet_m0_trunc: mask truncated to a facet (image space)\n :param Fn: Fourier transform of gridding function\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: contribution of facet to subgrid\n ' dims = len(BF.shape) BF_mid = extract_mid(numpy.roll(BF, (((- subgrid_off_elem) * self.yP_size) // self.N), axis), self.xMxN_yP_size, axis) MBF = (broadcast(facet_m0_trunc, dims, axis) * BF_mid) MBF_sum = numpy.array(extract_mid(MBF, self.xM_yP_size, axis)) xN_yP_size = (self.xMxN_yP_size - self.xM_yP_size) slc1 = create_slice(slice(None), slice((xN_yP_size // 2)), dims, axis) slc2 = create_slice(slice(None), slice(((- xN_yP_size) // 2), None), dims, axis) MBF_sum[slc1] += MBF[slc2] MBF_sum[slc2] += MBF[slc1] return (broadcast(Fn, len(BF.shape), axis) * extract_mid(fft(MBF_sum, axis), self.xM_yN_size, axis))<|docstring|>Extract the facet contribution to a subgrid. :param BF: TODO: ? prepared facet :param axis: axis along which the operations are performed (0 or 1) :param subgrid_off_elem: single subgrid offset element :param facet_m0_trunc: mask truncated to a facet (image space) :param Fn: Fourier transform of gridding function :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: contribution of facet to subgrid<|endoftext|>
004ef272ab22b3c484046f9aaa04575ff372cd7bb496b32e9c13cfe68ffcee57
@dask_wrapper def add_facet_contribution(self, facet_contrib, facet_off_elem, axis, **kwargs): '\n Further transforms facet contributions, which then will be summed up.\n\n :param facet_contrib: array-chunk of individual facet contributions\n :param facet_off_elem: facet offset for the facet_contrib array chunk\n :param axis: axis along which the operations are performed (0 or 1)\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: TODO??\n ' return numpy.roll(pad_mid(facet_contrib, self.xM_size, axis), ((facet_off_elem * self.xM_size) // self.N), axis=axis)
Further transforms facet contributions, which then will be summed up. :param facet_contrib: array-chunk of individual facet contributions :param facet_off_elem: facet offset for the facet_contrib array chunk :param axis: axis along which the operations are performed (0 or 1) :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: TODO??
src/fourier_transform/algorithm_parameters.py
add_facet_contribution
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
@dask_wrapper def add_facet_contribution(self, facet_contrib, facet_off_elem, axis, **kwargs): '\n Further transforms facet contributions, which then will be summed up.\n\n :param facet_contrib: array-chunk of individual facet contributions\n :param facet_off_elem: facet offset for the facet_contrib array chunk\n :param axis: axis along which the operations are performed (0 or 1)\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: TODO??\n ' return numpy.roll(pad_mid(facet_contrib, self.xM_size, axis), ((facet_off_elem * self.xM_size) // self.N), axis=axis)
@dask_wrapper def add_facet_contribution(self, facet_contrib, facet_off_elem, axis, **kwargs): '\n Further transforms facet contributions, which then will be summed up.\n\n :param facet_contrib: array-chunk of individual facet contributions\n :param facet_off_elem: facet offset for the facet_contrib array chunk\n :param axis: axis along which the operations are performed (0 or 1)\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: TODO??\n ' return numpy.roll(pad_mid(facet_contrib, self.xM_size, axis), ((facet_off_elem * self.xM_size) // self.N), axis=axis)<|docstring|>Further transforms facet contributions, which then will be summed up. :param facet_contrib: array-chunk of individual facet contributions :param facet_off_elem: facet offset for the facet_contrib array chunk :param axis: axis along which the operations are performed (0 or 1) :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: TODO??<|endoftext|>
be1ae30a00ae3ec20ab35d6087237b2702cc4a6ea99148a81826119ddb620d3e
@dask_wrapper def finish_subgrid(self, summed_facets, subgrid_mask1, subgrid_mask2, **kwargs): '\n Obtain finished subgrid.\n Operation performed for both axis\n (only works on 2D arrays in its current form).\n\n :param summed_facets: summed facets contributing to thins subgrid\n :param subgrid_mask1: ith subgrid mask element\n :param subgrid_mask2: (i+1)th subgrid mask element\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: approximate subgrid element\n ' tmp = extract_mid(extract_mid(ifft(ifft(summed_facets, axis=0), axis=1), self.xA_size, axis=0), self.xA_size, axis=1) approx_subgrid = (tmp * numpy.outer(subgrid_mask1, subgrid_mask2)) return approx_subgrid
Obtain finished subgrid. Operation performed for both axis (only works on 2D arrays in its current form). :param summed_facets: summed facets contributing to thins subgrid :param subgrid_mask1: ith subgrid mask element :param subgrid_mask2: (i+1)th subgrid mask element :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: approximate subgrid element
src/fourier_transform/algorithm_parameters.py
finish_subgrid
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
@dask_wrapper def finish_subgrid(self, summed_facets, subgrid_mask1, subgrid_mask2, **kwargs): '\n Obtain finished subgrid.\n Operation performed for both axis\n (only works on 2D arrays in its current form).\n\n :param summed_facets: summed facets contributing to thins subgrid\n :param subgrid_mask1: ith subgrid mask element\n :param subgrid_mask2: (i+1)th subgrid mask element\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: approximate subgrid element\n ' tmp = extract_mid(extract_mid(ifft(ifft(summed_facets, axis=0), axis=1), self.xA_size, axis=0), self.xA_size, axis=1) approx_subgrid = (tmp * numpy.outer(subgrid_mask1, subgrid_mask2)) return approx_subgrid
@dask_wrapper def finish_subgrid(self, summed_facets, subgrid_mask1, subgrid_mask2, **kwargs): '\n Obtain finished subgrid.\n Operation performed for both axis\n (only works on 2D arrays in its current form).\n\n :param summed_facets: summed facets contributing to thins subgrid\n :param subgrid_mask1: ith subgrid mask element\n :param subgrid_mask2: (i+1)th subgrid mask element\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: approximate subgrid element\n ' tmp = extract_mid(extract_mid(ifft(ifft(summed_facets, axis=0), axis=1), self.xA_size, axis=0), self.xA_size, axis=1) approx_subgrid = (tmp * numpy.outer(subgrid_mask1, subgrid_mask2)) return approx_subgrid<|docstring|>Obtain finished subgrid. Operation performed for both axis (only works on 2D arrays in its current form). :param summed_facets: summed facets contributing to thins subgrid :param subgrid_mask1: ith subgrid mask element :param subgrid_mask2: (i+1)th subgrid mask element :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: approximate subgrid element<|endoftext|>
225e638fcfe77b178d7b03e67072be83afb3f12ea9ea02439d532efb55fa411d
@dask_wrapper def prepare_subgrid(self, subgrid, **kwargs): '\n Calculate the FFT of a padded subgrid element.\n No reason to do this per-axis, so always do it for both axis.\n (Note: it will only work for 2D subgrid arrays)\n\n :param subgrid: single subgrid array element\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: TODO: the FS ??? term\n ' padded = pad_mid(pad_mid(subgrid, self.xM_size, axis=0), self.xM_size, axis=1) fftd = fft(fft(padded, axis=0), axis=1) return fftd
Calculate the FFT of a padded subgrid element. No reason to do this per-axis, so always do it for both axis. (Note: it will only work for 2D subgrid arrays) :param subgrid: single subgrid array element :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: TODO: the FS ??? term
src/fourier_transform/algorithm_parameters.py
prepare_subgrid
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
@dask_wrapper def prepare_subgrid(self, subgrid, **kwargs): '\n Calculate the FFT of a padded subgrid element.\n No reason to do this per-axis, so always do it for both axis.\n (Note: it will only work for 2D subgrid arrays)\n\n :param subgrid: single subgrid array element\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: TODO: the FS ??? term\n ' padded = pad_mid(pad_mid(subgrid, self.xM_size, axis=0), self.xM_size, axis=1) fftd = fft(fft(padded, axis=0), axis=1) return fftd
@dask_wrapper def prepare_subgrid(self, subgrid, **kwargs): '\n Calculate the FFT of a padded subgrid element.\n No reason to do this per-axis, so always do it for both axis.\n (Note: it will only work for 2D subgrid arrays)\n\n :param subgrid: single subgrid array element\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: TODO: the FS ??? term\n ' padded = pad_mid(pad_mid(subgrid, self.xM_size, axis=0), self.xM_size, axis=1) fftd = fft(fft(padded, axis=0), axis=1) return fftd<|docstring|>Calculate the FFT of a padded subgrid element. No reason to do this per-axis, so always do it for both axis. (Note: it will only work for 2D subgrid arrays) :param subgrid: single subgrid array element :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: TODO: the FS ??? term<|endoftext|>
52a654166f28d4beb57005009b414f02af353505243029efd7ec1188aa745b52
@dask_wrapper def extract_subgrid_contrib_to_facet(self, FSi, facet_off_elem, Fn, axis, **kwargs): '\n Extract contribution of subgrid to a facet.\n\n :param Fsi: TODO???\n :param facet_off_elem: single facet offset element\n :param Fn: Fourier transform of gridding function\n :param axis: axis along which the operations are performed (0 or 1)\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: Contribution of subgrid to facet\n\n ' return (broadcast(Fn, len(FSi.shape), axis) * extract_mid(numpy.roll(FSi, (((- facet_off_elem) * self.xM_size) // self.N), axis), self.xM_yN_size, axis))
Extract contribution of subgrid to a facet. :param Fsi: TODO??? :param facet_off_elem: single facet offset element :param Fn: Fourier transform of gridding function :param axis: axis along which the operations are performed (0 or 1) :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: Contribution of subgrid to facet
src/fourier_transform/algorithm_parameters.py
extract_subgrid_contrib_to_facet
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
@dask_wrapper def extract_subgrid_contrib_to_facet(self, FSi, facet_off_elem, Fn, axis, **kwargs): '\n Extract contribution of subgrid to a facet.\n\n :param Fsi: TODO???\n :param facet_off_elem: single facet offset element\n :param Fn: Fourier transform of gridding function\n :param axis: axis along which the operations are performed (0 or 1)\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: Contribution of subgrid to facet\n\n ' return (broadcast(Fn, len(FSi.shape), axis) * extract_mid(numpy.roll(FSi, (((- facet_off_elem) * self.xM_size) // self.N), axis), self.xM_yN_size, axis))
@dask_wrapper def extract_subgrid_contrib_to_facet(self, FSi, facet_off_elem, Fn, axis, **kwargs): '\n Extract contribution of subgrid to a facet.\n\n :param Fsi: TODO???\n :param facet_off_elem: single facet offset element\n :param Fn: Fourier transform of gridding function\n :param axis: axis along which the operations are performed (0 or 1)\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: Contribution of subgrid to facet\n\n ' return (broadcast(Fn, len(FSi.shape), axis) * extract_mid(numpy.roll(FSi, (((- facet_off_elem) * self.xM_size) // self.N), axis), self.xM_yN_size, axis))<|docstring|>Extract contribution of subgrid to a facet. :param Fsi: TODO??? :param facet_off_elem: single facet offset element :param Fn: Fourier transform of gridding function :param axis: axis along which the operations are performed (0 or 1) :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: Contribution of subgrid to facet<|endoftext|>
1fd9deb738e3a8db22769909df0ee09d45f35283443ad67d6fe4c4727d5cf8b4
@dask_wrapper def add_subgrid_contribution(self, dims, NjSi, subgrid_off_elem, facet_m0_trunc, axis, **kwargs): '\n Further transform subgrid contributions, which are then summed up.\n\n :param dims: length of tuple to be produced by create_slice\n (i.e. number of dimensions); int\n :param NjSi: TODO\n :param subgrid_off_elem: single subgrid offset element\n :param facet_m0_trunc: mask truncated to a facet (image space)\n :param axis: axis along which operations are performed (0 or 1)\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return summed subgrid contributions\n\n ' xN_yP_size = (self.xMxN_yP_size - self.xM_yP_size) NjSi_mid = ifft(pad_mid(NjSi, self.xM_yP_size, axis), axis) NjSi_temp = pad_mid(NjSi_mid, self.xMxN_yP_size, axis) slc1 = create_slice(slice(None), slice((xN_yP_size // 2)), dims, axis) slc2 = create_slice(slice(None), slice(((- xN_yP_size) // 2), None), dims, axis) NjSi_temp[slc1] = NjSi_mid[slc2] NjSi_temp[slc2] = NjSi_mid[slc1] NjSi_temp = (NjSi_temp * broadcast(facet_m0_trunc, len(NjSi.shape), axis)) return numpy.roll(pad_mid(NjSi_temp, self.yP_size, axis), ((subgrid_off_elem * self.yP_size) // self.N), axis=axis)
Further transform subgrid contributions, which are then summed up. :param dims: length of tuple to be produced by create_slice (i.e. number of dimensions); int :param NjSi: TODO :param subgrid_off_elem: single subgrid offset element :param facet_m0_trunc: mask truncated to a facet (image space) :param axis: axis along which operations are performed (0 or 1) :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return summed subgrid contributions
src/fourier_transform/algorithm_parameters.py
add_subgrid_contribution
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
@dask_wrapper def add_subgrid_contribution(self, dims, NjSi, subgrid_off_elem, facet_m0_trunc, axis, **kwargs): '\n Further transform subgrid contributions, which are then summed up.\n\n :param dims: length of tuple to be produced by create_slice\n (i.e. number of dimensions); int\n :param NjSi: TODO\n :param subgrid_off_elem: single subgrid offset element\n :param facet_m0_trunc: mask truncated to a facet (image space)\n :param axis: axis along which operations are performed (0 or 1)\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return summed subgrid contributions\n\n ' xN_yP_size = (self.xMxN_yP_size - self.xM_yP_size) NjSi_mid = ifft(pad_mid(NjSi, self.xM_yP_size, axis), axis) NjSi_temp = pad_mid(NjSi_mid, self.xMxN_yP_size, axis) slc1 = create_slice(slice(None), slice((xN_yP_size // 2)), dims, axis) slc2 = create_slice(slice(None), slice(((- xN_yP_size) // 2), None), dims, axis) NjSi_temp[slc1] = NjSi_mid[slc2] NjSi_temp[slc2] = NjSi_mid[slc1] NjSi_temp = (NjSi_temp * broadcast(facet_m0_trunc, len(NjSi.shape), axis)) return numpy.roll(pad_mid(NjSi_temp, self.yP_size, axis), ((subgrid_off_elem * self.yP_size) // self.N), axis=axis)
@dask_wrapper def add_subgrid_contribution(self, dims, NjSi, subgrid_off_elem, facet_m0_trunc, axis, **kwargs): '\n Further transform subgrid contributions, which are then summed up.\n\n :param dims: length of tuple to be produced by create_slice\n (i.e. number of dimensions); int\n :param NjSi: TODO\n :param subgrid_off_elem: single subgrid offset element\n :param facet_m0_trunc: mask truncated to a facet (image space)\n :param axis: axis along which operations are performed (0 or 1)\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return summed subgrid contributions\n\n ' xN_yP_size = (self.xMxN_yP_size - self.xM_yP_size) NjSi_mid = ifft(pad_mid(NjSi, self.xM_yP_size, axis), axis) NjSi_temp = pad_mid(NjSi_mid, self.xMxN_yP_size, axis) slc1 = create_slice(slice(None), slice((xN_yP_size // 2)), dims, axis) slc2 = create_slice(slice(None), slice(((- xN_yP_size) // 2), None), dims, axis) NjSi_temp[slc1] = NjSi_mid[slc2] NjSi_temp[slc2] = NjSi_mid[slc1] NjSi_temp = (NjSi_temp * broadcast(facet_m0_trunc, len(NjSi.shape), axis)) return numpy.roll(pad_mid(NjSi_temp, self.yP_size, axis), ((subgrid_off_elem * self.yP_size) // self.N), axis=axis)<|docstring|>Further transform subgrid contributions, which are then summed up. :param dims: length of tuple to be produced by create_slice (i.e. number of dimensions); int :param NjSi: TODO :param subgrid_off_elem: single subgrid offset element :param facet_m0_trunc: mask truncated to a facet (image space) :param axis: axis along which operations are performed (0 or 1) :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return summed subgrid contributions<|endoftext|>
353a8fc8af5f6480dd7321c6b6a38bdd01ac2f48e81d94e33ecacff05e4cc2a6
@dask_wrapper def finish_facet(self, MiNjSi_sum, facet_B_mask_elem, Fb, axis, **kwargs): '\n Obtain finished facet.\n\n It extracts from the padded facet (obtained from subgrid via FFT)\n the true-sized facet and multiplies with masked Fb.\n (Fb: Fourier transform of grid correction function)\n\n :param MiNjSi_sum: sum of subgrid contributions to a facet\n :param facet_B_mask_elem: a facet mask element\n :param Fb: Fourier transform of grid correction function\n :param axis: axis along which operations are performed (0 or 1)\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: finished (approximate) facet element\n ' return (extract_mid(fft(MiNjSi_sum, axis), self.yB_size, axis) * broadcast((Fb * facet_B_mask_elem), len(MiNjSi_sum.shape), axis))
Obtain finished facet. It extracts from the padded facet (obtained from subgrid via FFT) the true-sized facet and multiplies with masked Fb. (Fb: Fourier transform of grid correction function) :param MiNjSi_sum: sum of subgrid contributions to a facet :param facet_B_mask_elem: a facet mask element :param Fb: Fourier transform of grid correction function :param axis: axis along which operations are performed (0 or 1) :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: finished (approximate) facet element
src/fourier_transform/algorithm_parameters.py
finish_facet
ska-telescope/ska-sdp-distributed-fourier-transform
0
python
@dask_wrapper def finish_facet(self, MiNjSi_sum, facet_B_mask_elem, Fb, axis, **kwargs): '\n Obtain finished facet.\n\n It extracts from the padded facet (obtained from subgrid via FFT)\n the true-sized facet and multiplies with masked Fb.\n (Fb: Fourier transform of grid correction function)\n\n :param MiNjSi_sum: sum of subgrid contributions to a facet\n :param facet_B_mask_elem: a facet mask element\n :param Fb: Fourier transform of grid correction function\n :param axis: axis along which operations are performed (0 or 1)\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: finished (approximate) facet element\n ' return (extract_mid(fft(MiNjSi_sum, axis), self.yB_size, axis) * broadcast((Fb * facet_B_mask_elem), len(MiNjSi_sum.shape), axis))
@dask_wrapper def finish_facet(self, MiNjSi_sum, facet_B_mask_elem, Fb, axis, **kwargs): '\n Obtain finished facet.\n\n It extracts from the padded facet (obtained from subgrid via FFT)\n the true-sized facet and multiplies with masked Fb.\n (Fb: Fourier transform of grid correction function)\n\n :param MiNjSi_sum: sum of subgrid contributions to a facet\n :param facet_B_mask_elem: a facet mask element\n :param Fb: Fourier transform of grid correction function\n :param axis: axis along which operations are performed (0 or 1)\n :param kwargs: needs to contain the following if dask is used:\n use_dask: True\n nout: <number of function outputs> --> 1\n\n :return: finished (approximate) facet element\n ' return (extract_mid(fft(MiNjSi_sum, axis), self.yB_size, axis) * broadcast((Fb * facet_B_mask_elem), len(MiNjSi_sum.shape), axis))<|docstring|>Obtain finished facet. It extracts from the padded facet (obtained from subgrid via FFT) the true-sized facet and multiplies with masked Fb. (Fb: Fourier transform of grid correction function) :param MiNjSi_sum: sum of subgrid contributions to a facet :param facet_B_mask_elem: a facet mask element :param Fb: Fourier transform of grid correction function :param axis: axis along which operations are performed (0 or 1) :param kwargs: needs to contain the following if dask is used: use_dask: True nout: <number of function outputs> --> 1 :return: finished (approximate) facet element<|endoftext|>
69e5f1de0c843cf53840668087329980137c69ddff55dde0508f218e0d8ba0a6
def setUp(self): 'Set up the test environment.' self.backend = bluepy.BluepyBackend()
Set up the test environment.
test/integration_tests/test_bluepy_backend.py
setUp
onkelbeh/miflora
274
python
def setUp(self): self.backend = bluepy.BluepyBackend()
def setUp(self): self.backend = bluepy.BluepyBackend()<|docstring|>Set up the test environment.<|endoftext|>
9c805c8d8b6e57135ceb77c09cee3579145292ad074c5cbb134115d03a31b481
def test_scan(self): 'Test scanning for devices.\n\n Note: fore the test to pass, there must be at least one BTLE device\n near by.\n ' devices = bluepy.BluepyBackend.scan_for_devices(5) self.assertGreater(len(devices), 0) for device in devices: self.assertIsNotNone(device)
Test scanning for devices. Note: fore the test to pass, there must be at least one BTLE device near by.
test/integration_tests/test_bluepy_backend.py
test_scan
onkelbeh/miflora
274
python
def test_scan(self): 'Test scanning for devices.\n\n Note: fore the test to pass, there must be at least one BTLE device\n near by.\n ' devices = bluepy.BluepyBackend.scan_for_devices(5) self.assertGreater(len(devices), 0) for device in devices: self.assertIsNotNone(device)
def test_scan(self): 'Test scanning for devices.\n\n Note: fore the test to pass, there must be at least one BTLE device\n near by.\n ' devices = bluepy.BluepyBackend.scan_for_devices(5) self.assertGreater(len(devices), 0) for device in devices: self.assertIsNotNone(device)<|docstring|>Test scanning for devices. Note: fore the test to pass, there must be at least one BTLE device near by.<|endoftext|>
36bad2f50466050bbb726a54445802854210ec677329597c07dff32812e64f03
def test_invalid_mac_exception(self): 'Test writing data to handle of the sensor.' bluepy.RETRY_LIMIT = 1 with self.assertRaises(BluetoothBackendException): self.backend.connect(TEST_MAC) self.backend.read_handle(HANDLE_READ_NAME) bluepy.RETRY_LIMIT = 3
Test writing data to handle of the sensor.
test/integration_tests/test_bluepy_backend.py
test_invalid_mac_exception
onkelbeh/miflora
274
python
def test_invalid_mac_exception(self): bluepy.RETRY_LIMIT = 1 with self.assertRaises(BluetoothBackendException): self.backend.connect(TEST_MAC) self.backend.read_handle(HANDLE_READ_NAME) bluepy.RETRY_LIMIT = 3
def test_invalid_mac_exception(self): bluepy.RETRY_LIMIT = 1 with self.assertRaises(BluetoothBackendException): self.backend.connect(TEST_MAC) self.backend.read_handle(HANDLE_READ_NAME) bluepy.RETRY_LIMIT = 3<|docstring|>Test writing data to handle of the sensor.<|endoftext|>
e5d5807a074d1c85be105757967ef887f3a21feefd0e9508e613b7da3da59042
def list2df(self, data): 'Convert string list to dataframe' cols = data[0].split('\t') array = [] for line in data[1:]: array.append(line.split('\t')) df = pd.DataFrame(np.array(array), columns=cols) return df
Convert string list to dataframe
quartet_rnaseq_report/modules/rnaseq_performance_assessment/performance_assessment.py
list2df
chinese-quartet/quartet-rnaseq-report
1
python
def list2df(self, data): cols = data[0].split('\t') array = [] for line in data[1:]: array.append(line.split('\t')) df = pd.DataFrame(np.array(array), columns=cols) return df
def list2df(self, data): cols = data[0].split('\t') array = [] for line in data[1:]: array.append(line.split('\t')) df = pd.DataFrame(np.array(array), columns=cols) return df<|docstring|>Convert string list to dataframe<|endoftext|>
09bb1cefc0da14353a2edb4f6683f8b371e1076f6bf5bf1bf72e036b47f32834
def draw_point(self, point, color=Color.cyan()): '\n :type point: Vector\n :type color: Color\n :return: None\n ' if ((0 <= point.x < self.width) and (0 <= point.y < self.height)): self.put_pixel(point.x, point.y, color)
:type point: Vector :type color: Color :return: None
canvas.py
draw_point
loucq123/rasterizer
79
python
def draw_point(self, point, color=Color.cyan()): '\n :type point: Vector\n :type color: Color\n :return: None\n ' if ((0 <= point.x < self.width) and (0 <= point.y < self.height)): self.put_pixel(point.x, point.y, color)
def draw_point(self, point, color=Color.cyan()): '\n :type point: Vector\n :type color: Color\n :return: None\n ' if ((0 <= point.x < self.width) and (0 <= point.y < self.height)): self.put_pixel(point.x, point.y, color)<|docstring|>:type point: Vector :type color: Color :return: None<|endoftext|>
aa6ab13634eb375a6e2450195c5bb7afc27fcff7f1645a608456d8c991eff6cf
def draw_line(self, p1, p2): '\n :type p1: Vector\n :type p2: Vector\n ' (x1, y1, x2, y2) = [int(i) for i in [p1.x, p1.y, p2.x, p2.y]] dx = (x2 - x1) dy = (y2 - y1) if (abs(dx) > abs(dy)): (xmin, xmax) = sorted([x1, x2]) ratio = (0 if (dx == 0) else (dy / dx)) for x in range(xmin, xmax): y = (y1 + ((x - x1) * ratio)) self.draw_point(Vector(x, y)) else: (ymin, ymax) = sorted([y1, y2]) ratio = (0 if (dy == 0) else (dx / dy)) for y in range(ymin, ymax): x = (x1 + ((y - y1) * ratio)) self.draw_point(Vector(x, y))
:type p1: Vector :type p2: Vector
canvas.py
draw_line
loucq123/rasterizer
79
python
def draw_line(self, p1, p2): '\n :type p1: Vector\n :type p2: Vector\n ' (x1, y1, x2, y2) = [int(i) for i in [p1.x, p1.y, p2.x, p2.y]] dx = (x2 - x1) dy = (y2 - y1) if (abs(dx) > abs(dy)): (xmin, xmax) = sorted([x1, x2]) ratio = (0 if (dx == 0) else (dy / dx)) for x in range(xmin, xmax): y = (y1 + ((x - x1) * ratio)) self.draw_point(Vector(x, y)) else: (ymin, ymax) = sorted([y1, y2]) ratio = (0 if (dy == 0) else (dx / dy)) for y in range(ymin, ymax): x = (x1 + ((y - y1) * ratio)) self.draw_point(Vector(x, y))
def draw_line(self, p1, p2): '\n :type p1: Vector\n :type p2: Vector\n ' (x1, y1, x2, y2) = [int(i) for i in [p1.x, p1.y, p2.x, p2.y]] dx = (x2 - x1) dy = (y2 - y1) if (abs(dx) > abs(dy)): (xmin, xmax) = sorted([x1, x2]) ratio = (0 if (dx == 0) else (dy / dx)) for x in range(xmin, xmax): y = (y1 + ((x - x1) * ratio)) self.draw_point(Vector(x, y)) else: (ymin, ymax) = sorted([y1, y2]) ratio = (0 if (dy == 0) else (dx / dy)) for y in range(ymin, ymax): x = (x1 + ((y - y1) * ratio)) self.draw_point(Vector(x, y))<|docstring|>:type p1: Vector :type p2: Vector<|endoftext|>
2b8740b9f4f18d89332204460d66f906f818c1239eeb51062c7a2490c769a26e
def draw_triangle(self, v1, v2, v3): '\n :type v1: Vertex\n :type v2: Vertex\n :type v3: Vertex\n ' (a, b, c) = sorted([v1, v2, v3], key=(lambda k: k.position.y)) middle_factor = 0 if ((c.position.y - a.position.y) != 0): middle_factor = ((b.position.y - a.position.y) / (c.position.y - a.position.y)) middle = interpolate(a, c, middle_factor) start_y = int(a.position.y) end_y = int(b.position.y) for y in range(start_y, (end_y + 1)): factor = (((y - start_y) / (end_y - start_y)) if (end_y != start_y) else 0) va = interpolate(a, b, factor) vb = interpolate(a, middle, factor) self.draw_scanline(va, vb, y) start_y = int(b.position.y) end_y = int(c.position.y) for y in range(start_y, (end_y + 1)): factor = (((y - start_y) / (end_y - start_y)) if (end_y != start_y) else 0) va = interpolate(b, c, factor) vb = interpolate(middle, c, factor) self.draw_scanline(va, vb, y)
:type v1: Vertex :type v2: Vertex :type v3: Vertex
canvas.py
draw_triangle
loucq123/rasterizer
79
python
def draw_triangle(self, v1, v2, v3): '\n :type v1: Vertex\n :type v2: Vertex\n :type v3: Vertex\n ' (a, b, c) = sorted([v1, v2, v3], key=(lambda k: k.position.y)) middle_factor = 0 if ((c.position.y - a.position.y) != 0): middle_factor = ((b.position.y - a.position.y) / (c.position.y - a.position.y)) middle = interpolate(a, c, middle_factor) start_y = int(a.position.y) end_y = int(b.position.y) for y in range(start_y, (end_y + 1)): factor = (((y - start_y) / (end_y - start_y)) if (end_y != start_y) else 0) va = interpolate(a, b, factor) vb = interpolate(a, middle, factor) self.draw_scanline(va, vb, y) start_y = int(b.position.y) end_y = int(c.position.y) for y in range(start_y, (end_y + 1)): factor = (((y - start_y) / (end_y - start_y)) if (end_y != start_y) else 0) va = interpolate(b, c, factor) vb = interpolate(middle, c, factor) self.draw_scanline(va, vb, y)
def draw_triangle(self, v1, v2, v3): '\n :type v1: Vertex\n :type v2: Vertex\n :type v3: Vertex\n ' (a, b, c) = sorted([v1, v2, v3], key=(lambda k: k.position.y)) middle_factor = 0 if ((c.position.y - a.position.y) != 0): middle_factor = ((b.position.y - a.position.y) / (c.position.y - a.position.y)) middle = interpolate(a, c, middle_factor) start_y = int(a.position.y) end_y = int(b.position.y) for y in range(start_y, (end_y + 1)): factor = (((y - start_y) / (end_y - start_y)) if (end_y != start_y) else 0) va = interpolate(a, b, factor) vb = interpolate(a, middle, factor) self.draw_scanline(va, vb, y) start_y = int(b.position.y) end_y = int(c.position.y) for y in range(start_y, (end_y + 1)): factor = (((y - start_y) / (end_y - start_y)) if (end_y != start_y) else 0) va = interpolate(b, c, factor) vb = interpolate(middle, c, factor) self.draw_scanline(va, vb, y)<|docstring|>:type v1: Vertex :type v2: Vertex :type v3: Vertex<|endoftext|>
550ddd7c1979ae781d270216f16505f618a287a557f62edf8439c98073e41627
def test_xy_to_CCT_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition.\n ' np.testing.assert_allclose(xy_to_CCT_CIE_D(np.array([0.382343625, 0.383766261015578]), {'method': 'Nelder-Mead'}), 4000, rtol=1e-07, atol=1e-07) np.testing.assert_allclose(xy_to_CCT_CIE_D(np.array([0.30535743148688, 0.321646345474552]), {'method': 'Nelder-Mead'}), 7000, rtol=1e-07, atol=1e-07) np.testing.assert_allclose(xy_to_CCT_CIE_D(np.array([0.24985367, 0.254799464210944]), {'method': 'Nelder-Mead'}), 25000, rtol=1e-07, atol=1e-07)
Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition.
colour/temperature/tests/test_cie_d.py
test_xy_to_CCT_CIE_D
trevorandersen/colour
6
python
def test_xy_to_CCT_CIE_D(self): '\n \n ' np.testing.assert_allclose(xy_to_CCT_CIE_D(np.array([0.382343625, 0.383766261015578]), {'method': 'Nelder-Mead'}), 4000, rtol=1e-07, atol=1e-07) np.testing.assert_allclose(xy_to_CCT_CIE_D(np.array([0.30535743148688, 0.321646345474552]), {'method': 'Nelder-Mead'}), 7000, rtol=1e-07, atol=1e-07) np.testing.assert_allclose(xy_to_CCT_CIE_D(np.array([0.24985367, 0.254799464210944]), {'method': 'Nelder-Mead'}), 25000, rtol=1e-07, atol=1e-07)
def test_xy_to_CCT_CIE_D(self): '\n \n ' np.testing.assert_allclose(xy_to_CCT_CIE_D(np.array([0.382343625, 0.383766261015578]), {'method': 'Nelder-Mead'}), 4000, rtol=1e-07, atol=1e-07) np.testing.assert_allclose(xy_to_CCT_CIE_D(np.array([0.30535743148688, 0.321646345474552]), {'method': 'Nelder-Mead'}), 7000, rtol=1e-07, atol=1e-07) np.testing.assert_allclose(xy_to_CCT_CIE_D(np.array([0.24985367, 0.254799464210944]), {'method': 'Nelder-Mead'}), 25000, rtol=1e-07, atol=1e-07)<|docstring|>Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition.<|endoftext|>
0097f2b4d642db6eb950d42ed89116e4a16ea26e86fa030bb537e00cd5d29cc9
def test_n_dimensional_xy_to_CCT_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition\n n-dimensional arrays support.\n ' xy = np.array([0.382343625, 0.383766261015578]) CCT = xy_to_CCT_CIE_D(xy) xy = np.tile(xy, (6, 1)) CCT = np.tile(CCT, 6) np.testing.assert_almost_equal(xy_to_CCT_CIE_D(xy), CCT, decimal=7) xy = np.reshape(xy, (2, 3, 2)) CCT = np.reshape(CCT, (2, 3)) np.testing.assert_almost_equal(xy_to_CCT_CIE_D(xy), CCT, decimal=7)
Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition n-dimensional arrays support.
colour/temperature/tests/test_cie_d.py
test_n_dimensional_xy_to_CCT_CIE_D
trevorandersen/colour
6
python
def test_n_dimensional_xy_to_CCT_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition\n n-dimensional arrays support.\n ' xy = np.array([0.382343625, 0.383766261015578]) CCT = xy_to_CCT_CIE_D(xy) xy = np.tile(xy, (6, 1)) CCT = np.tile(CCT, 6) np.testing.assert_almost_equal(xy_to_CCT_CIE_D(xy), CCT, decimal=7) xy = np.reshape(xy, (2, 3, 2)) CCT = np.reshape(CCT, (2, 3)) np.testing.assert_almost_equal(xy_to_CCT_CIE_D(xy), CCT, decimal=7)
def test_n_dimensional_xy_to_CCT_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition\n n-dimensional arrays support.\n ' xy = np.array([0.382343625, 0.383766261015578]) CCT = xy_to_CCT_CIE_D(xy) xy = np.tile(xy, (6, 1)) CCT = np.tile(CCT, 6) np.testing.assert_almost_equal(xy_to_CCT_CIE_D(xy), CCT, decimal=7) xy = np.reshape(xy, (2, 3, 2)) CCT = np.reshape(CCT, (2, 3)) np.testing.assert_almost_equal(xy_to_CCT_CIE_D(xy), CCT, decimal=7)<|docstring|>Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition n-dimensional arrays support.<|endoftext|>
a83406968293d3fab8e529fbd1319c1875fc11d73dcc8f2e302d4a9724425a16
@ignore_numpy_errors def test_nan_xy_to_CCT_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition nan\n support.\n ' cases = [(- 1.0), 0.0, 1.0, (- np.inf), np.inf, np.nan] cases = set(permutations((cases * 3), r=2)) for case in cases: xy_to_CCT_CIE_D(case)
Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition nan support.
colour/temperature/tests/test_cie_d.py
test_nan_xy_to_CCT_CIE_D
trevorandersen/colour
6
python
@ignore_numpy_errors def test_nan_xy_to_CCT_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition nan\n support.\n ' cases = [(- 1.0), 0.0, 1.0, (- np.inf), np.inf, np.nan] cases = set(permutations((cases * 3), r=2)) for case in cases: xy_to_CCT_CIE_D(case)
@ignore_numpy_errors def test_nan_xy_to_CCT_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition nan\n support.\n ' cases = [(- 1.0), 0.0, 1.0, (- np.inf), np.inf, np.nan] cases = set(permutations((cases * 3), r=2)) for case in cases: xy_to_CCT_CIE_D(case)<|docstring|>Tests :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition nan support.<|endoftext|>
5eab51c5ddc06260ef9ce292238038b515809b491041b90a2826859696118c6a
def test_CCT_to_xy_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition.\n ' np.testing.assert_almost_equal(CCT_to_xy_CIE_D(4000), np.array([0.382343625, 0.383766261015578]), decimal=7) np.testing.assert_almost_equal(CCT_to_xy_CIE_D(7000), np.array([0.30535743148688, 0.321646345474552]), decimal=7) np.testing.assert_almost_equal(CCT_to_xy_CIE_D(25000), np.array([0.24985367, 0.254799464210944]), decimal=7)
Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition.
colour/temperature/tests/test_cie_d.py
test_CCT_to_xy_CIE_D
trevorandersen/colour
6
python
def test_CCT_to_xy_CIE_D(self): '\n \n ' np.testing.assert_almost_equal(CCT_to_xy_CIE_D(4000), np.array([0.382343625, 0.383766261015578]), decimal=7) np.testing.assert_almost_equal(CCT_to_xy_CIE_D(7000), np.array([0.30535743148688, 0.321646345474552]), decimal=7) np.testing.assert_almost_equal(CCT_to_xy_CIE_D(25000), np.array([0.24985367, 0.254799464210944]), decimal=7)
def test_CCT_to_xy_CIE_D(self): '\n \n ' np.testing.assert_almost_equal(CCT_to_xy_CIE_D(4000), np.array([0.382343625, 0.383766261015578]), decimal=7) np.testing.assert_almost_equal(CCT_to_xy_CIE_D(7000), np.array([0.30535743148688, 0.321646345474552]), decimal=7) np.testing.assert_almost_equal(CCT_to_xy_CIE_D(25000), np.array([0.24985367, 0.254799464210944]), decimal=7)<|docstring|>Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition.<|endoftext|>
03bd0928f9a7b34e7d96616c4adccd7b25913ff95ffb02b95a1529e360cab0a3
def test_n_dimensional_CCT_to_xy_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition\n n-dimensional arrays support.\n ' CCT = 4000 xy = CCT_to_xy_CIE_D(CCT) CCT = np.tile(CCT, 6) xy = np.tile(xy, (6, 1)) np.testing.assert_almost_equal(CCT_to_xy_CIE_D(CCT), xy, decimal=7) CCT = np.reshape(CCT, (2, 3)) xy = np.reshape(xy, (2, 3, 2)) np.testing.assert_almost_equal(CCT_to_xy_CIE_D(CCT), xy, decimal=7)
Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition n-dimensional arrays support.
colour/temperature/tests/test_cie_d.py
test_n_dimensional_CCT_to_xy_CIE_D
trevorandersen/colour
6
python
def test_n_dimensional_CCT_to_xy_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition\n n-dimensional arrays support.\n ' CCT = 4000 xy = CCT_to_xy_CIE_D(CCT) CCT = np.tile(CCT, 6) xy = np.tile(xy, (6, 1)) np.testing.assert_almost_equal(CCT_to_xy_CIE_D(CCT), xy, decimal=7) CCT = np.reshape(CCT, (2, 3)) xy = np.reshape(xy, (2, 3, 2)) np.testing.assert_almost_equal(CCT_to_xy_CIE_D(CCT), xy, decimal=7)
def test_n_dimensional_CCT_to_xy_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition\n n-dimensional arrays support.\n ' CCT = 4000 xy = CCT_to_xy_CIE_D(CCT) CCT = np.tile(CCT, 6) xy = np.tile(xy, (6, 1)) np.testing.assert_almost_equal(CCT_to_xy_CIE_D(CCT), xy, decimal=7) CCT = np.reshape(CCT, (2, 3)) xy = np.reshape(xy, (2, 3, 2)) np.testing.assert_almost_equal(CCT_to_xy_CIE_D(CCT), xy, decimal=7)<|docstring|>Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition n-dimensional arrays support.<|endoftext|>
fe1f5ca408caf68bc77db05eeb40e64450140c06fb52fd44632d9e8facc51215
@ignore_numpy_errors def test_nan_CCT_to_xy_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition\n nan support.\n ' cases = [(- 1.0), 0.0, 1.0, (- np.inf), np.inf, np.nan] cases = set(permutations((cases * 3), r=2)) for case in cases: CCT_to_xy_CIE_D(case)
Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition nan support.
colour/temperature/tests/test_cie_d.py
test_nan_CCT_to_xy_CIE_D
trevorandersen/colour
6
python
@ignore_numpy_errors def test_nan_CCT_to_xy_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition\n nan support.\n ' cases = [(- 1.0), 0.0, 1.0, (- np.inf), np.inf, np.nan] cases = set(permutations((cases * 3), r=2)) for case in cases: CCT_to_xy_CIE_D(case)
@ignore_numpy_errors def test_nan_CCT_to_xy_CIE_D(self): '\n Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition\n nan support.\n ' cases = [(- 1.0), 0.0, 1.0, (- np.inf), np.inf, np.nan] cases = set(permutations((cases * 3), r=2)) for case in cases: CCT_to_xy_CIE_D(case)<|docstring|>Tests :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition nan support.<|endoftext|>
7f8f3ca69a5afd3e9e3765d2dc69e2f1a62e8faf9f52a115f4689c40ea697b0c
def get_array_of_dicescores(seg): 'computes the array of dicescores for the given segmentation,\n it is assumed, that the label of interest is 1 and all other labels are 0.\n More in detail : For every two consecutive slices, the dice score is computed\n throughout the image. In the case of both images being black (no label 1), the dicescore \n is set to one.\n\n Args:\n seg (torch.Tensor): the segmentation\n\n Returns (ndarray): array of dicescores (one for every two consecutive slices in the comp)\n ' shape = np.shape(seg) nr_slices = shape[0] arr_of_dicescores = np.array([]) first_slide = seg[(0, :, :)] first_ones = torch.sum(first_slide) for i in range((nr_slices - 1)): second_slide = seg[((i + 1), :, :)] second_ones = torch.sum(second_slide) intersection = torch.dot(torch.flatten(first_slide), torch.flatten(second_slide)) if (not ((first_ones + second_ones) == 0)): dice_score = ((2 * intersection) / (first_ones + second_ones)) else: dice_score = 1 if (not (dice_score == 1)): arr_of_dicescores = np.append(arr_of_dicescores, np.array([dice_score])) first_slide = second_slide first_ones = second_ones return arr_of_dicescores
computes the array of dicescores for the given segmentation, it is assumed, that the label of interest is 1 and all other labels are 0. More in detail : For every two consecutive slices, the dice score is computed throughout the image. In the case of both images being black (no label 1), the dicescore is set to one. Args: seg (torch.Tensor): the segmentation Returns (ndarray): array of dicescores (one for every two consecutive slices in the comp)
mp/utils/feature_extractor.py
get_array_of_dicescores
MECLabTUDA/Seg_QA
0
python
def get_array_of_dicescores(seg): 'computes the array of dicescores for the given segmentation,\n it is assumed, that the label of interest is 1 and all other labels are 0.\n More in detail : For every two consecutive slices, the dice score is computed\n throughout the image. In the case of both images being black (no label 1), the dicescore \n is set to one.\n\n Args:\n seg (torch.Tensor): the segmentation\n\n Returns (ndarray): array of dicescores (one for every two consecutive slices in the comp)\n ' shape = np.shape(seg) nr_slices = shape[0] arr_of_dicescores = np.array([]) first_slide = seg[(0, :, :)] first_ones = torch.sum(first_slide) for i in range((nr_slices - 1)): second_slide = seg[((i + 1), :, :)] second_ones = torch.sum(second_slide) intersection = torch.dot(torch.flatten(first_slide), torch.flatten(second_slide)) if (not ((first_ones + second_ones) == 0)): dice_score = ((2 * intersection) / (first_ones + second_ones)) else: dice_score = 1 if (not (dice_score == 1)): arr_of_dicescores = np.append(arr_of_dicescores, np.array([dice_score])) first_slide = second_slide first_ones = second_ones return arr_of_dicescores
def get_array_of_dicescores(seg): 'computes the array of dicescores for the given segmentation,\n it is assumed, that the label of interest is 1 and all other labels are 0.\n More in detail : For every two consecutive slices, the dice score is computed\n throughout the image. In the case of both images being black (no label 1), the dicescore \n is set to one.\n\n Args:\n seg (torch.Tensor): the segmentation\n\n Returns (ndarray): array of dicescores (one for every two consecutive slices in the comp)\n ' shape = np.shape(seg) nr_slices = shape[0] arr_of_dicescores = np.array([]) first_slide = seg[(0, :, :)] first_ones = torch.sum(first_slide) for i in range((nr_slices - 1)): second_slide = seg[((i + 1), :, :)] second_ones = torch.sum(second_slide) intersection = torch.dot(torch.flatten(first_slide), torch.flatten(second_slide)) if (not ((first_ones + second_ones) == 0)): dice_score = ((2 * intersection) / (first_ones + second_ones)) else: dice_score = 1 if (not (dice_score == 1)): arr_of_dicescores = np.append(arr_of_dicescores, np.array([dice_score])) first_slide = second_slide first_ones = second_ones return arr_of_dicescores<|docstring|>computes the array of dicescores for the given segmentation, it is assumed, that the label of interest is 1 and all other labels are 0. More in detail : For every two consecutive slices, the dice score is computed throughout the image. In the case of both images being black (no label 1), the dicescore is set to one. Args: seg (torch.Tensor): the segmentation Returns (ndarray): array of dicescores (one for every two consecutive slices in the comp)<|endoftext|>
30ac912bebfb40f76cf35ea09cfc6fc669ff07e3085ab0888c214075a9f3979d
def get_dice_averages(img, seg, props): 'Computes the average dice score for a connected component of the \n given img-seg pair. \n STILL COMPUTED BUT NOT USED ANYMORE: Also computes the average differences between the dice scores \n and computes that average, because it was observed, that in bad artificial bad segmentations,\n these dice scores had a more rough graph, then good segmentations, thus it is used as feature.\n \n Args: \n img (torch.Tensor): the image\n seg (torch.Tensor): its segmentation\n props (dict[str->object]): a regionprops dictionary, c.f. skimage-> regionprops\n \n Returns (list(floats)): a list of two values, the avg dice score and the avg dice score difference' (min_row, min_col, min_sl, max_row, max_col, max_sl) = props.bbox cut_seg = seg[(min_row:max_row, min_col:max_col, min_sl:max_sl)] arr_of_dicescores = get_array_of_dicescores(cut_seg) dice_avg_value = np.average(arr_of_dicescores) if (len(arr_of_dicescores) < 10): dice_diff_avg_value = 1 else: dice_diff = np.diff(arr_of_dicescores) dice_diff_abs = np.absolute(dice_diff) dice_diff_avg_value = np.average(dice_diff_abs) return [dice_avg_value, dice_diff_avg_value]
Computes the average dice score for a connected component of the given img-seg pair. STILL COMPUTED BUT NOT USED ANYMORE: Also computes the average differences between the dice scores and computes that average, because it was observed, that in bad artificial bad segmentations, these dice scores had a more rough graph, then good segmentations, thus it is used as feature. Args: img (torch.Tensor): the image seg (torch.Tensor): its segmentation props (dict[str->object]): a regionprops dictionary, c.f. skimage-> regionprops Returns (list(floats)): a list of two values, the avg dice score and the avg dice score difference
mp/utils/feature_extractor.py
get_dice_averages
MECLabTUDA/Seg_QA
0
python
def get_dice_averages(img, seg, props): 'Computes the average dice score for a connected component of the \n given img-seg pair. \n STILL COMPUTED BUT NOT USED ANYMORE: Also computes the average differences between the dice scores \n and computes that average, because it was observed, that in bad artificial bad segmentations,\n these dice scores had a more rough graph, then good segmentations, thus it is used as feature.\n \n Args: \n img (torch.Tensor): the image\n seg (torch.Tensor): its segmentation\n props (dict[str->object]): a regionprops dictionary, c.f. skimage-> regionprops\n \n Returns (list(floats)): a list of two values, the avg dice score and the avg dice score difference' (min_row, min_col, min_sl, max_row, max_col, max_sl) = props.bbox cut_seg = seg[(min_row:max_row, min_col:max_col, min_sl:max_sl)] arr_of_dicescores = get_array_of_dicescores(cut_seg) dice_avg_value = np.average(arr_of_dicescores) if (len(arr_of_dicescores) < 10): dice_diff_avg_value = 1 else: dice_diff = np.diff(arr_of_dicescores) dice_diff_abs = np.absolute(dice_diff) dice_diff_avg_value = np.average(dice_diff_abs) return [dice_avg_value, dice_diff_avg_value]
def get_dice_averages(img, seg, props): 'Computes the average dice score for a connected component of the \n given img-seg pair. \n STILL COMPUTED BUT NOT USED ANYMORE: Also computes the average differences between the dice scores \n and computes that average, because it was observed, that in bad artificial bad segmentations,\n these dice scores had a more rough graph, then good segmentations, thus it is used as feature.\n \n Args: \n img (torch.Tensor): the image\n seg (torch.Tensor): its segmentation\n props (dict[str->object]): a regionprops dictionary, c.f. skimage-> regionprops\n \n Returns (list(floats)): a list of two values, the avg dice score and the avg dice score difference' (min_row, min_col, min_sl, max_row, max_col, max_sl) = props.bbox cut_seg = seg[(min_row:max_row, min_col:max_col, min_sl:max_sl)] arr_of_dicescores = get_array_of_dicescores(cut_seg) dice_avg_value = np.average(arr_of_dicescores) if (len(arr_of_dicescores) < 10): dice_diff_avg_value = 1 else: dice_diff = np.diff(arr_of_dicescores) dice_diff_abs = np.absolute(dice_diff) dice_diff_avg_value = np.average(dice_diff_abs) return [dice_avg_value, dice_diff_avg_value]<|docstring|>Computes the average dice score for a connected component of the given img-seg pair. STILL COMPUTED BUT NOT USED ANYMORE: Also computes the average differences between the dice scores and computes that average, because it was observed, that in bad artificial bad segmentations, these dice scores had a more rough graph, then good segmentations, thus it is used as feature. Args: img (torch.Tensor): the image seg (torch.Tensor): its segmentation props (dict[str->object]): a regionprops dictionary, c.f. skimage-> regionprops Returns (list(floats)): a list of two values, the avg dice score and the avg dice score difference<|endoftext|>
f535450725fe91cc028b460447365e0c79beadf8851c25cd4e9f39481f896829
def mean_var_big_comp(img, seg): ' Computes the mean and variance of the united intensity values \n of the 4 biggest connected components in the image\n Args:\n img(ndarray or torch tensor): the image \n seg(ndarray or torch tensor): a segmentation of any tissue in the image \n \n Returns(float,float): the mean and variance of the sampled intensity values' (labeled_image, _) = label(seg, return_num=True) props = regionprops(labeled_image) props = sorted(props, reverse=True, key=(lambda dict: dict['area'])) ints = sample_intensities(img, seg, props[0], number=5000) dens = GaussianMixture(n_components=1).fit(np.reshape(ints, newshape=((- 1), 1))) mean = dens.means_[(0, 0)] var = dens.covariances_[(0, 0, 0)] return (mean, var)
Computes the mean and variance of the united intensity values of the 4 biggest connected components in the image Args: img(ndarray or torch tensor): the image seg(ndarray or torch tensor): a segmentation of any tissue in the image Returns(float,float): the mean and variance of the sampled intensity values
mp/utils/feature_extractor.py
mean_var_big_comp
MECLabTUDA/Seg_QA
0
python
def mean_var_big_comp(img, seg): ' Computes the mean and variance of the united intensity values \n of the 4 biggest connected components in the image\n Args:\n img(ndarray or torch tensor): the image \n seg(ndarray or torch tensor): a segmentation of any tissue in the image \n \n Returns(float,float): the mean and variance of the sampled intensity values' (labeled_image, _) = label(seg, return_num=True) props = regionprops(labeled_image) props = sorted(props, reverse=True, key=(lambda dict: dict['area'])) ints = sample_intensities(img, seg, props[0], number=5000) dens = GaussianMixture(n_components=1).fit(np.reshape(ints, newshape=((- 1), 1))) mean = dens.means_[(0, 0)] var = dens.covariances_[(0, 0, 0)] return (mean, var)
def mean_var_big_comp(img, seg): ' Computes the mean and variance of the united intensity values \n of the 4 biggest connected components in the image\n Args:\n img(ndarray or torch tensor): the image \n seg(ndarray or torch tensor): a segmentation of any tissue in the image \n \n Returns(float,float): the mean and variance of the sampled intensity values' (labeled_image, _) = label(seg, return_num=True) props = regionprops(labeled_image) props = sorted(props, reverse=True, key=(lambda dict: dict['area'])) ints = sample_intensities(img, seg, props[0], number=5000) dens = GaussianMixture(n_components=1).fit(np.reshape(ints, newshape=((- 1), 1))) mean = dens.means_[(0, 0)] var = dens.covariances_[(0, 0, 0)] return (mean, var)<|docstring|>Computes the mean and variance of the united intensity values of the 4 biggest connected components in the image Args: img(ndarray or torch tensor): the image seg(ndarray or torch tensor): a segmentation of any tissue in the image Returns(float,float): the mean and variance of the sampled intensity values<|endoftext|>
40f18c9087cd06167f56333272a12c0d1cc9c19d8138fac17e0300aa1df623c4
def get_feature(self, feature, img, seg, lung_seg): 'Extracts the given feature for the given img-seg pair\n\n Args: \n feature (str): The feature to be extracted \n img (ndarray): the image \n seg (ndarray): The corresponding mask\n lung_seg (ndarray): The segmentation of the lung in the image \n\n Returns (object): depending on the feature: \n dice_scores -> (ndarray with two entries): array with two entries, the dice averages and dice_diff averages \n connected_components -> (integer): The number of connected components\n ' component_iterator = Component_Iterator(img, seg) original_threshhold = component_iterator.threshold if (feature == 'dice_scores'): dice_metrices = component_iterator.iterate(get_dice_averages) if (not dice_metrices): print('Image only has very small components') component_iterator.threshold = 0 dice_metrices = component_iterator.iterate(get_dice_averages) component_iterator.threshold = original_threshhold if (not dice_metrices): print('Image has no usable components, no reliable computations can be made for dice') return 1 dice_metrices = np.array(dice_metrices) dice_metrices = np.mean(dice_metrices, 0) return dice_metrices[0] if (feature == 'connected_components'): (_, number_components) = label(seg, return_num=True, connectivity=3) return number_components if (feature == 'gauss_params'): (mean, _) = mean_var_big_comp(img, seg) return mean if (feature == 'seg_in_lung'): dice_seg_lung = segmentation_in_lung(seg, lung_seg) return float(dice_seg_lung)
Extracts the given feature for the given img-seg pair Args: feature (str): The feature to be extracted img (ndarray): the image seg (ndarray): The corresponding mask lung_seg (ndarray): The segmentation of the lung in the image Returns (object): depending on the feature: dice_scores -> (ndarray with two entries): array with two entries, the dice averages and dice_diff averages connected_components -> (integer): The number of connected components
mp/utils/feature_extractor.py
get_feature
MECLabTUDA/Seg_QA
0
python
def get_feature(self, feature, img, seg, lung_seg): 'Extracts the given feature for the given img-seg pair\n\n Args: \n feature (str): The feature to be extracted \n img (ndarray): the image \n seg (ndarray): The corresponding mask\n lung_seg (ndarray): The segmentation of the lung in the image \n\n Returns (object): depending on the feature: \n dice_scores -> (ndarray with two entries): array with two entries, the dice averages and dice_diff averages \n connected_components -> (integer): The number of connected components\n ' component_iterator = Component_Iterator(img, seg) original_threshhold = component_iterator.threshold if (feature == 'dice_scores'): dice_metrices = component_iterator.iterate(get_dice_averages) if (not dice_metrices): print('Image only has very small components') component_iterator.threshold = 0 dice_metrices = component_iterator.iterate(get_dice_averages) component_iterator.threshold = original_threshhold if (not dice_metrices): print('Image has no usable components, no reliable computations can be made for dice') return 1 dice_metrices = np.array(dice_metrices) dice_metrices = np.mean(dice_metrices, 0) return dice_metrices[0] if (feature == 'connected_components'): (_, number_components) = label(seg, return_num=True, connectivity=3) return number_components if (feature == 'gauss_params'): (mean, _) = mean_var_big_comp(img, seg) return mean if (feature == 'seg_in_lung'): dice_seg_lung = segmentation_in_lung(seg, lung_seg) return float(dice_seg_lung)
def get_feature(self, feature, img, seg, lung_seg): 'Extracts the given feature for the given img-seg pair\n\n Args: \n feature (str): The feature to be extracted \n img (ndarray): the image \n seg (ndarray): The corresponding mask\n lung_seg (ndarray): The segmentation of the lung in the image \n\n Returns (object): depending on the feature: \n dice_scores -> (ndarray with two entries): array with two entries, the dice averages and dice_diff averages \n connected_components -> (integer): The number of connected components\n ' component_iterator = Component_Iterator(img, seg) original_threshhold = component_iterator.threshold if (feature == 'dice_scores'): dice_metrices = component_iterator.iterate(get_dice_averages) if (not dice_metrices): print('Image only has very small components') component_iterator.threshold = 0 dice_metrices = component_iterator.iterate(get_dice_averages) component_iterator.threshold = original_threshhold if (not dice_metrices): print('Image has no usable components, no reliable computations can be made for dice') return 1 dice_metrices = np.array(dice_metrices) dice_metrices = np.mean(dice_metrices, 0) return dice_metrices[0] if (feature == 'connected_components'): (_, number_components) = label(seg, return_num=True, connectivity=3) return number_components if (feature == 'gauss_params'): (mean, _) = mean_var_big_comp(img, seg) return mean if (feature == 'seg_in_lung'): dice_seg_lung = segmentation_in_lung(seg, lung_seg) return float(dice_seg_lung)<|docstring|>Extracts the given feature for the given img-seg pair Args: feature (str): The feature to be extracted img (ndarray): the image seg (ndarray): The corresponding mask lung_seg (ndarray): The segmentation of the lung in the image Returns (object): depending on the feature: dice_scores -> (ndarray with two entries): array with two entries, the dice averages and dice_diff averages connected_components -> (integer): The number of connected components<|endoftext|>
7649ac640dae70f442dc87dba57f18168ebabd18e772deb638d7500d23f2704c
def compute_features_id(self, id, features='all'): 'Computes all features for the img-seg and img-pred pairs (if existing)\n and saves them in the preprocessed_dir/.../id/...\n Args:\n id (str): the id of the patient to compute the features for\n features (str or list(str)): either all or a list of features to compute\n ' if (features == 'all'): features = self.features if (not (os.environ['INFERENCE_OR_TRAIN'] == 'train')): id_path = os.path.join(os.environ['PREPROCESSED_WORKFLOW_DIR'], os.environ['PREPROCESSED_OPERATOR_OUT_SCALED_DIR'], id) else: id_path = os.path.join(os.environ['PREPROCESSED_WORKFLOW_DIR'], os.environ['PREPROCESSED_OPERATOR_OUT_SCALED_DIR_TRAIN'], id) img_path = os.path.join(id_path, 'img', 'img.nii.gz') lung_seg_path = os.path.join(id_path, 'lung_seg', 'lung_seg.nii.gz') all_pred_path = os.path.join(id_path, 'pred') if os.path.exists(all_pred_path): for model in os.listdir(all_pred_path): mask_path_short = os.path.join(id_path, 'pred', model) self.save_feat_dict_from_paths(img_path, mask_path_short, lung_seg_path, features) seg_path_short = os.path.join(id_path, 'seg') seg_path = os.path.join(id_path, 'seg', '001.nii.gz') img = torch.tensor(torchio.Image(img_path, type=torchio.INTENSITY).numpy())[0] seg = torch.tensor(torchio.Image(seg_path, type=torchio.LABEL).numpy())[0] lung_seg = torch.tensor(torchio.Image(lung_seg_path, type=torchio.LABEL).numpy())[0] feature_save_path = os.path.join(seg_path_short, 'features.json') if os.path.exists(feature_save_path): with open(feature_save_path) as file: feat_dict = json.load(file) else: feat_dict = {} for feat in features: feat_dict[feat] = self.get_feature(feat, img, seg, lung_seg) with open(feature_save_path, 'w') as f: json.dump(feat_dict, f)
Computes all features for the img-seg and img-pred pairs (if existing) and saves them in the preprocessed_dir/.../id/... Args: id (str): the id of the patient to compute the features for features (str or list(str)): either all or a list of features to compute
mp/utils/feature_extractor.py
compute_features_id
MECLabTUDA/Seg_QA
0
python
def compute_features_id(self, id, features='all'): 'Computes all features for the img-seg and img-pred pairs (if existing)\n and saves them in the preprocessed_dir/.../id/...\n Args:\n id (str): the id of the patient to compute the features for\n features (str or list(str)): either all or a list of features to compute\n ' if (features == 'all'): features = self.features if (not (os.environ['INFERENCE_OR_TRAIN'] == 'train')): id_path = os.path.join(os.environ['PREPROCESSED_WORKFLOW_DIR'], os.environ['PREPROCESSED_OPERATOR_OUT_SCALED_DIR'], id) else: id_path = os.path.join(os.environ['PREPROCESSED_WORKFLOW_DIR'], os.environ['PREPROCESSED_OPERATOR_OUT_SCALED_DIR_TRAIN'], id) img_path = os.path.join(id_path, 'img', 'img.nii.gz') lung_seg_path = os.path.join(id_path, 'lung_seg', 'lung_seg.nii.gz') all_pred_path = os.path.join(id_path, 'pred') if os.path.exists(all_pred_path): for model in os.listdir(all_pred_path): mask_path_short = os.path.join(id_path, 'pred', model) self.save_feat_dict_from_paths(img_path, mask_path_short, lung_seg_path, features) seg_path_short = os.path.join(id_path, 'seg') seg_path = os.path.join(id_path, 'seg', '001.nii.gz') img = torch.tensor(torchio.Image(img_path, type=torchio.INTENSITY).numpy())[0] seg = torch.tensor(torchio.Image(seg_path, type=torchio.LABEL).numpy())[0] lung_seg = torch.tensor(torchio.Image(lung_seg_path, type=torchio.LABEL).numpy())[0] feature_save_path = os.path.join(seg_path_short, 'features.json') if os.path.exists(feature_save_path): with open(feature_save_path) as file: feat_dict = json.load(file) else: feat_dict = {} for feat in features: feat_dict[feat] = self.get_feature(feat, img, seg, lung_seg) with open(feature_save_path, 'w') as f: json.dump(feat_dict, f)
def compute_features_id(self, id, features='all'): 'Computes all features for the img-seg and img-pred pairs (if existing)\n and saves them in the preprocessed_dir/.../id/...\n Args:\n id (str): the id of the patient to compute the features for\n features (str or list(str)): either all or a list of features to compute\n ' if (features == 'all'): features = self.features if (not (os.environ['INFERENCE_OR_TRAIN'] == 'train')): id_path = os.path.join(os.environ['PREPROCESSED_WORKFLOW_DIR'], os.environ['PREPROCESSED_OPERATOR_OUT_SCALED_DIR'], id) else: id_path = os.path.join(os.environ['PREPROCESSED_WORKFLOW_DIR'], os.environ['PREPROCESSED_OPERATOR_OUT_SCALED_DIR_TRAIN'], id) img_path = os.path.join(id_path, 'img', 'img.nii.gz') lung_seg_path = os.path.join(id_path, 'lung_seg', 'lung_seg.nii.gz') all_pred_path = os.path.join(id_path, 'pred') if os.path.exists(all_pred_path): for model in os.listdir(all_pred_path): mask_path_short = os.path.join(id_path, 'pred', model) self.save_feat_dict_from_paths(img_path, mask_path_short, lung_seg_path, features) seg_path_short = os.path.join(id_path, 'seg') seg_path = os.path.join(id_path, 'seg', '001.nii.gz') img = torch.tensor(torchio.Image(img_path, type=torchio.INTENSITY).numpy())[0] seg = torch.tensor(torchio.Image(seg_path, type=torchio.LABEL).numpy())[0] lung_seg = torch.tensor(torchio.Image(lung_seg_path, type=torchio.LABEL).numpy())[0] feature_save_path = os.path.join(seg_path_short, 'features.json') if os.path.exists(feature_save_path): with open(feature_save_path) as file: feat_dict = json.load(file) else: feat_dict = {} for feat in features: feat_dict[feat] = self.get_feature(feat, img, seg, lung_seg) with open(feature_save_path, 'w') as f: json.dump(feat_dict, f)<|docstring|>Computes all features for the img-seg and img-pred pairs (if existing) and saves them in the preprocessed_dir/.../id/... Args: id (str): the id of the patient to compute the features for features (str or list(str)): either all or a list of features to compute<|endoftext|>
2c5c58edd4c557569f8dc5101f6b97734adb9cf5816ead9a9ab2f9d35b9ba816
def save_feat_dict_from_paths(self, img_path, mask_path_short, lung_seg_path, features): 'computes and saves the feature dict for a given img-pred pair \n is a utility function for compute_features_id\n\n Args: \n img_path (str): The path to the image \n mask_path_short (str): the path to the folder containing the seg mask\n and where the feature dict is to be saved \n lung_seg_path (str): The path to the segmentation of the lung \n features (list(str)): a list of strings for the features to compute \n ' mask_path = os.path.join(mask_path_short, 'pred.nii.gz') img = torch.tensor(torchio.Image(img_path, type=torchio.INTENSITY).numpy())[0] mask = torch.tensor(torchio.Image(mask_path, type=torchio.LABEL).numpy())[0] lung_seg = torch.tensor(torchio.Image(lung_seg_path, type=torchio.LABEL).numpy())[0] feature_save_path = os.path.join(mask_path_short, 'features.json') if os.path.exists(feature_save_path): with open(feature_save_path) as file: feat_dict = json.load(file) else: feat_dict = {} for feat in features: feat_dict[feat] = self.get_feature(feat, img, mask, lung_seg) with open(feature_save_path, 'w') as f: json.dump(feat_dict, f)
computes and saves the feature dict for a given img-pred pair is a utility function for compute_features_id Args: img_path (str): The path to the image mask_path_short (str): the path to the folder containing the seg mask and where the feature dict is to be saved lung_seg_path (str): The path to the segmentation of the lung features (list(str)): a list of strings for the features to compute
mp/utils/feature_extractor.py
save_feat_dict_from_paths
MECLabTUDA/Seg_QA
0
python
def save_feat_dict_from_paths(self, img_path, mask_path_short, lung_seg_path, features): 'computes and saves the feature dict for a given img-pred pair \n is a utility function for compute_features_id\n\n Args: \n img_path (str): The path to the image \n mask_path_short (str): the path to the folder containing the seg mask\n and where the feature dict is to be saved \n lung_seg_path (str): The path to the segmentation of the lung \n features (list(str)): a list of strings for the features to compute \n ' mask_path = os.path.join(mask_path_short, 'pred.nii.gz') img = torch.tensor(torchio.Image(img_path, type=torchio.INTENSITY).numpy())[0] mask = torch.tensor(torchio.Image(mask_path, type=torchio.LABEL).numpy())[0] lung_seg = torch.tensor(torchio.Image(lung_seg_path, type=torchio.LABEL).numpy())[0] feature_save_path = os.path.join(mask_path_short, 'features.json') if os.path.exists(feature_save_path): with open(feature_save_path) as file: feat_dict = json.load(file) else: feat_dict = {} for feat in features: feat_dict[feat] = self.get_feature(feat, img, mask, lung_seg) with open(feature_save_path, 'w') as f: json.dump(feat_dict, f)
def save_feat_dict_from_paths(self, img_path, mask_path_short, lung_seg_path, features): 'computes and saves the feature dict for a given img-pred pair \n is a utility function for compute_features_id\n\n Args: \n img_path (str): The path to the image \n mask_path_short (str): the path to the folder containing the seg mask\n and where the feature dict is to be saved \n lung_seg_path (str): The path to the segmentation of the lung \n features (list(str)): a list of strings for the features to compute \n ' mask_path = os.path.join(mask_path_short, 'pred.nii.gz') img = torch.tensor(torchio.Image(img_path, type=torchio.INTENSITY).numpy())[0] mask = torch.tensor(torchio.Image(mask_path, type=torchio.LABEL).numpy())[0] lung_seg = torch.tensor(torchio.Image(lung_seg_path, type=torchio.LABEL).numpy())[0] feature_save_path = os.path.join(mask_path_short, 'features.json') if os.path.exists(feature_save_path): with open(feature_save_path) as file: feat_dict = json.load(file) else: feat_dict = {} for feat in features: feat_dict[feat] = self.get_feature(feat, img, mask, lung_seg) with open(feature_save_path, 'w') as f: json.dump(feat_dict, f)<|docstring|>computes and saves the feature dict for a given img-pred pair is a utility function for compute_features_id Args: img_path (str): The path to the image mask_path_short (str): the path to the folder containing the seg mask and where the feature dict is to be saved lung_seg_path (str): The path to the segmentation of the lung features (list(str)): a list of strings for the features to compute<|endoftext|>
96f484d482e351f62a31e752a357e693d0c1fc30e6120adde1440a2cbff072f8
def collect_train_data(self): 'goes through the train directory and collects all the feature vectors and labels\n \n Returns: (ndarray,ndarray) the features and labels ' if (os.environ['INFERENCE_OR_TRAIN'] == 'train'): all_features = [] labels = [] path = os.path.join(os.environ['PREPROCESSED_WORKFLOW_DIR'], os.environ['PREPROCESSED_OPERATOR_OUT_SCALED_DIR_TRAIN']) for id in os.listdir(path): all_pred_path = os.path.join(path, id, 'pred') if os.path.exists(all_pred_path): for model in os.listdir(all_pred_path): pred_path = os.path.join(all_pred_path, model) feature_path = os.path.join(pred_path, 'features.json') label_path = os.path.join(pred_path, 'dice_score.json') feature_vec = self.read_feature_vector(feature_path) label = self.read_prediction_label(label_path) if np.isnan(np.sum(np.array(feature_vec))): pass else: all_features.append(feature_vec) labels.append(label) else: print('This method is only for train time') RuntimeError return (np.array(all_features), np.array(labels))
goes through the train directory and collects all the feature vectors and labels Returns: (ndarray,ndarray) the features and labels
mp/utils/feature_extractor.py
collect_train_data
MECLabTUDA/Seg_QA
0
python
def collect_train_data(self): 'goes through the train directory and collects all the feature vectors and labels\n \n Returns: (ndarray,ndarray) the features and labels ' if (os.environ['INFERENCE_OR_TRAIN'] == 'train'): all_features = [] labels = [] path = os.path.join(os.environ['PREPROCESSED_WORKFLOW_DIR'], os.environ['PREPROCESSED_OPERATOR_OUT_SCALED_DIR_TRAIN']) for id in os.listdir(path): all_pred_path = os.path.join(path, id, 'pred') if os.path.exists(all_pred_path): for model in os.listdir(all_pred_path): pred_path = os.path.join(all_pred_path, model) feature_path = os.path.join(pred_path, 'features.json') label_path = os.path.join(pred_path, 'dice_score.json') feature_vec = self.read_feature_vector(feature_path) label = self.read_prediction_label(label_path) if np.isnan(np.sum(np.array(feature_vec))): pass else: all_features.append(feature_vec) labels.append(label) else: print('This method is only for train time') RuntimeError return (np.array(all_features), np.array(labels))
def collect_train_data(self): 'goes through the train directory and collects all the feature vectors and labels\n \n Returns: (ndarray,ndarray) the features and labels ' if (os.environ['INFERENCE_OR_TRAIN'] == 'train'): all_features = [] labels = [] path = os.path.join(os.environ['PREPROCESSED_WORKFLOW_DIR'], os.environ['PREPROCESSED_OPERATOR_OUT_SCALED_DIR_TRAIN']) for id in os.listdir(path): all_pred_path = os.path.join(path, id, 'pred') if os.path.exists(all_pred_path): for model in os.listdir(all_pred_path): pred_path = os.path.join(all_pred_path, model) feature_path = os.path.join(pred_path, 'features.json') label_path = os.path.join(pred_path, 'dice_score.json') feature_vec = self.read_feature_vector(feature_path) label = self.read_prediction_label(label_path) if np.isnan(np.sum(np.array(feature_vec))): pass else: all_features.append(feature_vec) labels.append(label) else: print('This method is only for train time') RuntimeError return (np.array(all_features), np.array(labels))<|docstring|>goes through the train directory and collects all the feature vectors and labels Returns: (ndarray,ndarray) the features and labels<|endoftext|>
f241ddf152562aa805cea03275f11d0a014671b95d16da97ff5ca737983ccded
def __init__(self): '\n NodesLnnHardwareNode - a model defined in Swagger\n\n :param dict swaggerTypes: The key is attribute name\n and the value is attribute type.\n :param dict attributeMap: The key is attribute name\n and the value is json key in definition.\n ' self.swagger_types = {'chassis': 'str', 'chassis_code': 'str', 'chassis_count': 'str', '_class': 'str', 'configuration_id': 'str', 'cpu': 'str', 'disk_controller': 'str', 'disk_expander': 'str', 'family_code': 'str', 'flash_drive': 'str', 'generation_code': 'str', 'hwgen': 'str', 'id': 'int', 'imb_version': 'str', 'infiniband': 'str', 'lcd_version': 'str', 'lnn': 'int', 'motherboard': 'str', 'net_interfaces': 'str', 'nvram': 'str', 'powersupplies': 'list[str]', 'processor': 'str', 'product': 'str', 'ram': 'int', 'serial_number': 'str', 'series': 'str', 'storage_class': 'str'} self.attribute_map = {'chassis': 'chassis', 'chassis_code': 'chassis_code', 'chassis_count': 'chassis_count', '_class': 'class', 'configuration_id': 'configuration_id', 'cpu': 'cpu', 'disk_controller': 'disk_controller', 'disk_expander': 'disk_expander', 'family_code': 'family_code', 'flash_drive': 'flash_drive', 'generation_code': 'generation_code', 'hwgen': 'hwgen', 'id': 'id', 'imb_version': 'imb_version', 'infiniband': 'infiniband', 'lcd_version': 'lcd_version', 'lnn': 'lnn', 'motherboard': 'motherboard', 'net_interfaces': 'net_interfaces', 'nvram': 'nvram', 'powersupplies': 'powersupplies', 'processor': 'processor', 'product': 'product', 'ram': 'ram', 'serial_number': 'serial_number', 'series': 'series', 'storage_class': 'storage_class'} self._chassis = None self._chassis_code = None self._chassis_count = None self.__class = None self._configuration_id = None self._cpu = None self._disk_controller = None self._disk_expander = None self._family_code = None self._flash_drive = None self._generation_code = None self._hwgen = None self._id = None self._imb_version = None self._infiniband = None self._lcd_version = None self._lnn = None self._motherboard = None self._net_interfaces = None self._nvram = None self._powersupplies = None self._processor = None self._product = None self._ram = None self._serial_number = None self._series = None self._storage_class = None
NodesLnnHardwareNode - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition.
isi_sdk/models/nodes_lnn_hardware_node.py
__init__
Atomicology/isilon_sdk_python
0
python
def __init__(self): '\n NodesLnnHardwareNode - a model defined in Swagger\n\n :param dict swaggerTypes: The key is attribute name\n and the value is attribute type.\n :param dict attributeMap: The key is attribute name\n and the value is json key in definition.\n ' self.swagger_types = {'chassis': 'str', 'chassis_code': 'str', 'chassis_count': 'str', '_class': 'str', 'configuration_id': 'str', 'cpu': 'str', 'disk_controller': 'str', 'disk_expander': 'str', 'family_code': 'str', 'flash_drive': 'str', 'generation_code': 'str', 'hwgen': 'str', 'id': 'int', 'imb_version': 'str', 'infiniband': 'str', 'lcd_version': 'str', 'lnn': 'int', 'motherboard': 'str', 'net_interfaces': 'str', 'nvram': 'str', 'powersupplies': 'list[str]', 'processor': 'str', 'product': 'str', 'ram': 'int', 'serial_number': 'str', 'series': 'str', 'storage_class': 'str'} self.attribute_map = {'chassis': 'chassis', 'chassis_code': 'chassis_code', 'chassis_count': 'chassis_count', '_class': 'class', 'configuration_id': 'configuration_id', 'cpu': 'cpu', 'disk_controller': 'disk_controller', 'disk_expander': 'disk_expander', 'family_code': 'family_code', 'flash_drive': 'flash_drive', 'generation_code': 'generation_code', 'hwgen': 'hwgen', 'id': 'id', 'imb_version': 'imb_version', 'infiniband': 'infiniband', 'lcd_version': 'lcd_version', 'lnn': 'lnn', 'motherboard': 'motherboard', 'net_interfaces': 'net_interfaces', 'nvram': 'nvram', 'powersupplies': 'powersupplies', 'processor': 'processor', 'product': 'product', 'ram': 'ram', 'serial_number': 'serial_number', 'series': 'series', 'storage_class': 'storage_class'} self._chassis = None self._chassis_code = None self._chassis_count = None self.__class = None self._configuration_id = None self._cpu = None self._disk_controller = None self._disk_expander = None self._family_code = None self._flash_drive = None self._generation_code = None self._hwgen = None self._id = None self._imb_version = None self._infiniband = None self._lcd_version = None self._lnn = None self._motherboard = None self._net_interfaces = None self._nvram = None self._powersupplies = None self._processor = None self._product = None self._ram = None self._serial_number = None self._series = None self._storage_class = None
def __init__(self): '\n NodesLnnHardwareNode - a model defined in Swagger\n\n :param dict swaggerTypes: The key is attribute name\n and the value is attribute type.\n :param dict attributeMap: The key is attribute name\n and the value is json key in definition.\n ' self.swagger_types = {'chassis': 'str', 'chassis_code': 'str', 'chassis_count': 'str', '_class': 'str', 'configuration_id': 'str', 'cpu': 'str', 'disk_controller': 'str', 'disk_expander': 'str', 'family_code': 'str', 'flash_drive': 'str', 'generation_code': 'str', 'hwgen': 'str', 'id': 'int', 'imb_version': 'str', 'infiniband': 'str', 'lcd_version': 'str', 'lnn': 'int', 'motherboard': 'str', 'net_interfaces': 'str', 'nvram': 'str', 'powersupplies': 'list[str]', 'processor': 'str', 'product': 'str', 'ram': 'int', 'serial_number': 'str', 'series': 'str', 'storage_class': 'str'} self.attribute_map = {'chassis': 'chassis', 'chassis_code': 'chassis_code', 'chassis_count': 'chassis_count', '_class': 'class', 'configuration_id': 'configuration_id', 'cpu': 'cpu', 'disk_controller': 'disk_controller', 'disk_expander': 'disk_expander', 'family_code': 'family_code', 'flash_drive': 'flash_drive', 'generation_code': 'generation_code', 'hwgen': 'hwgen', 'id': 'id', 'imb_version': 'imb_version', 'infiniband': 'infiniband', 'lcd_version': 'lcd_version', 'lnn': 'lnn', 'motherboard': 'motherboard', 'net_interfaces': 'net_interfaces', 'nvram': 'nvram', 'powersupplies': 'powersupplies', 'processor': 'processor', 'product': 'product', 'ram': 'ram', 'serial_number': 'serial_number', 'series': 'series', 'storage_class': 'storage_class'} self._chassis = None self._chassis_code = None self._chassis_count = None self.__class = None self._configuration_id = None self._cpu = None self._disk_controller = None self._disk_expander = None self._family_code = None self._flash_drive = None self._generation_code = None self._hwgen = None self._id = None self._imb_version = None self._infiniband = None self._lcd_version = None self._lnn = None self._motherboard = None self._net_interfaces = None self._nvram = None self._powersupplies = None self._processor = None self._product = None self._ram = None self._serial_number = None self._series = None self._storage_class = None<|docstring|>NodesLnnHardwareNode - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition.<|endoftext|>
830de4536ac309c4e3830c97e8e58de3ed982bc2c47a7958949fcd9811fe4d64
@property def chassis(self): "\n Gets the chassis of this NodesLnnHardwareNode.\n Name of this node's chassis.\n\n :return: The chassis of this NodesLnnHardwareNode.\n :rtype: str\n " return self._chassis
Gets the chassis of this NodesLnnHardwareNode. Name of this node's chassis. :return: The chassis of this NodesLnnHardwareNode. :rtype: str
isi_sdk/models/nodes_lnn_hardware_node.py
chassis
Atomicology/isilon_sdk_python
0
python
@property def chassis(self): "\n Gets the chassis of this NodesLnnHardwareNode.\n Name of this node's chassis.\n\n :return: The chassis of this NodesLnnHardwareNode.\n :rtype: str\n " return self._chassis
@property def chassis(self): "\n Gets the chassis of this NodesLnnHardwareNode.\n Name of this node's chassis.\n\n :return: The chassis of this NodesLnnHardwareNode.\n :rtype: str\n " return self._chassis<|docstring|>Gets the chassis of this NodesLnnHardwareNode. Name of this node's chassis. :return: The chassis of this NodesLnnHardwareNode. :rtype: str<|endoftext|>
007de8c16090edc70de9c13169746fba9286b8f1566b324b381f0b7a90849836
@chassis.setter def chassis(self, chassis): "\n Sets the chassis of this NodesLnnHardwareNode.\n Name of this node's chassis.\n\n :param chassis: The chassis of this NodesLnnHardwareNode.\n :type: str\n " self._chassis = chassis
Sets the chassis of this NodesLnnHardwareNode. Name of this node's chassis. :param chassis: The chassis of this NodesLnnHardwareNode. :type: str
isi_sdk/models/nodes_lnn_hardware_node.py
chassis
Atomicology/isilon_sdk_python
0
python
@chassis.setter def chassis(self, chassis): "\n Sets the chassis of this NodesLnnHardwareNode.\n Name of this node's chassis.\n\n :param chassis: The chassis of this NodesLnnHardwareNode.\n :type: str\n " self._chassis = chassis
@chassis.setter def chassis(self, chassis): "\n Sets the chassis of this NodesLnnHardwareNode.\n Name of this node's chassis.\n\n :param chassis: The chassis of this NodesLnnHardwareNode.\n :type: str\n " self._chassis = chassis<|docstring|>Sets the chassis of this NodesLnnHardwareNode. Name of this node's chassis. :param chassis: The chassis of this NodesLnnHardwareNode. :type: str<|endoftext|>
1da7ffec5d6f750c1c6d69ccfba81d467afc94ac564a62fc11b379eb4b7604ac
@property def chassis_code(self): '\n Gets the chassis_code of this NodesLnnHardwareNode.\n Chassis code of this node (1U, 2U, etc.).\n\n :return: The chassis_code of this NodesLnnHardwareNode.\n :rtype: str\n ' return self._chassis_code
Gets the chassis_code of this NodesLnnHardwareNode. Chassis code of this node (1U, 2U, etc.). :return: The chassis_code of this NodesLnnHardwareNode. :rtype: str
isi_sdk/models/nodes_lnn_hardware_node.py
chassis_code
Atomicology/isilon_sdk_python
0
python
@property def chassis_code(self): '\n Gets the chassis_code of this NodesLnnHardwareNode.\n Chassis code of this node (1U, 2U, etc.).\n\n :return: The chassis_code of this NodesLnnHardwareNode.\n :rtype: str\n ' return self._chassis_code
@property def chassis_code(self): '\n Gets the chassis_code of this NodesLnnHardwareNode.\n Chassis code of this node (1U, 2U, etc.).\n\n :return: The chassis_code of this NodesLnnHardwareNode.\n :rtype: str\n ' return self._chassis_code<|docstring|>Gets the chassis_code of this NodesLnnHardwareNode. Chassis code of this node (1U, 2U, etc.). :return: The chassis_code of this NodesLnnHardwareNode. :rtype: str<|endoftext|>
07e703f31cf79d43761aa3b3f82a2c798e53a991a3c54d5e39257b3902225768
@chassis_code.setter def chassis_code(self, chassis_code): '\n Sets the chassis_code of this NodesLnnHardwareNode.\n Chassis code of this node (1U, 2U, etc.).\n\n :param chassis_code: The chassis_code of this NodesLnnHardwareNode.\n :type: str\n ' self._chassis_code = chassis_code
Sets the chassis_code of this NodesLnnHardwareNode. Chassis code of this node (1U, 2U, etc.). :param chassis_code: The chassis_code of this NodesLnnHardwareNode. :type: str
isi_sdk/models/nodes_lnn_hardware_node.py
chassis_code
Atomicology/isilon_sdk_python
0
python
@chassis_code.setter def chassis_code(self, chassis_code): '\n Sets the chassis_code of this NodesLnnHardwareNode.\n Chassis code of this node (1U, 2U, etc.).\n\n :param chassis_code: The chassis_code of this NodesLnnHardwareNode.\n :type: str\n ' self._chassis_code = chassis_code
@chassis_code.setter def chassis_code(self, chassis_code): '\n Sets the chassis_code of this NodesLnnHardwareNode.\n Chassis code of this node (1U, 2U, etc.).\n\n :param chassis_code: The chassis_code of this NodesLnnHardwareNode.\n :type: str\n ' self._chassis_code = chassis_code<|docstring|>Sets the chassis_code of this NodesLnnHardwareNode. Chassis code of this node (1U, 2U, etc.). :param chassis_code: The chassis_code of this NodesLnnHardwareNode. :type: str<|endoftext|>
125c984a172065a06a008437dbf5342eced9c2a817e5757a65237b4cd530acbf
@property def chassis_count(self): '\n Gets the chassis_count of this NodesLnnHardwareNode.\n Number of chassis making up this node.\n\n :return: The chassis_count of this NodesLnnHardwareNode.\n :rtype: str\n ' return self._chassis_count
Gets the chassis_count of this NodesLnnHardwareNode. Number of chassis making up this node. :return: The chassis_count of this NodesLnnHardwareNode. :rtype: str
isi_sdk/models/nodes_lnn_hardware_node.py
chassis_count
Atomicology/isilon_sdk_python
0
python
@property def chassis_count(self): '\n Gets the chassis_count of this NodesLnnHardwareNode.\n Number of chassis making up this node.\n\n :return: The chassis_count of this NodesLnnHardwareNode.\n :rtype: str\n ' return self._chassis_count
@property def chassis_count(self): '\n Gets the chassis_count of this NodesLnnHardwareNode.\n Number of chassis making up this node.\n\n :return: The chassis_count of this NodesLnnHardwareNode.\n :rtype: str\n ' return self._chassis_count<|docstring|>Gets the chassis_count of this NodesLnnHardwareNode. Number of chassis making up this node. :return: The chassis_count of this NodesLnnHardwareNode. :rtype: str<|endoftext|>
7d59a36440348ea9c592feb332abe355a2b1b2c60e8159bb059b12a1b2380885
@chassis_count.setter def chassis_count(self, chassis_count): '\n Sets the chassis_count of this NodesLnnHardwareNode.\n Number of chassis making up this node.\n\n :param chassis_count: The chassis_count of this NodesLnnHardwareNode.\n :type: str\n ' self._chassis_count = chassis_count
Sets the chassis_count of this NodesLnnHardwareNode. Number of chassis making up this node. :param chassis_count: The chassis_count of this NodesLnnHardwareNode. :type: str
isi_sdk/models/nodes_lnn_hardware_node.py
chassis_count
Atomicology/isilon_sdk_python
0
python
@chassis_count.setter def chassis_count(self, chassis_count): '\n Sets the chassis_count of this NodesLnnHardwareNode.\n Number of chassis making up this node.\n\n :param chassis_count: The chassis_count of this NodesLnnHardwareNode.\n :type: str\n ' self._chassis_count = chassis_count
@chassis_count.setter def chassis_count(self, chassis_count): '\n Sets the chassis_count of this NodesLnnHardwareNode.\n Number of chassis making up this node.\n\n :param chassis_count: The chassis_count of this NodesLnnHardwareNode.\n :type: str\n ' self._chassis_count = chassis_count<|docstring|>Sets the chassis_count of this NodesLnnHardwareNode. Number of chassis making up this node. :param chassis_count: The chassis_count of this NodesLnnHardwareNode. :type: str<|endoftext|>
27a1b63cd54c8474a3af0ab5988a29dd3fc1ef546fe9a7c1bff2ac30e0ab8139
@property def _class(self): '\n Gets the _class of this NodesLnnHardwareNode.\n Class of this node (storage, accelerator, etc.).\n\n :return: The _class of this NodesLnnHardwareNode.\n :rtype: str\n ' return self.__class
Gets the _class of this NodesLnnHardwareNode. Class of this node (storage, accelerator, etc.). :return: The _class of this NodesLnnHardwareNode. :rtype: str
isi_sdk/models/nodes_lnn_hardware_node.py
_class
Atomicology/isilon_sdk_python
0
python
@property def _class(self): '\n Gets the _class of this NodesLnnHardwareNode.\n Class of this node (storage, accelerator, etc.).\n\n :return: The _class of this NodesLnnHardwareNode.\n :rtype: str\n ' return self.__class
@property def _class(self): '\n Gets the _class of this NodesLnnHardwareNode.\n Class of this node (storage, accelerator, etc.).\n\n :return: The _class of this NodesLnnHardwareNode.\n :rtype: str\n ' return self.__class<|docstring|>Gets the _class of this NodesLnnHardwareNode. Class of this node (storage, accelerator, etc.). :return: The _class of this NodesLnnHardwareNode. :rtype: str<|endoftext|>
7491beaa6778eabb65f31338f1e66bc601935874557f4f7a6e6a4c96a1082ddf
@_class.setter def _class(self, _class): '\n Sets the _class of this NodesLnnHardwareNode.\n Class of this node (storage, accelerator, etc.).\n\n :param _class: The _class of this NodesLnnHardwareNode.\n :type: str\n ' self.__class = _class
Sets the _class of this NodesLnnHardwareNode. Class of this node (storage, accelerator, etc.). :param _class: The _class of this NodesLnnHardwareNode. :type: str
isi_sdk/models/nodes_lnn_hardware_node.py
_class
Atomicology/isilon_sdk_python
0
python
@_class.setter def _class(self, _class): '\n Sets the _class of this NodesLnnHardwareNode.\n Class of this node (storage, accelerator, etc.).\n\n :param _class: The _class of this NodesLnnHardwareNode.\n :type: str\n ' self.__class = _class
@_class.setter def _class(self, _class): '\n Sets the _class of this NodesLnnHardwareNode.\n Class of this node (storage, accelerator, etc.).\n\n :param _class: The _class of this NodesLnnHardwareNode.\n :type: str\n ' self.__class = _class<|docstring|>Sets the _class of this NodesLnnHardwareNode. Class of this node (storage, accelerator, etc.). :param _class: The _class of this NodesLnnHardwareNode. :type: str<|endoftext|>
d6471136c8c68afbdea64376a44f19a9a8aa1226aaa1dce5c3de6b7632cf2533
@property def configuration_id(self): '\n Gets the configuration_id of this NodesLnnHardwareNode.\n Node configuration ID.\n\n :return: The configuration_id of this NodesLnnHardwareNode.\n :rtype: str\n ' return self._configuration_id
Gets the configuration_id of this NodesLnnHardwareNode. Node configuration ID. :return: The configuration_id of this NodesLnnHardwareNode. :rtype: str
isi_sdk/models/nodes_lnn_hardware_node.py
configuration_id
Atomicology/isilon_sdk_python
0
python
@property def configuration_id(self): '\n Gets the configuration_id of this NodesLnnHardwareNode.\n Node configuration ID.\n\n :return: The configuration_id of this NodesLnnHardwareNode.\n :rtype: str\n ' return self._configuration_id
@property def configuration_id(self): '\n Gets the configuration_id of this NodesLnnHardwareNode.\n Node configuration ID.\n\n :return: The configuration_id of this NodesLnnHardwareNode.\n :rtype: str\n ' return self._configuration_id<|docstring|>Gets the configuration_id of this NodesLnnHardwareNode. Node configuration ID. :return: The configuration_id of this NodesLnnHardwareNode. :rtype: str<|endoftext|>
e17c4f21390ac4afa374b7f5a3362408da640fb735595316a520511a553d4b3c
@configuration_id.setter def configuration_id(self, configuration_id): '\n Sets the configuration_id of this NodesLnnHardwareNode.\n Node configuration ID.\n\n :param configuration_id: The configuration_id of this NodesLnnHardwareNode.\n :type: str\n ' self._configuration_id = configuration_id
Sets the configuration_id of this NodesLnnHardwareNode. Node configuration ID. :param configuration_id: The configuration_id of this NodesLnnHardwareNode. :type: str
isi_sdk/models/nodes_lnn_hardware_node.py
configuration_id
Atomicology/isilon_sdk_python
0
python
@configuration_id.setter def configuration_id(self, configuration_id): '\n Sets the configuration_id of this NodesLnnHardwareNode.\n Node configuration ID.\n\n :param configuration_id: The configuration_id of this NodesLnnHardwareNode.\n :type: str\n ' self._configuration_id = configuration_id
@configuration_id.setter def configuration_id(self, configuration_id): '\n Sets the configuration_id of this NodesLnnHardwareNode.\n Node configuration ID.\n\n :param configuration_id: The configuration_id of this NodesLnnHardwareNode.\n :type: str\n ' self._configuration_id = configuration_id<|docstring|>Sets the configuration_id of this NodesLnnHardwareNode. Node configuration ID. :param configuration_id: The configuration_id of this NodesLnnHardwareNode. :type: str<|endoftext|>
dfa93e9155e2d1369a09eb2bab8c74640bbee043d74171488c25b1d46adcab58
@property def cpu(self): "\n Gets the cpu of this NodesLnnHardwareNode.\n Manufacturer and model of this node's CPU.\n\n :return: The cpu of this NodesLnnHardwareNode.\n :rtype: str\n " return self._cpu
Gets the cpu of this NodesLnnHardwareNode. Manufacturer and model of this node's CPU. :return: The cpu of this NodesLnnHardwareNode. :rtype: str
isi_sdk/models/nodes_lnn_hardware_node.py
cpu
Atomicology/isilon_sdk_python
0
python
@property def cpu(self): "\n Gets the cpu of this NodesLnnHardwareNode.\n Manufacturer and model of this node's CPU.\n\n :return: The cpu of this NodesLnnHardwareNode.\n :rtype: str\n " return self._cpu
@property def cpu(self): "\n Gets the cpu of this NodesLnnHardwareNode.\n Manufacturer and model of this node's CPU.\n\n :return: The cpu of this NodesLnnHardwareNode.\n :rtype: str\n " return self._cpu<|docstring|>Gets the cpu of this NodesLnnHardwareNode. Manufacturer and model of this node's CPU. :return: The cpu of this NodesLnnHardwareNode. :rtype: str<|endoftext|>
7dbf1ee9cd1dd2b3e987b1313161d278376dbe5927c37e2ff94414d0dbde9c28
@cpu.setter def cpu(self, cpu): "\n Sets the cpu of this NodesLnnHardwareNode.\n Manufacturer and model of this node's CPU.\n\n :param cpu: The cpu of this NodesLnnHardwareNode.\n :type: str\n " self._cpu = cpu
Sets the cpu of this NodesLnnHardwareNode. Manufacturer and model of this node's CPU. :param cpu: The cpu of this NodesLnnHardwareNode. :type: str
isi_sdk/models/nodes_lnn_hardware_node.py
cpu
Atomicology/isilon_sdk_python
0
python
@cpu.setter def cpu(self, cpu): "\n Sets the cpu of this NodesLnnHardwareNode.\n Manufacturer and model of this node's CPU.\n\n :param cpu: The cpu of this NodesLnnHardwareNode.\n :type: str\n " self._cpu = cpu
@cpu.setter def cpu(self, cpu): "\n Sets the cpu of this NodesLnnHardwareNode.\n Manufacturer and model of this node's CPU.\n\n :param cpu: The cpu of this NodesLnnHardwareNode.\n :type: str\n " self._cpu = cpu<|docstring|>Sets the cpu of this NodesLnnHardwareNode. Manufacturer and model of this node's CPU. :param cpu: The cpu of this NodesLnnHardwareNode. :type: str<|endoftext|>
74547b4a948af4a6c47f504e440f554220589186b21c8e43bffba177b013a20f
@property def disk_controller(self): "\n Gets the disk_controller of this NodesLnnHardwareNode.\n Manufacturer and model of this node's disk controller.\n\n :return: The disk_controller of this NodesLnnHardwareNode.\n :rtype: str\n " return self._disk_controller
Gets the disk_controller of this NodesLnnHardwareNode. Manufacturer and model of this node's disk controller. :return: The disk_controller of this NodesLnnHardwareNode. :rtype: str
isi_sdk/models/nodes_lnn_hardware_node.py
disk_controller
Atomicology/isilon_sdk_python
0
python
@property def disk_controller(self): "\n Gets the disk_controller of this NodesLnnHardwareNode.\n Manufacturer and model of this node's disk controller.\n\n :return: The disk_controller of this NodesLnnHardwareNode.\n :rtype: str\n " return self._disk_controller
@property def disk_controller(self): "\n Gets the disk_controller of this NodesLnnHardwareNode.\n Manufacturer and model of this node's disk controller.\n\n :return: The disk_controller of this NodesLnnHardwareNode.\n :rtype: str\n " return self._disk_controller<|docstring|>Gets the disk_controller of this NodesLnnHardwareNode. Manufacturer and model of this node's disk controller. :return: The disk_controller of this NodesLnnHardwareNode. :rtype: str<|endoftext|>
cf91cc3025a265161b17c07d67cec0f6b00f442731e59dba0ff13c57aefa137b
@disk_controller.setter def disk_controller(self, disk_controller): "\n Sets the disk_controller of this NodesLnnHardwareNode.\n Manufacturer and model of this node's disk controller.\n\n :param disk_controller: The disk_controller of this NodesLnnHardwareNode.\n :type: str\n " self._disk_controller = disk_controller
Sets the disk_controller of this NodesLnnHardwareNode. Manufacturer and model of this node's disk controller. :param disk_controller: The disk_controller of this NodesLnnHardwareNode. :type: str
isi_sdk/models/nodes_lnn_hardware_node.py
disk_controller
Atomicology/isilon_sdk_python
0
python
@disk_controller.setter def disk_controller(self, disk_controller): "\n Sets the disk_controller of this NodesLnnHardwareNode.\n Manufacturer and model of this node's disk controller.\n\n :param disk_controller: The disk_controller of this NodesLnnHardwareNode.\n :type: str\n " self._disk_controller = disk_controller
@disk_controller.setter def disk_controller(self, disk_controller): "\n Sets the disk_controller of this NodesLnnHardwareNode.\n Manufacturer and model of this node's disk controller.\n\n :param disk_controller: The disk_controller of this NodesLnnHardwareNode.\n :type: str\n " self._disk_controller = disk_controller<|docstring|>Sets the disk_controller of this NodesLnnHardwareNode. Manufacturer and model of this node's disk controller. :param disk_controller: The disk_controller of this NodesLnnHardwareNode. :type: str<|endoftext|>
0e75102941c04ed8f633567cf95108db2f8f51e653fc9659bb5d070e035fb55c
@property def disk_expander(self): "\n Gets the disk_expander of this NodesLnnHardwareNode.\n Manufacturer and model of this node's disk expander.\n\n :return: The disk_expander of this NodesLnnHardwareNode.\n :rtype: str\n " return self._disk_expander
Gets the disk_expander of this NodesLnnHardwareNode. Manufacturer and model of this node's disk expander. :return: The disk_expander of this NodesLnnHardwareNode. :rtype: str
isi_sdk/models/nodes_lnn_hardware_node.py
disk_expander
Atomicology/isilon_sdk_python
0
python
@property def disk_expander(self): "\n Gets the disk_expander of this NodesLnnHardwareNode.\n Manufacturer and model of this node's disk expander.\n\n :return: The disk_expander of this NodesLnnHardwareNode.\n :rtype: str\n " return self._disk_expander
@property def disk_expander(self): "\n Gets the disk_expander of this NodesLnnHardwareNode.\n Manufacturer and model of this node's disk expander.\n\n :return: The disk_expander of this NodesLnnHardwareNode.\n :rtype: str\n " return self._disk_expander<|docstring|>Gets the disk_expander of this NodesLnnHardwareNode. Manufacturer and model of this node's disk expander. :return: The disk_expander of this NodesLnnHardwareNode. :rtype: str<|endoftext|>
4984d724a28aae6630a6054880d76842d4c949f01594ffd65ef7807b6db8a557
@disk_expander.setter def disk_expander(self, disk_expander): "\n Sets the disk_expander of this NodesLnnHardwareNode.\n Manufacturer and model of this node's disk expander.\n\n :param disk_expander: The disk_expander of this NodesLnnHardwareNode.\n :type: str\n " self._disk_expander = disk_expander
Sets the disk_expander of this NodesLnnHardwareNode. Manufacturer and model of this node's disk expander. :param disk_expander: The disk_expander of this NodesLnnHardwareNode. :type: str
isi_sdk/models/nodes_lnn_hardware_node.py
disk_expander
Atomicology/isilon_sdk_python
0
python
@disk_expander.setter def disk_expander(self, disk_expander): "\n Sets the disk_expander of this NodesLnnHardwareNode.\n Manufacturer and model of this node's disk expander.\n\n :param disk_expander: The disk_expander of this NodesLnnHardwareNode.\n :type: str\n " self._disk_expander = disk_expander
@disk_expander.setter def disk_expander(self, disk_expander): "\n Sets the disk_expander of this NodesLnnHardwareNode.\n Manufacturer and model of this node's disk expander.\n\n :param disk_expander: The disk_expander of this NodesLnnHardwareNode.\n :type: str\n " self._disk_expander = disk_expander<|docstring|>Sets the disk_expander of this NodesLnnHardwareNode. Manufacturer and model of this node's disk expander. :param disk_expander: The disk_expander of this NodesLnnHardwareNode. :type: str<|endoftext|>