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 |
|---|---|---|---|---|---|---|---|---|---|
aef6d6eabf496bd1accceab820d14e6cfc5730125ca3c71eccdb024020dbf9f1 | def _save_restore_dic(rsc_dir: str, bin_dic: dict):
'\n ์ํ๋ณต์ ๋ฐ์ด๋๋ฆฌ ์ฌ์ ์ ์ ์ฅํ๋ค.\n Args:\n rsc_dir: resource directory\n bin_dic: binary dictionary\n '
os.makedirs(rsc_dir, exist_ok=True)
with open('{}/restore.key'.format(rsc_dir), 'wb') as fkey:
with open('{}/restore.val'.format... | ์ํ๋ณต์ ๋ฐ์ด๋๋ฆฌ ์ฌ์ ์ ์ ์ฅํ๋ค.
Args:
rsc_dir: resource directory
bin_dic: binary dictionary | rsc/bin/compile_restore.py | _save_restore_dic | juntf/khaiii | 1,235 | python | def _save_restore_dic(rsc_dir: str, bin_dic: dict):
'\n ์ํ๋ณต์ ๋ฐ์ด๋๋ฆฌ ์ฌ์ ์ ์ ์ฅํ๋ค.\n Args:\n rsc_dir: resource directory\n bin_dic: binary dictionary\n '
os.makedirs(rsc_dir, exist_ok=True)
with open('{}/restore.key'.format(rsc_dir), 'wb') as fkey:
with open('{}/restore.val'.format... | def _save_restore_dic(rsc_dir: str, bin_dic: dict):
'\n ์ํ๋ณต์ ๋ฐ์ด๋๋ฆฌ ์ฌ์ ์ ์ ์ฅํ๋ค.\n Args:\n rsc_dir: resource directory\n bin_dic: binary dictionary\n '
os.makedirs(rsc_dir, exist_ok=True)
with open('{}/restore.key'.format(rsc_dir), 'wb') as fkey:
with open('{}/restore.val'.format... |
6ad2e8ffc5ea38dc710e8bc2efb2ab81f2ba3e45288edc5bc684b72ac7011714 | def _save_restore_one(rsc_dir: str, vocab_out: Dict[(str, int)], vocab_new: Dict[(str, int)]):
'\n ์ถ๋ ฅ ํ๊ทธ ๋ฒํธ ๋ณ ์ํ๋ณต์์ ํ์ง ์๋ ๋น๋ณต์ ์ฌ์ ์ ์ ์ฅํ๋ค.\n Args:\n rsc_dir: resource directory\n vocab_out: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ \n vocab_new: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ ์ ์ถ๊ฐํ ์๋ก์ด ํ๊ทธ\n '
idx_tags = sorted([(idx, tag) for (tag, idx) ... | ์ถ๋ ฅ ํ๊ทธ ๋ฒํธ ๋ณ ์ํ๋ณต์์ ํ์ง ์๋ ๋น๋ณต์ ์ฌ์ ์ ์ ์ฅํ๋ค.
Args:
rsc_dir: resource directory
vocab_out: ์ถ๋ ฅ ํ๊ทธ ์ฌ์
vocab_new: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ ์ ์ถ๊ฐํ ์๋ก์ด ํ๊ทธ | rsc/bin/compile_restore.py | _save_restore_one | juntf/khaiii | 1,235 | python | def _save_restore_one(rsc_dir: str, vocab_out: Dict[(str, int)], vocab_new: Dict[(str, int)]):
'\n ์ถ๋ ฅ ํ๊ทธ ๋ฒํธ ๋ณ ์ํ๋ณต์์ ํ์ง ์๋ ๋น๋ณต์ ์ฌ์ ์ ์ ์ฅํ๋ค.\n Args:\n rsc_dir: resource directory\n vocab_out: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ \n vocab_new: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ ์ ์ถ๊ฐํ ์๋ก์ด ํ๊ทธ\n '
idx_tags = sorted([(idx, tag) for (tag, idx) ... | def _save_restore_one(rsc_dir: str, vocab_out: Dict[(str, int)], vocab_new: Dict[(str, int)]):
'\n ์ถ๋ ฅ ํ๊ทธ ๋ฒํธ ๋ณ ์ํ๋ณต์์ ํ์ง ์๋ ๋น๋ณต์ ์ฌ์ ์ ์ ์ฅํ๋ค.\n Args:\n rsc_dir: resource directory\n vocab_out: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ \n vocab_new: ์ถ๋ ฅ ํ๊ทธ ์ฌ์ ์ ์ถ๊ฐํ ์๋ก์ด ํ๊ทธ\n '
idx_tags = sorted([(idx, tag) for (tag, idx) ... |
23e62105d8025ef5c5ec43923879c929751c0be95d6b051d4baa756e76f2addd | def run(args: Namespace):
'\n run function which is the start point of program\n Args:\n args: program arguments\n '
restore_dic = parse_restore_dic('{}/restore.dic'.format(args.rsc_src))
if (not restore_dic):
sys.exit(1)
vocab_out = load_vocab_out(args.rsc_src)
if (not voca... | run function which is the start point of program
Args:
args: program arguments | rsc/bin/compile_restore.py | run | juntf/khaiii | 1,235 | python | def run(args: Namespace):
'\n run function which is the start point of program\n Args:\n args: program arguments\n '
restore_dic = parse_restore_dic('{}/restore.dic'.format(args.rsc_src))
if (not restore_dic):
sys.exit(1)
vocab_out = load_vocab_out(args.rsc_src)
if (not voca... | def run(args: Namespace):
'\n run function which is the start point of program\n Args:\n args: program arguments\n '
restore_dic = parse_restore_dic('{}/restore.dic'.format(args.rsc_src))
if (not restore_dic):
sys.exit(1)
vocab_out = load_vocab_out(args.rsc_src)
if (not voca... |
bee8a5c64c5fdafdc21de3289179f55660c22ef1e017ccb737c33590aabefaf7 | def main():
'\n main function processes only argument parsing\n '
parser = ArgumentParser(description='๊ธฐ๋ถ์ ์ฌ์ ์ ๋น๋ํ๋ ์คํฌ๋ฆฝํธ')
parser.add_argument('--rsc-src', help='source directory (text) <default: ./src>', metavar='DIR', default='./src')
parser.add_argument('--rsc-dir', help='target directory (bina... | main function processes only argument parsing | rsc/bin/compile_restore.py | main | juntf/khaiii | 1,235 | python | def main():
'\n \n '
parser = ArgumentParser(description='๊ธฐ๋ถ์ ์ฌ์ ์ ๋น๋ํ๋ ์คํฌ๋ฆฝํธ')
parser.add_argument('--rsc-src', help='source directory (text) <default: ./src>', metavar='DIR', default='./src')
parser.add_argument('--rsc-dir', help='target directory (binary) <default: ./share/khaiii>', metavar='DIR'... | def main():
'\n \n '
parser = ArgumentParser(description='๊ธฐ๋ถ์ ์ฌ์ ์ ๋น๋ํ๋ ์คํฌ๋ฆฝํธ')
parser.add_argument('--rsc-src', help='source directory (text) <default: ./src>', metavar='DIR', default='./src')
parser.add_argument('--rsc-dir', help='target directory (binary) <default: ./share/khaiii>', metavar='DIR'... |
dc0a1d3a4f2d95fa4eab3933741df20bdde9cc86d7f4f157f1982a5c8ad372b2 | def basic_lti_launch(self, document_url=None, grading_supported=True):
'Do a basic LTI launch with the given document_url.'
self.sync_lti_data_to_h()
self.store_lti_data()
self.context.get_or_create_course()
if grading_supported:
self.context.js_config.maybe_enable_grading()
if (document... | Do a basic LTI launch with the given document_url. | lms/views/basic_lti_launch.py | basic_lti_launch | mattdricker/lms | 0 | python | def basic_lti_launch(self, document_url=None, grading_supported=True):
self.sync_lti_data_to_h()
self.store_lti_data()
self.context.get_or_create_course()
if grading_supported:
self.context.js_config.maybe_enable_grading()
if (document_url is not None):
self.context.js_config.ad... | def basic_lti_launch(self, document_url=None, grading_supported=True):
self.sync_lti_data_to_h()
self.store_lti_data()
self.context.get_or_create_course()
if grading_supported:
self.context.js_config.maybe_enable_grading()
if (document_url is not None):
self.context.js_config.ad... |
8f944cd6634ed93d87109854ce25707c7e0aa7284896814e2387b68d844374de | def sync_lti_data_to_h(self):
'\n Sync LTI data to H.\n\n Before any LTI assignment launch create or update the Hypothesis user\n and group corresponding to the LTI user and course.\n '
self.request.find_service(name='lti_h').sync([self.context.h_group], self.request.params) | Sync LTI data to H.
Before any LTI assignment launch create or update the Hypothesis user
and group corresponding to the LTI user and course. | lms/views/basic_lti_launch.py | sync_lti_data_to_h | mattdricker/lms | 0 | python | def sync_lti_data_to_h(self):
'\n Sync LTI data to H.\n\n Before any LTI assignment launch create or update the Hypothesis user\n and group corresponding to the LTI user and course.\n '
self.request.find_service(name='lti_h').sync([self.context.h_group], self.request.params) | def sync_lti_data_to_h(self):
'\n Sync LTI data to H.\n\n Before any LTI assignment launch create or update the Hypothesis user\n and group corresponding to the LTI user and course.\n '
self.request.find_service(name='lti_h').sync([self.context.h_group], self.request.params)<|docstri... |
16881c0476bcbd5108a4034aa26ffd8da5a7a4f6162844d1f06ac095d1aee440 | def store_lti_data(self):
'Store LTI launch data in our LMS database.'
request = self.request
LtiLaunches.add(request.db, request.params.get('context_id'), request.params.get('oauth_consumer_key'))
lti_user = request.lti_user
if ((not lti_user.is_instructor) and (not self.context.is_canvas)):
... | Store LTI launch data in our LMS database. | lms/views/basic_lti_launch.py | store_lti_data | mattdricker/lms | 0 | python | def store_lti_data(self):
request = self.request
LtiLaunches.add(request.db, request.params.get('context_id'), request.params.get('oauth_consumer_key'))
lti_user = request.lti_user
if ((not lti_user.is_instructor) and (not self.context.is_canvas)):
request.find_service(name='grading_info').... | def store_lti_data(self):
request = self.request
LtiLaunches.add(request.db, request.params.get('context_id'), request.params.get('oauth_consumer_key'))
lti_user = request.lti_user
if ((not lti_user.is_instructor) and (not self.context.is_canvas)):
request.find_service(name='grading_info').... |
6fd784d3e0faa687c0c5fb1bb272ac6bfd1946161343cab822919581f202a454 | @view_config(canvas_file=True)
def canvas_file_basic_lti_launch(self):
"\n Respond to a Canvas file assignment launch.\n\n Canvas file assignment launch requests have a ``file_id`` request\n parameter, which is the Canvas instance's ID for the file. To display\n the assignment we have to... | Respond to a Canvas file assignment launch.
Canvas file assignment launch requests have a ``file_id`` request
parameter, which is the Canvas instance's ID for the file. To display
the assignment we have to use this ``file_id`` to get a download URL
for the file from the Canvas API. We then pass that download URL to
Vi... | lms/views/basic_lti_launch.py | canvas_file_basic_lti_launch | mattdricker/lms | 0 | python | @view_config(canvas_file=True)
def canvas_file_basic_lti_launch(self):
"\n Respond to a Canvas file assignment launch.\n\n Canvas file assignment launch requests have a ``file_id`` request\n parameter, which is the Canvas instance's ID for the file. To display\n the assignment we have to... | @view_config(canvas_file=True)
def canvas_file_basic_lti_launch(self):
"\n Respond to a Canvas file assignment launch.\n\n Canvas file assignment launch requests have a ``file_id`` request\n parameter, which is the Canvas instance's ID for the file. To display\n the assignment we have to... |
3a0d69665b9c607cd1a9dbf7462c8d1bbd47bca2f33e7aad17bee30b86b7f797 | @view_config(vitalsource_book=True)
def vitalsource_lti_launch(self):
"\n Respond to a VitalSource book launch.\n\n The book and chapter to show are configured by `book_id` and `cfi` request\n parameters. VitalSource book launches involve a second LTI launch.\n Hypothesis's LMS app gener... | Respond to a VitalSource book launch.
The book and chapter to show are configured by `book_id` and `cfi` request
parameters. VitalSource book launches involve a second LTI launch.
Hypothesis's LMS app generates the form parameters needed to load
VitalSource's book viewer using an LTI launch. The LMS frontend then
rend... | lms/views/basic_lti_launch.py | vitalsource_lti_launch | mattdricker/lms | 0 | python | @view_config(vitalsource_book=True)
def vitalsource_lti_launch(self):
"\n Respond to a VitalSource book launch.\n\n The book and chapter to show are configured by `book_id` and `cfi` request\n parameters. VitalSource book launches involve a second LTI launch.\n Hypothesis's LMS app gener... | @view_config(vitalsource_book=True)
def vitalsource_lti_launch(self):
"\n Respond to a VitalSource book launch.\n\n The book and chapter to show are configured by `book_id` and `cfi` request\n parameters. VitalSource book launches involve a second LTI launch.\n Hypothesis's LMS app gener... |
e2176da8985e513fce7ef66310e38725463f31b80d5287b455842455c4045218 | @view_config(db_configured=True)
def db_configured_basic_lti_launch(self):
"\n Respond to a DB-configured assignment launch.\n\n DB-configured assignment launch requests don't have any kind of file ID\n or document URL in the request. Instead the document URL is stored in\n our own DB. T... | Respond to a DB-configured assignment launch.
DB-configured assignment launch requests don't have any kind of file ID
or document URL in the request. Instead the document URL is stored in
our own DB. This happens with LMS's that don't support LTI content item
selection/deep linking, so they don't support storing the d... | lms/views/basic_lti_launch.py | db_configured_basic_lti_launch | mattdricker/lms | 0 | python | @view_config(db_configured=True)
def db_configured_basic_lti_launch(self):
"\n Respond to a DB-configured assignment launch.\n\n DB-configured assignment launch requests don't have any kind of file ID\n or document URL in the request. Instead the document URL is stored in\n our own DB. T... | @view_config(db_configured=True)
def db_configured_basic_lti_launch(self):
"\n Respond to a DB-configured assignment launch.\n\n DB-configured assignment launch requests don't have any kind of file ID\n or document URL in the request. Instead the document URL is stored in\n our own DB. T... |
a7bf30954503dc792d42b258be3e134b4dbffa173167f8f27a330626552f4ce3 | @view_config(blackboard_copied=True)
def blackboard_copied_basic_lti_launch(self):
"\n Respond to a launch of a newly-copied Blackboard assignment.\n\n For more about Blackboard course copy see the BlackboardCopied\n predicate's docstring.\n "
return self.course_copied_basic_lti_laun... | Respond to a launch of a newly-copied Blackboard assignment.
For more about Blackboard course copy see the BlackboardCopied
predicate's docstring. | lms/views/basic_lti_launch.py | blackboard_copied_basic_lti_launch | mattdricker/lms | 0 | python | @view_config(blackboard_copied=True)
def blackboard_copied_basic_lti_launch(self):
"\n Respond to a launch of a newly-copied Blackboard assignment.\n\n For more about Blackboard course copy see the BlackboardCopied\n predicate's docstring.\n "
return self.course_copied_basic_lti_laun... | @view_config(blackboard_copied=True)
def blackboard_copied_basic_lti_launch(self):
"\n Respond to a launch of a newly-copied Blackboard assignment.\n\n For more about Blackboard course copy see the BlackboardCopied\n predicate's docstring.\n "
return self.course_copied_basic_lti_laun... |
9d821a1966d103dc881b92a40919e3d08c7a64387f29d26658c86c311e2ab0b0 | @view_config(brightspace_copied=True)
def brightspace_copied_basic_lti_launch(self):
"\n Respond to a launch of a newly-copied Brightspace assignment.\n\n For more about Brightspace course copy see the BrightspaceCopied\n predicate's docstring.\n "
return self.course_copied_basic_lti... | Respond to a launch of a newly-copied Brightspace assignment.
For more about Brightspace course copy see the BrightspaceCopied
predicate's docstring. | lms/views/basic_lti_launch.py | brightspace_copied_basic_lti_launch | mattdricker/lms | 0 | python | @view_config(brightspace_copied=True)
def brightspace_copied_basic_lti_launch(self):
"\n Respond to a launch of a newly-copied Brightspace assignment.\n\n For more about Brightspace course copy see the BrightspaceCopied\n predicate's docstring.\n "
return self.course_copied_basic_lti... | @view_config(brightspace_copied=True)
def brightspace_copied_basic_lti_launch(self):
"\n Respond to a launch of a newly-copied Brightspace assignment.\n\n For more about Brightspace course copy see the BrightspaceCopied\n predicate's docstring.\n "
return self.course_copied_basic_lti... |
726321c03b0f9f5944906be1d2650e54c958f3e2dd95e7ce6c93bdca1de9a2cb | def course_copied_basic_lti_launch(self, original_resource_link_id):
'\n Respond to a launch of a newly-copied assignment.\n\n Find the document_url for the original assignment and make a copy of it\n with the new resource_link_id, then launch the assignment as normal.\n\n Helper method ... | Respond to a launch of a newly-copied assignment.
Find the document_url for the original assignment and make a copy of it
with the new resource_link_id, then launch the assignment as normal.
Helper method for the *_copied_basic_lti_launch() methods above.
:param original_resource_link_id: the resource_link_id of the... | lms/views/basic_lti_launch.py | course_copied_basic_lti_launch | mattdricker/lms | 0 | python | def course_copied_basic_lti_launch(self, original_resource_link_id):
'\n Respond to a launch of a newly-copied assignment.\n\n Find the document_url for the original assignment and make a copy of it\n with the new resource_link_id, then launch the assignment as normal.\n\n Helper method ... | def course_copied_basic_lti_launch(self, original_resource_link_id):
'\n Respond to a launch of a newly-copied assignment.\n\n Find the document_url for the original assignment and make a copy of it\n with the new resource_link_id, then launch the assignment as normal.\n\n Helper method ... |
a2cf2577a225e9210187c9b2754b47c709e9775772b8c79ad42bcef12614025e | @view_config(url_configured=True, schema=URLConfiguredBasicLTILaunchSchema)
def url_configured_basic_lti_launch(self):
"\n Respond to a URL-configured assignment launch.\n\n URL-configured assignment launch requests have the document URL in the\n ``url`` request parameter. This happens in LMS's... | Respond to a URL-configured assignment launch.
URL-configured assignment launch requests have the document URL in the
``url`` request parameter. This happens in LMS's that support LTI
content item selection/deep linking: the document URL is chosen during
content item selection (during assignment creation) and saved in... | lms/views/basic_lti_launch.py | url_configured_basic_lti_launch | mattdricker/lms | 0 | python | @view_config(url_configured=True, schema=URLConfiguredBasicLTILaunchSchema)
def url_configured_basic_lti_launch(self):
"\n Respond to a URL-configured assignment launch.\n\n URL-configured assignment launch requests have the document URL in the\n ``url`` request parameter. This happens in LMS's... | @view_config(url_configured=True, schema=URLConfiguredBasicLTILaunchSchema)
def url_configured_basic_lti_launch(self):
"\n Respond to a URL-configured assignment launch.\n\n URL-configured assignment launch requests have the document URL in the\n ``url`` request parameter. This happens in LMS's... |
8f81b1b8231860d4da7d2d4a918d9afcc21b2268e47e2e8d6a89395048623356 | @view_config(authorized_to_configure_assignments=True, configured=False, renderer='lms:templates/file_picker.html.jinja2')
def unconfigured_basic_lti_launch(self):
"\n Respond to an unconfigured assignment launch.\n\n Unconfigured assignment launch requests don't contain any document URL\n or f... | Respond to an unconfigured assignment launch.
Unconfigured assignment launch requests don't contain any document URL
or file ID because the assignment's document hasn't been chosen yet.
This happens in LMS's that don't support LTI content item
selection/deep linking. They go straight from assignment creation to
launch... | lms/views/basic_lti_launch.py | unconfigured_basic_lti_launch | mattdricker/lms | 0 | python | @view_config(authorized_to_configure_assignments=True, configured=False, renderer='lms:templates/file_picker.html.jinja2')
def unconfigured_basic_lti_launch(self):
"\n Respond to an unconfigured assignment launch.\n\n Unconfigured assignment launch requests don't contain any document URL\n or f... | @view_config(authorized_to_configure_assignments=True, configured=False, renderer='lms:templates/file_picker.html.jinja2')
def unconfigured_basic_lti_launch(self):
"\n Respond to an unconfigured assignment launch.\n\n Unconfigured assignment launch requests don't contain any document URL\n or f... |
c21f01283dcea7985788fb36bfdddb5d304d9a67018798bfd097cd1c0237839a | @view_config(authorized_to_configure_assignments=False, configured=False, renderer='lms:templates/basic_lti_launch/unconfigured_basic_lti_launch_not_authorized.html.jinja2')
def unconfigured_basic_lti_launch_not_authorized(self):
"\n Respond to an unauthorized unconfigured assignment launch.\n\n This ... | Respond to an unauthorized unconfigured assignment launch.
This happens when an assignment's document hasn't been chosen yet and
the assignment is launched by a user who isn't authorized to choose the
document (for example a learner rather than a teacher). We just show an
error page. | lms/views/basic_lti_launch.py | unconfigured_basic_lti_launch_not_authorized | mattdricker/lms | 0 | python | @view_config(authorized_to_configure_assignments=False, configured=False, renderer='lms:templates/basic_lti_launch/unconfigured_basic_lti_launch_not_authorized.html.jinja2')
def unconfigured_basic_lti_launch_not_authorized(self):
"\n Respond to an unauthorized unconfigured assignment launch.\n\n This ... | @view_config(authorized_to_configure_assignments=False, configured=False, renderer='lms:templates/basic_lti_launch/unconfigured_basic_lti_launch_not_authorized.html.jinja2')
def unconfigured_basic_lti_launch_not_authorized(self):
"\n Respond to an unauthorized unconfigured assignment launch.\n\n This ... |
6dc14c07fd19c75ef02a1244a729c4c7597dafc589c57fb78f6388900dfd2b6e | @view_config(authorized_to_configure_assignments=True, route_name='configure_assignment', schema=ConfigureAssignmentSchema)
def configure_assignment(self):
'\n Respond to a configure module item request.\n\n This happens after an unconfigured assignment launch. We show the user\n our document s... | Respond to a configure module item request.
This happens after an unconfigured assignment launch. We show the user
our document selection form instead of launching the assignment, and
when the user chooses a document and submits the form this is the view
that receives that form submission.
We save the chosen document... | lms/views/basic_lti_launch.py | configure_assignment | mattdricker/lms | 0 | python | @view_config(authorized_to_configure_assignments=True, route_name='configure_assignment', schema=ConfigureAssignmentSchema)
def configure_assignment(self):
'\n Respond to a configure module item request.\n\n This happens after an unconfigured assignment launch. We show the user\n our document s... | @view_config(authorized_to_configure_assignments=True, route_name='configure_assignment', schema=ConfigureAssignmentSchema)
def configure_assignment(self):
'\n Respond to a configure module item request.\n\n This happens after an unconfigured assignment launch. We show the user\n our document s... |
b3e5990fbdcb2eb8ac996cf8f3e6bc911b0cae6f30fffcd02d15bf3d7d49409d | def test_assertfailedwrite():
'\n\tIO Test - made to fail with Wrong Output file path\n\t'
np.random.seed(0)
random_data = (np.random.random(size=(10, 1080, 1920, 3)) * 255)
input_data = random_data.astype(np.uint8)
with pytest.raises(AssertionError):
writer = WriteGear('wrong_path/output.mp... | IO Test - made to fail with Wrong Output file path | vidgear/tests/writer_tests/test_IO.py | test_assertfailedwrite | winnerineast/vidgear | 1 | python | def test_assertfailedwrite():
'\n\t\n\t'
np.random.seed(0)
random_data = (np.random.random(size=(10, 1080, 1920, 3)) * 255)
input_data = random_data.astype(np.uint8)
with pytest.raises(AssertionError):
writer = WriteGear('wrong_path/output.mp4')
writer.write(input_data)
write... | def test_assertfailedwrite():
'\n\t\n\t'
np.random.seed(0)
random_data = (np.random.random(size=(10, 1080, 1920, 3)) * 255)
input_data = random_data.astype(np.uint8)
with pytest.raises(AssertionError):
writer = WriteGear('wrong_path/output.mp4')
writer.write(input_data)
write... |
2fea8bcfd1a1a5beef187bcd4a7273514208180c5c24a091ed62f04476458825 | def test_failedextension():
'\n\tIO Test - made to fail with filename with wrong extention\n\t'
np.random.seed(0)
random_data = (np.random.random(size=(10, 1080, 1920, 3)) * 255)
input_data = random_data.astype(np.uint8)
with pytest.raises(ValueError):
writer = WriteGear('garbage.garbage')
... | IO Test - made to fail with filename with wrong extention | vidgear/tests/writer_tests/test_IO.py | test_failedextension | winnerineast/vidgear | 1 | python | def test_failedextension():
'\n\t\n\t'
np.random.seed(0)
random_data = (np.random.random(size=(10, 1080, 1920, 3)) * 255)
input_data = random_data.astype(np.uint8)
with pytest.raises(ValueError):
writer = WriteGear('garbage.garbage')
writer.write(input_data)
writer.close() | def test_failedextension():
'\n\t\n\t'
np.random.seed(0)
random_data = (np.random.random(size=(10, 1080, 1920, 3)) * 255)
input_data = random_data.astype(np.uint8)
with pytest.raises(ValueError):
writer = WriteGear('garbage.garbage')
writer.write(input_data)
writer.close()<|d... |
93281dd4a23eaf2158739c45bf6e6cc5573ebeeb1b9aad548d2d0c90b4d8f377 | def __init__(self, name=None, physical_name=None, tag=None, _configuration=None):
'AgentThingProperties - a model defined in Swagger'
if (_configuration is None):
_configuration = Configuration()
self._configuration = _configuration
self._name = None
self._physical_name = None
self._tag ... | AgentThingProperties - a model defined in Swagger | ctm_api_client/models/agent_thing_properties.py | __init__ | tadinve/ctm_python_client | 0 | python | def __init__(self, name=None, physical_name=None, tag=None, _configuration=None):
if (_configuration is None):
_configuration = Configuration()
self._configuration = _configuration
self._name = None
self._physical_name = None
self._tag = None
self.discriminator = None
if (name i... | def __init__(self, name=None, physical_name=None, tag=None, _configuration=None):
if (_configuration is None):
_configuration = Configuration()
self._configuration = _configuration
self._name = None
self._physical_name = None
self._tag = None
self.discriminator = None
if (name i... |
39018a111492d28ac0c852d50ba6e4e6f1f60dd893ae87ca4cdac275bcf14195 | @property
def name(self):
'Gets the name of this AgentThingProperties. # noqa: E501\n\n the logical name to be used for new agent (equivilant to NodeId) # noqa: E501\n\n :return: The name of this AgentThingProperties. # noqa: E501\n :rtype: str\n '
return self._name | Gets the name of this AgentThingProperties. # noqa: E501
the logical name to be used for new agent (equivilant to NodeId) # noqa: E501
:return: The name of this AgentThingProperties. # noqa: E501
:rtype: str | ctm_api_client/models/agent_thing_properties.py | name | tadinve/ctm_python_client | 0 | python | @property
def name(self):
'Gets the name of this AgentThingProperties. # noqa: E501\n\n the logical name to be used for new agent (equivilant to NodeId) # noqa: E501\n\n :return: The name of this AgentThingProperties. # noqa: E501\n :rtype: str\n '
return self._name | @property
def name(self):
'Gets the name of this AgentThingProperties. # noqa: E501\n\n the logical name to be used for new agent (equivilant to NodeId) # noqa: E501\n\n :return: The name of this AgentThingProperties. # noqa: E501\n :rtype: str\n '
return self._name<|docstring|>Ge... |
6b6bbd6d8e440b05714b560cd3f9d4031140f5aa4f067e0952a03ffef2718d08 | @name.setter
def name(self, name):
'Sets the name of this AgentThingProperties.\n\n the logical name to be used for new agent (equivilant to NodeId) # noqa: E501\n\n :param name: The name of this AgentThingProperties. # noqa: E501\n :type: str\n '
self._name = name | Sets the name of this AgentThingProperties.
the logical name to be used for new agent (equivilant to NodeId) # noqa: E501
:param name: The name of this AgentThingProperties. # noqa: E501
:type: str | ctm_api_client/models/agent_thing_properties.py | name | tadinve/ctm_python_client | 0 | python | @name.setter
def name(self, name):
'Sets the name of this AgentThingProperties.\n\n the logical name to be used for new agent (equivilant to NodeId) # noqa: E501\n\n :param name: The name of this AgentThingProperties. # noqa: E501\n :type: str\n '
self._name = name | @name.setter
def name(self, name):
'Sets the name of this AgentThingProperties.\n\n the logical name to be used for new agent (equivilant to NodeId) # noqa: E501\n\n :param name: The name of this AgentThingProperties. # noqa: E501\n :type: str\n '
self._name = name<|docstring|>Sets... |
3d9b35cf23e5db685971c68756dfb30f83afa47f448b33f28e143c9362d54a0a | @property
def physical_name(self):
'Gets the physical_name of this AgentThingProperties. # noqa: E501\n\n the physical name of the thing the agent is installed on # noqa: E501\n\n :return: The physical_name of this AgentThingProperties. # noqa: E501\n :rtype: str\n '
return self._... | Gets the physical_name of this AgentThingProperties. # noqa: E501
the physical name of the thing the agent is installed on # noqa: E501
:return: The physical_name of this AgentThingProperties. # noqa: E501
:rtype: str | ctm_api_client/models/agent_thing_properties.py | physical_name | tadinve/ctm_python_client | 0 | python | @property
def physical_name(self):
'Gets the physical_name of this AgentThingProperties. # noqa: E501\n\n the physical name of the thing the agent is installed on # noqa: E501\n\n :return: The physical_name of this AgentThingProperties. # noqa: E501\n :rtype: str\n '
return self._... | @property
def physical_name(self):
'Gets the physical_name of this AgentThingProperties. # noqa: E501\n\n the physical name of the thing the agent is installed on # noqa: E501\n\n :return: The physical_name of this AgentThingProperties. # noqa: E501\n :rtype: str\n '
return self._... |
68a0ddaba0e9539c21c66c7ef9e9d0c053d18b05071e1b3b0bb1be8b20c909d2 | @physical_name.setter
def physical_name(self, physical_name):
'Sets the physical_name of this AgentThingProperties.\n\n the physical name of the thing the agent is installed on # noqa: E501\n\n :param physical_name: The physical_name of this AgentThingProperties. # noqa: E501\n :type: str\n ... | Sets the physical_name of this AgentThingProperties.
the physical name of the thing the agent is installed on # noqa: E501
:param physical_name: The physical_name of this AgentThingProperties. # noqa: E501
:type: str | ctm_api_client/models/agent_thing_properties.py | physical_name | tadinve/ctm_python_client | 0 | python | @physical_name.setter
def physical_name(self, physical_name):
'Sets the physical_name of this AgentThingProperties.\n\n the physical name of the thing the agent is installed on # noqa: E501\n\n :param physical_name: The physical_name of this AgentThingProperties. # noqa: E501\n :type: str\n ... | @physical_name.setter
def physical_name(self, physical_name):
'Sets the physical_name of this AgentThingProperties.\n\n the physical name of the thing the agent is installed on # noqa: E501\n\n :param physical_name: The physical_name of this AgentThingProperties. # noqa: E501\n :type: str\n ... |
dbd932be984f4d3118b82d48c21afe50faaa168af7652f806602e32e8c772336 | @property
def tag(self):
'Gets the tag of this AgentThingProperties. # noqa: E501\n\n the agent tag to be associated with the new agent (CMS RBA permissions tag that is) # noqa: E501\n\n :return: The tag of this AgentThingProperties. # noqa: E501\n :rtype: str\n '
return self._tag | Gets the tag of this AgentThingProperties. # noqa: E501
the agent tag to be associated with the new agent (CMS RBA permissions tag that is) # noqa: E501
:return: The tag of this AgentThingProperties. # noqa: E501
:rtype: str | ctm_api_client/models/agent_thing_properties.py | tag | tadinve/ctm_python_client | 0 | python | @property
def tag(self):
'Gets the tag of this AgentThingProperties. # noqa: E501\n\n the agent tag to be associated with the new agent (CMS RBA permissions tag that is) # noqa: E501\n\n :return: The tag of this AgentThingProperties. # noqa: E501\n :rtype: str\n '
return self._tag | @property
def tag(self):
'Gets the tag of this AgentThingProperties. # noqa: E501\n\n the agent tag to be associated with the new agent (CMS RBA permissions tag that is) # noqa: E501\n\n :return: The tag of this AgentThingProperties. # noqa: E501\n :rtype: str\n '
return self._tag... |
e0345b0f9cdd5c85c4971511a135fd31b1f101af53a8871dabf1e920b0b75e7e | @tag.setter
def tag(self, tag):
'Sets the tag of this AgentThingProperties.\n\n the agent tag to be associated with the new agent (CMS RBA permissions tag that is) # noqa: E501\n\n :param tag: The tag of this AgentThingProperties. # noqa: E501\n :type: str\n '
self._tag = tag | Sets the tag of this AgentThingProperties.
the agent tag to be associated with the new agent (CMS RBA permissions tag that is) # noqa: E501
:param tag: The tag of this AgentThingProperties. # noqa: E501
:type: str | ctm_api_client/models/agent_thing_properties.py | tag | tadinve/ctm_python_client | 0 | python | @tag.setter
def tag(self, tag):
'Sets the tag of this AgentThingProperties.\n\n the agent tag to be associated with the new agent (CMS RBA permissions tag that is) # noqa: E501\n\n :param tag: The tag of this AgentThingProperties. # noqa: E501\n :type: str\n '
self._tag = tag | @tag.setter
def tag(self, tag):
'Sets the tag of this AgentThingProperties.\n\n the agent tag to be associated with the new agent (CMS RBA permissions tag that is) # noqa: E501\n\n :param tag: The tag of this AgentThingProperties. # noqa: E501\n :type: str\n '
self._tag = tag<|docs... |
7ef2a1bb433525ea7b34d7a8df59d542de09a94040ab54d996aa1ff5a002a8f3 | def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | Returns the model properties as a dict | ctm_api_client/models/agent_thing_properties.py | to_dict | tadinve/ctm_python_client | 0 | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
cbb19eaa2fc8a113d9e32f924ef280a7e97563f8915f94f65dab438997af2e99 | def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | Returns the string representation of the model | ctm_api_client/models/agent_thing_properties.py | to_str | tadinve/ctm_python_client | 0 | python | def to_str(self):
return pprint.pformat(self.to_dict()) | def to_str(self):
return pprint.pformat(self.to_dict())<|docstring|>Returns the string representation of the model<|endoftext|> |
772243a2c2b3261a9b954d07aaf295e3c1242a579a495e2d6a5679c677861703 | def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | For `print` and `pprint` | ctm_api_client/models/agent_thing_properties.py | __repr__ | tadinve/ctm_python_client | 0 | python | def __repr__(self):
return self.to_str() | def __repr__(self):
return self.to_str()<|docstring|>For `print` and `pprint`<|endoftext|> |
6b64912bd6638ae335c6a7458f60bc6df34ddb734354f3a3e252ae35723752fb | def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, AgentThingProperties)):
return False
return (self.to_dict() == other.to_dict()) | Returns true if both objects are equal | ctm_api_client/models/agent_thing_properties.py | __eq__ | tadinve/ctm_python_client | 0 | python | def __eq__(self, other):
if (not isinstance(other, AgentThingProperties)):
return False
return (self.to_dict() == other.to_dict()) | def __eq__(self, other):
if (not isinstance(other, AgentThingProperties)):
return False
return (self.to_dict() == other.to_dict())<|docstring|>Returns true if both objects are equal<|endoftext|> |
e63e3dc1e13b926ad30b50c71c879f4b3466e8e88b5491514de5b5be5a2c73ab | def __ne__(self, other):
'Returns true if both objects are not equal'
if (not isinstance(other, AgentThingProperties)):
return True
return (self.to_dict() != other.to_dict()) | Returns true if both objects are not equal | ctm_api_client/models/agent_thing_properties.py | __ne__ | tadinve/ctm_python_client | 0 | python | def __ne__(self, other):
if (not isinstance(other, AgentThingProperties)):
return True
return (self.to_dict() != other.to_dict()) | def __ne__(self, other):
if (not isinstance(other, AgentThingProperties)):
return True
return (self.to_dict() != other.to_dict())<|docstring|>Returns true if both objects are not equal<|endoftext|> |
7ea6216aa5d5e5d2d376e1323957a1bc945adc872a2934c3364e884e93a5f383 | @app.route('/')
def main():
'Main function that does main things.'
print('salut')
return 'wesh tranquille?' | Main function that does main things. | Flask/Test/main.py | main | MarcPartensky/Python-2020 | 1 | python | @app.route('/')
def main():
print('salut')
return 'wesh tranquille?' | @app.route('/')
def main():
print('salut')
return 'wesh tranquille?'<|docstring|>Main function that does main things.<|endoftext|> |
6cbcfb2749389ac8de8d54cd5181729d72f25be75aaf33b6c774d51a5c7ead2d | def _ctx_name_callback():
"\n We don't use threading.current_thread() because it will deadlock if\n called when profiling threading._active_limbo_lock.acquire().\n See: #Issue48.\n "
try:
current_thread = threading._active[get_ident()]
return current_thread.__class__.__name__
exc... | We don't use threading.current_thread() because it will deadlock if
called when profiling threading._active_limbo_lock.acquire().
See: #Issue48. | yappi/yappi.py | _ctx_name_callback | gaborbernat/yappi | 877 | python | def _ctx_name_callback():
"\n We don't use threading.current_thread() because it will deadlock if\n called when profiling threading._active_limbo_lock.acquire().\n See: #Issue48.\n "
try:
current_thread = threading._active[get_ident()]
return current_thread.__class__.__name__
exc... | def _ctx_name_callback():
"\n We don't use threading.current_thread() because it will deadlock if\n called when profiling threading._active_limbo_lock.acquire().\n See: #Issue48.\n "
try:
current_thread = threading._active[get_ident()]
return current_thread.__class__.__name__
exc... |
2b798517999bf81a17646d9ca1103d81eab40daa1e749175037b31d85f6f776e | def _profile_thread_callback(frame, event, arg):
"\n _profile_thread_callback will only be called once per-thread. _yappi will detect\n the new thread and changes the profilefunc param of the ThreadState\n structure. This is an internal function please don't mess with it.\n "
_yappi._profile_event(f... | _profile_thread_callback will only be called once per-thread. _yappi will detect
the new thread and changes the profilefunc param of the ThreadState
structure. This is an internal function please don't mess with it. | yappi/yappi.py | _profile_thread_callback | gaborbernat/yappi | 877 | python | def _profile_thread_callback(frame, event, arg):
"\n _profile_thread_callback will only be called once per-thread. _yappi will detect\n the new thread and changes the profilefunc param of the ThreadState\n structure. This is an internal function please don't mess with it.\n "
_yappi._profile_event(f... | def _profile_thread_callback(frame, event, arg):
"\n _profile_thread_callback will only be called once per-thread. _yappi will detect\n the new thread and changes the profilefunc param of the ThreadState\n structure. This is an internal function please don't mess with it.\n "
_yappi._profile_event(f... |
92887686e355da4bb99eaf52c47428c2c0803def11cf4aa94fa50db014a0530f | def _create_greenlet_callbacks():
"\n Returns two functions:\n - one that can identify unique greenlets. Identity of a greenlet\n cannot be reused once a greenlet dies. 'id(greenlet)' cannot be used because\n 'id' returns an identifier that can be reused once a greenlet object is garbage\n coll... | Returns two functions:
- one that can identify unique greenlets. Identity of a greenlet
cannot be reused once a greenlet dies. 'id(greenlet)' cannot be used because
'id' returns an identifier that can be reused once a greenlet object is garbage
collected.
- one that can return the name of the greenlet class used ... | yappi/yappi.py | _create_greenlet_callbacks | gaborbernat/yappi | 877 | python | def _create_greenlet_callbacks():
"\n Returns two functions:\n - one that can identify unique greenlets. Identity of a greenlet\n cannot be reused once a greenlet dies. 'id(greenlet)' cannot be used because\n 'id' returns an identifier that can be reused once a greenlet object is garbage\n coll... | def _create_greenlet_callbacks():
"\n Returns two functions:\n - one that can identify unique greenlets. Identity of a greenlet\n cannot be reused once a greenlet dies. 'id(greenlet)' cannot be used because\n 'id' returns an identifier that can be reused once a greenlet object is garbage\n coll... |
f199ef7cf9053fb06d32514139a5d9d430e39ba81eff09a7faa809b510ac296c | def _fft(x, COL_SIZE=8):
'\n function to prettify time columns in stats.\n '
_rprecision = 6
while (_rprecision > 0):
_fmt = (('%0.' + ('%d' % _rprecision)) + 'f')
s = (_fmt % x)
if (len(s) <= COL_SIZE):
break
_rprecision -= 1
return s | function to prettify time columns in stats. | yappi/yappi.py | _fft | gaborbernat/yappi | 877 | python | def _fft(x, COL_SIZE=8):
'\n \n '
_rprecision = 6
while (_rprecision > 0):
_fmt = (('%0.' + ('%d' % _rprecision)) + 'f')
s = (_fmt % x)
if (len(s) <= COL_SIZE):
break
_rprecision -= 1
return s | def _fft(x, COL_SIZE=8):
'\n \n '
_rprecision = 6
while (_rprecision > 0):
_fmt = (('%0.' + ('%d' % _rprecision)) + 'f')
s = (_fmt % x)
if (len(s) <= COL_SIZE):
break
_rprecision -= 1
return s<|docstring|>function to prettify time columns in stats.<|endo... |
3914d2c012eeaa553b3a4923326dab529aa6be815bf92a184c330e81eb8edbe9 | def func_matches(stat, funcs):
"\n This function will not work with stats that are saved and loaded. That is \n because current API of loading stats is as following:\n yappi.get_func_stats(filter_callback=_filter).add('dummy.ys').print_all()\n\n funcs: is an iterable that selects functions via method de... | This function will not work with stats that are saved and loaded. That is
because current API of loading stats is as following:
yappi.get_func_stats(filter_callback=_filter).add('dummy.ys').print_all()
funcs: is an iterable that selects functions via method descriptor/bound method
or function object. selector typ... | yappi/yappi.py | func_matches | gaborbernat/yappi | 877 | python | def func_matches(stat, funcs):
"\n This function will not work with stats that are saved and loaded. That is \n because current API of loading stats is as following:\n yappi.get_func_stats(filter_callback=_filter).add('dummy.ys').print_all()\n\n funcs: is an iterable that selects functions via method de... | def func_matches(stat, funcs):
"\n This function will not work with stats that are saved and loaded. That is \n because current API of loading stats is as following:\n yappi.get_func_stats(filter_callback=_filter).add('dummy.ys').print_all()\n\n funcs: is an iterable that selects functions via method de... |
65fd95eaec84a0b960aea6feda9c247e4f4bcc16cf8f033c76d967db47cfdd68 | def profile(clock_type='cpu', profile_builtins=False, return_callback=None):
'\n A profile decorator that can be used to profile a single call.\n\n We need to clear_stats() on entry/exit of the function unfortunately.\n As yappi is a per-interpreter resource, we cannot simply resume profiling\n session ... | A profile decorator that can be used to profile a single call.
We need to clear_stats() on entry/exit of the function unfortunately.
As yappi is a per-interpreter resource, we cannot simply resume profiling
session upon exit of the function, that is because we _may_ simply change
start() params which may differ from t... | yappi/yappi.py | profile | gaborbernat/yappi | 877 | python | def profile(clock_type='cpu', profile_builtins=False, return_callback=None):
'\n A profile decorator that can be used to profile a single call.\n\n We need to clear_stats() on entry/exit of the function unfortunately.\n As yappi is a per-interpreter resource, we cannot simply resume profiling\n session ... | def profile(clock_type='cpu', profile_builtins=False, return_callback=None):
'\n A profile decorator that can be used to profile a single call.\n\n We need to clear_stats() on entry/exit of the function unfortunately.\n As yappi is a per-interpreter resource, we cannot simply resume profiling\n session ... |
d4a841042e050334dd17b6c08792a4372ab7fcd5f3b1d8e506b1cdec7b897c0e | def is_running():
'\n Returns true if the profiler is running, false otherwise.\n '
return bool(_yappi.is_running()) | Returns true if the profiler is running, false otherwise. | yappi/yappi.py | is_running | gaborbernat/yappi | 877 | python | def is_running():
'\n \n '
return bool(_yappi.is_running()) | def is_running():
'\n \n '
return bool(_yappi.is_running())<|docstring|>Returns true if the profiler is running, false otherwise.<|endoftext|> |
c579ee1821c3ac4f8a1ea0f31b5dcbc1517b46a21d93e6c6235a4789db7d6812 | def start(builtins=False, profile_threads=True, profile_greenlets=True):
"\n Start profiler.\n\n profile_threads: Set to True to profile multiple threads. Set to false\n to profile only the invoking thread. This argument is only respected when\n context backend is 'native_thread' and ignored otherwise.\... | Start profiler.
profile_threads: Set to True to profile multiple threads. Set to false
to profile only the invoking thread. This argument is only respected when
context backend is 'native_thread' and ignored otherwise.
profile_greenlets: Set to True to to profile multiple greenlets. Set to
False to profile only the i... | yappi/yappi.py | start | gaborbernat/yappi | 877 | python | def start(builtins=False, profile_threads=True, profile_greenlets=True):
"\n Start profiler.\n\n profile_threads: Set to True to profile multiple threads. Set to false\n to profile only the invoking thread. This argument is only respected when\n context backend is 'native_thread' and ignored otherwise.\... | def start(builtins=False, profile_threads=True, profile_greenlets=True):
"\n Start profiler.\n\n profile_threads: Set to True to profile multiple threads. Set to false\n to profile only the invoking thread. This argument is only respected when\n context backend is 'native_thread' and ignored otherwise.\... |
a40c55c606f04b8dd160624e9781e842ae9784470f9a9e24e1b6034ccdc98e4f | def get_func_stats(tag=None, ctx_id=None, filter=None, filter_callback=None):
'\n Gets the function profiler results with given filters and returns an iterable.\n\n filter: is here mainly for backward compat. we will not document it anymore.\n tag, ctx_id: select given tag and ctx_id related stats in C sid... | Gets the function profiler results with given filters and returns an iterable.
filter: is here mainly for backward compat. we will not document it anymore.
tag, ctx_id: select given tag and ctx_id related stats in C side.
filter_callback: we could do it like: get_func_stats().filter(). The problem
with this approach i... | yappi/yappi.py | get_func_stats | gaborbernat/yappi | 877 | python | def get_func_stats(tag=None, ctx_id=None, filter=None, filter_callback=None):
'\n Gets the function profiler results with given filters and returns an iterable.\n\n filter: is here mainly for backward compat. we will not document it anymore.\n tag, ctx_id: select given tag and ctx_id related stats in C sid... | def get_func_stats(tag=None, ctx_id=None, filter=None, filter_callback=None):
'\n Gets the function profiler results with given filters and returns an iterable.\n\n filter: is here mainly for backward compat. we will not document it anymore.\n tag, ctx_id: select given tag and ctx_id related stats in C sid... |
6e6ace310154db2b79b9fd77d87f3def992b419299590e157a45ba137279a0ca | def get_thread_stats():
'\n Gets the thread profiler results with given filters and returns an iterable.\n '
return YThreadStats().get() | Gets the thread profiler results with given filters and returns an iterable. | yappi/yappi.py | get_thread_stats | gaborbernat/yappi | 877 | python | def get_thread_stats():
'\n \n '
return YThreadStats().get() | def get_thread_stats():
'\n \n '
return YThreadStats().get()<|docstring|>Gets the thread profiler results with given filters and returns an iterable.<|endoftext|> |
a70dee86115699c9db85e9d0bca843bccdbbe29c17d631575f0d323d86a47007 | def get_greenlet_stats():
'\n Gets the greenlet stats captured by the profiler\n '
return YGreenletStats().get() | Gets the greenlet stats captured by the profiler | yappi/yappi.py | get_greenlet_stats | gaborbernat/yappi | 877 | python | def get_greenlet_stats():
'\n \n '
return YGreenletStats().get() | def get_greenlet_stats():
'\n \n '
return YGreenletStats().get()<|docstring|>Gets the greenlet stats captured by the profiler<|endoftext|> |
201253b27daf84bdda97bf905731ebf12fd51d9bcd41b3f3bfc7ddb463c4be3b | def stop():
'\n Stop profiler.\n '
_yappi.stop()
threading.setprofile(None) | Stop profiler. | yappi/yappi.py | stop | gaborbernat/yappi | 877 | python | def stop():
'\n \n '
_yappi.stop()
threading.setprofile(None) | def stop():
'\n \n '
_yappi.stop()
threading.setprofile(None)<|docstring|>Stop profiler.<|endoftext|> |
6de6cc0be4de5e345dd6e9bf6619a8065b6362c5f64da757ba6cad1e594b3cb9 | @contextmanager
def run(builtins=False, profile_threads=True, profile_greenlets=True):
'\n Context manger for profiling block of code.\n\n Starts profiling before entering the context, and stop profilying when\n exiting from the context.\n\n Usage:\n\n with yappi.run():\n print("this c... | Context manger for profiling block of code.
Starts profiling before entering the context, and stop profilying when
exiting from the context.
Usage:
with yappi.run():
print("this call is profiled")
Warning: don't use this recursively, the inner context will stop profiling
when exited:
with yappi.run... | yappi/yappi.py | run | gaborbernat/yappi | 877 | python | @contextmanager
def run(builtins=False, profile_threads=True, profile_greenlets=True):
'\n Context manger for profiling block of code.\n\n Starts profiling before entering the context, and stop profilying when\n exiting from the context.\n\n Usage:\n\n with yappi.run():\n print("this c... | @contextmanager
def run(builtins=False, profile_threads=True, profile_greenlets=True):
'\n Context manger for profiling block of code.\n\n Starts profiling before entering the context, and stop profilying when\n exiting from the context.\n\n Usage:\n\n with yappi.run():\n print("this c... |
fd9c71b3c58ba6298299d24d105d299edb5b88e5b48ad9519c28725c2252ae9f | def clear_stats():
'\n Clears all of the profile results.\n '
_yappi._pause()
try:
_yappi.clear_stats()
finally:
_yappi._resume() | Clears all of the profile results. | yappi/yappi.py | clear_stats | gaborbernat/yappi | 877 | python | def clear_stats():
'\n \n '
_yappi._pause()
try:
_yappi.clear_stats()
finally:
_yappi._resume() | def clear_stats():
'\n \n '
_yappi._pause()
try:
_yappi.clear_stats()
finally:
_yappi._resume()<|docstring|>Clears all of the profile results.<|endoftext|> |
0261c49a1498a3083ef340b40bf31ce7d2917bf6e37d878d1f37c2d7c70b9e23 | def get_clock_time():
'\n Returns the current clock time with regard to current clock type.\n '
return _yappi.get_clock_time() | Returns the current clock time with regard to current clock type. | yappi/yappi.py | get_clock_time | gaborbernat/yappi | 877 | python | def get_clock_time():
'\n \n '
return _yappi.get_clock_time() | def get_clock_time():
'\n \n '
return _yappi.get_clock_time()<|docstring|>Returns the current clock time with regard to current clock type.<|endoftext|> |
07c61b933ad311e695c8548ff4739e953630c944562a3e23982c70670537c8c4 | def get_clock_type():
'\n Returns the underlying clock type\n '
return _yappi.get_clock_type() | Returns the underlying clock type | yappi/yappi.py | get_clock_type | gaborbernat/yappi | 877 | python | def get_clock_type():
'\n \n '
return _yappi.get_clock_type() | def get_clock_type():
'\n \n '
return _yappi.get_clock_type()<|docstring|>Returns the underlying clock type<|endoftext|> |
486c47d3a6eebdec333b847fc902332d9bff5f3a8ce5d96b51c5a39a2c0b430d | def get_clock_info():
'\n Returns a dict containing the OS API used for timing, the precision of the\n underlying clock.\n '
return _yappi.get_clock_info() | Returns a dict containing the OS API used for timing, the precision of the
underlying clock. | yappi/yappi.py | get_clock_info | gaborbernat/yappi | 877 | python | def get_clock_info():
'\n Returns a dict containing the OS API used for timing, the precision of the\n underlying clock.\n '
return _yappi.get_clock_info() | def get_clock_info():
'\n Returns a dict containing the OS API used for timing, the precision of the\n underlying clock.\n '
return _yappi.get_clock_info()<|docstring|>Returns a dict containing the OS API used for timing, the precision of the
underlying clock.<|endoftext|> |
ac55b277ad3fb7747322e3493577d143efbb3abc70d86a0dcf2ab948a3b7f77b | def set_clock_type(type):
'\n Sets the internal clock type for timing. Profiler shall not have any previous stats.\n Otherwise an exception is thrown.\n '
type = type.upper()
if (type not in CLOCK_TYPES):
raise YappiError(('Invalid clock type:%s' % type))
_yappi.set_clock_type(CLOCK_TYP... | Sets the internal clock type for timing. Profiler shall not have any previous stats.
Otherwise an exception is thrown. | yappi/yappi.py | set_clock_type | gaborbernat/yappi | 877 | python | def set_clock_type(type):
'\n Sets the internal clock type for timing. Profiler shall not have any previous stats.\n Otherwise an exception is thrown.\n '
type = type.upper()
if (type not in CLOCK_TYPES):
raise YappiError(('Invalid clock type:%s' % type))
_yappi.set_clock_type(CLOCK_TYP... | def set_clock_type(type):
'\n Sets the internal clock type for timing. Profiler shall not have any previous stats.\n Otherwise an exception is thrown.\n '
type = type.upper()
if (type not in CLOCK_TYPES):
raise YappiError(('Invalid clock type:%s' % type))
_yappi.set_clock_type(CLOCK_TYP... |
c4515ef31fce816dd4a946c97093ba63a08cba8392409c26aa5c5d0cfee70de6 | def get_mem_usage():
'\n Returns the internal memory usage of the profiler itself.\n '
return _yappi.get_mem_usage() | Returns the internal memory usage of the profiler itself. | yappi/yappi.py | get_mem_usage | gaborbernat/yappi | 877 | python | def get_mem_usage():
'\n \n '
return _yappi.get_mem_usage() | def get_mem_usage():
'\n \n '
return _yappi.get_mem_usage()<|docstring|>Returns the internal memory usage of the profiler itself.<|endoftext|> |
f1399168ab506cadf8cf141392abca66ff6d49b261fd423193fe77c8184f18f6 | def set_tag_callback(cbk):
'\n Every stat. entry will have a specific tag field and users might be able\n to filter on stats via tag field.\n '
return _yappi.set_tag_callback(cbk) | Every stat. entry will have a specific tag field and users might be able
to filter on stats via tag field. | yappi/yappi.py | set_tag_callback | gaborbernat/yappi | 877 | python | def set_tag_callback(cbk):
'\n Every stat. entry will have a specific tag field and users might be able\n to filter on stats via tag field.\n '
return _yappi.set_tag_callback(cbk) | def set_tag_callback(cbk):
'\n Every stat. entry will have a specific tag field and users might be able\n to filter on stats via tag field.\n '
return _yappi.set_tag_callback(cbk)<|docstring|>Every stat. entry will have a specific tag field and users might be able
to filter on stats via tag field.<|end... |
98ea756258afe4e5725bb29894a89c698d3d923e130fe45c20efae7edf4de3c3 | def set_context_backend(type):
'\n Sets the internal context backend used to track execution context.\n\n type must be one of \'greenlet\' or \'native_thread\'. For example:\n\n >>> import greenlet, yappi\n >>> yappi.set_context_backend("greenlet")\n\n Setting the context backend will reset any callb... | Sets the internal context backend used to track execution context.
type must be one of 'greenlet' or 'native_thread'. For example:
>>> import greenlet, yappi
>>> yappi.set_context_backend("greenlet")
Setting the context backend will reset any callbacks configured via:
- set_context_id_callback
- set_context_name... | yappi/yappi.py | set_context_backend | gaborbernat/yappi | 877 | python | def set_context_backend(type):
'\n Sets the internal context backend used to track execution context.\n\n type must be one of \'greenlet\' or \'native_thread\'. For example:\n\n >>> import greenlet, yappi\n >>> yappi.set_context_backend("greenlet")\n\n Setting the context backend will reset any callb... | def set_context_backend(type):
'\n Sets the internal context backend used to track execution context.\n\n type must be one of \'greenlet\' or \'native_thread\'. For example:\n\n >>> import greenlet, yappi\n >>> yappi.set_context_backend("greenlet")\n\n Setting the context backend will reset any callb... |
0bcd6845b6ec9835bdc736746afd67e2b858b2c4d9ef4cc8c3a334ad5ef95977 | def set_context_id_callback(callback):
'\n Use a number other than thread_id to determine the current context.\n\n The callback must take no arguments and return an integer. For example:\n\n >>> import greenlet, yappi\n >>> yappi.set_context_id_callback(lambda: id(greenlet.getcurrent()))\n '
retu... | Use a number other than thread_id to determine the current context.
The callback must take no arguments and return an integer. For example:
>>> import greenlet, yappi
>>> yappi.set_context_id_callback(lambda: id(greenlet.getcurrent())) | yappi/yappi.py | set_context_id_callback | gaborbernat/yappi | 877 | python | def set_context_id_callback(callback):
'\n Use a number other than thread_id to determine the current context.\n\n The callback must take no arguments and return an integer. For example:\n\n >>> import greenlet, yappi\n >>> yappi.set_context_id_callback(lambda: id(greenlet.getcurrent()))\n '
retu... | def set_context_id_callback(callback):
'\n Use a number other than thread_id to determine the current context.\n\n The callback must take no arguments and return an integer. For example:\n\n >>> import greenlet, yappi\n >>> yappi.set_context_id_callback(lambda: id(greenlet.getcurrent()))\n '
retu... |
021f07146ba1e92eb295fb364f26555145ced90246ca188499eaf2ddc3bb908b | def set_context_name_callback(callback):
"\n Set the callback to retrieve current context's name.\n\n The callback must take no arguments and return a string. For example:\n\n >>> import greenlet, yappi\n >>> yappi.set_context_name_callback(\n ... lambda: greenlet.getcurrent().__class__.__name__)... | Set the callback to retrieve current context's name.
The callback must take no arguments and return a string. For example:
>>> import greenlet, yappi
>>> yappi.set_context_name_callback(
... lambda: greenlet.getcurrent().__class__.__name__)
If the callback cannot return the name at this time but may be able to
r... | yappi/yappi.py | set_context_name_callback | gaborbernat/yappi | 877 | python | def set_context_name_callback(callback):
"\n Set the callback to retrieve current context's name.\n\n The callback must take no arguments and return a string. For example:\n\n >>> import greenlet, yappi\n >>> yappi.set_context_name_callback(\n ... lambda: greenlet.getcurrent().__class__.__name__)... | def set_context_name_callback(callback):
"\n Set the callback to retrieve current context's name.\n\n The callback must take no arguments and return a string. For example:\n\n >>> import greenlet, yappi\n >>> yappi.set_context_name_callback(\n ... lambda: greenlet.getcurrent().__class__.__name__)... |
413312f1335f4ee9ab3cbddae6b5d6f86e8594a1c3e4ab7c7fe4bb90d67553d9 | def _debug_check_sanity(self):
'\n Check for basic sanity errors in stats. e.g: Check for duplicate stats.\n '
for x in self:
if (self.count(x) > 1):
return False
return True | Check for basic sanity errors in stats. e.g: Check for duplicate stats. | yappi/yappi.py | _debug_check_sanity | gaborbernat/yappi | 877 | python | def _debug_check_sanity(self):
'\n \n '
for x in self:
if (self.count(x) > 1):
return False
return True | def _debug_check_sanity(self):
'\n \n '
for x in self:
if (self.count(x) > 1):
return False
return True<|docstring|>Check for basic sanity errors in stats. e.g: Check for duplicate stats.<|endoftext|> |
1ad59e1a51972b7df467da555ad559bbb8b31f939a24a7958931b290abeae188 | def print_all(self, out=sys.stdout, columns={0: ('name', 36), 1: ('ncall', 5), 2: ('tsub', 8), 3: ('ttot', 8), 4: ('tavg', 8)}):
'\n Prints all of the child function profiler results to a given file. (stdout by default)\n '
if (self.empty() or (len(columns) == 0)):
return
for (_, col) ... | Prints all of the child function profiler results to a given file. (stdout by default) | yappi/yappi.py | print_all | gaborbernat/yappi | 877 | python | def print_all(self, out=sys.stdout, columns={0: ('name', 36), 1: ('ncall', 5), 2: ('tsub', 8), 3: ('ttot', 8), 4: ('tavg', 8)}):
'\n \n '
if (self.empty() or (len(columns) == 0)):
return
for (_, col) in columns.items():
_validate_columns(col[0], COLUMNS_FUNCSTATS)
out.write... | def print_all(self, out=sys.stdout, columns={0: ('name', 36), 1: ('ncall', 5), 2: ('tsub', 8), 3: ('ttot', 8), 4: ('tavg', 8)}):
'\n \n '
if (self.empty() or (len(columns) == 0)):
return
for (_, col) in columns.items():
_validate_columns(col[0], COLUMNS_FUNCSTATS)
out.write... |
ba2b7312c4c88ff84dddc6ff5b89e114fda4d906bcd8c32eec9aa8573690afaf | def _save_as_PSTAT(self, path):
'\n Save the profiling information as PSTAT.\n '
_stats = convert2pstats(self)
_stats.dump_stats(path) | Save the profiling information as PSTAT. | yappi/yappi.py | _save_as_PSTAT | gaborbernat/yappi | 877 | python | def _save_as_PSTAT(self, path):
'\n \n '
_stats = convert2pstats(self)
_stats.dump_stats(path) | def _save_as_PSTAT(self, path):
'\n \n '
_stats = convert2pstats(self)
_stats.dump_stats(path)<|docstring|>Save the profiling information as PSTAT.<|endoftext|> |
9346d0c612dc3879f13bc3998283b3b6f521cf9b3b2c8d65b9bfc3a682b468f2 | def _save_as_CALLGRIND(self, path):
'\n Writes all the function stats in a callgrind-style format to the given\n file. (stdout by default)\n '
header = ('version: 1\ncreator: %s\npid: %d\ncmd: %s\npart: 1\n\nevents: Ticks' % ('yappi', os.getpid(), ' '.join(sys.argv)))
lines = [header]
... | Writes all the function stats in a callgrind-style format to the given
file. (stdout by default) | yappi/yappi.py | _save_as_CALLGRIND | gaborbernat/yappi | 877 | python | def _save_as_CALLGRIND(self, path):
'\n Writes all the function stats in a callgrind-style format to the given\n file. (stdout by default)\n '
header = ('version: 1\ncreator: %s\npid: %d\ncmd: %s\npart: 1\n\nevents: Ticks' % ('yappi', os.getpid(), ' '.join(sys.argv)))
lines = [header]
... | def _save_as_CALLGRIND(self, path):
'\n Writes all the function stats in a callgrind-style format to the given\n file. (stdout by default)\n '
header = ('version: 1\ncreator: %s\npid: %d\ncmd: %s\npart: 1\n\nevents: Ticks' % ('yappi', os.getpid(), ' '.join(sys.argv)))
lines = [header]
... |
0ca88b324a1e87b6fe1ce5f32bb5b2c05531f7f1c314ad677d3852b4d539979c | def print_all(self, out=sys.stdout, columns={0: ('name', 36), 1: ('ncall', 5), 2: ('tsub', 8), 3: ('ttot', 8), 4: ('tavg', 8)}):
'\n Prints all of the function profiler results to a given file. (stdout by default)\n '
if self.empty():
return
for (_, col) in columns.items():
_va... | Prints all of the function profiler results to a given file. (stdout by default) | yappi/yappi.py | print_all | gaborbernat/yappi | 877 | python | def print_all(self, out=sys.stdout, columns={0: ('name', 36), 1: ('ncall', 5), 2: ('tsub', 8), 3: ('ttot', 8), 4: ('tavg', 8)}):
'\n \n '
if self.empty():
return
for (_, col) in columns.items():
_validate_columns(col[0], COLUMNS_FUNCSTATS)
out.write(LINESEP)
out.write((... | def print_all(self, out=sys.stdout, columns={0: ('name', 36), 1: ('ncall', 5), 2: ('tsub', 8), 3: ('ttot', 8), 4: ('tavg', 8)}):
'\n \n '
if self.empty():
return
for (_, col) in columns.items():
_validate_columns(col[0], COLUMNS_FUNCSTATS)
out.write(LINESEP)
out.write((... |
7d8f89e48bb43eca91fb135ca73e50a7944ce00c27b04aa28a9b77ca5f767a7d | def print_all(self, out=sys.stdout, columns=None):
'\n Prints all of the thread profiler results to a given file. (stdout by default)\n '
if (columns is None):
columns = self._DEFAULT_PRINT_COLUMNS
if self.empty():
return
for (_, col) in columns.items():
_validate_c... | Prints all of the thread profiler results to a given file. (stdout by default) | yappi/yappi.py | print_all | gaborbernat/yappi | 877 | python | def print_all(self, out=sys.stdout, columns=None):
'\n \n '
if (columns is None):
columns = self._DEFAULT_PRINT_COLUMNS
if self.empty():
return
for (_, col) in columns.items():
_validate_columns(col[0], self._ALL_COLUMNS)
out.write(LINESEP)
self._print_heade... | def print_all(self, out=sys.stdout, columns=None):
'\n \n '
if (columns is None):
columns = self._DEFAULT_PRINT_COLUMNS
if self.empty():
return
for (_, col) in columns.items():
_validate_columns(col[0], self._ALL_COLUMNS)
out.write(LINESEP)
self._print_heade... |
d0b527c7759dfefa8b2accd26e44a9dadfc70be8d9f91b5d3dda47ee43f1435e | def setUp(self):
'\n If no key/cert pair found, generate a new\n key/cert pair and store as a file.\n '
call(['openssl', 'req', '-x509', '-nodes', '-days', '1', '-newkey', 'rsa:2048', '-keyout', TEST_KEY_FILE, '-out', TEST_CERT_FILE, '-subj', TEST_CERT_DN])
p1 = Popen(['openssl', 'x509'... | If no key/cert pair found, generate a new
key/cert pair and store as a file. | test/test_crypto.py | setUp | RoseECooper/ssm | 7 | python | def setUp(self):
'\n If no key/cert pair found, generate a new\n key/cert pair and store as a file.\n '
call(['openssl', 'req', '-x509', '-nodes', '-days', '1', '-newkey', 'rsa:2048', '-keyout', TEST_KEY_FILE, '-out', TEST_CERT_FILE, '-subj', TEST_CERT_DN])
p1 = Popen(['openssl', 'x509'... | def setUp(self):
'\n If no key/cert pair found, generate a new\n key/cert pair and store as a file.\n '
call(['openssl', 'req', '-x509', '-nodes', '-days', '1', '-newkey', 'rsa:2048', '-keyout', TEST_KEY_FILE, '-out', TEST_CERT_FILE, '-subj', TEST_CERT_DN])
p1 = Popen(['openssl', 'x509'... |
730c937fc75e5f528df91ace30f82ab5fa1ea7a326b12f74d6d02794b771b530 | def tearDown(self):
'Remove temporary files.'
os.remove(TEST_CERT_FILE)
os.remove(TEST_KEY_FILE)
os.remove(self.ca_certpath) | Remove temporary files. | test/test_crypto.py | tearDown | RoseECooper/ssm | 7 | python | def tearDown(self):
os.remove(TEST_CERT_FILE)
os.remove(TEST_KEY_FILE)
os.remove(self.ca_certpath) | def tearDown(self):
os.remove(TEST_CERT_FILE)
os.remove(TEST_KEY_FILE)
os.remove(self.ca_certpath)<|docstring|>Remove temporary files.<|endoftext|> |
10a53171a0dd735999b37c302f2dc1ccba97698eef80b1e14fc3de2364593c63 | def test_check_cert_key(self):
'Check that valid cert and key works.'
self.assertTrue(check_cert_key(TEST_CERT_FILE, TEST_KEY_FILE), 'Cert and key match but function failed.') | Check that valid cert and key works. | test/test_crypto.py | test_check_cert_key | RoseECooper/ssm | 7 | python | def test_check_cert_key(self):
self.assertTrue(check_cert_key(TEST_CERT_FILE, TEST_KEY_FILE), 'Cert and key match but function failed.') | def test_check_cert_key(self):
self.assertTrue(check_cert_key(TEST_CERT_FILE, TEST_KEY_FILE), 'Cert and key match but function failed.')<|docstring|>Check that valid cert and key works.<|endoftext|> |
d66befabfec8066f41d5e01a4f9b6fdadc8909e1cfcf660512824ad4f8a443cf | def test_check_cert_key_invalid_paths(self):
"Check invalid file paths don't return True."
self.assertFalse(check_cert_key('hello', 'hello'), 'Accepted invalid file paths.')
self.assertFalse(check_cert_key(TEST_CERT_FILE, 'k'), 'Accepted invalid key path.')
self.assertFalse(check_cert_key('c', TEST_KEY_... | Check invalid file paths don't return True. | test/test_crypto.py | test_check_cert_key_invalid_paths | RoseECooper/ssm | 7 | python | def test_check_cert_key_invalid_paths(self):
self.assertFalse(check_cert_key('hello', 'hello'), 'Accepted invalid file paths.')
self.assertFalse(check_cert_key(TEST_CERT_FILE, 'k'), 'Accepted invalid key path.')
self.assertFalse(check_cert_key('c', TEST_KEY_FILE), 'Accepted invalid cert path.') | def test_check_cert_key_invalid_paths(self):
self.assertFalse(check_cert_key('hello', 'hello'), 'Accepted invalid file paths.')
self.assertFalse(check_cert_key(TEST_CERT_FILE, 'k'), 'Accepted invalid key path.')
self.assertFalse(check_cert_key('c', TEST_KEY_FILE), 'Accepted invalid cert path.')<|docstr... |
bae084d842425dc54d16883ed7cad79413019f1bd88c21cf855563528764d901 | def test_check_cert_key_arg_order(self):
"Check incorrect order of cert and key path args doesn't succeed."
self.assertFalse(check_cert_key(TEST_CERT_FILE, TEST_CERT_FILE), 'Accepted certificate as key.')
self.assertFalse(check_cert_key(TEST_KEY_FILE, TEST_KEY_FILE), 'Accepted key as cert.')
self.assert... | Check incorrect order of cert and key path args doesn't succeed. | test/test_crypto.py | test_check_cert_key_arg_order | RoseECooper/ssm | 7 | python | def test_check_cert_key_arg_order(self):
self.assertFalse(check_cert_key(TEST_CERT_FILE, TEST_CERT_FILE), 'Accepted certificate as key.')
self.assertFalse(check_cert_key(TEST_KEY_FILE, TEST_KEY_FILE), 'Accepted key as cert.')
self.assertFalse(check_cert_key(TEST_KEY_FILE, TEST_CERT_FILE), 'Accepted key... | def test_check_cert_key_arg_order(self):
self.assertFalse(check_cert_key(TEST_CERT_FILE, TEST_CERT_FILE), 'Accepted certificate as key.')
self.assertFalse(check_cert_key(TEST_KEY_FILE, TEST_KEY_FILE), 'Accepted key as cert.')
self.assertFalse(check_cert_key(TEST_KEY_FILE, TEST_CERT_FILE), 'Accepted key... |
0a8b65565c0b602a5c5285dbec0ddfe899a432709367db9df5dfae2808f4a70f | def test_check_cert_key_invalid_files(self):
'Check behaviour with an invalid cert or key file.'
with tempfile.NamedTemporaryFile() as tmp:
self.assertFalse(check_cert_key(tmp.name, TEST_KEY_FILE), 'Accepted invalid cert file.')
self.assertFalse(check_cert_key(TEST_CERT_FILE, tmp.name), 'Accepte... | Check behaviour with an invalid cert or key file. | test/test_crypto.py | test_check_cert_key_invalid_files | RoseECooper/ssm | 7 | python | def test_check_cert_key_invalid_files(self):
with tempfile.NamedTemporaryFile() as tmp:
self.assertFalse(check_cert_key(tmp.name, TEST_KEY_FILE), 'Accepted invalid cert file.')
self.assertFalse(check_cert_key(TEST_CERT_FILE, tmp.name), 'Accepted invalid key file.') | def test_check_cert_key_invalid_files(self):
with tempfile.NamedTemporaryFile() as tmp:
self.assertFalse(check_cert_key(tmp.name, TEST_KEY_FILE), 'Accepted invalid cert file.')
self.assertFalse(check_cert_key(TEST_CERT_FILE, tmp.name), 'Accepted invalid key file.')<|docstring|>Check behaviour w... |
7b84a1496fcd35531aaed9c126bb0a2112b0221cc976a4805271d46e19ec973d | def test_sign(self):
"\n I haven't found a good way to test this yet. Each time you sign a\n message, the output has a random element, so you can't compare strings.\n "
signed = sign(MSG, TEST_CERT_FILE, TEST_KEY_FILE)
if ('MIME-Version' not in signed):
self.fail("Didn't get MI... | I haven't found a good way to test this yet. Each time you sign a
message, the output has a random element, so you can't compare strings. | test/test_crypto.py | test_sign | RoseECooper/ssm | 7 | python | def test_sign(self):
"\n I haven't found a good way to test this yet. Each time you sign a\n message, the output has a random element, so you can't compare strings.\n "
signed = sign(MSG, TEST_CERT_FILE, TEST_KEY_FILE)
if ('MIME-Version' not in signed):
self.fail("Didn't get MI... | def test_sign(self):
"\n I haven't found a good way to test this yet. Each time you sign a\n message, the output has a random element, so you can't compare strings.\n "
signed = sign(MSG, TEST_CERT_FILE, TEST_KEY_FILE)
if ('MIME-Version' not in signed):
self.fail("Didn't get MI... |
af342476d6c976ce0e848a7dfcbff4ad075b1314ca008e81825626ba992be197 | def test_get_certificate_subject(self):
'\n Check that the correct DN is extracted from the cert.\n Check that incorrect input gives an appropriate error.\n '
with open(TEST_CERT_FILE, 'r') as test_cert:
cert_string = test_cert.read()
dn = get_certificate_subject(cert_string)
... | Check that the correct DN is extracted from the cert.
Check that incorrect input gives an appropriate error. | test/test_crypto.py | test_get_certificate_subject | RoseECooper/ssm | 7 | python | def test_get_certificate_subject(self):
'\n Check that the correct DN is extracted from the cert.\n Check that incorrect input gives an appropriate error.\n '
with open(TEST_CERT_FILE, 'r') as test_cert:
cert_string = test_cert.read()
dn = get_certificate_subject(cert_string)
... | def test_get_certificate_subject(self):
'\n Check that the correct DN is extracted from the cert.\n Check that incorrect input gives an appropriate error.\n '
with open(TEST_CERT_FILE, 'r') as test_cert:
cert_string = test_cert.read()
dn = get_certificate_subject(cert_string)
... |
6d1f1bc63464ae8be0c5625144093f408aecd8f1b4c2f12507bd014b05b8e005 | def test_get_signer_cert(self):
'\n Check that the certificate retrieved from the signed message\n matches the certificate used to sign it.\n '
signed_msg = sign(MSG, TEST_CERT_FILE, TEST_KEY_FILE)
cert = get_signer_cert(signed_msg)
cert = cert[cert.find('-----BEGIN'):]
with ope... | Check that the certificate retrieved from the signed message
matches the certificate used to sign it. | test/test_crypto.py | test_get_signer_cert | RoseECooper/ssm | 7 | python | def test_get_signer_cert(self):
'\n Check that the certificate retrieved from the signed message\n matches the certificate used to sign it.\n '
signed_msg = sign(MSG, TEST_CERT_FILE, TEST_KEY_FILE)
cert = get_signer_cert(signed_msg)
cert = cert[cert.find('-----BEGIN'):]
with ope... | def test_get_signer_cert(self):
'\n Check that the certificate retrieved from the signed message\n matches the certificate used to sign it.\n '
signed_msg = sign(MSG, TEST_CERT_FILE, TEST_KEY_FILE)
cert = get_signer_cert(signed_msg)
cert = cert[cert.find('-----BEGIN'):]
with ope... |
a1d6320fd8c37e5b2f9f1daffbf4b568a7f886f081eca8868cbc0e0ce4e5a92b | def test_encrypt(self):
'\n Not a correct test yet.\n '
encrypted = encrypt(MSG, TEST_CERT_FILE)
if ('MIME-Version' not in encrypted):
self.fail('Encrypted message is not MIME')
decrypted = decrypt(encrypted, TEST_CERT_FILE, TEST_KEY_FILE)
if (decrypted != MSG):
self.fa... | Not a correct test yet. | test/test_crypto.py | test_encrypt | RoseECooper/ssm | 7 | python | def test_encrypt(self):
'\n \n '
encrypted = encrypt(MSG, TEST_CERT_FILE)
if ('MIME-Version' not in encrypted):
self.fail('Encrypted message is not MIME')
decrypted = decrypt(encrypted, TEST_CERT_FILE, TEST_KEY_FILE)
if (decrypted != MSG):
self.fail("Encrypted message w... | def test_encrypt(self):
'\n \n '
encrypted = encrypt(MSG, TEST_CERT_FILE)
if ('MIME-Version' not in encrypted):
self.fail('Encrypted message is not MIME')
decrypted = decrypt(encrypted, TEST_CERT_FILE, TEST_KEY_FILE)
if (decrypted != MSG):
self.fail("Encrypted message w... |
a9bef7b9489fefe66eb1bd6c311596cfa1a57959acaf421281f22af9a92f1297 | def test_decrypt(self):
'\n Check that the encrypted message can be decrypted and returns the\n original message.\n '
encrypted = encrypt(MSG, TEST_CERT_FILE)
decrypted = decrypt(encrypted, TEST_CERT_FILE, TEST_KEY_FILE)
if (decrypted.strip() != MSG):
self.fail('Failed to de... | Check that the encrypted message can be decrypted and returns the
original message. | test/test_crypto.py | test_decrypt | RoseECooper/ssm | 7 | python | def test_decrypt(self):
'\n Check that the encrypted message can be decrypted and returns the\n original message.\n '
encrypted = encrypt(MSG, TEST_CERT_FILE)
decrypted = decrypt(encrypted, TEST_CERT_FILE, TEST_KEY_FILE)
if (decrypted.strip() != MSG):
self.fail('Failed to de... | def test_decrypt(self):
'\n Check that the encrypted message can be decrypted and returns the\n original message.\n '
encrypted = encrypt(MSG, TEST_CERT_FILE)
decrypted = decrypt(encrypted, TEST_CERT_FILE, TEST_KEY_FILE)
if (decrypted.strip() != MSG):
self.fail('Failed to de... |
3ea60f8cf507738f51e03b224252b88a25be42aca57c72c1915c2bb78ff4419e | def test_verify_cert(self):
"\n Check that the test certificate is verified against itself, and that\n it doesn't verify without the correct CA directory. Check that a\n nonsense string isn't verified.\n\n I can't check the CRLs of a self-signed certificate easily.\n "
with o... | Check that the test certificate is verified against itself, and that
it doesn't verify without the correct CA directory. Check that a
nonsense string isn't verified.
I can't check the CRLs of a self-signed certificate easily. | test/test_crypto.py | test_verify_cert | RoseECooper/ssm | 7 | python | def test_verify_cert(self):
"\n Check that the test certificate is verified against itself, and that\n it doesn't verify without the correct CA directory. Check that a\n nonsense string isn't verified.\n\n I can't check the CRLs of a self-signed certificate easily.\n "
with o... | def test_verify_cert(self):
"\n Check that the test certificate is verified against itself, and that\n it doesn't verify without the correct CA directory. Check that a\n nonsense string isn't verified.\n\n I can't check the CRLs of a self-signed certificate easily.\n "
with o... |
c2c177d5111b48797a1e654011902e9cd39406e51a76413d03dd8b1dd0d489f0 | def test_message_tampering(self):
'Test that a tampered message is not accepted as valid.'
signed_message = sign(MSG, TEST_CERT_FILE, TEST_KEY_FILE)
tampered_message = signed_message.replace(MSG, 'Spam')
(verified_message, verified_signer) = verify(signed_message, TEST_CA_DIR, False)
self.assertEqua... | Test that a tampered message is not accepted as valid. | test/test_crypto.py | test_message_tampering | RoseECooper/ssm | 7 | python | def test_message_tampering(self):
signed_message = sign(MSG, TEST_CERT_FILE, TEST_KEY_FILE)
tampered_message = signed_message.replace(MSG, 'Spam')
(verified_message, verified_signer) = verify(signed_message, TEST_CA_DIR, False)
self.assertEqual(verified_message, MSG)
self.assertEqual(verified_s... | def test_message_tampering(self):
signed_message = sign(MSG, TEST_CERT_FILE, TEST_KEY_FILE)
tampered_message = signed_message.replace(MSG, 'Spam')
(verified_message, verified_signer) = verify(signed_message, TEST_CA_DIR, False)
self.assertEqual(verified_message, MSG)
self.assertEqual(verified_s... |
f508c3e71ab5a335bad88831d1cd2254ba50f46914b3ab09e497f79307e5be27 | def chunks(l, n):
'Yield successive n-sized chunks from l.'
for i in range(0, len(l), n):
(yield l[i:(i + n)]) | Yield successive n-sized chunks from l. | yield.py | chunks | robertbyers1111/python | 0 | python | def chunks(l, n):
for i in range(0, len(l), n):
(yield l[i:(i + n)]) | def chunks(l, n):
for i in range(0, len(l), n):
(yield l[i:(i + n)])<|docstring|>Yield successive n-sized chunks from l.<|endoftext|> |
b87aad031a924ae68dac9c6216a7a4fb5bcab126af6b9a56f09bcdc1edc514b7 | def get_min_realtime(stock_code):
'\n ่ทๅ่ก็ฅจ1ๅ้ๅฎๆถ่กๆ
ใ\n \n Parameters\n ----------\n stock_code\n ่ก็ฅจไปฃ็ \n \n Returns\n -------\n DataFrame\n ่ฅๅฝๆฅๆ ๆฐๆฎ,ๅ่ฟๅNone\n '
r = redis.Redis(connection_pool=pool)
data = r.hgetall(':'.join(['KLine', '1Min', stock_code, dt.datetim... | ่ทๅ่ก็ฅจ1ๅ้ๅฎๆถ่กๆ
ใ
Parameters
----------
stock_code
่ก็ฅจไปฃ็
Returns
-------
DataFrame
่ฅๅฝๆฅๆ ๆฐๆฎ,ๅ่ฟๅNone | api_realtime.py | get_min_realtime | challenger-zpp/dataflow | 0 | python | def get_min_realtime(stock_code):
'\n ่ทๅ่ก็ฅจ1ๅ้ๅฎๆถ่กๆ
ใ\n \n Parameters\n ----------\n stock_code\n ่ก็ฅจไปฃ็ \n \n Returns\n -------\n DataFrame\n ่ฅๅฝๆฅๆ ๆฐๆฎ,ๅ่ฟๅNone\n '
r = redis.Redis(connection_pool=pool)
data = r.hgetall(':'.join(['KLine', '1Min', stock_code, dt.datetim... | def get_min_realtime(stock_code):
'\n ่ทๅ่ก็ฅจ1ๅ้ๅฎๆถ่กๆ
ใ\n \n Parameters\n ----------\n stock_code\n ่ก็ฅจไปฃ็ \n \n Returns\n -------\n DataFrame\n ่ฅๅฝๆฅๆ ๆฐๆฎ,ๅ่ฟๅNone\n '
r = redis.Redis(connection_pool=pool)
data = r.hgetall(':'.join(['KLine', '1Min', stock_code, dt.datetim... |
fd6ce0900221b5b19dc4e0ca3c23865f3af4c44e6f929ff20dade41cb04abf47 | def read_dataset(path, sep):
'\n path: path to dataset file\n return: Dataframe -> pandas type\n '
return pd.read_csv(path, sep=sep) | path: path to dataset file
return: Dataframe -> pandas type | brasileirao/main.py | read_dataset | Vitoraugustoliveira/python-tutorial | 0 | python | def read_dataset(path, sep):
'\n path: path to dataset file\n return: Dataframe -> pandas type\n '
return pd.read_csv(path, sep=sep) | def read_dataset(path, sep):
'\n path: path to dataset file\n return: Dataframe -> pandas type\n '
return pd.read_csv(path, sep=sep)<|docstring|>path: path to dataset file
return: Dataframe -> pandas type<|endoftext|> |
9738670fa6edb27cc344e841fe056f41d825a0ae24d23dba04521c503ce16b5b | def try_add(self, item):
'\n Tries to add an item to the inventory.\n\n Returns True on success otherwise False.\n '
if (not self.has_room_for_item(item)):
return False
else:
if item.has('stacker'):
self.try_stack_item(item)
if (item.stacker.size ... | Tries to add an item to the inventory.
Returns True on success otherwise False. | inventory.py | try_add | co/TheLastRogue | 8 | python | def try_add(self, item):
'\n Tries to add an item to the inventory.\n\n Returns True on success otherwise False.\n '
if (not self.has_room_for_item(item)):
return False
else:
if item.has('stacker'):
self.try_stack_item(item)
if (item.stacker.size ... | def try_add(self, item):
'\n Tries to add an item to the inventory.\n\n Returns True on success otherwise False.\n '
if (not self.has_room_for_item(item)):
return False
else:
if item.has('stacker'):
self.try_stack_item(item)
if (item.stacker.size ... |
039026c80cfda0eadf265d5b62038481b987eed76ec9c7469baa67d9ecae9056 | def has_room_for_item(self, other_item):
'\n Returns true if the inventory has room for another item.\n '
stack_successful = False
if other_item.has('stacker'):
stack_successful = self.can_stack_new_item(other_item)
return (stack_successful or ((len(self._items) + 1) <= self._item_... | Returns true if the inventory has room for another item. | inventory.py | has_room_for_item | co/TheLastRogue | 8 | python | def has_room_for_item(self, other_item):
'\n \n '
stack_successful = False
if other_item.has('stacker'):
stack_successful = self.can_stack_new_item(other_item)
return (stack_successful or ((len(self._items) + 1) <= self._item_capacity)) | def has_room_for_item(self, other_item):
'\n \n '
stack_successful = False
if other_item.has('stacker'):
stack_successful = self.can_stack_new_item(other_item)
return (stack_successful or ((len(self._items) + 1) <= self._item_capacity))<|docstring|>Returns true if the inventory has... |
a32a34750268d19831c517d785831e74e887018948c44ed28d195a36970bd47c | def can_drop_item(self, item):
'\n Returns true if it is a legal action to drop the item.\n '
return item.mover.can_move(self.parent.position, self.parent.dungeon_level) | Returns true if it is a legal action to drop the item. | inventory.py | can_drop_item | co/TheLastRogue | 8 | python | def can_drop_item(self, item):
'\n \n '
return item.mover.can_move(self.parent.position, self.parent.dungeon_level) | def can_drop_item(self, item):
'\n \n '
return item.mover.can_move(self.parent.position, self.parent.dungeon_level)<|docstring|>Returns true if it is a legal action to drop the item.<|endoftext|> |
2bbc9fcf807126356e094de5add0fe1543d1eb41f39dc6427f9978c46ac9c574 | def try_drop_item(self, item):
'\n Tries to drop an item to the ground.\n\n Returns True on success otherwise False.\n '
drop_successful = item.mover.try_move(self.parent.position.value, self.parent.dungeon_level.value)
if drop_successful:
self.remove_item(item)
return drop_... | Tries to drop an item to the ground.
Returns True on success otherwise False. | inventory.py | try_drop_item | co/TheLastRogue | 8 | python | def try_drop_item(self, item):
'\n Tries to drop an item to the ground.\n\n Returns True on success otherwise False.\n '
drop_successful = item.mover.try_move(self.parent.position.value, self.parent.dungeon_level.value)
if drop_successful:
self.remove_item(item)
return drop_... | def try_drop_item(self, item):
'\n Tries to drop an item to the ground.\n\n Returns True on success otherwise False.\n '
drop_successful = item.mover.try_move(self.parent.position.value, self.parent.dungeon_level.value)
if drop_successful:
self.remove_item(item)
return drop_... |
92241cf18becd105eda0227a8e9bbc0b2cb7c1f2d0e1db576c281318ec437f19 | def remove_item(self, item):
'\n Removes item from the inventory.\n '
self._items.remove(item) | Removes item from the inventory. | inventory.py | remove_item | co/TheLastRogue | 8 | python | def remove_item(self, item):
'\n \n '
self._items.remove(item) | def remove_item(self, item):
'\n \n '
self._items.remove(item)<|docstring|>Removes item from the inventory.<|endoftext|> |
c9e16c19db69f2a9e854a3621e0802184348cb1b92a1578972933b9cbaee9e7a | def remove_one_item_from_stack(self, item):
'\n Removes one instance of an item from the inventory.\n\n Works like remove_item but does not remove an entire stack of items.\n '
if item.has('stacker'):
item.stacker.size -= 1
if (item.stacker.size <= 0):
self._item... | Removes one instance of an item from the inventory.
Works like remove_item but does not remove an entire stack of items. | inventory.py | remove_one_item_from_stack | co/TheLastRogue | 8 | python | def remove_one_item_from_stack(self, item):
'\n Removes one instance of an item from the inventory.\n\n Works like remove_item but does not remove an entire stack of items.\n '
if item.has('stacker'):
item.stacker.size -= 1
if (item.stacker.size <= 0):
self._item... | def remove_one_item_from_stack(self, item):
'\n Removes one instance of an item from the inventory.\n\n Works like remove_item but does not remove an entire stack of items.\n '
if item.has('stacker'):
item.stacker.size -= 1
if (item.stacker.size <= 0):
self._item... |
b97c16ec4e3600c87858c052d98763f0dff32600822d156d13b6fdbaa1557379 | def has_item(self, item):
'\n Returns true if the item instance is in the inventory, false otherwise.\n '
return (item in self._items) | Returns true if the item instance is in the inventory, false otherwise. | inventory.py | has_item | co/TheLastRogue | 8 | python | def has_item(self, item):
'\n \n '
return (item in self._items) | def has_item(self, item):
'\n \n '
return (item in self._items)<|docstring|>Returns true if the item instance is in the inventory, false otherwise.<|endoftext|> |
bf1afa36923152ba399377bcaebc5d20059f76b33aaa4d120c3836a0a1030525 | def has_item_of_type(self, item_type):
'\n Returns true if the item instance is in the inventory, false otherwise.\n '
return any([item for item in self._items if (item.item_type.value == item_type)]) | Returns true if the item instance is in the inventory, false otherwise. | inventory.py | has_item_of_type | co/TheLastRogue | 8 | python | def has_item_of_type(self, item_type):
'\n \n '
return any([item for item in self._items if (item.item_type.value == item_type)]) | def has_item_of_type(self, item_type):
'\n \n '
return any([item for item in self._items if (item.item_type.value == item_type)])<|docstring|>Returns true if the item instance is in the inventory, false otherwise.<|endoftext|> |
bde5e4e4f3f5a2fbece43a37428a5a82c50c1e0ab89423a705da6d726a18335b | def is_empty(self):
'\n Returns true the inventory is empty, false otherwise.\n '
return (len(self._items) <= 0) | Returns true the inventory is empty, false otherwise. | inventory.py | is_empty | co/TheLastRogue | 8 | python | def is_empty(self):
'\n \n '
return (len(self._items) <= 0) | def is_empty(self):
'\n \n '
return (len(self._items) <= 0)<|docstring|>Returns true the inventory is empty, false otherwise.<|endoftext|> |
b5dc224d073a6155fb83137a6c58efa61da6db85a343ffe678d980169231642f | def items_of_equipment_type(self, type_):
'\n Returns a list of all items in the inventory of the given type.\n '
return [item for item in self._items if (item.has('equipment_type') and (item.equipment_type.value == type_))] | Returns a list of all items in the inventory of the given type. | inventory.py | items_of_equipment_type | co/TheLastRogue | 8 | python | def items_of_equipment_type(self, type_):
'\n \n '
return [item for item in self._items if (item.has('equipment_type') and (item.equipment_type.value == type_))] | def items_of_equipment_type(self, type_):
'\n \n '
return [item for item in self._items if (item.has('equipment_type') and (item.equipment_type.value == type_))]<|docstring|>Returns a list of all items in the inventory of the given type.<|endoftext|> |
279f9c7951774ff269f5de954ede99e28330ee41d2092285caa4303f42968a8c | def __init__(self, iterator):
'\n Initialize your data structure here.\n :type iterator: Iterator\n '
self.iter = iterator
self.currentPeak = (self.iter.next() if self.iter.hasNext() else None) | Initialize your data structure here.
:type iterator: Iterator | leetcode.com/python/284_Peeking_Iterator.py | __init__ | its-sushant/coding-interview-gym | 713 | python | def __init__(self, iterator):
'\n Initialize your data structure here.\n :type iterator: Iterator\n '
self.iter = iterator
self.currentPeak = (self.iter.next() if self.iter.hasNext() else None) | def __init__(self, iterator):
'\n Initialize your data structure here.\n :type iterator: Iterator\n '
self.iter = iterator
self.currentPeak = (self.iter.next() if self.iter.hasNext() else None)<|docstring|>Initialize your data structure here.
:type iterator: Iterator<|endoftext|> |
96f1d91cb0f4aad94f7c43691ab2f8d919642a60b8d10811289a01c9418f2b53 | def peek(self):
'\n Returns the next element in the iteration without advancing the iterator.\n :rtype: int\n '
return self.currentPeak | Returns the next element in the iteration without advancing the iterator.
:rtype: int | leetcode.com/python/284_Peeking_Iterator.py | peek | its-sushant/coding-interview-gym | 713 | python | def peek(self):
'\n Returns the next element in the iteration without advancing the iterator.\n :rtype: int\n '
return self.currentPeak | def peek(self):
'\n Returns the next element in the iteration without advancing the iterator.\n :rtype: int\n '
return self.currentPeak<|docstring|>Returns the next element in the iteration without advancing the iterator.
:rtype: int<|endoftext|> |
4d30823897eaf5e8ac5c091591488061b227fb1c2b8e44c30f0df8607d6c7607 | def next(self):
'\n :rtype: int\n '
returnValue = self.currentPeak
self.currentPeak = (self.iter.next() if self.iter.hasNext() else None)
return returnValue | :rtype: int | leetcode.com/python/284_Peeking_Iterator.py | next | its-sushant/coding-interview-gym | 713 | python | def next(self):
'\n \n '
returnValue = self.currentPeak
self.currentPeak = (self.iter.next() if self.iter.hasNext() else None)
return returnValue | def next(self):
'\n \n '
returnValue = self.currentPeak
self.currentPeak = (self.iter.next() if self.iter.hasNext() else None)
return returnValue<|docstring|>:rtype: int<|endoftext|> |
73f406dfbf7e7f1e640908c1ac6009ed8b49fce261a37c2ea26d6a357f3e3a3b | def hasNext(self):
'\n :rtype: bool\n '
return (True if self.currentPeak else False) | :rtype: bool | leetcode.com/python/284_Peeking_Iterator.py | hasNext | its-sushant/coding-interview-gym | 713 | python | def hasNext(self):
'\n \n '
return (True if self.currentPeak else False) | def hasNext(self):
'\n \n '
return (True if self.currentPeak else False)<|docstring|>:rtype: bool<|endoftext|> |
ecec87208df3624d0bc8374b3f8658c5e022376345f8ca1a1ecff90e9efd0c15 | def build(self):
'Avoid warning on build step'
pass | Avoid warning on build step | conanfile.py | build | AndrewGaspar/variant-lite | 218 | python | def build(self):
pass | def build(self):
pass<|docstring|>Avoid warning on build step<|endoftext|> |
3048d78eb3558c6ffc8aa83818d746210f1278312aa53d5d5abf4f15eb6377ad | def package(self):
'Run CMake install'
cmake = CMake(self)
cmake.definitions['VARIANT_LITE_OPT_BUILD_TESTS'] = 'OFF'
cmake.definitions['VARIANT_LITE_OPT_BUILD_EXAMPLES'] = 'OFF'
cmake.configure()
cmake.install() | Run CMake install | conanfile.py | package | AndrewGaspar/variant-lite | 218 | python | def package(self):
cmake = CMake(self)
cmake.definitions['VARIANT_LITE_OPT_BUILD_TESTS'] = 'OFF'
cmake.definitions['VARIANT_LITE_OPT_BUILD_EXAMPLES'] = 'OFF'
cmake.configure()
cmake.install() | def package(self):
cmake = CMake(self)
cmake.definitions['VARIANT_LITE_OPT_BUILD_TESTS'] = 'OFF'
cmake.definitions['VARIANT_LITE_OPT_BUILD_EXAMPLES'] = 'OFF'
cmake.configure()
cmake.install()<|docstring|>Run CMake install<|endoftext|> |
265bfe7101e704385e0812919375ae3cc629c46645963b54e66b9082b3994af2 | def zigzagLevelOrder(self, root):
'\n :type root: TreeNode\n :rtype: List[List[int]]\n '
if (not root):
return []
(currnode, nextnode, res) = ([root], [], [])
(start, end, count) = (0, 0, 1)
reverse = False
while currnode:
(start, end) = (0, count)
(l... | :type root: TreeNode
:rtype: List[List[int]] | LeetCode/2018-12-29-103-Binary-Tree-Zigzag-Level-Order-Traversal.py | zigzagLevelOrder | HeRuivio/Algorithm | 5 | python | def zigzagLevelOrder(self, root):
'\n :type root: TreeNode\n :rtype: List[List[int]]\n '
if (not root):
return []
(currnode, nextnode, res) = ([root], [], [])
(start, end, count) = (0, 0, 1)
reverse = False
while currnode:
(start, end) = (0, count)
(l... | def zigzagLevelOrder(self, root):
'\n :type root: TreeNode\n :rtype: List[List[int]]\n '
if (not root):
return []
(currnode, nextnode, res) = ([root], [], [])
(start, end, count) = (0, 0, 1)
reverse = False
while currnode:
(start, end) = (0, count)
(l... |
faf52fb3fbab1c97517bda16b856b9084284a0a31523791edd479f9dd311fde8 | def zigzagLevelOrder(self, root):
'\n :type root: TreeNode\n :rtype: List[List[int]]\n '
if (not root):
return []
(reverse, res, queue) = (False, [], deque())
queue.append(root)
while queue:
(nums, level) = (len(queue), [])
for _ in range(0, nums):
... | :type root: TreeNode
:rtype: List[List[int]] | LeetCode/2018-12-29-103-Binary-Tree-Zigzag-Level-Order-Traversal.py | zigzagLevelOrder | HeRuivio/Algorithm | 5 | python | def zigzagLevelOrder(self, root):
'\n :type root: TreeNode\n :rtype: List[List[int]]\n '
if (not root):
return []
(reverse, res, queue) = (False, [], deque())
queue.append(root)
while queue:
(nums, level) = (len(queue), [])
for _ in range(0, nums):
... | def zigzagLevelOrder(self, root):
'\n :type root: TreeNode\n :rtype: List[List[int]]\n '
if (not root):
return []
(reverse, res, queue) = (False, [], deque())
queue.append(root)
while queue:
(nums, level) = (len(queue), [])
for _ in range(0, nums):
... |
c71387057ed6e2af1b6ea9cabce37c587af5fdc04bdb79349a5fcca0e6291e69 | def gelu(x):
"Implementation of the gelu activation function.\n For information: OpenAI GPT's gelu is slightly different\n (and gives slightly different results):\n 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) *\n (x + 0.044715 * torch.pow(x, 3))))\n Also see https://arxiv.org... | Implementation of the gelu activation function.
For information: OpenAI GPT's gelu is slightly different
(and gives slightly different results):
0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) *
(x + 0.044715 * torch.pow(x, 3))))
Also see https://arxiv.org/abs/1606.08415 | src/modules.py | gelu | salesforce/CoSeRec | 0 | python | def gelu(x):
"Implementation of the gelu activation function.\n For information: OpenAI GPT's gelu is slightly different\n (and gives slightly different results):\n 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) *\n (x + 0.044715 * torch.pow(x, 3))))\n Also see https://arxiv.org... | def gelu(x):
"Implementation of the gelu activation function.\n For information: OpenAI GPT's gelu is slightly different\n (and gives slightly different results):\n 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) *\n (x + 0.044715 * torch.pow(x, 3))))\n Also see https://arxiv.org... |
55f3935f38eccda49c1865b2171bc7e39d386f6cb0ba6f95300db8c397d630ae | def __init__(self, hidden_size, eps=1e-12):
'Construct a layernorm module in the TF style (epsilon inside the square root).\n '
super(LayerNorm, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.bias = nn.Parameter(torch.zeros(hidden_size))
self.variance_epsilon = eps | Construct a layernorm module in the TF style (epsilon inside the square root). | src/modules.py | __init__ | salesforce/CoSeRec | 0 | python | def __init__(self, hidden_size, eps=1e-12):
'\n '
super(LayerNorm, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.bias = nn.Parameter(torch.zeros(hidden_size))
self.variance_epsilon = eps | def __init__(self, hidden_size, eps=1e-12):
'\n '
super(LayerNorm, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.bias = nn.Parameter(torch.zeros(hidden_size))
self.variance_epsilon = eps<|docstring|>Construct a layernorm module in the TF style (epsilon inside the s... |
211d9175278821f7f809c2c2ef18d259b0e9eae2b007a77ce972b356e13ccf0b | def get_child_states(self, tree):
'\n Get c and h of all children\n :param tree:\n :return: (tuple)\n child_c: (num_children, 1, mem_dim)\n child_h: (num_children, 1, mem_dim)\n '
if (tree.num_children == 0):
child_c = Var(torch.zeros(1, 1, self.mem_dim))
... | Get c and h of all children
:param tree:
:return: (tuple)
child_c: (num_children, 1, mem_dim)
child_h: (num_children, 1, mem_dim) | treelstm/model.py | get_child_states | ram-g-athreya/RNN-Question-Answering | 7 | python | def get_child_states(self, tree):
'\n Get c and h of all children\n :param tree:\n :return: (tuple)\n child_c: (num_children, 1, mem_dim)\n child_h: (num_children, 1, mem_dim)\n '
if (tree.num_children == 0):
child_c = Var(torch.zeros(1, 1, self.mem_dim))
... | def get_child_states(self, tree):
'\n Get c and h of all children\n :param tree:\n :return: (tuple)\n child_c: (num_children, 1, mem_dim)\n child_h: (num_children, 1, mem_dim)\n '
if (tree.num_children == 0):
child_c = Var(torch.zeros(1, 1, self.mem_dim))
... |
f851b752d7c086bdf8fad119cd38c71ff3625763980e74ccd822a099f6e0c817 | @staticmethod
def get_schema(max_nesting_depth: Optional[int]=6, nesting_depth: int=0, nesting_list: List[str]=[], max_recursion_limit: Optional[int]=2, include_extension: Optional[bool]=False, extension_fields: Optional[List[str]]=['valueBoolean', 'valueCode', 'valueDate', 'valueDateTime', 'valueDecimal', 'valueId', '... | The subscription resource is used to define a push-based subscription from a
server to another system. Once a subscription is registered with the server,
the server checks every resource that is created or updated, and if the
resource matches the given criteria, it sends a message on the defined
"channel" so that anoth... | spark_fhir_schemas/r4/complex_types/subscription_channel.py | get_schema | imranq2/SparkFhirSchemas | 2 | python | @staticmethod
def get_schema(max_nesting_depth: Optional[int]=6, nesting_depth: int=0, nesting_list: List[str]=[], max_recursion_limit: Optional[int]=2, include_extension: Optional[bool]=False, extension_fields: Optional[List[str]]=['valueBoolean', 'valueCode', 'valueDate', 'valueDateTime', 'valueDecimal', 'valueId', '... | @staticmethod
def get_schema(max_nesting_depth: Optional[int]=6, nesting_depth: int=0, nesting_list: List[str]=[], max_recursion_limit: Optional[int]=2, include_extension: Optional[bool]=False, extension_fields: Optional[List[str]]=['valueBoolean', 'valueCode', 'valueDate', 'valueDateTime', 'valueDecimal', 'valueId', '... |
a677c520baa25b1dd9f5831ab743fc0c3b12b6614d84c415a743009444631293 | def hardness_plot(bin_file, hr_file, file_dir, filename, color_map, stn, wcs_fits):
'\n Plot hardness ratio\n '
hdu = fits.open(wcs_fits)[0]
wcs = WCS(hdu.header)
(Bins, x_min, x_max, y_min, y_max) = read_in(bin_file, hr_file)
fig = plt.figure()
fig.set_size_inches(7, 7)
ax = plt.axes(... | Plot hardness ratio | TemperatureMapPipeline/Hardness_Ratio.py | hardness_plot | crhea93/AstronomyTools | 8 | python | def hardness_plot(bin_file, hr_file, file_dir, filename, color_map, stn, wcs_fits):
'\n \n '
hdu = fits.open(wcs_fits)[0]
wcs = WCS(hdu.header)
(Bins, x_min, x_max, y_min, y_max) = read_in(bin_file, hr_file)
fig = plt.figure()
fig.set_size_inches(7, 7)
ax = plt.axes(xlim=(x_min, x_max)... | def hardness_plot(bin_file, hr_file, file_dir, filename, color_map, stn, wcs_fits):
'\n \n '
hdu = fits.open(wcs_fits)[0]
wcs = WCS(hdu.header)
(Bins, x_min, x_max, y_min, y_max) = read_in(bin_file, hr_file)
fig = plt.figure()
fig.set_size_inches(7, 7)
ax = plt.axes(xlim=(x_min, x_max)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.