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 |
|---|---|---|---|---|---|---|---|---|---|
9397005a087bcbdc622d4112a3d4bd0ab2157f3cbb4938139ec4a028ac87226c | def get_region_wise_buckets(self):
'\n Fetch all buckets in all regions.\n '
try:
buckets = self.list_existing_buckets()
if buckets:
region_wise_bucket = {}
for bucket in buckets:
region = self.get_bucket_region(bucket)
if (re... | Fetch all buckets in all regions. | lib/awsLib/S3.py | get_region_wise_buckets | umang-cb/TAF | 9 | python | def get_region_wise_buckets(self):
'\n \n '
try:
buckets = self.list_existing_buckets()
if buckets:
region_wise_bucket = {}
for bucket in buckets:
region = self.get_bucket_region(bucket)
if (region in region_wise_bucket):
... | def get_region_wise_buckets(self):
'\n \n '
try:
buckets = self.list_existing_buckets()
if buckets:
region_wise_bucket = {}
for bucket in buckets:
region = self.get_bucket_region(bucket)
if (region in region_wise_bucket):
... |
3e679084fb53fdfa89a859e269c4ea76973f860d3e838ebf71726a270d52b029 | def get_bucket_region(self, bucket_name):
'\n Gets the region where the bucket is located\n '
try:
response = self.s3_client.list_buckets(Bucket=bucket_name)
if response:
if (response['LocationConstraint'] == None):
return 'us-east-1'
else:
... | Gets the region where the bucket is located | lib/awsLib/S3.py | get_bucket_region | umang-cb/TAF | 9 | python | def get_bucket_region(self, bucket_name):
'\n \n '
try:
response = self.s3_client.list_buckets(Bucket=bucket_name)
if response:
if (response['LocationConstraint'] == None):
return 'us-east-1'
else:
return response['LocationCon... | def get_bucket_region(self, bucket_name):
'\n \n '
try:
response = self.s3_client.list_buckets(Bucket=bucket_name)
if response:
if (response['LocationConstraint'] == None):
return 'us-east-1'
else:
return response['LocationCon... |
98a7bb25266ddd849cd20252a4e4269054151428ca5ee335b597f9b3a280a90f | def upload_file(self, bucket_name, source_path, destination_path):
'\n Uploads a file to bucket specified.\n :param bucket_name: name of the bucket where file has to be uploaded.\n :param source_path: path of the file to be uploaded.\n :param destination_path: path relative to aws bucket... | Uploads a file to bucket specified.
:param bucket_name: name of the bucket where file has to be uploaded.
:param source_path: path of the file to be uploaded.
:param destination_path: path relative to aws bucket. If only file name is specified
then file will be loaded in root folder relative to bucket.
:return: True/Fa... | lib/awsLib/S3.py | upload_file | umang-cb/TAF | 9 | python | def upload_file(self, bucket_name, source_path, destination_path):
'\n Uploads a file to bucket specified.\n :param bucket_name: name of the bucket where file has to be uploaded.\n :param source_path: path of the file to be uploaded.\n :param destination_path: path relative to aws bucket... | def upload_file(self, bucket_name, source_path, destination_path):
'\n Uploads a file to bucket specified.\n :param bucket_name: name of the bucket where file has to be uploaded.\n :param source_path: path of the file to be uploaded.\n :param destination_path: path relative to aws bucket... |
eaf06910785f20123b4b878be63d75effbcbdee74f11428b43c9db0c5ee5c00b | def upload_large_file(self, bucket_name, source_path, destination_path, multipart_threshold=((1024 * 1024) * 8), max_concurrency=10, multipart_chunksize=((1024 * 1024) * 8), use_threads=True):
'\n Uploads a large file to bucket specified.\n :param bucket_name: name of the bucket where file has to be u... | Uploads a large file to bucket specified.
:param bucket_name: name of the bucket where file has to be uploaded.
:param source_path: path of the file to be uploaded.
:param destination_path: path relative to aws bucket. If only file name is specified
then file will be loaded in root folder relative to bucket.
:param mul... | lib/awsLib/S3.py | upload_large_file | umang-cb/TAF | 9 | python | def upload_large_file(self, bucket_name, source_path, destination_path, multipart_threshold=((1024 * 1024) * 8), max_concurrency=10, multipart_chunksize=((1024 * 1024) * 8), use_threads=True):
'\n Uploads a large file to bucket specified.\n :param bucket_name: name of the bucket where file has to be u... | def upload_large_file(self, bucket_name, source_path, destination_path, multipart_threshold=((1024 * 1024) * 8), max_concurrency=10, multipart_chunksize=((1024 * 1024) * 8), use_threads=True):
'\n Uploads a large file to bucket specified.\n :param bucket_name: name of the bucket where file has to be u... |
5be83905dbac7f4adec2eda8683042ea20d668266e206c498fae8ae227868315 | def perform(self, data):
'\n Parses the given request data and returns a matching response header.\n '
key = self._build_web_socket_accept_from_request_header(data.decode('utf-8'))
return self._build_response_header(key) | Parses the given request data and returns a matching response header. | WebSocket/Handshake.py | perform | Cottin/BrowserREPL-for-Sublime | 32 | python | def perform(self, data):
'\n \n '
key = self._build_web_socket_accept_from_request_header(data.decode('utf-8'))
return self._build_response_header(key) | def perform(self, data):
'\n \n '
key = self._build_web_socket_accept_from_request_header(data.decode('utf-8'))
return self._build_response_header(key)<|docstring|>Parses the given request data and returns a matching response header.<|endoftext|> |
ee71dd7d48306988994792e91b41c09d50a40b12eb055b656b10a070b73ffd83 | def _build_web_socket_accept_from_request_header(self, header):
'\n Parses the response header and builds a sec web socket accept.\n '
search_term = 'Sec-WebSocket-Key: '
start = (header.find(search_term) + len(search_term))
end = header.find('\r\n', start)
key = header[start:end]
... | Parses the response header and builds a sec web socket accept. | WebSocket/Handshake.py | _build_web_socket_accept_from_request_header | Cottin/BrowserREPL-for-Sublime | 32 | python | def _build_web_socket_accept_from_request_header(self, header):
'\n \n '
search_term = 'Sec-WebSocket-Key: '
start = (header.find(search_term) + len(search_term))
end = header.find('\r\n', start)
key = header[start:end]
guid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
key = (key +... | def _build_web_socket_accept_from_request_header(self, header):
'\n \n '
search_term = 'Sec-WebSocket-Key: '
start = (header.find(search_term) + len(search_term))
end = header.find('\r\n', start)
key = header[start:end]
guid = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
key = (key +... |
32654773c14170ddf2b497565dceb7a95869d6b430b6cf6a46da460e93b04eaa | def _build_response_header(self, key):
'\n Builds the response header containing the given key.\n '
return str(((((('HTTP/1.1 101 Switching Protocols\r\n' + 'Upgrade: websocket\r\n') + 'Connection: Upgrade\r\n') + 'Sec-WebSocket-Accept: ') + key.decode('utf-8')) + '\r\n\r\n')) | Builds the response header containing the given key. | WebSocket/Handshake.py | _build_response_header | Cottin/BrowserREPL-for-Sublime | 32 | python | def _build_response_header(self, key):
'\n \n '
return str(((((('HTTP/1.1 101 Switching Protocols\r\n' + 'Upgrade: websocket\r\n') + 'Connection: Upgrade\r\n') + 'Sec-WebSocket-Accept: ') + key.decode('utf-8')) + '\r\n\r\n')) | def _build_response_header(self, key):
'\n \n '
return str(((((('HTTP/1.1 101 Switching Protocols\r\n' + 'Upgrade: websocket\r\n') + 'Connection: Upgrade\r\n') + 'Sec-WebSocket-Accept: ') + key.decode('utf-8')) + '\r\n\r\n'))<|docstring|>Builds the response header containing the given key.<|endoft... |
b3fe5ebca447393db9dc6aebf147e7c3a7f0319d3220edf6c0c7ab4a76e8359f | @group.command('get')
@click.argument('id', type=int)
@click.pass_context
def get(ctx, id):
'Gets a single record from the table.'
record = model.get(id)
if (not record):
ctx.fail(click.style(f'No record found with id "{id}".', fg='red'))
click.echo(record.to_json()) | Gets a single record from the table. | rfidsecuritysvc/cli/guest.py | get | bcurnow/rfid-security-svc | 0 | python | @group.command('get')
@click.argument('id', type=int)
@click.pass_context
def get(ctx, id):
record = model.get(id)
if (not record):
ctx.fail(click.style(f'No record found with id "{id}".', fg='red'))
click.echo(record.to_json()) | @group.command('get')
@click.argument('id', type=int)
@click.pass_context
def get(ctx, id):
record = model.get(id)
if (not record):
ctx.fail(click.style(f'No record found with id "{id}".', fg='red'))
click.echo(record.to_json())<|docstring|>Gets a single record from the table.<|endoftext|> |
0307e9c17897a35ee853097b1d412805d9c60eec2d9c149cecdb56beff7bd256 | @group.command('list')
def list():
'List all the records in the table.'
for i in model.list():
click.echo(i.to_json()) | List all the records in the table. | rfidsecuritysvc/cli/guest.py | list | bcurnow/rfid-security-svc | 0 | python | @group.command('list')
def list():
for i in model.list():
click.echo(i.to_json()) | @group.command('list')
def list():
for i in model.list():
click.echo(i.to_json())<|docstring|>List all the records in the table.<|endoftext|> |
0587dcc4d6f624e7c278758ce8724e5814b135c91b086fe48f2d26e2dfa20a35 | @group.command('create')
@click.argument('first_name')
@click.argument('last_name')
@click.argument('sound', type=int, required=False)
@click.argument('color', type=int, required=False)
@click.pass_context
def create(ctx, first_name, last_name, sound, color):
'Manually adds a record to the table.'
try:
... | Manually adds a record to the table. | rfidsecuritysvc/cli/guest.py | create | bcurnow/rfid-security-svc | 0 | python | @group.command('create')
@click.argument('first_name')
@click.argument('last_name')
@click.argument('sound', type=int, required=False)
@click.argument('color', type=int, required=False)
@click.pass_context
def create(ctx, first_name, last_name, sound, color):
try:
model.create(first_name, last_name, so... | @group.command('create')
@click.argument('first_name')
@click.argument('last_name')
@click.argument('sound', type=int, required=False)
@click.argument('color', type=int, required=False)
@click.pass_context
def create(ctx, first_name, last_name, sound, color):
try:
model.create(first_name, last_name, so... |
f618e2a779cda06c22ac560b655eaa282ef5551662697d46559179fbe83b0d38 | @group.command('delete')
@click.argument('id', type=int)
@click.pass_context
def delete(ctx, id):
'Manually deletes a record from the table.'
click.echo(click.style(f'{model.delete(id)} record(s) deleted.', bg='green', fg='black'))
ctx.invoke(list) | Manually deletes a record from the table. | rfidsecuritysvc/cli/guest.py | delete | bcurnow/rfid-security-svc | 0 | python | @group.command('delete')
@click.argument('id', type=int)
@click.pass_context
def delete(ctx, id):
click.echo(click.style(f'{model.delete(id)} record(s) deleted.', bg='green', fg='black'))
ctx.invoke(list) | @group.command('delete')
@click.argument('id', type=int)
@click.pass_context
def delete(ctx, id):
click.echo(click.style(f'{model.delete(id)} record(s) deleted.', bg='green', fg='black'))
ctx.invoke(list)<|docstring|>Manually deletes a record from the table.<|endoftext|> |
756701c45e61b45cfddc2409751ce904757c55e95afab8b5fb83e39f32d74bd0 | @group.command('update')
@click.argument('id', type=int)
@click.argument('first_name')
@click.argument('last_name')
@click.argument('sound', type=int, required=False)
@click.argument('color', type=int, required=False)
@click.pass_context
def update(ctx, id, first_name, last_name, sound, color):
'Manually updates a ... | Manually updates a record in the table. | rfidsecuritysvc/cli/guest.py | update | bcurnow/rfid-security-svc | 0 | python | @group.command('update')
@click.argument('id', type=int)
@click.argument('first_name')
@click.argument('last_name')
@click.argument('sound', type=int, required=False)
@click.argument('color', type=int, required=False)
@click.pass_context
def update(ctx, id, first_name, last_name, sound, color):
try:
mo... | @group.command('update')
@click.argument('id', type=int)
@click.argument('first_name')
@click.argument('last_name')
@click.argument('sound', type=int, required=False)
@click.argument('color', type=int, required=False)
@click.pass_context
def update(ctx, id, first_name, last_name, sound, color):
try:
mo... |
e0232aecbd67cc7d4490a3e598b4252f88f783b737a276f9898880eb733c16d4 | def setStyleSheet(stylesheetname):
'Set stylesheet from the _stylesheets resource (from https://github.com/Alexhuszagh/BreezeStyleSheets).\n\n NOT USED BECAUSE THIS IS UNUSABLE!\n '
if (stylesheetname == 'dark'):
ss = qdarkstyle.load_stylesheet(palette=qdarkstyle.DarkPalette)
elif (stylesheetn... | Set stylesheet from the _stylesheets resource (from https://github.com/Alexhuszagh/BreezeStyleSheets).
NOT USED BECAUSE THIS IS UNUSABLE! | argos/utility.py | setStyleSheet | subhacom/argos | 1 | python | def setStyleSheet(stylesheetname):
'Set stylesheet from the _stylesheets resource (from https://github.com/Alexhuszagh/BreezeStyleSheets).\n\n NOT USED BECAUSE THIS IS UNUSABLE!\n '
if (stylesheetname == 'dark'):
ss = qdarkstyle.load_stylesheet(palette=qdarkstyle.DarkPalette)
elif (stylesheetn... | def setStyleSheet(stylesheetname):
'Set stylesheet from the _stylesheets resource (from https://github.com/Alexhuszagh/BreezeStyleSheets).\n\n NOT USED BECAUSE THIS IS UNUSABLE!\n '
if (stylesheetname == 'dark'):
ss = qdarkstyle.load_stylesheet(palette=qdarkstyle.DarkPalette)
elif (stylesheetn... |
daf772d391934f3ddd7119145d9d5dcbf114daea403da3841e227d83a40802bd | def init():
'Initialize logging and Qt settings.'
qc.QCoreApplication.setOrganizationName('NIH')
qc.QCoreApplication.setOrganizationDomain('nih.gov')
qc.QCoreApplication.setApplicationName('Argos')
settings = qc.QSettings()
logging.basicConfig(stream=sys.stdout, format='%(asctime)s p=%(processNa... | Initialize logging and Qt settings. | argos/utility.py | init | subhacom/argos | 1 | python | def init():
qc.QCoreApplication.setOrganizationName('NIH')
qc.QCoreApplication.setOrganizationDomain('nih.gov')
qc.QCoreApplication.setApplicationName('Argos')
settings = qc.QSettings()
logging.basicConfig(stream=sys.stdout, format='%(asctime)s p=%(processName)s[%(process)d] t=%(threadName)s[%(... | def init():
qc.QCoreApplication.setOrganizationName('NIH')
qc.QCoreApplication.setOrganizationDomain('nih.gov')
qc.QCoreApplication.setApplicationName('Argos')
settings = qc.QSettings()
logging.basicConfig(stream=sys.stdout, format='%(asctime)s p=%(processName)s[%(process)d] t=%(threadName)s[%(... |
55f0b8db79084862ece37333226c378168a9d5e9407796701d3831b806e80d61 | def to_qpolygon(points, scale=1.0):
'Convert a sequence of (x, y) points into a `qg.QPolygonF`.'
return qg.QPolygonF([qc.QPointF((p0 * scale), (p1 * scale)) for (p0, p1) in points]) | Convert a sequence of (x, y) points into a `qg.QPolygonF`. | argos/utility.py | to_qpolygon | subhacom/argos | 1 | python | def to_qpolygon(points, scale=1.0):
return qg.QPolygonF([qc.QPointF((p0 * scale), (p1 * scale)) for (p0, p1) in points]) | def to_qpolygon(points, scale=1.0):
return qg.QPolygonF([qc.QPointF((p0 * scale), (p1 * scale)) for (p0, p1) in points])<|docstring|>Convert a sequence of (x, y) points into a `qg.QPolygonF`.<|endoftext|> |
843aceec090182b793f1707a2b7fdd365f4e8111ed3b590452d6b0dc66ef8b82 | def cond_bbox_overlap(ra, rb, min_iou):
'Check if IoU of axis-aligned bounding boxes overlap.\n\n Parameters\n ----------\n ra, rb: array like\n Rectangles specified as (x, y, w, h)\n min_iou: flat\n Minimum value of IoU to consider overlap.\n\n Returns\n -------\n bool\n T... | Check if IoU of axis-aligned bounding boxes overlap.
Parameters
----------
ra, rb: array like
Rectangles specified as (x, y, w, h)
min_iou: flat
Minimum value of IoU to consider overlap.
Returns
-------
bool
True if `ra` and `rb` have IoU >= `min_iou`. False otherwise. | argos/utility.py | cond_bbox_overlap | subhacom/argos | 1 | python | def cond_bbox_overlap(ra, rb, min_iou):
'Check if IoU of axis-aligned bounding boxes overlap.\n\n Parameters\n ----------\n ra, rb: array like\n Rectangles specified as (x, y, w, h)\n min_iou: flat\n Minimum value of IoU to consider overlap.\n\n Returns\n -------\n bool\n T... | def cond_bbox_overlap(ra, rb, min_iou):
'Check if IoU of axis-aligned bounding boxes overlap.\n\n Parameters\n ----------\n ra, rb: array like\n Rectangles specified as (x, y, w, h)\n min_iou: flat\n Minimum value of IoU to consider overlap.\n\n Returns\n -------\n bool\n T... |
53069f0e7d8dc4d9aae9e49455c9204f014c619a1fef4be8b10758496c7572b0 | def cond_minrect_overlap(ra, rb, min_iou):
'Check if IoU of minimum area (rotated) bounding rectangles is at least\n `min_iou`.\n\n Parameters\n ----------\n ra: array like\n First rectangle defined by the coordinates of four corners.\n rb: array like\n Second rectangle defined by the c... | Check if IoU of minimum area (rotated) bounding rectangles is at least
`min_iou`.
Parameters
----------
ra: array like
First rectangle defined by the coordinates of four corners.
rb: array like
Second rectangle defined by the coordinates of four corners.
min_iou: float
Minimum overlap defined by intersecti... | argos/utility.py | cond_minrect_overlap | subhacom/argos | 1 | python | def cond_minrect_overlap(ra, rb, min_iou):
'Check if IoU of minimum area (rotated) bounding rectangles is at least\n `min_iou`.\n\n Parameters\n ----------\n ra: array like\n First rectangle defined by the coordinates of four corners.\n rb: array like\n Second rectangle defined by the c... | def cond_minrect_overlap(ra, rb, min_iou):
'Check if IoU of minimum area (rotated) bounding rectangles is at least\n `min_iou`.\n\n Parameters\n ----------\n ra: array like\n First rectangle defined by the coordinates of four corners.\n rb: array like\n Second rectangle defined by the c... |
0e4069cf6319e20be1e4a437d9cdc9715c7f522c9f419a017a3beb7d3609cb2e | def cond_proximity(points_a, points_b, min_dist):
'Check if the proximity of two arrays of points is more than `min_dist`.\n\n To take the shape of the object into account, I use the following measure\n of distance:\n scale the distance between centres of mass by the geometric mean of the\n square roots... | Check if the proximity of two arrays of points is more than `min_dist`.
To take the shape of the object into account, I use the following measure
of distance:
scale the distance between centres of mass by the geometric mean of the
square roots of the second moments.
(x1 - x2) / sqrt(sigma_1_x * sigma_2_x)
(y1 - y2) /... | argos/utility.py | cond_proximity | subhacom/argos | 1 | python | def cond_proximity(points_a, points_b, min_dist):
'Check if the proximity of two arrays of points is more than `min_dist`.\n\n To take the shape of the object into account, I use the following measure\n of distance:\n scale the distance between centres of mass by the geometric mean of the\n square roots... | def cond_proximity(points_a, points_b, min_dist):
'Check if the proximity of two arrays of points is more than `min_dist`.\n\n To take the shape of the object into account, I use the following measure\n of distance:\n scale the distance between centres of mass by the geometric mean of the\n square roots... |
9162c9d0949fafaa8ccca8e1b854819d01093d37771bc71d88741aae66309892 | def cv2qimage(frame: np.ndarray, copy: bool=False) -> qg.QImage:
'Convert BGR/gray/bw frame from array into QImage".\n\n OpenCV reads images into 2D or 3D matrix. This function converts it into\n Qt QImage.\n\n Parameters\n ----------\n frame: numpy.ndarray\n Input image data as a 2D (black an... | Convert BGR/gray/bw frame from array into QImage".
OpenCV reads images into 2D or 3D matrix. This function converts it into
Qt QImage.
Parameters
----------
frame: numpy.ndarray
Input image data as a 2D (black and white, gray() or 3D (color, OpenCV
reads images in BGR instead of RGB format) array.
copy: bool,... | argos/utility.py | cv2qimage | subhacom/argos | 1 | python | def cv2qimage(frame: np.ndarray, copy: bool=False) -> qg.QImage:
'Convert BGR/gray/bw frame from array into QImage".\n\n OpenCV reads images into 2D or 3D matrix. This function converts it into\n Qt QImage.\n\n Parameters\n ----------\n frame: numpy.ndarray\n Input image data as a 2D (black an... | def cv2qimage(frame: np.ndarray, copy: bool=False) -> qg.QImage:
'Convert BGR/gray/bw frame from array into QImage".\n\n OpenCV reads images into 2D or 3D matrix. This function converts it into\n Qt QImage.\n\n Parameters\n ----------\n frame: numpy.ndarray\n Input image data as a 2D (black an... |
4257d44bcaeff862fce5adfe1e4b8754e818df60f1a812108c1b399d5a6c8107 | def match_bboxes(id_bboxes: dict, new_bboxes: np.ndarray, boxtype: OutlineStyle, metric: DistanceMetric=DistanceMetric.euclidean, max_dist: float=10000) -> Tuple[(Dict[(int, int)], Set[int], Set[int])]:
'Match the rectangular bounding boxes in `new_bboxes` to the closest\n object in the `id_bboxes` dictionary.\n... | Match the rectangular bounding boxes in `new_bboxes` to the closest
object in the `id_bboxes` dictionary.
Parameters
----------
id_bboxes: dict[int, np.ndarray]
Mapping ids to bounding boxes
new_bboxes: np.ndarray
Array of new bounding boxes to be matched to those in ``id_bboxes``.
boxtype: {OutlineStyle.bbox,... | argos/utility.py | match_bboxes | subhacom/argos | 1 | python | def match_bboxes(id_bboxes: dict, new_bboxes: np.ndarray, boxtype: OutlineStyle, metric: DistanceMetric=DistanceMetric.euclidean, max_dist: float=10000) -> Tuple[(Dict[(int, int)], Set[int], Set[int])]:
'Match the rectangular bounding boxes in `new_bboxes` to the closest\n object in the `id_bboxes` dictionary.\n... | def match_bboxes(id_bboxes: dict, new_bboxes: np.ndarray, boxtype: OutlineStyle, metric: DistanceMetric=DistanceMetric.euclidean, max_dist: float=10000) -> Tuple[(Dict[(int, int)], Set[int], Set[int])]:
'Match the rectangular bounding boxes in `new_bboxes` to the closest\n object in the `id_bboxes` dictionary.\n... |
9c41626a4bf8c4719ecccfb2bba3a8ece732e1d102b05af526fbb71f75bdf923 | def reconnect(signal, newhandler=None, oldhandler=None):
'Disconnect PyQt signal from oldhandler and connect to newhandler'
while True:
try:
if (oldhandler is not None):
signal.disconnect(oldhandler)
else:
signal.disconnect()
except TypeErr... | Disconnect PyQt signal from oldhandler and connect to newhandler | argos/utility.py | reconnect | subhacom/argos | 1 | python | def reconnect(signal, newhandler=None, oldhandler=None):
while True:
try:
if (oldhandler is not None):
signal.disconnect(oldhandler)
else:
signal.disconnect()
except TypeError:
break
if (newhandler is not None):
sig... | def reconnect(signal, newhandler=None, oldhandler=None):
while True:
try:
if (oldhandler is not None):
signal.disconnect(oldhandler)
else:
signal.disconnect()
except TypeError:
break
if (newhandler is not None):
sig... |
b6e83f7a9c0e62632e3be6b6aa2ce2865cc70ae27ad48a5ca42be29c0456f0c9 | def make_color(num: int) -> Tuple[int]:
'Create a random color based on number.\n\n The provided number is passed through the murmur hash function in order\n to generate bytes which are somewhat apart from each other. The three least\n significant byte values are taken as r, g, and b.\n\n Parameters\n ... | Create a random color based on number.
The provided number is passed through the murmur hash function in order
to generate bytes which are somewhat apart from each other. The three least
significant byte values are taken as r, g, and b.
Parameters
----------
num: int
number to use as hash key
Returns
-------
byt... | argos/utility.py | make_color | subhacom/argos | 1 | python | def make_color(num: int) -> Tuple[int]:
'Create a random color based on number.\n\n The provided number is passed through the murmur hash function in order\n to generate bytes which are somewhat apart from each other. The three least\n significant byte values are taken as r, g, and b.\n\n Parameters\n ... | def make_color(num: int) -> Tuple[int]:
'Create a random color based on number.\n\n The provided number is passed through the murmur hash function in order\n to generate bytes which are somewhat apart from each other. The three least\n significant byte values are taken as r, g, and b.\n\n Parameters\n ... |
079790c218ea818fc5969476e6c333ca37802b432ca80370527cda4429797a5c | def get_cmap_color(num, maxnum, cmap):
'Get rgb based on specified colormap `cmap` for index `num` where the\n total range of values is (0, maxnum].\n\n Parameters\n ----------\n num: real number\n Position into colormap.\n maxnum: real number\n Normalize `num` by this value.\n cmap:... | Get rgb based on specified colormap `cmap` for index `num` where the
total range of values is (0, maxnum].
Parameters
----------
num: real number
Position into colormap.
maxnum: real number
Normalize `num` by this value.
cmap: str
Name of colormap
Returns
-------
tuple: (r, g, b)
The red, green and bl... | argos/utility.py | get_cmap_color | subhacom/argos | 1 | python | def get_cmap_color(num, maxnum, cmap):
'Get rgb based on specified colormap `cmap` for index `num` where the\n total range of values is (0, maxnum].\n\n Parameters\n ----------\n num: real number\n Position into colormap.\n maxnum: real number\n Normalize `num` by this value.\n cmap:... | def get_cmap_color(num, maxnum, cmap):
'Get rgb based on specified colormap `cmap` for index `num` where the\n total range of values is (0, maxnum].\n\n Parameters\n ----------\n num: real number\n Position into colormap.\n maxnum: real number\n Normalize `num` by this value.\n cmap:... |
29cea57d5853fa01f4f57192b7398bd33dfec26e4bcb0a74638a9868e6f36357 | def extract_frames(vidfile, nframes, scale=1.0, outdir='.', random=False):
'Extract `nframes` frames from `vidfile` into `outdir`'
cap = cv2.VideoCapture(vidfile)
fname = os.path.basename(vidfile)
prefix = fname.rpartition('.')[0]
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
idx = np.ara... | Extract `nframes` frames from `vidfile` into `outdir` | argos/utility.py | extract_frames | subhacom/argos | 1 | python | def extract_frames(vidfile, nframes, scale=1.0, outdir='.', random=False):
cap = cv2.VideoCapture(vidfile)
fname = os.path.basename(vidfile)
prefix = fname.rpartition('.')[0]
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
idx = np.arange(frame_count, dtype=int)
if (frame_count < nfram... | def extract_frames(vidfile, nframes, scale=1.0, outdir='.', random=False):
cap = cv2.VideoCapture(vidfile)
fname = os.path.basename(vidfile)
prefix = fname.rpartition('.')[0]
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
idx = np.arange(frame_count, dtype=int)
if (frame_count < nfram... |
722c1a6e5a3cbe11725e839f5883dae6ed2bcda2a2edea4aa31a58d10166bc0b | def points2rect(p0: np.ndarray, p1: np.ndarray) -> np.ndarray:
'Convert diagonally opposite vertices into (x, y, w, h) format\n rectangle.\n\n Returns\n -------\n np.ndarray:\n Rectangle with diagonal corners `p0` and `p1` after scaling\n by `scale`. This will work ... | Convert diagonally opposite vertices into (x, y, w, h) format
rectangle.
Returns
-------
np.ndarray:
Rectangle with diagonal corners `p0` and `p1` after scaling
by `scale`. This will work with both top-left - bottom-right
and bottom-left - top-right diagonals. | argos/utility.py | points2rect | subhacom/argos | 1 | python | def points2rect(p0: np.ndarray, p1: np.ndarray) -> np.ndarray:
'Convert diagonally opposite vertices into (x, y, w, h) format\n rectangle.\n\n Returns\n -------\n np.ndarray:\n Rectangle with diagonal corners `p0` and `p1` after scaling\n by `scale`. This will work ... | def points2rect(p0: np.ndarray, p1: np.ndarray) -> np.ndarray:
'Convert diagonally opposite vertices into (x, y, w, h) format\n rectangle.\n\n Returns\n -------\n np.ndarray:\n Rectangle with diagonal corners `p0` and `p1` after scaling\n by `scale`. This will work ... |
e318297c9e10ab5cfc40fd53917f9305f80e2a7baaf2f5601d421acc98e10767 | def rect2points(rect: np.ndarray) -> np.ndarray:
'Convert topleft, width, height format rectangle into four anti-clockwise\n vertices'
return np.vstack([rect[:2], (rect[0], (rect[1] + rect[3])), (rect[:2] + rect[2:]), ((rect[0] + rect[2]), rect[1])]) | Convert topleft, width, height format rectangle into four anti-clockwise
vertices | argos/utility.py | rect2points | subhacom/argos | 1 | python | def rect2points(rect: np.ndarray) -> np.ndarray:
'Convert topleft, width, height format rectangle into four anti-clockwise\n vertices'
return np.vstack([rect[:2], (rect[0], (rect[1] + rect[3])), (rect[:2] + rect[2:]), ((rect[0] + rect[2]), rect[1])]) | def rect2points(rect: np.ndarray) -> np.ndarray:
'Convert topleft, width, height format rectangle into four anti-clockwise\n vertices'
return np.vstack([rect[:2], (rect[0], (rect[1] + rect[3])), (rect[:2] + rect[2:]), ((rect[0] + rect[2]), rect[1])])<|docstring|>Convert topleft, width, height format rect... |
6103ca89e4023ad97e3ca970520f7a08aad46e9339511e96c74188b41a26f936 | def tlwh2xyrh(rect):
'Convert top-left, width, height into center, aspect ratio, height'
return np.array(((rect[0] + (rect[2] / 2.0)), (rect[1] + (rect[3] / 2.0)), (rect[2] / float(rect[3])), rect[3])) | Convert top-left, width, height into center, aspect ratio, height | argos/utility.py | tlwh2xyrh | subhacom/argos | 1 | python | def tlwh2xyrh(rect):
return np.array(((rect[0] + (rect[2] / 2.0)), (rect[1] + (rect[3] / 2.0)), (rect[2] / float(rect[3])), rect[3])) | def tlwh2xyrh(rect):
return np.array(((rect[0] + (rect[2] / 2.0)), (rect[1] + (rect[3] / 2.0)), (rect[2] / float(rect[3])), rect[3]))<|docstring|>Convert top-left, width, height into center, aspect ratio, height<|endoftext|> |
79f59dddbdf1c173a781ab6a717957dca935351571c90489ed77ba240cecfa89 | def xyrh2tlwh(rect: np.ndarray) -> np.ndarray:
'Convert centre, aspect ratio, height into top-left, width, height\n format'
w = (rect[2] * rect[3])
return np.asanyarray(((rect[0] - (w / 2.0)), (rect[1] - (rect[3] / 2.0)), w, rect[3]), dtype=int) | Convert centre, aspect ratio, height into top-left, width, height
format | argos/utility.py | xyrh2tlwh | subhacom/argos | 1 | python | def xyrh2tlwh(rect: np.ndarray) -> np.ndarray:
'Convert centre, aspect ratio, height into top-left, width, height\n format'
w = (rect[2] * rect[3])
return np.asanyarray(((rect[0] - (w / 2.0)), (rect[1] - (rect[3] / 2.0)), w, rect[3]), dtype=int) | def xyrh2tlwh(rect: np.ndarray) -> np.ndarray:
'Convert centre, aspect ratio, height into top-left, width, height\n format'
w = (rect[2] * rect[3])
return np.asanyarray(((rect[0] - (w / 2.0)), (rect[1] - (rect[3] / 2.0)), w, rect[3]), dtype=int)<|docstring|>Convert centre, aspect ratio, height into t... |
2b790ef145f906d90010cba2903a414e12239485b24ca2afe436ab625776dc7c | def rect_intersection(ra: np.ndarray, rb: np.ndarray) -> np.ndarray:
'Find if two axis-aligned rectangles intersect.\n\n This runs almost 50 times faster than Polygon intersection in shapely.\n and ~5 times faster than cv2.intersectConvexConvex.\n\n Parameters\n ----------\n ra: n... | Find if two axis-aligned rectangles intersect.
This runs almost 50 times faster than Polygon intersection in shapely.
and ~5 times faster than cv2.intersectConvexConvex.
Parameters
----------
ra: np.ndarray
rb: np.ndarray
Rectangles specified as (x, y, w, h) where (x, y) is the coordinate
of the lower left co... | argos/utility.py | rect_intersection | subhacom/argos | 1 | python | def rect_intersection(ra: np.ndarray, rb: np.ndarray) -> np.ndarray:
'Find if two axis-aligned rectangles intersect.\n\n This runs almost 50 times faster than Polygon intersection in shapely.\n and ~5 times faster than cv2.intersectConvexConvex.\n\n Parameters\n ----------\n ra: n... | def rect_intersection(ra: np.ndarray, rb: np.ndarray) -> np.ndarray:
'Find if two axis-aligned rectangles intersect.\n\n This runs almost 50 times faster than Polygon intersection in shapely.\n and ~5 times faster than cv2.intersectConvexConvex.\n\n Parameters\n ----------\n ra: n... |
63deae5b5d49aa1e6ea915995b4b869f93d910a437976f90c70cc394bc409c7e | def rect_iou(ra: np.ndarray, rb: np.ndarray) -> float:
'Compute Intersection over Union of two axis-aligned rectangles.\n\n This is the ratio of the are of intersection to the area of the union\n of the two rectangles.\n\n Parameters\n ----------\n ra: np.ndarray\n rb: np.n... | Compute Intersection over Union of two axis-aligned rectangles.
This is the ratio of the are of intersection to the area of the union
of the two rectangles.
Parameters
----------
ra: np.ndarray
rb: np.ndarray
Axis aligned rectangles specified as (x, y, w, h) where (x, y) is
the position of the lower left corn... | argos/utility.py | rect_iou | subhacom/argos | 1 | python | def rect_iou(ra: np.ndarray, rb: np.ndarray) -> float:
'Compute Intersection over Union of two axis-aligned rectangles.\n\n This is the ratio of the are of intersection to the area of the union\n of the two rectangles.\n\n Parameters\n ----------\n ra: np.ndarray\n rb: np.n... | def rect_iou(ra: np.ndarray, rb: np.ndarray) -> float:
'Compute Intersection over Union of two axis-aligned rectangles.\n\n This is the ratio of the are of intersection to the area of the union\n of the two rectangles.\n\n Parameters\n ----------\n ra: np.ndarray\n rb: np.n... |
3c20ec57fdc3e590f284ddd05ec65bb23f8f5a1ed5fc4ae1382060dd3a0430b7 | def rect_ios(ra: np.ndarray, rb: np.ndarray) -> float:
'Compute intersection over area of smaller of two axis-aligned\n rectangles.\n\n This is the ratio of the area of intersection to the area of the smaller\n of the two rectangles.\n\n Parameters\n ----------\n ra: np.nda... | Compute intersection over area of smaller of two axis-aligned
rectangles.
This is the ratio of the area of intersection to the area of the smaller
of the two rectangles.
Parameters
----------
ra: np.ndarray
rb: np.ndarray
Axis aligned rectangles specified as (x, y, w, h) where (x, y) is
the position of the lo... | argos/utility.py | rect_ios | subhacom/argos | 1 | python | def rect_ios(ra: np.ndarray, rb: np.ndarray) -> float:
'Compute intersection over area of smaller of two axis-aligned\n rectangles.\n\n This is the ratio of the area of intersection to the area of the smaller\n of the two rectangles.\n\n Parameters\n ----------\n ra: np.nda... | def rect_ios(ra: np.ndarray, rb: np.ndarray) -> float:
'Compute intersection over area of smaller of two axis-aligned\n rectangles.\n\n This is the ratio of the area of intersection to the area of the smaller\n of the two rectangles.\n\n Parameters\n ----------\n ra: np.nda... |
c06d778958fda6fbf798a47ab04600c58848a452a6f7482d816da2ad4e874bf3 | def pairwise_distance(new_bboxes: np.ndarray, bboxes: np.ndarray, boxtype: OutlineStyle, metric: DistanceMetric) -> np.ndarray:
'Computes the distance between all pairs of rectangles.\n\n Parameters\n ----------\n new_bboxes: np.ndarray\n Array of bounding boxes, each row as (x, y, w,... | Computes the distance between all pairs of rectangles.
Parameters
----------
new_bboxes: np.ndarray
Array of bounding boxes, each row as (x, y, w, h)
bboxes: np.ndarray
Array of bounding boxes, each row as (x, y, w, h)
boxtype: {OutlineStyle.bbox, OulineStyle.minrect}
OutlineStyle.bbox for axis aligned rectan... | argos/utility.py | pairwise_distance | subhacom/argos | 1 | python | def pairwise_distance(new_bboxes: np.ndarray, bboxes: np.ndarray, boxtype: OutlineStyle, metric: DistanceMetric) -> np.ndarray:
'Computes the distance between all pairs of rectangles.\n\n Parameters\n ----------\n new_bboxes: np.ndarray\n Array of bounding boxes, each row as (x, y, w,... | def pairwise_distance(new_bboxes: np.ndarray, bboxes: np.ndarray, boxtype: OutlineStyle, metric: DistanceMetric) -> np.ndarray:
'Computes the distance between all pairs of rectangles.\n\n Parameters\n ----------\n new_bboxes: np.ndarray\n Array of bounding boxes, each row as (x, y, w,... |
7e51b637c95bb695d2f45aba5b76fce7014eb9c2e5eb180af3c712f237df530a | def forward(self, x):
'\n Feed forward the model.\n \n Args:\n x (torch.Tensor): Input data.\n \n Raises:\n -\n\n Returns:\n x (torch.Tensor): Output of the feed forward execution.\n \n '
x = self.bn1(self.pool(F.relu(s... | Feed forward the model.
Args:
x (torch.Tensor): Input data.
Raises:
-
Returns:
x (torch.Tensor): Output of the feed forward execution. | project_cnn/cnn.py | forward | vsaveris/deep-learning | 0 | python | def forward(self, x):
'\n Feed forward the model.\n \n Args:\n x (torch.Tensor): Input data.\n \n Raises:\n -\n\n Returns:\n x (torch.Tensor): Output of the feed forward execution.\n \n '
x = self.bn1(self.pool(F.relu(s... | def forward(self, x):
'\n Feed forward the model.\n \n Args:\n x (torch.Tensor): Input data.\n \n Raises:\n -\n\n Returns:\n x (torch.Tensor): Output of the feed forward execution.\n \n '
x = self.bn1(self.pool(F.relu(s... |
d63c4e4a7766eac736902b263222214c728574cff69a606ed05f4ed38ed07a50 | def __init__(self, max_failures=None):
"Creates a new Benchmark.\n\n Args:\n max_failures: The number of story run's failures before bailing\n from executing subsequent page runs. If None, we never bail.\n "
self._expectations = None
self._max_failures = max_failures | Creates a new Benchmark.
Args:
max_failures: The number of story run's failures before bailing
from executing subsequent page runs. If None, we never bail. | telemetry/telemetry/benchmark.py | __init__ | tdresser/catapult-csm | 4 | python | def __init__(self, max_failures=None):
"Creates a new Benchmark.\n\n Args:\n max_failures: The number of story run's failures before bailing\n from executing subsequent page runs. If None, we never bail.\n "
self._expectations = None
self._max_failures = max_failures | def __init__(self, max_failures=None):
"Creates a new Benchmark.\n\n Args:\n max_failures: The number of story run's failures before bailing\n from executing subsequent page runs. If None, we never bail.\n "
self._expectations = None
self._max_failures = max_failures<|docstring|>Creates ... |
5fd62d2674a4f650614f6551fac62abde71d5bf933148d14fe09bce598a79b46 | @classmethod
def ShouldDisable(cls, possible_browser):
'Override this method to disable a benchmark under specific conditions.\n\n Supports logic too complex for simple Enabled and Disabled decorators.\n Decorators are still respected in cases where this function returns False.\n '
return False | Override this method to disable a benchmark under specific conditions.
Supports logic too complex for simple Enabled and Disabled decorators.
Decorators are still respected in cases where this function returns False. | telemetry/telemetry/benchmark.py | ShouldDisable | tdresser/catapult-csm | 4 | python | @classmethod
def ShouldDisable(cls, possible_browser):
'Override this method to disable a benchmark under specific conditions.\n\n Supports logic too complex for simple Enabled and Disabled decorators.\n Decorators are still respected in cases where this function returns False.\n '
return False | @classmethod
def ShouldDisable(cls, possible_browser):
'Override this method to disable a benchmark under specific conditions.\n\n Supports logic too complex for simple Enabled and Disabled decorators.\n Decorators are still respected in cases where this function returns False.\n '
return False<|doc... |
75ff77d8db41f683c3a71e34a6d7a96e8346c8309e740d18703ab36708de81cb | def Run(self, finder_options):
'Do not override this method.'
return story_runner.RunBenchmark(self, finder_options) | Do not override this method. | telemetry/telemetry/benchmark.py | Run | tdresser/catapult-csm | 4 | python | def Run(self, finder_options):
return story_runner.RunBenchmark(self, finder_options) | def Run(self, finder_options):
return story_runner.RunBenchmark(self, finder_options)<|docstring|>Do not override this method.<|endoftext|> |
629f54e84d42aae4504f16e9f25bc0efcfba3c9b6a95b5dfc34acb49ca3fb67b | @classmethod
def ShouldTearDownStateAfterEachStoryRun(cls):
'Override to specify whether to tear down state after each story run.\n\n Tearing down all states after each story run, e.g., clearing profiles,\n stopping the browser, stopping local server, etc. So the browser will not be\n reused among multiple... | Override to specify whether to tear down state after each story run.
Tearing down all states after each story run, e.g., clearing profiles,
stopping the browser, stopping local server, etc. So the browser will not be
reused among multiple stories. This is particularly useful to get the
startup part of launching the br... | telemetry/telemetry/benchmark.py | ShouldTearDownStateAfterEachStoryRun | tdresser/catapult-csm | 4 | python | @classmethod
def ShouldTearDownStateAfterEachStoryRun(cls):
'Override to specify whether to tear down state after each story run.\n\n Tearing down all states after each story run, e.g., clearing profiles,\n stopping the browser, stopping local server, etc. So the browser will not be\n reused among multiple... | @classmethod
def ShouldTearDownStateAfterEachStoryRun(cls):
'Override to specify whether to tear down state after each story run.\n\n Tearing down all states after each story run, e.g., clearing profiles,\n stopping the browser, stopping local server, etc. So the browser will not be\n reused among multiple... |
a5acf980952e56ae225a697cdb7c369bb35071fcc07205298bd0d2097e8bcc01 | @classmethod
def ShouldTearDownStateAfterEachStorySetRun(cls):
'Override to specify whether to tear down state after each story set run.\n\n Defaults to True in order to reset the state and make individual story set\n repeats more independent of each other. The intended effect is to average\n out noise in ... | Override to specify whether to tear down state after each story set run.
Defaults to True in order to reset the state and make individual story set
repeats more independent of each other. The intended effect is to average
out noise in measurements between repeats.
Long running benchmarks willing to stess test the bro... | telemetry/telemetry/benchmark.py | ShouldTearDownStateAfterEachStorySetRun | tdresser/catapult-csm | 4 | python | @classmethod
def ShouldTearDownStateAfterEachStorySetRun(cls):
'Override to specify whether to tear down state after each story set run.\n\n Defaults to True in order to reset the state and make individual story set\n repeats more independent of each other. The intended effect is to average\n out noise in ... | @classmethod
def ShouldTearDownStateAfterEachStorySetRun(cls):
'Override to specify whether to tear down state after each story set run.\n\n Defaults to True in order to reset the state and make individual story set\n repeats more independent of each other. The intended effect is to average\n out noise in ... |
a6b1043e15350620b13c6a410fb8d6ecaa3cd208f83df7c34208c294d3a5ac79 | def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options):
'Setup tracing categories associated with default trace option.' | Setup tracing categories associated with default trace option. | telemetry/telemetry/benchmark.py | SetupBenchmarkDefaultTraceRerunOptions | tdresser/catapult-csm | 4 | python | def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options):
| def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options):
<|docstring|>Setup tracing categories associated with default trace option.<|endoftext|> |
3ed4aa6d7a31e78d1d0f790463b50401944852b3bb60bfbbbfdbecbfb8d8bb7d | def SetupBenchmarkDebugTraceRerunOptions(self, tbm_options):
'Setup tracing categories associated with debug trace option.' | Setup tracing categories associated with debug trace option. | telemetry/telemetry/benchmark.py | SetupBenchmarkDebugTraceRerunOptions | tdresser/catapult-csm | 4 | python | def SetupBenchmarkDebugTraceRerunOptions(self, tbm_options):
| def SetupBenchmarkDebugTraceRerunOptions(self, tbm_options):
<|docstring|>Setup tracing categories associated with debug trace option.<|endoftext|> |
6a69a453a5ca09a3bbd54d43b2a601f8bfa5f5509a7d27168cfa0c1e0fc35e2d | @classmethod
def ValueCanBeAddedPredicate(cls, value, is_first_result):
'Returns whether |value| can be added to the test results.\n\n Override this method to customize the logic of adding values to test\n results.\n\n Args:\n value: a value.Value instance (except failure.FailureValue,\n skip.S... | Returns whether |value| can be added to the test results.
Override this method to customize the logic of adding values to test
results.
Args:
value: a value.Value instance (except failure.FailureValue,
skip.SkipValue or trace.TraceValue which will always be added).
is_first_result: True if |value| is the firs... | telemetry/telemetry/benchmark.py | ValueCanBeAddedPredicate | tdresser/catapult-csm | 4 | python | @classmethod
def ValueCanBeAddedPredicate(cls, value, is_first_result):
'Returns whether |value| can be added to the test results.\n\n Override this method to customize the logic of adding values to test\n results.\n\n Args:\n value: a value.Value instance (except failure.FailureValue,\n skip.S... | @classmethod
def ValueCanBeAddedPredicate(cls, value, is_first_result):
'Returns whether |value| can be added to the test results.\n\n Override this method to customize the logic of adding values to test\n results.\n\n Args:\n value: a value.Value instance (except failure.FailureValue,\n skip.S... |
6ae0d6a0e40c308ebbd9c421c068d6f21aa07c21aee071c360e7b7757754bd76 | def CustomizeBrowserOptions(self, options):
'Add browser options that are required by this benchmark.' | Add browser options that are required by this benchmark. | telemetry/telemetry/benchmark.py | CustomizeBrowserOptions | tdresser/catapult-csm | 4 | python | def CustomizeBrowserOptions(self, options):
| def CustomizeBrowserOptions(self, options):
<|docstring|>Add browser options that are required by this benchmark.<|endoftext|> |
5cb77061689bbe1373429100ef98442e1dc23806f029ff1449e3fe40ccfe20a9 | def GetBugComponents(self):
"Returns a GenericSet Diagnostic containing the benchmark's Monorail\n component.\n\n Returns:\n GenericSet Diagnostic with the benchmark's bug component name\n "
benchmark_component = decorators.GetComponent(self)
component_diagnostic_value = ([benchmark_compone... | Returns a GenericSet Diagnostic containing the benchmark's Monorail
component.
Returns:
GenericSet Diagnostic with the benchmark's bug component name | telemetry/telemetry/benchmark.py | GetBugComponents | tdresser/catapult-csm | 4 | python | def GetBugComponents(self):
"Returns a GenericSet Diagnostic containing the benchmark's Monorail\n component.\n\n Returns:\n GenericSet Diagnostic with the benchmark's bug component name\n "
benchmark_component = decorators.GetComponent(self)
component_diagnostic_value = ([benchmark_compone... | def GetBugComponents(self):
"Returns a GenericSet Diagnostic containing the benchmark's Monorail\n component.\n\n Returns:\n GenericSet Diagnostic with the benchmark's bug component name\n "
benchmark_component = decorators.GetComponent(self)
component_diagnostic_value = ([benchmark_compone... |
cc5ccae8c05c03041076feeeb98a1a0ade2fe3bc63f9b481ba2075e3676d9805 | def GetOwners(self):
"Returns a Generic Diagnostic containing the benchmark's owners' emails\n in a list.\n\n Returns:\n Diagnostic with a list of the benchmark's owners' emails\n "
return histogram.GenericSet((decorators.GetEmails(self) or [])) | Returns a Generic Diagnostic containing the benchmark's owners' emails
in a list.
Returns:
Diagnostic with a list of the benchmark's owners' emails | telemetry/telemetry/benchmark.py | GetOwners | tdresser/catapult-csm | 4 | python | def GetOwners(self):
"Returns a Generic Diagnostic containing the benchmark's owners' emails\n in a list.\n\n Returns:\n Diagnostic with a list of the benchmark's owners' emails\n "
return histogram.GenericSet((decorators.GetEmails(self) or [])) | def GetOwners(self):
"Returns a Generic Diagnostic containing the benchmark's owners' emails\n in a list.\n\n Returns:\n Diagnostic with a list of the benchmark's owners' emails\n "
return histogram.GenericSet((decorators.GetEmails(self) or []))<|docstring|>Returns a Generic Diagnostic containi... |
b05ca62487cd660107a7dc1f9adb4c64574ddb9c2f6f8f9258a9fdf650d11b3f | @decorators.Deprecated(2017, 7, 29, 'Use CreateCoreTimelineBasedMeasurementOptions instead.')
def CreateTimelineBasedMeasurementOptions(self):
'See CreateCoreTimelineBasedMeasurementOptions.'
return self.CreateCoreTimelineBasedMeasurementOptions() | See CreateCoreTimelineBasedMeasurementOptions. | telemetry/telemetry/benchmark.py | CreateTimelineBasedMeasurementOptions | tdresser/catapult-csm | 4 | python | @decorators.Deprecated(2017, 7, 29, 'Use CreateCoreTimelineBasedMeasurementOptions instead.')
def CreateTimelineBasedMeasurementOptions(self):
return self.CreateCoreTimelineBasedMeasurementOptions() | @decorators.Deprecated(2017, 7, 29, 'Use CreateCoreTimelineBasedMeasurementOptions instead.')
def CreateTimelineBasedMeasurementOptions(self):
return self.CreateCoreTimelineBasedMeasurementOptions()<|docstring|>See CreateCoreTimelineBasedMeasurementOptions.<|endoftext|> |
64c1af7336b67175c5b3025e77ac1caf6bf0a88f3faff197c2a9c49d3bff18d7 | def CreateCoreTimelineBasedMeasurementOptions(self):
'Return the base TimelineBasedMeasurementOptions for this Benchmark.\n\n Additional chrome and atrace categories can be appended when running the\n benchmark with the --extra-chrome-categories and --extra-atrace-categories\n flags.\n\n Override this m... | Return the base TimelineBasedMeasurementOptions for this Benchmark.
Additional chrome and atrace categories can be appended when running the
benchmark with the --extra-chrome-categories and --extra-atrace-categories
flags.
Override this method to configure a TimelineBasedMeasurement benchmark. If
this is not a Timeli... | telemetry/telemetry/benchmark.py | CreateCoreTimelineBasedMeasurementOptions | tdresser/catapult-csm | 4 | python | def CreateCoreTimelineBasedMeasurementOptions(self):
'Return the base TimelineBasedMeasurementOptions for this Benchmark.\n\n Additional chrome and atrace categories can be appended when running the\n benchmark with the --extra-chrome-categories and --extra-atrace-categories\n flags.\n\n Override this m... | def CreateCoreTimelineBasedMeasurementOptions(self):
'Return the base TimelineBasedMeasurementOptions for this Benchmark.\n\n Additional chrome and atrace categories can be appended when running the\n benchmark with the --extra-chrome-categories and --extra-atrace-categories\n flags.\n\n Override this m... |
93374d170e4df7453d061296ffac3c5eb2ac7d1c2ed299cf59d5990a1e3b2afe | def _GetTimelineBasedMeasurementOptions(self, options):
'Return all timeline based measurements for the curren benchmark run.\n\n This includes the benchmark-configured measurements in\n CreateCoreTimelineBasedMeasurementOptions as well as the user-flag-\n configured options from --extra-chrome-categories ... | Return all timeline based measurements for the curren benchmark run.
This includes the benchmark-configured measurements in
CreateCoreTimelineBasedMeasurementOptions as well as the user-flag-
configured options from --extra-chrome-categories and
--extra-atrace-categories. | telemetry/telemetry/benchmark.py | _GetTimelineBasedMeasurementOptions | tdresser/catapult-csm | 4 | python | def _GetTimelineBasedMeasurementOptions(self, options):
'Return all timeline based measurements for the curren benchmark run.\n\n This includes the benchmark-configured measurements in\n CreateCoreTimelineBasedMeasurementOptions as well as the user-flag-\n configured options from --extra-chrome-categories ... | def _GetTimelineBasedMeasurementOptions(self, options):
'Return all timeline based measurements for the curren benchmark run.\n\n This includes the benchmark-configured measurements in\n CreateCoreTimelineBasedMeasurementOptions as well as the user-flag-\n configured options from --extra-chrome-categories ... |
822dc929c75e6d936303d8164c5cbdd089010993f40ef92e8809f1a01a277e86 | def CreatePageTest(self, options):
'Return the PageTest for this Benchmark.\n\n Override this method for PageTest tests.\n Override, CreateCoreTimelineBasedMeasurementOptions to configure\n TimelineBasedMeasurement tests. Do not override both methods.\n\n Args:\n options: a browser_options.BrowserF... | Return the PageTest for this Benchmark.
Override this method for PageTest tests.
Override, CreateCoreTimelineBasedMeasurementOptions to configure
TimelineBasedMeasurement tests. Do not override both methods.
Args:
options: a browser_options.BrowserFinderOptions instance
Returns:
|test()| if |test| is a PageTest c... | telemetry/telemetry/benchmark.py | CreatePageTest | tdresser/catapult-csm | 4 | python | def CreatePageTest(self, options):
'Return the PageTest for this Benchmark.\n\n Override this method for PageTest tests.\n Override, CreateCoreTimelineBasedMeasurementOptions to configure\n TimelineBasedMeasurement tests. Do not override both methods.\n\n Args:\n options: a browser_options.BrowserF... | def CreatePageTest(self, options):
'Return the PageTest for this Benchmark.\n\n Override this method for PageTest tests.\n Override, CreateCoreTimelineBasedMeasurementOptions to configure\n TimelineBasedMeasurement tests. Do not override both methods.\n\n Args:\n options: a browser_options.BrowserF... |
174a8e0f885cb59701a70e6d9c6583c509cb45232308ee9a57a722b05952cebb | def CreateStorySet(self, options):
'Creates the instance of StorySet used to run the benchmark.\n\n Can be overridden by subclasses.\n '
del options
if (not self.page_set):
raise NotImplementedError('This test has no "page_set" attribute.')
return self.page_set() | Creates the instance of StorySet used to run the benchmark.
Can be overridden by subclasses. | telemetry/telemetry/benchmark.py | CreateStorySet | tdresser/catapult-csm | 4 | python | def CreateStorySet(self, options):
'Creates the instance of StorySet used to run the benchmark.\n\n Can be overridden by subclasses.\n '
del options
if (not self.page_set):
raise NotImplementedError('This test has no "page_set" attribute.')
return self.page_set() | def CreateStorySet(self, options):
'Creates the instance of StorySet used to run the benchmark.\n\n Can be overridden by subclasses.\n '
del options
if (not self.page_set):
raise NotImplementedError('This test has no "page_set" attribute.')
return self.page_set()<|docstring|>Creates the in... |
92b8d21cd9417ab984be8db1a6cbcdb65378408e02421767e918cabfb60f058d | def InitializeExpectations(self):
'Returns StoryExpectation object.\n\n This is a wrapper for GetExpectations. The user overrides GetExpectatoins\n in the benchmark class to have it use the correct expectations. This is what\n story_runner.py uses to get the expectations.\n '
if (not self._expectati... | Returns StoryExpectation object.
This is a wrapper for GetExpectations. The user overrides GetExpectatoins
in the benchmark class to have it use the correct expectations. This is what
story_runner.py uses to get the expectations. | telemetry/telemetry/benchmark.py | InitializeExpectations | tdresser/catapult-csm | 4 | python | def InitializeExpectations(self):
'Returns StoryExpectation object.\n\n This is a wrapper for GetExpectations. The user overrides GetExpectatoins\n in the benchmark class to have it use the correct expectations. This is what\n story_runner.py uses to get the expectations.\n '
if (not self._expectati... | def InitializeExpectations(self):
'Returns StoryExpectation object.\n\n This is a wrapper for GetExpectations. The user overrides GetExpectatoins\n in the benchmark class to have it use the correct expectations. This is what\n story_runner.py uses to get the expectations.\n '
if (not self._expectati... |
50ebc9f767c89afba63885c56534ac140da4e6c2b0a504e83b10b26db32ebbc1 | def GetExpectations(self):
'Returns a StoryExpectation object.\n\n This object is used to determine what stories are disabled. This needs to be\n overridden by the subclass. It defaults to an empty expectations object.\n '
return expectations.StoryExpectations() | Returns a StoryExpectation object.
This object is used to determine what stories are disabled. This needs to be
overridden by the subclass. It defaults to an empty expectations object. | telemetry/telemetry/benchmark.py | GetExpectations | tdresser/catapult-csm | 4 | python | def GetExpectations(self):
'Returns a StoryExpectation object.\n\n This object is used to determine what stories are disabled. This needs to be\n overridden by the subclass. It defaults to an empty expectations object.\n '
return expectations.StoryExpectations() | def GetExpectations(self):
'Returns a StoryExpectation object.\n\n This object is used to determine what stories are disabled. This needs to be\n overridden by the subclass. It defaults to an empty expectations object.\n '
return expectations.StoryExpectations()<|docstring|>Returns a StoryExpectation o... |
39d7d43fd0b0afd7854c2a6b2a95b38c4f61eef7de499355e7b0a042a332e61f | def _dct(self, x, y, u, v, n):
' calculate discrete cosine transformation '
a = tf.math.cos((((((2 * x) + 1) * u) * math.pi) / (2 * n)))
b = tf.math.cos((((((2 * y) + 1) * v) * math.pi) / (2 * n)))
return (a * b) | calculate discrete cosine transformation | noise/dct.py | _dct | marco-willi/HiDDeN-tensorflow | 0 | python | def _dct(self, x, y, u, v, n):
' '
a = tf.math.cos((((((2 * x) + 1) * u) * math.pi) / (2 * n)))
b = tf.math.cos((((((2 * y) + 1) * v) * math.pi) / (2 * n)))
return (a * b) | def _dct(self, x, y, u, v, n):
' '
a = tf.math.cos((((((2 * x) + 1) * u) * math.pi) / (2 * n)))
b = tf.math.cos((((((2 * y) + 1) * v) * math.pi) / (2 * n)))
return (a * b)<|docstring|>calculate discrete cosine transformation<|endoftext|> |
ec782feb3b2aeb26a58072239867258f606fdf1460b65bb664c0aecaa28116b6 | def _dct_kernel(self, n, normalize):
' Build DCT 2D Convolutional Kernels '
full_kernel = ((n * n), (n * n))
G = np.zeros(shape=full_kernel)
for x in range(0, n):
for y in range(0, n):
for u in range(0, n):
for v in range(0, n):
val = self._dct(x, ... | Build DCT 2D Convolutional Kernels | noise/dct.py | _dct_kernel | marco-willi/HiDDeN-tensorflow | 0 | python | def _dct_kernel(self, n, normalize):
' '
full_kernel = ((n * n), (n * n))
G = np.zeros(shape=full_kernel)
for x in range(0, n):
for y in range(0, n):
for u in range(0, n):
for v in range(0, n):
val = self._dct(x, y, u, v, n)
if... | def _dct_kernel(self, n, normalize):
' '
full_kernel = ((n * n), (n * n))
G = np.zeros(shape=full_kernel)
for x in range(0, n):
for y in range(0, n):
for u in range(0, n):
for v in range(0, n):
val = self._dct(x, y, u, v, n)
if... |
7cf8167c04e082aac4064119b06dbffb380389ba6abe2b81253578b928bb7997 | def _mask_filters(self, res_channel, mask):
' Mask filters according to mask '
mask = tf.reshape(mask, shape=(res_channel.shape[(- 1)],))
mask = tf.cast(mask, tf.float32)
return tf.multiply(res_channel, mask) | Mask filters according to mask | noise/dct.py | _mask_filters | marco-willi/HiDDeN-tensorflow | 0 | python | def _mask_filters(self, res_channel, mask):
' '
mask = tf.reshape(mask, shape=(res_channel.shape[(- 1)],))
mask = tf.cast(mask, tf.float32)
return tf.multiply(res_channel, mask) | def _mask_filters(self, res_channel, mask):
' '
mask = tf.reshape(mask, shape=(res_channel.shape[(- 1)],))
mask = tf.cast(mask, tf.float32)
return tf.multiply(res_channel, mask)<|docstring|>Mask filters according to mask<|endoftext|> |
de2c70aaa28d3d34c5f5d6044db74df2c4a20f5dfdbc91e173709b224e28bda6 | def __call__(self, inputs, masks=None):
'\n Args:\n inputs: tensor (batch, x, y, n x n, c)\n masks: list of c (n x n) binary masks\n '
n_channels = inputs.shape[(- 1)]
if (masks is not None):
assert (len(masks) == n_channels), 'length of masks ({}) mus... | Args:
inputs: tensor (batch, x, y, n x n, c)
masks: list of c (n x n) binary masks | noise/dct.py | __call__ | marco-willi/HiDDeN-tensorflow | 0 | python | def __call__(self, inputs, masks=None):
'\n Args:\n inputs: tensor (batch, x, y, n x n, c)\n masks: list of c (n x n) binary masks\n '
n_channels = inputs.shape[(- 1)]
if (masks is not None):
assert (len(masks) == n_channels), 'length of masks ({}) mus... | def __call__(self, inputs, masks=None):
'\n Args:\n inputs: tensor (batch, x, y, n x n, c)\n masks: list of c (n x n) binary masks\n '
n_channels = inputs.shape[(- 1)]
if (masks is not None):
assert (len(masks) == n_channels), 'length of masks ({}) mus... |
d4c8b303c540695dd315f2badb30d4ac09827d6f58b13cba03b00c2743997c95 | def __init__(self, path: str):
'Initializes Dotfile class.'
self.path = Path(path)
self.local_base = 'dotfiles'
self.absolute = self._get_absolute(self.path)
self.category = self._get_path_category(self.path)
self.factory = DotfileHandlerFactory() | Initializes Dotfile class. | handlers/dotfile_handler.py | __init__ | tomislavperich/nomad | 0 | python | def __init__(self, path: str):
self.path = Path(path)
self.local_base = 'dotfiles'
self.absolute = self._get_absolute(self.path)
self.category = self._get_path_category(self.path)
self.factory = DotfileHandlerFactory() | def __init__(self, path: str):
self.path = Path(path)
self.local_base = 'dotfiles'
self.absolute = self._get_absolute(self.path)
self.category = self._get_path_category(self.path)
self.factory = DotfileHandlerFactory()<|docstring|>Initializes Dotfile class.<|endoftext|> |
b9308d241608bfcf34912c3e2b58bcecfd290df3037b805d9269f1a6565c0f70 | def _get_absolute(self, path: Path) -> Path:
'Resolves given path to absolute.\n\n Args:\n path: Path to be resolved.\n\n Returns:\n Path: resolved, absolute Path.\n '
return path.expanduser().absolute() | Resolves given path to absolute.
Args:
path: Path to be resolved.
Returns:
Path: resolved, absolute Path. | handlers/dotfile_handler.py | _get_absolute | tomislavperich/nomad | 0 | python | def _get_absolute(self, path: Path) -> Path:
'Resolves given path to absolute.\n\n Args:\n path: Path to be resolved.\n\n Returns:\n Path: resolved, absolute Path.\n '
return path.expanduser().absolute() | def _get_absolute(self, path: Path) -> Path:
'Resolves given path to absolute.\n\n Args:\n path: Path to be resolved.\n\n Returns:\n Path: resolved, absolute Path.\n '
return path.expanduser().absolute()<|docstring|>Resolves given path to absolute.
Args:
path: Pat... |
41036983710b76e93935139e71a60a2c505b43df5bdd45d86fb1eecab11c8bcb | def _get_path_type(self, path: Path) -> str:
'Determines path type.\n\n Determines whether the path is a file or a directory.\n\n Args:\n path: Path to the dotfile.\n\n Returns:\n str: A string indicating path type.\n '
if path.is_dir():
return 'dir'
... | Determines path type.
Determines whether the path is a file or a directory.
Args:
path: Path to the dotfile.
Returns:
str: A string indicating path type. | handlers/dotfile_handler.py | _get_path_type | tomislavperich/nomad | 0 | python | def _get_path_type(self, path: Path) -> str:
'Determines path type.\n\n Determines whether the path is a file or a directory.\n\n Args:\n path: Path to the dotfile.\n\n Returns:\n str: A string indicating path type.\n '
if path.is_dir():
return 'dir'
... | def _get_path_type(self, path: Path) -> str:
'Determines path type.\n\n Determines whether the path is a file or a directory.\n\n Args:\n path: Path to the dotfile.\n\n Returns:\n str: A string indicating path type.\n '
if path.is_dir():
return 'dir'
... |
399801753458cb20dc810294a6a1f0bf814448e73cd77bde5c1d7cc5c9f999ad | def _get_path_category(self, path: Path) -> str:
'Determines path category.\n\n Determines path category for placing files locally.\n\n Args:\n path: Path str to determine category of.\n\n Returns:\n str: Category in which file belongs.\n '
if str(path).startswi... | Determines path category.
Determines path category for placing files locally.
Args:
path: Path str to determine category of.
Returns:
str: Category in which file belongs. | handlers/dotfile_handler.py | _get_path_category | tomislavperich/nomad | 0 | python | def _get_path_category(self, path: Path) -> str:
'Determines path category.\n\n Determines path category for placing files locally.\n\n Args:\n path: Path str to determine category of.\n\n Returns:\n str: Category in which file belongs.\n '
if str(path).startswi... | def _get_path_category(self, path: Path) -> str:
'Determines path category.\n\n Determines path category for placing files locally.\n\n Args:\n path: Path str to determine category of.\n\n Returns:\n str: Category in which file belongs.\n '
if str(path).startswi... |
ea17f4763927a62e42190ee67b04f1ea64e787d38a1f197e3070423bda34f999 | def _get_local_dest(self, path: Path) -> Path:
'Gets local destination for copying.\n\n Gets local destination based on source path.\n\n Args:\n path: Path to build destination path from.\n\n Returns:\n str: Path pointing to local destination.\n '
dest = ''
... | Gets local destination for copying.
Gets local destination based on source path.
Args:
path: Path to build destination path from.
Returns:
str: Path pointing to local destination. | handlers/dotfile_handler.py | _get_local_dest | tomislavperich/nomad | 0 | python | def _get_local_dest(self, path: Path) -> Path:
'Gets local destination for copying.\n\n Gets local destination based on source path.\n\n Args:\n path: Path to build destination path from.\n\n Returns:\n str: Path pointing to local destination.\n '
dest =
if... | def _get_local_dest(self, path: Path) -> Path:
'Gets local destination for copying.\n\n Gets local destination based on source path.\n\n Args:\n path: Path to build destination path from.\n\n Returns:\n str: Path pointing to local destination.\n '
dest =
if... |
04fd5c28098981d21b976189fd5999ffd8abc36fd7f73c4ae5da40c87acc5afe | def _get_local_src(self, path: Path) -> Path:
'Gets local source path for copying.\n\n Gets local source path based on passed source path.\n\n Args:\n path: Path to build local source path from.\n\n Returns:\n str: Path pointing to local source.\n '
src = ''
... | Gets local source path for copying.
Gets local source path based on passed source path.
Args:
path: Path to build local source path from.
Returns:
str: Path pointing to local source. | handlers/dotfile_handler.py | _get_local_src | tomislavperich/nomad | 0 | python | def _get_local_src(self, path: Path) -> Path:
'Gets local source path for copying.\n\n Gets local source path based on passed source path.\n\n Args:\n path: Path to build local source path from.\n\n Returns:\n str: Path pointing to local source.\n '
src =
i... | def _get_local_src(self, path: Path) -> Path:
'Gets local source path for copying.\n\n Gets local source path based on passed source path.\n\n Args:\n path: Path to build local source path from.\n\n Returns:\n str: Path pointing to local source.\n '
src =
i... |
fb9e53da6997cce51e771d8128e10662a634172611edf77c99990b23e390e4c5 | def update(self) -> None:
'Fetches dotfiles from given path'
destination = self._get_local_dest(self.path)
try:
path_type = self._get_path_type(self.absolute)
handler = self.factory.get_handler(path_type)
handler.update(self.absolute, destination)
except Exception as e:
p... | Fetches dotfiles from given path | handlers/dotfile_handler.py | update | tomislavperich/nomad | 0 | python | def update(self) -> None:
destination = self._get_local_dest(self.path)
try:
path_type = self._get_path_type(self.absolute)
handler = self.factory.get_handler(path_type)
handler.update(self.absolute, destination)
except Exception as e:
print(f'[!] Skipping {self.path}: {... | def update(self) -> None:
destination = self._get_local_dest(self.path)
try:
path_type = self._get_path_type(self.absolute)
handler = self.factory.get_handler(path_type)
handler.update(self.absolute, destination)
except Exception as e:
print(f'[!] Skipping {self.path}: {... |
c8957070e3e0443a3296d401c8289fbe82d199f851c18db6a8ceaf5296281123 | def bootstrap(self, backup: bool, overwrite: bool) -> None:
'Bootstraps dotfiles to given path.'
src = self._get_local_src(self.path)
try:
path_type = self._get_path_type(src)
handler = self.factory.get_handler(path_type)
handler.bootstrap(src, self.absolute, backup, overwrite)
e... | Bootstraps dotfiles to given path. | handlers/dotfile_handler.py | bootstrap | tomislavperich/nomad | 0 | python | def bootstrap(self, backup: bool, overwrite: bool) -> None:
src = self._get_local_src(self.path)
try:
path_type = self._get_path_type(src)
handler = self.factory.get_handler(path_type)
handler.bootstrap(src, self.absolute, backup, overwrite)
except Exception as e:
print(... | def bootstrap(self, backup: bool, overwrite: bool) -> None:
src = self._get_local_src(self.path)
try:
path_type = self._get_path_type(src)
handler = self.factory.get_handler(path_type)
handler.bootstrap(src, self.absolute, backup, overwrite)
except Exception as e:
print(... |
ed10c555baa875ac2a4f7283f5c79b74fd9e5df622c6aa89314f6e3fbc0a988f | def is_matrix_spd(matrix: np.ndarray) -> bool:
'\n Mengembalikan True jika matriks\n input adalah definit positif simetris.\n Mengembalikan False sebaliknya.\n >>> import numpy as np\n >>> dimension = 3\n >>> set_matrix = create_spd_matrix(dimension)\n >>> is_matrix_spd(set_matrix)\n True\n ... | Mengembalikan True jika matriks
input adalah definit positif simetris.
Mengembalikan False sebaliknya.
>>> import numpy as np
>>> dimension = 3
>>> set_matrix = create_spd_matrix(dimension)
>>> is_matrix_spd(set_matrix)
True | implementation/linear_algebra/conjugate_gradient.py | is_matrix_spd | reskimulud/Python | 79 | python | def is_matrix_spd(matrix: np.ndarray) -> bool:
'\n Mengembalikan True jika matriks\n input adalah definit positif simetris.\n Mengembalikan False sebaliknya.\n >>> import numpy as np\n >>> dimension = 3\n >>> set_matrix = create_spd_matrix(dimension)\n >>> is_matrix_spd(set_matrix)\n True\n ... | def is_matrix_spd(matrix: np.ndarray) -> bool:
'\n Mengembalikan True jika matriks\n input adalah definit positif simetris.\n Mengembalikan False sebaliknya.\n >>> import numpy as np\n >>> dimension = 3\n >>> set_matrix = create_spd_matrix(dimension)\n >>> is_matrix_spd(set_matrix)\n True\n ... |
56db85872710d8f7f9713dc4cc45b3b4d5792ba73338c60cde7f82cd88123e22 | def create_spd_matrix(dimension: int) -> Any:
'\n Mengembalikan matriks definit positif\n simetris yang diberi dimensi.\n '
random_matrix = np.random.randn(dimension, dimension)
spd_matrix = np.dot(random_matrix, random_matrix.T)
assert is_matrix_spd(spd_matrix)
return spd_matrix | Mengembalikan matriks definit positif
simetris yang diberi dimensi. | implementation/linear_algebra/conjugate_gradient.py | create_spd_matrix | reskimulud/Python | 79 | python | def create_spd_matrix(dimension: int) -> Any:
'\n Mengembalikan matriks definit positif\n simetris yang diberi dimensi.\n '
random_matrix = np.random.randn(dimension, dimension)
spd_matrix = np.dot(random_matrix, random_matrix.T)
assert is_matrix_spd(spd_matrix)
return spd_matrix | def create_spd_matrix(dimension: int) -> Any:
'\n Mengembalikan matriks definit positif\n simetris yang diberi dimensi.\n '
random_matrix = np.random.randn(dimension, dimension)
spd_matrix = np.dot(random_matrix, random_matrix.T)
assert is_matrix_spd(spd_matrix)
return spd_matrix<|docstring... |
2bd3bfcb05fcd6b744b3fbc600736b8214683fffdd214ea36d9ab1bff3e14635 | def conjugate_gradient(spd_matrix, load_vector, max_iterations=1000, tol=1e-08):
'\n return solusi linear sistem np.dot(spd_matrix, x) = b\n >>> import numpy as np\n >>> spd_matrix_1= np.array([\n ... [8.73256573, -5.02034289, -2.68709226],\n ... [-5.02034289, 3.78188322, 0.91980451],\n ... [-2.... | return solusi linear sistem np.dot(spd_matrix, x) = b
>>> import numpy as np
>>> spd_matrix_1= np.array([
... [8.73256573, -5.02034289, -2.68709226],
... [-5.02034289, 3.78188322, 0.91980451],
... [-2.68709226, 0.91980451, 1.94746467]])
>>> b = np.array([
... [-5.80872761],
... [ 3.23807431],
... [ 1.95381422]])
>>... | implementation/linear_algebra/conjugate_gradient.py | conjugate_gradient | reskimulud/Python | 79 | python | def conjugate_gradient(spd_matrix, load_vector, max_iterations=1000, tol=1e-08):
'\n return solusi linear sistem np.dot(spd_matrix, x) = b\n >>> import numpy as np\n >>> spd_matrix_1= np.array([\n ... [8.73256573, -5.02034289, -2.68709226],\n ... [-5.02034289, 3.78188322, 0.91980451],\n ... [-2.... | def conjugate_gradient(spd_matrix, load_vector, max_iterations=1000, tol=1e-08):
'\n return solusi linear sistem np.dot(spd_matrix, x) = b\n >>> import numpy as np\n >>> spd_matrix_1= np.array([\n ... [8.73256573, -5.02034289, -2.68709226],\n ... [-5.02034289, 3.78188322, 0.91980451],\n ... [-2.... |
ad95a5993472ee314211e221c4d69dccffa1e154072e4f7c109f4adeef8279b6 | def testing_conjugate_gradient() -> None:
'\n >>> testing_conjugate_gradient()\n '
dimension = 3
spd_matrix = create_spd_matrix(dimension)
x_true = np.random.randn(dimension, 1)
b = np.dot(spd_matrix, x_true)
x_numpy = np.linalg.solve(spd_matrix, b)
x_conjugate_gradient = conjugate_gra... | >>> testing_conjugate_gradient() | implementation/linear_algebra/conjugate_gradient.py | testing_conjugate_gradient | reskimulud/Python | 79 | python | def testing_conjugate_gradient() -> None:
'\n \n '
dimension = 3
spd_matrix = create_spd_matrix(dimension)
x_true = np.random.randn(dimension, 1)
b = np.dot(spd_matrix, x_true)
x_numpy = np.linalg.solve(spd_matrix, b)
x_conjugate_gradient = conjugate_gradient(spd_matrix, b)
assert ... | def testing_conjugate_gradient() -> None:
'\n \n '
dimension = 3
spd_matrix = create_spd_matrix(dimension)
x_true = np.random.randn(dimension, 1)
b = np.dot(spd_matrix, x_true)
x_numpy = np.linalg.solve(spd_matrix, b)
x_conjugate_gradient = conjugate_gradient(spd_matrix, b)
assert ... |
67a58621ee17448f1e63bc14b6c02f17319ef350d6f2d8cc4bda1e82dc7af658 | def smallest_size_at_least(height, width, resize_min):
'Computes new shape with the smallest side equal to `smallest_side`.\n\n Computes new shape with the smallest side equal to `smallest_side` while\n preserving the original aspect ratio.\n\n Args:\n height: an int32 scalar tensor indicating the cur... | Computes new shape with the smallest side equal to `smallest_side`.
Computes new shape with the smallest side equal to `smallest_side` while
preserving the original aspect ratio.
Args:
height: an int32 scalar tensor indicating the current height.
width: an int32 scalar tensor indicating the current width.
resiz... | dataset/preprocess_dataset.py | smallest_size_at_least | bolide2006/r329_aipu | 0 | python | def smallest_size_at_least(height, width, resize_min):
'Computes new shape with the smallest side equal to `smallest_side`.\n\n Computes new shape with the smallest side equal to `smallest_side` while\n preserving the original aspect ratio.\n\n Args:\n height: an int32 scalar tensor indicating the cur... | def smallest_size_at_least(height, width, resize_min):
'Computes new shape with the smallest side equal to `smallest_side`.\n\n Computes new shape with the smallest side equal to `smallest_side` while\n preserving the original aspect ratio.\n\n Args:\n height: an int32 scalar tensor indicating the cur... |
a7ae15b1c6e25d6748c1a69cec955f72803ace5684400043e05bd92a86945e8f | def resize_image(image, height, width, method='BILINEAR'):
'Simple wrapper around tf.resize_images.\n\n This is primarily to make sure we use the same `ResizeMethod` and other\n details each time.\n\n Args:\n image: A 3-D image `Tensor`.\n height: The target height for the resized image.\n w... | Simple wrapper around tf.resize_images.
This is primarily to make sure we use the same `ResizeMethod` and other
details each time.
Args:
image: A 3-D image `Tensor`.
height: The target height for the resized image.
width: The target width for the resized image.
Returns:
resized_image: A 3-D tensor containing... | dataset/preprocess_dataset.py | resize_image | bolide2006/r329_aipu | 0 | python | def resize_image(image, height, width, method='BILINEAR'):
'Simple wrapper around tf.resize_images.\n\n This is primarily to make sure we use the same `ResizeMethod` and other\n details each time.\n\n Args:\n image: A 3-D image `Tensor`.\n height: The target height for the resized image.\n w... | def resize_image(image, height, width, method='BILINEAR'):
'Simple wrapper around tf.resize_images.\n\n This is primarily to make sure we use the same `ResizeMethod` and other\n details each time.\n\n Args:\n image: A 3-D image `Tensor`.\n height: The target height for the resized image.\n w... |
cc4dd2d1c3afe57dceba709c14567bb6ca56b9801700d9e4451b6491d601bc48 | def aspect_preserving_resize(image, resize_min, channels=3, method='BILINEAR'):
'Resize images preserving the original aspect ratio.\n\n Args:\n image: A 3-D image `Tensor`.\n resize_min: A python integer or scalar `Tensor` indicating the size of\n the smallest side after resize.\n\n Returns:... | Resize images preserving the original aspect ratio.
Args:
image: A 3-D image `Tensor`.
resize_min: A python integer or scalar `Tensor` indicating the size of
the smallest side after resize.
Returns:
resized_image: A 3-D tensor containing the resized image. | dataset/preprocess_dataset.py | aspect_preserving_resize | bolide2006/r329_aipu | 0 | python | def aspect_preserving_resize(image, resize_min, channels=3, method='BILINEAR'):
'Resize images preserving the original aspect ratio.\n\n Args:\n image: A 3-D image `Tensor`.\n resize_min: A python integer or scalar `Tensor` indicating the size of\n the smallest side after resize.\n\n Returns:... | def aspect_preserving_resize(image, resize_min, channels=3, method='BILINEAR'):
'Resize images preserving the original aspect ratio.\n\n Args:\n image: A 3-D image `Tensor`.\n resize_min: A python integer or scalar `Tensor` indicating the size of\n the smallest side after resize.\n\n Returns:... |
c310ea0577d8785bcf5b7961cfa0d754ab325588584bf72e938cd98ef17db505 | def central_crop(image, crop_height, crop_width, channels=3):
'Performs central crops of the given image list.\n\n Args:\n image: a 3-D image tensor\n crop_height: the height of the image following the crop.\n crop_width: the width of the image following the crop.\n\n Returns:\n 3-D tensor... | Performs central crops of the given image list.
Args:
image: a 3-D image tensor
crop_height: the height of the image following the crop.
crop_width: the width of the image following the crop.
Returns:
3-D tensor with cropped image. | dataset/preprocess_dataset.py | central_crop | bolide2006/r329_aipu | 0 | python | def central_crop(image, crop_height, crop_width, channels=3):
'Performs central crops of the given image list.\n\n Args:\n image: a 3-D image tensor\n crop_height: the height of the image following the crop.\n crop_width: the width of the image following the crop.\n\n Returns:\n 3-D tensor... | def central_crop(image, crop_height, crop_width, channels=3):
'Performs central crops of the given image list.\n\n Args:\n image: a 3-D image tensor\n crop_height: the height of the image following the crop.\n crop_width: the width of the image following the crop.\n\n Returns:\n 3-D tensor... |
3a1ff86ccbe563ab787b43a78ada8d16a1fefbef6b032b1a10ce5aadcae55203 | def _block_diag(arrays):
' Create block-diagonal matrix from `arrays`. '
result = None
for arr in arrays:
arr[(arr == (- 0))] = 0
if (result is None):
result = arr
else:
(r_rows, r_cols) = result.shape
(a_rows, a_cols) = arr.shape
resul... | Create block-diagonal matrix from `arrays`. | openmdao.lib/src/openmdao/lib/geometry/stl_group.py | _block_diag | mjfwest/OpenMDAO-Framework | 69 | python | def _block_diag(arrays):
' '
result = None
for arr in arrays:
arr[(arr == (- 0))] = 0
if (result is None):
result = arr
else:
(r_rows, r_cols) = result.shape
(a_rows, a_cols) = arr.shape
result = np.vstack((np.hstack((result, np.zeros(... | def _block_diag(arrays):
' '
result = None
for arr in arrays:
arr[(arr == (- 0))] = 0
if (result is None):
result = arr
else:
(r_rows, r_cols) = result.shape
(a_rows, a_cols) = arr.shape
result = np.vstack((np.hstack((result, np.zeros(... |
ff79cbf4e166fa28984c0b436788c4b62d15f24b47a0cb7cfa7c3c62be996ff6 | def _build_io(self):
" returns a dictionary of io sets key'd to component names"
self.comp_param_count = {}
params = []
for comp in self._comps:
name = comp.name
if isinstance(comp, Body):
val = comp.delta_C[(:, 0)]
meta = {'value': val, 'iotype': 'in', 'shape': v... | returns a dictionary of io sets key'd to component names | openmdao.lib/src/openmdao/lib/geometry/stl_group.py | _build_io | mjfwest/OpenMDAO-Framework | 69 | python | def _build_io(self):
" "
self.comp_param_count = {}
params = []
for comp in self._comps:
name = comp.name
if isinstance(comp, Body):
val = comp.delta_C[(:, 0)]
meta = {'value': val, 'iotype': 'in', 'shape': val.shape, 'desc': 'axial location of control points for ... | def _build_io(self):
" "
self.comp_param_count = {}
params = []
for comp in self._comps:
name = comp.name
if isinstance(comp, Body):
val = comp.delta_C[(:, 0)]
meta = {'value': val, 'iotype': 'in', 'shape': val.shape, 'desc': 'axial location of control points for ... |
f7e5f6d23caf396cb9460746104596114c189b19f69055fea78af7f0019beaa3 | def deform(self, **kwargs):
' deforms the geometry applying the new locations for the control points, given by body name'
for (name, delta_C) in kwargs.iteritems():
i = self._i_comps[name]
comp = self._comps[i]
if isinstance(comp, Body):
comp.deform(delta_C)
else:
... | deforms the geometry applying the new locations for the control points, given by body name | openmdao.lib/src/openmdao/lib/geometry/stl_group.py | deform | mjfwest/OpenMDAO-Framework | 69 | python | def deform(self, **kwargs):
' '
for (name, delta_C) in kwargs.iteritems():
i = self._i_comps[name]
comp = self._comps[i]
if isinstance(comp, Body):
comp.deform(delta_C)
else:
comp.deform(*delta_C)
self.list_parameters() | def deform(self, **kwargs):
' '
for (name, delta_C) in kwargs.iteritems():
i = self._i_comps[name]
comp = self._comps[i]
if isinstance(comp, Body):
comp.deform(delta_C)
else:
comp.deform(*delta_C)
self.list_parameters()<|docstring|>deforms the geom... |
c5db9bc63ae298da32a9ba56af4ddce26a2cb526e5d556ce3d39261ee7c37ecc | def _build_ascii_stl(self, facets):
'returns a list of ascii lines for the stl file '
lines = ['solid ffd_geom']
for facet in facets:
lines.append(ASCII_FACET.format(face=facet))
lines.append('endsolid ffd_geom')
return lines | returns a list of ascii lines for the stl file | openmdao.lib/src/openmdao/lib/geometry/stl_group.py | _build_ascii_stl | mjfwest/OpenMDAO-Framework | 69 | python | def _build_ascii_stl(self, facets):
' '
lines = ['solid ffd_geom']
for facet in facets:
lines.append(ASCII_FACET.format(face=facet))
lines.append('endsolid ffd_geom')
return lines | def _build_ascii_stl(self, facets):
' '
lines = ['solid ffd_geom']
for facet in facets:
lines.append(ASCII_FACET.format(face=facet))
lines.append('endsolid ffd_geom')
return lines<|docstring|>returns a list of ascii lines for the stl file<|endoftext|> |
af9fc9e8e7c236fe488e3f9954d6d4e61cd81fcb76b6496ca7f435abd094325e | def _build_binary_stl(self, facets):
'returns a string of binary binary data for the stl file'
lines = [struct.pack(BINARY_HEADER, b'Binary STL Writer', len(facets))]
for facet in facets:
facet = list(facet)
facet.append(0)
lines.append(struct.pack(BINARY_FACET, *facet))
return l... | returns a string of binary binary data for the stl file | openmdao.lib/src/openmdao/lib/geometry/stl_group.py | _build_binary_stl | mjfwest/OpenMDAO-Framework | 69 | python | def _build_binary_stl(self, facets):
lines = [struct.pack(BINARY_HEADER, b'Binary STL Writer', len(facets))]
for facet in facets:
facet = list(facet)
facet.append(0)
lines.append(struct.pack(BINARY_FACET, *facet))
return lines | def _build_binary_stl(self, facets):
lines = [struct.pack(BINARY_HEADER, b'Binary STL Writer', len(facets))]
for facet in facets:
facet = list(facet)
facet.append(0)
lines.append(struct.pack(BINARY_FACET, *facet))
return lines<|docstring|>returns a string of binary binary data f... |
0e778363d2721445b57cf5c63aaf783969b7ba8acfc16b547a2b04ce42313777 | def writeSTL(self, file_name, ascii=False):
'outputs an STL file'
facets = []
for comp in self._comps:
if isinstance(comp, Body):
facets.extend(comp.stl.get_facets())
else:
facets.extend(comp.outer_stl.get_facets())
facets.extend(comp.inner_stl.get_facets(... | outputs an STL file | openmdao.lib/src/openmdao/lib/geometry/stl_group.py | writeSTL | mjfwest/OpenMDAO-Framework | 69 | python | def writeSTL(self, file_name, ascii=False):
facets = []
for comp in self._comps:
if isinstance(comp, Body):
facets.extend(comp.stl.get_facets())
else:
facets.extend(comp.outer_stl.get_facets())
facets.extend(comp.inner_stl.get_facets())
f = open(file_... | def writeSTL(self, file_name, ascii=False):
facets = []
for comp in self._comps:
if isinstance(comp, Body):
facets.extend(comp.stl.get_facets())
else:
facets.extend(comp.outer_stl.get_facets())
facets.extend(comp.inner_stl.get_facets())
f = open(file_... |
216a23bd1431c8cf120baf9c515f620ae9752bc52b2c421a64be8d68d45ad77e | def writeFEPOINT(self, stream):
'writes out a new FEPOINT file with the given name, using the supplied points.\n derivs is of size (3,len(points),len(control_points)), giving matricies of\n X,Y,Z drivatives\n\n jacobian should have a shape of (len(points),len(control_points))'
self.provideJ... | writes out a new FEPOINT file with the given name, using the supplied points.
derivs is of size (3,len(points),len(control_points)), giving matricies of
X,Y,Z drivatives
jacobian should have a shape of (len(points),len(control_points)) | openmdao.lib/src/openmdao/lib/geometry/stl_group.py | writeFEPOINT | mjfwest/OpenMDAO-Framework | 69 | python | def writeFEPOINT(self, stream):
'writes out a new FEPOINT file with the given name, using the supplied points.\n derivs is of size (3,len(points),len(control_points)), giving matricies of\n X,Y,Z drivatives\n\n jacobian should have a shape of (len(points),len(control_points))'
self.provideJ... | def writeFEPOINT(self, stream):
'writes out a new FEPOINT file with the given name, using the supplied points.\n derivs is of size (3,len(points),len(control_points)), giving matricies of\n X,Y,Z drivatives\n\n jacobian should have a shape of (len(points),len(control_points))'
self.provideJ... |
c871307e65e0083e315b3a1d7272819f622f8fdf13ed7bf2898586ab97578234 | def read_corpus():
'读取语料,每行一个json\n '
while True:
with open(corpus_path) as f:
for l in f:
(yield json.loads(l)) | 读取语料,每行一个json | simbert_sim.py | read_corpus | baokui/simbert | 0 | python | def read_corpus():
'\n '
while True:
with open(corpus_path) as f:
for l in f:
(yield json.loads(l)) | def read_corpus():
'\n '
while True:
with open(corpus_path) as f:
for l in f:
(yield json.loads(l))<|docstring|>读取语料,每行一个json<|endoftext|> |
1e7348a5eab099d2db86c8d08fb91ac1269df85f39b3d4c19ec02aa6322236b5 | def truncate(text):
'截断句子\n '
(seps, strips) = (u'\n。!?!?;;,, ', u';;,, ')
return text_segmentate(text, (maxlen - 2), seps, strips)[0] | 截断句子 | simbert_sim.py | truncate | baokui/simbert | 0 | python | def truncate(text):
'\n '
(seps, strips) = (u'\n。!?!?;;,, ', u';;,, ')
return text_segmentate(text, (maxlen - 2), seps, strips)[0] | def truncate(text):
'\n '
(seps, strips) = (u'\n。!?!?;;,, ', u';;,, ')
return text_segmentate(text, (maxlen - 2), seps, strips)[0]<|docstring|>截断句子<|endoftext|> |
7e508cbc47524de233c45cbb92c0624f1eb324eed1c5e0ba6eae83e92493fcb4 | def gen_synonyms(text, n=100, k=20):
'"含义: 产生sent的n个相似句,然后返回最相似的k个。\n 做法:用seq2seq生成,并用encoder算相似度并排序。\n 效果:\n >>> gen_synonyms(u\'微信和支付宝哪个好?\')\n [\n u\'微信和支付宝,哪个好?\',\n u\'微信和支付宝哪个好\',\n u\'支付宝和微信哪个好\',\n u\'支付宝和微信哪个好啊\',\n u\'微信和支付宝那个好用?\'... | "含义: 产生sent的n个相似句,然后返回最相似的k个。
做法:用seq2seq生成,并用encoder算相似度并排序。
效果:
>>> gen_synonyms(u'微信和支付宝哪个好?')
[
u'微信和支付宝,哪个好?',
u'微信和支付宝哪个好',
u'支付宝和微信哪个好',
u'支付宝和微信哪个好啊',
u'微信和支付宝那个好用?',
u'微信和支付宝哪个好用',
u'支付宝和微信那个更好',
u'支付宝和微信哪个好用',
u'微信和支付宝用起来哪个好?',
... | simbert_sim.py | gen_synonyms | baokui/simbert | 0 | python | def gen_synonyms(text, n=100, k=20):
'"含义: 产生sent的n个相似句,然后返回最相似的k个。\n 做法:用seq2seq生成,并用encoder算相似度并排序。\n 效果:\n >>> gen_synonyms(u\'微信和支付宝哪个好?\')\n [\n u\'微信和支付宝,哪个好?\',\n u\'微信和支付宝哪个好\',\n u\'支付宝和微信哪个好\',\n u\'支付宝和微信哪个好啊\',\n u\'微信和支付宝那个好用?\'... | def gen_synonyms(text, n=100, k=20):
'"含义: 产生sent的n个相似句,然后返回最相似的k个。\n 做法:用seq2seq生成,并用encoder算相似度并排序。\n 效果:\n >>> gen_synonyms(u\'微信和支付宝哪个好?\')\n [\n u\'微信和支付宝,哪个好?\',\n u\'微信和支付宝哪个好\',\n u\'支付宝和微信哪个好\',\n u\'支付宝和微信哪个好啊\',\n u\'微信和支付宝那个好用?\'... |
f59f99a5db95da73b745c5b952df56506003c1b800f44856d61f5ed2a7a13cd7 | def just_show():
'随机观察一些样本的效果\n '
S = random.sample(TrnData, k=10)
for s in S:
try:
print('###########################')
print('------------------')
print((u'原句子:%s' % s['input']))
print(u'同义句子:')
r = gen_synonyms(s['click'], 10, 10)
... | 随机观察一些样本的效果 | simbert_sim.py | just_show | baokui/simbert | 0 | python | def just_show():
'\n '
S = random.sample(TrnData, k=10)
for s in S:
try:
print('###########################')
print('------------------')
print((u'原句子:%s' % s['input']))
print(u'同义句子:')
r = gen_synonyms(s['click'], 10, 10)
fo... | def just_show():
'\n '
S = random.sample(TrnData, k=10)
for s in S:
try:
print('###########################')
print('------------------')
print((u'原句子:%s' % s['input']))
print(u'同义句子:')
r = gen_synonyms(s['click'], 10, 10)
fo... |
b8a658d3665433788cf321b0219acf08f3dfdf610eedd6f775df0c71c33e922f | def __init__(__self__, *, vpc_id: pulumi.Input[str], assign_ipv6_address_on_creation: Optional[pulumi.Input[bool]]=None, availability_zone: Optional[pulumi.Input[str]]=None, availability_zone_id: Optional[pulumi.Input[str]]=None, cidr_block: Optional[pulumi.Input[str]]=None, enable_dns64: Optional[pulumi.Input[bool]]=N... | The set of arguments for constructing a Subnet resource. | sdk/python/pulumi_aws_native/ec2/subnet.py | __init__ | pulumi/pulumi-aws-native | 29 | python | def __init__(__self__, *, vpc_id: pulumi.Input[str], assign_ipv6_address_on_creation: Optional[pulumi.Input[bool]]=None, availability_zone: Optional[pulumi.Input[str]]=None, availability_zone_id: Optional[pulumi.Input[str]]=None, cidr_block: Optional[pulumi.Input[str]]=None, enable_dns64: Optional[pulumi.Input[bool]]=N... | def __init__(__self__, *, vpc_id: pulumi.Input[str], assign_ipv6_address_on_creation: Optional[pulumi.Input[bool]]=None, availability_zone: Optional[pulumi.Input[str]]=None, availability_zone_id: Optional[pulumi.Input[str]]=None, cidr_block: Optional[pulumi.Input[str]]=None, enable_dns64: Optional[pulumi.Input[bool]]=N... |
5393f4d8eb647a36fd4907361ce1dc12369303a9709eabff58c05c92ec331efa | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, assign_ipv6_address_on_creation: Optional[pulumi.Input[bool]]=None, availability_zone: Optional[pulumi.Input[str]]=None, availability_zone_id: Optional[pulumi.Input[str]]=None, cidr_block: Optional[pulumi.Input[str]]=None,... | Resource Type definition for AWS::EC2::Subnet
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource. | sdk/python/pulumi_aws_native/ec2/subnet.py | __init__ | pulumi/pulumi-aws-native | 29 | python | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, assign_ipv6_address_on_creation: Optional[pulumi.Input[bool]]=None, availability_zone: Optional[pulumi.Input[str]]=None, availability_zone_id: Optional[pulumi.Input[str]]=None, cidr_block: Optional[pulumi.Input[str]]=None,... | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, assign_ipv6_address_on_creation: Optional[pulumi.Input[bool]]=None, availability_zone: Optional[pulumi.Input[str]]=None, availability_zone_id: Optional[pulumi.Input[str]]=None, cidr_block: Optional[pulumi.Input[str]]=None,... |
40e9c9542b6ddcc67d348ce0bd2d5d79bbf7e648aa338c5c43c85cce55317580 | @overload
def __init__(__self__, resource_name: str, args: SubnetArgs, opts: Optional[pulumi.ResourceOptions]=None):
"\n Resource Type definition for AWS::EC2::Subnet\n\n :param str resource_name: The name of the resource.\n :param SubnetArgs args: The arguments to use to populate this resource... | Resource Type definition for AWS::EC2::Subnet
:param str resource_name: The name of the resource.
:param SubnetArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource. | sdk/python/pulumi_aws_native/ec2/subnet.py | __init__ | pulumi/pulumi-aws-native | 29 | python | @overload
def __init__(__self__, resource_name: str, args: SubnetArgs, opts: Optional[pulumi.ResourceOptions]=None):
"\n Resource Type definition for AWS::EC2::Subnet\n\n :param str resource_name: The name of the resource.\n :param SubnetArgs args: The arguments to use to populate this resource... | @overload
def __init__(__self__, resource_name: str, args: SubnetArgs, opts: Optional[pulumi.ResourceOptions]=None):
"\n Resource Type definition for AWS::EC2::Subnet\n\n :param str resource_name: The name of the resource.\n :param SubnetArgs args: The arguments to use to populate this resource... |
860218a028505098e8be91473c27b8e76f21a1702fc4cfafa24e5118e426df09 | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'Subnet':
"\n Get an existing Subnet resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique na... | Get an existing Subnet resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for ... | sdk/python/pulumi_aws_native/ec2/subnet.py | get | pulumi/pulumi-aws-native | 29 | python | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'Subnet':
"\n Get an existing Subnet resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique na... | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'Subnet':
"\n Get an existing Subnet resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique na... |
a9cdf47e586f64d1121407f57c9c5928c4754ed33b5cf70acd553cad78e8e102 | @pytest.fixture(name='simple_sim')
def sim_fixt(tmp_path):
'Pytest fixture for basic simulation class'
dic = {'Grid': {'N': 2, 'r_min': 0, 'r_max': 1}, 'Clock': {'start_time': 0, 'end_time': 10, 'num_steps': 100}, 'Tools': {'ExampleTool': [{'custom_name': 'example'}, {'custom_name': 'example2'}]}, 'PhysicsModul... | Pytest fixture for basic simulation class | tests/test_core.py | sim_fixt | kpf59/turbopy | 0 | python | @pytest.fixture(name='simple_sim')
def sim_fixt(tmp_path):
dic = {'Grid': {'N': 2, 'r_min': 0, 'r_max': 1}, 'Clock': {'start_time': 0, 'end_time': 10, 'num_steps': 100}, 'Tools': {'ExampleTool': [{'custom_name': 'example'}, {'custom_name': 'example2'}]}, 'PhysicsModules': {'ExampleModule': {}}, 'Diagnostics': ... | @pytest.fixture(name='simple_sim')
def sim_fixt(tmp_path):
dic = {'Grid': {'N': 2, 'r_min': 0, 'r_max': 1}, 'Clock': {'start_time': 0, 'end_time': 10, 'num_steps': 100}, 'Tools': {'ExampleTool': [{'custom_name': 'example'}, {'custom_name': 'example2'}]}, 'PhysicsModules': {'ExampleModule': {}}, 'Diagnostics': ... |
ce514e70506a31ff3a1145ee3a83c0afe305b2020bd5b6f41c251bc529c59d26 | def test_simulation_init_should_create_class_instance_when_called(simple_sim, tmp_path):
'Test init method for Simulation class'
assert (simple_sim.physics_modules == [])
assert (simple_sim.compute_tools == [])
assert (simple_sim.diagnostics == [])
assert (simple_sim.grid is None)
assert (simple... | Test init method for Simulation class | tests/test_core.py | test_simulation_init_should_create_class_instance_when_called | kpf59/turbopy | 0 | python | def test_simulation_init_should_create_class_instance_when_called(simple_sim, tmp_path):
assert (simple_sim.physics_modules == [])
assert (simple_sim.compute_tools == [])
assert (simple_sim.diagnostics == [])
assert (simple_sim.grid is None)
assert (simple_sim.clock is None)
assert (simple_... | def test_simulation_init_should_create_class_instance_when_called(simple_sim, tmp_path):
assert (simple_sim.physics_modules == [])
assert (simple_sim.compute_tools == [])
assert (simple_sim.diagnostics == [])
assert (simple_sim.grid is None)
assert (simple_sim.clock is None)
assert (simple_... |
ac3ddd15502e63e0fd74c58d2b882e59239f5eb7248fe8b28f09730d991007b4 | def test_read_grid_from_input_should_set_grid_attr_when_called(simple_sim):
'Test read_grid_from_input method in Simulation class'
simple_sim.read_grid_from_input()
assert (simple_sim.grid.num_points == 2)
assert (simple_sim.grid.r_min == 0)
assert (simple_sim.grid.r_max == 1) | Test read_grid_from_input method in Simulation class | tests/test_core.py | test_read_grid_from_input_should_set_grid_attr_when_called | kpf59/turbopy | 0 | python | def test_read_grid_from_input_should_set_grid_attr_when_called(simple_sim):
simple_sim.read_grid_from_input()
assert (simple_sim.grid.num_points == 2)
assert (simple_sim.grid.r_min == 0)
assert (simple_sim.grid.r_max == 1) | def test_read_grid_from_input_should_set_grid_attr_when_called(simple_sim):
simple_sim.read_grid_from_input()
assert (simple_sim.grid.num_points == 2)
assert (simple_sim.grid.r_min == 0)
assert (simple_sim.grid.r_max == 1)<|docstring|>Test read_grid_from_input method in Simulation class<|endoftext|... |
6385a4b251f5f8b667060a6310dced8e880a5fcbc4aec6e87505fb58d2dc76c1 | def test_gridless_simulation(tmp_path):
'Test a gridless simulation'
dic = {'Clock': {'start_time': 0, 'end_time': 10, 'num_steps': 100}, 'Tools': {'ExampleTool': [{'custom_name': 'example'}, {'custom_name': 'example2'}]}, 'PhysicsModules': {'ExampleModule': {}}, 'Diagnostics': {'directory': f'{tmp_path}/defaul... | Test a gridless simulation | tests/test_core.py | test_gridless_simulation | kpf59/turbopy | 0 | python | def test_gridless_simulation(tmp_path):
dic = {'Clock': {'start_time': 0, 'end_time': 10, 'num_steps': 100}, 'Tools': {'ExampleTool': [{'custom_name': 'example'}, {'custom_name': 'example2'}]}, 'PhysicsModules': {'ExampleModule': {}}, 'Diagnostics': {'directory': f'{tmp_path}/default_output', 'clock': {}, 'Exa... | def test_gridless_simulation(tmp_path):
dic = {'Clock': {'start_time': 0, 'end_time': 10, 'num_steps': 100}, 'Tools': {'ExampleTool': [{'custom_name': 'example'}, {'custom_name': 'example2'}]}, 'PhysicsModules': {'ExampleModule': {}}, 'Diagnostics': {'directory': f'{tmp_path}/default_output', 'clock': {}, 'Exa... |
9753007957265bd15a9565312cf39a26f82144f36ffe6a7d8158928d6f7be499 | def test_read_clock_from_input_should_set_clock_attr_when_called(simple_sim):
'Test read_clock_from_input method in Simulation class'
simple_sim.read_clock_from_input()
assert (simple_sim.clock._owner == simple_sim)
assert (simple_sim.clock.start_time == 0)
assert (simple_sim.clock.time == 0)
as... | Test read_clock_from_input method in Simulation class | tests/test_core.py | test_read_clock_from_input_should_set_clock_attr_when_called | kpf59/turbopy | 0 | python | def test_read_clock_from_input_should_set_clock_attr_when_called(simple_sim):
simple_sim.read_clock_from_input()
assert (simple_sim.clock._owner == simple_sim)
assert (simple_sim.clock.start_time == 0)
assert (simple_sim.clock.time == 0)
assert (simple_sim.clock.end_time == 10)
assert (simp... | def test_read_clock_from_input_should_set_clock_attr_when_called(simple_sim):
simple_sim.read_clock_from_input()
assert (simple_sim.clock._owner == simple_sim)
assert (simple_sim.clock.start_time == 0)
assert (simple_sim.clock.time == 0)
assert (simple_sim.clock.end_time == 10)
assert (simp... |
0b42e10385c6626de1593ca9d75aa0986cd6f3519d54a64b7fe69e9f474303db | def test_read_tools_from_input_should_set_tools_attr_when_called(simple_sim):
'Test read_tools_from_input method in Simulation class'
simple_sim.read_tools_from_input()
assert (simple_sim.compute_tools[0]._owner == simple_sim)
assert (simple_sim.compute_tools[0]._input_data == {'type': 'ExampleTool', 'c... | Test read_tools_from_input method in Simulation class | tests/test_core.py | test_read_tools_from_input_should_set_tools_attr_when_called | kpf59/turbopy | 0 | python | def test_read_tools_from_input_should_set_tools_attr_when_called(simple_sim):
simple_sim.read_tools_from_input()
assert (simple_sim.compute_tools[0]._owner == simple_sim)
assert (simple_sim.compute_tools[0]._input_data == {'type': 'ExampleTool', 'custom_name': 'example'})
assert (simple_sim.compute... | def test_read_tools_from_input_should_set_tools_attr_when_called(simple_sim):
simple_sim.read_tools_from_input()
assert (simple_sim.compute_tools[0]._owner == simple_sim)
assert (simple_sim.compute_tools[0]._input_data == {'type': 'ExampleTool', 'custom_name': 'example'})
assert (simple_sim.compute... |
e8716d4bd20a853cbaf1e0c4dfccac1bfc2c7e924a74ca03eee7385606154cc9 | def test_fundamental_cycle_should_advance_clock_when_called(simple_sim):
'Test fundamental_cycle method in Simulation class'
simple_sim.read_clock_from_input()
simple_sim.fundamental_cycle()
assert (simple_sim.clock.this_step == 1)
assert (simple_sim.clock.time == 0.1) | Test fundamental_cycle method in Simulation class | tests/test_core.py | test_fundamental_cycle_should_advance_clock_when_called | kpf59/turbopy | 0 | python | def test_fundamental_cycle_should_advance_clock_when_called(simple_sim):
simple_sim.read_clock_from_input()
simple_sim.fundamental_cycle()
assert (simple_sim.clock.this_step == 1)
assert (simple_sim.clock.time == 0.1) | def test_fundamental_cycle_should_advance_clock_when_called(simple_sim):
simple_sim.read_clock_from_input()
simple_sim.fundamental_cycle()
assert (simple_sim.clock.this_step == 1)
assert (simple_sim.clock.time == 0.1)<|docstring|>Test fundamental_cycle method in Simulation class<|endoftext|> |
7baab71f04d314290fbd740cad044e2ef2ed6b7aba2a0dd75a4e6de1c8fee11d | def test_run_should_run_simulation_while_clock_is_running(simple_sim):
'Test run method in Simulation class'
simple_sim.run()
assert (simple_sim.clock.this_step == 100)
assert (simple_sim.clock.time == 10) | Test run method in Simulation class | tests/test_core.py | test_run_should_run_simulation_while_clock_is_running | kpf59/turbopy | 0 | python | def test_run_should_run_simulation_while_clock_is_running(simple_sim):
simple_sim.run()
assert (simple_sim.clock.this_step == 100)
assert (simple_sim.clock.time == 10) | def test_run_should_run_simulation_while_clock_is_running(simple_sim):
simple_sim.run()
assert (simple_sim.clock.this_step == 100)
assert (simple_sim.clock.time == 10)<|docstring|>Test run method in Simulation class<|endoftext|> |
7c761f8c98641eb8b2ffae88013fbb44b0c612fc83c046cdb41f86328d3a609e | def test_turn_back_should_turn_back_time_when_called(simple_sim):
'Test fundamental_cycle method in Simulation class'
simple_sim.read_clock_from_input()
simple_sim.fundamental_cycle()
assert (simple_sim.clock.this_step == 1)
assert (simple_sim.clock.time == 0.1)
simple_sim.clock.turn_back()
... | Test fundamental_cycle method in Simulation class | tests/test_core.py | test_turn_back_should_turn_back_time_when_called | kpf59/turbopy | 0 | python | def test_turn_back_should_turn_back_time_when_called(simple_sim):
simple_sim.read_clock_from_input()
simple_sim.fundamental_cycle()
assert (simple_sim.clock.this_step == 1)
assert (simple_sim.clock.time == 0.1)
simple_sim.clock.turn_back()
assert (simple_sim.clock.this_step == 0)
assert... | def test_turn_back_should_turn_back_time_when_called(simple_sim):
simple_sim.read_clock_from_input()
simple_sim.fundamental_cycle()
assert (simple_sim.clock.this_step == 1)
assert (simple_sim.clock.time == 0.1)
simple_sim.clock.turn_back()
assert (simple_sim.clock.this_step == 0)
assert... |
f157c4c9e9b1926bcbea6e5c1162010f564f9d906f3980c1240860cfaaa4305b | def test_read_modules_from_input_should_set_modules_attr_when_called(simple_sim):
'Test read_modules_from_input method in Simulation calss'
simple_sim.read_modules_from_input()
assert (simple_sim.physics_modules[0]._owner == simple_sim)
assert (simple_sim.physics_modules[0]._input_data == {'name': 'Exam... | Test read_modules_from_input method in Simulation calss | tests/test_core.py | test_read_modules_from_input_should_set_modules_attr_when_called | kpf59/turbopy | 0 | python | def test_read_modules_from_input_should_set_modules_attr_when_called(simple_sim):
simple_sim.read_modules_from_input()
assert (simple_sim.physics_modules[0]._owner == simple_sim)
assert (simple_sim.physics_modules[0]._input_data == {'name': 'ExampleModule'}) | def test_read_modules_from_input_should_set_modules_attr_when_called(simple_sim):
simple_sim.read_modules_from_input()
assert (simple_sim.physics_modules[0]._owner == simple_sim)
assert (simple_sim.physics_modules[0]._input_data == {'name': 'ExampleModule'})<|docstring|>Test read_modules_from_input met... |
c582456a7cb6727d4ca58c557abeca02ebd9d416b66c367549499ee06224411c | def test_default_diagnostic_filename_is_generated_if_no_name_specified(simple_sim, tmp_path):
'Test read_diagnostic_from_input method in Simulation class'
simple_sim.read_diagnostics_from_input()
input_data = simple_sim.diagnostics[0]._input_data
assert (input_data['directory'] == str(Path(f'{tmp_path}/... | Test read_diagnostic_from_input method in Simulation class | tests/test_core.py | test_default_diagnostic_filename_is_generated_if_no_name_specified | kpf59/turbopy | 0 | python | def test_default_diagnostic_filename_is_generated_if_no_name_specified(simple_sim, tmp_path):
simple_sim.read_diagnostics_from_input()
input_data = simple_sim.diagnostics[0]._input_data
assert (input_data['directory'] == str(Path(f'{tmp_path}/default_output')))
assert (input_data['filename'] == str... | def test_default_diagnostic_filename_is_generated_if_no_name_specified(simple_sim, tmp_path):
simple_sim.read_diagnostics_from_input()
input_data = simple_sim.diagnostics[0]._input_data
assert (input_data['directory'] == str(Path(f'{tmp_path}/default_output')))
assert (input_data['filename'] == str... |
ec8bf6b1776371d50dcd65efc62dbd843dcb27dda5380eda6350653725957d33 | def test_default_diagnostic_filename_increments_for_multiple_diagnostics(simple_sim, tmp_path):
'Test read_diagnostic_from_input method in Simulation class'
simple_sim.read_diagnostics_from_input()
assert (simple_sim.diagnostics[0]._input_data['directory'] == str(Path(f'{tmp_path}/default_output')))
ass... | Test read_diagnostic_from_input method in Simulation class | tests/test_core.py | test_default_diagnostic_filename_increments_for_multiple_diagnostics | kpf59/turbopy | 0 | python | def test_default_diagnostic_filename_increments_for_multiple_diagnostics(simple_sim, tmp_path):
simple_sim.read_diagnostics_from_input()
assert (simple_sim.diagnostics[0]._input_data['directory'] == str(Path(f'{tmp_path}/default_output')))
assert (simple_sim.diagnostics[0]._input_data['filename'] == st... | def test_default_diagnostic_filename_increments_for_multiple_diagnostics(simple_sim, tmp_path):
simple_sim.read_diagnostics_from_input()
assert (simple_sim.diagnostics[0]._input_data['directory'] == str(Path(f'{tmp_path}/default_output')))
assert (simple_sim.diagnostics[0]._input_data['filename'] == st... |
c410c9e7bd30ce1e65e3fb203df5b65d1409dcd42cd01b7ecd63972072b62cb5 | @pytest.fixture(name='simple_grid')
def grid_conf():
'Pytest fixture for grid configuration dictionary'
grid = {'N': 8, 'r_min': 0, 'r_max': 0.1}
return Grid(grid) | Pytest fixture for grid configuration dictionary | tests/test_core.py | grid_conf | kpf59/turbopy | 0 | python | @pytest.fixture(name='simple_grid')
def grid_conf():
grid = {'N': 8, 'r_min': 0, 'r_max': 0.1}
return Grid(grid) | @pytest.fixture(name='simple_grid')
def grid_conf():
grid = {'N': 8, 'r_min': 0, 'r_max': 0.1}
return Grid(grid)<|docstring|>Pytest fixture for grid configuration dictionary<|endoftext|> |
b5532f3e01c51dca5485ed938eeb3589408e45e4973c6df734e676125af8e33e | def test_grid_init(simple_grid):
'Test initialization of the Grid class'
assert (simple_grid.r_min == 0.0)
assert (simple_grid.r_max == 0.1) | Test initialization of the Grid class | tests/test_core.py | test_grid_init | kpf59/turbopy | 0 | python | def test_grid_init(simple_grid):
assert (simple_grid.r_min == 0.0)
assert (simple_grid.r_max == 0.1) | def test_grid_init(simple_grid):
assert (simple_grid.r_min == 0.0)
assert (simple_grid.r_max == 0.1)<|docstring|>Test initialization of the Grid class<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.