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 |
|---|---|---|---|---|---|---|---|---|---|
63f123314da84113fd407d9a0d5d4b246ad45e563f948ded3e44ab91132c3456 | def _apply_interactions(self, cc_lst, age, disabled):
'Returns a list of HCCs after applying interactions.\n '
if (self.version == '22'):
cc_lst = V2218O1M.create_interactions(cc_lst, disabled)
elif (self.version == '23'):
cc_lst = V2318P1M.create_interactions(cc_lst, disabled, age)
elif (self.version == '24'):
cc_lst = V2419P1M.create_interactions(cc_lst, disabled, age)
return cc_lst | Returns a list of HCCs after applying interactions. | hccpy/hcc.py | _apply_interactions | Navina-ai/hccpy | 0 | python | def _apply_interactions(self, cc_lst, age, disabled):
'\n '
if (self.version == '22'):
cc_lst = V2218O1M.create_interactions(cc_lst, disabled)
elif (self.version == '23'):
cc_lst = V2318P1M.create_interactions(cc_lst, disabled, age)
elif (self.version == '24'):
cc_lst = V2419P1M.create_interactions(cc_lst, disabled, age)
return cc_lst | def _apply_interactions(self, cc_lst, age, disabled):
'\n '
if (self.version == '22'):
cc_lst = V2218O1M.create_interactions(cc_lst, disabled)
elif (self.version == '23'):
cc_lst = V2318P1M.create_interactions(cc_lst, disabled, age)
elif (self.version == '24'):
cc_lst = V2419P1M.create_interactions(cc_lst, disabled, age)
return cc_lst<|docstring|>Returns a list of HCCs after applying interactions.<|endoftext|> |
6e15e0241d06b843b0526d732da28de8e9b1c92a41223593c93c64604cb8de48 | def profile(self, dx_lst, age=70, sex='M', elig='CNA', orec='0', medicaid=False):
'Returns the HCC risk profile of a given patient information.\n\n Parameters\n ----------\n dx_lst : list of str\n A list of ICD10 codes for the measurement year.\n age : int or float\n The age of the patient.\n sex : str \n The sex of the patient; {"M", "F"}\n elig : str\n The eligibility segment of the patient.\n Allowed values are as follows:\n - "CFA": Community Full Benefit Dual Aged\n - "CFD": Community Full Benefit Dual Disabled\n - "CNA": Community NonDual Aged\n - "CND": Community NonDual Disabled\n - "CPA": Community Partial Benefit Dual Aged\n - "CPD": Community Partial Benefit Dual Disabled\n - "INS": Long Term Institutional\n - "NE": New Enrollee\n - "SNPNE": SNP NE\n orec: str\n Original reason for entitlement code.\n - "0": Old age and survivor\'s insurance\n - "1": Disability insurance benefits\n - "2": End-stage renal disease \n - "3": Both DIB and ESRD\n medicaid: bool\n If the patient is in Medicaid or not.\n '
sex = self._sexmap(sex)
(disabled, origds, elig) = AGESEXV2.get_ds(age, orec, medicaid, elig)
dx_set = {dx.strip().upper().replace('.', '') for dx in dx_lst}
cc_dct = {dx: self.dx2cc[dx] for dx in dx_set if (dx in self.dx2cc)}
cc_dct = V22I0ED2.apply_agesex_edits(cc_dct, age, sex)
hcc_lst = self._apply_hierarchy(cc_dct, age, sex)
hcc_lst = self._apply_interactions(hcc_lst, age, disabled)
risk_dct = V2218O1P.get_risk_dct(self.coefn, hcc_lst, age, sex, elig, origds)
score = np.sum([x for x in risk_dct.values()])
out = {'risk_score': score, 'details': risk_dct, 'hcc_lst': hcc_lst, 'hcc_map': cc_dct, 'parameters': {'age': age, 'sex': sex, 'elig': elig, 'medicaid': medicaid, 'disabled': disabled, 'origds': origds}}
return out | Returns the HCC risk profile of a given patient information.
Parameters
----------
dx_lst : list of str
A list of ICD10 codes for the measurement year.
age : int or float
The age of the patient.
sex : str
The sex of the patient; {"M", "F"}
elig : str
The eligibility segment of the patient.
Allowed values are as follows:
- "CFA": Community Full Benefit Dual Aged
- "CFD": Community Full Benefit Dual Disabled
- "CNA": Community NonDual Aged
- "CND": Community NonDual Disabled
- "CPA": Community Partial Benefit Dual Aged
- "CPD": Community Partial Benefit Dual Disabled
- "INS": Long Term Institutional
- "NE": New Enrollee
- "SNPNE": SNP NE
orec: str
Original reason for entitlement code.
- "0": Old age and survivor's insurance
- "1": Disability insurance benefits
- "2": End-stage renal disease
- "3": Both DIB and ESRD
medicaid: bool
If the patient is in Medicaid or not. | hccpy/hcc.py | profile | Navina-ai/hccpy | 0 | python | def profile(self, dx_lst, age=70, sex='M', elig='CNA', orec='0', medicaid=False):
'Returns the HCC risk profile of a given patient information.\n\n Parameters\n ----------\n dx_lst : list of str\n A list of ICD10 codes for the measurement year.\n age : int or float\n The age of the patient.\n sex : str \n The sex of the patient; {"M", "F"}\n elig : str\n The eligibility segment of the patient.\n Allowed values are as follows:\n - "CFA": Community Full Benefit Dual Aged\n - "CFD": Community Full Benefit Dual Disabled\n - "CNA": Community NonDual Aged\n - "CND": Community NonDual Disabled\n - "CPA": Community Partial Benefit Dual Aged\n - "CPD": Community Partial Benefit Dual Disabled\n - "INS": Long Term Institutional\n - "NE": New Enrollee\n - "SNPNE": SNP NE\n orec: str\n Original reason for entitlement code.\n - "0": Old age and survivor\'s insurance\n - "1": Disability insurance benefits\n - "2": End-stage renal disease \n - "3": Both DIB and ESRD\n medicaid: bool\n If the patient is in Medicaid or not.\n '
sex = self._sexmap(sex)
(disabled, origds, elig) = AGESEXV2.get_ds(age, orec, medicaid, elig)
dx_set = {dx.strip().upper().replace('.', ) for dx in dx_lst}
cc_dct = {dx: self.dx2cc[dx] for dx in dx_set if (dx in self.dx2cc)}
cc_dct = V22I0ED2.apply_agesex_edits(cc_dct, age, sex)
hcc_lst = self._apply_hierarchy(cc_dct, age, sex)
hcc_lst = self._apply_interactions(hcc_lst, age, disabled)
risk_dct = V2218O1P.get_risk_dct(self.coefn, hcc_lst, age, sex, elig, origds)
score = np.sum([x for x in risk_dct.values()])
out = {'risk_score': score, 'details': risk_dct, 'hcc_lst': hcc_lst, 'hcc_map': cc_dct, 'parameters': {'age': age, 'sex': sex, 'elig': elig, 'medicaid': medicaid, 'disabled': disabled, 'origds': origds}}
return out | def profile(self, dx_lst, age=70, sex='M', elig='CNA', orec='0', medicaid=False):
'Returns the HCC risk profile of a given patient information.\n\n Parameters\n ----------\n dx_lst : list of str\n A list of ICD10 codes for the measurement year.\n age : int or float\n The age of the patient.\n sex : str \n The sex of the patient; {"M", "F"}\n elig : str\n The eligibility segment of the patient.\n Allowed values are as follows:\n - "CFA": Community Full Benefit Dual Aged\n - "CFD": Community Full Benefit Dual Disabled\n - "CNA": Community NonDual Aged\n - "CND": Community NonDual Disabled\n - "CPA": Community Partial Benefit Dual Aged\n - "CPD": Community Partial Benefit Dual Disabled\n - "INS": Long Term Institutional\n - "NE": New Enrollee\n - "SNPNE": SNP NE\n orec: str\n Original reason for entitlement code.\n - "0": Old age and survivor\'s insurance\n - "1": Disability insurance benefits\n - "2": End-stage renal disease \n - "3": Both DIB and ESRD\n medicaid: bool\n If the patient is in Medicaid or not.\n '
sex = self._sexmap(sex)
(disabled, origds, elig) = AGESEXV2.get_ds(age, orec, medicaid, elig)
dx_set = {dx.strip().upper().replace('.', ) for dx in dx_lst}
cc_dct = {dx: self.dx2cc[dx] for dx in dx_set if (dx in self.dx2cc)}
cc_dct = V22I0ED2.apply_agesex_edits(cc_dct, age, sex)
hcc_lst = self._apply_hierarchy(cc_dct, age, sex)
hcc_lst = self._apply_interactions(hcc_lst, age, disabled)
risk_dct = V2218O1P.get_risk_dct(self.coefn, hcc_lst, age, sex, elig, origds)
score = np.sum([x for x in risk_dct.values()])
out = {'risk_score': score, 'details': risk_dct, 'hcc_lst': hcc_lst, 'hcc_map': cc_dct, 'parameters': {'age': age, 'sex': sex, 'elig': elig, 'medicaid': medicaid, 'disabled': disabled, 'origds': origds}}
return out<|docstring|>Returns the HCC risk profile of a given patient information.
Parameters
----------
dx_lst : list of str
A list of ICD10 codes for the measurement year.
age : int or float
The age of the patient.
sex : str
The sex of the patient; {"M", "F"}
elig : str
The eligibility segment of the patient.
Allowed values are as follows:
- "CFA": Community Full Benefit Dual Aged
- "CFD": Community Full Benefit Dual Disabled
- "CNA": Community NonDual Aged
- "CND": Community NonDual Disabled
- "CPA": Community Partial Benefit Dual Aged
- "CPD": Community Partial Benefit Dual Disabled
- "INS": Long Term Institutional
- "NE": New Enrollee
- "SNPNE": SNP NE
orec: str
Original reason for entitlement code.
- "0": Old age and survivor's insurance
- "1": Disability insurance benefits
- "2": End-stage renal disease
- "3": Both DIB and ESRD
medicaid: bool
If the patient is in Medicaid or not.<|endoftext|> |
ee7941aa1cc1264ea44170a6eb151c79da64c46278b2c2be323abb9b88fe25aa | def describe_hcc(self, cc):
'\n Return the medical description of a given Condition Category\n \n Parameters\n ----------\n cc : str\n The Condition Category of interest\n '
cc = cc.upper()
cc_desc = self.label.get(cc.replace('HCC', ''), 'N/A')
cc_desc_short = self.label_short.get(cc.replace('HCC', ''), 'N/A')
if ('HCC' not in cc):
cc = 'HCC{}'.format(cc)
cc_children = self.hier.get(cc, [])
cc_parents = []
for (k, v) in self.hier.items():
if (cc in v):
cc_parents.append(k)
out = {'description': cc_desc, 'desc_short': cc_desc_short, 'children': cc_children, 'parents': cc_parents}
return out | Return the medical description of a given Condition Category
Parameters
----------
cc : str
The Condition Category of interest | hccpy/hcc.py | describe_hcc | Navina-ai/hccpy | 0 | python | def describe_hcc(self, cc):
'\n Return the medical description of a given Condition Category\n \n Parameters\n ----------\n cc : str\n The Condition Category of interest\n '
cc = cc.upper()
cc_desc = self.label.get(cc.replace('HCC', ), 'N/A')
cc_desc_short = self.label_short.get(cc.replace('HCC', ), 'N/A')
if ('HCC' not in cc):
cc = 'HCC{}'.format(cc)
cc_children = self.hier.get(cc, [])
cc_parents = []
for (k, v) in self.hier.items():
if (cc in v):
cc_parents.append(k)
out = {'description': cc_desc, 'desc_short': cc_desc_short, 'children': cc_children, 'parents': cc_parents}
return out | def describe_hcc(self, cc):
'\n Return the medical description of a given Condition Category\n \n Parameters\n ----------\n cc : str\n The Condition Category of interest\n '
cc = cc.upper()
cc_desc = self.label.get(cc.replace('HCC', ), 'N/A')
cc_desc_short = self.label_short.get(cc.replace('HCC', ), 'N/A')
if ('HCC' not in cc):
cc = 'HCC{}'.format(cc)
cc_children = self.hier.get(cc, [])
cc_parents = []
for (k, v) in self.hier.items():
if (cc in v):
cc_parents.append(k)
out = {'description': cc_desc, 'desc_short': cc_desc_short, 'children': cc_children, 'parents': cc_parents}
return out<|docstring|>Return the medical description of a given Condition Category
Parameters
----------
cc : str
The Condition Category of interest<|endoftext|> |
15a5cc013b67f46dc174ac1d953fecab983d61cb969b520b14e080395cac04ae | def diff(self, before=[], after=[]):
'\n Return the difference between two HCC lists (before and after)\n \n Background\n ----------\n CCs evolve over years. As patients get older, new CCs are added, \n some pre-exisited CCs may disappear. Sometimes, CCs get assigned to\n a higher level (or parent) CCs as the conditinos become more \n serious. This module provides the difference between "before" and\n "after" and highlights what are "added (both new and upgraded)", \n "deleted".\n\n Parameters\n ----------\n before : list\n a list of CCs that were present before\n after : list\n a list of CCs that are present curretly\n '
before_set = set(before)
after_set = set(after)
added_set = (after_set - before_set)
deleted_set = (before_set - after_set)
for added_item in added_set:
if (added_item not in self.hier):
continue
for child_item in self.hier[added_item]:
if (child_item in deleted_set):
deleted_set.remove(child_item)
out = {'added': list(added_set), 'deleted': list(deleted_set)}
return out | Return the difference between two HCC lists (before and after)
Background
----------
CCs evolve over years. As patients get older, new CCs are added,
some pre-exisited CCs may disappear. Sometimes, CCs get assigned to
a higher level (or parent) CCs as the conditinos become more
serious. This module provides the difference between "before" and
"after" and highlights what are "added (both new and upgraded)",
"deleted".
Parameters
----------
before : list
a list of CCs that were present before
after : list
a list of CCs that are present curretly | hccpy/hcc.py | diff | Navina-ai/hccpy | 0 | python | def diff(self, before=[], after=[]):
'\n Return the difference between two HCC lists (before and after)\n \n Background\n ----------\n CCs evolve over years. As patients get older, new CCs are added, \n some pre-exisited CCs may disappear. Sometimes, CCs get assigned to\n a higher level (or parent) CCs as the conditinos become more \n serious. This module provides the difference between "before" and\n "after" and highlights what are "added (both new and upgraded)", \n "deleted".\n\n Parameters\n ----------\n before : list\n a list of CCs that were present before\n after : list\n a list of CCs that are present curretly\n '
before_set = set(before)
after_set = set(after)
added_set = (after_set - before_set)
deleted_set = (before_set - after_set)
for added_item in added_set:
if (added_item not in self.hier):
continue
for child_item in self.hier[added_item]:
if (child_item in deleted_set):
deleted_set.remove(child_item)
out = {'added': list(added_set), 'deleted': list(deleted_set)}
return out | def diff(self, before=[], after=[]):
'\n Return the difference between two HCC lists (before and after)\n \n Background\n ----------\n CCs evolve over years. As patients get older, new CCs are added, \n some pre-exisited CCs may disappear. Sometimes, CCs get assigned to\n a higher level (or parent) CCs as the conditinos become more \n serious. This module provides the difference between "before" and\n "after" and highlights what are "added (both new and upgraded)", \n "deleted".\n\n Parameters\n ----------\n before : list\n a list of CCs that were present before\n after : list\n a list of CCs that are present curretly\n '
before_set = set(before)
after_set = set(after)
added_set = (after_set - before_set)
deleted_set = (before_set - after_set)
for added_item in added_set:
if (added_item not in self.hier):
continue
for child_item in self.hier[added_item]:
if (child_item in deleted_set):
deleted_set.remove(child_item)
out = {'added': list(added_set), 'deleted': list(deleted_set)}
return out<|docstring|>Return the difference between two HCC lists (before and after)
Background
----------
CCs evolve over years. As patients get older, new CCs are added,
some pre-exisited CCs may disappear. Sometimes, CCs get assigned to
a higher level (or parent) CCs as the conditinos become more
serious. This module provides the difference between "before" and
"after" and highlights what are "added (both new and upgraded)",
"deleted".
Parameters
----------
before : list
a list of CCs that were present before
after : list
a list of CCs that are present curretly<|endoftext|> |
b78dc95da07230125bad40f0e4eca7364c2731a445b8cd090f131f9a1eb9e0d9 | @implements(numpy.count_nonzero)
def count_nonzero(x: PolyLike, axis: Union[(None, int, Sequence[int])]=None, **kwargs: Any) -> Union[(int, numpy.ndarray)]:
'\n Count the number of non-zero values in the array a.\n\n Args:\n x:\n The array for which to count non-zeros.\n axis: (Union[int, Tuple[int], None]):\n Axis or tuple of axes along which to count non-zeros. Default is\n None, meaning that non-zeros will be counted along a flattened\n version of a.\n\n Returns:\n Number of non-zero values in the array along a given axis. Otherwise,\n the total number of non-zero values in the array is returned.\n\n Examples:\n >>> q0, q1 = numpoly.variable(2)\n >>> numpoly.count_nonzero([q0])\n 1\n >>> numpoly.count_nonzero([[0, q0*q0, 0, 0],\n ... [q0+1, 0, 2*q0, 7*q0]])\n 4\n >>> numpoly.count_nonzero([[0, q0+q1, 0, 0],\n ... [3*q1, 0, 2, 7*q0]], axis=0)\n array([1, 1, 1, 1])\n >>> numpoly.count_nonzero([[0, q1, 0, 0],\n ... [q0, 0, 2*q0, 6*q1]], axis=1)\n array([1, 3])\n\n '
a = numpoly.aspolynomial(x)
index = numpy.any(numpy.asarray(a.coefficients), axis=0)
return numpy.count_nonzero(index, axis=axis) | Count the number of non-zero values in the array a.
Args:
x:
The array for which to count non-zeros.
axis: (Union[int, Tuple[int], None]):
Axis or tuple of axes along which to count non-zeros. Default is
None, meaning that non-zeros will be counted along a flattened
version of a.
Returns:
Number of non-zero values in the array along a given axis. Otherwise,
the total number of non-zero values in the array is returned.
Examples:
>>> q0, q1 = numpoly.variable(2)
>>> numpoly.count_nonzero([q0])
1
>>> numpoly.count_nonzero([[0, q0*q0, 0, 0],
... [q0+1, 0, 2*q0, 7*q0]])
4
>>> numpoly.count_nonzero([[0, q0+q1, 0, 0],
... [3*q1, 0, 2, 7*q0]], axis=0)
array([1, 1, 1, 1])
>>> numpoly.count_nonzero([[0, q1, 0, 0],
... [q0, 0, 2*q0, 6*q1]], axis=1)
array([1, 3]) | numpoly/array_function/count_nonzero.py | count_nonzero | jonathf/npoly | 8 | python | @implements(numpy.count_nonzero)
def count_nonzero(x: PolyLike, axis: Union[(None, int, Sequence[int])]=None, **kwargs: Any) -> Union[(int, numpy.ndarray)]:
'\n Count the number of non-zero values in the array a.\n\n Args:\n x:\n The array for which to count non-zeros.\n axis: (Union[int, Tuple[int], None]):\n Axis or tuple of axes along which to count non-zeros. Default is\n None, meaning that non-zeros will be counted along a flattened\n version of a.\n\n Returns:\n Number of non-zero values in the array along a given axis. Otherwise,\n the total number of non-zero values in the array is returned.\n\n Examples:\n >>> q0, q1 = numpoly.variable(2)\n >>> numpoly.count_nonzero([q0])\n 1\n >>> numpoly.count_nonzero([[0, q0*q0, 0, 0],\n ... [q0+1, 0, 2*q0, 7*q0]])\n 4\n >>> numpoly.count_nonzero([[0, q0+q1, 0, 0],\n ... [3*q1, 0, 2, 7*q0]], axis=0)\n array([1, 1, 1, 1])\n >>> numpoly.count_nonzero([[0, q1, 0, 0],\n ... [q0, 0, 2*q0, 6*q1]], axis=1)\n array([1, 3])\n\n '
a = numpoly.aspolynomial(x)
index = numpy.any(numpy.asarray(a.coefficients), axis=0)
return numpy.count_nonzero(index, axis=axis) | @implements(numpy.count_nonzero)
def count_nonzero(x: PolyLike, axis: Union[(None, int, Sequence[int])]=None, **kwargs: Any) -> Union[(int, numpy.ndarray)]:
'\n Count the number of non-zero values in the array a.\n\n Args:\n x:\n The array for which to count non-zeros.\n axis: (Union[int, Tuple[int], None]):\n Axis or tuple of axes along which to count non-zeros. Default is\n None, meaning that non-zeros will be counted along a flattened\n version of a.\n\n Returns:\n Number of non-zero values in the array along a given axis. Otherwise,\n the total number of non-zero values in the array is returned.\n\n Examples:\n >>> q0, q1 = numpoly.variable(2)\n >>> numpoly.count_nonzero([q0])\n 1\n >>> numpoly.count_nonzero([[0, q0*q0, 0, 0],\n ... [q0+1, 0, 2*q0, 7*q0]])\n 4\n >>> numpoly.count_nonzero([[0, q0+q1, 0, 0],\n ... [3*q1, 0, 2, 7*q0]], axis=0)\n array([1, 1, 1, 1])\n >>> numpoly.count_nonzero([[0, q1, 0, 0],\n ... [q0, 0, 2*q0, 6*q1]], axis=1)\n array([1, 3])\n\n '
a = numpoly.aspolynomial(x)
index = numpy.any(numpy.asarray(a.coefficients), axis=0)
return numpy.count_nonzero(index, axis=axis)<|docstring|>Count the number of non-zero values in the array a.
Args:
x:
The array for which to count non-zeros.
axis: (Union[int, Tuple[int], None]):
Axis or tuple of axes along which to count non-zeros. Default is
None, meaning that non-zeros will be counted along a flattened
version of a.
Returns:
Number of non-zero values in the array along a given axis. Otherwise,
the total number of non-zero values in the array is returned.
Examples:
>>> q0, q1 = numpoly.variable(2)
>>> numpoly.count_nonzero([q0])
1
>>> numpoly.count_nonzero([[0, q0*q0, 0, 0],
... [q0+1, 0, 2*q0, 7*q0]])
4
>>> numpoly.count_nonzero([[0, q0+q1, 0, 0],
... [3*q1, 0, 2, 7*q0]], axis=0)
array([1, 1, 1, 1])
>>> numpoly.count_nonzero([[0, q1, 0, 0],
... [q0, 0, 2*q0, 6*q1]], axis=1)
array([1, 3])<|endoftext|> |
85b652f7ba79764c6548e856514046bef9372e31932e88ba814501a78eafe7cc | def conv3x3(in_planes, out_planes, stride=1):
' 3x3 convolution with padding '
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) | 3x3 convolution with padding | mmocr/models/textrecog/backbones/table_resnet_extra.py | conv3x3 | yanlieting/TableMASTER-mmocr | 206 | python | def conv3x3(in_planes, out_planes, stride=1):
' '
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) | def conv3x3(in_planes, out_planes, stride=1):
' '
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False)<|docstring|>3x3 convolution with padding<|endoftext|> |
51df69389d033e9e7710d21d786dda0272e8544a9b074c47432ee1dd0aee5f3e | def conv1x1(in_planes, out_planes, stride=1):
' 1x1 convolution '
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) | 1x1 convolution | mmocr/models/textrecog/backbones/table_resnet_extra.py | conv1x1 | yanlieting/TableMASTER-mmocr | 206 | python | def conv1x1(in_planes, out_planes, stride=1):
' '
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) | def conv1x1(in_planes, out_planes, stride=1):
' '
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)<|docstring|>1x1 convolution<|endoftext|> |
11984b87c48acc17519b06cf681f424efec91c4fae36236c9b67658f12241214 | def _preprocess(self, im_crops):
'\n TODO:\n 1. to float with scale from 0 to 1\n 2. resize to (64, 128) as Market1501 dataset did\n 3. concatenate to a numpy array\n 3. to torch Tensor\n 4. normalize\n '
def _resize(im, size):
return cv2.resize((im.astype(np.float32) / 255.0), size)
im_batch = torch.cat([self.norm(_resize(im, self.size)).unsqueeze(0) for im in im_crops], dim=0).float()
return im_batch | TODO:
1. to float with scale from 0 to 1
2. resize to (64, 128) as Market1501 dataset did
3. concatenate to a numpy array
3. to torch Tensor
4. normalize | tracker/deep_sort/deep/feature_extractor.py | _preprocess | GoalballAnalysis/GUI | 0 | python | def _preprocess(self, im_crops):
'\n TODO:\n 1. to float with scale from 0 to 1\n 2. resize to (64, 128) as Market1501 dataset did\n 3. concatenate to a numpy array\n 3. to torch Tensor\n 4. normalize\n '
def _resize(im, size):
return cv2.resize((im.astype(np.float32) / 255.0), size)
im_batch = torch.cat([self.norm(_resize(im, self.size)).unsqueeze(0) for im in im_crops], dim=0).float()
return im_batch | def _preprocess(self, im_crops):
'\n TODO:\n 1. to float with scale from 0 to 1\n 2. resize to (64, 128) as Market1501 dataset did\n 3. concatenate to a numpy array\n 3. to torch Tensor\n 4. normalize\n '
def _resize(im, size):
return cv2.resize((im.astype(np.float32) / 255.0), size)
im_batch = torch.cat([self.norm(_resize(im, self.size)).unsqueeze(0) for im in im_crops], dim=0).float()
return im_batch<|docstring|>TODO:
1. to float with scale from 0 to 1
2. resize to (64, 128) as Market1501 dataset did
3. concatenate to a numpy array
3. to torch Tensor
4. normalize<|endoftext|> |
2748697b3c1a0356823604b7c6fb365d918e64abe967260cbaa44c42ab31d338 | def __init__(self, label_col_name):
'\n Args:\n label_col_name: 标签名\n '
self.label_col_name = label_col_name
self.ds = None
self.schemas = None
self.file_format = None
self.data_source = None | Args:
label_col_name: 标签名 | feature_selection/parse_data/read_api_v2.py | __init__ | Junphy-Jan/Feature_Selection | 3 | python | def __init__(self, label_col_name):
'\n Args:\n label_col_name: 标签名\n '
self.label_col_name = label_col_name
self.ds = None
self.schemas = None
self.file_format = None
self.data_source = None | def __init__(self, label_col_name):
'\n Args:\n label_col_name: 标签名\n '
self.label_col_name = label_col_name
self.ds = None
self.schemas = None
self.file_format = None
self.data_source = None<|docstring|>Args:
label_col_name: 标签名<|endoftext|> |
1b09049c64449d417cf2cc2e454223cda8a8781892c4b8ea1316d2c82736981c | def dump_ciphertext(in_file, key):
'Returns the in_file data, encrypted using the key.'
cipher = AESCipher(key)
with open(in_file, 'rb') as f:
data = f.read()
return cipher.encrypt(((in_file + '::::\n').encode('utf-8') + data)) | Returns the in_file data, encrypted using the key. | source/python34/cryptopress.py | dump_ciphertext | zach-king/CoolPython | 3 | python | def dump_ciphertext(in_file, key):
cipher = AESCipher(key)
with open(in_file, 'rb') as f:
data = f.read()
return cipher.encrypt(((in_file + '::::\n').encode('utf-8') + data)) | def dump_ciphertext(in_file, key):
cipher = AESCipher(key)
with open(in_file, 'rb') as f:
data = f.read()
return cipher.encrypt(((in_file + '::::\n').encode('utf-8') + data))<|docstring|>Returns the in_file data, encrypted using the key.<|endoftext|> |
0faeff5724c200f758cd24bb32845315c37e3036fd43abe1105fb55101328684 | def dump_multiple(key, files, output_file=None):
'Dump the ciphertext for each file in files to the output_file.'
full_data = b''
for f in files:
ciphertext = dump_ciphertext(f, key)
full_data += (ciphertext + b'\n')
if (output_file != None):
with open(output_file, 'wb') as f:
f.write(full_data)
return full_data | Dump the ciphertext for each file in files to the output_file. | source/python34/cryptopress.py | dump_multiple | zach-king/CoolPython | 3 | python | def dump_multiple(key, files, output_file=None):
full_data = b
for f in files:
ciphertext = dump_ciphertext(f, key)
full_data += (ciphertext + b'\n')
if (output_file != None):
with open(output_file, 'wb') as f:
f.write(full_data)
return full_data | def dump_multiple(key, files, output_file=None):
full_data = b
for f in files:
ciphertext = dump_ciphertext(f, key)
full_data += (ciphertext + b'\n')
if (output_file != None):
with open(output_file, 'wb') as f:
f.write(full_data)
return full_data<|docstring|>Dump the ciphertext for each file in files to the output_file.<|endoftext|> |
b3106d4bbbca70dc4e0e8574b9bbcfb359c660bae547271027e28f159427a2e8 | def restore_files(key, archive_file):
'Restore the orgiginal files from the compressed archive.'
with open(archive_file, 'r') as f:
lines = f.readlines()
for ciphertext in lines:
cipher = AESCipher(key)
decrypted = cipher.decrypt(ciphertext)
(fname, data) = decrypted.decode('utf-8').split('::::\n')
with open(fname, 'wb') as f:
f.write(data.strip('\n').encode('utf-8')) | Restore the orgiginal files from the compressed archive. | source/python34/cryptopress.py | restore_files | zach-king/CoolPython | 3 | python | def restore_files(key, archive_file):
with open(archive_file, 'r') as f:
lines = f.readlines()
for ciphertext in lines:
cipher = AESCipher(key)
decrypted = cipher.decrypt(ciphertext)
(fname, data) = decrypted.decode('utf-8').split('::::\n')
with open(fname, 'wb') as f:
f.write(data.strip('\n').encode('utf-8')) | def restore_files(key, archive_file):
with open(archive_file, 'r') as f:
lines = f.readlines()
for ciphertext in lines:
cipher = AESCipher(key)
decrypted = cipher.decrypt(ciphertext)
(fname, data) = decrypted.decode('utf-8').split('::::\n')
with open(fname, 'wb') as f:
f.write(data.strip('\n').encode('utf-8'))<|docstring|>Restore the orgiginal files from the compressed archive.<|endoftext|> |
a13edddfd71e86251e0ec224363fa2bfa4e4e905c2d6d4be95ae5a265ebb7b60 | @property
def epoch_only(self):
'Returns :attr:`epoch_only`.\n '
return self._epoch_only | Returns :attr:`epoch_only`. | colossalai/trainer/metric.py | epoch_only | ProgrammerNeoo/ColossalAI | 1 | python | @property
def epoch_only(self):
'\n '
return self._epoch_only | @property
def epoch_only(self):
'\n '
return self._epoch_only<|docstring|>Returns :attr:`epoch_only`.<|endoftext|> |
d4ab6e10c6ae6640efe859a8c968ab24f2dace98c163e620af64b20b4dc3c8ad | @abstractmethod
def reset(self) -> None:
"Resets the metric to it's initial state.\n By default, this is called at the start of each epoch.\n "
pass | Resets the metric to it's initial state.
By default, this is called at the start of each epoch. | colossalai/trainer/metric.py | reset | ProgrammerNeoo/ColossalAI | 1 | python | @abstractmethod
def reset(self) -> None:
"Resets the metric to it's initial state.\n By default, this is called at the start of each epoch.\n "
pass | @abstractmethod
def reset(self) -> None:
"Resets the metric to it's initial state.\n By default, this is called at the start of each epoch.\n "
pass<|docstring|>Resets the metric to it's initial state.
By default, this is called at the start of each epoch.<|endoftext|> |
9129d92e511a6912b85fa3899f6b142583d7536fd37648657a7327fdbf29b327 | @abstractmethod
def update(self, *args, **kwargs) -> None:
"Updates the metric's state using the passed batch output.\n By default, this is called once for each batch.\n "
pass | Updates the metric's state using the passed batch output.
By default, this is called once for each batch. | colossalai/trainer/metric.py | update | ProgrammerNeoo/ColossalAI | 1 | python | @abstractmethod
def update(self, *args, **kwargs) -> None:
"Updates the metric's state using the passed batch output.\n By default, this is called once for each batch.\n "
pass | @abstractmethod
def update(self, *args, **kwargs) -> None:
"Updates the metric's state using the passed batch output.\n By default, this is called once for each batch.\n "
pass<|docstring|>Updates the metric's state using the passed batch output.
By default, this is called once for each batch.<|endoftext|> |
3927953a806361b198a404841d1ffa0dc0c2621551f6b40a2ffe7c9b7c29a6b4 | @abstractmethod
def get_last_step_value(self):
'Returns the metric value in the last iteration.\n '
pass | Returns the metric value in the last iteration. | colossalai/trainer/metric.py | get_last_step_value | ProgrammerNeoo/ColossalAI | 1 | python | @abstractmethod
def get_last_step_value(self):
'\n '
pass | @abstractmethod
def get_last_step_value(self):
'\n '
pass<|docstring|>Returns the metric value in the last iteration.<|endoftext|> |
b3e4fb5edc07d2241f0b7f37afda483010828865a9ba93e540503eab672ad37f | @abstractmethod
def get_accumulated_value(self):
"Computes the metric based on it's accumulated state.\n By default, this is called at the end of each epoch.\n\n :return: the actual quantity of interest\n :rtype: Any\n "
pass | Computes the metric based on it's accumulated state.
By default, this is called at the end of each epoch.
:return: the actual quantity of interest
:rtype: Any | colossalai/trainer/metric.py | get_accumulated_value | ProgrammerNeoo/ColossalAI | 1 | python | @abstractmethod
def get_accumulated_value(self):
"Computes the metric based on it's accumulated state.\n By default, this is called at the end of each epoch.\n\n :return: the actual quantity of interest\n :rtype: Any\n "
pass | @abstractmethod
def get_accumulated_value(self):
"Computes the metric based on it's accumulated state.\n By default, this is called at the end of each epoch.\n\n :return: the actual quantity of interest\n :rtype: Any\n "
pass<|docstring|>Computes the metric based on it's accumulated state.
By default, this is called at the end of each epoch.
:return: the actual quantity of interest
:rtype: Any<|endoftext|> |
41e434ad2d163ac32a15b17f86704aeef96b062aff57bb98824812c9e07f61b8 | @staticmethod
@abstractmethod
def is_better(a, b) -> bool:
'Compares a and b, and returns whether a is better than b\n\n :return: The result of comparison\n :rtype: bool\n '
pass | Compares a and b, and returns whether a is better than b
:return: The result of comparison
:rtype: bool | colossalai/trainer/metric.py | is_better | ProgrammerNeoo/ColossalAI | 1 | python | @staticmethod
@abstractmethod
def is_better(a, b) -> bool:
'Compares a and b, and returns whether a is better than b\n\n :return: The result of comparison\n :rtype: bool\n '
pass | @staticmethod
@abstractmethod
def is_better(a, b) -> bool:
'Compares a and b, and returns whether a is better than b\n\n :return: The result of comparison\n :rtype: bool\n '
pass<|docstring|>Compares a and b, and returns whether a is better than b
:return: The result of comparison
:rtype: bool<|endoftext|> |
86e339813fdf8eab45fc9eea19df1cdf53ecec16e9d80fdf331a51e65c851962 | def reset(self) -> None:
'Sets :attr:`last_step_loss` and :attr:`accum_loss` to zero.\n '
self.last_step_loss.zero_()
self.accum_loss.zero_()
self.count = 0 | Sets :attr:`last_step_loss` and :attr:`accum_loss` to zero. | colossalai/trainer/metric.py | reset | ProgrammerNeoo/ColossalAI | 1 | python | def reset(self) -> None:
'\n '
self.last_step_loss.zero_()
self.accum_loss.zero_()
self.count = 0 | def reset(self) -> None:
'\n '
self.last_step_loss.zero_()
self.accum_loss.zero_()
self.count = 0<|docstring|>Sets :attr:`last_step_loss` and :attr:`accum_loss` to zero.<|endoftext|> |
cd6fdd7be8ec69fb18348e8f061b2a026c34a5f480d1fe7bb84ca42718af10db | def update(self, loss) -> None:
'Updates :attr:`last_step_loss` and :attr:`accum_loss` with current loss.\n It expects the output has loss.\n\n :param loss: Current loss of the output\n '
loss_ = loss.detach()
self.last_step_loss.copy_(loss_)
self.accum_loss.add_(loss_)
self.count += 1 | Updates :attr:`last_step_loss` and :attr:`accum_loss` with current loss.
It expects the output has loss.
:param loss: Current loss of the output | colossalai/trainer/metric.py | update | ProgrammerNeoo/ColossalAI | 1 | python | def update(self, loss) -> None:
'Updates :attr:`last_step_loss` and :attr:`accum_loss` with current loss.\n It expects the output has loss.\n\n :param loss: Current loss of the output\n '
loss_ = loss.detach()
self.last_step_loss.copy_(loss_)
self.accum_loss.add_(loss_)
self.count += 1 | def update(self, loss) -> None:
'Updates :attr:`last_step_loss` and :attr:`accum_loss` with current loss.\n It expects the output has loss.\n\n :param loss: Current loss of the output\n '
loss_ = loss.detach()
self.last_step_loss.copy_(loss_)
self.accum_loss.add_(loss_)
self.count += 1<|docstring|>Updates :attr:`last_step_loss` and :attr:`accum_loss` with current loss.
It expects the output has loss.
:param loss: Current loss of the output<|endoftext|> |
0cdcc4869486487efa66079be829310238332347390eebe07ef76707d3a479b4 | def get_accumulated_value(self):
'Returns accumulated loss.\n '
if gpc.is_initialized(ParallelMode.DATA):
dist.all_reduce(self.accum_loss, op=dist.ReduceOp.SUM, group=gpc.get_group(ParallelMode.DATA))
self.accum_loss.div_(gpc.get_world_size(ParallelMode.DATA))
self.accum_loss.div_(self.count)
return self.accum_loss.item() | Returns accumulated loss. | colossalai/trainer/metric.py | get_accumulated_value | ProgrammerNeoo/ColossalAI | 1 | python | def get_accumulated_value(self):
'\n '
if gpc.is_initialized(ParallelMode.DATA):
dist.all_reduce(self.accum_loss, op=dist.ReduceOp.SUM, group=gpc.get_group(ParallelMode.DATA))
self.accum_loss.div_(gpc.get_world_size(ParallelMode.DATA))
self.accum_loss.div_(self.count)
return self.accum_loss.item() | def get_accumulated_value(self):
'\n '
if gpc.is_initialized(ParallelMode.DATA):
dist.all_reduce(self.accum_loss, op=dist.ReduceOp.SUM, group=gpc.get_group(ParallelMode.DATA))
self.accum_loss.div_(gpc.get_world_size(ParallelMode.DATA))
self.accum_loss.div_(self.count)
return self.accum_loss.item()<|docstring|>Returns accumulated loss.<|endoftext|> |
9fc38db7d28c1ef3448d476d9a72fc05ec9616a02326793e1d28889012d0e67e | def get_last_step_value(self):
'Returns :attr:`last_step_loss`.\n '
return self.last_step_loss | Returns :attr:`last_step_loss`. | colossalai/trainer/metric.py | get_last_step_value | ProgrammerNeoo/ColossalAI | 1 | python | def get_last_step_value(self):
'\n '
return self.last_step_loss | def get_last_step_value(self):
'\n '
return self.last_step_loss<|docstring|>Returns :attr:`last_step_loss`.<|endoftext|> |
4940ff484d9370bfd20e5783f28b75c99b383186ff25f9b1de53da3ec14ff61e | def update(self, logits, label) -> None:
'Updates last step accuracy and accumulated accuracy with current logits\n and labels. It expects the output has logits and labels.\n\n :param logits: The logits output of the model\n :param label: The labels of the input data\n '
if isinstance(logits, (list, tuple)):
logits = logits[0]
if isinstance(label, (list, tuple)):
label = label[0]
preds = torch.argmax(logits, dim=(- 1))
correct = torch.sum((label == preds))
self.last_step_sum.fill_(label.size(0))
self.last_step_correct.fill_(correct)
self.accumulated_sum += self.last_step_sum
self.accumulated_correct += self.last_step_correct | Updates last step accuracy and accumulated accuracy with current logits
and labels. It expects the output has logits and labels.
:param logits: The logits output of the model
:param label: The labels of the input data | colossalai/trainer/metric.py | update | ProgrammerNeoo/ColossalAI | 1 | python | def update(self, logits, label) -> None:
'Updates last step accuracy and accumulated accuracy with current logits\n and labels. It expects the output has logits and labels.\n\n :param logits: The logits output of the model\n :param label: The labels of the input data\n '
if isinstance(logits, (list, tuple)):
logits = logits[0]
if isinstance(label, (list, tuple)):
label = label[0]
preds = torch.argmax(logits, dim=(- 1))
correct = torch.sum((label == preds))
self.last_step_sum.fill_(label.size(0))
self.last_step_correct.fill_(correct)
self.accumulated_sum += self.last_step_sum
self.accumulated_correct += self.last_step_correct | def update(self, logits, label) -> None:
'Updates last step accuracy and accumulated accuracy with current logits\n and labels. It expects the output has logits and labels.\n\n :param logits: The logits output of the model\n :param label: The labels of the input data\n '
if isinstance(logits, (list, tuple)):
logits = logits[0]
if isinstance(label, (list, tuple)):
label = label[0]
preds = torch.argmax(logits, dim=(- 1))
correct = torch.sum((label == preds))
self.last_step_sum.fill_(label.size(0))
self.last_step_correct.fill_(correct)
self.accumulated_sum += self.last_step_sum
self.accumulated_correct += self.last_step_correct<|docstring|>Updates last step accuracy and accumulated accuracy with current logits
and labels. It expects the output has logits and labels.
:param logits: The logits output of the model
:param label: The labels of the input data<|endoftext|> |
e1e79c1a98eb37037924bcff5305ac84684e6d1fd6d86d6c18b1ab519013cd92 | def __init__(self, commandName: int, payloadSize: int=0, checkSum: str='', startString: str=MAINNET_START_STRING):
'\n Read https://bitcoin.org/en/developer-reference#message-headers\n :param commandName: identifies the type of message\n :param payloadSize: number of bytes in payload\n :param checkSum: First 4 bytes of SHA256(SHA256(payload)) in internal byte order.\n :param startString: always at the start of the message\n '
self.startString = startString
self.commandName = commandName
self.payloadSize = payloadSize
self.checkSum = checkSum
self.startString = startString | Read https://bitcoin.org/en/developer-reference#message-headers
:param commandName: identifies the type of message
:param payloadSize: number of bytes in payload
:param checkSum: First 4 bytes of SHA256(SHA256(payload)) in internal byte order.
:param startString: always at the start of the message | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self, commandName: int, payloadSize: int=0, checkSum: str=, startString: str=MAINNET_START_STRING):
'\n Read https://bitcoin.org/en/developer-reference#message-headers\n :param commandName: identifies the type of message\n :param payloadSize: number of bytes in payload\n :param checkSum: First 4 bytes of SHA256(SHA256(payload)) in internal byte order.\n :param startString: always at the start of the message\n '
self.startString = startString
self.commandName = commandName
self.payloadSize = payloadSize
self.checkSum = checkSum
self.startString = startString | def __init__(self, commandName: int, payloadSize: int=0, checkSum: str=, startString: str=MAINNET_START_STRING):
'\n Read https://bitcoin.org/en/developer-reference#message-headers\n :param commandName: identifies the type of message\n :param payloadSize: number of bytes in payload\n :param checkSum: First 4 bytes of SHA256(SHA256(payload)) in internal byte order.\n :param startString: always at the start of the message\n '
self.startString = startString
self.commandName = commandName
self.payloadSize = payloadSize
self.checkSum = checkSum
self.startString = startString<|docstring|>Read https://bitcoin.org/en/developer-reference#message-headers
:param commandName: identifies the type of message
:param payloadSize: number of bytes in payload
:param checkSum: First 4 bytes of SHA256(SHA256(payload)) in internal byte order.
:param startString: always at the start of the message<|endoftext|> |
0788a9aa252cec4dba79d45da28f2061c203fbfce65fe40ff8183ed4afa0c880 | def getMessageHeaderAsDict(self) -> dict:
'\n returns the message header as dictionary\n :return: message header dict\n '
return {'startString': self.startString, 'commandName': self.commandName, 'payloadSize': self.payloadSize, 'checkSum': self.checkSum, 'startString': self.startString} | returns the message header as dictionary
:return: message header dict | src/p2p_network/tlc_message.py | getMessageHeaderAsDict | kalymgr/Project-T-Cryptocurrencies | 0 | python | def getMessageHeaderAsDict(self) -> dict:
'\n returns the message header as dictionary\n :return: message header dict\n '
return {'startString': self.startString, 'commandName': self.commandName, 'payloadSize': self.payloadSize, 'checkSum': self.checkSum, 'startString': self.startString} | def getMessageHeaderAsDict(self) -> dict:
'\n returns the message header as dictionary\n :return: message header dict\n '
return {'startString': self.startString, 'commandName': self.commandName, 'payloadSize': self.payloadSize, 'checkSum': self.checkSum, 'startString': self.startString}<|docstring|>returns the message header as dictionary
:return: message header dict<|endoftext|> |
f6f11f694e52ad17b43a70568f889effd3044f720399f3fe5623bf836ffcebc5 | def __init__(self, msgType: int, msgData=None):
'\n Constructor for a message\n :param msgType: the type of the message\n :param msgData: the data of the message\n '
self.msgHeader = MessageHeader(msgType)
self.msgData = msgData | Constructor for a message
:param msgType: the type of the message
:param msgData: the data of the message | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self, msgType: int, msgData=None):
'\n Constructor for a message\n :param msgType: the type of the message\n :param msgData: the data of the message\n '
self.msgHeader = MessageHeader(msgType)
self.msgData = msgData | def __init__(self, msgType: int, msgData=None):
'\n Constructor for a message\n :param msgType: the type of the message\n :param msgData: the data of the message\n '
self.msgHeader = MessageHeader(msgType)
self.msgData = msgData<|docstring|>Constructor for a message
:param msgType: the type of the message
:param msgData: the data of the message<|endoftext|> |
cde32c44b9f0623d6a5d29db74d02eea8986bad788608ec8e9e1673e7a03685e | def getMessageAsDict(self):
'\n returns the message as a dictionary\n :return:\n '
return {'msgHeader': self.msgHeader.getMessageHeaderAsDict(), 'msgData': self.msgData} | returns the message as a dictionary
:return: | src/p2p_network/tlc_message.py | getMessageAsDict | kalymgr/Project-T-Cryptocurrencies | 0 | python | def getMessageAsDict(self):
'\n returns the message as a dictionary\n :return:\n '
return {'msgHeader': self.msgHeader.getMessageHeaderAsDict(), 'msgData': self.msgData} | def getMessageAsDict(self):
'\n returns the message as a dictionary\n :return:\n '
return {'msgHeader': self.msgHeader.getMessageHeaderAsDict(), 'msgData': self.msgData}<|docstring|>returns the message as a dictionary
:return:<|endoftext|> |
a075baa3b06c9617084535a805fb990dc122e61421a8584cf03781a7cc0a2748 | def getMessageAsSendable(self):
'\n returns the messaqe in a form that is sendable by the tcp protocol\n :return: for now, a json string\n '
return (json.dumps(self.getMessageAsDict()) + '\n').encode('utf8') | returns the messaqe in a form that is sendable by the tcp protocol
:return: for now, a json string | src/p2p_network/tlc_message.py | getMessageAsSendable | kalymgr/Project-T-Cryptocurrencies | 0 | python | def getMessageAsSendable(self):
'\n returns the messaqe in a form that is sendable by the tcp protocol\n :return: for now, a json string\n '
return (json.dumps(self.getMessageAsDict()) + '\n').encode('utf8') | def getMessageAsSendable(self):
'\n returns the messaqe in a form that is sendable by the tcp protocol\n :return: for now, a json string\n '
return (json.dumps(self.getMessageAsDict()) + '\n').encode('utf8')<|docstring|>returns the messaqe in a form that is sendable by the tcp protocol
:return: for now, a json string<|endoftext|> |
2203f083630b779f689313a8f4e1973a35d216a742cdd6fd8dc3df8fc234437d | def __init__(self, nodeType: int, ipAddress: str=None, port: int=None, protocolVersion=Parameters.PROTOCOL_VERSION):
'\n Constructor method for the version message\n :param nodeType: the type of the node (eg full node, seed etc.)\n :param ipAddress: the ip address of the transmitting node. The default used, if None\n :param port: the port of the transmitting node. The default used, if None\n :param protocolVersion: the version of the protocol. If ommitted, it uses the default from the Params\n '
if (ipAddress is None):
ipAddress = Parameters.NODE_IP_ADDRESS
if (port is None):
port = Parameters.NODE_DEFAULT_PORT_MAINNET
super().__init__(TLCMessage.CTRLMSGTYPE_VERSION)
self.msgData = {'version': protocolVersion, 'services': Parameters.NODE_TYPE, 'timestamp': time(), 'addrReceivServices': nodeType, 'ipAddress': ipAddress, 'port': port}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | Constructor method for the version message
:param nodeType: the type of the node (eg full node, seed etc.)
:param ipAddress: the ip address of the transmitting node. The default used, if None
:param port: the port of the transmitting node. The default used, if None
:param protocolVersion: the version of the protocol. If ommitted, it uses the default from the Params | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self, nodeType: int, ipAddress: str=None, port: int=None, protocolVersion=Parameters.PROTOCOL_VERSION):
'\n Constructor method for the version message\n :param nodeType: the type of the node (eg full node, seed etc.)\n :param ipAddress: the ip address of the transmitting node. The default used, if None\n :param port: the port of the transmitting node. The default used, if None\n :param protocolVersion: the version of the protocol. If ommitted, it uses the default from the Params\n '
if (ipAddress is None):
ipAddress = Parameters.NODE_IP_ADDRESS
if (port is None):
port = Parameters.NODE_DEFAULT_PORT_MAINNET
super().__init__(TLCMessage.CTRLMSGTYPE_VERSION)
self.msgData = {'version': protocolVersion, 'services': Parameters.NODE_TYPE, 'timestamp': time(), 'addrReceivServices': nodeType, 'ipAddress': ipAddress, 'port': port}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | def __init__(self, nodeType: int, ipAddress: str=None, port: int=None, protocolVersion=Parameters.PROTOCOL_VERSION):
'\n Constructor method for the version message\n :param nodeType: the type of the node (eg full node, seed etc.)\n :param ipAddress: the ip address of the transmitting node. The default used, if None\n :param port: the port of the transmitting node. The default used, if None\n :param protocolVersion: the version of the protocol. If ommitted, it uses the default from the Params\n '
if (ipAddress is None):
ipAddress = Parameters.NODE_IP_ADDRESS
if (port is None):
port = Parameters.NODE_DEFAULT_PORT_MAINNET
super().__init__(TLCMessage.CTRLMSGTYPE_VERSION)
self.msgData = {'version': protocolVersion, 'services': Parameters.NODE_TYPE, 'timestamp': time(), 'addrReceivServices': nodeType, 'ipAddress': ipAddress, 'port': port}
self.msgHeader.payloadSize = len(self.getMessageAsSendable())<|docstring|>Constructor method for the version message
:param nodeType: the type of the node (eg full node, seed etc.)
:param ipAddress: the ip address of the transmitting node. The default used, if None
:param port: the port of the transmitting node. The default used, if None
:param protocolVersion: the version of the protocol. If ommitted, it uses the default from the Params<|endoftext|> |
9fa3eea554d1e4658efadc119a932e131c89390f711d9523805654478f98661d | def __init__(self):
'\n constructor method\n '
super().__init__(TLCMessage.CTRLMSGTYPE_VERACK)
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | constructor method | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self):
'\n \n '
super().__init__(TLCMessage.CTRLMSGTYPE_VERACK)
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | def __init__(self):
'\n \n '
super().__init__(TLCMessage.CTRLMSGTYPE_VERACK)
self.msgHeader.payloadSize = len(self.getMessageAsSendable())<|docstring|>constructor method<|endoftext|> |
bd102758766dfaf88cff89dd6f3f6c57dcffcb9e5a2557cfbeda205000aa71b1 | def __init__(self):
'\n constructor method\n '
super().__init__(TLCMessage.CTRLMSGTYPE_GETADDR)
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | constructor method | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self):
'\n \n '
super().__init__(TLCMessage.CTRLMSGTYPE_GETADDR)
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | def __init__(self):
'\n \n '
super().__init__(TLCMessage.CTRLMSGTYPE_GETADDR)
self.msgHeader.payloadSize = len(self.getMessageAsSendable())<|docstring|>constructor method<|endoftext|> |
515e5e460d51be1b89554d98e8da8e9e8a164add0fe25accf801d56d8732199d | def __init__(self, addressesList: list):
'\n constructor method\n :param addressesList: the list of addresses sent\n '
super().__init__(TLCMessage.CTRLMSGTYPE_ADDR)
self.msgData = {'ipAddresses': addressesList, 'ipAddressCount': len(addressesList)}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | constructor method
:param addressesList: the list of addresses sent | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self, addressesList: list):
'\n constructor method\n :param addressesList: the list of addresses sent\n '
super().__init__(TLCMessage.CTRLMSGTYPE_ADDR)
self.msgData = {'ipAddresses': addressesList, 'ipAddressCount': len(addressesList)}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | def __init__(self, addressesList: list):
'\n constructor method\n :param addressesList: the list of addresses sent\n '
super().__init__(TLCMessage.CTRLMSGTYPE_ADDR)
self.msgData = {'ipAddresses': addressesList, 'ipAddressCount': len(addressesList)}
self.msgHeader.payloadSize = len(self.getMessageAsSendable())<|docstring|>constructor method
:param addressesList: the list of addresses sent<|endoftext|> |
686570a768ec40fd5ba63b77f3ef294fd6d8b03eab9b49b62162ecd79aa6f841 | def __init__(self, msgRejectedType: str, rejectCode: str, reason: str=None):
"\n Constructor that initializes a reject message\n :param msgRejectedType: the type of the message rejected (eg 'version')\n :param rejectCode: the code of the reject\n :param reason: the reason (description) of the rejection\n "
super().__init__(TLCMessage.CTRLMSGTYPE_REJECT)
self.msgData = {'msgRejectedType': msgRejectedType, 'rejectCode': rejectCode, 'reason': reason}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | Constructor that initializes a reject message
:param msgRejectedType: the type of the message rejected (eg 'version')
:param rejectCode: the code of the reject
:param reason: the reason (description) of the rejection | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self, msgRejectedType: str, rejectCode: str, reason: str=None):
"\n Constructor that initializes a reject message\n :param msgRejectedType: the type of the message rejected (eg 'version')\n :param rejectCode: the code of the reject\n :param reason: the reason (description) of the rejection\n "
super().__init__(TLCMessage.CTRLMSGTYPE_REJECT)
self.msgData = {'msgRejectedType': msgRejectedType, 'rejectCode': rejectCode, 'reason': reason}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | def __init__(self, msgRejectedType: str, rejectCode: str, reason: str=None):
"\n Constructor that initializes a reject message\n :param msgRejectedType: the type of the message rejected (eg 'version')\n :param rejectCode: the code of the reject\n :param reason: the reason (description) of the rejection\n "
super().__init__(TLCMessage.CTRLMSGTYPE_REJECT)
self.msgData = {'msgRejectedType': msgRejectedType, 'rejectCode': rejectCode, 'reason': reason}
self.msgHeader.payloadSize = len(self.getMessageAsSendable())<|docstring|>Constructor that initializes a reject message
:param msgRejectedType: the type of the message rejected (eg 'version')
:param rejectCode: the code of the reject
:param reason: the reason (description) of the rejection<|endoftext|> |
bcd11d4e287ffd853f019ba60c99a5537d57e275ad0431a7b7e17f129bbaa119 | def __init__(self):
'\n constructor method\n '
super().__init__(TLCMessage.CTRLMSGTYPE_PING)
self.msgData = {'nonce': randint(1, 1000)}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | constructor method | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self):
'\n \n '
super().__init__(TLCMessage.CTRLMSGTYPE_PING)
self.msgData = {'nonce': randint(1, 1000)}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | def __init__(self):
'\n \n '
super().__init__(TLCMessage.CTRLMSGTYPE_PING)
self.msgData = {'nonce': randint(1, 1000)}
self.msgHeader.payloadSize = len(self.getMessageAsSendable())<|docstring|>constructor method<|endoftext|> |
45234ec0657bdfb8a33641912fa8f1f0064608593ce6e3cc2d43bcfc2fa37a0a | def __init__(self, nonce: int):
'\n constructor method\n :param nonce: the nonce received from the ping message\n '
super().__init__(TLCMessage.CTRLMSGTYPE_PONG)
self.msgData = {'nonce': nonce}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | constructor method
:param nonce: the nonce received from the ping message | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self, nonce: int):
'\n constructor method\n :param nonce: the nonce received from the ping message\n '
super().__init__(TLCMessage.CTRLMSGTYPE_PONG)
self.msgData = {'nonce': nonce}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | def __init__(self, nonce: int):
'\n constructor method\n :param nonce: the nonce received from the ping message\n '
super().__init__(TLCMessage.CTRLMSGTYPE_PONG)
self.msgData = {'nonce': nonce}
self.msgHeader.payloadSize = len(self.getMessageAsSendable())<|docstring|>constructor method
:param nonce: the nonce received from the ping message<|endoftext|> |
9b1572255489998c5de6b2dba768759f1c43a46fe4f7572e138af6a7e4182aab | def __init__(self, headerHash: str):
"\n constructor method\n :param headerHash: the header hash of the last block existing in the node's blockchain\n "
super().__init__(TLCMessage.DATAMSGTYPE_GETBLOCKS)
self.msgData = {'headerHash': headerHash}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | constructor method
:param headerHash: the header hash of the last block existing in the node's blockchain | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self, headerHash: str):
"\n constructor method\n :param headerHash: the header hash of the last block existing in the node's blockchain\n "
super().__init__(TLCMessage.DATAMSGTYPE_GETBLOCKS)
self.msgData = {'headerHash': headerHash}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | def __init__(self, headerHash: str):
"\n constructor method\n :param headerHash: the header hash of the last block existing in the node's blockchain\n "
super().__init__(TLCMessage.DATAMSGTYPE_GETBLOCKS)
self.msgData = {'headerHash': headerHash}
self.msgHeader.payloadSize = len(self.getMessageAsSendable())<|docstring|>constructor method
:param headerHash: the header hash of the last block existing in the node's blockchain<|endoftext|> |
28e3007b03119c1ade78e796e655cb4ef6738772703d07e6752694254b18d005 | def __init__(self, inventoryEntries: list):
'\n constructor method\n :param inventoryEntries: a list of inventory entries (list)\n '
super().__init__(TLCMessage.DATAMSGTYPE_INV)
self.msgData = {'inventory': inventoryEntries, 'count': len(inventoryEntries)}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | constructor method
:param inventoryEntries: a list of inventory entries (list) | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self, inventoryEntries: list):
'\n constructor method\n :param inventoryEntries: a list of inventory entries (list)\n '
super().__init__(TLCMessage.DATAMSGTYPE_INV)
self.msgData = {'inventory': inventoryEntries, 'count': len(inventoryEntries)}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | def __init__(self, inventoryEntries: list):
'\n constructor method\n :param inventoryEntries: a list of inventory entries (list)\n '
super().__init__(TLCMessage.DATAMSGTYPE_INV)
self.msgData = {'inventory': inventoryEntries, 'count': len(inventoryEntries)}
self.msgHeader.payloadSize = len(self.getMessageAsSendable())<|docstring|>constructor method
:param inventoryEntries: a list of inventory entries (list)<|endoftext|> |
9f862f0641a34a0c714e6bfeaff514b7a2cb64cedb3bc22bafbe62309ec082d0 | def __init__(self, dataEntries: list):
'\n constructor method\n :param dataEntries: a list of inventory entries (list)\n '
super().__init__(TLCMessage.DATAMSGTYPE_GETDATA)
self.msgData = {'inventory': dataEntries, 'count': len(dataEntries)}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | constructor method
:param dataEntries: a list of inventory entries (list) | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self, dataEntries: list):
'\n constructor method\n :param dataEntries: a list of inventory entries (list)\n '
super().__init__(TLCMessage.DATAMSGTYPE_GETDATA)
self.msgData = {'inventory': dataEntries, 'count': len(dataEntries)}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | def __init__(self, dataEntries: list):
'\n constructor method\n :param dataEntries: a list of inventory entries (list)\n '
super().__init__(TLCMessage.DATAMSGTYPE_GETDATA)
self.msgData = {'inventory': dataEntries, 'count': len(dataEntries)}
self.msgHeader.payloadSize = len(self.getMessageAsSendable())<|docstring|>constructor method
:param dataEntries: a list of inventory entries (list)<|endoftext|> |
43285d5c506dbd1a4054138f3892c6c2b79a8476789fbca12b6d19df4bf67e50 | def __init__(self, block: str):
'\n constructor method\n :param block: the block that will be sent\n '
super().__init__(TLCMessage.DATAMSGTYPE_BLOCK)
self.msgData = {'block': block}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | constructor method
:param block: the block that will be sent | src/p2p_network/tlc_message.py | __init__ | kalymgr/Project-T-Cryptocurrencies | 0 | python | def __init__(self, block: str):
'\n constructor method\n :param block: the block that will be sent\n '
super().__init__(TLCMessage.DATAMSGTYPE_BLOCK)
self.msgData = {'block': block}
self.msgHeader.payloadSize = len(self.getMessageAsSendable()) | def __init__(self, block: str):
'\n constructor method\n :param block: the block that will be sent\n '
super().__init__(TLCMessage.DATAMSGTYPE_BLOCK)
self.msgData = {'block': block}
self.msgHeader.payloadSize = len(self.getMessageAsSendable())<|docstring|>constructor method
:param block: the block that will be sent<|endoftext|> |
e8ac80744d57c406012060eea5b8953b63b93238738be77ed281a4d6454a65cd | @property
def design_libray(self):
'Design Library.'
return 'Simplorer Elements' | Design Library. | pyaedt/modeler/PrimitivesTwinBuilder.py | design_libray | myoung301/pyaedt | 38 | python | @property
def design_libray(self):
return 'Simplorer Elements' | @property
def design_libray(self):
return 'Simplorer Elements'<|docstring|>Design Library.<|endoftext|> |
ce8d82410e85b84b6874ed99207099addb1940160b76212af2615a9715db591d | @property
def tab_name(self):
'Tab name.'
return 'Quantities' | Tab name. | pyaedt/modeler/PrimitivesTwinBuilder.py | tab_name | myoung301/pyaedt | 38 | python | @property
def tab_name(self):
return 'Quantities' | @property
def tab_name(self):
return 'Quantities'<|docstring|>Tab name.<|endoftext|> |
1de7cdb5becd9b783d706645f9232c6a844b22912c86161f4cbe16803453e3ca | @pyaedt_function_handler()
def __getitem__(self, partname):
'Get object id from a string or integer.\n\n Parameters\n ----------\n partname : int or str\n ID or name of the object.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n '
if isinstance(partname, int):
return self.components[partname]
for el in self.components:
if ((self.components[el].name == partname) or (self.components[el].composed_name == partname) or (el == partname)):
return self.components[el]
return None | Get object id from a string or integer.
Parameters
----------
partname : int or str
ID or name of the object.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object. | pyaedt/modeler/PrimitivesTwinBuilder.py | __getitem__ | myoung301/pyaedt | 38 | python | @pyaedt_function_handler()
def __getitem__(self, partname):
'Get object id from a string or integer.\n\n Parameters\n ----------\n partname : int or str\n ID or name of the object.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n '
if isinstance(partname, int):
return self.components[partname]
for el in self.components:
if ((self.components[el].name == partname) or (self.components[el].composed_name == partname) or (el == partname)):
return self.components[el]
return None | @pyaedt_function_handler()
def __getitem__(self, partname):
'Get object id from a string or integer.\n\n Parameters\n ----------\n partname : int or str\n ID or name of the object.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n '
if isinstance(partname, int):
return self.components[partname]
for el in self.components:
if ((self.components[el].name == partname) or (self.components[el].composed_name == partname) or (el == partname)):
return self.components[el]
return None<|docstring|>Get object id from a string or integer.
Parameters
----------
partname : int or str
ID or name of the object.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.<|endoftext|> |
cbeb1cdbf935f27629e2b595ab1a624b2596e8cad7d66ecce08270bf3a4de101 | @property
def components_catalog(self):
'Return the syslib component catalog with all info.\n\n Returns\n -------\n :class:`pyaedt.modeler.PrimitivesCircuit.ComponentCatalog`\n '
if (not self._components_catalog):
self._components_catalog = ComponentCatalog(self)
return self._components_catalog | Return the syslib component catalog with all info.
Returns
-------
:class:`pyaedt.modeler.PrimitivesCircuit.ComponentCatalog` | pyaedt/modeler/PrimitivesTwinBuilder.py | components_catalog | myoung301/pyaedt | 38 | python | @property
def components_catalog(self):
'Return the syslib component catalog with all info.\n\n Returns\n -------\n :class:`pyaedt.modeler.PrimitivesCircuit.ComponentCatalog`\n '
if (not self._components_catalog):
self._components_catalog = ComponentCatalog(self)
return self._components_catalog | @property
def components_catalog(self):
'Return the syslib component catalog with all info.\n\n Returns\n -------\n :class:`pyaedt.modeler.PrimitivesCircuit.ComponentCatalog`\n '
if (not self._components_catalog):
self._components_catalog = ComponentCatalog(self)
return self._components_catalog<|docstring|>Return the syslib component catalog with all info.
Returns
-------
:class:`pyaedt.modeler.PrimitivesCircuit.ComponentCatalog`<|endoftext|> |
f23f62b11e5f20d478f5ec975968deeae5e88be8577d97d8824161665046fc75 | @pyaedt_function_handler()
def create_resistor(self, compname=None, value=50, location=[], angle=0, use_instance_id_netlist=False):
'Create a resistor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the resistor. The default is ``None``.\n value : float, optional\n Value for the resistor. The default is ``50``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Passive Elements', component_name='R', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
id.set_property('R', value)
return id | Create a resistor.
Parameters
----------
compname : str, optional
Name of the resistor. The default is ``None``.
value : float, optional
Value for the resistor. The default is ``50``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent | pyaedt/modeler/PrimitivesTwinBuilder.py | create_resistor | myoung301/pyaedt | 38 | python | @pyaedt_function_handler()
def create_resistor(self, compname=None, value=50, location=[], angle=0, use_instance_id_netlist=False):
'Create a resistor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the resistor. The default is ``None``.\n value : float, optional\n Value for the resistor. The default is ``50``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Passive Elements', component_name='R', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
id.set_property('R', value)
return id | @pyaedt_function_handler()
def create_resistor(self, compname=None, value=50, location=[], angle=0, use_instance_id_netlist=False):
'Create a resistor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the resistor. The default is ``None``.\n value : float, optional\n Value for the resistor. The default is ``50``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Passive Elements', component_name='R', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
id.set_property('R', value)
return id<|docstring|>Create a resistor.
Parameters
----------
compname : str, optional
Name of the resistor. The default is ``None``.
value : float, optional
Value for the resistor. The default is ``50``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent<|endoftext|> |
1ffe59179963dfb9495fdf0dc4da05db1ce9c6dfa68ebf283c2f60fb1cda36c6 | @pyaedt_function_handler()
def create_inductor(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False):
'Create an inductor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the inductor. The default is ``None``.\n value : float, optional\n Value for the inductor. The default is ``50``.\n location : list of float, optional\n Position on the X axis and Y axis. The default is ``None``.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
if (location == None):
location = []
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Passive Elements', component_name='L', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
id.set_property('L', value)
return id | Create an inductor.
Parameters
----------
compname : str, optional
Name of the inductor. The default is ``None``.
value : float, optional
Value for the inductor. The default is ``50``.
location : list of float, optional
Position on the X axis and Y axis. The default is ``None``.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent | pyaedt/modeler/PrimitivesTwinBuilder.py | create_inductor | myoung301/pyaedt | 38 | python | @pyaedt_function_handler()
def create_inductor(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False):
'Create an inductor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the inductor. The default is ``None``.\n value : float, optional\n Value for the inductor. The default is ``50``.\n location : list of float, optional\n Position on the X axis and Y axis. The default is ``None``.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
if (location == None):
location = []
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Passive Elements', component_name='L', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
id.set_property('L', value)
return id | @pyaedt_function_handler()
def create_inductor(self, compname=None, value=50, location=None, angle=0, use_instance_id_netlist=False):
'Create an inductor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the inductor. The default is ``None``.\n value : float, optional\n Value for the inductor. The default is ``50``.\n location : list of float, optional\n Position on the X axis and Y axis. The default is ``None``.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
if (location == None):
location = []
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Passive Elements', component_name='L', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
id.set_property('L', value)
return id<|docstring|>Create an inductor.
Parameters
----------
compname : str, optional
Name of the inductor. The default is ``None``.
value : float, optional
Value for the inductor. The default is ``50``.
location : list of float, optional
Position on the X axis and Y axis. The default is ``None``.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent<|endoftext|> |
60c28234df7d782a55f8a4b2473b1fa026f085a2788ab9389e3fa0e925eb3792 | @pyaedt_function_handler()
def create_capacitor(self, compname=None, value=50, location=[], angle=0, use_instance_id_netlist=False):
'Create a capacitor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the capacitor. The default is ``None``.\n value : float, optional\n Value for the capacitor. The default is ``50``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Passive Elements', component_name='C', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
id.set_property('C', value)
id.set_property('UseInitialConditions', True)
return id | Create a capacitor.
Parameters
----------
compname : str, optional
Name of the capacitor. The default is ``None``.
value : float, optional
Value for the capacitor. The default is ``50``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent | pyaedt/modeler/PrimitivesTwinBuilder.py | create_capacitor | myoung301/pyaedt | 38 | python | @pyaedt_function_handler()
def create_capacitor(self, compname=None, value=50, location=[], angle=0, use_instance_id_netlist=False):
'Create a capacitor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the capacitor. The default is ``None``.\n value : float, optional\n Value for the capacitor. The default is ``50``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Passive Elements', component_name='C', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
id.set_property('C', value)
id.set_property('UseInitialConditions', True)
return id | @pyaedt_function_handler()
def create_capacitor(self, compname=None, value=50, location=[], angle=0, use_instance_id_netlist=False):
'Create a capacitor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the capacitor. The default is ``None``.\n value : float, optional\n Value for the capacitor. The default is ``50``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Passive Elements', component_name='C', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
id.set_property('C', value)
id.set_property('UseInitialConditions', True)
return id<|docstring|>Create a capacitor.
Parameters
----------
compname : str, optional
Name of the capacitor. The default is ``None``.
value : float, optional
Value for the capacitor. The default is ``50``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent<|endoftext|> |
12d9963ddf7206817d4aa7b52e7b27c092ef286cdab5283ba56a78be63d45acd | @pyaedt_function_handler()
def create_voltage_source(self, compname=None, type='E', amplitude=326, freq=50, location=[], angle=0, use_instance_id_netlist=False):
'Create a voltage source (conservative electrical output).\n\n Parameters\n ----------\n compname : str, optional\n Name of the voltage source. The default is ``None``.\n type : str, optional\n Type of the source. The default is ``E``.\n amplitude : float, optional\n Amplitude of the waveform if periodic. The default is ``326V``\n freq : float, optional\n Frequency of the periodic waveform. The default is ``50Hz``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle of rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list or not. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Sources', component_name='E', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
id.set_property('Type', type)
if (type == 'E'):
id.set_property('EMF', amplitude)
if ((type == 'ESINE') or (type == 'EPULSE') or (type == 'ETRIANG')):
id.set_property('AMPL', amplitude)
id.set_property('FREQ', freq)
id.set_property('TPERIO', 'Tend+1')
id.set_property('PERIO', 1)
return id | Create a voltage source (conservative electrical output).
Parameters
----------
compname : str, optional
Name of the voltage source. The default is ``None``.
type : str, optional
Type of the source. The default is ``E``.
amplitude : float, optional
Amplitude of the waveform if periodic. The default is ``326V``
freq : float, optional
Frequency of the periodic waveform. The default is ``50Hz``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle of rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list or not. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent | pyaedt/modeler/PrimitivesTwinBuilder.py | create_voltage_source | myoung301/pyaedt | 38 | python | @pyaedt_function_handler()
def create_voltage_source(self, compname=None, type='E', amplitude=326, freq=50, location=[], angle=0, use_instance_id_netlist=False):
'Create a voltage source (conservative electrical output).\n\n Parameters\n ----------\n compname : str, optional\n Name of the voltage source. The default is ``None``.\n type : str, optional\n Type of the source. The default is ``E``.\n amplitude : float, optional\n Amplitude of the waveform if periodic. The default is ``326V``\n freq : float, optional\n Frequency of the periodic waveform. The default is ``50Hz``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle of rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list or not. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Sources', component_name='E', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
id.set_property('Type', type)
if (type == 'E'):
id.set_property('EMF', amplitude)
if ((type == 'ESINE') or (type == 'EPULSE') or (type == 'ETRIANG')):
id.set_property('AMPL', amplitude)
id.set_property('FREQ', freq)
id.set_property('TPERIO', 'Tend+1')
id.set_property('PERIO', 1)
return id | @pyaedt_function_handler()
def create_voltage_source(self, compname=None, type='E', amplitude=326, freq=50, location=[], angle=0, use_instance_id_netlist=False):
'Create a voltage source (conservative electrical output).\n\n Parameters\n ----------\n compname : str, optional\n Name of the voltage source. The default is ``None``.\n type : str, optional\n Type of the source. The default is ``E``.\n amplitude : float, optional\n Amplitude of the waveform if periodic. The default is ``326V``\n freq : float, optional\n Frequency of the periodic waveform. The default is ``50Hz``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle of rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list or not. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Sources', component_name='E', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
id.set_property('Type', type)
if (type == 'E'):
id.set_property('EMF', amplitude)
if ((type == 'ESINE') or (type == 'EPULSE') or (type == 'ETRIANG')):
id.set_property('AMPL', amplitude)
id.set_property('FREQ', freq)
id.set_property('TPERIO', 'Tend+1')
id.set_property('PERIO', 1)
return id<|docstring|>Create a voltage source (conservative electrical output).
Parameters
----------
compname : str, optional
Name of the voltage source. The default is ``None``.
type : str, optional
Type of the source. The default is ``E``.
amplitude : float, optional
Amplitude of the waveform if periodic. The default is ``326V``
freq : float, optional
Frequency of the periodic waveform. The default is ``50Hz``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle of rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list or not. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent<|endoftext|> |
041644602dbe3e00abc8a93ac6a67febad9fae7578db4abe747730f7761d34b2 | @pyaedt_function_handler()
def create_diode(self, compname=None, location=[], angle=0, use_instance_id_netlist=False):
'Create a diode.\n\n Parameters\n ----------\n compname : str, optional\n Name of the diode. The default is ``None``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Semiconductors System Level', component_name='D', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
return id | Create a diode.
Parameters
----------
compname : str, optional
Name of the diode. The default is ``None``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent | pyaedt/modeler/PrimitivesTwinBuilder.py | create_diode | myoung301/pyaedt | 38 | python | @pyaedt_function_handler()
def create_diode(self, compname=None, location=[], angle=0, use_instance_id_netlist=False):
'Create a diode.\n\n Parameters\n ----------\n compname : str, optional\n Name of the diode. The default is ``None``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Semiconductors System Level', component_name='D', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
return id | @pyaedt_function_handler()
def create_diode(self, compname=None, location=[], angle=0, use_instance_id_netlist=False):
'Create a diode.\n\n Parameters\n ----------\n compname : str, optional\n Name of the diode. The default is ``None``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Semiconductors System Level', component_name='D', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
return id<|docstring|>Create a diode.
Parameters
----------
compname : str, optional
Name of the diode. The default is ``None``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent<|endoftext|> |
0785210c37237c06adf45cde83fda80d3fb15358903563a9d8f722a442854987 | @pyaedt_function_handler()
def create_npn(self, compname=None, location=[], angle=0, use_instance_id_netlist=False):
'Create an NPN transistor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the NPN transistor. The default is ``None``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Semiconductors System Level', component_name='BJT', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
return id | Create an NPN transistor.
Parameters
----------
compname : str, optional
Name of the NPN transistor. The default is ``None``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent | pyaedt/modeler/PrimitivesTwinBuilder.py | create_npn | myoung301/pyaedt | 38 | python | @pyaedt_function_handler()
def create_npn(self, compname=None, location=[], angle=0, use_instance_id_netlist=False):
'Create an NPN transistor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the NPN transistor. The default is ``None``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Semiconductors System Level', component_name='BJT', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
return id | @pyaedt_function_handler()
def create_npn(self, compname=None, location=[], angle=0, use_instance_id_netlist=False):
'Create an NPN transistor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the NPN transistor. The default is ``None``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Semiconductors System Level', component_name='BJT', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
return id<|docstring|>Create an NPN transistor.
Parameters
----------
compname : str, optional
Name of the NPN transistor. The default is ``None``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent<|endoftext|> |
519e370dc2df93f89615d64554dc4fde8ccba80b09470e4eed9cb1d4414239b1 | @pyaedt_function_handler()
def create_pnp(self, compname=None, location=[], angle=0, use_instance_id_netlist=False):
'Create a PNP transistor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the PNP transistor. The default is ``None``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Semiconductors System Level', component_name='BJT', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
return id | Create a PNP transistor.
Parameters
----------
compname : str, optional
Name of the PNP transistor. The default is ``None``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent | pyaedt/modeler/PrimitivesTwinBuilder.py | create_pnp | myoung301/pyaedt | 38 | python | @pyaedt_function_handler()
def create_pnp(self, compname=None, location=[], angle=0, use_instance_id_netlist=False):
'Create a PNP transistor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the PNP transistor. The default is ``None``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Semiconductors System Level', component_name='BJT', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
return id | @pyaedt_function_handler()
def create_pnp(self, compname=None, location=[], angle=0, use_instance_id_netlist=False):
'Create a PNP transistor.\n\n Parameters\n ----------\n compname : str, optional\n Name of the PNP transistor. The default is ``None``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Circuit\\Semiconductors System Level', component_name='BJT', location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
return id<|docstring|>Create a PNP transistor.
Parameters
----------
compname : str, optional
Name of the PNP transistor. The default is ``None``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent<|endoftext|> |
8f291155d526c9dcc8bf3b1c3fbaad7ff96bbb1aa48220eeb6538749575604a1 | @pyaedt_function_handler()
def create_periodic_waveform_source(self, compname=None, type='SINE', amplitude=100, freq=50, phase=0, offset=0, delay=0, location=[], angle=0, use_instance_id_netlist=False):
'\n Create a periodic waveform source (non conservative real output).\n\n Parameters\n ----------\n compname : str, optional\n Name of the voltage source. The default is ``None``.\n type : str, optional\n Type of the source [SINE, PULSE, TRAING, SAWTOOTH]. The default is ``SINE``.\n amplitude : float, optional\n Amplitude of the waveform if periodic. The default is ``100V``\n freq : float, optional\n Frequency of the periodic waveform. The default is ``50Hz``.\n phase : float, optional\n Phase of the periodic waveform. The default is ``0deg``.\n offset : float, optional\n Offset added to the amplitude of the periodic waveform. The default is ``0``.\n delay : float, optional\n Delay before starting of the periodic waveform. The default is ``0``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle of rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list or not. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Tools\\Time Functions', component_name=type, location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
if (type in ['SINE', 'PULSE', 'TRIANG', 'SAWTOOTH']):
id.set_property('AMPL', amplitude)
id.set_property('FREQ', freq)
id.set_property('PHASE', phase)
id.set_property('OFF', offset)
id.set_property('TDELAY', delay)
id.set_property('TPERIO', 'Tend+1')
id.set_property('PERIO', 1)
return id | Create a periodic waveform source (non conservative real output).
Parameters
----------
compname : str, optional
Name of the voltage source. The default is ``None``.
type : str, optional
Type of the source [SINE, PULSE, TRAING, SAWTOOTH]. The default is ``SINE``.
amplitude : float, optional
Amplitude of the waveform if periodic. The default is ``100V``
freq : float, optional
Frequency of the periodic waveform. The default is ``50Hz``.
phase : float, optional
Phase of the periodic waveform. The default is ``0deg``.
offset : float, optional
Offset added to the amplitude of the periodic waveform. The default is ``0``.
delay : float, optional
Delay before starting of the periodic waveform. The default is ``0``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle of rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list or not. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent | pyaedt/modeler/PrimitivesTwinBuilder.py | create_periodic_waveform_source | myoung301/pyaedt | 38 | python | @pyaedt_function_handler()
def create_periodic_waveform_source(self, compname=None, type='SINE', amplitude=100, freq=50, phase=0, offset=0, delay=0, location=[], angle=0, use_instance_id_netlist=False):
'\n Create a periodic waveform source (non conservative real output).\n\n Parameters\n ----------\n compname : str, optional\n Name of the voltage source. The default is ``None``.\n type : str, optional\n Type of the source [SINE, PULSE, TRAING, SAWTOOTH]. The default is ``SINE``.\n amplitude : float, optional\n Amplitude of the waveform if periodic. The default is ``100V``\n freq : float, optional\n Frequency of the periodic waveform. The default is ``50Hz``.\n phase : float, optional\n Phase of the periodic waveform. The default is ``0deg``.\n offset : float, optional\n Offset added to the amplitude of the periodic waveform. The default is ``0``.\n delay : float, optional\n Delay before starting of the periodic waveform. The default is ``0``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle of rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list or not. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Tools\\Time Functions', component_name=type, location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
if (type in ['SINE', 'PULSE', 'TRIANG', 'SAWTOOTH']):
id.set_property('AMPL', amplitude)
id.set_property('FREQ', freq)
id.set_property('PHASE', phase)
id.set_property('OFF', offset)
id.set_property('TDELAY', delay)
id.set_property('TPERIO', 'Tend+1')
id.set_property('PERIO', 1)
return id | @pyaedt_function_handler()
def create_periodic_waveform_source(self, compname=None, type='SINE', amplitude=100, freq=50, phase=0, offset=0, delay=0, location=[], angle=0, use_instance_id_netlist=False):
'\n Create a periodic waveform source (non conservative real output).\n\n Parameters\n ----------\n compname : str, optional\n Name of the voltage source. The default is ``None``.\n type : str, optional\n Type of the source [SINE, PULSE, TRAING, SAWTOOTH]. The default is ``SINE``.\n amplitude : float, optional\n Amplitude of the waveform if periodic. The default is ``100V``\n freq : float, optional\n Frequency of the periodic waveform. The default is ``50Hz``.\n phase : float, optional\n Phase of the periodic waveform. The default is ``0deg``.\n offset : float, optional\n Offset added to the amplitude of the periodic waveform. The default is ``0``.\n delay : float, optional\n Delay before starting of the periodic waveform. The default is ``0``.\n location : list of float, optional\n Position on the X axis and Y axis.\n angle : float, optional\n Angle of rotation in degrees. The default is ``0``.\n use_instance_id_netlist : bool, optional\n Whether to use the instance ID in the net list or not. The default is ``False``.\n\n Returns\n -------\n :class:`pyaedt.modeler.Object3d.CircuitComponent`\n Circuit Component Object.\n\n References\n ----------\n\n >>> oEditor.CreateComponent\n '
id = self.create_component(compname, component_library='Basic Elements\\Tools\\Time Functions', component_name=type, location=location, angle=angle, use_instance_id_netlist=use_instance_id_netlist)
if (type in ['SINE', 'PULSE', 'TRIANG', 'SAWTOOTH']):
id.set_property('AMPL', amplitude)
id.set_property('FREQ', freq)
id.set_property('PHASE', phase)
id.set_property('OFF', offset)
id.set_property('TDELAY', delay)
id.set_property('TPERIO', 'Tend+1')
id.set_property('PERIO', 1)
return id<|docstring|>Create a periodic waveform source (non conservative real output).
Parameters
----------
compname : str, optional
Name of the voltage source. The default is ``None``.
type : str, optional
Type of the source [SINE, PULSE, TRAING, SAWTOOTH]. The default is ``SINE``.
amplitude : float, optional
Amplitude of the waveform if periodic. The default is ``100V``
freq : float, optional
Frequency of the periodic waveform. The default is ``50Hz``.
phase : float, optional
Phase of the periodic waveform. The default is ``0deg``.
offset : float, optional
Offset added to the amplitude of the periodic waveform. The default is ``0``.
delay : float, optional
Delay before starting of the periodic waveform. The default is ``0``.
location : list of float, optional
Position on the X axis and Y axis.
angle : float, optional
Angle of rotation in degrees. The default is ``0``.
use_instance_id_netlist : bool, optional
Whether to use the instance ID in the net list or not. The default is ``False``.
Returns
-------
:class:`pyaedt.modeler.Object3d.CircuitComponent`
Circuit Component Object.
References
----------
>>> oEditor.CreateComponent<|endoftext|> |
4579ba0293aaddc51324f5f2cb2dd169c2f166be61f7218495be24ef166d3c28 | def build_data(num_obs, num_alts):
'\n Build a simulated list of scenarios, alternatives, and probabilities\n \n '
obs = np.repeat(np.arange(num_obs), num_alts)
alts = np.random.randint(0, (num_alts * 10), size=(num_obs * num_alts))
weights = np.random.rand(num_alts, num_obs)
probs = (weights / weights.sum(axis=0))
probslist = probs.flatten(order='F')
data = pd.DataFrame({'oid': obs, 'aid': alts, 'probs': probslist})
data = data.set_index(['oid', 'aid']).probs
return data | Build a simulated list of scenarios, alternatives, and probabilities | tests/test_simulation.py | build_data | UDST/choicemodels | 54 | python | def build_data(num_obs, num_alts):
'\n \n \n '
obs = np.repeat(np.arange(num_obs), num_alts)
alts = np.random.randint(0, (num_alts * 10), size=(num_obs * num_alts))
weights = np.random.rand(num_alts, num_obs)
probs = (weights / weights.sum(axis=0))
probslist = probs.flatten(order='F')
data = pd.DataFrame({'oid': obs, 'aid': alts, 'probs': probslist})
data = data.set_index(['oid', 'aid']).probs
return data | def build_data(num_obs, num_alts):
'\n \n \n '
obs = np.repeat(np.arange(num_obs), num_alts)
alts = np.random.randint(0, (num_alts * 10), size=(num_obs * num_alts))
weights = np.random.rand(num_alts, num_obs)
probs = (weights / weights.sum(axis=0))
probslist = probs.flatten(order='F')
data = pd.DataFrame({'oid': obs, 'aid': alts, 'probs': probslist})
data = data.set_index(['oid', 'aid']).probs
return data<|docstring|>Build a simulated list of scenarios, alternatives, and probabilities<|endoftext|> |
79020b1d9ffee37558b8a8115189260c46a237c80624b198ecec06bf703c11cb | def test_monte_carlo_choices():
'\n Test simulation of choices without capacity constraints. This test just verifies that\n the code runs, using a fairly large synthetic dataset.\n \n '
data = build_data(1000, 100)
monte_carlo_choices(data) | Test simulation of choices without capacity constraints. This test just verifies that
the code runs, using a fairly large synthetic dataset. | tests/test_simulation.py | test_monte_carlo_choices | UDST/choicemodels | 54 | python | def test_monte_carlo_choices():
'\n Test simulation of choices without capacity constraints. This test just verifies that\n the code runs, using a fairly large synthetic dataset.\n \n '
data = build_data(1000, 100)
monte_carlo_choices(data) | def test_monte_carlo_choices():
'\n Test simulation of choices without capacity constraints. This test just verifies that\n the code runs, using a fairly large synthetic dataset.\n \n '
data = build_data(1000, 100)
monte_carlo_choices(data)<|docstring|>Test simulation of choices without capacity constraints. This test just verifies that
the code runs, using a fairly large synthetic dataset.<|endoftext|> |
691af66c6e823b15efb66de6694e2aa7ecf22639b247e7625acea322eaa60525 | def test_simulation_accuracy():
'\n This test checks that the simulation tool is generating choices that match the \n provided probabilities. \n \n '
data = build_data(5, 3)
r = np.random.randint(0, 15, 1)
row = pd.DataFrame(data).reset_index().iloc[r]
oid = int(row.oid)
aid = int(row.aid)
prob = float(pd.DataFrame(data).query(((('oid==' + str(oid)) + ' & aid==') + str(aid))).sum())
n = 1000
count = 0
for i in range(n):
choices = monte_carlo_choices(data)
if (choices.loc[oid] == aid):
count += 1
assert ((count / n) > (prob - 0.1))
assert ((count / n) < (prob + 0.1)) | This test checks that the simulation tool is generating choices that match the
provided probabilities. | tests/test_simulation.py | test_simulation_accuracy | UDST/choicemodels | 54 | python | def test_simulation_accuracy():
'\n This test checks that the simulation tool is generating choices that match the \n provided probabilities. \n \n '
data = build_data(5, 3)
r = np.random.randint(0, 15, 1)
row = pd.DataFrame(data).reset_index().iloc[r]
oid = int(row.oid)
aid = int(row.aid)
prob = float(pd.DataFrame(data).query(((('oid==' + str(oid)) + ' & aid==') + str(aid))).sum())
n = 1000
count = 0
for i in range(n):
choices = monte_carlo_choices(data)
if (choices.loc[oid] == aid):
count += 1
assert ((count / n) > (prob - 0.1))
assert ((count / n) < (prob + 0.1)) | def test_simulation_accuracy():
'\n This test checks that the simulation tool is generating choices that match the \n provided probabilities. \n \n '
data = build_data(5, 3)
r = np.random.randint(0, 15, 1)
row = pd.DataFrame(data).reset_index().iloc[r]
oid = int(row.oid)
aid = int(row.aid)
prob = float(pd.DataFrame(data).query(((('oid==' + str(oid)) + ' & aid==') + str(aid))).sum())
n = 1000
count = 0
for i in range(n):
choices = monte_carlo_choices(data)
if (choices.loc[oid] == aid):
count += 1
assert ((count / n) > (prob - 0.1))
assert ((count / n) < (prob + 0.1))<|docstring|>This test checks that the simulation tool is generating choices that match the
provided probabilities.<|endoftext|> |
0bc293fd74b27665c693e57c047f5dd0e2ec463dab3536652cc1d5f9e5ee329e | def test_iterative_lottery_choices(obs, alts, mct, probs):
'\n Test that iterative lottery choices can run.\n \n '
choices = iterative_lottery_choices(obs, alts, mct, probs) | Test that iterative lottery choices can run. | tests/test_simulation.py | test_iterative_lottery_choices | UDST/choicemodels | 54 | python | def test_iterative_lottery_choices(obs, alts, mct, probs):
'\n \n \n '
choices = iterative_lottery_choices(obs, alts, mct, probs) | def test_iterative_lottery_choices(obs, alts, mct, probs):
'\n \n \n '
choices = iterative_lottery_choices(obs, alts, mct, probs)<|docstring|>Test that iterative lottery choices can run.<|endoftext|> |
6fcfaa3224b961aaf52b9b7f3654dc5f530ce4bac7e4d5e2435e799ead1f17b9 | def test_input_safety(obs, alts, mct, probs):
'\n Confirm that original copies of the input dataframes are not modified.\n \n '
orig_obs = obs.copy()
orig_alts = alts.copy()
choices = iterative_lottery_choices(obs, alts, mct, probs)
pd.testing.assert_frame_equal(orig_obs, obs)
pd.testing.assert_frame_equal(orig_alts, alts) | Confirm that original copies of the input dataframes are not modified. | tests/test_simulation.py | test_input_safety | UDST/choicemodels | 54 | python | def test_input_safety(obs, alts, mct, probs):
'\n \n \n '
orig_obs = obs.copy()
orig_alts = alts.copy()
choices = iterative_lottery_choices(obs, alts, mct, probs)
pd.testing.assert_frame_equal(orig_obs, obs)
pd.testing.assert_frame_equal(orig_alts, alts) | def test_input_safety(obs, alts, mct, probs):
'\n \n \n '
orig_obs = obs.copy()
orig_alts = alts.copy()
choices = iterative_lottery_choices(obs, alts, mct, probs)
pd.testing.assert_frame_equal(orig_obs, obs)
pd.testing.assert_frame_equal(orig_alts, alts)<|docstring|>Confirm that original copies of the input dataframes are not modified.<|endoftext|> |
e83a30f9f8f28798b1cfed018c669803f28d35bd26402b12eb094916485efe9f | def test_index_name_retention(obs, alts, mct, probs):
'\n Confirm retention of index names.\n \n '
choices = iterative_lottery_choices(obs, alts, mct, probs)
assert (choices.index.name == obs.index.name)
assert (choices.name == alts.index.name) | Confirm retention of index names. | tests/test_simulation.py | test_index_name_retention | UDST/choicemodels | 54 | python | def test_index_name_retention(obs, alts, mct, probs):
'\n \n \n '
choices = iterative_lottery_choices(obs, alts, mct, probs)
assert (choices.index.name == obs.index.name)
assert (choices.name == alts.index.name) | def test_index_name_retention(obs, alts, mct, probs):
'\n \n \n '
choices = iterative_lottery_choices(obs, alts, mct, probs)
assert (choices.index.name == obs.index.name)
assert (choices.name == alts.index.name)<|docstring|>Confirm retention of index names.<|endoftext|> |
3873baaf524147f50ef504840c637f674f090c2216b6e70427cf901916925789 | def test_unique_choices(obs, alts, mct, probs):
"\n Confirm unique choices when there's an implicit capacity of 1.\n \n "
choices = iterative_lottery_choices(obs, alts, mct, probs)
assert (len(choices) == len(choices.unique())) | Confirm unique choices when there's an implicit capacity of 1. | tests/test_simulation.py | test_unique_choices | UDST/choicemodels | 54 | python | def test_unique_choices(obs, alts, mct, probs):
"\n \n \n "
choices = iterative_lottery_choices(obs, alts, mct, probs)
assert (len(choices) == len(choices.unique())) | def test_unique_choices(obs, alts, mct, probs):
"\n \n \n "
choices = iterative_lottery_choices(obs, alts, mct, probs)
assert (len(choices) == len(choices.unique()))<|docstring|>Confirm unique choices when there's an implicit capacity of 1.<|endoftext|> |
a3d572c944c64302f7b3f97313a0544ab6d2c4d5b3a528a9f431520a0bf6062e | def test_count_capacity(obs, alts, mct, probs):
'\n Confirm count-based capacity constraints are respected.\n \n '
alts['capacity'] = np.random.choice([1, 2, 3], size=len(alts))
choices = iterative_lottery_choices(obs, alts, mct, probs, alt_capacity='capacity')
placed = pd.DataFrame(choices).groupby('aid').size().rename('placed')
df = pd.DataFrame(alts.capacity).join(placed, on='aid').fillna(0)
assert all(df.placed.le(df.capacity)) | Confirm count-based capacity constraints are respected. | tests/test_simulation.py | test_count_capacity | UDST/choicemodels | 54 | python | def test_count_capacity(obs, alts, mct, probs):
'\n \n \n '
alts['capacity'] = np.random.choice([1, 2, 3], size=len(alts))
choices = iterative_lottery_choices(obs, alts, mct, probs, alt_capacity='capacity')
placed = pd.DataFrame(choices).groupby('aid').size().rename('placed')
df = pd.DataFrame(alts.capacity).join(placed, on='aid').fillna(0)
assert all(df.placed.le(df.capacity)) | def test_count_capacity(obs, alts, mct, probs):
'\n \n \n '
alts['capacity'] = np.random.choice([1, 2, 3], size=len(alts))
choices = iterative_lottery_choices(obs, alts, mct, probs, alt_capacity='capacity')
placed = pd.DataFrame(choices).groupby('aid').size().rename('placed')
df = pd.DataFrame(alts.capacity).join(placed, on='aid').fillna(0)
assert all(df.placed.le(df.capacity))<|docstring|>Confirm count-based capacity constraints are respected.<|endoftext|> |
a927ff35b9ffb09a9879121a59791037e7a6dc5ea58310355dd7fd2afa26fdf5 | def test_size_capacity(obs, alts, mct, probs):
'\n Confirm size-based capacity constraints are respected.\n \n '
alts['capacity'] = np.random.choice([1, 2, 3], size=len(alts))
obs['size'] = np.random.choice([1, 2], size=len(obs))
choices = iterative_lottery_choices(obs, alts, mct, probs, alt_capacity='capacity', chooser_size='size')
choice_df = pd.DataFrame(choices).join(obs['size'], on='oid')
placed = choice_df.groupby('aid')['size'].sum().rename('placed')
df = pd.DataFrame(alts.capacity).join(placed, on='aid').fillna(0)
assert all(df.placed.le(df.capacity)) | Confirm size-based capacity constraints are respected. | tests/test_simulation.py | test_size_capacity | UDST/choicemodels | 54 | python | def test_size_capacity(obs, alts, mct, probs):
'\n \n \n '
alts['capacity'] = np.random.choice([1, 2, 3], size=len(alts))
obs['size'] = np.random.choice([1, 2], size=len(obs))
choices = iterative_lottery_choices(obs, alts, mct, probs, alt_capacity='capacity', chooser_size='size')
choice_df = pd.DataFrame(choices).join(obs['size'], on='oid')
placed = choice_df.groupby('aid')['size'].sum().rename('placed')
df = pd.DataFrame(alts.capacity).join(placed, on='aid').fillna(0)
assert all(df.placed.le(df.capacity)) | def test_size_capacity(obs, alts, mct, probs):
'\n \n \n '
alts['capacity'] = np.random.choice([1, 2, 3], size=len(alts))
obs['size'] = np.random.choice([1, 2], size=len(obs))
choices = iterative_lottery_choices(obs, alts, mct, probs, alt_capacity='capacity', chooser_size='size')
choice_df = pd.DataFrame(choices).join(obs['size'], on='oid')
placed = choice_df.groupby('aid')['size'].sum().rename('placed')
df = pd.DataFrame(alts.capacity).join(placed, on='aid').fillna(0)
assert all(df.placed.le(df.capacity))<|docstring|>Confirm size-based capacity constraints are respected.<|endoftext|> |
7f1c0c40db74cd872537a5190cf6b7ff94d270badcb2076598ee3e53941e83a7 | def test_insufficient_capacity(obs, alts, mct, probs):
'\n Confirm that choices are simulated even if there is insufficient overall capacity.\n \n '
alts = alts.iloc[:30].copy()
choices = iterative_lottery_choices(obs, alts, mct, probs)
assert (len(choices) > 0) | Confirm that choices are simulated even if there is insufficient overall capacity. | tests/test_simulation.py | test_insufficient_capacity | UDST/choicemodels | 54 | python | def test_insufficient_capacity(obs, alts, mct, probs):
'\n \n \n '
alts = alts.iloc[:30].copy()
choices = iterative_lottery_choices(obs, alts, mct, probs)
assert (len(choices) > 0) | def test_insufficient_capacity(obs, alts, mct, probs):
'\n \n \n '
alts = alts.iloc[:30].copy()
choices = iterative_lottery_choices(obs, alts, mct, probs)
assert (len(choices) > 0)<|docstring|>Confirm that choices are simulated even if there is insufficient overall capacity.<|endoftext|> |
a13f0961a35bc5cb5117d3614a379a9261955a0f7ed6b1c2615a4968fc6d6696 | def test_chooser_priority(obs, alts, mct, probs):
'\n Confirm that chooser priority is randomized.\n \n '
choices = iterative_lottery_choices(obs, alts, mct, probs)
assert (choices.index.values[:5].tolist != [0, 1, 2, 3, 4]) | Confirm that chooser priority is randomized. | tests/test_simulation.py | test_chooser_priority | UDST/choicemodels | 54 | python | def test_chooser_priority(obs, alts, mct, probs):
'\n \n \n '
choices = iterative_lottery_choices(obs, alts, mct, probs)
assert (choices.index.values[:5].tolist != [0, 1, 2, 3, 4]) | def test_chooser_priority(obs, alts, mct, probs):
'\n \n \n '
choices = iterative_lottery_choices(obs, alts, mct, probs)
assert (choices.index.values[:5].tolist != [0, 1, 2, 3, 4])<|docstring|>Confirm that chooser priority is randomized.<|endoftext|> |
4cc610ed8e29fb19b6dd8b775f896bd3ef684c5ef810faaaab4dc64f90d521e8 | def test_max_iter(obs, alts, mct, probs):
'\n Confirm that max_iter param will prevent infinite loop.\n \n '
obs['size'] = 2
choices = iterative_lottery_choices(obs, alts, mct, probs, chooser_size='size', max_iter=5) | Confirm that max_iter param will prevent infinite loop. | tests/test_simulation.py | test_max_iter | UDST/choicemodels | 54 | python | def test_max_iter(obs, alts, mct, probs):
'\n \n \n '
obs['size'] = 2
choices = iterative_lottery_choices(obs, alts, mct, probs, chooser_size='size', max_iter=5) | def test_max_iter(obs, alts, mct, probs):
'\n \n \n '
obs['size'] = 2
choices = iterative_lottery_choices(obs, alts, mct, probs, chooser_size='size', max_iter=5)<|docstring|>Confirm that max_iter param will prevent infinite loop.<|endoftext|> |
7ffc2b3dee2f00d8ff521a6aeec1498c139e5ab3181a8ac3074c21d70b6d3f03 | def test_capacity_break(obs, alts, mct, probs):
'\n Confirm that if alts[capacity].max() < choosers[size].min() will prevent infinite loop.\n\n '
obs['size'] = 2
alts['capacity'] = np.random.choice([3, 5], size=len(alts))
choices = iterative_lottery_choices(obs, alts, mct, probs, chooser_size='size', alt_capacity='capacity') | Confirm that if alts[capacity].max() < choosers[size].min() will prevent infinite loop. | tests/test_simulation.py | test_capacity_break | UDST/choicemodels | 54 | python | def test_capacity_break(obs, alts, mct, probs):
'\n \n\n '
obs['size'] = 2
alts['capacity'] = np.random.choice([3, 5], size=len(alts))
choices = iterative_lottery_choices(obs, alts, mct, probs, chooser_size='size', alt_capacity='capacity') | def test_capacity_break(obs, alts, mct, probs):
'\n \n\n '
obs['size'] = 2
alts['capacity'] = np.random.choice([3, 5], size=len(alts))
choices = iterative_lottery_choices(obs, alts, mct, probs, chooser_size='size', alt_capacity='capacity')<|docstring|>Confirm that if alts[capacity].max() < choosers[size].min() will prevent infinite loop.<|endoftext|> |
151ca09a4195df5307fbcf1582b35a9af44d66c2931454c8669ba0dd3ccb40f5 | def test_parallel_lottery_choices(obs, alts, mct, probs):
"\n Test that parallel lottery choices can run and that there\n aren't any duplicate choices\n \n "
num_cpus = multiprocessing.cpu_count()
batch_size = int(np.ceil((len(obs) / num_cpus)))
choices = parallel_lottery_choices(obs, alts, mct, probs, chooser_batch_size=batch_size)
assert (len(np.unique(list(choices.values))) == min((len(alts) - 1), len(obs))) | Test that parallel lottery choices can run and that there
aren't any duplicate choices | tests/test_simulation.py | test_parallel_lottery_choices | UDST/choicemodels | 54 | python | def test_parallel_lottery_choices(obs, alts, mct, probs):
"\n Test that parallel lottery choices can run and that there\n aren't any duplicate choices\n \n "
num_cpus = multiprocessing.cpu_count()
batch_size = int(np.ceil((len(obs) / num_cpus)))
choices = parallel_lottery_choices(obs, alts, mct, probs, chooser_batch_size=batch_size)
assert (len(np.unique(list(choices.values))) == min((len(alts) - 1), len(obs))) | def test_parallel_lottery_choices(obs, alts, mct, probs):
"\n Test that parallel lottery choices can run and that there\n aren't any duplicate choices\n \n "
num_cpus = multiprocessing.cpu_count()
batch_size = int(np.ceil((len(obs) / num_cpus)))
choices = parallel_lottery_choices(obs, alts, mct, probs, chooser_batch_size=batch_size)
assert (len(np.unique(list(choices.values))) == min((len(alts) - 1), len(obs)))<|docstring|>Test that parallel lottery choices can run and that there
aren't any duplicate choices<|endoftext|> |
7be4ee4dabc92b172375d6177d2531519511fc0b168cd5c2e4d814be60bdef50 | def __init__(self, parameter_list=None, state_list=None):
' Carries out topological data analysis for SSH model. Provide either the state_list or parameter list.\n\n Args:\n parameter_list (list): list of parameters of the format (t1, t2, [band_index], mesh_size). Note that t1 and t2 are parameters in the SSH Hamiltonian\n state_list (list): list of states to be used for tda.\n\n '
if (state_list is None):
assert (parameter_list is not None), 'provide either the parameter_list or the state_list'
state_list = ssh_utils.get_state_list(*parameter_list)
else:
assert (parameter_list is None), 'provide either the parameter_list or the state_list, not both'
self.distance_matrix = []
for i in range(len(state_list)):
distance_list = []
for j in range(i):
distance_list.append(ssh_utils.distance(state_list[i], state_list[j]))
self.distance_matrix.append(distance_list) | Carries out topological data analysis for SSH model. Provide either the state_list or parameter list.
Args:
parameter_list (list): list of parameters of the format (t1, t2, [band_index], mesh_size). Note that t1 and t2 are parameters in the SSH Hamiltonian
state_list (list): list of states to be used for tda. | ssh/ssh_tda.py | __init__ | park-sungjoon/topological-phase-diagram | 0 | python | def __init__(self, parameter_list=None, state_list=None):
' Carries out topological data analysis for SSH model. Provide either the state_list or parameter list.\n\n Args:\n parameter_list (list): list of parameters of the format (t1, t2, [band_index], mesh_size). Note that t1 and t2 are parameters in the SSH Hamiltonian\n state_list (list): list of states to be used for tda.\n\n '
if (state_list is None):
assert (parameter_list is not None), 'provide either the parameter_list or the state_list'
state_list = ssh_utils.get_state_list(*parameter_list)
else:
assert (parameter_list is None), 'provide either the parameter_list or the state_list, not both'
self.distance_matrix = []
for i in range(len(state_list)):
distance_list = []
for j in range(i):
distance_list.append(ssh_utils.distance(state_list[i], state_list[j]))
self.distance_matrix.append(distance_list) | def __init__(self, parameter_list=None, state_list=None):
' Carries out topological data analysis for SSH model. Provide either the state_list or parameter list.\n\n Args:\n parameter_list (list): list of parameters of the format (t1, t2, [band_index], mesh_size). Note that t1 and t2 are parameters in the SSH Hamiltonian\n state_list (list): list of states to be used for tda.\n\n '
if (state_list is None):
assert (parameter_list is not None), 'provide either the parameter_list or the state_list'
state_list = ssh_utils.get_state_list(*parameter_list)
else:
assert (parameter_list is None), 'provide either the parameter_list or the state_list, not both'
self.distance_matrix = []
for i in range(len(state_list)):
distance_list = []
for j in range(i):
distance_list.append(ssh_utils.distance(state_list[i], state_list[j]))
self.distance_matrix.append(distance_list)<|docstring|>Carries out topological data analysis for SSH model. Provide either the state_list or parameter list.
Args:
parameter_list (list): list of parameters of the format (t1, t2, [band_index], mesh_size). Note that t1 and t2 are parameters in the SSH Hamiltonian
state_list (list): list of states to be used for tda.<|endoftext|> |
50a63ac16f4de324b8ae25bf25ef4ebcc01ca7f0b0f35e369396a3c0eaea1f9a | def foo():
'This is a docstring with \n some lines of text here\n '
return | This is a docstring with
some lines of text here | tests/data/docstring.py | foo | Austin-HTTPS/black | 1 | python | def foo():
'This is a docstring with \n some lines of text here\n '
return | def foo():
'This is a docstring with \n some lines of text here\n '
return<|docstring|>This is a docstring with
some lines of text here<|endoftext|> |
739fb4047a99cd682e38fa9bcc0c825b73df7101fb215b32ff8275a0aaac2885 | def bar():
'This is another docstring\n with more lines of text\n '
return | This is another docstring
with more lines of text | tests/data/docstring.py | bar | Austin-HTTPS/black | 1 | python | def bar():
'This is another docstring\n with more lines of text\n '
return | def bar():
'This is another docstring\n with more lines of text\n '
return<|docstring|>This is another docstring
with more lines of text<|endoftext|> |
28a2114290c10ed6bab09454e79ab8bb7f42058fc65768e9903e826ceaca237f | def baz():
'"This" is a string with some\n embedded "quotes"'
return | "This" is a string with some
embedded "quotes" | tests/data/docstring.py | baz | Austin-HTTPS/black | 1 | python | def baz():
'"This" is a string with some\n embedded "quotes"'
return | def baz():
'"This" is a string with some\n embedded "quotes"'
return<|docstring|>"This" is a string with some
embedded "quotes"<|endoftext|> |
dce9c2923568ef81f8e73e69e57dcc3134412f1bfc3279a0737b3d492715179e | def troz():
'Indentation with tabs\n\tis just as OK\n\t'
return | Indentation with tabs
is just as OK | tests/data/docstring.py | troz | Austin-HTTPS/black | 1 | python | def troz():
'Indentation with tabs\n\tis just as OK\n\t'
return | def troz():
'Indentation with tabs\n\tis just as OK\n\t'
return<|docstring|>Indentation with tabs
is just as OK<|endoftext|> |
d3ea4a194dbb7f5d62af68de7a192b1a519af08f52d2d9e341383aad25649dc3 | def zort():
'Another\n multiline\n docstring\n '
pass | Another
multiline
docstring | tests/data/docstring.py | zort | Austin-HTTPS/black | 1 | python | def zort():
'Another\n multiline\n docstring\n '
pass | def zort():
'Another\n multiline\n docstring\n '
pass<|docstring|>Another
multiline
docstring<|endoftext|> |
70a482a04036edf10ebbced92f05844daa6ebf924da566d0714dba680796593e | def poit():
'\n Lorem ipsum dolor sit amet. \n\n Consectetur adipiscing elit:\n - sed do eiusmod tempor incididunt ut labore\n - dolore magna aliqua\n - enim ad minim veniam\n - quis nostrud exercitation ullamco laboris nisi\n - aliquip ex ea commodo consequat\n '
pass | Lorem ipsum dolor sit amet.
Consectetur adipiscing elit:
- sed do eiusmod tempor incididunt ut labore
- dolore magna aliqua
- enim ad minim veniam
- quis nostrud exercitation ullamco laboris nisi
- aliquip ex ea commodo consequat | tests/data/docstring.py | poit | Austin-HTTPS/black | 1 | python | def poit():
'\n Lorem ipsum dolor sit amet. \n\n Consectetur adipiscing elit:\n - sed do eiusmod tempor incididunt ut labore\n - dolore magna aliqua\n - enim ad minim veniam\n - quis nostrud exercitation ullamco laboris nisi\n - aliquip ex ea commodo consequat\n '
pass | def poit():
'\n Lorem ipsum dolor sit amet. \n\n Consectetur adipiscing elit:\n - sed do eiusmod tempor incididunt ut labore\n - dolore magna aliqua\n - enim ad minim veniam\n - quis nostrud exercitation ullamco laboris nisi\n - aliquip ex ea commodo consequat\n '
pass<|docstring|>Lorem ipsum dolor sit amet.
Consectetur adipiscing elit:
- sed do eiusmod tempor incididunt ut labore
- dolore magna aliqua
- enim ad minim veniam
- quis nostrud exercitation ullamco laboris nisi
- aliquip ex ea commodo consequat<|endoftext|> |
010fa9c4b92d8403cd02a211beef7042c848470beba4eb7dc930f0cb19ccc674 | def under_indent():
'\n These lines are indented in a way that does not\nmake sense.\n '
pass | These lines are indented in a way that does not
make sense. | tests/data/docstring.py | under_indent | Austin-HTTPS/black | 1 | python | def under_indent():
'\n These lines are indented in a way that does not\nmake sense.\n '
pass | def under_indent():
'\n These lines are indented in a way that does not\nmake sense.\n '
pass<|docstring|>These lines are indented in a way that does not
make sense.<|endoftext|> |
5c5e4de157e2674e720db24b0e1d967a2f4beb5837625162cc8226eeee6a1314 | def over_indent():
'\n This has a shallow indent\n - But some lines are deeper\n - And the closing quote is too deep\n '
pass | This has a shallow indent
- But some lines are deeper
- And the closing quote is too deep | tests/data/docstring.py | over_indent | Austin-HTTPS/black | 1 | python | def over_indent():
'\n This has a shallow indent\n - But some lines are deeper\n - And the closing quote is too deep\n '
pass | def over_indent():
'\n This has a shallow indent\n - But some lines are deeper\n - And the closing quote is too deep\n '
pass<|docstring|>This has a shallow indent
- But some lines are deeper
- And the closing quote is too deep<|endoftext|> |
106996826c68b75643d009348fd3c6f2cf20dee946960b756d37285f4e61b91f | def single_line():
'But with a newline after it!\n\n '
pass | But with a newline after it! | tests/data/docstring.py | single_line | Austin-HTTPS/black | 1 | python | def single_line():
'\n\n '
pass | def single_line():
'\n\n '
pass<|docstring|>But with a newline after it!<|endoftext|> |
1170e0e647689e9eadaa7f2bffcd4ce1699ebafb70270b5ecba518a8da73d843 | def this():
"\n 'hey ho'\n " | 'hey ho' | tests/data/docstring.py | this | Austin-HTTPS/black | 1 | python | def this():
"\n \n " | def this():
"\n \n "<|docstring|>'hey ho'<|endoftext|> |
2dcc9bd5bf03bcb7e9c3517b867e78f8dd119d468e636de862e09897b9295009 | def that():
' "hey yah" ' | "hey yah" | tests/data/docstring.py | that | Austin-HTTPS/black | 1 | python | def that():
' ' | def that():
' '<|docstring|>"hey yah"<|endoftext|> |
3e3bc47b257e51fabecd4f6f19d5afb760dc90be5297d434202fccfecbf55af6 | def and_that():
'\n "hey yah" ' | "hey yah" | tests/data/docstring.py | and_that | Austin-HTTPS/black | 1 | python | def and_that():
'\n ' | def and_that():
'\n '<|docstring|>"hey yah"<|endoftext|> |
fd51bf568dca4554f03a4f8db7f46fa5ba2ef76430cd83144248f76dcd6d57d0 | def and_this():
' \n "hey yah"' | "hey yah" | tests/data/docstring.py | and_this | Austin-HTTPS/black | 1 | python | def and_this():
' \n ' | def and_this():
' \n '<|docstring|>"hey yah"<|endoftext|> |
fd97729ad31e55e387dc97a55dc0e3bfdca70553694a3979a4570237a41016aa | def single_quotes():
'testing' | testing | tests/data/docstring.py | single_quotes | Austin-HTTPS/black | 1 | python | def single_quotes():
| def single_quotes():
<|docstring|>testing<|endoftext|> |
057ce5fa1194af6e48b45cd1f92a6ebf72dc7265becf9630896e8728a070287a | def believe_it_or_not_this_is_in_the_py_stdlib():
' \n"hey yah"' | "hey yah" | tests/data/docstring.py | believe_it_or_not_this_is_in_the_py_stdlib | Austin-HTTPS/black | 1 | python | def believe_it_or_not_this_is_in_the_py_stdlib():
' \n' | def believe_it_or_not_this_is_in_the_py_stdlib():
' \n'<|docstring|>"hey yah"<|endoftext|> |
625efc26145369688f95433134a44a21d49ba05797bb900fb9906efb77b71067 | def ignored_docstring():
'a => b' | a => b | tests/data/docstring.py | ignored_docstring | Austin-HTTPS/black | 1 | python | def ignored_docstring():
| def ignored_docstring():
<|docstring|>a => b<|endoftext|> |
766ed87fc435a59214fb70a4649fd43bce596ee0d4784d1e5ac58366b6dab0be | def single_line_docstring_with_whitespace():
' This should be stripped ' | This should be stripped | tests/data/docstring.py | single_line_docstring_with_whitespace | Austin-HTTPS/black | 1 | python | def single_line_docstring_with_whitespace():
' ' | def single_line_docstring_with_whitespace():
' '<|docstring|>This should be stripped<|endoftext|> |
3ba9ebdd273c15cd53715179cdb4afe18f3d26dffdc1b3120308d8f75dbe1f56 | def docstring_with_inline_tabs_and_space_indentation():
'hey\n\n tab\tseparated\tvalue\n \ttab at start of line and then a tab\tseparated\tvalue\n \t\t\t\tmultiple tabs at the beginning\tand\tinline\n \t \t \tmixed tabs and spaces at beginning. next line has mixed tabs and spaces only.\n \t\t\t \t \t\t\n line ends with some tabs\t\t\n ' | hey
tab separated value
tab at start of line and then a tab separated value
multiple tabs at the beginning and inline
mixed tabs and spaces at beginning. next line has mixed tabs and spaces only.
line ends with some tabs | tests/data/docstring.py | docstring_with_inline_tabs_and_space_indentation | Austin-HTTPS/black | 1 | python | def docstring_with_inline_tabs_and_space_indentation():
'hey\n\n tab\tseparated\tvalue\n \ttab at start of line and then a tab\tseparated\tvalue\n \t\t\t\tmultiple tabs at the beginning\tand\tinline\n \t \t \tmixed tabs and spaces at beginning. next line has mixed tabs and spaces only.\n \t\t\t \t \t\t\n line ends with some tabs\t\t\n ' | def docstring_with_inline_tabs_and_space_indentation():
'hey\n\n tab\tseparated\tvalue\n \ttab at start of line and then a tab\tseparated\tvalue\n \t\t\t\tmultiple tabs at the beginning\tand\tinline\n \t \t \tmixed tabs and spaces at beginning. next line has mixed tabs and spaces only.\n \t\t\t \t \t\t\n line ends with some tabs\t\t\n '<|docstring|>hey
tab separated value
tab at start of line and then a tab separated value
multiple tabs at the beginning and inline
mixed tabs and spaces at beginning. next line has mixed tabs and spaces only.
line ends with some tabs<|endoftext|> |
a32b20c2cbeeb34bab51a2066697a087348efcebd1381b7f0889495ad49d88f7 | def docstring_with_inline_tabs_and_tab_indentation():
'hey\n\n\ttab\tseparated\tvalue\n\t\ttab at start of line and then a tab\tseparated\tvalue\n\t\t\t\t\tmultiple tabs at the beginning\tand\tinline\n\t\t \t \tmixed tabs and spaces at beginning. next line has mixed tabs and spaces only.\n\t\t\t\t \t \t\t\n\tline ends with some tabs\t\t\n\t'
pass | hey
tab separated value
tab at start of line and then a tab separated value
multiple tabs at the beginning and inline
mixed tabs and spaces at beginning. next line has mixed tabs and spaces only.
line ends with some tabs | tests/data/docstring.py | docstring_with_inline_tabs_and_tab_indentation | Austin-HTTPS/black | 1 | python | def docstring_with_inline_tabs_and_tab_indentation():
'hey\n\n\ttab\tseparated\tvalue\n\t\ttab at start of line and then a tab\tseparated\tvalue\n\t\t\t\t\tmultiple tabs at the beginning\tand\tinline\n\t\t \t \tmixed tabs and spaces at beginning. next line has mixed tabs and spaces only.\n\t\t\t\t \t \t\t\n\tline ends with some tabs\t\t\n\t'
pass | def docstring_with_inline_tabs_and_tab_indentation():
'hey\n\n\ttab\tseparated\tvalue\n\t\ttab at start of line and then a tab\tseparated\tvalue\n\t\t\t\t\tmultiple tabs at the beginning\tand\tinline\n\t\t \t \tmixed tabs and spaces at beginning. next line has mixed tabs and spaces only.\n\t\t\t\t \t \t\t\n\tline ends with some tabs\t\t\n\t'
pass<|docstring|>hey
tab separated value
tab at start of line and then a tab separated value
multiple tabs at the beginning and inline
mixed tabs and spaces at beginning. next line has mixed tabs and spaces only.
line ends with some tabs<|endoftext|> |
b29cec9233d02430ca186e45bd8b60708e6da805a73d43cea35c6e81e9ca6019 | def foo():
'This is a docstring with\n some lines of text here\n '
return | This is a docstring with
some lines of text here | tests/data/docstring.py | foo | Austin-HTTPS/black | 1 | python | def foo():
'This is a docstring with\n some lines of text here\n '
return | def foo():
'This is a docstring with\n some lines of text here\n '
return<|docstring|>This is a docstring with
some lines of text here<|endoftext|> |
01248caff71e1b6a84e4490b515f467468b02a753fbb644df36e05c6bfc7051f | def bar():
'This is another docstring\n with more lines of text\n '
return | This is another docstring
with more lines of text | tests/data/docstring.py | bar | Austin-HTTPS/black | 1 | python | def bar():
'This is another docstring\n with more lines of text\n '
return | def bar():
'This is another docstring\n with more lines of text\n '
return<|docstring|>This is another docstring
with more lines of text<|endoftext|> |
da8c7d12b3e791b784999b0b66ab9d037bf287e3e05e8cf01eb4f86407682f81 | def baz():
'"This" is a string with some\n embedded "quotes"'
return | "This" is a string with some
embedded "quotes" | tests/data/docstring.py | baz | Austin-HTTPS/black | 1 | python | def baz():
'"This" is a string with some\n embedded "quotes"'
return | def baz():
'"This" is a string with some\n embedded "quotes"'
return<|docstring|>"This" is a string with some
embedded "quotes"<|endoftext|> |
2474989aa62c3e71e310902373d50fa42ad8e1031ecc1fa4931ab632c6607e90 | def troz():
'Indentation with tabs\n is just as OK\n '
return | Indentation with tabs
is just as OK | tests/data/docstring.py | troz | Austin-HTTPS/black | 1 | python | def troz():
'Indentation with tabs\n is just as OK\n '
return | def troz():
'Indentation with tabs\n is just as OK\n '
return<|docstring|>Indentation with tabs
is just as OK<|endoftext|> |
21326ed3730e18253e3d2f12949d6b39369ee06b9e6ee08db36694ea11da2ba3 | def zort():
'Another\n multiline\n docstring\n '
pass | Another
multiline
docstring | tests/data/docstring.py | zort | Austin-HTTPS/black | 1 | python | def zort():
'Another\n multiline\n docstring\n '
pass | def zort():
'Another\n multiline\n docstring\n '
pass<|docstring|>Another
multiline
docstring<|endoftext|> |
d5efdf23fb4474ac5bbac728ca2faab3708b8f2d7a1d7584f757720650bd9522 | def poit():
'\n Lorem ipsum dolor sit amet.\n\n Consectetur adipiscing elit:\n - sed do eiusmod tempor incididunt ut labore\n - dolore magna aliqua\n - enim ad minim veniam\n - quis nostrud exercitation ullamco laboris nisi\n - aliquip ex ea commodo consequat\n '
pass | Lorem ipsum dolor sit amet.
Consectetur adipiscing elit:
- sed do eiusmod tempor incididunt ut labore
- dolore magna aliqua
- enim ad minim veniam
- quis nostrud exercitation ullamco laboris nisi
- aliquip ex ea commodo consequat | tests/data/docstring.py | poit | Austin-HTTPS/black | 1 | python | def poit():
'\n Lorem ipsum dolor sit amet.\n\n Consectetur adipiscing elit:\n - sed do eiusmod tempor incididunt ut labore\n - dolore magna aliqua\n - enim ad minim veniam\n - quis nostrud exercitation ullamco laboris nisi\n - aliquip ex ea commodo consequat\n '
pass | def poit():
'\n Lorem ipsum dolor sit amet.\n\n Consectetur adipiscing elit:\n - sed do eiusmod tempor incididunt ut labore\n - dolore magna aliqua\n - enim ad minim veniam\n - quis nostrud exercitation ullamco laboris nisi\n - aliquip ex ea commodo consequat\n '
pass<|docstring|>Lorem ipsum dolor sit amet.
Consectetur adipiscing elit:
- sed do eiusmod tempor incididunt ut labore
- dolore magna aliqua
- enim ad minim veniam
- quis nostrud exercitation ullamco laboris nisi
- aliquip ex ea commodo consequat<|endoftext|> |
de557e998da7ff0e83fa7b2ba51ba13978020637e0feee739b2a5a9dcd8ce430 | def under_indent():
'\n These lines are indented in a way that does not\n make sense.\n '
pass | These lines are indented in a way that does not
make sense. | tests/data/docstring.py | under_indent | Austin-HTTPS/black | 1 | python | def under_indent():
'\n These lines are indented in a way that does not\n make sense.\n '
pass | def under_indent():
'\n These lines are indented in a way that does not\n make sense.\n '
pass<|docstring|>These lines are indented in a way that does not
make sense.<|endoftext|> |
69515445c6fdc27b7ebd7112ba2020c660ceebae52926b60e6a38c8d995f584f | def over_indent():
'\n This has a shallow indent\n - But some lines are deeper\n - And the closing quote is too deep\n '
pass | This has a shallow indent
- But some lines are deeper
- And the closing quote is too deep | tests/data/docstring.py | over_indent | Austin-HTTPS/black | 1 | python | def over_indent():
'\n This has a shallow indent\n - But some lines are deeper\n - And the closing quote is too deep\n '
pass | def over_indent():
'\n This has a shallow indent\n - But some lines are deeper\n - And the closing quote is too deep\n '
pass<|docstring|>This has a shallow indent
- But some lines are deeper
- And the closing quote is too deep<|endoftext|> |
1c96cff613d80a481b868b65db88a5562366d2044e7495d48a5c44764639def9 | def single_line():
'But with a newline after it!'
pass | But with a newline after it! | tests/data/docstring.py | single_line | Austin-HTTPS/black | 1 | python | def single_line():
pass | def single_line():
pass<|docstring|>But with a newline after it!<|endoftext|> |
1170e0e647689e9eadaa7f2bffcd4ce1699ebafb70270b5ecba518a8da73d843 | def this():
"\n 'hey ho'\n " | 'hey ho' | tests/data/docstring.py | this | Austin-HTTPS/black | 1 | python | def this():
"\n \n " | def this():
"\n \n "<|docstring|>'hey ho'<|endoftext|> |
2dcc9bd5bf03bcb7e9c3517b867e78f8dd119d468e636de862e09897b9295009 | def that():
' "hey yah" ' | "hey yah" | tests/data/docstring.py | that | Austin-HTTPS/black | 1 | python | def that():
' ' | def that():
' '<|docstring|>"hey yah"<|endoftext|> |
af5d71ae100dd6be4c85d8fdf9ee17bf14cf3ea6b967d085d6b1a02c140f411b | def and_that():
'\n "hey yah" ' | "hey yah" | tests/data/docstring.py | and_that | Austin-HTTPS/black | 1 | python | def and_that():
'\n ' | def and_that():
'\n '<|docstring|>"hey yah"<|endoftext|> |
2941aadcb02ddd2a8f5d4f134baba092bb71560829f384b82a50ad7905975516 | def and_this():
'\n "hey yah"' | "hey yah" | tests/data/docstring.py | and_this | Austin-HTTPS/black | 1 | python | def and_this():
'\n ' | def and_this():
'\n '<|docstring|>"hey yah"<|endoftext|> |
fd97729ad31e55e387dc97a55dc0e3bfdca70553694a3979a4570237a41016aa | def single_quotes():
'testing' | testing | tests/data/docstring.py | single_quotes | Austin-HTTPS/black | 1 | python | def single_quotes():
| def single_quotes():
<|docstring|>testing<|endoftext|> |
05dc424b2eacf44f5c103e59db5f9b54d5472c2ceac03c3d8da7e3c670456854 | def believe_it_or_not_this_is_in_the_py_stdlib():
'\n "hey yah"' | "hey yah" | tests/data/docstring.py | believe_it_or_not_this_is_in_the_py_stdlib | Austin-HTTPS/black | 1 | python | def believe_it_or_not_this_is_in_the_py_stdlib():
'\n ' | def believe_it_or_not_this_is_in_the_py_stdlib():
'\n '<|docstring|>"hey yah"<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.