hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 | qsc_code_num_words_quality_signal int64 | qsc_code_num_chars_quality_signal float64 | qsc_code_mean_word_length_quality_signal float64 | qsc_code_frac_words_unique_quality_signal float64 | qsc_code_frac_chars_top_2grams_quality_signal float64 | qsc_code_frac_chars_top_3grams_quality_signal float64 | qsc_code_frac_chars_top_4grams_quality_signal float64 | qsc_code_frac_chars_dupe_5grams_quality_signal float64 | qsc_code_frac_chars_dupe_6grams_quality_signal float64 | qsc_code_frac_chars_dupe_7grams_quality_signal float64 | qsc_code_frac_chars_dupe_8grams_quality_signal float64 | qsc_code_frac_chars_dupe_9grams_quality_signal float64 | qsc_code_frac_chars_dupe_10grams_quality_signal float64 | qsc_code_frac_chars_replacement_symbols_quality_signal float64 | qsc_code_frac_chars_digital_quality_signal float64 | qsc_code_frac_chars_whitespace_quality_signal float64 | qsc_code_size_file_byte_quality_signal float64 | qsc_code_num_lines_quality_signal float64 | qsc_code_num_chars_line_max_quality_signal float64 | qsc_code_num_chars_line_mean_quality_signal float64 | qsc_code_frac_chars_alphabet_quality_signal float64 | qsc_code_frac_chars_comments_quality_signal float64 | qsc_code_cate_xml_start_quality_signal float64 | qsc_code_frac_lines_dupe_lines_quality_signal float64 | qsc_code_cate_autogen_quality_signal float64 | qsc_code_frac_lines_long_string_quality_signal float64 | qsc_code_frac_chars_string_length_quality_signal float64 | qsc_code_frac_chars_long_word_length_quality_signal float64 | qsc_code_frac_lines_string_concat_quality_signal float64 | qsc_code_cate_encoded_data_quality_signal float64 | qsc_code_frac_chars_hex_words_quality_signal float64 | qsc_code_frac_lines_prompt_comments_quality_signal float64 | qsc_code_frac_lines_assert_quality_signal float64 | qsc_codepython_cate_ast_quality_signal float64 | qsc_codepython_frac_lines_func_ratio_quality_signal float64 | qsc_codepython_cate_var_zero_quality_signal bool | qsc_codepython_frac_lines_pass_quality_signal float64 | qsc_codepython_frac_lines_import_quality_signal float64 | qsc_codepython_frac_lines_simplefunc_quality_signal float64 | qsc_codepython_score_lines_no_logic_quality_signal float64 | qsc_codepython_frac_lines_print_quality_signal float64 | qsc_code_num_words int64 | qsc_code_num_chars int64 | qsc_code_mean_word_length int64 | qsc_code_frac_words_unique null | qsc_code_frac_chars_top_2grams int64 | qsc_code_frac_chars_top_3grams int64 | qsc_code_frac_chars_top_4grams int64 | qsc_code_frac_chars_dupe_5grams int64 | qsc_code_frac_chars_dupe_6grams int64 | qsc_code_frac_chars_dupe_7grams int64 | qsc_code_frac_chars_dupe_8grams int64 | qsc_code_frac_chars_dupe_9grams int64 | qsc_code_frac_chars_dupe_10grams int64 | qsc_code_frac_chars_replacement_symbols int64 | qsc_code_frac_chars_digital int64 | qsc_code_frac_chars_whitespace int64 | qsc_code_size_file_byte int64 | qsc_code_num_lines int64 | qsc_code_num_chars_line_max int64 | qsc_code_num_chars_line_mean int64 | qsc_code_frac_chars_alphabet int64 | qsc_code_frac_chars_comments int64 | qsc_code_cate_xml_start int64 | qsc_code_frac_lines_dupe_lines int64 | qsc_code_cate_autogen int64 | qsc_code_frac_lines_long_string int64 | qsc_code_frac_chars_string_length int64 | qsc_code_frac_chars_long_word_length int64 | qsc_code_frac_lines_string_concat null | qsc_code_cate_encoded_data int64 | qsc_code_frac_chars_hex_words int64 | qsc_code_frac_lines_prompt_comments int64 | qsc_code_frac_lines_assert int64 | qsc_codepython_cate_ast int64 | qsc_codepython_frac_lines_func_ratio int64 | qsc_codepython_cate_var_zero int64 | qsc_codepython_frac_lines_pass int64 | qsc_codepython_frac_lines_import int64 | qsc_codepython_frac_lines_simplefunc int64 | qsc_codepython_score_lines_no_logic int64 | qsc_codepython_frac_lines_print int64 | effective string | hits int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d794328c200e963178dcd99809c2ed3580ba6659 | 30,185 | py | Python | tests/legacy/responses/repository/pullrequest_fixtrue.py | timmo001/aiogithubapi | 9d33bad77e49f8ee720bcd81c2cbab8a4cf8ebac | [
"MIT"
] | 8 | 2019-07-24T18:14:25.000Z | 2022-03-01T18:33:53.000Z | tests/legacy/responses/repository/pullrequest_fixtrue.py | timmo001/aiogithubapi | 9d33bad77e49f8ee720bcd81c2cbab8a4cf8ebac | [
"MIT"
] | 33 | 2019-12-18T22:15:06.000Z | 2022-03-30T06:08:38.000Z | tests/legacy/responses/repository/pullrequest_fixtrue.py | timmo001/aiogithubapi | 9d33bad77e49f8ee720bcd81c2cbab8a4cf8ebac | [
"MIT"
] | 14 | 2019-09-02T17:50:16.000Z | 2022-03-14T10:30:37.000Z | """
Generated by generate/generate.py - 2020-08-02 10:03:59.857088
"""
import pytest
@pytest.fixture()
def pullrequest_fixtrue_response():
return {
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
"id": 1,
"node_id": "MDExOlB1bGxSZXF1ZXN0MQ==",
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
"patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch",
"issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
"commits_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits",
"review_comments_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments",
"review_comment_url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}",
"comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments",
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",
"number": 1347,
"state": "open",
"locked": True,
"title": "Amazing new feature",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": False,
},
"body": "Please pull these awesome changes in!",
"labels": [
{
"id": 208045946,
"node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
"name": "bug",
"description": "Something isn't working",
"color": "f29513",
"default": True,
}
],
"milestone": {
"url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
"html_url": "https://github.com/octocat/Hello-World/milestones/v1.0",
"labels_url": "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels",
"id": 1002604,
"node_id": "MDk6TWlsZXN0b25lMTAwMjYwNA==",
"number": 1,
"state": "open",
"title": "v1.0",
"description": "Tracking milestone for version 1.0",
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": False,
},
"open_issues": 4,
"closed_issues": 8,
"created_at": "2011-04-10T20:09:31Z",
"updated_at": "2014-03-03T18:58:10Z",
"closed_at": "2013-02-12T13:22:01Z",
"due_on": "2012-10-09T23:39:01Z",
},
"active_lock_reason": "too heated",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:01:12Z",
"closed_at": "2011-01-26T19:01:12Z",
"merged_at": "2011-01-26T19:01:12Z",
"merge_commit_sha": "e5bd3914e2e596debea16f433f57875b5b90bcd6",
"assignee": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": False,
},
"assignees": [
{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": False,
},
{
"login": "hubot",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/hubot_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/hubot",
"html_url": "https://github.com/hubot",
"followers_url": "https://api.github.com/users/hubot/followers",
"following_url": "https://api.github.com/users/hubot/following{/other_user}",
"gists_url": "https://api.github.com/users/hubot/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hubot/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hubot/subscriptions",
"organizations_url": "https://api.github.com/users/hubot/orgs",
"repos_url": "https://api.github.com/users/hubot/repos",
"events_url": "https://api.github.com/users/hubot/events{/privacy}",
"received_events_url": "https://api.github.com/users/hubot/received_events",
"type": "User",
"site_admin": True,
},
],
"requested_reviewers": [
{
"login": "other_user",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/other_user_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/other_user",
"html_url": "https://github.com/other_user",
"followers_url": "https://api.github.com/users/other_user/followers",
"following_url": "https://api.github.com/users/other_user/following{/other_user}",
"gists_url": "https://api.github.com/users/other_user/gists{/gist_id}",
"starred_url": "https://api.github.com/users/other_user/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/other_user/subscriptions",
"organizations_url": "https://api.github.com/users/other_user/orgs",
"repos_url": "https://api.github.com/users/other_user/repos",
"events_url": "https://api.github.com/users/other_user/events{/privacy}",
"received_events_url": "https://api.github.com/users/other_user/received_events",
"type": "User",
"site_admin": False,
}
],
"requested_teams": [
{
"id": 1,
"node_id": "MDQ6VGVhbTE=",
"url": "https://api.github.com/teams/1",
"html_url": "https://api.github.com/teams/justice-league",
"name": "Justice League",
"slug": "justice-league",
"description": "A great team.",
"privacy": "closed",
"permission": "admin",
"members_url": "https://api.github.com/teams/1/members{/member}",
"repositories_url": "https://api.github.com/teams/1/repos",
"parent": None,
}
],
"head": {
"label": "octocat:new-topic",
"ref": "new-topic",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": False,
},
"repo": {
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": False,
},
"private": False,
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
"fork": False,
"url": "https://api.github.com/repos/octocat/Hello-World",
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
"clone_url": "https://github.com/octocat/Hello-World.git",
"mirror_url": "git:git.example.com/octocat/Hello-World",
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"homepage": "https://github.com",
"language": None,
"forks_count": 9,
"stargazers_count": 80,
"watchers_count": 80,
"size": 108,
"default_branch": "main",
"open_issues_count": 0,
"is_template": True,
"topics": ["octocat", "atom", "electron", "api"],
"has_issues": True,
"has_projects": True,
"has_wiki": True,
"has_pages": False,
"has_downloads": True,
"archived": False,
"disabled": False,
"visibility": "public",
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z",
"permissions": {"admin": False, "push": False, "pull": True},
"allow_rebase_merge": True,
"template_repository": None,
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
"allow_squash_merge": True,
"delete_branch_on_merge": True,
"allow_merge_commit": True,
"subscribers_count": 42,
"network_count": 0,
},
},
"base": {
"label": "octocat:main",
"ref": "main",
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": False,
},
"repo": {
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": False,
},
"private": False,
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
"fork": False,
"url": "https://api.github.com/repos/octocat/Hello-World",
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
"clone_url": "https://github.com/octocat/Hello-World.git",
"mirror_url": "git:git.example.com/octocat/Hello-World",
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"homepage": "https://github.com",
"language": None,
"forks_count": 9,
"stargazers_count": 80,
"watchers_count": 80,
"size": 108,
"default_branch": "main",
"open_issues_count": 0,
"is_template": True,
"topics": ["octocat", "atom", "electron", "api"],
"has_issues": True,
"has_projects": True,
"has_wiki": True,
"has_pages": False,
"has_downloads": True,
"archived": False,
"disabled": False,
"visibility": "public",
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z",
"permissions": {"admin": False, "push": False, "pull": True},
"allow_rebase_merge": True,
"template_repository": None,
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
"allow_squash_merge": True,
"delete_branch_on_merge": True,
"allow_merge_commit": True,
"subscribers_count": 42,
"network_count": 0,
},
},
"_links": {
"self": {"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347"},
"html": {"href": "https://github.com/octocat/Hello-World/pull/1347"},
"issue": {"href": "https://api.github.com/repos/octocat/Hello-World/issues/1347"},
"comments": {
"href": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments"
},
"review_comments": {
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"
},
"review_comment": {
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}"
},
"commits": {
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits"
},
"statuses": {
"href": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"
},
},
"author_association": "OWNER",
"draft": False,
"merged": False,
"mergeable": True,
"rebaseable": True,
"mergeable_state": "clean",
"merged_by": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": False,
},
"comments": 10,
"review_comments": 0,
"maintainer_can_modify": True,
"commits": 3,
"additions": 100,
"deletions": 3,
"changed_files": 5,
}
| 59.302554 | 127 | 0.553023 | 3,213 | 30,185 | 5.061625 | 0.08559 | 0.13503 | 0.151264 | 0.139027 | 0.920556 | 0.917973 | 0.912009 | 0.899895 | 0.869704 | 0.861096 | 0 | 0.023931 | 0.273215 | 30,185 | 508 | 128 | 59.419291 | 0.717385 | 0.002054 | 0 | 0.693837 | 1 | 0.053678 | 0.624871 | 0.02009 | 0 | 0 | 0 | 0 | 0 | 1 | 0.001988 | true | 0 | 0.001988 | 0.001988 | 0.005964 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 9 |
ad04b562ca44cabfbce80ecb135c1f53a11d55ca | 9,048 | py | Python | cicada2/engine/tests/test_actions.py | herzo175/cicada-2 | be838e7183dccfceafe02b61b0fe2307d50aab69 | [
"BSD-3-Clause"
] | 11 | 2020-05-05T22:42:09.000Z | 2020-05-11T04:13:17.000Z | cicada2/engine/tests/test_actions.py | cicadatesting/cicada-2 | be838e7183dccfceafe02b61b0fe2307d50aab69 | [
"BSD-3-Clause"
] | 8 | 2020-09-24T12:31:54.000Z | 2022-02-19T01:15:42.000Z | cicada2/engine/tests/test_actions.py | cicadatesting/cicada-2 | be838e7183dccfceafe02b61b0fe2307d50aab69 | [
"BSD-3-Clause"
] | 1 | 2020-05-05T22:41:33.000Z | 2020-05-05T22:41:33.000Z | from unittest.mock import patch
from cicada2.engine import actions
@patch("cicada2.engine.actions.get_action_sender")
def test_run_actions(get_action_sender_mock):
get_action_sender_mock.return_value.__enter__.return_value.return_value = {
"foo": "bar"
}
test_actions = [
{
"type": "POST",
"name": "POST0",
"executionsPerCycle": 2,
"params": {"foo": "bar"},
"outputs": [{"name": "A", "value": "xyz"}],
},
{"name": "X", "params": {"fizz": "buzz"}},
]
actions_data = actions.run_actions(test_actions, {}, "", 0)
assert actions_data["POST0"]["results"] == [{"foo": "bar"}, {"foo": "bar"}]
assert actions_data["POST0"]["outputs"]["A"] == "xyz"
assert actions_data["X"]["results"] == [{"foo": "bar"}]
@patch("cicada2.engine.actions.get_action_sender")
def test_run_actions_with_asserts(get_action_sender_mock):
get_action_sender_mock.return_value.__enter__.return_value.return_value = {
"foo": "bar",
"fizz": "buzz",
}
test_actions = [
{
"type": "POST",
"name": "POST0",
"params": {"foo": "bar"},
"asserts": [{"name": "Assert0", "expected": {"foo": "bar"}}],
}
]
actions_data = actions.run_actions(test_actions, {}, "", 0)
assert actions_data["POST0"]["results"] == [{"foo": "bar", "fizz": "buzz"}]
assert actions_data["POST0"]["asserts"]["Assert0"][0]["passed"]
@patch("cicada2.engine.actions.get_action_sender")
def test_run_actions_with_asserts_actual_override(get_action_sender_mock):
get_action_sender_mock.return_value.__enter__.return_value.return_value = {
"foo": ["fizz", "buzz"]
}
test_actions = [
{
"type": "POST",
"name": "POST0",
"params": {"foo": "bar"},
"asserts": [
{
"name": "Assert0",
"expected": 2,
"template": """
actual: {{ result['foo']|length }}
""",
}
],
}
]
actions_data = actions.run_actions(test_actions, {}, "", 0)
assert actions_data["POST0"]["asserts"]["Assert0"][0]["passed"]
@patch("cicada2.engine.actions.get_action_sender")
def test_run_actions_with_asserts_multiple_calls_versioned(
get_action_sender_mock,
):
get_action_sender_mock.return_value.__enter__.return_value.side_effect = [
{"foo": "bar"},
{"fizz": "buzz"},
]
test_actions = [
{
"type": "POST",
"name": "POST0",
"params": {"foo": "bar"},
"executionsPerCycle": 2,
"asserts": [
{
"name": "Assert0",
"expected": {"foo": "bar"},
"storeVersions": True,
},
{
"name": "Assert1",
"expected": {"fizz": "buzz"},
"storeVersions": True,
},
],
}
]
actions_data = actions.run_actions(test_actions, {}, "", 0)
assert actions_data["POST0"]["results"] == [{"foo": "bar"}, {"fizz": "buzz"}]
# Assert0 passed
# Assert1 fails, then passed
assert actions_data["POST0"]["asserts"]["Assert0"][0]["passed"]
assert not actions_data["POST0"]["asserts"]["Assert1"][0]["passed"]
assert actions_data["POST0"]["asserts"]["Assert1"][1]["passed"]
@patch("cicada2.engine.actions.get_action_sender")
def test_run_actions_with_asserts_multiple_calls_versioned_keep_if_passed(
get_action_sender_mock,
):
get_action_sender_mock.return_value.__enter__.return_value.side_effect = [
{"foo": "bar"},
{"fizz": "buzz"},
]
test_actions = [
{
"type": "POST",
"name": "POST0",
"params": {"foo": "bar"},
"executionsPerCycle": 2,
"asserts": [
{
"name": "Assert0",
"expected": {"foo": "bar"},
"storeVersions": True,
"keepIfPassed": True,
},
{
"name": "Assert1",
"expected": {"fizz": "buzz"},
"storeVersions": True,
"keepIfPassed": True,
},
],
}
]
actions_data = actions.run_actions(test_actions, {}, "", 0)
assert actions_data["POST0"]["results"] == [{"foo": "bar"}, {"fizz": "buzz"}]
# Assert0 passed, then fails
# Assert1 fails, then passed
assert actions_data["POST0"]["asserts"]["Assert0"][0]["passed"]
assert actions_data["POST0"]["asserts"]["Assert1"][1]["passed"]
assert not actions_data["POST0"]["asserts"]["Assert0"][1]["passed"]
assert not actions_data["POST0"]["asserts"]["Assert1"][0]["passed"]
@patch("cicada2.engine.actions.get_action_sender")
def test_run_actions_errored_call(get_action_sender_mock):
get_action_sender_mock.return_value.__enter__.return_value.side_effect = [
{"foo": "bar"},
{},
{},
]
test_actions = [
{
"type": "POST",
"name": "POST0",
"executionsPerCycle": 2,
"params": {"foo": "bar"},
"outputs": [{"name": "A", "value": "xyz"}],
},
{"name": "X", "params": {"fizz": "buzz"}},
]
actions_data = actions.run_actions(test_actions, {}, "", 0)
assert actions_data["POST0"]["results"] == [{"foo": "bar"}, {}]
assert actions_data["POST0"]["outputs"]["A"] == "xyz"
assert actions_data["X"]["results"] == [{}]
@patch("cicada2.engine.actions.get_action_sender")
def test_run_actions_non_versioned(get_action_sender_mock):
get_action_sender_mock.return_value.__enter__.return_value.return_value = {
"foo": "bar"
}
test_actions = [
{
"type": "POST",
"name": "POST0",
"executionsPerCycle": 2,
"storeVersions": False,
"params": {"foo": "bar"},
"outputs": [{"name": "A", "value": "xyz", "storeVersions": True}],
},
{"name": "X", "params": {"fizz": "buzz"}},
]
actions_data = actions.run_actions(test_actions, {}, "", 0)
assert actions_data["POST0"]["results"] == {"foo": "bar"}
assert actions_data["POST0"]["outputs"]["A"] == ["xyz"]
assert actions_data["X"]["results"] == [{"foo": "bar"}]
def test_run_assert_from_action_result_negated():
asrt = {"name": "foo", "expected": {"fizz", "buzz"}, "negate": True}
action_result = {"foo", "bar"}
assert_result = actions.run_assert_from_action_result(asrt, action_result)
assert assert_result["passed"]
def test_run_assert_from_action_result_negated_passed():
asrt = {"name": "foo", "expected": {"fizz", "buzz"}, "negate": True}
action_result = {"fizz", "buzz"}
assert_result = actions.run_assert_from_action_result(asrt, action_result)
assert not assert_result["passed"]
def test_combine_action_data():
current_actions_data = {
"POST0": {
"results": [{"foo": "bar"}, {"foo": "bar"}],
"outputs": {"A": ["xyz"]},
"asserts": {"Assert0": {"passed": False}, "Assert1": [{"passed": False}]},
}
}
new_actions_data = {
"POST0": {
"results": [{"foo": "bar"}, {"foo": "bar"}],
"outputs": {"A": ["xyz"]},
"asserts": {"Assert0": {"passed": True}, "Assert1": [{"passed": True}]},
},
"X": {"results": [{"foo": "bar"}]},
}
combined_actions_data = actions.combine_action_data(
current_actions_data, new_actions_data
)
assert combined_actions_data["POST0"]["results"] == [
{"foo": "bar"},
{"foo": "bar"},
{"foo": "bar"},
{"foo": "bar"},
]
assert combined_actions_data["POST0"]["outputs"]["A"] == ["xyz", "xyz"]
assert combined_actions_data["X"]["results"] == [{"foo": "bar"}]
assert combined_actions_data["POST0"]["asserts"]["Assert0"]["passed"]
assert combined_actions_data["POST0"]["asserts"]["Assert1"] == [
{"passed": False},
{"passed": True},
]
def test_combine_action_data_error():
current_actions_data = {
"POST0": {
"results": [{"foo": "bar"}, {"foo": "bar"}],
"outputs": {"A": ["xyz"]},
}
}
new_actions_data = {
"POST0": {"results": [{}, {}], "outputs": {"A": ["xyz"]}},
"X": {"results": [{"foo": "bar"}]},
}
combined_actions_data = actions.combine_action_data(
current_actions_data, new_actions_data
)
assert combined_actions_data["POST0"]["results"] == [
{"foo": "bar"},
{"foo": "bar"},
{},
{},
]
assert combined_actions_data["POST0"]["outputs"]["A"] == ["xyz", "xyz"]
assert combined_actions_data["X"]["results"] == [{"foo": "bar"}]
| 30.26087 | 86 | 0.523762 | 880 | 9,048 | 5.081818 | 0.082955 | 0.113148 | 0.100179 | 0.073792 | 0.931798 | 0.905635 | 0.890653 | 0.883945 | 0.83229 | 0.83229 | 0 | 0.013829 | 0.280725 | 9,048 | 298 | 87 | 30.362416 | 0.673325 | 0.0105 | 0 | 0.612766 | 0 | 0 | 0.230443 | 0.031292 | 0 | 0 | 0 | 0 | 0.212766 | 1 | 0.046809 | false | 0.085106 | 0.008511 | 0 | 0.055319 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 7 |
ad876d8072afebd5c8f200e77b021380e885966c | 261 | py | Python | timeSeries/energyAndMiningSeries.py | rafiq/Data_Science | ffb4bfac9957f930d16367dfafff45cb13d66536 | [
"MIT"
] | null | null | null | timeSeries/energyAndMiningSeries.py | rafiq/Data_Science | ffb4bfac9957f930d16367dfafff45cb13d66536 | [
"MIT"
] | null | null | null | timeSeries/energyAndMiningSeries.py | rafiq/Data_Science | ffb4bfac9957f930d16367dfafff45cb13d66536 | [
"MIT"
] | null | null | null | import pandas as pd
pd.read_excel("/Users/rafiqkamal/Desktop/Data_Science/timeSeries/Energy and Mining 50 series 200 plus entities World Bank.xlsx")
/Users/rafiqkamal/Desktop/Data_Science/timeSeries/Energy and Mining 50 series 200 plus entities World Bank.xlsx | 65.25 | 128 | 0.835249 | 41 | 261 | 5.243902 | 0.560976 | 0.139535 | 0.204651 | 0.24186 | 0.874419 | 0.874419 | 0.874419 | 0.874419 | 0.874419 | 0.874419 | 0 | 0.042194 | 0.091954 | 261 | 4 | 129 | 65.25 | 0.864979 | 0 | 0 | 0 | 0 | 0.333333 | 0.423664 | 0.21374 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.333333 | null | null | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 12 |
d110692123f5a97a31a54dcd93cf38527578a332 | 147 | py | Python | python/testData/psi/CommaAfterStarArg.py | truthiswill/intellij-community | fff88cfb0dc168eea18ecb745d3e5b93f57b0b95 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/psi/CommaAfterStarArg.py | truthiswill/intellij-community | fff88cfb0dc168eea18ecb745d3e5b93f57b0b95 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/psi/CommaAfterStarArg.py | truthiswill/intellij-community | fff88cfb0dc168eea18ecb745d3e5b93f57b0b95 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | def some_function(*args,): # <- missing highlighting here
pass
def some_function(**kwargs,): # <- missing highlighting here
pass | 29.4 | 65 | 0.653061 | 16 | 147 | 5.875 | 0.5625 | 0.148936 | 0.319149 | 0.574468 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.231293 | 147 | 5 | 66 | 29.4 | 0.831858 | 0.387755 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 7 |
d11b796071b5035553de05b1faf10da6c3123ff3 | 2,591 | py | Python | Graphics/Colors.py | Geliana/TellyDownloadManager | ea645c281152f4a6e082b8be65d157b4f0ac465c | [
"Apache-2.0"
] | 2 | 2022-01-02T11:21:41.000Z | 2022-01-09T12:40:44.000Z | Graphics/Colors.py | Geliana/TellyDownloadManager | ea645c281152f4a6e082b8be65d157b4f0ac465c | [
"Apache-2.0"
] | 5 | 2022-01-16T20:05:23.000Z | 2022-01-24T11:50:17.000Z | Graphics/Colors.py | Geliana/TellyDownloadManager | ea645c281152f4a6e082b8be65d157b4f0ac465c | [
"Apache-2.0"
] | null | null | null | import importlib
import Assets.Functions.Parser as p
def get_main_theme_color(essence="tuple"):
importlib.reload(p)
if essence == "tuple":
if p.KeyMatch().match("theme") == "Pink-lady":
color = (1, .4, .5, 1) # FF6680
return color
elif p.KeyMatch().match("theme") == "Ocean_Blue":
color = (.16, .55, 1, 1)
return color
elif p.KeyMatch().match("theme") == "Dark":
color = (.3, .3, .3, 1)
return color
elif essence == "string":
if p.KeyMatch().match("theme") == "Pink-lady":
color = "#FF6680"
return color
elif p.KeyMatch().match("theme") == "Ocean_Blue":
color = "#298CFF"
return color
elif p.KeyMatch().match("theme") == "Dark":
color = "#505050"
return color
def get_sub_theme_color(essence="tuple"):
importlib.reload(p)
if essence == "tuple":
if p.KeyMatch().match("theme") == "Pink-lady":
color = (1, .5, .55, .7)
return color
elif p.KeyMatch().match("theme") == "Ocean_Blue":
color = (.19, .65, .9, .7)
return color
elif p.KeyMatch().match("theme") == "Dark":
color = (.5, .5, .5, .7)
return color
elif essence == "string":
if p.KeyMatch().match("theme") == "Pink-lady":
color = "#FF808C"
return color
elif p.KeyMatch().match("theme") == "Ocean_Blue":
color = "#298CFF"
return color
elif p.KeyMatch().match("theme") == "Dark":
color = "#505050"
return color
def get_transparent_sub_theme_color(essence="tuple"):
importlib.reload(p)
if essence == "string":
if p.KeyMatch().match("theme") == "Pink-lady":
color = "#FF9BA0"
return color
elif p.KeyMatch().match("theme") == "Ocean_Blue":
color = "#6AAFFF"
return color
elif p.KeyMatch().match("theme") == "Dark":
color = "8F8D8A"
return color
elif essence == "tuple":
if p.KeyMatch().match("theme") == "Pink-lady":
color = (1, .6, .62, 1)
return color
elif p.KeyMatch().match("theme") == "Ocean_Blue":
color = (.41, .68, 1, 1)
return color
elif p.KeyMatch().match("theme") == "Dark":
color = (.56, .55, .54, 1)
return color
| 29.781609 | 58 | 0.47472 | 277 | 2,591 | 4.382671 | 0.184116 | 0.133443 | 0.207578 | 0.281713 | 0.87397 | 0.87397 | 0.87397 | 0.87397 | 0.871499 | 0.800659 | 0 | 0.049878 | 0.365496 | 2,591 | 86 | 59 | 30.127907 | 0.688564 | 0.002316 | 0 | 0.691176 | 0 | 0 | 0.135362 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.044118 | false | 0 | 0.073529 | 0 | 0.382353 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
d122fb6c382b49cddc6fa65ef459a9cdcbdb5c31 | 79 | py | Python | riak_pb/__init__.py | echenonline/riak_pb | 792acbc07a2daddfc435a00ea037b90bbd0f424b | [
"Apache-2.0"
] | null | null | null | riak_pb/__init__.py | echenonline/riak_pb | 792acbc07a2daddfc435a00ea037b90bbd0f424b | [
"Apache-2.0"
] | null | null | null | riak_pb/__init__.py | echenonline/riak_pb | 792acbc07a2daddfc435a00ea037b90bbd0f424b | [
"Apache-2.0"
] | null | null | null | from riak_pb2 import *
from riak_kv_pb2 import *
from riak_search_pb2 import *
| 19.75 | 29 | 0.810127 | 14 | 79 | 4.214286 | 0.428571 | 0.40678 | 0.440678 | 0.576271 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.044776 | 0.151899 | 79 | 3 | 30 | 26.333333 | 0.835821 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 8 |
d15d776f313c9150303d534da0f554ac34034a37 | 3,826 | py | Python | metric.py | STEELISI/SENMO | 19753819cd4294badc461359a630297e1a5be7af | [
"MIT"
] | 1 | 2022-03-15T21:03:41.000Z | 2022-03-15T21:03:41.000Z | metric.py | STEELISI/SENMO | 19753819cd4294badc461359a630297e1a5be7af | [
"MIT"
] | null | null | null | metric.py | STEELISI/SENMO | 19753819cd4294badc461359a630297e1a5be7af | [
"MIT"
] | null | null | null | from utils import label_cols
def accuracy(df_preds, df_test, output_file):
for col in label_cols:
c = 0
n = len(df_test)
for index, value in df_preds[col].items():
if df_preds[col][index] == df_test[col][index]:
c = c + 1
# print
print('{} accuracy : {}/{} = {}'.format(col, c, n, str(c/n)))
# write
output_file.write('{} accuracy : {}/{} = {}'.format(col, c, n, str(c/n)))
output_file.write('\n')
print('\n')
output_file.write('\n')
def true_positive(df_preds, df_test, output_file):
for col in label_cols:
c = 0
n = 0
for index, value in df_preds[col].items():
if df_test[col][index] == 1:
n = n + 1
if df_preds[col][index] == df_test[col][index]:
c = c + 1
# print
print('=== {} ==='.format(col))
print('true positive : {}/{} = {}'.format(c, n, str(c/n)))
print('false negative : {}/{} = {}'.format(n - c, n, str(1 - c/n)))
# write
output_file.write('=== {} ==='.format(col))
output_file.write('\n')
output_file.write('true positive : {}/{} = {}'.format(c, n, str(c/n)))
output_file.write('\n')
output_file.write('false negative : {}/{} = {}'.format(n - c, n, str(1 - c/n)))
output_file.write('\n')
print('\n')
output_file.write('\n')
def false_positive(df_preds, df_test, output_file):
for col in label_cols:
c = 0
n = 0
for index, value in df_preds[col].items():
if df_test[col][index] == 0:
n = n + 1
if df_preds[col][index] == df_test[col][index]:
c = c + 1
# print
print('=== {} ==='.format(col))
print('true negative : {}/{} = {}'.format(c, n, str(c/n)))
print('false positive : {}/{} = {}'.format(n - c, n, str(1 - c/n)))
# write
output_file.write('=== {} ==='.format(col))
output_file.write('\n')
output_file.write('true negative : {}/{} = {}'.format(c, n, str(c/n)))
output_file.write('\n')
output_file.write('false positive : {}/{} = {}'.format(n - c, n, str(1 - c/n)))
output_file.write('\n')
print('\n')
output_file.write('\n')
### compute accuracy for NONE class"
def none_accuracy(df_preds, df_test, output_file):
c1 = 0
n1 = 0
for index, row in df_test.iterrows():
if row[label_cols].sum() == 0:
n1 = n1 + 1
if df_preds.iloc[index,1:].sum() == 0: # is 'NONE'
c1 = c1 + 1
# print
print('=== NONE ===')
print('true positive : {}/{} = {}'.format(c1, n1, str(c1/n1)))
print('false negative : {}/{} = {}'.format(n1 - c1, n1, str(1 - c1/n1)))
# write
output_file.write('=== NONE ===')
output_file.write('\n')
output_file.write('true positive : {}/{} = {}'.format(c1, n1, str(c1/n1)))
output_file.write('\n')
output_file.write('false negative : {}/{} = {}'.format(n1 - c1, n1, str(1 - c1/n1)))
output_file.write('\n')
c2 = 0
n2 = 0
for index, row in df_test.iterrows():
if row[label_cols].sum() != 0:
n2 = n2 + 1
if df_preds.iloc[index,1:].sum() != 0: # is not 'NONE'
c2 = c2 + 1
# print
print('=== NONE ===')
print('true negative : {}/{} = {}'.format(c2, n2, str(c2/n2)))
print('false positive : {}/{} = {}'.format(n2 - c2, n2, str(1 - c2/n2)))
print('\n')
# write
output_file.write('=== NONE ===')
output_file.write('\n')
output_file.write('true negative : {}/{} = {}'.format(c2, n2, str(c2/n2)))
output_file.write('\n')
output_file.write('false positive : {}/{} = {}'.format(n2 - c2, n2, str(1 - c2/n2)))
output_file.write('\n')
output_file.write('\n')
### per-note accuracy: accuracy that the model predicts every class correctly for each note ###
def pernote_accuracy(df_preds, df_test, output_file):
c = 0
n = len(df_test)
for i in range(n):
if df_preds.iloc[i,:].equals(df_test.iloc[i,:]):
c = c + 1
# print
print('Per note accuracy : {}/{} = {}'.format(c, n, str(c/n)))
print('\n')
# write
output_file.write('Per note accuracy : {}/{} = {}'.format(c, n, str(c/n)))
output_file.write('\n')
output_file.write('\n') | 32.151261 | 95 | 0.581547 | 610 | 3,826 | 3.521311 | 0.095082 | 0.176909 | 0.230447 | 0.141527 | 0.887337 | 0.881285 | 0.833333 | 0.787244 | 0.707635 | 0.668994 | 0 | 0.026692 | 0.17747 | 3,826 | 119 | 96 | 32.151261 | 0.655863 | 0.056717 | 0 | 0.575758 | 0 | 0 | 0.18628 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.050505 | false | 0 | 0.010101 | 0 | 0.060606 | 0.191919 | 0 | 0 | 0 | null | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
66f6f5b3d4ca5d850f4dec1e526884868919a6e8 | 611,881 | py | Python | main/src/pythonGenerator/objectDefinition.py | eapcivil/EXUDYN | 52bddc8c258cda07e51373f68e1198b66c701d03 | [
"BSD-3-Clause-Open-MPI"
] | 1 | 2020-10-06T08:06:25.000Z | 2020-10-06T08:06:25.000Z | main/src/pythonGenerator/objectDefinition.py | eapcivil/EXUDYN | 52bddc8c258cda07e51373f68e1198b66c701d03 | [
"BSD-3-Clause-Open-MPI"
] | null | null | null | main/src/pythonGenerator/objectDefinition.py | eapcivil/EXUDYN | 52bddc8c258cda07e51373f68e1198b66c701d03 | [
"BSD-3-Clause-Open-MPI"
] | null | null | null | ma#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#autogenerated object files
#load this file into pythonAutoGenerateObjects.py (in same folder
#USAGE:
# define a certain class with
# class = [C++ class name] ==> will be changed to CName, MainName, VisualizationName
# define parameters per line, see pattern below, using types and flags
# finally write:
# writeFile=[C++ file name]
#
#text with "" may contain spaces and commas, etc; tabs will be erased
#
# **********************************************
# FIELDS/OPTIONS for every class
# classDescription: textual description, which will be used in C and Python
# compParentClass: parent class for ComputationalObject
# mainParentClass: parent class for MainObject
# visuParentClass: parent class for VisualizationObject
# pythonShortName: abbreviation used in interface
# outputVariables: types automatically generate object::GetOutputVariableTypes(); description added to docu; used to identify available output variables
# addProtected[C|Main]: string which is added in protected section (e.g. variable definition)
# addPublic[C|Main]: string, which is added in public section
# addIncludes[c|Main]: text added at includes part of C or Main classes
# cParentClass: parent computational class
# mainParentClass: parent main class
# miniExample':'', #mini python example (without headers and typical setup); code in separate lines, ended with '/end' in separate line
# equations':'', #latex style equations, direct latex code; latex code in separate lines, ended with '/end' in separate line
# classType: type of class: node, object, marker, load, sensor, ...
#
# **********************************************
# FIELDS/OPTIONS in parameter/function list:
# [V|F[v]]: V...Value (=member variable), Vp ... value used from parent class, F...Function (access via member function); v ... virtual Function; s ... static function
# Dest=Destination: M ... Main object, C ... computational object, V ... visualization object; P ... parameter structure
# pythonName: name which is used in python; member variables MUST be lower-case!!!
# cplusplusName: name which is used on C++ side of EXUDYN (leave empty if it is the same)
# size = leave empty if size is variable; e.g. 3 (size of vector), 2x3 (2 rows, 3 columns) %used for vectors and matrices only!
# type = Bool, Int, Real, UInt, UReal, Vector, Matrix, SymmetricMatrix (variable type or return type)
# defaultValue = default value or string (use "" to clearly identify strings incl. spaces); for 'V'-types: default initialization; vor 'F' and 'F'-types: C++ code of function;
# args = arguments in function declaration (empty for variable)
# cFlags = R(read only; functions are always read only), M(modifiableDuringSimulation), N(parameter change needs object reset), C(onst member function), U...mutable (can be modified in const functions - for temporary vectors),
# I ... Dictionary Interface, D(declaration only; implementation in .cpp file done manually), O ... optional parameter in dictionary (otherwise using default value)
# P ... write Pybind11 interface, X ... does not override parent function [default is read/write access and that changes are immediately applied and need no reset of the system]
# parameterDescription = description for parameter used in C++ code
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = NodePoint
classDescription = "A 3D point node for point masses or solid finite elements which has 3 displacement degrees of freedom for second order differential equations (ODE2)."
cParentClass = CNodeODE2
mainParentClass = MainNode
visuParentClass = VisualizationNode
pythonShortName = Point
outputVariables = "{'Position':'$\pv\cConfig = [p_0,\,p_1,\,p_2]\cConfig\tp= \uv\cConfig + \pv\cRef$global 3D position vector of node; $\uv\cRef=0$', 'Displacement':'$\uv\cConfig = [q_0,\,q_1,\,q_2]\cConfig\tp$global 3D displacement vector of node', 'Velocity':'$\vv\cConfig = [\dot q_0,\,\dot q_1,\,\dot q_2]\cConfig\tp$global 3D velocity vector of node', 'Acceleration':'$\av\cConfig = \ddot \qv\cConfig = [\ddot q_0,\,\ddot q_1,\,\ddot q_2]\cConfig\tp$global 3D acceleration vector of node', 'Coordinates':'$\cv\cConfig = \uv\cConfig = [q_0,\,q_1,\,q_2]\tp\cConfig$ coordinate vector of node', 'Coordinates_t':'$\dot\cv\cConfig = \vv\cConfig = [\dot q_0,\,\dot q_1,\,\dot q_2]\tp\cConfig$ velocity coordinates vector of node', 'Coordinates_tt':'$\ddot\cv\cConfig = \av\cConfig = [\ddot q_0,\,\ddot q_1,\,\ddot q_2]\tp\cConfig$ acceleration coordinates vector of node'}"
classType = Node
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
%\startTable{intermediate variables}{symbol}{description}
% \rowTable{marker m0 position}{$\LU{0}{\pv}_{m0}$}{current global position which is provided by marker m0}
%\finishTable
The node provides $n_c=3$ displacement coordinates. Equations of motion need to be provided by an according object (e.g., MassPoint, finite elements, ...).
Usually, the nodal coordinates are provided in the global frame. However, the coordinate system is defined by the object (e.g. MassPoint uses global coordinates, but floating frame of reference objects use local frames).
Note that for this very simple node, coordinates are identical to the nodal displacements, same for time derivatives. This is not the case, e.g. for nodes with orientation. \vspace{6pt}\\
\noindent {\bf Example} for NodePoint: see ObjectMassPoint
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "node's unique name"
V, CP, referenceCoordinates, , 3, Vector3D, "Vector3D({0.,0.,0.})", , I, "$\qv\cRef = [q_0,\,q_1,\,q_2]\tp\cRef = \pv\cRef = [r_0,\,r_1,\,r_2]\tp$reference coordinates of node, e.g. ref. coordinates for finite elements; global position of node without displacement"
V, MP, initialCoordinates, initialCoordinates, 3, Vector3D, "Vector3D({0.,0.,0.})", , IO, "$\qv\cIni = [q_0,\,q_1,\,q_2]\cIni\tp = \uv\cIni = [u_0,\,u_1,\,u_2]\cIni\tp$initial displacement coordinate"
V, MP, initialVelocities, initialCoordinates_t,3, Vector3D, "Vector3D({0.,0.,0.})", , IO, "$\dot\qv\cIni = \vv\cIni = [\dot q_0,\,\dot q_1,\,\dot q_2]\cIni\tp$initial velocity coordinate"
Fv, C, GetNumberOfODE2Coordinates, GetNumberOfODE2Coordinates,, Index,"return 3;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetType, , , Node::Type, "return Node::Position;", , CI, "return node type (for node treatment in computation)"
#Fv, C, NodeGroup, , , CNodeGroup, , , CIJ, "return node group (for classification (ODE1/ODE2/AE) in computation)"
Fv, C, GetPosition, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent position of node"
Fv, C, GetVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent velocity of node"
Fv, C, GetPositionJacobian, , , void, "value.SetScalarMatrix(3,1.);", "Matrix& value", CI, "provide position jacobian of node"
Fv, M, GetTypeName, , , const char*, "return 'Point';", , CI, "Get type name of node (without keyword 'Node'...!); could also be realized via a string -> type conversion?"
Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific node function ==> automatically generated in future"
Fv, C, GetReferenceCoordinateVector, , , LinkedDataVector, "return parameters.referenceCoordinates;", , CI, "return internally stored reference coordinates of node"
Fv, M, GetInitialVector, , , LinkedDataVector, "return parameters.initialCoordinates;", , CI, "return internally stored initial coordinates (displacements) of node"
Fv, M, GetInitialVector_t, , , LinkedDataVector, "return parameters.initialCoordinates_t;", , CI, "return internally stored initial coordinates (velocities) of node"
Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'; used e.g. for postprocessing and sensors"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size (diameter, dimensions of underlying cube, etc.) for item; size == -1.f means that default size is used"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, color, , 4, Float4, "Float4({-1.f,-1.f,-1.f,-1.f})", , IO, "Default RGBA color for nodes; 4th value is alpha-transparency; R=-1.f means, that default color is used"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = NodePoint2D
classDescription = "A 2D point node for point masses or solid finite elements which has 2 displacement degrees of freedom for second order differential equations."
cParentClass = CNodeODE2
mainParentClass = MainNode
visuParentClass = VisualizationNode
pythonShortName = Point2D
#outputVariables = "{'Position':'global 3D position vector of node (=displacement+reference position)', 'Displacement':'global 3D displacement vector of node', 'Velocity':'global 3D velocity vector of node', 'Coordinates':'coordinates vector of node', 'Coordinates_t':'velocity coordinates vector of node'}"
outputVariables = "{'Position':'$\pv\cConfig = [p_0,\,p_1,\,0]\cConfig\tp= \uv\cConfig + \pv\cRef$global 3D position vector of node; $\uv\cRef=0$', 'Displacement':'$\uv\cConfig = [q_0,\,q_1,\,0]\cConfig\tp$global 3D displacement vector of node', 'Velocity':'$\vv\cConfig = [\dot q_0,\,\dot q_1,\,0]\cConfig\tp$global 3D velocity vector of node', 'Coordinates':'$\cv\cConfig = [q_0,\,q_1]\tp\cConfig$ coordinate vector of node', 'Coordinates_t':'$\dot\cv\cConfig = [\dot q_0,\,\dot q_1]\tp\cConfig$ velocity coordinates vector of node'}"
classType = Node
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
\vspace{6pt}\\
%{\bf Note the difference of coordinate vectors and displacement or position vectors}:
%\startTable{quantity}{symbol}{description}
% \rowTable{Coordinates}{$\cv\cConfig = \qv\cConfig = [q_0,\,q_1]\cConfig\tp = [u_0,\,u_1]\cConfig\tp \ldots$}{displacement coordinates}
% \rowTable{Displacement}{$\uv\cConfig = [u_0,\,u_1,\,0]\cConfig\tp$}{displacement vector, 0 in third component}
% \rowTable{Position}{$\pv\cConfig = [p_0,\,p_1,\,0]\cConfig\tp = [u_0,\,u_1,\,0]\cConfig\tp + [r_0,\,r_1,\,0]\cRef\tp$}{displacement vector, 0 in third component}
%\finishTable
The node provides $n_c=2$ displacement coordinates. Equations of motion need to be provided by an according object (e.g., MassPoint2D).
Coordinates are identical to the nodal displacements, except for the third coordinate $u_2$, which is zero, because $q_2$ does not exist. \vspace{6pt}\\
Note that for this very simple node, coordinates are identical to the nodal displacements, same for time derivatives. This is not the case, e.g. for nodes with orientation. \vspace{6pt}\\
\noindent {\bf Example} for NodePoint: see ObjectMassPoint2D
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "node's unique name"
V, CP, referenceCoordinates, , 2, Vector2D, "Vector2D({0.,0.})", , I, "$\qv\cRef = [q_0,\,q_1]\tp\cRef = \pv\cRef = [r_0,\,r_1]\tp$reference coordinates of node ==> e.g. ref. coordinates for finite elements; global position of node without displacement"
V, MP, initialCoordinates, initialCoordinates, 2, Vector2D, "Vector2D({0.,0.})", , IO, "$\qv\cIni = [q_0,\,q_1]\cIni\tp = [u_0,\,u_1]\cIni\tp$initial displacement coordinate"
V, MP, initialVelocities, initialCoordinates_t,2, Vector2D, "Vector2D({0.,0.})", , IO, "$\dot\qv\cIni = \vv\cIni = [\dot q_0,\,\dot q_1]\cIni\tp$initial velocity coordinate"
Fv, C, GetNumberOfODE2Coordinates, GetNumberOfODE2Coordinates,, Index,"return 2;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetType, , , Node::Type, "return Node::Position2D;", , CI, "return node type (for node treatment in computation)"
#Fv, C, NodeGroup, , , CNodeGroup, , , CIJ, "return node group (for classification (ODE1/ODE2/AE) in computation)"
Fv, C, GetPosition, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent position of node; returns always a 3D Vector"
Fv, C, GetVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent velocity of node; returns always a 3D Vector"
Fv, C, GetPositionJacobian, , , void, "value.SetMatrix(3,2,{1.f,0.f,0.f,1.f,0.f,0.f});", "Matrix& value", CI, "provide position jacobian of node; derivative of 3D Position with respect to 2 coordinates"
Fv, M, GetTypeName, , , const char*, "return 'Point2D';", , CI, "Get type name of node (without keyword 'Node'...!); could also be realized via a string -> type conversion?"
Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific node function ==> automatically generated in future"
Fv, C, GetReferenceCoordinateVector, , , LinkedDataVector, "return parameters.referenceCoordinates;", , CI, "return internally stored reference coordinates of node"
Fv, M, GetInitialVector, , , LinkedDataVector, "return parameters.initialCoordinates;", , CI, "return internally stored initial coordinates (displacements) of node"
Fv, M, GetInitialVector_t, , , LinkedDataVector, "return parameters.initialCoordinates_t;", , CI, "return internally stored initial coordinates (velocities) of node"
Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'; used e.g. for postprocessing and sensors"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size (diameter, dimensions of underlying cube, etc.) for item; size == -1.f means that default size is used"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, color, , 4, Float4, "Float4({-1.f,-1.f,-1.f,-1.f})", , IO, "Default RGBA color for nodes; 4th value is alpha-transparency; R=-1.f means, that default color is used"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = NodeRigidBodyEP
classDescription = "A 3D rigid body node based on Euler parameters for rigid bodies or beams; the node has 3 displacement coordinates (displacements of center of mass - COM: ux,uy,uz) and four rotation coordinates (Euler parameters = quaternions)."
cParentClass = CNodeRigidBody
mainParentClass = MainNode
visuParentClass = VisualizationNode
addProtectedC = " static constexpr Index nRotationCoordinates = 4;\n static constexpr Index nDisplacementCoordinates = 3;\n Index globalAECoordinateIndex;\n"
pythonShortName = RigidEP
outputVariables = "{'Position':'$\LU{0}{\pv}\cConfig = \LU{0}{[p_0,\,p_1,\,p_2]}\cConfig\tp= \LU{0}{\uv}\cConfig + \LU{0}{\pv}\cRef$global 3D position vector of node; $\uv\cRef=0$', 'Displacement':'$\LU{0}{\uv}\cConfig = [q_0,\,q_1,\,q_2]\cConfig\tp$global 3D displacement vector of node','Velocity':'$\LU{0}{\vv}\cConfig = [\dot q_0,\,\dot q_1,\,\dot q_2]\cConfig\tp$global 3D velocity vector of node', 'Coordinates':'$\cv\cConfig = [q_0,\,q_1,\,q_2, \,\psi_0,\,\psi_1,\,\psi_2,\,\psi_3]\tp\cConfig$ coordinate vector of node, having 3 displacement coordinates and 4 Euler parameters', 'Coordinates_t':'$\dot\cv\cConfig = [\dot q_0,\,\dot q_1,\,\dot q_2, \,\dot \psi_0,\,\dot \psi_1,\,\dot \psi_2,\,\dot \psi_3]\tp\cConfig$ velocity coordinates vector of node', 'RotationMatrix':'$[A_{00},\,A_{01},\,A_{02},\,A_{10},\,\ldots,\,A_{21},\,A_{22}]\cConfig\tp$vector with 9 components of the rotation matrix $\LU{0b}{\Rot}\cConfig$ in row-major format, in any configuration; the rotation matrix transforms local ($b$) to global (0) coordinates', 'Rotation':'$[\varphi_0,\,\varphi_1,\,\varphi_2]\tp\cConfig$vector with 3 components of the Euler angles in xyz-sequence ($\LU{0b}{\Rot}\cConfig=:\Rot_0(\varphi_0) \cdot \Rot_1(\varphi_1) \cdot \Rot_2(\varphi_2)$), recomputed from rotation matrix', 'AngularVelocity':'$\LU{0}{\tomega}\cConfig = \LU{0}{[\omega_0,\,\omega_1,\,\omega_2]}\cConfig\tp$global 3D angular velocity vector of node', 'AngularVelocityLocal':'$\LU{b}{\tomega}\cConfig = \LU{b}{[\omega_0,\,\omega_1,\,\omega_2]}\cConfig\tp$local (body-fixed) 3D angular velocity vector of node'}"
#outputVariables = "{'Position':'$\LU{0}{\pv}\cConfig = \LU{0}{[p_0,\,p_1,\,p_2]}\cConfig\tp= \LU{0}{\uv}\cConfig + \LU{0}{\pv}\cRef$global 3D position vector of node; $\uv\cRef=0$', 'Displacement':'$\LU{0}{\uv}\cConfig = [q_0,\,q_1,\,q_2]\cConfig\tp$global 3D displacement vector of node','Velocity':'$\LU{0}{\vv}\cConfig = [\dot q_0,\,\dot q_1,\,\dot q_2]\cConfig\tp$global 3D velocity vector of node', 'Coordinates':'$\cv\cConfig = [q_0,\,q_1,\,q_2, \,\psi_0,\,\psi_1,\,\psi_2,\,\psi_3]\tp\cConfig$ coordinate vector of node, having 3 displacement coordinates and 4 Euler parameters', 'Coordinates_t':'$\dot\cv\cConfig = [\dot q_0,\,\dot q_1,\,\dot q_2, \,\dot \psi_0,\,\dot \psi_1,\,\dot \psi_2,\,\dot \psi_3]\tp\cConfig$ velocity coordinates vector of node', 'RotationMatrix':'$[A_{00},\,A_{01},\,A_{02},\,A_{10},\,A_{11},\,A_{12},\,A_{20},\,A_{21},\,A_{22}]\cConfig\tp$vector with 9 components of the rotation matrix $\LU{0b}{\Rot}\cConfig$ in row-major format, in any configuration; the rotation matrix transforms local ($b$) to global (0) coordinates', 'Rotation':'$\varphi_0,\,\varphi_1,\,\varphi_2$vector with 3 components of the Euler angles in xyz-sequence ($\LU{0b}{\Rot}\cConfig=:\Rot_0(\varphi_0) \cdot \Rot_1(\varphi_1) \cdot \Rot_2(\varphi_2)$), recomputed from rotation matrix', 'AngularVelocity':'$\LU{0}{\tomega}\cConfig = \LU{0}{[\omega_0,\,\omega_1,\,\omega_2]}\cConfig\tp$global 3D angular velocity vector of node', 'AngularVelocityLocal':'$\LU{b}{\tomega}\cConfig = \LU{b}{[\omega_0,\,\omega_1,\,\omega_2]}\cConfig\tp$local (body-fixed) 3D angular velocity vector of node'}"
#
#outputVariables = "{'Position':'global 3D position vector of node (=displacement+reference position)', 'Displacement':'global 3D displacement vector of node',
#'Velocity':'global 3D velocity vector of node',
#'RotationMatrix':'vector with 9 components of the rotation matrix (row-major format)',
#'Rotation':'vector with 3 components of the Euler angles in xyz-sequence (R=Rx*Ry*Rz), recomputed from rotation matrix',
#'AngularVelocity':'global 3D velocity vector of node',
#'AngularVelocityLocal':'local (body-fixed) 3D velocity vector of node',
#'Coordinates':'coordinates vector of node', 'Coordinates_t':'velocity coordinates vector of node'}"
equations =
All coordinates $\cv\cConfig$ lead to second order differential equations, but there is one additional constraint equation for the quaternions.
The additional constraint equation, which needs to be provided by the object, reads
\be
1 - \sum_{i=0}^{3} \theta_i^2 = 0.
\ee
The rotation matrix $\LU{0b}{\Rot}\cConfig$ transforms local (body-fixed) 3D positions $\LU{b}{\pv} = \LU{b}{[p_0,\,p_1,\,p_2]}\tp$ to global 3D positions,
\be
\LU{0}{\pv}\cConfig = \LU{0b}{\Rot}\cConfig \LU{b}{\pv}
\ee
Note that the Euler parameters $\ttheta\cCur$ are computed as sum of current coordinates plus reference coordinates,
\be
\ttheta\cCur = \tpsi\cCur + \tpsi\cRef.
\ee
The rotation matrix is defined as function of the rotation parameters $\ttheta=[\theta_0,\,\theta_1,\,\theta_2,\,\theta_3]\tp$
\be
\LU{0b}{\Rot} = \mr{-2\theta_3^2 - 2\theta_2^2+1}{-2\theta_3\theta_0+2\theta_2\theta_1}{2*\theta_3\theta_1+2*\theta_2\theta_0}
{2\theta_3\theta_0+2\theta_2\theta_1}{-2\theta_3^2-2\theta_1^2+1}{2\theta_3\theta_2-2\theta_1\theta_0}
{-2\theta_2\theta_0+2\theta_3\theta_1}{2\theta_3\theta_2+2\theta_1\theta_0}{-2\theta_2^2-2\theta_1^2+1}
\ee
The derivatives of the angular velocity vectors w.r.t.\ the rotation velocity coordinates $\dot \ttheta=[\dot \theta_0,\,\dot \theta_1,\,\dot \theta_2,\,\dot \theta_3]\tp$ lead to the $\Gm$ matrices, as used in the equations of motion for rigid bodies,
\bea
\LU{0}{\tomega} &=& \LU{0}{\Gm} \dot \ttheta, \\
\LU{b}{\tomega} &=& \LU{b}{\Gm} \dot \ttheta.
%return ConstSizeMatrix<3*maxRotCoordinates>(3, 4, { -2.*ep[1], 2.*ep[0],-2.*ep[3], 2.*ep[2],
% -2.*ep[2], 2.*ep[3], 2.*ep[0],-2.*ep[1],
% -2.*ep[3],-2.*ep[2], 2.*ep[1], 2.*ep[0] });
%return ConstSizeMatrix<3*maxRotCoordinates>(3, 4, { -2.*ep[1], 2.*ep[0], 2.*ep[3],-2.*ep[2],
% -2.*ep[2],-2.*ep[3], 2.*ep[0], 2.*ep[1],
% -2.*ep[3], 2.*ep[2],-2.*ep[1], 2.*ep[0] });
\eea
/end
classType = Node
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "node's unique name"
V, CP, referenceCoordinates, , 7, Vector7D, "Vector7D({0.,0.,0., 0.,0.,0.,0.})", , I, "$\qv\cRef = [q_0,\,q_1,\,q_2,\,\psi_0,\,\psi_1,\,\psi_2,\,\psi_3]\tp\cRef = [\pv\tp\cRef,\,\tpsi\tp\cRef]\tp$reference coordinates (3 position coordinates and 4 Euler parameters) of node ==> e.g. ref. coordinates for finite elements or reference position of rigid body (e.g. for definition of joints)"
V, MP, initialCoordinates, initialCoordinates, 7, Vector7D, "Vector7D({0.,0.,0., 0.,0.,0.,0.})", , IO, "$\qv\cIni = [q_0,\,q_1,\,q_2,\,\psi_0,\,\psi_1,\,\psi_2,\,\psi_3]\tp\cIni = [\uv\tp\cIni,\,\tpsi\tp\cIni]\tp$initial displacement coordinates and 4 Euler parameters relative to reference coordinates"
V, MP, initialVelocities, initialCoordinates_t,7, Vector7D, "Vector7D({0.,0.,0., 0.,0.,0.,0.})", , IO, "$\dot \qv\cIni = [\dot q_0,\,\dot q_1,\,\dot q_2,\,\dot \psi_0,\,\dot \psi_1,\,\dot \psi_2,\,\dot \psi_3]\tp\cIni = [\dot \uv\tp\cIni,\,\dot \tpsi\tp\cIni]\tp$initial velocity coordinates: time derivatives of initial displacements and Euler parameters"
#V, C, globalAECoordinateIndex, , , Index, "EXUstd::InvalidIndex", , , "refers to the place in the global AE coordinate vector (filled during Assemble() )"
Fv, C, SetGlobalAECoordinateIndex, , , void, "globalAECoordinateIndex = globalIndex;", "Index globalIndex", I, "write access function needed by system for algebraic coordinate"
Fv, C, GetGlobalAECoordinateIndex, , , Index, "return globalAECoordinateIndex;", , CI, "read access function needed by system for algebraic coordinate"
#
Fv, C, GetNumberOfODE2Coordinates, , , Index, "return 7;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetNumberOfAECoordinates, , , Index, "return 1;", , CI, "return number of (internal) algebraic eq. coordinates"
Fv, C, GetNumberOfDisplacementCoordinates,, , Index, "return nDisplacementCoordinates;",,CI, "return number of displacement coordinates"
Fv, C, GetNumberOfRotationCoordinates, , , Index, "return nRotationCoordinates;", , CI, "return number of rotation coordinates"
#not possible: coordinate is automatically generated by rigid body!: Fv, C, GetNumberOfAECoordinates, , , Index,"return 1;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetType, , , Node::Type, "return (Node::Type)(Node::Position + Node::Orientation + Node::RigidBody + Node::RotationEulerParameters);", , CI, "return node type (for node treatment in computation)"
Fv, C, GetNodeGroup, , , CNodeGroup, "return (CNodeGroup)((Index)CNodeGroup::ODE2variables + (Index)CNodeGroup::AEvariables);", , CI, "return node group, which is special because of algebraic equations"
Fv, C, GetPosition, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent position of node; returns always a 3D Vector"
Fv, C, GetVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent velocity of node; returns always a 3D Vector"
Fv, C, GetRotationMatrix, , 9, Matrix3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Vector"
Fv, C, GetAngularVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector"
Fv, C, GetAngularVelocityLocal, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector"
Fv, C, GetPositionJacobian, , , void, , "Matrix& value", CDI, "provide position jacobian of node; derivative of 3D Position with respect to 7 coordinates ux,uy,uz,ep0,...,ep3"
Fv, C, GetRotationJacobian, , , void, , "Matrix& value", CDI, "provide 'rotation' jacobian $\Jm_R$ of node; derivative of 3D angular velocity vector with respect to all velocity coordinates ('G-matrix'); action of torque $\mv$: $\Qm_m = \Jm_R^T \mv$"
Fv, M, GetTypeName, , , const char*, "return 'RigidBodyEP';", , CI, "Get type name of node (without keyword 'Node'...!); could also be realized via a string -> type conversion?"
Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific node function ==> automatically generated in future"
Fv, C, GetReferenceCoordinateVector, , , LinkedDataVector, "return parameters.referenceCoordinates;", , CI, "return internally stored reference coordinates of node"
Fv, M, GetInitialVector, , , LinkedDataVector, "return parameters.initialCoordinates;", , CI, "return internally stored initial coordinates (displacements) of node"
Fv, M, GetInitialVector_t, , , LinkedDataVector, "return parameters.initialCoordinates_t;", , CI, "return internally stored initial coordinates (velocities) of node"
Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'; used e.g. for postprocessing and sensors"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#helper functions for rotation parameters:
#F, C, GetEulerParameters, , , ConstSizeVector<nRotationCoordinates>, ,"ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute vector to of 4 Euler Parameters from reference and configuration coordinates"
#F, C, GetEulerParameters_t, , , ConstSizeVector<nRotationCoordinates>, ,"ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute vector to time derivative of 4 Euler Parameters in given configuration"
Fv, C, GetRotationParameters, , , ConstSizeVector<maxRotationCoordinates>, ,"ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute vector to of 4 Euler Parameters from reference and configuration coordinates"
Fv, C, GetRotationParameters_t, , , LinkedDataVector, ,"ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute vector to time derivative of 4 Euler Parameters in given configuration"
Fv, C, GetG, , , void, ,"ConstSizeMatrix<maxRotationCoordinates * nDim3D>& matrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute G matrix (=diff(angularVelocity, velocityParameters)) for given configuration"
Fv, C, GetGlocal, , , void, ,"ConstSizeMatrix<maxRotationCoordinates * nDim3D>& matrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute local G matrix for given configuration"
Fv, C, GetG_t, , , void, ,"ConstSizeMatrix<maxRotationCoordinates * nDim3D>& matrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute G matrix (=diff(angularVelocity, velocityParameters)) for given configuration"
Fv, C, GetGlocal_t, , , void, ,"ConstSizeMatrix<maxRotationCoordinates * nDim3D>& matrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute local G matrix for given configuration"
#
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size (diameter, dimensions of underlying cube, etc.) for item; size == -1.f means that default size is used"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, color, , 4, Float4, "Float4({-1.f,-1.f,-1.f,-1.f})", , IO, "Default RGBA color for nodes; 4th value is alpha-transparency; R=-1.f means, that default color is used"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = NodeRigidBodyRxyz
classDescription = "A 3D rigid body node based on Euler / Tait-Bryan angles for rigid bodies or beams; all coordinates lead to second order differential equations; NOTE that this node has a singularity if the second rotation parameter reaches $\psi_1 = (2k-1) \pi/2$, with $k \in \Ncal$ or $-k \in \Ncal$."
cParentClass = CNodeRigidBody
mainParentClass = MainNode
visuParentClass = VisualizationNode
addProtectedC = " static constexpr Index nRotationCoordinates = 3;\n static constexpr Index nDisplacementCoordinates = 3;\n"
pythonShortName = RigidRxyz
outputVariables = "{'Position':'$\LU{0}{\pv}\cConfig = \LU{0}{[p_0,\,p_1,\,p_2]}\cConfig\tp= \LU{0}{\uv}\cConfig + \LU{0}{\pv}\cRef$global 3D position vector of node; $\uv\cRef=0$', 'Displacement':'$\LU{0}{\uv}\cConfig = [q_0,\,q_1,\,q_2]\cConfig\tp$global 3D displacement vector of node','Velocity':'$\LU{0}{\vv}\cConfig = [\dot q_0,\,\dot q_1,\,\dot q_2]\cConfig\tp$global 3D velocity vector of node', 'Coordinates':'$\cv\cConfig = [q_0,\,q_1,\,q_2, \,\psi_0,\,\psi_1,\,\psi_2]\tp\cConfig$ coordinate vector of node, having 3 displacement coordinates and 3 Euler angles', 'Coordinates_t':'$\dot\cv\cConfig = [\dot q_0,\,\dot q_1,\,\dot q_2, \,\dot \psi_0,\,\dot \psi_1,\,\dot \psi_2]\tp\cConfig$ velocity coordinates vector of node', 'RotationMatrix':'$[A_{00},\,A_{01},\,A_{02},\,A_{10},\,\ldots,\,A_{21},\,A_{22}]\cConfig\tp$vector with 9 components of the rotation matrix $\LU{0b}{\Rot}\cConfig$ in row-major format, in any configuration; the rotation matrix transforms local ($b$) to global (0) coordinates', 'Rotation':'$[\varphi_0,\,\varphi_1,\,\varphi_2]\tp\cConfig = [\psi_0,\,\psi_1,\,\psi_2]\tp\cRef + [\psi_0,\,\psi_1,\,\psi_2]\tp\cConfig$vector with 3 components of the Euler / Tait-Bryan angles in xyz-sequence ($\LU{0b}{\Rot}\cConfig=:\Rot_0(\varphi_0) \cdot \Rot_1(\varphi_1) \cdot \Rot_2(\varphi_2)$), recomputed from rotation matrix', 'AngularVelocity':'$\LU{0}{\tomega}\cConfig = \LU{0}{[\omega_0,\,\omega_1,\,\omega_2]}\cConfig\tp$global 3D angular velocity vector of node', 'AngularVelocityLocal':'$\LU{b}{\tomega}\cConfig = \LU{b}{[\omega_0,\,\omega_1,\,\omega_2]}\cConfig\tp$local (body-fixed) 3D angular velocity vector of node'}"
classType = Node
equations =
The node has 3 displacement coordinates $[q_0,\,q_1,\,q_2]\tp$ and 3 rotation coordinates $[\psi_0,\,\psi_1,\,\psi_2]\tp$ for consecutive rotations around the 0, 1 and 2-axis ($x$, $y$ and $z$).
All coordinates $\cv\cConfig$ lead to second order differential equations.
The rotation matrix $\LU{0b}{\Rot}\cConfig$ transforms local (body-fixed) 3D positions $\LU{b}{\pv} = \LU{b}{[p_0,\,p_1,\,p_2]}\tp$ to global 3D positions,
\be
\LU{0}{\pv}\cConfig = \LU{0b}{\Rot}\cConfig \LU{b}{\pv}
\ee
Note that the Euler angles $\ttheta\cCur$ are computed as sum of current coordinates plus reference coordinates,
\be
\ttheta\cCur = \tpsi\cCur + \tpsi\cRef.
\ee
The rotation matrix is defined as function of the rotation parameters $\ttheta=[\theta_0,\,\theta_1,\,\theta_2]\tp$
\be
\LU{0b}{\Rot} = \Rot_0(\theta_0)\Rot_1(\theta_1)\Rot_2(\theta_2)
\ee
The derivatives of the angular velocity vectors w.r.t.\ the rotation velocity coordinates $\dot \ttheta=[\dot \theta_0,\,\dot \theta_1,\,\dot \theta_2,\,\dot \theta_3]\tp$ lead to the $\Gm$ matrices, as used in the equations of motion for rigid bodies,
\bea
\LU{0}{\tomega} &=& \LU{0}{\Gm} \dot \ttheta, \\
\LU{b}{\tomega} &=& \LU{b}{\Gm} \dot \ttheta.
\eea
/end
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "node's unique name"
V, CP, referenceCoordinates, , 6, Vector6D, "Vector6D({0.,0.,0., 0.,0.,0.})", , I, "$\qv\cRef = [q_0,\,q_1,\,q_2,\,\psi_0,\,\psi_1,\,\psi_2]\tp\cRef = [\pv\tp\cRef,\,\tpsi\tp\cRef]\tp$reference coordinates (3 position and 3 xyz Euler angles) of node ==> e.g. ref. coordinates for finite elements or reference position of rigid body (e.g. for definition of joints)"
V, MP, initialCoordinates, initialCoordinates, 6, Vector6D, "Vector6D({0.,0.,0., 0.,0.,0.})", , IO, "$\qv\cIni = [q_0,\,q_1,\,q_2,\,\psi_0,\,\psi_1,\,\psi_2]\tp\cIni = [\uv\tp\cIni,\,\tpsi\tp\cIni]\tp$initial displacement coordinates: ux,uy,uz and 3 Euler angles (xyz) relative to reference coordinates"
V, MP, initialVelocities, initialCoordinates_t,6, Vector6D, "Vector6D({0.,0.,0., 0.,0.,0.})", , IO, "$\dot \qv\cIni = [\dot q_0,\,\dot q_1,\,\dot q_2,\,\dot \psi_0,\,\dot \psi_1,\,\dot \psi_2]\tp\cIni = [\dot \uv\tp\cIni,\,\dot \tpsi\tp\cIni]\tp$initial velocity coordinate: time derivatives of ux,uy,uz and of 3 Euler angles (xyz)"
#
Fv, C, GetNumberOfODE2Coordinates, , , Index, "return 6;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetNumberOfDisplacementCoordinates,, , Index, "return nDisplacementCoordinates;",,CI, "return number of displacement coordinates"
Fv, C, GetNumberOfRotationCoordinates, , , Index, "return nRotationCoordinates;", , CI, "return number of rotation coordinates"
#not possible: coordinate is automatically generated by rigid body!: Fv, C, GetNumberOfAECoordinates, , , Index,"return 1;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetType, , , Node::Type, "return (Node::Type)(Node::Position + Node::Orientation + Node::RigidBody + Node::RotationRxyz);", , CI, "return node type (for node treatment in computation)"
Fv, C, GetNodeGroup, , , CNodeGroup, "return CNodeGroup::ODE2variables;", , CI, "return node group, which is special because of algebraic equations"
Fv, C, GetPosition, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent position of node; returns always a 3D Vector"
Fv, C, GetVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent velocity of node; returns always a 3D Vector"
Fv, C, GetRotationMatrix, , 9, Matrix3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Vector"
Fv, C, GetAngularVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector"
Fv, C, GetAngularVelocityLocal, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector"
Fv, C, GetPositionJacobian, , , void, , "Matrix& value", CDI, "provide position jacobian of node; derivative of 3D Position with respect to 3 displacement coordinates $[q_0,\,q_1,\,q_2]\tp$ and 3 rotation coordinates $[\psi_0,\,\psi_1,\,\psi_2]\tp$"
Fv, C, GetRotationJacobian, , , void, , "Matrix& value", CDI, "provide 'rotation' jacobian $\Jm_R$ of node; derivative of 3D angular velocity vector with respect to all velocity coordinates ('G-matrix'); action of torque $\mv$: $\Qm_m = \Jm_R^T \mv$"
Fv, M, GetTypeName, , , const char*, "return 'RigidBodyRxyz';", , CI, "Get type name of node (without keyword 'Node'...!); could also be realized via a string -> type conversion?"
Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific node function ==> automatically generated in future"
Fv, C, GetReferenceCoordinateVector, , , LinkedDataVector, "return parameters.referenceCoordinates;", , CI, "return internally stored reference coordinates of node"
Fv, M, GetInitialVector, , , LinkedDataVector, "return parameters.initialCoordinates;", , CI, "return internally stored initial coordinates (displacements) of node"
Fv, M, GetInitialVector_t, , , LinkedDataVector, "return parameters.initialCoordinates_t;", , CI, "return internally stored initial coordinates (velocities) of node"
Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'; used e.g. for postprocessing and sensors"
#helper functions for rotation parameters:
Fv, C, GetRotationParameters, , , ConstSizeVector<maxRotationCoordinates>, ,"ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute vector to of 4 Euler Parameters from reference and configuration coordinates"
Fv, C, GetRotationParameters_t, , , LinkedDataVector, ,"ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute vector to time derivative of 4 Euler Parameters in given configuration"
Fv, C, GetG, , , void, ,"ConstSizeMatrix<maxRotationCoordinates * nDim3D>& matrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute G matrix (=diff(angularVelocity, velocityParameters)) for given configuration"
Fv, C, GetGlocal, , , void, ,"ConstSizeMatrix<maxRotationCoordinates * nDim3D>& matrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute local G matrix for given configuration"
Fv, C, GetG_t, , , void, ,"ConstSizeMatrix<maxRotationCoordinates * nDim3D>& matrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute G matrix (=diff(angularVelocity, velocityParameters)) for given configuration"
Fv, C, GetGlocal_t, , , void, ,"ConstSizeMatrix<maxRotationCoordinates * nDim3D>& matrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute local G matrix for given configuration"
#
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size (diameter, dimensions of underlying cube, etc.) for item; size == -1.f means that default size is used"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, color, , 4, Float4, "Float4({-1.f,-1.f,-1.f,-1.f})", , IO, "Default RGBA color for nodes; 4th value is alpha-transparency; R=-1.f means, that default color is used"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = NodeRigidBodyRotVecLG
classDescription = "A 3D rigid body node based on rotation vector and Lie group methods for rigid bodies or beams; the node has 3 displacement coordinates and three rotation coordinates."
cParentClass = CNodeRigidBody
mainParentClass = MainNode
visuParentClass = VisualizationNode
addProtectedC = " static constexpr Index nRotationCoordinates = 3;\n static constexpr Index nDisplacementCoordinates = 3;\n"
pythonShortName = RigidRotVecLG
outputVariables = "{'Position':'$\LU{0}{\pv}\cConfig = \LU{0}{[p_0,\,p_1,\,p_2]}\cConfig\tp= \LU{0}{\uv}\cConfig + \LU{0}{\pv}\cRef$global 3D position vector of node; $\uv\cRef=0$', 'Displacement':'$\LU{0}{\uv}\cConfig = [q_0,\,q_1,\,q_2]\cConfig\tp$global 3D displacement vector of node','Velocity':'$\LU{0}{\vv}\cConfig = [\dot q_0,\,\dot q_1,\,\dot q_2]\cConfig\tp$global 3D velocity vector of node', 'Coordinates':'$\cv\cConfig = [q_0,\,q_1,\,q_2, \,\nu_0,\,\nu_1,\,\nu_2]\tp\cConfig$ coordinate vector of node, having 3 displacement coordinates and 3 Euler angles', 'Coordinates_t':'$\dot\cv\cConfig = [\dot q_0,\,\dot q_1,\,\dot q_2, \,\dot \nu_0,\,\dot \nu_1,\,\dot \nu_2]\tp\cConfig$ velocity coordinates vector of node', 'RotationMatrix':'$[A_{00},\,A_{01},\,A_{02},\,A_{10},\,\ldots,\,A_{21},\,A_{22}]\cConfig\tp$vector with 9 components of the rotation matrix $\LU{0b}{\Rot}\cConfig$ in row-major format, in any configuration; the rotation matrix transforms local ($b$) to global (0) coordinates', 'Rotation':'$[\varphi_0,\,\varphi_1,\,\varphi_2]\tp\cConfig$vector with 3 components of the Euler / Tait-Bryan angles in xyz-sequence ($\LU{0b}{\Rot}\cConfig=:\Rot_0(\varphi_0) \cdot \Rot_1(\varphi_1) \cdot \Rot_2(\varphi_2)$), recomputed from rotation matrix', 'AngularVelocity':'$\LU{0}{\tomega}\cConfig = \LU{0}{[\omega_0,\,\omega_1,\,\omega_2]}\cConfig\tp$global 3D angular velocity vector of node', 'AngularVelocityLocal':'$\LU{b}{\tomega}\cConfig = \LU{b}{[\omega_0,\,\omega_1,\,\omega_2]}\cConfig\tp$local (body-fixed) 3D angular velocity vector of node'}"
classType = Node
equations =
The node has 3 displacement coordinates $[q_0,\,q_1,\,q_2]\tp$ and three rotation coordinates, which is the rotation vector
\be
\tnu = \varphi \nv = \tnu\cConfig + \tnu\cRef,
\ee
with the rotation angle $\varphi$ and the rotation axis $\nv$.
All coordinates $\cv\cConfig$ lead to second order differential equations, however the rotation vector cannot be used as a conventional parameterization. It must be computed within a nonlinear update, using appropriate Lie group methods.
The rotation matrix $\LU{0b}{\Rot}\cConfig$ transforms local (body-fixed) 3D positions $\LU{b}{\pv} = \LU{b}{[p_0,\,p_1,\,p_2]}\tp$ to global 3D positions,
\be
\LU{0}{\pv}\cConfig = \LU{0b}{\Rot}\cConfig \LU{b}{\pv}
\ee
Note that the rotation vector $\tnu\cCur$ are computed as sum of current coordinates plus reference coordinates,
\be
\ttheta\cCur = \tnu\cCur + \tnu\cRef \quad \mathrm{with}.
\ee
%The rotation matrix is defined as function of the rotation parameters $\ttheta=[\theta_0,\,\theta_1,\,\theta_2]\tp$
%\be
% \LU{0b}{\Rot} = \Rot_0(\theta_0)\Rot_1(\theta_1)\Rot_2(\theta_2)
%\ee
The derivatives of the angular velocity vectors w.r.t.\ the rotation velocity coordinates $\dot \ttheta=[\dot \theta_0,\,\dot \theta_1,\,\dot \theta_2,\,\dot \theta_3]\tp$ lead to the $\Gm$ matrices, as used in the equations of motion for rigid bodies,
\bea
\LU{0}{\tomega} &=& \LU{0}{\Gm} \dot \ttheta, \\
\LU{b}{\tomega} &=& \LU{b}{\Gm} \dot \ttheta.
\eea
/end
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "node's unique name"
V, CP, referenceCoordinates, , 3, Vector6D, "Vector6D({0.,0.,0., 0.,0.,0.})", , I, "$\qv\cRef = [q_0,\,q_1,\,q_2,\,\nu_0,\,\nu_1,\,\nu_2]\tp\cRef = [\pv\tp\cRef,\,\tnu\tp\cRef]\tp$reference coordinates (position and rotation vector $\tnu$) of node ==> e.g. ref. coordinates for finite elements or reference position of rigid body (e.g. for definition of joints)"
V, MP, initialCoordinates, initialCoordinates, 3, Vector6D, "Vector6D({0.,0.,0., 0.,0.,0.})", , IO, "$\qv\cIni = [q_0,\,q_1,\,q_2,\,\nu_0,\,\nu_1,\,\nu_2]\tp\cIni = [\uv\tp\cIni,\,\tnu\tp\cIni]\tp$initial displacement coordinates $\uv$ and rotation vector $\tnu$ relative to reference coordinates"
V, MP, initialVelocities, initialCoordinates_t,3, Vector6D, "Vector6D({0.,0.,0., 0.,0.,0.})", , IO, "$\dot \qv\cIni = [\dot q_0,\,\dot q_1,\,\dot q_2,\,\dot \nu_0,\,\dot \nu_1,\,\dot \nu_2]\tp\cIni = [\dot \uv\tp\cIni,\,\dot \tnu\tp\cIni]\tp$initial velocity coordinate: time derivatives of displacement and angular velocity vector"
#
Fv, C, GetNumberOfODE2Coordinates, , , Index, "return 6;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetNumberOfDisplacementCoordinates,, , Index, "return nDisplacementCoordinates;",,CI, "return number of displacement coordinates"
Fv, C, GetNumberOfRotationCoordinates, , , Index, "return nRotationCoordinates;", , CI, "return number of rotation coordinates"
#not possible: coordinate is automatically generated by rigid body!: Fv, C, GetNumberOfAECoordinates, , , Index,"return 1;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetType, , , Node::Type, "return (Node::Type)(Node::Position + Node::Orientation + Node::RigidBody + Node::RotationRotationVector + Node::RotationLieGroup);", , CI, "return node type (for node treatment in computation)"
Fv, C, GetNodeGroup, , , CNodeGroup, "return CNodeGroup::ODE2variables;", , CI, "return node group, which is special because of algebraic equations"
Fv, C, GetPosition, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent position of node; returns always a 3D Vector"
Fv, C, GetVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent velocity of node; returns always a 3D Vector"
Fv, C, GetRotationMatrix, , 9, Matrix3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Vector"
Fv, C, GetAngularVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector"
Fv, C, GetAngularVelocityLocal, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector"
Fv, C, GetPositionJacobian, , , void, , "Matrix& value", CDI, "provide position jacobian of node; derivative of 3D Position with respect to all coordinates"
Fv, C, GetRotationJacobian, , , void, , "Matrix& value", CDI, "provide 'rotation' jacobian $\Jm_R$ of node; derivative of 3D angular velocity vector with respect to all velocity coordinates (='G-matrix'); action of torque $\mv$: $\Qm_m = \Jm_R^T \mv$"
Fv, M, GetTypeName, , , const char*, "return 'RigidBodyRotVecLG';", , CI, "Get type name of node (without keyword 'Node'...!); could also be realized via a string -> type conversion?"
Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific node function ==> automatically generated in future"
Fv, C, GetReferenceCoordinateVector, , , LinkedDataVector, "return parameters.referenceCoordinates;", , CI, "return internally stored reference coordinates of node"
Fv, M, GetInitialVector, , , LinkedDataVector, "return parameters.initialCoordinates;", , CI, "return internally stored initial coordinates (displacements) of node"
Fv, M, GetInitialVector_t, , , LinkedDataVector, "return parameters.initialCoordinates_t;", , CI, "return internally stored initial coordinates (velocities) of node"
Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'; used e.g. for postprocessing and sensors"
#helper functions for rotation parameters:
Fv, C, GetRotationParameters, , , ConstSizeVector<maxRotationCoordinates>, ,"ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute vector to of 4 Euler Parameters from reference and configuration coordinates"
Fv, C, GetRotationParameters_t, , , LinkedDataVector, ,"ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute vector to time derivative of 4 Euler Parameters in given configuration"
Fv, C, GetG, , , void, ,"ConstSizeMatrix<maxRotationCoordinates * nDim3D>& matrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute G matrix (=diff(angularVelocity, velocityParameters)) for given configuration"
Fv, C, GetGlocal, , , void, ,"ConstSizeMatrix<maxRotationCoordinates * nDim3D>& matrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute local G matrix for given configuration"
Fv, C, GetG_t, , , void, ,"ConstSizeMatrix<maxRotationCoordinates * nDim3D>& matrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute G matrix (=diff(angularVelocity, velocityParameters)) for given configuration"
Fv, C, GetGlocal_t, , , void, ,"ConstSizeMatrix<maxRotationCoordinates * nDim3D>& matrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "Compute local G matrix for given configuration"
#
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size (diameter, dimensions of underlying cube, etc.) for item; size == -1.f means that default size is used"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, color, , 4, Float4, "Float4({-1.f,-1.f,-1.f,-1.f})", , IO, "Default RGBA color for nodes; 4th value is alpha-transparency; R=-1.f means, that default color is used"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = NodeRigidBody2D
classDescription = "A 2D rigid body node for rigid bodies or beams; the node has 2 displacement degrees of freedom and one rotation coordinate (rotation around z-axis: uphi). All coordinates are ODE2, used for second order differetial equations."
cParentClass = CNodeODE2
mainParentClass = MainNode
visuParentClass = VisualizationNode
pythonShortName = Rigid2D
#outputVariables = "{'Position':'global 3D position vector of node (=displacement+reference position)', 'Displacement':'global 3D displacement vector of node', 'Velocity':'global 3D velocity vector of node', 'Coordinates':'coordinates vector of node', 'Coordinates_t':'velocity coordinates vector of node'}"
outputVariables = "{'Position':'$\LU{0}{\pv}\cConfig = \LU{0}{[p_0,\,p_1,\,0]}\cConfig\tp= \LU{0}{\uv}\cConfig + \LU{0}{\pv}\cRef$global 3D position vector of node; $\uv\cRef=0$', 'Displacement':'$\LU{0}{\uv}\cConfig = [q_0,\,q_1,\,0]\cConfig\tp$global 3D displacement vector of node','Velocity':'$\LU{0}{\vv}\cConfig = [\dot q_0,\,\dot q_1,\,0]\cConfig\tp$global 3D velocity vector of node', 'Coordinates':'$\cv\cConfig = [q_0,\,q_1,\,\psi_0]\tp\cConfig$ coordinate vector of node, having 2 displacement coordinates and 1 angle', 'Coordinates_t':'$\dot\cv\cConfig = [\dot q_0,\,\dot q_1,\,\dot \psi_0]\tp\cConfig$ velocity coordinates vector of node', 'RotationMatrix':'$[A_{00},\,A_{01},\,A_{02},\,A_{10},\,\ldots,\,A_{21},\,A_{22}]\cConfig\tp$vector with 9 components of the rotation matrix $\LU{0b}{\Rot}\cConfig$ in row-major format, in any configuration; the rotation matrix transforms local ($b$) to global (0) coordinates', 'Rotation':'$[\theta_0]\tp\cConfig = [\psi_0]\tp\cRef + [\psi_0]\tp\cConfig$vector with 1 angle around out of plane axix', 'AngularVelocity':'$\LU{0}{\tomega}\cConfig = \LU{0}{[\omega_0,\,0,\,0]}\cConfig\tp$global 3D angular velocity vector of node', 'AngularVelocityLocal':'$\LU{b}{\tomega}\cConfig = \LU{b}{[\omega_0,\,0,\,0]}\cConfig\tp$local (body-fixed) 3D angular velocity vector of node'}"
classType = Node
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
The node provides 2 displacement coordinates (displacement of center of mass, COM, ($q_0,q_1$) ) and 1 rotation parameter ($\theta_0$). According equations need to be provided by an according object (e.g., RigidBody2D).
Using the rotation parameter $\theta_{0\mathrm{config}} = \psi_{0ref} + \psi_{0\mathrm{config}}$, the rotation matrix is defined as
\be
\LU{0b}{\Rot}\cConfig = \mr{\cos(\theta_0)}{-\sin(\theta_0)}{0}{\sin(\theta_0)}{\cos(\theta_0)}{0} {0}{0}{1}\cConfig
\ee
\noindent {\bf Example} for NodeRigidBody2D: see ObjectRigidBody2D
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "node's unique name"
V, CP, referenceCoordinates, , 3, Vector3D, "Vector3D({0.,0.,0.})", , I, "$\qv\cRef = [q_0,\,q_1,\,\psi_0]\tp\cRef$reference coordinates (x-pos,y-pos and rotation) of node ==> e.g. ref. coordinates for finite elements; global position of node without displacement"
V, MP, initialCoordinates, initialCoordinates, 3, Vector3D, "Vector3D({0.,0.,0.})", , IO, "$\qv\cIni = [q_0,\,q_1,\,\psi_0]\tp\cIni$initial displacement coordinates and angle (relative to reference coordinates)"
V, MP, initialVelocities, initialCoordinates_t,3, Vector3D, "Vector3D({0.,0.,0.})", , IO, "$\dot \qv\cIni = [\dot q_0,\,\dot q_1,\,\dot \psi_0]\tp\cIni = [v_0,\,v_1,\,\omega_2]\tp\cIni$initial velocity coordinates"
Fv, C, GetNumberOfODE2Coordinates, GetNumberOfODE2Coordinates,, Index,"return 3;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetType, , , Node::Type, "return (Node::Type)(Node::Position2D + Node::Orientation2D + Node::RigidBody);", , CI, "return node type (for node treatment in computation)"
Fv, C, GetPosition, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent position of node; returns always a 3D Vector"
Fv, C, GetVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent velocity of node; returns always a 3D Vector"
Fv, C, GetRotationMatrix, , 9, Matrix3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Vector"
Fv, C, GetAngularVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector"
Fv, C, GetAngularVelocityLocal, , 3, Vector3D, "return GetAngularVelocity(configuration);", "ConfigurationType configuration = ConfigurationType::Current", CI, "return configuration dependent local (=body-fixed) angular velocity of node; in 2D case, this is the same as the global angular velocity; returns always a 3D Vector"
Fv, C, GetPositionJacobian, , , void, "value.SetMatrix(3,3,{1.f,0.f,0.f, 0.f,1.f,0.f, 0.f,0.f,0.f});", "Matrix& value", CI, "provide position jacobian of node; derivative of 3D Position with respect to 3 coordinates ux,uy,uphi"
Fv, C, GetRotationJacobian, , , void, "value.SetMatrix(3,3,{0.f,0.f,0.f, 0.f,0.f,0.f, 0.f,0.f,1.f});", "Matrix& value", CI, "provide 'rotation' jacobian $\Jm_R$ of node; derivative of 3D angular velocity vector with respect to all velocity coordinates ('G-matrix'); action of torque $\mv$: $\Qm_m = \Jm_R^T \mv$"
Fv, M, GetTypeName, , , const char*, "return 'RigidBody2D';", , CI, "Get type name of node (without keyword 'Node'...!); could also be realized via a string -> type conversion?"
Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific node function ==> automatically generated in future"
Fv, C, GetReferenceCoordinateVector, , , LinkedDataVector, "return parameters.referenceCoordinates;", , CI, "return internally stored reference coordinates of node"
Fv, M, GetInitialVector, , , LinkedDataVector, "return parameters.initialCoordinates;", , CI, "return internally stored initial coordinates (displacements) of node"
Fv, M, GetInitialVector_t, , , LinkedDataVector, "return parameters.initialCoordinates_t;", , CI, "return internally stored initial coordinates (velocities) of node"
Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'; used e.g. for postprocessing and sensors"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size (diameter, dimensions of underlying cube, etc.) for item; size == -1.f means that default size is used"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, color, , 4, Float4, "Float4({-1.f,-1.f,-1.f,-1.f})", , IO, "Default RGBA color for nodes; 4th value is alpha-transparency; R=-1.f means, that default color is used"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = Node1D
classDescription = "A node with one ODE2 coordinate for one dimensional (1D) problems; use e.g. for scalar dynamic equations (Mass1D) and mass-spring-damper mechanisms, representing either translational or rotational degrees of freedom: in most cases, Node1D is equivalent to NodeGenericODE2 using one coordinate, however, it offers a transformation to 3D translational or rotational motion and allows to couple this node to 2D or 3D bodies."
cParentClass = CNodeODE2
mainParentClass = MainNode
visuParentClass = VisualizationNode
outputVariables = "{'Coordinates':'$\qv\cConfig = [q_0]\tp\cConfig$ODE2 coordinate of node (in vector form)', 'Coordinates_t':'$\dot \qv\cConfig = [\dot q_0]\tp\cConfig$ODE2 velocity coordinate of node (in vector form)'}"
classType = Node
equations =
The current position/rotation coordinate of the 1D node is computed from
\be
p_0 = {q_0}\cRef + {q_0}\cCur
\ee
The coordinate leads to one second order differential equation.
The graphical representation and the (internal) position of the node is
\be
p\cConfig= \vr{{p_0}\cConfig}{0}{0}
\ee
The (internal) velocity vector is $[{p_0}\cConfig,\,0,\,0]\tp$.
/end
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "node's unique name"
V, CP, referenceCoordinates, , , Vector, "Vector({0.})", , I, "$[q_0]\tp\cRef$reference coordinate of node (in vector form)"
V, MP, initialCoordinates, , , Vector, "Vector({0.})", , IO, "$[q_0]\tp\cIni$initial displacement coordinate (in vector form)"
V, MP, initialVelocities, initialCoordinates_t, , Vector, "Vector({0.})", , IO, "$[\dot q_0]\tp\cIni$initial velocity coordinate (in vector form)"
#
Fv, C, GetNumberOfODE2Coordinates, GetNumberOfODE2Coordinates,, Index,"return 1;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetType, , , Node::Type, "return Node::GenericODE2;",, CI, "return node type (for node treatment in computation)"
Fv, C, GetPosition, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent position of node; returns always a 3D Vector; gives the local (x) position for Node1D"
Fv, C, GetVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent velocity of node; returns always a 3D Vector; gives the local (x) velocity for Node1D"
Fv, M, GetTypeName, , , const char*, "return '1D';", , CI, "Get type name of node (without keyword 'Node'...!); could also be realized via a string -> type conversion?"
#Fv, M, CallFunction, , , py::object, ";", "STDstring functionName, py::dict args", CDI, "Call a specific node function ==> automatically generated in future"
Fv, C, GetReferenceCoordinateVector, , , LinkedDataVector, "return parameters.referenceCoordinates;", , CI, "return internally stored reference coordinates of node"
Fv, M, GetInitialVector, , , LinkedDataVector, "return parameters.initialCoordinates;", , CI, "return internally stored initial coordinates (displacements) of node"
Fv, M, GetInitialVector_t, , , LinkedDataVector, "return parameters.initialCoordinates_t;", , CI, "return internally stored initial coordinates (velocities) of node"
Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'; used e.g. for postprocessing and sensors"
#Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#VISUALIZATION:
Vp, V, show, , , bool, "false", , IO, "set true, if item is shown in visualization and false if it is not shown; The node1D is represented as reference position and displacement along the global x-axis, which must not agree with the representation in the object using the Node1D"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", I, "Empty graphics update for now"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = NodePoint2DSlope1
classDescription = "A 2D point/slope vector node for planar Bernoulli-Euler ANCF (absolute nodal coordinate formulation) beam elements; the node has 4 displacement degrees of freedom (2 for displacement of point node and 2 for the slope vector 'slopex'); all coordinates lead to second order differential equations; the slope vector defines the directional derivative w.r.t the local axial (x) coordinate, denoted as $()^\prime$; in straight configuration aligned at the global x-axis, the slope vector reads $\rv^\prime=[r_x^\prime\;\;r_y^\prime]^T=[1\;\;0]^T$."
cParentClass = CNodeODE2
mainParentClass = MainNode
visuParentClass = VisualizationNode
pythonShortName = Point2DS1
outputVariables = "{'Position':'global 3D position vector of node (=displacement+reference position)', 'Displacement':'global 3D displacement vector of node', 'Velocity':'global 3D velocity vector of node', 'Coordinates':'coordinates vector of node (2 displacement coordinates + 2 slope vector coordinates)', 'Coordinates_t':'velocity coordinates vector of node (derivative of the 2 displacement coordinates + 2 slope vector coordinates)'}"
classType = Node
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "node's unique name"
V, CP, referenceCoordinates, , 4, Vector4D, "Vector4D({0.,0.,1.,0.})", , I, "reference coordinates (x-pos,y-pos; x-slopex, y-slopex) of node; global position of node without displacement"
V, MP, initialCoordinates, initialCoordinates, 4, Vector4D, "Vector4D({0.,0.,0.,0.})", , IO, "initial displacement coordinates: ux, uy and x/y 'displacements' of slopex"
V, MP, initialVelocities, initialCoordinates_t,4, Vector4D, "Vector4D({0.,0.,0.,0.})", , IO, "initial velocity coordinates"
Fv, C, GetNumberOfODE2Coordinates, GetNumberOfODE2Coordinates,, Index,"return 4;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetType, , , Node::Type, "return (Node::Type)(Node::Position2D + Node::Orientation2D + Node::Point2DSlope1);", , CI, "return node type (for node treatment in computation)"
Fv, C, GetPosition, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent position of node; returns always a 3D Vector"
Fv, C, GetVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent velocity of node; returns always a 3D Vector"
Fv, C, GetRotationMatrix, , 9, Matrix3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; the slope vector $\rv^\prime = [1,0]$ is defines as zero angle ($\varphi = 0$), leading to a matrix $\Am = \mr{\cos\varphi}{-\sin\varphi}{0} {\sin\varphi}{\cos\varphi}{0} {0}{0}{1}$; the function always computes a 3D Matrix"
Fv, C, GetAngularVelocity, , 3, Vector3D, , "ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector"
Fv, C, GetAngularVelocityLocal, , 3, Vector3D, "return GetAngularVelocity(configuration);","ConfigurationType configuration = ConfigurationType::Current", CI, "return configuration dependent angular velocity of node; in 2D case, this is the same as the global angular velocity; returns always a 3D Vector"
Fv, C, GetPositionJacobian, , , void, , "Matrix& value", CDI, "provide position jacobian $\Jm_P$ of node; derivative of 3D position with respect to 4 coordinates ux,uy and x/y 'displacements' of slopex; action of force: $\Qm_f = \Jm_P^T \fv$"
Fv, C, GetRotationJacobian, , , void, , "Matrix& value", CDI, "provide 'rotation' jacobian $\Jm_R$ of node; derivative of 3D angular velocity with respect to 4 velocity coordinates ux,uy and x/y 'displacements' of slopex; action of torque: $\Qm_m = \Jm_R^T \mv$"
Fv, M, GetTypeName, , , const char*, "return 'Point2DSlope1';", , CI, "Get type name of node (without keyword 'Node'...!); could also be realized via a string -> type conversion?"
Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific node function ==> automatically generated in future"
Fv, C, GetReferenceCoordinateVector, , , LinkedDataVector, "return parameters.referenceCoordinates;", , CI, "return internally stored reference coordinates of node"
Fv, M, GetInitialVector, , , LinkedDataVector, "return parameters.initialCoordinates;", , CI, "return internally stored initial coordinates (displacements) of node"
Fv, M, GetInitialVector_t, , , LinkedDataVector, "return parameters.initialCoordinates_t;", , CI, "return internally stored initial coordinates (velocities) of node"
Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'; used e.g. for postprocessing and sensors"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size (diameter, dimensions of underlying cube, etc.) for item; size == -1.f means that default size is used"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, color, , 4, Float4, "Float4({-1.f,-1.f,-1.f,-1.f})", , IO, "Default RGBA color for nodes; 4th value is alpha-transparency; R=-1.f means, that default color is used"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = NodeGenericODE2
classDescription = "A node containing a number of ODE2 variables; use e.g. for scalar dynamic equations (Mass1D) or for the ALECable element."
cParentClass = CNodeODE2
mainParentClass = MainNode
visuParentClass = VisualizationNode
outputVariables = "{'Coordinates':'$\qv\cConfig = [q_0,\,\ldots,\,q_{nc}]\tp\cConfig$coordinates vector of node', 'Coordinates_t':'$\dot \qv\cConfig = [\dot q_0,\,\ldots,\,\dot q_{nc}]\tp\cConfig$velocity coordinates vector of node'}"
classType = Node
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "node's unique name"
V, CP, referenceCoordinates, , , Vector, "Vector()", , I, "$\qv\cRef = [q_0,\,\ldots,\,q_{nc}]\tp\cRef$generic reference coordinates of node; must be consistent with numberOfODE2Coordinates"
V, MP, initialCoordinates, , , Vector, "Vector()", , IO, "$\qv\cIni = [q_0,\,\ldots,\,q_{nc}]\tp\cIni$initial displacement coordinates; must be consistent with numberOfODE2Coordinates"
V, MP, initialCoordinates_t, , , Vector, "Vector()", , IO, "$\dot \qv\cIni = [\dot q_0,\,\ldots,\,\dot q_{n_c}]\tp\cIni$initial velocity coordinates; must be consistent with numberOfODE2Coordinates"
V, CP, numberOfODE2Coordinates, , , Index, "0", , I, "$n_c$number of generic ODE2 coordinates"
Fv, C, GetNumberOfODE2Coordinates, GetNumberOfODE2Coordinates,, Index,"return parameters.numberOfODE2Coordinates;;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetType, , , Node::Type, "return Node::GenericODE2;", , CI, "return node type (for node treatment in computation)"
Fv, C, GetPosition, , 3, Vector3D, "return Vector3D({0.,0.,0.});", "ConfigurationType configuration = ConfigurationType::Current", CI, "return configuration dependent position of node; returns always a 3D Vector; this makes no sense for NodeGenericODE2, but necessary for consistency; FUTURE: add 'drawable' flag to nodes in order to exclude drawing"
Fv, M, GetTypeName, , , const char*, "return 'GenericODE2';", , CI, "Get type name of node (without keyword 'Node'...!); could also be realized via a string -> type conversion?"
#Fv, M, CallFunction, , , py::object, ";", "STDstring functionName, py::dict args", CDI, "Call a specific node function ==> automatically generated in future"
Fv, C, GetReferenceCoordinateVector, , , LinkedDataVector, "return parameters.referenceCoordinates;", , CI, "return internally stored reference coordinates of node"
Fv, M, GetInitialVector, , , LinkedDataVector, "return parameters.initialCoordinates;", , CI, "return internally stored initial coordinates (displacements) of node"
Fv, M, GetInitialVector_t, , , LinkedDataVector, "return parameters.initialCoordinates_t;", , CI, "return internally stored initial coordinates (velocities) of node"
Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'; used e.g. for postprocessing and sensors"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#VISUALIZATION:
Vp, V, show, , , bool, "false", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", I, "Empty graphics update for now"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = NodeGenericData
classDescription = "A node containing a number of data (history) variables; use e.g. for contact (active set), friction or plasticity (history variable)."
cParentClass = CNodeData
mainParentClass = MainNode
visuParentClass = VisualizationNode
outputVariables = "{'Coordinates':'$\xv\cConfig = [x_0,\,\ldots,\,x_{nc}]\tp\cConfig$data coordinates (history variables) vector of node'}"
classType = Node
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "node's unique name"
V, MP, initialCoordinates, , , Vector, "Vector()", , IO, "$\xv\cIni = [x_0,\,\ldots,\,x_{n_c}]\tp\cIni$initial data coordinates"
V, CP, numberOfDataCoordinates, , , Index, "0", , I, "$n_c$number of generic data coordinates (history variables)"
Fv, C, GetNumberOfDataCoordinates, , , Index, "return parameters.numberOfDataCoordinates;", , CI, "return number of data coordinates"
Fv, C, GetType, , , Node::Type, "return Node::GenericData;", , CI, "return node type (for node treatment in computation)"
#Fv, C, NodeGroup, , , CNodeGroup, , , CIJ, "return node group (for classification (ODE1/ODE2/AE) in computation)"
Fv, M, GetTypeName, , , const char*, "return 'GenericData';", , CI, "Get type name of node (without keyword 'Node'...!); could also be realized via a string -> type conversion?"
#Fv, M, CallFunction, , , py::object, ";", "STDstring functionName, py::dict args", CDI, "Call a specific node function ==> automatically generated in future"
Fv, M, GetInitialVector, , , LinkedDataVector, "return parameters.initialCoordinates;", , CI, "return internally stored initial data coordinates of node"
Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'; used e.g. for postprocessing and sensors"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#VISUALIZATION:
Vp, V, show, , , bool, "false", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", I, "Empty graphics update for now"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = NodePointGround
classDescription = "A 3D point node fixed to ground. The node can be used as NodePoint, but it does not generate coordinates. Applied or reaction forces do not have any effect."
cParentClass = CNodeODE2
mainParentClass = MainNode
visuParentClass = VisualizationNode
pythonShortName = PointGround
outputVariables = "{'Position':'$\pv\cConfig = [p_0,\,p_1,\,p_2]\cConfig\tp = \pv\cRef$global 3D position vector of node (=reference position)', 'Displacement':'$\uv\cConfig = [0,\,0,\,0]\cConfig\tp$zero 3D vector', 'Velocity':'$\vv\cConfig = [0,\,0,\,0]\cConfig\tp$zero 3D vector', 'Coordinates':'$\cv\cConfig =[]$vector of length zero', 'Coordinates_t':'$\dot\cv\cConfig =[]$vector of length zero'}"
classType = Node
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "node's unique name"
V, CP, referenceCoordinates, , 3, Vector3D, "Vector3D({0.,0.,0.})", , I, "$\qv\cRef = [q_0,\,q_1,\,q_2]\tp\cRef = \pv\cRef = [r_0,\,r_1,\,r_2]\tp$reference coordinates of node ==> e.g. ref. coordinates for finite elements; global position of node without displacement"
#V, MP, initialCoordinates, initialCoordinates, 3, Vector3D, "Vector3D({0.,0.,0.})", , IO, "initial displacement coordinate"
#V, MP, initialVelocities, initialCoordinates_t,3, Vector3D, "Vector3D({0.,0.,0.})", , IO, "initial velocity coordinate"
Fv, C, GetNumberOfODE2Coordinates, GetNumberOfODE2Coordinates,, Index,"return 0;", , CI, "return number of second order diff. eq. coordinates"
Fv, C, GetType, , , Node::Type, "return (Node::Type)(Node::Position + Node::Position2D + Node::GenericODE2 + Node::Ground);", , CI, "return node type (for node treatment in computation)"
#Fv, C, NodeGroup, , , CNodeGroup, , , CIJ, "return node group (for classification (ODE1/ODE2/AE) in computation)"
Fv, C, GetPosition, , 3, Vector3D, "return parameters.referenceCoordinates;", "ConfigurationType configuration = ConfigurationType::Current", CI, "Returns position of node, which is the reference position for all configurations"
Fv, C, GetVelocity, , 3, Vector3D, "return Vector3D(0.);", "ConfigurationType configuration = ConfigurationType::Current", CI, "Returns zero velocity
Fv, C, GetPositionJacobian, , , void, "value.SetNumberOfRowsAndColumns(0,0);", "Matrix& value", CI, "return zero sized matrix for ground node (no action)"
Fv, M, GetTypeName, , , const char*, "return 'PointGround';", , CI, "Get type name of node (without keyword 'Node'...!); could also be realized via a string -> type conversion?"
Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific node function ==> automatically generated in future"
Fv, C, GetReferenceCoordinateVector, , , LinkedDataVector, "return parameters.referenceCoordinates;", , CI, "return internally stored reference coordinates of node"
Fv, M, GetInitialVector, , , LinkedDataVector, "return LinkedDataVector();", , CI, "return empty vector, as there are no initial coordinates"
Fv, M, GetInitialVector_t, , , LinkedDataVector, "return LinkedDataVector();", , CI, "return empty vector, as there are no initial velocity coordinates"
Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'; used e.g. for postprocessing and sensors"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size (diameter, dimensions of underlying cube, etc.) for item; size == -1.f means that default size is used"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, color, , 4, Float4, "Float4({-1.f,-1.f,-1.f,-1.f})", , IO, "Default RGBA color for nodes; 4th value is alpha-transparency; R=-1.f means, that default color is used"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectMassPoint
classDescription = "A 3D mass point which is attached to a position-based node, usually NodePoint."
cParentClass = CObjectBody
mainParentClass = MainObjectBody
visuParentClass = VisualizationObject
pythonShortName = MassPoint
addProtectedC = " static constexpr Index nODE2Coordinates = 3;\n"
outputVariables = "{'Position':'$\LU{0}{\pv}\cConfig(\LU{b}{\pv}) = \LU{0}{\uv}\cConfig + \LU{0}{\pv}\cRef + \LU{0b}{\Rot}\LU{b}{\pv}$global position vector of translated local position; local (body) coordinate system = global coordinate system', 'Displacement':'$\LU{0}{\uv}\cConfig = [q_0,\;q_1,\;q_2]\cConfig\tp$global displacement vector of mass point', 'Velocity':'$\LU{0}{\vv}\cConfig = \LU{0}{\dot\uv}\cConfig = [\dot q_0,\;\dot q_1,\;\dot q_2]\cConfig\tp$global velocity vector of mass point'}"
classType = Object
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
\vspace{6pt}\\
\startTable{intermediate variables}{symbol}{description}
\rowTable{node position}{$\LU{0}{\pv}\cConfig = \LU{0}{\pv}(n_0)\cConfig$}{position of mass point which is provided by node $n_0$ in any configuration}
\rowTable{node displacement}{$\LU{0}{\uv}\cConfig = [q_0,\;q_1,\;q_2]\cConfig\tp = \LU{0}{\uv}(n_0)\cConfig$}{displacement of mass point which is provided by node $n_0$ in any configuration}
\rowTable{node velocity}{$\LU{0}{\vv}\cConfig = [\dot q_0,\;\dot q_1,\;\dot q_2]\cConfig\tp = \LU{0}{\vv}(n_0)\cConfig$}{velocity of mass point which is provided by node $n_0$ in any configuration}
\rowTable{transformation matrix}{$\LU{0b}{\Rot} = \Im^{3\times 3}$}{transformation of local body ($b$) coordinates to global (0) coordinates; this is the constant unit matrix, because local = global coordinates for the mass point}
\rowTable{residual forces}{$\LU{0}{\fv} = [f_0,\;f_1,\;f_2]\tp$}{residual of all forces on mass point }
\rowTable{applied forces}{$\LU{0}{\fv}_a = [f_0,\;f_1,\;f_2]\tp$}{applied forces (loads, connectors, joint reaction forces, ...)}
\finishTable
%{\bf Definition of quantities}:
%\bi
% %\item $m \ldots$ physicsMass
% %\item $n0 \ldots$ node number
% \item $\cv\body = \cv_{n0} (= [q_0,\;q_1,\;q_2]\tp) \ldots$ displacement coordinates of body (taken from NodePoint)
% \item $\fv = [f_0,\;f_1,\;f_2]\tp \ldots$ residual of all forces (loads, constraints, springs, ...)
% \item $\pv\cRef = \cv\cRef = [q_0,\;q_1,\;q_2]\cRef\tp \ldots$ reference position = reference coordinates of node
% \item $\pv\cConfig = \uv\cConfig + \pv\cRef \ldots$ position in any configuration ($\uv\cRef = 0$)
% \item $\pv\cCur = \uv\cCur + \pv\cRef \ldots$ current position, equals to node's reference position + current coordinates
%\ei
{\bf Equations of motion}:
\be
\mr{m}{0}{0} {0}{m}{0} {0}{0}{m} \vr{\ddot q_0}{\ddot q_1}{\ddot q_2} = \vr{f_0}{f_1}{f_2}.
\ee
For example, a LoadCoordinate on coordinate 1 of the node would add a term in $f_1$ on the RHS.
Position-based markers can measure position $\pv\cConfig$. The {\bf position jacobian}
\be
\Jm_{pos} = \partial \pv\cCur / \partial \cv\cCur = \mr{1}{0}{0} {0}{1}{0} {0}{0}{0}
\ee
transforms the action of global applied forces $\LU{0}{\fv}_a$ of position-based markers on the coordinates $\cv$
\be
\Qm = \Jm_{pos} \LU{0}{\fv}_a.
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
miniExample =
node = mbs.AddNode(NodePoint(referenceCoordinates = [1,1,0],
initialCoordinates=[0.5,0,0],
initialVelocities=[0.5,0,0]))
mbs.AddObject(MassPoint(nodeNumber = node, physicsMass=1))
#assemble and solve system for default parameters
mbs.Assemble()
SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', exu.SimulationSettings())
#check result
testError = mbs.GetNodeOutput(node, exu.OutputVariableType.Position)[0] - 2
#final x-coordinate of position shall be 2
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#done automatically: V, M, cObjectMassPoint, , , CNodePoint*,, , , "pointer to computational object"
Vp, M, name, , , String, "", , I, "objects's unique name"
V, CP, physicsMass, , , UReal, "0.", , I, "$m$mass [SI:kg] of mass point"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "$n0$node number (type NodeIndex) for mass point"
#
# add dict interface for functions in a different way!
Fv, C, ComputeMassMatrix, , , void, , "Matrix& massMatrix", CDI, "Computational function: compute mass matrix"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return JacobianType::_None;", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetAccessFunctionTypes, , , AccessFunctionType,, , CDI, "Flags to determine, which access (forces, moments, connectors, ...) to object are possible"
Fv, C, GetAccessFunctionBody, , , void, , "AccessFunctionType accessType, const Vector3D& localPosition, Matrix& value", DC, "provide Jacobian at localPosition in 'value' according to object access"
Fv, C, GetOutputVariableBody, , , void, , "OutputVariableType variableType, const Vector3D& localPosition, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetPosition, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetDisplacement, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetVelocity, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of 'localPosition' according to configuration type"
Fv, C, GetLocalCenterOfMass, , 3, Vector3D, "return Vector3D({0.,0.,0.});", , CI, "return the local position of the center of mass, needed for equations of motion and for massProportionalLoad"
#
Fv, M, GetTypeName, , , const char*, "return 'MassPoint';" , , CI, "Get type name of object; could also be realized via a string -> type conversion?"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex == 0);\n return parameters.nodeNumber;", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 1;", , CI, "number of nodes; needed for every object"
#Fv, C, GetODE2LocalToGlobalCoordinates,, , Index, , , CDI, "local to global coordinates of body --> not needed"
Fv, C, GetODE2Size, , , Index, "return nODE2Coordinates;", , CI, "number of ODE2 coordinates; needed for object?"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::Position;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Body + (Index)CObjectType::SingleNoded);",, CI, "Get type of object, e.g. to categorize and distinguish during assembly and computation"
Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific object function ==> automatically generated in future?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, graphicsData, , , BodyGraphicsData, , , IO, "Structure contains data for body visualization; data is defined in special list / dictionary structure"
#file names automatically determined from class name
writeFile = True
class = ObjectMassPoint2D
classDescription = "A 2D mass point which is attached to a position-based 2D node."
# Equations of motion with the displacements $[u_x\;\; u_y]^T$, the mass $m$ and the residual of all forces $[R_x\;\; R_y]^T$ are given as \be \vp{m \cdot \ddot u_x}{m \cdot \ddot u_y} = \vp{R_x}{R_y}.\ee
cParentClass = CObjectBody
mainParentClass = MainObjectBody
visuParentClass = VisualizationObject
pythonShortName = MassPoint2D
addProtectedC = " static constexpr Index nODE2Coordinates = 2;\n"
outputVariables = "{'Position':'$\LU{0}{\pv}\cConfig(\LU{b}{\pv}) = \LU{0}{\uv}\cConfig + \LU{0}{\pv}\cRef + \LU{0b}{\Rot}\LU{b}{\pv}$global position vector of translated local position; local (body) coordinate system = global coordinate system', 'Displacement':'$\LU{0}{\uv}\cConfig = [q_0,\;q_1,\;0]\cConfig\tp$global displacement vector of mass point', 'Velocity':'$\LU{0}{\vv}\cConfig = \LU{0}{\dot\uv}\cConfig = [\dot q_0,\;\dot q_1,\;0]\cConfig\tp$global velocity vector of mass point'}"
classType = Object
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
\vspace{6pt}\\
\startTable{intermediate variables}{symbol}{description}
\rowTable{node position}{$\LU{0}{\pv}\cConfig = \LU{0}{\pv}(n_0)\cConfig$}{position of mass point which is provided by node $n_0$ in any configuration}
\rowTable{node displacement}{$\LU{0}{\uv}\cConfig = [q_0,\;q_1,\;0]\cConfig\tp = \LU{0}{\uv}(n_0)\cConfig$}{displacement of mass point which is provided by node $n_0$ in any configuration}
\rowTable{node velocity}{$\LU{0}{\vv}\cConfig = [\dot q_0,\;\dot q_1,\;0]\cConfig\tp = \LU{0}{\vv}(n_0)\cConfig$}{velocity of mass point which is provided by node $n_0$ in any configuration}
\rowTable{transformation matrix}{$\LU{0b}{\Rot} = \Im^{3\times 3}$}{transformation of local body ($b$) coordinates to global (0) coordinates; this is the constant unit matrix, because local = global coordinates for the mass point}
\rowTable{residual forces}{$\LU{0}{\fv} = [f_0,\;f_1]\tp$}{residual of all forces on mass point}
\rowTable{applied forces}{$\LU{0}{\fv}_a = [f_0,\;f_1,\;f_2]\tp$}{applied forces (loads, connectors, joint reaction forces, ...)}
\finishTable
%
{\bf Equations of motion}:
\be
\mp{m}{0} {0}{m} \vp{\ddot q_0}{\ddot q_1} = \vp{f_0}{f_1}.
\ee
For example, a LoadCoordinate on coordinate 1 of the node would add a term in $f_1$ on the RHS.
Position-based markers can measure position $\pv\cConfig$. The {\bf position jacobian}
\be
\Jm_{pos} = \partial \pv\cCur / \partial \cv\cCur =
\left[\!\! \begin{array}{ccc}
1 & 0 & 0 \vspace{0.1cm}\\
0 & 1 & 0 \end{array} \!\!\right]
\ee
transforms the action of global applied forces $\LU{0}{\fv}_a$ of position-based markers on the coordinates $\cv$
\be
\Qm = \Jm_{pos} \LU{0}{\fv}_a.
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
miniExample =
node = mbs.AddNode(NodePoint2D(referenceCoordinates = [1,1],
initialCoordinates=[0.5,0],
initialVelocities=[0.5,0]))
mbs.AddObject(MassPoint2D(nodeNumber = node, physicsMass=1))
#assemble and solve system for default parameters
mbs.Assemble()
SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', exu.SimulationSettings())
#check result
testError = mbs.GetNodeOutput(node, exu.OutputVariableType.Position)[0] - 2
#final x-coordinate of position shall be 2
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "objects's unique name"
V, CP, physicsMass, , , UReal, "0.", , I, "$m$mass [SI:kg] of mass point"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "$n0$node number (type NodeIndex) for mass point"
#
# add dict interface for functions in a different way!
Fv, C, ComputeMassMatrix, , , void, , "Matrix& massMatrix", CDI, "Computational function: compute mass matrix"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return JacobianType::_None;", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetAccessFunctionTypes, , , AccessFunctionType,, , CDI, "Flags to determine, which access (forces, moments, connectors, ...) to object are possible"
Fv, C, GetAccessFunctionBody, , , void, , "AccessFunctionType accessType, const Vector3D& localPosition, Matrix& value", DC, "provide Jacobian at localPosition in 'value' according to object access"
Fv, C, GetOutputVariableBody, , , void, , "OutputVariableType variableType, const Vector3D& localPosition, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetPosition, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetDisplacement, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetVelocity, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of 'localPosition' according to configuration type"
Fv, C, GetLocalCenterOfMass, , 3, Vector3D, "return Vector3D({0.,0.,0.});", , CI, "return the local position of the center of mass, needed for equations of motion and for massProportionalLoad"
#
Fv, M, GetTypeName, , , const char*, "return 'MassPoint2D';" , , CI, "Get type name of object; could also be realized via a string -> type conversion?"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex == 0);\n return parameters.nodeNumber;", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 1;", , CI, "number of nodes; needed for every object"
#Fv, C, GetODE2LocalToGlobalCoordinates,, , Index, , , CDI, "local to global coordinates of body --> not needed"
Fv, C, GetODE2Size, , , Index, "return nODE2Coordinates;", , CI, "number of ODE2 coordinates; needed for object?"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::Position2D;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Body + (Index)CObjectType::SingleNoded);",, CI, "Get type of object, e.g. to categorize and distinguish during assembly and computation"
#Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific object function ==> automatically generated in future?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, graphicsData, , , BodyGraphicsData, , , IO, "Structure contains data for body visualization; data is defined in special list / dictionary structure"
#file names automatically determined from class name
writeFile = True
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectMass1D
classDescription = "A 1D (translational) mass which is attached to Node1D. Note, that the mass does not need to have the interpretation as a translational mass."
cParentClass = CObjectBody
mainParentClass = MainObjectBody
visuParentClass = VisualizationObject
pythonShortName = Mass1D
outputVariables = "{'Position':'$\LU{0}{\pv}\cConfig$global position vector; for interpretation see intermediate variables', 'Displacement':'$\LU{0}{\uv}\cConfig$global displacement vector; for interpretation see intermediate variables', 'Velocity':'$\LU{0}{\vv}\cConfig $global velocity vector; for interpretation see intermediate variables', 'RotationMatrix':'$\LU{0b}{\Rot}$vector with 9 components of the rotation matrix (row-major format)', 'Rotation':'vector with 3 components of the Euler angles in xyz-sequence (R=Rx*Ry*Rz), recomputed from rotation matrix $\LU{0b}{\Rot}$', 'AngularVelocity':'$\LU{0}{\tomega}\cConfig$angular velocity of body', 'AngularVelocityLocal':'$\LU{b}{\tomega}\cConfig$local (body-fixed) 3D velocity vector of node'}"
classType = Object
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
\vspace{6pt}\\
\startTable{intermediate variables}{symbol}{description}
\rowTable{position coordinate}{${p_0}\cConfig = {c_0}\cConfig + {c_0}\cRef$}{position coordinate of node (nodal coordinate $c_0$) in any configuration}
\rowTable{displacement coordinate}{${u_0}\cConfig = {c_0}\cConfig$}{displacement coordinate of mass node in any configuration}
\rowTable{velocity coordinate}{${u_0}\cConfig$}{velocity coordinate of mass node in any configuration}
\rowTable{Position}{$\LU{0}{\pv}\cConfig =\LU{0}{\pv_0} + \LU{0b}{\Rot_{0}} \LU{b}{\vr{p_0}{0}{0}}\cConfig$}{(translational) position of mass object in any configuration}
\rowTable{Displacement}{$\LU{0}{\uv}\cConfig = \LU{0b}{\Rot_{0}} \LU{b}{\vr{q_0}{0}{0}}\cConfig$}{(translational) displacement of mass object in any configuration}
\rowTable{Velocity}{$\LU{0}{\vv}\cConfig = \LU{0b}{\Rot_{0}} \LU{b}{\vr{\dot q_0}{0}{0}}\cConfig$}{(translational) velocity of mass object in any configuration}
%
\rowTable{residual force}{$f$}{residual of all forces on mass object}
\rowTable{applied force}{$\LU{0}{\fv}_a = [f_0,\;f_1,\;f_2]\tp$}{3D applied force (loads, connectors, joint reaction forces, ...)}
\rowTable{applied torque}{$\LU{0}{\ttau}_a = [\tau_0,\;\tau_1,\;\tau_2]\tp$}{3D applied torque (loads, connectors, joint reaction forces, ...)}
\finishTable
%
A rigid body marker (e.g., MarkerBodyRigid) may be attached to this object and forces/torques can be applied.
However, torques will have no effect and forces will only have effect in 'direction' of the coordinate.
{\bf Equations of motion}:
\be
m \cdot \ddot q_0 = f.
\ee
Note that $f$ is computed from all connectors and loads upon the object. E.g., a 3D force vector $\LU{0}{\fv}_a$ is
transformed to $f$ as
\be
f = \LU{b}{[1,\,0,\,0]} \LU{b0}{\Rot_{0}} \LU{0}{\fv}_a
\ee
Thus, the {\bf position jacobian} reads
\be
\Jm_{pos} = \partial \pv\cCur / \partial {q_0}\cCur =
\LU{b}{[1,\,0,\,0]} \LU{b0}{\Rot_{0}}
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
miniExample =
node = mbs.AddNode(Node1D(referenceCoordinates = [1],
initialCoordinates=[0.5],
initialVelocities=[0.5]))
mass = mbs.AddObject(Mass1D(nodeNumber = node, physicsMass=1))
#assemble and solve system for default parameters
mbs.Assemble()
SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', exu.SimulationSettings())
#check result, get current mass position at local position [0,0,0]
testError = mbs.GetObjectOutputBody(mass, exu.OutputVariableType.Position, [0,0,0])[0] - 2
#final x-coordinate of position shall be 2
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "objects's unique name"
V, CP, physicsMass, , , UReal, "0.", , I, "$m$mass [SI:kg] of mass"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "$n0$node number (type NodeIndex) for Node1D"
V, CP, referencePosition, , 3, Vector3D, "Vector3D({0.,0.,0.})", , IO, "$\LU{0}{\pv_0}$a reference position, used to transform the 1D coordinate to a position"
V, CP, referenceRotation, , , Matrix3D, "EXUmath::unitMatrix3D", , IO, "$\LU{0b}{\Rot_{0}} \in \Rcal^{3 \times 3}$the constant body rotation matrix, which transforms body-fixed (b) to global (0) coordinates"
#
# add dict interface for functions in a different way!
Fv, C, ComputeMassMatrix, , , void, , "Matrix& massMatrix", CDI, "Computational function: compute mass matrix"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return JacobianType::_None;", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetAccessFunctionTypes, , , AccessFunctionType,, , CDI, "Flags to determine, which access (forces, moments, connectors, ...) to object are possible"
Fv, C, GetAccessFunctionBody, , , void, , "AccessFunctionType accessType, const Vector3D& localPosition, Matrix& value", DC, "provide Jacobian at localPosition in 'value' according to object access"
Fv, C, GetOutputVariableBody, , , void, , "OutputVariableType variableType, const Vector3D& localPosition, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetPosition, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetDisplacement, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetVelocity, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of 'localPosition' according to configuration type"
Fv, C, GetRotationMatrix, , 9, Matrix3D, "return parameters.referenceRotation;", "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CI, "return configuration dependent rotation matrix of node; returns always a 3D Matrix, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocity, , 3, Vector3D, "return Vector3D({ 0.,0.,0. });", "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CI, "return configuration dependent angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocityLocal, , 3, Vector3D, "return Vector3D({ 0.,0.,0. });", "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetLocalCenterOfMass, , 3, Vector3D, "return Vector3D({0.,0.,0.});", , CI, "return the local position of the center of mass, needed for equations of motion and for massProportionalLoad"
#
Fv, M, GetTypeName, , , const char*, "return 'Mass1D';" , , CI, "Get type name of object; could also be realized via a string -> type conversion?"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex == 0);\n return parameters.nodeNumber;", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 1;", , CI, "number of nodes; needed for every object"
#Fv, C, GetODE2LocalToGlobalCoordinates,, , Index, , , CDI, "local to global coordinates of body --> not needed"
Fv, C, GetODE2Size, , , Index, "return 1;", , CI, "number of ODE2 coordinates; needed for object?"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::GenericODE2;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Body + (Index)CObjectType::SingleNoded);",, CI, "Get type of object, e.g. to categorize and distinguish during assembly and computation"
#Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific object function ==> automatically generated in future?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, graphicsData, , , BodyGraphicsData, , , IO, "Structure contains data for body visualization; data is defined in special list / dictionary structure"
#file names automatically determined from class name
writeFile = True
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectRotationalMass1D
classDescription = "A 1D rotational inertia (mass) which is attached to Node1D."
cParentClass = CObjectBody
mainParentClass = MainObjectBody
visuParentClass = VisualizationObject
pythonShortName = Rotor1D
outputVariables = "{'Position':'$\LU{0}{\pv}\cConfig$global position vector; for interpretation see intermediate variables', 'Displacement':'$\LU{0}{\uv}\cConfig$global displacement vector; for interpretation see intermediate variables', 'Velocity':'$\LU{0}{\vv}\cConfig $global velocity vector; for interpretation see intermediate variables', 'RotationMatrix':'$\LU{0b}{\Rot}$vector with 9 components of the rotation matrix (row-major format)', 'Rotation':'vector with 3 components of the Euler angles in xyz-sequence (R=Rx*Ry*Rz), recomputed from rotation matrix $\LU{0b}{\Rot}$', 'AngularVelocity':'$\LU{0}{\tomega}\cConfig$angular velocity of body', 'AngularVelocityLocal':'$\LU{b}{\tomega}\cConfig$local (body-fixed) 3D velocity vector of node'}"
classType = Object
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
\vspace{6pt}\\
\startTable{intermediate variables}{symbol}{description}
\rowTable{position coordinate}{${\theta_0}\cConfig = {c_0}\cConfig + {c_0}\cRef $}{total rotation coordinate of node (e.g., Node1D) in any configuration (nodal coordinate $c_0$)}
\rowTable{displacement coordinate}{${\psi_0}\cConfig = {c_0}\cConfig$}{change of rotation coordinate of mass node (e.g., Node1D) in any configuration (nodal coordinate $c_0$)}
\rowTable{velocity coordinate}{${\dot \psi_{0\cConfig}}$}{rotation velocity coordinate of mass node (e.g., Node1D) in any configuration}
\rowTable{Position}{$\LU{0}{\pv}\cConfig =\LU{0}{\pv_0}$}{constant (translational) position of mass object in any configuration}
\rowTable{Displacement}{$\LU{0}{\uv}\cConfig = [0,0,0]\tp$}{(translational) displacement of mass object in any configuration}
\rowTable{Velocity}{$\LU{0}{\vv}\cConfig = [0,0,0]\tp$}{(translational) velocity of mass object in any configuration}
\rowTable{AngularVelocity}{$\LU{0}{\tomega}\cConfig = \LU{0i}{\Rot_{0}} \LU{i}{\vr{0}{0}{\dot \psi_0}}\tp$}{}
\rowTable{AngularVelocityLocal}{$\LU{b}{\tomega}\cConfig = \LU{i}{\vr{0}{0}{\dot \psi_0}}\tp$}{}
\rowTable{RotationMatrix}{$\LU{0b}{\Rot} = \LU{0i}{\Rot_{0}} \LU{ib}{\mr{\cos(\theta_0)}{-\sin(\theta_0)}{0} {\sin(\theta_0)}{\cos(\theta_0)}{0} {0}{0}{1}}$}{transformation of local body ($b$) coordinates to global (0) coordinates}
%
\rowTable{residual force}{$\tau$}{residual of all forces on mass object}
\rowTable{applied force}{$\LU{0}{\fv}_a = [f_0,\;f_1,\;f_2]\tp$}{3D applied force (loads, connectors, joint reaction forces, ...)}
\rowTable{applied torque}{$\LU{0}{\ttau}_a = [\tau_0,\;\tau_1,\;\tau_2]\tp$}{3D applied torque (loads, connectors, joint reaction forces, ...)}
\finishTable
%
A rigid body marker (e.g., MarkerBodyRigid) may be attached to this object and forces/torques can be applied.
However, forces will have no effect and torques will only have effect in 'direction' of the coordinate.
{\bf Equations of motion}:
\be
J \cdot \ddot \psi_0 = \tau.
\ee
Note that $\tau$ is computed from all connectors and loads upon the object. E.g., a 3D torque vector $\LU{0}{\ttau}_a$ is
transformed to $\tau$ as
\be
\tau = \LU{b}{[0,\,0,\,1]}\LU{b0}{\Rot_{0}} \LU{0}{\ttau}_a
\ee
Thus, the {\bf rotation jacobian} reads
\be
\Jm_{rot} = \partial \tomega\cCur / \partial \dot q_{0,cur} =
\LU{b}{[0,\,0,\,1]} \LU{b0}{\Rot_{0}}
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
miniExample =
node = mbs.AddNode(Node1D(referenceCoordinates = [1], #\psi_0ref
initialCoordinates=[0.5], #\psi_0ini
initialVelocities=[0.5])) #\psi_t0ini
rotor = mbs.AddObject(Rotor1D(nodeNumber = node, physicsInertia=1))
#assemble and solve system for default parameters
mbs.Assemble()
SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', exu.SimulationSettings())
#check result
#check result, get current rotor z-rotation at local position [0,0,0]
testError = mbs.GetObjectOutputBody(rotor, exu.OutputVariableType.Rotation, [0,0,0]) - 2
#final z-angle of rotor shall be 2
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "objects's unique name"
V, CP, physicsInertia, , , UReal, "0.", , I, "$J$inertia components [SI:kgm$^2$] of rotor / rotational mass"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "$n0$node number (type NodeIndex) of Node1D, providing rotation coordinate $\psi_0 = c_0$"
V, CP, referencePosition, , 3, Vector3D, "Vector3D({0.,0.,0.})", , IO, "$\LU{0}{\pv_0}$a constant reference position, used to assign joint constraints accordingly and for drawing"
V, CP, referenceRotation, , , Matrix3D, "EXUmath::unitMatrix3D", , IO, "$\LU{0i}{\Rot_{0}} \in \Rcal^{3 \times 3}$an intermediate rotation matrix, which transforms the 1D coordinate into 3D, see description"
#
# add dict interface for functions in a different way!
Fv, C, ComputeMassMatrix, , , void, , "Matrix& massMatrix", CDI, "Computational function: compute mass matrix"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return JacobianType::_None;", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetAccessFunctionTypes, , , AccessFunctionType,, , CDI, "Flags to determine, which access (forces, moments, connectors, ...) to object are possible"
Fv, C, GetAccessFunctionBody, , , void, , "AccessFunctionType accessType, const Vector3D& localPosition, Matrix& value", DC, "provide Jacobian at localPosition in 'value' according to object access"
Fv, C, GetOutputVariableBody, , , void, , "OutputVariableType variableType, const Vector3D& localPosition, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'"
F, C, GetRotationAngle, , , Real, , "ConfigurationType configuration = ConfigurationType::Current", DIC, "return the rotation angle (reference+current) according to configuration type"
Fv, C, GetPosition, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetDisplacement, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetVelocity, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of 'localPosition' according to configuration type"
Fv, C, GetRotationMatrix, , 9, Matrix3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Matrix, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocity, , 3, Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocityLocal, , 3, Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetLocalCenterOfMass, , 3, Vector3D, "return Vector3D({0.,0.,0.});", , CI, "return the local position of the center of mass, needed for equations of motion and for massProportionalLoad"
#
Fv, M, GetTypeName, , , const char*, "return 'RotationalMass1D';" , , CI, "Get type name of object; could also be realized via a string -> type conversion?"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex == 0);\n return parameters.nodeNumber;", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 1;", , CI, "number of nodes; needed for every object"
#Fv, C, GetODE2LocalToGlobalCoordinates,, , Index, , , CDI, "local to global coordinates of body --> not needed"
Fv, C, GetODE2Size, , , Index, "return 1;", , CI, "number of ODE2 coordinates; needed for object?"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::GenericODE2;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Body + (Index)CObjectType::SingleNoded);",, CI, "Get type of object, e.g. to categorize and distinguish during assembly and computation"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, graphicsData, , , BodyGraphicsData, , , IO, "Structure contains data for body visualization; data is defined in special list / dictionary structure"
#file names automatically determined from class name
writeFile = True
class = ObjectRigidBody
classDescription = "A 3D rigid body which is attached to a 3D rigid body node. Equations of motion with the displacements $[u_x\;\; u_y\;\; u_z]^T$ of the center of mass and the rotation parameters (Euler parameters) $\mathbf{q}$, the mass $m$, inertia $\mathbf{J} = [J_{xx}, J_{xy}, J_{xz}; J_{yx}, J_{yy}, J_{yz}; J_{zx}, J_{zy}, J_{zz}]$ and the residual of all forces and moments $[R_x\;\; R_y\;\; R_z\;\; R_{q0}\;\; R_{q1}\;\; R_{q2}\;\; R_{q3}]^T$ are given as ...; REMARK: Use the class RigidBodyInertia and AddRigidBody(...) of exudynRigidBodyUtilities.py to handle inertia, COM and mass."
cParentClass = CObjectBody
mainParentClass = MainObjectBody
visuParentClass = VisualizationObject
pythonShortName = RigidBody
#addProtectedC = " static constexpr Index nODE2Coordinates = 7;\n static constexpr Index nAECoordinates = 1;\n static constexpr Index nRotationCoordinates = 4;\n"
addProtectedC = " static constexpr Index nDim3D = 3; //used to avoid pure 3 in code where dimensionality applies\n static constexpr Index nDisplacementCoordinates = 3; //code currently implemented for 3 displacemnet coordinates; this constant used to change this in future implementation\n"
outputVariables = "{'Position':'global position vector of rotated and translated local position', 'Displacement':'global displacement vector of local position', 'RotationMatrix':'vector with 9 components of the rotation matrix (row-major format)', 'Rotation':'vector with 3 components of the Euler angles in xyz-sequence (R=Rx*Ry*Rz), recomputed from rotation matrix', 'Velocity':'global velocity vector of local position', 'AngularVelocity':'angular velocity of body', 'AngularVelocityLocal':'local (body-fixed) 3D velocity vector of node'}"
#outputVariables = "{'Position':'$\pv\cConfig(\LU{b}{\pv}) = \uv\cConfig + \pv\cRef + \LU{b}{\pv}$global position vector of translated local position; local (body) coordinate system = global coordinate system', 'Displacement':'$\LU{0}{\uv}\cConfig = [q_0,\;q_1,\;0]\cConfig\tp$global displacement vector of mass point', 'Velocity':'$\LU{0}{\vv}\cConfig = \LU{0}{\dot\uv}\cConfig = [\dot q_0,\;\dot q_1,\;0]\cConfig\tp$global velocity vector of mass point'}"
classType = Object
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "objects's unique name"
V, CP, physicsMass, , , UReal, "0.", , I, "$m$mass [SI:kg] of rigid body"
V, CP, physicsInertia, , , Vector6D, "Vector6D({0.,0.,0., 0.,0.,0.})", , I, "$J$inertia components [SI:kgm$^2$]: $[J_{xx}, J_{yy}, J_{zz}, J_{yz}, J_{xz}, J_{xy}]$ of rigid body w.r.t. to the reference point of the body, NOT w.r.t. to center of mass; use the class RigidBodyInertia and AddRigidBody(...) of exudynRigidBodyUtilities.py to handle inertia, COM and mass"
V, CP, physicsCenterOfMass, , 3, Vector3D, "Vector3D({0.,0.,0.})", , IO, "$\LU{b}{\pv}_{COM}$local position of center of mass (COM); if the vector of the COM is [0,0,0], the computation will not consider additional terms for the COM and it is faster"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "$n0$node number (type NodeIndex) for rigid body node"
#
# add dict interface for functions in a different way!
Fv, C, ComputeMassMatrix, , , void, , "Matrix& massMatrix", CDI, "Computational function: compute mass matrix"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, bool useIndex2 = false", CDI, "Compute algebraic equations part of rigid body"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE", CDI, "Compute jacobians of algebraic equations part of rigid body w.r.t. ODE2"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::AE_ODE2 + JacobianType::AE_ODE2_function);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
#Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return JacobianType::_None;", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetAccessFunctionTypes, , , AccessFunctionType,, , CDI, "Flags to determine, which access (forces, moments, connectors, ...) to object are possible"
Fv, C, GetAccessFunctionBody, , , void, , "AccessFunctionType accessType, const Vector3D& localPosition, Matrix& value", DC, "provide Jacobian at localPosition in 'value' according to object access"
Fv, C, GetOutputVariableBody, , , void, , "OutputVariableType variableType, const Vector3D& localPosition, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetPosition, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetDisplacement, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetVelocity, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of 'localPosition' according to configuration type"
Fv, C, GetRotationMatrix, , 9, Matrix3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Matrix, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocity, , 3, Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocityLocal, , 3, Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetLocalCenterOfMass, , 3, Vector3D, "return parameters.physicsCenterOfMass;", , CI, "return the local position of the center of mass, needed for equations of motion and for massProportionalLoad"
#
Fv, M, GetTypeName, , , const char*, "return 'RigidBody';" , , CI, "Get type name of object; could also be realized via a string -> type conversion?"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex == 0);\n return parameters.nodeNumber;", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 1;", , CI, "number of nodes; needed for every object"
#Fv, C, GetODE2LocalToGlobalCoordinates,, , Index, , , CDI, "local to global coordinates of body --> not needed"
Fv, C, GetODE2Size, , , Index, , , CDI, "number of ODE2 coordinates; depends on node"
Fv, C, GetAlgebraicEquationsSize, , , Index, , , CDI, "number of AE coordinates; depends on node"
Fv, M, GetRequestedNodeType, , , Node::Type, "return (Node::Type)(Node::Position + Node::Orientation + Node::RigidBody);", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Body + (Index)CObjectType::SingleNoded);",, CI, "Get type of object, e.g. to categorize and distinguish during assembly and computation"
#Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific object function ==> automatically generated in future?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, CallUserFunction, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, const MainSystem& mainSystem, Index itemNumber", DI, "user function which is called to update specific object graphics computed in python functions; this is rather slow, but useful for user elements"
Fv, V, HasUserFunction, , , bool, "return graphicsDataUserFunction!=0;", "", I, "return true, if object has a user function to be called during redraw"
V, V, graphicsDataUserFunction, , , PyFunctionGraphicsData, 0, , IO, "A python function which returns a bodyGraphicsData object, which is a list of graphics data in a dictionary computed by the user function; the graphics elements need to be defined in the local body coordinates and are transformed by mbs to global coordinates"
V, V, graphicsData, , , BodyGraphicsData, , , IO, "Structure contains data for body visualization; data is defined in special list / dictionary structure"
#file names automatically determined from class name
writeFile = True
class = ObjectRigidBody2D
classDescription = "A 2D rigid body which is attached to a rigid body 2D node. The body obtains coordinates, position, velocity, etc. from the underlying 2D node"
cParentClass = CObjectBody
mainParentClass = MainObjectBody
visuParentClass = VisualizationObject
pythonShortName = RigidBody2D
addProtectedC = " static constexpr Index nODE2Coordinates = 3;\n"
#outputVariables = "{'Position':'global position vector of rotated and translated local position', 'Displacement':'global displacement vector of local position', 'Velocity':'global velocity vector of local position', 'Rotation':'scalar rotation angle of body', 'AngularVelocity':'angular velocity of body', 'RotationMatrix':'rotation matrix in vector form (stored in row-major order)'}"
outputVariables = "{'Position':'$\LU{0}{\pv}\cConfig(\LU{b}{\pv}) = \LU{0}{\uv}\cConfig + \LU{0}{\pv}\cRef + \LU{0b}{\Rot}\LU{b}{\pv}$global position vector of body-fixed point given by local position vector', 'Displacement':'$\LU{0}{\uv}\cConfig + \LU{0b}{\Rot}\LU{b}{\pv}$global displacement vector of body-fixed point given by local position vector', 'Velocity':'$\LU{0}{\vv}\cConfig = \LU{0}{\dot\uv}\cConfig + \LU{0b}{\Rot}(\LU{b}{\tomega} \times \LU{b}{\pv}\cConfig)$global velocity vector of body-fixed point given by local position vector', 'Rotation':'$\theta_{0\mathrm{config}}$scalar rotation angle of body', 'AngularVelocity':'$\omega_{0\mathrm{config}}$angular velocity of body', 'RotationMatrix':'$\mathrm{vec}(\LU{0b}{\Rot})=[A_{00},\,A_{01},\,A_{02},\,A_{10},\,\ldots,\,A_{21},\,A_{22}]\cConfig\tp$rotation matrix in vector form (stored in row-major order)'}"
classType = Object
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
\vspace{6pt}\\
\startTable{intermediate variables}{symbol}{description}
\rowTable{COM position}{$\LU{0}{\pv}\cConfig = \LU{0}{\pv}(n_0)\cConfig$}{position of center of mass (COM) which is provided by node $n_0$ in any configuration}
\rowTable{COM displacement}{$\LU{0}{\uv}\cConfig = [q_0,\;q_1,\;0]\cConfig\tp = \LU{0}{\uv}(n_0)\cConfig$}{displacement of center of mass which is provided by node $n_0$ in any configuration}
\rowTable{COM velocity}{$\LU{0}{\vv}\cConfig = [\dot q_0,\;\dot q_1,\;0]\cConfig\tp = \LU{0}{\vv}(n_0)\cConfig$}{velocity of center of mass which is provided by node $n_0$ in any configuration}
\rowTable{body rotation}{$\LU{0}{\theta}_{0\mathrm{config}} = \theta_0(n_0)\cConfig = \psi_0(n_0)\cRef + \psi_0(n_0)\cConfig$}{rotation of body as provided by node $n_0$ in any configuration}
\rowTable{body rotation matrix}{$\LU{0b}{\Rot}\cConfig = \LU{0b}{\Rot}(n_0)\cConfig$}{rotation matrix which transforms local to global coordinates as given by node}
\rowTable{local position}{$\LU{b}{\pv} = [\LU{b}{p_0},\,\LU{b}{p_1},\,0]\tp$}{local position as used by markers or sensors}
\rowTable{body angular velocity}{$\LU{0}{\tomega}\cConfig = \LU{0}{[\omega_0(n_0),\,0,\,0]}\cConfig\tp$}{rotation of body as provided by node $n_0$ in any configuration}
\rowTable{(generalized) coordinates}{$\cv\cConfig = [q_0,q_1,\;\psi_0]\tp$}{generalized coordinates of body (= coordinates of node)}
\rowTable{generalized forces}{$\LU{0}{\fv} = [f_0,\;f_1,\;\tau_2]\tp$}{generalized forces applied to body}
\rowTable{applied forces}{$\LU{0}{\fv}_a = [f_0,\;f_1,\;0]\tp$}{applied forces (loads, connectors, joint reaction forces, ...)}
\rowTable{applied torques}{$\LU{0}{\ttau}_a = [0,\;0,\;\tau_2]\tp$}{applied torques (loads, connectors, joint reaction forces, ...)}
\finishTable
%
{\bf Equations of motion}:
\be
\mr{m}{0}{0} {0}{m}{0} {0}{0}{J} \vr{\ddot q_0}{\ddot q_1}{\ddot \psi_0} = \vr{f_0}{f_1}{\tau_2} = \fv.
\ee
For example, a LoadCoordinate on coordinate 2 of the node would add a torque $\tau_2$ on the RHS.
Position-based markers can measure position $\pv\cConfig$ depending on the local position $\LU{b}{\pv}$.
The {\bf position jacobian} depends on the local position $\LU{b}{\pv}$ and is defined as,
\be
\Jm_{pos} = \partial \pv\cCur / \partial \cv\cCur = \mr{1}{0}{-\sin(\theta)\LU{b}{p_0} - \cos(\theta)\LU{b}{p_1}}
{0}{1}{\cos(\theta)\LU{b}{p_0}-\sin(\theta)\LU{b}{p_1}} {0}{0}{0}
\ee
which transforms the action of global forces $\LU{0}{\fv}$ of position-based markers on the coordinates $\cv$,
\be
\Qm = \Jm_{pos} \LU{0}{\fv}_a
\ee
The {\bf rotation jacobian}
\be
\Jm_{rot} = \partial \pv\cCur / \partial \cv\cCur = \mr{0}{0}{0} {0}{0}{0} {0}{0}{1}
\ee
transforms the action of global torques $\LU{0}{\ttau}$ of orientation-based markers on the coordinates $\cv$,
\be
\Qm = \Jm_{rot} \LU{0}{\ttau}_a
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
miniExample =
node = mbs.AddNode(NodeRigidBody2D(referenceCoordinates = [1,1,0.25*np.pi],
initialCoordinates=[0.5,0,0],
initialVelocities=[0.5,0,0.75*np.pi]))
mbs.AddObject(RigidBody2D(nodeNumber = node, physicsMass=1, physicsInertia=2))
#assemble and solve system for default parameters
mbs.Assemble()
SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', exu.SimulationSettings())
#check result
testError = mbs.GetNodeOutput(node, exu.OutputVariableType.Position)[0] - 2
testError+= mbs.GetNodeOutput(node, exu.OutputVariableType.Coordinates)[2] - 0.75*np.pi
#final x-coordinate of position shall be 2, angle theta shall be np.pi
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "objects's unique name"
V, CP, physicsMass, , , UReal, "0.", , I, "$m$mass [SI:kg] of rigid body"
V, CP, physicsInertia, , , UReal, "0.", , I, "$J$inertia [SI:kgm$^2$] of rigid body w.r.t. center of mass"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "$n_0$node number (type NodeIndex) for 2D rigid body node"
#
# add dict interface for functions in a different way!
Fv, C, ComputeMassMatrix, , , void, , "Matrix& massMatrix", CDI, "Computational function: compute mass matrix"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return JacobianType::_None;", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetAccessFunctionTypes, , , AccessFunctionType,, , CDI, "Flags to determine, which access (forces, moments, connectors, ...) to object are possible"
Fv, C, GetAccessFunctionBody, , , void, , "AccessFunctionType accessType, const Vector3D& localPosition, Matrix& value", DC, "provide Jacobian at localPosition in 'value' according to object access"
Fv, C, GetOutputVariableBody, , , void, , "OutputVariableType variableType, const Vector3D& localPosition, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetPosition, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetDisplacement, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetVelocity, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of 'localPosition' according to configuration type"
Fv, C, GetRotationMatrix, , 9, Matrix3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Matrix, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocity, , 3, Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocityLocal, , 3, Vector3D, "return GetAngularVelocity(localPosition, configuration);","const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CI, "return configuration dependent local (=body-fixed) angular velocity of node, which is the same as the global angular velocity vector in 2D; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetLocalCenterOfMass, , 3, Vector3D, "return Vector3D({0.,0.,0.});", , CI, "return the local position of the center of mass, needed for equations of motion and for massProportionalLoad"
#
Fv, M, GetTypeName, , , const char*, "return 'RigidBody2D';" , , CI, "Get type name of object; could also be realized via a string -> type conversion?"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex == 0);\n return parameters.nodeNumber;", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 1;", , CI, "number of nodes; needed for every object"
#Fv, C, GetODE2LocalToGlobalCoordinates,, , Index, , , CDI, "local to global coordinates of body --> not needed"
Fv, C, GetODE2Size, , , Index, "return nODE2Coordinates;", , CI, "number of ODE2 coordinates; needed for object?"
Fv, M, GetRequestedNodeType, , , Node::Type, "return (Node::Type)(Node::Position2D + Node::Orientation2D);", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Body + (Index)CObjectType::SingleNoded);",, CI, "Get type of object, e.g. to categorize and distinguish during assembly and computation"
#Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific object function ==> automatically generated in future?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, CallUserFunction, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, const MainSystem& mainSystem, Index itemNumber", DI, "user function which is called to update specific object graphics computed in python functions; this is rather slow, but useful for user elements"
Fv, V, HasUserFunction, , , bool, "return graphicsDataUserFunction!=0;", "", I, "return true, if object has a user function to be called during redraw"
V, V, graphicsDataUserFunction, , , PyFunctionGraphicsData, 0, , IO, "A python function which returns a bodyGraphicsData object, which is a list of graphics data in a dictionary computed by the user function; the graphics elements need to be defined in the local body coordinates and are transformed by mbs to global coordinates"
V, V, graphicsData, , , BodyGraphicsData, , , IO, "Structure contains data for body visualization; data is defined in special list / dictionary structure"
#file names automatically determined from class name
writeFile = True
class = ObjectGenericODE2
classDescription = "A system of $n$ second order ordinary differential equations (ODE2), having a mass matrix, damping/gyroscopic matrix, stiffness matrix and generalized forces. It can combine generic nodes, or node points. User functions can be used to compute mass matrix and generalized forces depending on given coordinates. NOTE that all matrices, vectors, etc. must have the same dimensions $n$ or $(n \times n)$, or they must be empty $(0 \times 0)$, except for the mass matrix which always needs to have dimensions $(n \times n)$."
cParentClass = CObjectSuperElement
mainParentClass = MainObjectBody
visuParentClass = VisualizationObjectSuperElement
addIncludesC = '#include <pybind11/numpy.h>//for NumpyMatrix\n#include <pybind11/stl.h>//for NumpyMatrix\n#include <pybind11/pybind11.h>\ntypedef py::array_t<Real> NumpyMatrix; \n'
outputVariables = "{'Coordinates':'all ODE2 coordinates', 'Coordinates_t':'all ODE2 velocity coordinates', 'Force':'generalized forces for all coordinates (residual of all forces except mass*accleration; corresponds to ComputeODE2RHS)'}"
classType = Object
equations =
An object with node numbers $[n_0,\,\ldots,\,n_n]$ and according numbers of nodal coordinates $[n_{c_0},\,\ldots,\,n_{c_n}]$, the total number of equations (=coordinates) of the object is
\be
n = \sum_{i} n_{c_i}.
\ee
{\bf Equations of motion}:
\be \label{eq_ObjectGenericODE2_EOM}
\Mm \ddot \qv + \Dm \dot \qv + \Km \qv = \fv + \fv_{user}(t,\qv,\dot \qv)
\ee
Note that the user function $\fv_{user}(t,\qv,\dot \qv)$ may be empty (=0).
In case that a user mass matrix is specified, \eq{eq_ObjectGenericODE2_EOM} is replaced with
\be
\Mm_{user}(t,\qv,\dot \qv) \ddot \qv + \Dm \dot \qv + \Km \qv = \fv + \fv_{user}(t,\qv,\dot \qv)
\ee
CoordinateLoads are integrated for each ODE2 coordinate on the RHS of the latter equation.
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
miniExample =
#set up a mechanical system with two nodes; it has the structure: |~~M0~~M1
nMass0 = mbs.AddNode(NodePoint(referenceCoordinates=[0,0,0]))
nMass1 = mbs.AddNode(NodePoint(referenceCoordinates=[1,0,0]))
mass = 0.5 * np.eye(3) #mass of nodes
stif = 5000 * np.eye(3) #stiffness of nodes
damp = 50 * np.eye(3) #damping of nodes
Z = 0. * np.eye(3) #matrix with zeros
#build mass, stiffness and damping matrices (:
M = np.block([[mass, 0.*np.eye(3)],
[0.*np.eye(3), mass ] ])
K = np.block([[2*stif, -stif],
[ -stif, stif] ])
D = np.block([[2*damp, -damp],
[ -damp, damp] ])
oGenericODE2 = mbs.AddObject(ObjectGenericODE2(nodeNumbers=[nMass0,nMass1],
massMatrix=M,
stiffnessMatrix=K,
dampingMatrix=D))
mNode1 = mbs.AddMarker(MarkerNodePosition(nodeNumber=nMass1))
mbs.AddLoad(Force(markerNumber = mNode1, loadVector = [10, 0, 0])) #static solution=10*(1/5000+1/5000)=0.0004
#assemble and solve system for default parameters
mbs.Assemble()
sims=exu.SimulationSettings()
sims.timeIntegration.generalizedAlpha.spectralRadius=1
SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', sims)
#check result at default integration time
testError = mbs.GetNodeOutput(nMass1, exu.OutputVariableType.Position)[0] - (1.0039999999354785)
/end
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "objects's unique name"
V, CP, nodeNumbers, , , ArrayIndex, "ArrayIndex()", , I, "$\mathbf{n}_n = [n_0,\,\ldots,\,n_n]\tp$node numbers which provide the coordinates for the object (consecutively as provided in this list)"
V, CP, massMatrix, , , NumpyMatrix,"Matrix()", , I, "$\Mm \in \Rcal^{n \times n}$mass matrix of object in python numpy format"
V, CP, stiffnessMatrix, , , NumpyMatrix,"Matrix()", , I, "$\Km \in \Rcal^{n \times n}$stiffness matrix of object in python numpy format"
V, CP, dampingMatrix, , , NumpyMatrix,"Matrix()", , I, "$\Dm \in \Rcal^{n \times n}$damping matrix of object in python numpy format"
V, CP, forceVector, , , NumpyVector,"Vector()", , I, "$\fv \in \Rcal^{n}$generalized force vector added to RHS"
V, CP, forceUserFunction, , , PyFunctionVectorScalar2Vector, 0, , IO, "$\fv_{user} \in \Rcal^{n}$A python user function which computes the generalized user force vector for the ODE2 equations; The function takes the time, coordinates q (without reference values) and coordinate velocities q\_t; Example for python function with numpy stiffness matrix K: def f(t, q, q\_t): return np.dot(K, q)"
V, CP, massMatrixUserFunction, , , PyFunctionMatrixScalar2Vector, 0, , IO, "$\Mm_{user} \in \Rcal^{n\times n}$A python user function which computes the mass matrix instead of the constant mass matrix; The function takes the time, coordinates q (without reference values) and coordinate velocities q\_t; Example (academic) for python function with numpy stiffness matrix M: def f(t, q, q\_t): return (q[0]+1)*M"
V, CP, coordinateIndexPerNode, , , ArrayIndex, "ArrayIndex()", , IR, "this list contains the local coordinate index for every node, which is needed, e.g., for markers; the list is generated automatically every time parameters have been changed"
#
Fv, C, ComputeMassMatrix, , , void, , "Matrix& massMatrix", CDI, "Computational function: compute mass matrix"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return JacobianType::_None;", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetAccessFunctionTypes, , , AccessFunctionType,, , CDI, "Flags to determine, which access (forces, moments, connectors, ...) to object are possible"
Fv, C, GetAccessFunctionBody, , , void, , "AccessFunctionType accessType, const Vector3D& localPosition, Matrix& value", DC, "provide Jacobian at localPosition in 'value' according to object access"
Fv, C, GetOutputVariableBody, , , void, , "OutputVariableType variableType, const Vector3D& localPosition, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetPosition, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetDisplacement, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetVelocity, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of 'localPosition' according to configuration type"
Fv, C, GetLocalCenterOfMass, , 3, Vector3D, "return Vector3D({0.,0.,0.});", , CI, "return the local position of the center of mass, used for massProportionalLoad, which may NOT be appropriate for GenericODE2"
#
Fv, M, GetTypeName, , , const char*, "return 'GenericODE2';" , , CI, "Get type name of object; could also be realized via a string -> type conversion?"
Fv, C, GetNodeNumber, , , Index, "return parameters.nodeNumbers[localIndex];", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return parameters.nodeNumbers.NumberOfItems();", , CI, "number of nodes; needed for every object"
Fv, C, GetODE2Size, , , Index, , , CDI, "number of ODE2 coordinates; needed for object?"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::_None;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
#not implemented in NodePoint, etc. Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::GenericODE2;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Body + (Index)CObjectType::MultiNoded + (Index)CObjectType::SuperElement);",, CI, "Get type of object, e.g. to categorize and distinguish during assembly and computation"
Fv, C, ParametersHaveChanged, , , void, "InitializeCoordinateIndices();", , I, "This flag is reset upon change of parameters; says that the vector of coordinate indices has changed"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
Fv, C, GetLocalODE2CoordinateIndexPerNode, , , Index, "return parameters.coordinateIndexPerNode[localNode];", "Index localNode", CI, "read access to coordinate index array"
#helper functions:
F, C, ComputeObjectCoordinates, , , void, , "Vector& coordinates, Vector& coordinates_t, ConfigurationType configuration = ConfigurationType::Current", CDI, "compute object coordinates composed from all nodal coordinates; does not include reference coordinates"
F, C, InitializeCoordinateIndices, , , void, , , DI, "initialize coordinateIndexPerNode array"
#superelement functions:
Fv, C, HasReferenceFrame, , , bool, "localReferenceFrameNode = 0; return false;", "Index& localReferenceFrameNode", CI, "return true, if object has reference frame; return according LOCAL node number"
Fv, C, GetNumberOfMeshNodes, , , Index, "return GetNumberOfNodes();", , IC, "return the number of mesh nodes, which is 1 less than the number of nodes if referenceFrame is used"
Fv, C, GetMeshNodeLocalPosition, , , Vector3D, , "Index meshNodeNumber, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (local) position of a mesh node according to configuration type; use Configuration.Reference to access the mesh reference position; meshNodeNumber is the local node number of the (underlying) mesh"
Fv, C, GetMeshNodeLocalVelocity, , , Vector3D, , "Index meshNodeNumber, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (local) velocity of a mesh node according to configuration type; meshNodeNumber is the local node number of the (underlying) mesh"
Fv, C, GetMeshNodePosition, , , Vector3D, , "Index meshNodeNumber, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of a mesh node according to configuration type; this is the node position transformed by the motion of the reference frame; meshNodeNumber is the local node number of the (underlying) mesh"
Fv, C, GetMeshNodeVelocity, , , Vector3D, , "Index meshNodeNumber, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of a mesh node according to configuration type; this is the node position transformed by the motion of the reference frame; meshNodeNumber is the local node number of the (underlying) mesh"
Fv, C, GetAccessFunctionSuperElement, , , void, , "AccessFunctionType accessType, const Matrix& weightingMatrix, const ArrayIndex& meshNodeNumbers, Matrix& value", DC, "compute Jacobian with weightingMatrix (WM) and/or meshNodeNumbers, which define how the SuperElement mesh nodes or coordinates are transformed to a global position; for details see CObjectSuperElement header file"
Fv, C, GetOutputVariableTypesSuperElement, , , OutputVariableType, , "Index meshNodeNumber", DC, "get extended output variable types for multi-nodal objects with mesh nodes; some objects have meshNode-dependent OutputVariableTypes"
Fv, C, GetOutputVariableSuperElement, , , void, , "OutputVariableType variableType, Index meshNodeNumber, ConfigurationType configuration, Vector& value", DC, "get extended output variables for multi-nodal objects with mesh nodes"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, color, , 4, Float4, "Float4({-1.f,-1.f,-1.f,-1.f})", , IO, "RGBA color for object; 4th value is alpha-transparency; R=-1.f means, that default color is used"
V, V, triangleMesh, , , NumpyMatrixI,"MatrixI()", , IO, "a matrix, containg node number triples in every row, referring to the node numbers of the GenericODE2 object; the mesh uses the nodes to visualize the underlying object; contour plot colors are still computed in the local frame!"
V, V, showNodes, , , bool, "false", , IO, "set true, nodes are drawn uniquely via the mesh, eventually using the floating reference frame, even in the visualization of the node is show=False; node numbers are shown with indicator 'NF'"
Fv, V, CallUserFunction, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, const MainSystem& mainSystem, Index itemNumber", DI, "user function which is called to update specific object graphics computed in python functions; this is rather slow, but useful for user elements"
Fv, V, HasUserFunction, , , bool, "return graphicsDataUserFunction!=0;", "", I, "return true, if object has a user function to be called during redraw"
V, V, graphicsDataUserFunction, , , PyFunctionGraphicsData, 0, , IO, "A python function which returns a bodyGraphicsData object, which is a list of graphics data in a dictionary computed by the user function; the graphics data is draw in global coordinates; it can be used to implement user element visualization, e.g., beam elements or simple mechanical systems; note that this user function may significantly slow down visualization"
#
#done in VisualizationObjectSuperElement:
#Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#Fv, V, GetSuperElementShowNodes, , , bool, "return showNodes;", , CI, "showNodes interface for general drawing function of super element"
#Fv, V, GetSuperElementTriangleMesh, , , "const MatrixI&", "return triangleMesh;", , CI, "mesh interface for general drawing function of super element"
#Fv, V, GetSuperElementColor, , , Float4, ";", , CI, "color interface for general drawing function of super element"
#could be used to visualize nodes: V, V, graphicsData, , , BodyGraphicsData, , , IO, "Structure contains data for body visualization; data is defined in special list / dictionary structure"
#file names automatically determined from class name
writeFile = True
class = ObjectFFRF
classDescription = "This object is used to represent equations modelled by the floating frame of reference formulation (FFRF). It contains a RigidBodyNode (always node 0) and a list of other nodes representing the finite element nodes used in the FFRF. Note that temporary matrices and vectors are subject of change in future."
cParentClass = CObjectSuperElement
mainParentClass = MainObjectBody
visuParentClass = VisualizationObjectSuperElement
addIncludesC = '#include <pybind11/numpy.h>//for NumpyMatrix\n#include <pybind11/stl.h>//for NumpyMatrix\n#include <pybind11/pybind11.h>\ntypedef py::array_t<Real> NumpyMatrix; \n#include "Pymodules/PyMatrixContainer.h"//for some FFRF matrices\n'
addPublicC = " static constexpr Index ffrfNodeDim = 3; //dimension of nodes (=displacement coordinates per node)\n static constexpr Index rigidBodyNodeNumber = 0; //number of rigid body node (usually = 0)\n"
outputVariables = "{'Coordinates':'all ODE2 coordinates', 'Coordinates_t':'all ODE2 velocity coordinates', 'Force':'generalized forces for all coordinates (residual of all forces except mass*accleration; corresponds to ComputeODE2RHS)'}"
classType = Object
equations =
\vspace{6pt}\\
\startTable{intermediate variables}{symbol}{description}
\rowTable{object coordinates}{$\cv = [\cv_r,\,\qv_f]\tp$}{object coordinates}
\rowTable{rigid body coordinates}{$\cv_r = [q_0,\,q_1,\,q_2,\,\psi_0,\,\psi_1,\,\psi_2,\,\psi_3]\tp$}{rigid body coordinates in case of Euler parameters}
\rowTable{rotation coordinates}{$\ttheta\cCur = [\psi_0,\,\psi_1,\,\psi_2,\,\psi_3]\tp\cRef + [\psi_0,\,\psi_1,\,\psi_2,\,\psi_3]\cCur\tp$}{rigid body coordinates in case of Euler parameters}
\rowTable{flexible coordinates}{$\qv_f$}{flexible, body-fixed coordinates}
\rowTable{flexible coordinates transformation matrix}{$\LU{0b}{\Am}_{bd} = \mathrm{diag}([\LU{0b}{\Am},\;\ldots,\;\LU{0b}{\Am})$}{block diagonal transformation matrix, which transforms all flexible coordinates from local to global coordinates}
\finishTable
%
Consider an object with $n = 1+ n_f$ nodes, $n_f$ being the 'flexible' nodes.
It has node numbers $[n_0,\,\ldots,\,n_{n_f}]$ and according numbers of
nodal coordinates $[n_{c_0},\,\ldots,\,n_{c_n}]$.
This gives $n_c$ total nodal coordinates,
\be
n_c = \sum_{i=0}^{n_f} n_{c_i}.
\ee
whereof the flexible coordinates are
\be
n_{c_f} = \sum_{i=1}^{n_f} n_{c_i}.
\ee
\noindent The total number of equations (=coordinates) of the object is $n_c$.
The first node $n_0$ represents the rigid body motion of the underlying reference frame with $n_{c_r} = n_{c_0}$ coordinates
(e.g., $n_{c_r}=6$ coordinates for Euler angles and $n_{c_r}=7$ coordinates in case of Euler parameters).
{\bf Equations of motion}, in case that \texttt{computeFFRFterms = True}:
\be
\left(\Mm_{user}(t,\cv,\dot \cv) + \mr{\Mm_{tt}}{\Mm_{tr}}{\Mm_{tf}} {}{\Mm_{rr}}{\Mm_{rf}} {\mathrm{sym.}}{}{\Mm_{ff}} \right) \ddot \cv +
\mr{0}{0}{0} {0}{0}{0} {0}{0}{\Dm_{ff}} \dot \cv + \mr{0}{0}{0} {0}{0}{0} {0}{0}{\Km_{ff}} \cv =
\fv_Q(\cv,\dot \cv) + \vp{\fv_r}{\LURU{0b}{\Am}{bd}{\mathrm{T}} \fv_{ff}} + \fv_{user}(t,\cv,\dot \cv)
\ee
In case that \texttt{computeFFRFterms = False}, the mass terms $\Mm_{tt} \ldots \Mm_{ff}$ are zero (not computed) and
the quadratic velocity vector $\fv_Q = \Null$.
Note that the user functions $\fv_{user}(t,\cv,\dot \cv)$ and $\Mm_{user}(t,\cv,\dot \cv)$ may be empty (=0).
CoordinateLoads are integrated for each ODE2 coordinate on the RHS of the latter equation.
\noindent If the rigid body node is using Euler parameters $\ttheta = [\theta_0,\,\theta_1,\,\theta_2,\,\theta_3]\tp$, an {\bf additional constraint} (constraint nr.\ 0) is
added automatically for the Euler parameter norm, reading
\be
1 - \sum_{i=0}^{3} \theta_i^2 = 0.
\ee
%\noindent If \texttt{constrainRigidBodyMotion==True}, {\bf 6 algebraic constraints} (constraint nrs.\ $[1\ldots 6]$) are added to restrict rigid body motion:
%of the flexible coordinates, by applying the constraints of a Tisserand frame, giving 3 constraints for the position of the center of mass
In order to suppress the rigid body motion of the mesh nodes, you should apply a ObjectConnectorCoordinateVector object with the following constraint
equations which impose constraints of a so-called Tisserand frame, giving 3 constraints for the position of the center of mass
\be
\Phi_t\tp \Mm \cv_f = 0
\ee
and 3 constraints for the rotation,
\be
\tilde\xv_{f}\tp \Mm \cv_f = 0
\ee
%
/end
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "objects's unique name"
V, CP, nodeNumbers, , , ArrayIndex, "ArrayIndex()", , I, "$\mathbf{n}_n = [n_0,\,\ldots,\,n_{n_f}]\tp$node numbers which provide the coordinates for the object (consecutively as provided in this list); the $(n_f+1)$ nodes represent the nodes of the FE mesh (except for node 0); the global nodal position needs to be reconstructed from the rigid-body motion of the reference frame"
V, CP, massMatrixFF, , , PyMatrixContainer,"PyMatrixContainer()", , I, "$\Mm_{ff} \in \Rcal^{n_{c_f} \times n_{c_f}}$body-fixed and ONLY flexible coordinates part of mass matrix of object given in python numpy format (sparse (CSR) or dense, converted to sparse matrix); internally data is stored in triplet format"
V, CP, stiffnessMatrixFF, , , PyMatrixContainer,"PyMatrixContainer()", , I, "$\Km_{ff} \in \Rcal^{n_{c_f} \times n_{c_f}}$body-fixed and ONLY flexible coordinates part of stiffness matrix of object in python numpy format (sparse (CSR) or dense, converted to sparse matrix); internally data is stored in triplet format"
V, CP, dampingMatrixFF, , , PyMatrixContainer,"PyMatrixContainer()", , I, "$\Dm_{ff} \in \Rcal^{n_{c_f} \times n_{c_f}}$body-fixed and ONLY flexible coordinates part of damping matrix of object in python numpy format (sparse (CSR) or dense, converted to sparse matrix); internally data is stored in triplet format"
V, CP, forceVector, , , NumpyVector,"Vector()", , I, "$\fv \in \Rcal^{n_c}$generalized, global force vector added to RHS; the rigid body part $\fv_r$ is directly applied to rigid body coordinates while the flexible part $\fv_{ff}$ is transformed from global to local coordinates"
V, CP, forceUserFunction, , , PyFunctionVectorScalar2Vector, 0, , IO, "$\fv_{user} \in \Rcal^{n_c}$A python user function which computes the generalized user force vector for the ODE2 equations; The function takes the time, coordinates q (without reference values) and coordinate velocities q\_t; Example for python function with numpy matrix K: def f(t, q, q\_t): return np.dot(K, q)"
V, CP, massMatrixUserFunction, , , PyFunctionMatrixScalar2Vector, 0, , IO, "$\Mm_{user} \in \Rcal^{n_c\times n_c}$A python user function which computes the TOTAL mass matrix (including reference node) and adds the local constant mass matrix; this function takes the time, coordinates q (without reference values) and coordinate velocities q\_t; Example (academic) for python function with numpy matrix M: def f(t, q, q\_t): return (q[0]+1)*M"
V, CP, computeFFRFterms, , , bool, "true", , IO, "flag decides whether the standard FFRF terms are computed; use this flag for user-defined definition of FFRF terms in mass matrix and quadratic velocity vector"
#impossible now: object cannot have constraints without algebraic nodal variables: V, CP, constrainRigidBodyMotion, , , bool, "true", , IO, "if true, the rigid body motion of the flexible coordinates is constrained by 6 additional algebraic equations, using the Tisserand frame"
#auto-computed quantities:
V, C, coordinateIndexPerNode, , , ArrayIndex, "ArrayIndex()", , IR, "this list contains the local coordinate index for every node, which is needed, e.g., for markers; the list is generated automatically every time parameters have been changed"
V, C, objectIsInitialized, , , bool, "false", , IO, "flag used to correctly initialize all FFRF matrices; as soon as this flag is set false, FFRF matrices and terms are recomputed"
V, C, physicsMass, , , UReal, "0.", , IR, "$m$total mass [SI:kg] of FFRF object, auto-computed from mass matrix $\Mm$"
V, C, physicsInertia, , , Matrix3D, "EXUmath::unitMatrix3D", , IR, "$J_r \in \Rcal^{3 \times 3}$inertia tensor [SI:kgm$^2$] of rigid body w.r.t. to the reference point of the body, auto-computed from the mass matrix $\Mm_{ff}$"
V, C, physicsCenterOfMass, , 3, Vector3D, "Vector3D({0.,0.,0.})", , IR, "$\LU{b}{\pv}_{COM}$local position of center of mass (COM); auto-computed from mass matrix $\Mm$"
V, C, PHItTM, , , NumpyMatrix,"Matrix()", , IR, "$\Phi_t\tp \in \Rcal^{n_{c_f} \times 3}$projector matrix; may be removed in future"
V, C, referencePositions, , , NumpyVector,"Vector()", , IR, "$\xv_{f} \in \Rcal^{n_f}$vector containing the reference positions of all flexible nodes"
V, C, tempVector, , , NumpyVector,"Vector()", , IUR, "$\vv_{temp} \in \Rcal^{n_f}$temporary vector"
V, C, tempCoordinates, , , NumpyVector,"Vector()", , IUR, "$\cv_{temp} \in \Rcal^{n_f}$temporary vector containing coordinates"
V, C, tempCoordinates_t, , , NumpyVector,"Vector()", , IUR, "$\dot \cv_{temp} \in \Rcal^{n_f}$temporary vector containing velocity coordinates"
V, C, tempRefPosSkew, , , NumpyMatrix,"Matrix()", , IUR, "$\tilde\pv_{f} \in \Rcal^{n_{c_f} \times 3}$temporary matrix with skew symmetric local (deformed) node positions"
V, C, tempVelSkew, , , NumpyMatrix,"Matrix()", , IUR, "$\dot\tilde\cv_{f} \in \Rcal^{n_{c_f} \times 3}$temporary matrix with skew symmetric local node velocities"
V, C, tempMatrix, , , ResizableMatrix,"ResizableMatrix()", , U, "$\Xm_{temp} \in \Rcal^{n_{c_f} \times 3}$temporary matrix"
V, C, tempMatrix2, , , ResizableMatrix,"ResizableMatrix()", , U, "$\Xm_{temp2} \in \Rcal^{n_{c_f} \times 4}$other temporary matrix"
#
#for CMS: V, CP, modeBasis, , , NumpyMatrix,"Matrix()", , IO, "$\tPhi \in \Rcal^{n \times m}$if this matrix is defined, the number of coordinates in the equations of motion is $m$ and this the mode basis matrix transforms $m$ modal displacement coordinates to $n$ nodal displacement coordinates; note that the range of $m$ is restricted to $m \in [1,m]$"
#for CMS: V, CP, nodesReferencePosition, , , NumpyMatrix,"Matrix()", , IO, "$\Rm_f \in \Rcal^{n_r \times 3}$body-fixed 3D positions of reference nodes, stored row-by-row in the matrix; needed together with modeBasis"
#
Fv, C, ComputeMassMatrix, , , void, , "Matrix& massMatrix", CDI, "Computational function: compute mass matrix"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, bool useIndex2 = false", CDI, "Compute algebraic equations part of rigid body"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE", CDI, "Compute jacobians of algebraic equations part of rigid body w.r.t. ODE2"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::AE_ODE2 + JacobianType::AE_ODE2_function);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
#Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return JacobianType::_None;", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetAccessFunctionTypes, , , AccessFunctionType,, , CDI, "Flags to determine, which access (forces, moments, connectors, ...) to object are possible"
Fv, C, GetAccessFunctionBody, , , void, , "AccessFunctionType accessType, const Vector3D& localPosition, Matrix& value", DC, "provide Jacobian at localPosition in 'value' according to object access"
Fv, C, GetOutputVariableBody, , , void, , "OutputVariableType variableType, const Vector3D& localPosition, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetPosition, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetDisplacement, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetVelocity, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of 'localPosition' according to configuration type"
Fv, C, GetRotationMatrix, , 9, Matrix3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Matrix, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocity, , 3, Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocityLocal, , 3, Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetLocalCenterOfMass, , 3, Vector3D, "return physicsCenterOfMass;", , CI, "return the local position of the center of mass, needed for massProportionalLoad; this is only the reference-frame part!"
#
Fv, M, GetTypeName, , , const char*, "return 'GenericODE2';" , , CI, "Get type name of object; could also be realized via a string -> type conversion?"
Fv, C, GetNodeNumber, , , Index, "return parameters.nodeNumbers[localIndex];", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return parameters.nodeNumbers.NumberOfItems();", , CI, "number of nodes; needed for every object"
Fv, C, GetODE2Size, , , Index, , , CDI, "number of ODE2 coordinates; needed for object?"
Fv, C, GetAlgebraicEquationsSize, , , Index, , , CDI, "number of AE coordinates; depends on node"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::_None;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
#not implemented in NodePoint, etc. Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::GenericODE2;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Body + (Index)CObjectType::MultiNoded + (Index)CObjectType::SuperElement);",, CI, "Get type of object, e.g. to categorize and distinguish during assembly and computation"
Fv, C, ParametersHaveChanged, , , void, "objectIsInitialized = false;", , I, "This flag is reset upon change of parameters; says that the vector of coordinate indices has changed"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
Fv, C, PostAssemble, , , void, "InitializeObject();", , I, "operations done after Assemble()"
Fv, C, GetLocalODE2CoordinateIndexPerNode, , , Index, "return coordinateIndexPerNode[localNode];", "Index localNode", CI, "read access to coordinate index array"
#helper functions:
F, C, ComputeObjectCoordinates, , , void, , "Vector& coordinates, Vector& coordinates_t, ConfigurationType configuration = ConfigurationType::Current", CDI, "compute object coordinates composed from all nodal coordinates; does not include reference coordinates"
F, C, InitializeObject, , , void, , , DI, "initialize coordinateIndexPerNode array"
#F, C, HasModeBasis, , , bool, "return parameters.modeBasis.NumberOfColumns()!=0;", , CI, "return true, if a modal basis is provided and the object is treated as modally reduced FFRF-formulation"
#superelement, mesh functions:
Fv, C, HasReferenceFrame, , , bool, "localReferenceFrameNode = rigidBodyNodeNumber; return true;", "Index& localReferenceFrameNode", CI, "always true, because ObjectFFRF; return according LOCAL node number"
Fv, C, GetNumberOfMeshNodes, , , Index, "return GetNumberOfNodes()-1;", , IC, "return the number of mesh nodes, which is 1 less than the number of nodes (but different in other SuperElements)"
Fv, C, GetMeshNodeLocalPosition, , , Vector3D, , "Index meshNodeNumber, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (local) position of a mesh node according to configuration type; use Configuration.Reference to access the mesh reference position; meshNodeNumber is the local node number of the (underlying) mesh"
Fv, C, GetMeshNodeLocalVelocity, , , Vector3D, , "Index meshNodeNumber, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (local) velocity of a mesh node according to configuration type; meshNodeNumber is the local node number of the (underlying) mesh"
Fv, C, GetMeshNodePosition, , , Vector3D, , "Index meshNodeNumber, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of a mesh node according to configuration type; this is the node position transformed by the motion of the reference frame; meshNodeNumber is the local node number of the (underlying) mesh"
Fv, C, GetMeshNodeVelocity, , , Vector3D, , "Index meshNodeNumber, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of a mesh node according to configuration type; this is the node position transformed by the motion of the reference frame; meshNodeNumber is the local node number of the (underlying) mesh"
Fv, C, GetAccessFunctionSuperElement, , , void, , "AccessFunctionType accessType, const Matrix& weightingMatrix, const ArrayIndex& meshNodeNumbers, Matrix& value", DC, "compute Jacobian with weightingMatrix (WM) and/or meshNodeNumbers, which define how the SuperElement mesh nodes or coordinates are transformed to a global position; for details see CObjectSuperElement header file"
Fv, C, GetOutputVariableTypesSuperElement, , , OutputVariableType, , "Index meshNodeNumber", DC, "get extended output variable types for multi-nodal objects with mesh nodes; some objects have meshNode-dependent OutputVariableTypes"
Fv, C, GetOutputVariableSuperElement, , , void, , "OutputVariableType variableType, Index meshNodeNumber, ConfigurationType configuration, Vector& value", DC, "get extended output variables for multi-nodal objects with mesh nodes"
#??decide, whether GenericMarker or Object computes special jacobian
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown; use visualizationSettings.bodies.deformationScaleFactor to draw scaled (local) deformations; the reference frame node is shown with additional letters RF"
V, V, color, , 4, Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA color for object; 4th value is alpha-transparency; R=-1.f means, that default color is used"
V, V, triangleMesh, , , NumpyMatrixI,"MatrixI()", , IO, "a matrix, containg node number triples in every row, referring to the node numbers of the GenericODE2 object; the mesh uses the nodes to visualize the underlying object; contour plot colors are still computed in the local frame!"
V, V, showNodes, , , bool, "false", , IO, "set true, nodes are drawn uniquely via the mesh, eventually using the floating reference frame, even in the visualization of the node is show=False; node numbers are shown with indicator 'NF'"
#
#done in VisualizationObjectSuperElement:
#Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#Fv, V, GetSuperElementShowNodes, , , bool, ";", , I, "showNodes interface for general drawing function of super element"
#Fv, V, GetSuperElementTriangleMesh, , , "const MatrixI&", "return triangleMesh;", , I, "mesh interface for general drawing function of super element"
#Fv, V, GetSuperElementColor, , , Float4, ";", , I, "color interface for general drawing function of super element"
#could be used to visualize nodes: V, V, graphicsData, , , BodyGraphicsData, , , IO, "Structure contains data for body visualization; data is defined in special list / dictionary structure"
#file names automatically determined from class name
writeFile = True
class = ObjectFFRFreducedOrder
classDescription = "This object is used to represent modally reduced flexible bodies using the floating frame of reference formulation (FFRF) and the component mode synthesis. It contains a RigidBodyNode (always node 0) and a NodeGenericODE2 representing the modal coordinates."
cParentClass = CObjectSuperElement
mainParentClass = MainObjectBody
visuParentClass = VisualizationObjectSuperElement
pythonShortName = CMSobject
addIncludesC = '#include <pybind11/numpy.h>//for NumpyMatrix\n#include <pybind11/stl.h>//for NumpyMatrix\n#include <pybind11/pybind11.h>\ntypedef py::array_t<Real> NumpyMatrix; \n#include "Pymodules/PyMatrixContainer.h"//for some FFRF matrices\n'
addPublicC = " static constexpr Index ffrfNodeDim = 3; //dimension of nodes (=displacement coordinates per node)\n static constexpr Index rigidBodyNodeNumber = 0; //node number of rigid body node (usually = 0)\n static constexpr Index genericNodeNumber = 1;//node number for modal coordinates\n"
outputVariables = "{'Coordinates':'all ODE2 coordinates', 'Coordinates_t':'all ODE2 velocity coordinates', 'Force':'generalized forces for all coordinates (residual of all forces except mass*accleration; corresponds to ComputeODE2RHS)'}"
classType = Object
equations =
\vspace{6pt}\\
, 'Stress':'allows to compute linearized, corotational nodal stresses (in mesh nodes, in body frame) based on modal stress values provided in outputVariableModeBasis; the flag outputVariableTypeModeBasis must be set in this case to exu.Outputvariable.Stress', 'Strain':'allows to compute linearized, corotational nodal strains (in mesh nodes, in body frame) based on modal strain values provided in outputVariableModeBasis; the flag outputVariableTypeModeBasis must be set in this case to exu.Outputvariable.Strain'
The object additionally provides the following output variables for mesh nodes (use \\texttt{mbs.GetObjectOutputSuperElement(...)} or \texttt{SensorSuperElement}):
\startTable{mesh node output variables}{symbol}{description}
\rowTable{Position}{$\LU{0}{\rv}_{n_i}$}{position of node with mesh node number $n_i$ in global coordinates}
\rowTable{Position}{$\LU{0}{\rv}_{n_i}$}{position of node with mesh node number $n_i$ in global coordinates}
\rowTable{DisplacementLocal (mesh node $i$)}{$\LU{b}{\uv}_{f,i}$}{local nodal mesh displacement in reference (body) frame}
\rowTable{VelocityLocal (mesh node $i$)}{$\LU{b}{\dot \uv}_{f,i}$}{local nodal mesh velocity in reference (body) frame}
\rowTable{Displacement (mesh node $i$)}{$\LU{0}{\uv}_{i,config} = \LU{0}{\qv}_{t,config} + \LU{0b}{\Am}_{config} \LU{b}{\pv}_{f,i,config} - (\LU{0}{\qv}_{t,ref} + \LU{0b}{\Am}_{ref} \LU{b}{\rv}_{f,i})$}{nodal mesh displacement in global coordinates}
\rowTable{Position (mesh node $i$)}{$\LU{0}{\pv}_{i} = \LU{0}{\pv}_t + \LU{0b}{\Am} \LU{b}{\pv}_{f,i}$}{nodal mesh displacement in global coordinates}
\rowTable{Velocity (mesh node $i$)}{$\LU{0}{\dot \uv}_{i} = \LU{0}{\dot \qv}_t + \LU{0b}{\Am} (\LU{b}{\dot \uv}_{f,i} + \LU{b}{\tilde \tomega} \LU{b}{\dot \uv}_{f,i})$}{nodal mesh velocity in global coordinates}
\rowTable{Stress (mesh node $i$)}{$\LU{b}{\tsigma}_{i} = (\tpsi_{OV} \tzeta)_{3\cdot i \ldots 3\cdot i+5}$}{linearized stress components of mesh node $i$ in reference frame; $\tsigma=[\sigma_{xx},\,\sigma_{yy},\,\sigma_{zz},\,\sigma_{yz},\,\sigma_{xz},\,\sigma_{xy}]\tp$; ONLY available, if $\tpsi_{OV}$ is provided and \texttt{outputVariableTypeModeBasis==exu.OutputVariableType.Stress}}
\rowTable{Strain (mesh node $i$)}{$\LU{b}{\teps}_{i} = (\tpsi_{OV} \tzeta)_{3\cdot i \ldots 3\cdot i+5}$}{linearized stress components of mesh node $i$ in reference frame; $\tsigma=[\sigma_{xx},\,\sigma_{yy},\,\sigma_{zz},\,\sigma_{yz},\,\sigma_{xz},\,\sigma_{xy}]\tp$; ONLY available, if $\tpsi_{OV}$ is provided and \texttt{outputVariableTypeModeBasis==exu.OutputVariableType.Strain}}
\finishTable
%
\startTable{intermediate variables}{symbol}{description}
\rowTable{flexible coordinates transformation matrix}{$\LU{0b}{\Am}_{bd} = \mathrm{diag}([\LU{0b}{\Am},\;\ldots,\;\LU{0b}{\Am})$}{block diagonal transformation matrix, which transforms all flexible coordinates from local to global coordinates}
\rowTable{coordinate vector}{$\qv = [\LU{0}{\qv}_t,\,\tpsi,\,\tzeta]$}{vector of object coordinates; $\qv_t$ and $\tpsi$ are the translation and rotation part of displacements of the reference frame, provided by the rigid body node (node number 0)}
\rowTable{reference frame position}{$\LU{0}{\pv}_{t,config} = \LU{0}{\qv}_{t,config} + \LU{0}{\qv}_{t,ref}$}{reference frame position in any configuration except reference}
\rowTable{reference frame rotation}{$\ttheta_{config} = \ttheta_{config} + \ttheta_{ref}$}{reference frame rotation parameters in any configuration except reference}
%
\rowTable{vector of modal coordinates}{$\tzeta = [\zeta_0,\,\ldots,\zeta_{n_m-1}]\tp$}{vector of modal coordinates}
\rowTable{vector of mesh coordinates}{$\LU{b}{\qv}_f = \tpsi \tzeta$}{vector of alternating x,y, an z coordinates of local (in body frame) mesh displacements reconstructed from modal coordinates $\tzeta$}
%\rowTable{local mesh displacement vector}{$\LU{b}{\uv}_f = \mr{\LU{b}{\qv}_{f,0}}{\LU{b}{\qv}_{f,1}}{\LU{b}{\qv}_{f,2}} {\vdots}{\vdots}{\vdots} {\LU{b}{\qv}_{f,n_c-3}}{\LU{b}{\qv}_{f,n_c-2}}{\LU{b}{\qv}_{f,n_c-1}}\tp$}{vector nodal mesh displacement vectors in local coordinates (body frame)}
\rowTable{local mesh displacements}{$\LU{b}{\uv}_{f,i} = \vr{\LU{b}{\qv}_{f,i\cdot 3}}{\LU{b}{\qv}_{f,i\cdot 3+1}}{\LU{b}{\qv}_{f,i\cdot 3+2}}$}{nodal mesh displacement in local coordinates (body frame)}
\rowTable{local mesh position}{$\LU{b}{\pv}_{f,i} = \vr{\LU{b}{\qv}_{f,i\cdot 3}}{\LU{b}{\qv}_{f,i\cdot 3+1}}{\LU{b}{\qv}_{f,i\cdot 3+2}} + \vr{\LU{b}{\rv}_{f,i\cdot 3}}{\LU{b}{\rv}_{f,i\cdot 3+1}}{\LU{b}{\rv}_{f,i\cdot 3+2}}$}{(deformed) nodal mesh position in local coordinates (body frame)}
\finishTable
%
Some definitions:
\bi
\item body frame (b) = reference frame
\item $n_n$ ... number of mesh nodes
\item $n_c = 3 \cdot n_n$ ... number of mesh coordinates
\item $n_{rigid}$ ... number of rigid body node coordinates: 6 in case of Euler angles and 7 in case of Euler parameters
\item $n_{ODE2} = n_c + n_{rigid}$ ... total number of object coordinates
\item $n_m$ ... number of modal coordinates; computed from number of columns in modeBasis
\item $\tpsi$ ... mode basis, containing eigenmodes and static modes
\item $\LU{b}{\rv}_{f} $ ... node reference coordinates for mesh nodes
\ei
{\bf Equations of motion}, in case that \texttt{computeFFRFterms = True} (NEEDS TO BE UPDATED FOR FFRF!!!!):
\be
\left(\Mm_{user}(t,\cv,\dot \cv) + \mr{\Mm_{tt}}{\Mm_{tr}}{\Mm_{tf}} {}{\Mm_{rr}}{\Mm_{rf}} {\mathrm{sym.}}{}{\Mm_{ff}} \right) \ddot \cv +
\mr{0}{0}{0} {0}{0}{0} {0}{0}{\Dm_{ff}} \dot \cv + \mr{0}{0}{0} {0}{0}{0} {0}{0}{\Km_{ff}} \cv =
\fv_Q(\cv,\dot \cv) + \fv_{user}(t,\cv,\dot \cv)
\ee
In case that \texttt{computeFFRFterms = False}, the mass terms $\Mm_{tt} \ldots \Mm_{ff}$ are zero (not computed) and
the quadratic velocity vector $\fv_Q = \Null$.
Note that the user functions $\fv_{user}(t,\cv,\dot \cv)$ and $\Mm_{user}(t,\cv,\dot \cv)$ may be empty (=0).
CoordinateLoads are integrated for each ODE2 coordinate on the RHS of the latter equation.
%
/end
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "objects's unique name"
V, CP, nodeNumbers, , , ArrayIndex, "ArrayIndex()", , I, "$\mathbf{n} = [n_0,\,n_1]\tp$node numbers of rigid body node and NodeGenericODE2 for modal coordinates; the global nodal position needs to be reconstructed from the rigid-body motion of the reference frame, the modal coordinates and the mode basis"
V, CP, massMatrixReduced, , , PyMatrixContainer,"PyMatrixContainer()",, I, "$\Mm_{red} \in \Rcal^{n_{c_f} \times n_{c_f}}$body-fixed and ONLY flexible coordinates part of reduced mass matrix; provided as MatrixContainer(sparse/dense matrix)"
V, CP, stiffnessMatrixReduced, , , PyMatrixContainer,"PyMatrixContainer()",, I, "$\Km_{red} \in \Rcal^{n_{c_f} \times n_{c_f}}$body-fixed and ONLY flexible coordinates part of reduced stiffness matrix; provided as MatrixContainer(sparse/dense matrix)"
V, CP, dampingMatrixReduced, , , PyMatrixContainer,"PyMatrixContainer()",, I, "$\Dm_{red} \in \Rcal^{n_{c_f} \times n_{c_f}}$body-fixed and ONLY flexible coordinates part of reduced damping matrix; provided as MatrixContainer(sparse/dense matrix)"
V, CP, forceUserFunction, , , PyFunctionVectorScalar2Vector, 0, , IO, "$\fv_{user} \in \Rcal^{n_c}$A python user function which computes the generalized user force vector for the ODE2 equations; The function takes the time, coordinates q (without reference values) and coordinate velocities q\_t; Example for python function with numpy matrix K: def f(t, q, q\_t): return np.dot(K, q)"
V, CP, massMatrixUserFunction, , , PyFunctionMatrixScalar2Vector, 0, , IO, "$\Mm_{user} \in \Rcal^{n_c\times n_c}$A python user function which computes the TOTAL mass matrix (including reference node) and adds the local constant mass matrix; this function takes the time, coordinates q (without reference values) and coordinate velocities q\_t; Example (academic) for python function with numpy matrix M: def f(t, q, q\_t): return (q[0]+1)*M"
V, CP, computeFFRFterms, , , bool, "true", , IO, "flag decides whether the standard FFRF/CMS terms are computed; use this flag for user-defined definition of FFRF terms in mass matrix and quadratic velocity vector"
#
V, CP, modeBasis, , , NumpyMatrix,"Matrix()", , I, "$\tpsi \in \Rcal^{n_{c_f} \times n_{m}}$mode basis, which transforms reduced coordinates to (full) nodal coordinates, written as a single vector $[u_{x,n_0},\,u_{y,n_0},\,u_{z,n_0},\,\ldots,\,u_{x,n_n},\,u_{y,n_n},\,u_{z,n_n}]\tp$"
V, CP, outputVariableModeBasis, , , NumpyMatrix,"Matrix()", , IO, "$\tpsi_{OV} \in \Rcal^{n_{n} \times (n_{m}\cdot s_{OV})}$mode basis, which transforms reduced coordinates to output variables per mode; $s_{OV}$ is the size of the output variable, e.g., 6 for stress modes ($S_{xx},...,S_{xy}$)"
V, CP, outputVariableTypeModeBasis, , , OutputVariableType, "OutputVariableType::_None", , IO, "this must be the output variable type of the outputVariableModeBasis, e.g. exu.OutputVariableType.Stress"
V, CP, referencePositions, , , NumpyVector,"Vector()", , I, "$\LU{b}{\rv}_{f} \in \Rcal^{n_f}$vector containing the reference positions of all flexible nodes, needed for graphics"
#auto-computed quantities:
#V, C, objectIsInitialized, , , bool, "false", , IO, "flag used to correctly initialize all FFRF matrices; as soon as this flag is set false, FFRF matrices and terms are recomputed"
V, C, physicsMass, , , UReal, "0.", , IR, "$m$total mass [SI:kg] of FFRF object, auto-computed from mass matrix $\Mm$"
V, C, physicsInertia, , , Matrix3D, "EXUmath::unitMatrix3D", , IR, "$J_r \in \Rcal^{3 \times 3}$inertia tensor [SI:kgm$^2$] of rigid body w.r.t. to the reference point of the body, auto-computed from the mass matrix $\Mm_{ff}$"
V, C, physicsCenterOfMass, , 3, Vector3D, "Vector3D({0.,0.,0.})", , IR, "$\LU{b}{\pv}_{COM}$local position of center of mass (COM); auto-computed from mass matrix $\Mm$"
#needs to be updated:
V, C, PHItTM, , , NumpyMatrix,"Matrix()", , IR, "$\Phi_t\tp \in \Rcal^{n_{c_f} \times 3}$projector matrix; may be removed in future"
V, C, tempUserFunctionForce, , , NumpyVector,"Vector()", , IUR, "$\vv_{temp} \in \Rcal^{n_c}$temporary vector for UF force"
V, C, tempVector, , , ResizableVector,"ResizableVector()", , UR, "$\vv_{temp} \in \Rcal^{n_f}$temporary vector"
V, C, tempCoordinates, , , ResizableVector,"ResizableVector()", , UR, "$\cv_{temp} \in \Rcal^{n_f}$temporary vector containing coordinates"
V, C, tempCoordinates_t, , , ResizableVector,"ResizableVector()", , UR, "$\dot \cv_{temp} \in \Rcal^{n_f}$temporary vector containing velocity coordinates"
V, C, tempRefPosSkew, , , NumpyMatrix,"Matrix()", , IUR, "$\tilde\pv_{f} \in \Rcal^{n_{c_f} \times 3}$matrix with skew symmetric local (deformed) node positions"
V, C, tempVelSkew, , , NumpyMatrix,"Matrix()", , IUR, "$\dot\tilde\cv_{f} \in \Rcal^{n_{c_f} \times 3}$matrix with skew symmetric local node velocities"
V, C, tempMatrix, , , ResizableMatrix,"ResizableMatrix()", , U, "$\Xm_{temp} \in \Rcal^{n_{c_f} \times 3}$temporary matrix"
V, C, tempMatrix2, , , ResizableMatrix,"ResizableMatrix()", , U, "$\Xm_{temp2} \in \Rcal^{n_{c_f} \times 4}$other temporary matrix"
#
#for CMS: V, CP, modeBasis, , , NumpyMatrix,"Matrix()", , IO, "$\tPhi \in \Rcal^{n \times m}$if this matrix is defined, the number of coordinates in the equations of motion is $m$ and this the mode basis matrix transforms $m$ modal displacement coordinates to $n$ nodal displacement coordinates; note that the range of $m$ is restricted to $m \in [1,m]$"
#for CMS: V, CP, nodesReferencePosition, , , NumpyMatrix,"Matrix()", , IO, "$\Rm_f \in \Rcal^{n_r \times 3}$body-fixed 3D positions of reference nodes, stored row-by-row in the matrix; needed together with modeBasis"
#
Fv, C, ComputeMassMatrix, , , void, , "Matrix& massMatrix", CDI, "Computational function: compute mass matrix"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, bool useIndex2 = false", CDI, "Compute algebraic equations part of rigid body"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE", CDI, "Compute jacobians of algebraic equations part of rigid body w.r.t. ODE2"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, , , CDI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetAccessFunctionTypes, , , AccessFunctionType,, , CDI, "Flags to determine, which access (forces, moments, connectors, ...) to object are possible"
Fv, C, GetAccessFunctionBody, , , void, , "AccessFunctionType accessType, const Vector3D& localPosition, Matrix& value", DC, "provide Jacobian at localPosition in 'value' according to object access"
Fv, C, GetOutputVariableBody, , , void, , "OutputVariableType variableType, const Vector3D& localPosition, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetPosition, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetDisplacement, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetVelocity, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of 'localPosition' according to configuration type"
Fv, C, GetRotationMatrix, , 9, Matrix3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Matrix, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocity, , 3, Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocityLocal, , 3, Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetLocalCenterOfMass, , 3, Vector3D, "return physicsCenterOfMass;", , CI, "return the local position of the center of mass, needed for massProportionalLoad; this is only the reference-frame part!"
#
Fv, M, GetTypeName, , , const char*, "return 'GenericODE2';" , , CI, "Get type name of object; could also be realized via a string -> type conversion?"
Fv, C, GetNodeNumber, , , Index, "return parameters.nodeNumbers[localIndex];", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return parameters.nodeNumbers.NumberOfItems();", , CI, "number of nodes; needed for every object"
Fv, C, GetODE2Size, , , Index, , , CDI, "number of ODE2 coordinates; needed for object?"
Fv, C, GetAlgebraicEquationsSize, , , Index, , , CDI, "number of AE coordinates; depends on node"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::_None;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
#not implemented in NodePoint, etc. Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::GenericODE2;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Body + (Index)CObjectType::MultiNoded + (Index)CObjectType::SuperElement);",, CI, "Get type of object, e.g. to categorize and distinguish during assembly and computation"
#Fv, C, ParametersHaveChanged, , , void, "objectIsInitialized = false;", , I, "This flag is reset upon change of parameters; says that the vector of coordinate indices has changed"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#Fv, C, PostAssemble, , , void, "InitializeObject();", , I, "operations done after Assemble()"
#not needed any more: Fv, C, GetLocalODE2CoordinateIndexPerNode, , , Index, "return coordinateIndexPerNode[localNode];", "Index localNode", CI, "read access to coordinate index array"
#helper functions:
F, C, ComputeObjectCoordinates, , , void, , "Vector& coordinates, ConfigurationType configuration = ConfigurationType::Current", CDI, "compute object coordinates composed from all nodal coordinates; does not include reference coordinates"
F, C, ComputeObjectCoordinates_t, , , void, , "Vector& coordinates_t, ConfigurationType configuration = ConfigurationType::Current", CDI, "compute object velocity coordinates composed from all nodal coordinates"
F, C, GetMeshNodeCoordinates, , , Vector3D, , "Index nodeNumber, const Vector& coordinates", CDI, "compute coordinates for nodeNumber (without reference coordinates) from modeBasis (=multiplication of according part of mode Basis with modal coordinates)"
#superelement, mesh functions:
Fv, C, HasReferenceFrame, , , bool, "localReferenceFrameNode = rigidBodyNodeNumber; return true;", "Index& localReferenceFrameNode", CI, "always true, because FFRF-based object; return according LOCAL node number"
Fv, C, GetNumberOfMeshNodes, , , Index, "return parameters.referencePositions.NumberOfItems()/3;", , IC, "return the number of mesh nodes, which is given according to the node reference positions"
Fv, C, GetMeshNodeLocalPosition, , , Vector3D, , "Index meshNodeNumber, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (local) position of a mesh node according to configuration type; use Configuration.Reference to access the mesh reference position; meshNodeNumber is the local node number of the (underlying) mesh"
Fv, C, GetMeshNodeLocalVelocity, , , Vector3D, , "Index meshNodeNumber, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (local) velocity of a mesh node according to configuration type; meshNodeNumber is the local node number of the (underlying) mesh"
Fv, C, GetMeshNodePosition, , , Vector3D, , "Index meshNodeNumber, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of a mesh node according to configuration type; this is the node position transformed by the motion of the reference frame; meshNodeNumber is the local node number of the (underlying) mesh"
Fv, C, GetMeshNodeVelocity, , , Vector3D, , "Index meshNodeNumber, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of a mesh node according to configuration type; this is the node position transformed by the motion of the reference frame; meshNodeNumber is the local node number of the (underlying) mesh"
Fv, C, GetAccessFunctionSuperElement, , , void, , "AccessFunctionType accessType, const Matrix& weightingMatrix, const ArrayIndex& meshNodeNumbers, Matrix& value", DC, "compute Jacobian with weightingMatrix (WM) and/or meshNodeNumbers, which define how the SuperElement mesh nodes or coordinates are transformed to a global position; for details see CObjectSuperElement header file"
Fv, C, GetOutputVariableTypesSuperElement, , , OutputVariableType, , "Index meshNodeNumber", DC, "get extended output variable types for multi-nodal objects with mesh nodes; some objects have meshNode-dependent OutputVariableTypes"
Fv, C, GetOutputVariableSuperElement, , , void, , "OutputVariableType variableType, Index meshNodeNumber, ConfigurationType configuration, Vector& value", DC, "get extended output variables for multi-nodal objects with mesh nodes"
#??decide, whether GenericMarker or Object computes special jacobian
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown; use visualizationSettings.bodies.deformationScaleFactor to draw scaled (local) deformations; the reference frame node is shown with additional letters RF"
V, V, color, , 4, Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA color for object; 4th value is alpha-transparency; R=-1.f means, that default color is used"
V, V, triangleMesh, , , NumpyMatrixI,"MatrixI()", , IO, "a matrix, containg node number triples in every row, referring to the node numbers of the GenericODE2 object; the mesh uses the nodes to visualize the underlying object; contour plot colors are still computed in the local frame!"
V, V, showNodes, , , bool, "false", , IO, "set true, nodes are drawn uniquely via the mesh, eventually using the floating reference frame, even in the visualization of the node is show=False; node numbers are shown with indicator 'NF'"
#put into bodies-settings: V, V, deformationScaleFactor, , , UReal, 1, , IO, "a scaling factor, which is applied to the nodal deformations in order to visualize deformations"
#done in VisualizationObjectSuperElement:
#Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#Fv, V, GetSuperElementShowNodes, , , bool, ";", , I, "showNodes interface for general drawing function of super element"
#Fv, V, GetSuperElementTriangleMesh, , , "const MatrixI&", "return triangleMesh;", , I, "mesh interface for general drawing function of super element"
#Fv, V, GetSuperElementColor, , , Float4, ";", , I, "color interface for general drawing function of super element"
#could be used to visualize nodes: V, V, graphicsData, , , BodyGraphicsData, , , IO, "Structure contains data for body visualization; data is defined in special list / dictionary structure"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#FINITE ELEMENTS
class = ObjectANCFCable2D
classDescription = "A 2D cable finite element using 2 nodes of type NodePoint2DSlope1; the element has 8 coordinates and uses cubic polynomials for position interpolation; the Bernoulli-Euler beam is capable of large deformation as it employs the material measure of curvature for the bending."
cParentClass = CObjectANCFCable2DBase
mainParentClass = MainObjectBody
visuParentClass = VisualizationObject
pythonShortName = Cable2D
#addProtectedC = " static constexpr Index nODE2Coordinates = 8; //!< fixed size of coordinates used e.g. for ConstSizeVectors\n mutable bool massMatrixComputed; //!< flag which shows that mass matrix has been computed; will be set to false at time when parameters are set\n mutable ConstSizeMatrix<nODE2Coordinates*nODE2Coordinates> precomputedMassMatrix; //!< if massMatrixComputed=true, this contains the (constant) mass matrix for faster computation\n"
addIncludesC = '#include "Objects/CObjectANCFCable2DBase.h"\n'
#addPublicC = ""
outputVariables = "{'Position':'global position vector of local axis (1) and cross section (2) position', 'Displacement':'global displacement vector of local axis (1) and cross section (2) position', 'Velocity':'global velocity vector of local axis (1) and cross section (2) position', 'Director1':'(axial) slope vector of local axis position', 'Strain':'axial strain (scalar)', 'Curvature':'axial strain (scalar)', 'Force':'(local) section normal force (scalar)', 'Torque':'(local) bending moment (scalar)'}"
classType = Object
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "objects's unique name"
V, CP, physicsLength, , , UReal, "0.", , I, "reference length $L$ [SI:m] of beam; such that the total volume (e.g. for volume load) gives $\rho A L$"
V, CP, physicsMassPerLength, , , UReal, "0.", , I, "mass $\rho A$ [SI:kg/m$^2$] of beam"
V, CP, physicsBendingStiffness, , , UReal, "0.", , I, "bending stiffness $EI$ [SI:Nm$^2$] of beam; the bending moment is $m = EI (\kappa - \kappa_0)$, in which $\kappa$ is the material measure of curvature"
V, CP, physicsAxialStiffness, , , UReal, "0.", , I, "axial stiffness $EA$ [SI:N] of beam; the axial force is $f_{ax} = EA (\varepsilon -\varepsilon_0)$, in which $\varepsilon = |\rv^\prime|-1$ is the axial strain"
V, CP, physicsBendingDamping, , , UReal, "0.", , I, "bending damping $d_{EI}$ [SI:Nm$^2$/s] of beam; the additional virtual work due to damping is $\delta W_{\dot \kappa} = \int_0^L \dot \kappa \delta \kappa dx$"
V, CP, physicsAxialDamping, , , UReal, "0.", , I, "axial stiffness $d_{EA}$ [SI:N/s] of beam; the additional virtual work due to damping is $\delta W_{\dot\varepsilon} = \int_0^L \dot \varepsilon \delta \varepsilon dx$"
V, CP, physicsReferenceAxialStrain, , , UReal, "0.", , I, "reference axial strain of beam (pre-deformation) $\varepsilon_0$ [SI:1] of beam; without external loading the beam will statically keep the reference axial strain value"
V, CP, physicsReferenceCurvature, , , UReal, "0.", , I, "reference curvature of beam (pre-deformation) $\kappa_0$ [SI:1/m] of beam; without external loading the beam will statically keep the reference curvature value"
V, CP, nodeNumbers, , , Index2, "Index2({EXUstd::InvalidIndex, EXUstd::InvalidIndex})", , I, "two node numbers ANCF cable element"
V, CP, useReducedOrderIntegration, , , Bool, false, , I, "false: use Gauss order 9 integration for virtual work of axial forces, order 5 for virtual work of bending moments; true: use Gauss order 7 integration for virtual work of axial forces, order 3 for virtual work of bending moments"
#access to parameters for Base class:
Fv, C, GetLength, , , Real, "return parameters.physicsLength;", , IC, "access to individual element paramters for base class functions"
Fv, C, GetMassPerLength, , , Real, "return parameters.physicsMassPerLength;", , IC, "access to individual element paramters for base class functions"
Fv, C, GetMaterialParameters, , , void, "physicsBendingStiffness = parameters.physicsBendingStiffness; physicsAxialStiffness = parameters.physicsAxialStiffness; physicsBendingDamping = parameters.physicsBendingDamping; physicsAxialDamping = parameters.physicsAxialDamping; physicsReferenceAxialStrain = parameters.physicsReferenceAxialStrain; physicsReferenceCurvature = parameters.physicsReferenceCurvature;", "Real& physicsBendingStiffness, Real& physicsAxialStiffness, Real& physicsBendingDamping, Real& physicsAxialDamping, Real& physicsReferenceAxialStrain, Real& physicsReferenceCurvature", IC, "access to individual element paramters for base class functions"
Fv, C, UseReducedOrderIntegration, , , Bool, "return parameters.useReducedOrderIntegration;", , IC, "access to useReducedOrderIntegration from derived class"
#
#Fv, C, ComputeMassMatrix, , , void, , "Matrix& massMatrix", CDI, "Computational function: compute mass matrix"
#Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::ODE2_ODE2 + JacobianType::ODE2_ODE2_t + JacobianType::ODE2_ODE2_function + JacobianType::ODE2_ODE2_t_function);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
#Fv, C, GetAccessFunctionTypes, , , AccessFunctionType,, , CDI, "Flags to determine, which access (forces, moments, connectors, ...) to object are possible"
#Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
#Fv, C, GetAccessFunctionBody, , , void, , "AccessFunctionType accessType, const Vector3D& localPosition, Matrix& value", DC, "provide Jacobian at localPosition in 'value' according to object access"
#Fv, C, GetOutputVariableBody, , , void, , "OutputVariableType variableType, const Vector3D& localPosition, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'"
#Fv, C, GetPosition, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
#Fv, C, GetDisplacement, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
#Fv, C, GetVelocity, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of 'localPosition' according to configuration type"
#Fv, C, GetRotationMatrix, , 9, Matrix3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Matrix, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
#Fv, C, GetAngularVelocity, , 3, Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, M, GetTypeName, , , const char*, "return 'ANCFCable2D';" , , CI, "Get type name of object; could also be realized via a string -> type conversion?"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex <= 1);\n return parameters.nodeNumbers[localIndex];", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 2;", , CI, "number of nodes; needed for every object"
Fv, C, GetODE2Size, , , Index, "return nODE2Coordinates;", , CI, "number of ODE2 coordinates; needed for object?"
Fv, M, GetRequestedNodeType, , , Node::Type, "return (Node::Type)(Node::Position2D + Node::Orientation2D + Node::Point2DSlope1);", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
#Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Body + (Index)CObjectType::MultiNoded);",, CI, "Get type of object, e.g. to categorize and distinguish during assembly and computation"
Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific object function ==> automatically generated in future?"
Fv, C, ParametersHaveChanged, , , void, "massMatrixComputed = false;", , I, "This flag is reset upon change of parameters; says that mass matrix (future: other pre-computed values) need to be recomputed"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#internal functions:
#Fs, C, MapCoordinates, , , Vector2D, , "const Vector4D& SV, const LinkedDataVector& q0, const LinkedDataVector& q1", DI, "map element coordinates (position or veloctiy level) given by nodal vectors q0 and q1 onto compressed shape function vector to compute position, etc."
#Fs, C, ComputeShapeFunctions, , , Vector4D, , "Real x, Real L", DI, "get compressed shape function vector $\Sm_v$, depending local position $x \in [0,L]$"
#Fs, C, ComputeShapeFunctions_x, , , Vector4D, , "Real x, Real L", DI, "get first derivative of compressed shape function vector $\frac{\partial \Sm_v}{\partial x}$, depending local position $x \in [0,L]$"
#Fs, C, ComputeShapeFunctions_xx, , , Vector4D, , "Real x, Real L", DI, "get second derivative of compressed shape function vector $\frac{\partial^2 \Sm_v}{\partial^2 x}$, depending local position $x \in [0,L]$"
#F, C, ComputeCurrentNodeCoordinates, , , void, , "ConstSizeVector<4>& qNode0, ConstSizeVector<4>& qNode1", CDI, "Compute node coordinates in current configuration including reference coordinates"
#F, C, ComputeCurrentNodeVelocities, , , void, , "ConstSizeVector<4>& qNode0, ConstSizeVector<4>& qNode1", CDI, "Compute node velocity coordinates in current configuration"
#F, C, ComputeCurrentObjectCoordinates,, , void, , "ConstSizeVector<8>& qANCF", CDI, "Compute object (finite element) coordinates in current configuration including reference coordinates"
#F, C, ComputeCurrentObjectVelocities, , , void, , "ConstSizeVector<8>& qANCF_t", CDI, "Compute object (finite element) velocities in current configuration"
#F, C, ComputeSlopeVector, , , Vector2D, , "Real x, ConfigurationType configuration", CDI, "compute the slope vector at a certain position, for given configuration"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, drawHeight, , , float, "0.f", , IO, "if beam is drawn with rectangular shape, this is the drawing height"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA color of the object; if R==-1, use default color"
#lateron: use this for cross-section definition: V, V, graphicsData, , , BodyGraphicsData, , , IO, "Structure contains data for body visualization; data is defined in special list / dictionary structure"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectALEANCFCable2D
classDescription = "A 2D cable finite element using 2 nodes of type NodePoint2DSlope1 and a axially moving coordinate of type NodeGenericODE2; the element has 8+1 coordinates and uses cubic polynomials for position interpolation; the element in addition to ANCFCable2D adds an Eulerian axial velocity by the GenericODE2 coordiante"
cParentClass = CObjectANCFCable2DBase
mainParentClass = MainObjectBody
visuParentClass = VisualizationObject
pythonShortName = ALECable2D
addProtectedC = " mutable bool massTermsALEComputed; //!< flag which shows that ALE mass terms have been computed; will be set to false at time when parameters are set\n mutable ConstSizeMatrix<nODE2Coordinates*nODE2Coordinates> preComputedM1, preComputedM2, preComputedB1, preComputedB2; //!< if massTermsALEComputed=true, this contains the constant mass terms for faster computation\n"
addIncludesC = '#include "Objects/CObjectANCFCable2DBase.h"\n'
outputVariables = "{'Position':'global position vector of local axis (1) and cross section (2) position', 'Displacement':'global displacement vector of local axis (1) and cross section (2) position', 'Velocity':'global velocity vector of local axis (1) and cross section (2) position', 'Director1':'(axial) slope vector of local axis position', 'Strain':'axial strain (scalar)', 'Curvature':'axial strain (scalar)', 'Force':'(local) section normal force (scalar)', 'Torque':'(local) bending moment (scalar)'}"
classType = Object
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "objects's unique name"
V, CP, physicsLength, , , UReal, "0.", , I, "reference length $L$ [SI:m] of beam; such that the total volume (e.g. for volume load) gives $\rho A L$"
V, CP, physicsMassPerLength, , , UReal, "0.", , I, "mass $\rho A$ [SI:kg/m$^2$] of beam"
V, CP, physicsMovingMassFactor, , , UReal, "1.", , I, "this factor denotes the amount of $\rho A$ which is moving; physicsMovingMassFactor=1 means, that all mass is moving; physicsMovingMassFactor=0 means, that no mass is moving; factor can be used to simulate e.g. pipe conveying fluid, in which $\rho A$ is the mass of the pipe+fluid, while $physicsMovingMassFactor \cdot \rho A$ is the mass per unit length of the fluid"
V, CP, physicsBendingStiffness, , , UReal, "0.", , I, "bending stiffness $EI$ [SI:Nm$^2$] of beam; the bending moment is $m = EI (\kappa - \kappa_0)$, in which $\kappa$ is the material measure of curvature"
V, CP, physicsAxialStiffness, , , UReal, "0.", , I, "axial stiffness $EA$ [SI:N] of beam; the axial force is $f_{ax} = EA (\varepsilon -\varepsilon_0)$, in which $\varepsilon = |\rv^\prime|-1$ is the axial strain"
V, CP, physicsBendingDamping, , , UReal, "0.", , I, "bending damping $d_{EI}$ [SI:Nm$^2$/s] of beam; the additional virtual work due to damping is $\delta W_{\dot \kappa} = \int_0^L \dot \kappa \delta \kappa dx$"
V, CP, physicsAxialDamping, , , UReal, "0.", , I, "axial stiffness $d_{EA}$ [SI:N/s] of beam; the additional virtual work due to damping is $\delta W_{\dot\varepsilon} = \int_0^L \dot \varepsilon \delta \varepsilon dx$"
V, CP, physicsReferenceAxialStrain, , , UReal, "0.", , I, "reference axial strain of beam (pre-deformation) $\varepsilon_0$ [SI:1] of beam; without external loading the beam will statically keep the reference axial strain value"
V, CP, physicsReferenceCurvature, , , UReal, "0.", , I, "reference curvature of beam (pre-deformation) $\kappa_0$ [SI:1/m] of beam; without external loading the beam will statically keep the reference curvature value"
V, CP, physicsUseCouplingTerms, , , bool, "true", , I, "true: correct case, where all coupling terms due to moving mass are respected; false: only include constant mass for ALE node coordinate, but deactivate other coupling terms (behaves like ANCFCable2D then)"
V, CP, nodeNumbers, , , Index3, "Index3({EXUstd::InvalidIndex, EXUstd::InvalidIndex, EXUstd::InvalidIndex})", , I, "two node numbers ANCF cable element, third node=ALE GenericODE2 node"
V, CP, useReducedOrderIntegration, , , Bool, false, , I, "false: use Gauss order 9 integration for virtual work of axial forces, order 5 for virtual work of bending moments; true: use Gauss order 7 integration for virtual work of axial forces, order 3 for virtual work of bending moments"
#access to parameters for Base class:
Fv, C, GetLength, , , Real, "return parameters.physicsLength;", , IC, "access to individual element paramters for base class functions"
Fv, C, GetMassPerLength, , , Real, "return parameters.physicsMassPerLength;", , IC, "access to individual element paramters for base class functions"
Fv, C, GetMaterialParameters, , , void, "physicsBendingStiffness = parameters.physicsBendingStiffness; physicsAxialStiffness = parameters.physicsAxialStiffness; physicsBendingDamping = parameters.physicsBendingDamping; physicsAxialDamping = parameters.physicsAxialDamping; physicsReferenceAxialStrain = parameters.physicsReferenceAxialStrain; physicsReferenceCurvature = parameters.physicsReferenceCurvature;", "Real& physicsBendingStiffness, Real& physicsAxialStiffness, Real& physicsBendingDamping, Real& physicsAxialDamping, Real& physicsReferenceAxialStrain, Real& physicsReferenceCurvature", IC, "access to individual element paramters for base class functions"
Fv, C, UseReducedOrderIntegration, , , Bool, "return parameters.useReducedOrderIntegration;", , IC, "access to useReducedOrderIntegration from derived class"
#
Fv, C, ComputeMassMatrix, , , void, , "Matrix& massMatrix", CDI, "Computational function: compute mass matrix"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::ODE2_ODE2 + JacobianType::ODE2_ODE2_t);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
#Fv, C, GetAccessFunctionTypes, , , AccessFunctionType,, , CDI, "Flags to determine, which access (forces, moments, connectors, ...) to object are possible"
#Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetAccessFunctionBody, , , void, , "AccessFunctionType accessType, const Vector3D& localPosition, Matrix& value", DC, "provide Jacobian at localPosition in 'value' according to object access"
#Fv, C, GetOutputVariableBody, , , void, , "OutputVariableType variableType, const Vector3D& localPosition, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'"
#Fv, C, GetPosition, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
#Fv, C, GetDisplacement, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetVelocity, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) velocity of 'localPosition' according to configuration type"
#Fv, C, GetRotationMatrix, , 9, Matrix3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Matrix, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
#Fv, C, GetAngularVelocity, , 3, Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, M, GetTypeName, , , const char*, "return 'ANCFALECable2D';" , , CI, "Get type name of object; could also be realized via a string -> type conversion?"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex <= 2);\n return parameters.nodeNumbers[localIndex];", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 3;", , CI, "number of nodes; needed for every object"
#Fv, C, GetODE2LocalToGlobalCoordinates,, , Index, , , CDI, "local to global coordinates of body --> not needed"
Fv, C, GetODE2Size, , , Index, "return nODE2Coordinates+1;", , CI, "number of ODE2 coordinates; needed for object?"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::_None;", , CI, "node types are checked in CheckPreAssembleConsistency(...);provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
#Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Body + (Index)CObjectType::MultiNoded);",, CI, "Get type of object, e.g. to categorize and distinguish during assembly and computation"
Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific object function ==> automatically generated in future?"
Fv, C, ParametersHaveChanged, , , void, "massTermsALEComputed = false; massMatrixComputed = false;", , I, "This flag is reset upon change of parameters; says that mass matrix (future: other pre-computed values) need to be recomputed"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#internal functions:
#Fs, C, MapCoordinates, , , Vector2D, , "const Vector4D& SV, const LinkedDataVector& q0, const LinkedDataVector& q1", DI, "map element coordinates (position or veloctiy level) given by nodal vectors q0 and q1 onto compressed shape function vector to compute position, etc."
#Fs, C, ComputeShapeFunctions, , , Vector4D, , "Real x, Real L", DI, "get compressed shape function vector $\Sm_v$, depending local position $x \in [0,L]$"
#Fs, C, ComputeShapeFunctions_x, , , Vector4D, , "Real x, Real L", DI, "get first derivative of compressed shape function vector $\frac{\partial \Sm_v}{\partial x}$, depending local position $x \in [0,L]$"
#Fs, C, ComputeShapeFunctions_xx, , , Vector4D, , "Real x, Real L", DI, "get second derivative of compressed shape function vector $\frac{\partial^2 \Sm_v}{\partial^2 x}$, depending local position $x \in [0,L]$"
#F, C, ComputeCurrentNodeCoordinates, , , void, , "ConstSizeVector<4>& qNode0, ConstSizeVector<4>& qNode1", CDI, "Compute node coordinates of current configuration including reference coordinates"
#F, C, ComputeCurrentNodeVelocities, , , void, , "ConstSizeVector<4>& qNode0, ConstSizeVector<4>& qNode1", CDI, "Compute node velocity coordinates of current configuration"
#F, C, ComputeSlopeVector, , , Vector2D, , "Real x, ConfigurationType configuration", CDI, "compute the slope vector at a certain position, for given configuration"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
V, V, drawHeight, , , float, "0.f", , IO, "if beam is drawn with rectangular shape, this is the drawing height"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA color of the object; if R==-1, use default color"
#lateron: use this for cross-section definition: V, V, graphicsData, , , BodyGraphicsData, , , IO, "Structure contains data for body visualization; data is defined in special list / dictionary structure"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectGround
classDescription = "A ground object behaving like a rigid body, but having no degrees of freedom; used to attach body-connectors without an action. For examples see spring dampers and joints."
cParentClass = CObjectBody
mainParentClass = MainObjectBody
visuParentClass = VisualizationObject
addProtectedC = " static constexpr Index nODE2Coordinates = 0;\n"
#keep this consistent with ObjectRigidBody for mutual usage of both objects:
outputVariables = "{'Position':'global position vector of rotated and translated local position', 'Displacement':'global displacement vector of local position', 'Velocity':'global velocity vector of local position', 'AngularVelocity':'angular velocity of body', 'RotationMatrix':'rotation matrix in vector form (stored in row-major order)'}"
classType = Object
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "objects's unique name"
V, CP, referencePosition, , 3, Vector3D, "Vector3D({0.,0.,0.})", , I, "reference position for ground object; local position is added on top of reference position for a ground object"
#add referenceOrientation Rotation matrix lateron!
#
Fv, C, ComputeMassMatrix, , , void, , "Matrix& massMatrix", CDI, "Computational function: compute mass matrix"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::_None);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetAccessFunctionTypes, , , AccessFunctionType,, , CDI, "Flags to determine, which access (forces, moments, connectors, ...) to object are possible"
#automatic now; Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetAccessFunctionBody, , , void, , "AccessFunctionType accessType, const Vector3D& localPosition, Matrix& value", DC, "provide Jacobian at localPosition in 'value' according to object access"
Fv, C, GetOutputVariableBody, , , void, , "OutputVariableType variableType, const Vector3D& localPosition, ConfigurationType configuration, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetPosition, , , Vector3D, , "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", DIC, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetDisplacement, , , Vector3D, "return Vector3D({ 0.,0.,0. });", "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CI, "return the (global) position of 'localPosition' according to configuration type"
Fv, C, GetVelocity, , , Vector3D, "return Vector3D({ 0.,0.,0. });", "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CI, "return the (global) velocity of 'localPosition' according to configuration type"
#use EXUmath::unitMatrix3D instead: Matrix3D(3,3,{1,0,0, 0,1,0, 0,0,1 })
Fv, C, GetRotationMatrix, , 9, Matrix3D, "return EXUmath::unitMatrix3D;", "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CI, "return configuration dependent rotation matrix of node; returns always a 3D Matrix, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocity, , 3, Vector3D, "return Vector3D({ 0.,0.,0. });", "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CI, "return configuration dependent angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetAngularVelocityLocal, , 3, Vector3D, "return Vector3D({ 0.,0.,0. });", "const Vector3D& localPosition, ConfigurationType configuration = ConfigurationType::Current", CI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector, independent of 2D or 3D object; for rigid bodies, the argument localPosition has no effect"
Fv, C, GetLocalCenterOfMass, , 3, Vector3D, "return Vector3D({0.,0.,0.});", , CI, "return the local position of the center of mass, needed for equations of motion and for massProportionalLoad -- not used for GroundObject"
#
Fv, M, GetTypeName, , , const char*, "return 'Ground';" , , CI, "Get type name of object; could also be realized via a string -> type conversion?"
Fv, C, GetNodeNumber, , , Index, "release_assert(0);\n return 0;", "Index localIndex", CI, "No nodenumber can be returned for ground object!"
Fv, C, GetNumberOfNodes, , , Index, "return 0;", , CI, "number of nodes; needed for every object"
Fv, C, GetODE2Size, , , Index, "return 0;", , CI, "number of ODE2 coordinates; needed for object?"
#as there are no node numbers, there is no check needed: Fv, M, GetRequestedNodeType, , , Node::Type, "return (Node::Type)(Node::Position2D + Node::Orientation2D);", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Body + (Index)CObjectType::Ground);",, CI, "Get type of object, e.g. to categorize and distinguish during assembly and computation"
Fv, M, CallFunction, , , py::object, , "STDstring functionName, py::dict args", CDI, "Call a specific object function ==> automatically generated in future?"
#
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, CallUserFunction, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, const MainSystem& mainSystem, Index itemNumber", DI, "user function which is called to update specific object graphics computed in python functions; this is rather slow, but useful for user elements"
Fv, V, HasUserFunction, , , bool, "return graphicsDataUserFunction!=0;", "", I, "return true, if object has a user function to be called during redraw"
V, V, graphicsDataUserFunction, , , PyFunctionGraphicsData, 0, , IO, "A python function which returns a bodyGraphicsData object, which is a list of graphics data in a dictionary computed by the user function"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGB node color; if R==-1, use default color"
V, V, graphicsData, , , BodyGraphicsData, , , IO, "Structure contains data for body visualization; data is defined in special list / dictionary structure"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectConnectorSpringDamper
classDescription = "An simple spring-damper element with additional force; connects to position-based markers."
cParentClass = CObjectConnector
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = SpringDamper
classType = Object
outputVariables = "{'Distance':'distance between both points', 'Displacement':'relative displacement between both points', 'Velocity':'relative velocity between both points', 'Force':'spring-damper force'}"
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
\vspace{6pt}\\
{\bf Definition of quantities}:
\startTable{input parameter}{symbol}{description}
\rowTable{referenceLength}{$L_0$}{}
\rowTable{stiffness}{$k$}{}
\rowTable{damping}{$d$}{}
\rowTable{force}{$f_{a}$}{additional force (e.g., actuator force)}
\rowTable{markerNumbers[0]}{$m0$}{global marker number m0}
\rowTable{markerNumbers[1]}{$m1$}{global marker number m1}
\finishTable
\startTable{intermediate variables}{symbol}{description}
\rowTable{marker m0 position}{$\LU{0}{\pv}_{m0}$}{current global position which is provided by marker m0}
\rowTable{marker m1 position}{$\LU{0}{\pv}_{m1}$}{}
\rowTable{marker m0 velocity}{$\LU{0}{\vv}_{m0}$}{current global velocity which is provided by marker m0}
\rowTable{marker m1 velocity}{$\LU{0}{\vv}_{m1}$}{}
\finishTable
\startTable{output variables}{symbol}{formula}
\rowTable{Distance}{$L$}{$|\Delta\! \LU{0}{\pv}|$}
\rowTable{Displacement}{$\Delta\! \LU{0}{\pv}$}{$\LU{0}{\pv}_{m1} - \LU{0}{\pv}_{m0}$}
\rowTable{Velocity}{$\Delta\! \LU{0}{\vv}$}{$\LU{0}{\vv}_{m1} - \LU{0}{\vv}_{m0}$}
\rowTable{Force}{$\fv$}{see below}
\finishTable
\noindent {\bf Connector equations}:
%Displacement between marker m0 to marker m1 positions,
%\be
% \Delta\! \LU{0}{\pv}= \LU{0}{\pv}_{m1} - \LU{0}{\pv}_{m0}
%\ee
%and relative velocity,
%\be
% \Delta\! \LU{0}{\vv}= \LU{0}{\vv}_{m1} - \LU{0}{\vv}_{m0}
%\ee
%With the current spring length (distance) $L = |\Delta\! \LU{0}{\pv}|$,
The unit vector in force direction reads (raises SysError if $L=0$),
\be
\vv_{f} = \frac{1}{L} \Delta\! \LU{0}{\pv}
\ee
If \texttt{activeConnector = True}, the scalar spring force is computed as
\be
f_{SD} = k\cdot(L-L_0) + d \cdot\Delta\! \LU{0}{\vv}\tp \vv_{f} + f_{a}
\ee
If the springForceUserFunction $\mathrm{UF}$ is defined, $\fv$ instead becomes ($t$ is current time)
\be
f_{SD} = \mathrm{UF}(t, L-L_0, \Delta\! \LU{0}{\vv}\tp \vv_{f}, k, d, f_{a})
\ee
if \texttt{activeConnector = False}, $f_{SD}$ is set to zero.:
The vector of the spring force applied at both markers finally reads
\be
\fv = f_{SD}\vv_{f}
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
miniExample =
node = mbs.AddNode(NodePoint(referenceCoordinates = [1.05,0,0]))
oMassPoint = mbs.AddObject(MassPoint(nodeNumber = node, physicsMass=1))
m0 = mbs.AddMarker(MarkerBodyPosition(bodyNumber=oGround, localPosition=[0,0,0]))
m1 = mbs.AddMarker(MarkerBodyPosition(bodyNumber=oMassPoint, localPosition=[0,0,0]))
mbs.AddObject(ObjectConnectorSpringDamper(markerNumbers=[m0,m1],
referenceLength = 1, #shorter than initial distance
stiffness = 100,
damping = 1))
#assemble and solve system for default parameters
mbs.Assemble()
SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', exu.SimulationSettings())
#check result at default integration time
testError = mbs.GetNodeOutput(node, exu.OutputVariableType.Position)[0] - 0.9736596225944887
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "connector's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "list of markers used in connector"
V, CP, referenceLength, , , UReal, 0., , I, "reference length [SI:m] of spring"
V, CP, stiffness, , , UReal, 0., , I, "stiffness [SI:N/m] of spring; acts against (length-initialLength)"
V, CP, damping, , , UReal, 0., , I, "damping [SI:N/(m s)] of damper; acts against d/dt(length)"
V, CP, force, , , UReal, 0., , IO, "added constant force [SI:N] of spring; scalar force; f=1 is equivalent to reducing initialLength by 1/stiffness; f > 0: tension; f < 0: compression"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#questionable if the functions should go into Parameter class:
V, CP, springForceUserFunction, , , PyFunctionScalar6, 0, , IO, "A python function which defines the spring force with parameters (time, deltaL, deltaL\_t, Real stiffness, Real damping, Real springForce); the parameters are provided to the function using the current values of the SpringDamper object; The python function will only be evaluated, if activeConnector is true, otherwise the SpringDamper is inactive; Example for python function: def f(t, u, v, k, d, F0): return k*u + d*v + F0"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, IsPenaltyConnector, , , Bool, "return true;", , CI, "connector uses penalty formulation"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs, const MarkerDataStructure& markerData", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, ComputeJacobianODE2_ODE2, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_ODE2_t, const MarkerDataStructure& markerData", CDI, "Computational function: compute Jacobian of ODE2 RHS equations w.r.t. ODE coordinates (jacobian) and if JacobianType::ODE2_ODE2_t flag is set in GetAvailableJacobians() compute jacobian w.r.t. ODE_t coordinates"
#Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::ODE2_ODE2+JacobianType::ODE2_ODE2_t);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::_None);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
#Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::Position;", , CI, "provide requested markerType for connector"
Fv, C, GetType, , , CObjectType,"return CObjectType::Connector;", , CI, "return object type (for node treatment in computation)"
#Fv, C, GetODE2Size, , , Index, , , CDI, "NEEDED? should be done during preprocessing ==> written in global list; number of ODE2 coordinates the connector is related to; depends on coordinates of marker objects/nodes"
Fv, M, GetTypeName, , , const char*,"return 'ConnectorSpringDamper';", , CI, "Get type name of node (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Vp, V, show, , , Bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = diameter of spring; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectConnectorCartesianSpringDamper
classDescription = "An 3D spring-damper element acting accordingly in three (global) directions (x,y,z) which connects to position-based markers."
cParentClass = CObjectConnector
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = CartesianSpringDamper
outputVariables = "{'Displacement':'$\Delta\! \LU{0}{\pv} = \LU{0}{\pv}_{m1} - \LU{0}{\pv}_{m0}$relative displacement in global coordinates', 'Distance':'$L=|\Delta\! \LU{0}{\pv}|$scalar distance between both marker points', 'Velocity':'$\Delta\! \LU{0}{\vv} = \LU{0}{\vv}_{m1} - \LU{0}{\vv}_{m0}$relative translational velocity in global coordinates', 'Force':'$\fv_{SD}$joint force in global coordinates, see equations'}"
classType = Object
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
\vspace{6pt}\\
{\bf Definition of quantities}:
\startTable{intermediate variables}{symbol}{description}
\rowTable{marker m0 position}{$\LU{0}{\pv}_{m0}$}{current global position which is provided by marker m0}
\rowTable{marker m1 position}{$\LU{0}{\pv}_{m1}$}{}
\rowTable{marker m0 velocity}{$\LU{0}{\vv}_{m0}$}{current global velocity which is provided by marker m0}
\rowTable{marker m1 velocity}{$\LU{0}{\vv}_{m1}$}{}
\finishTable
\noindent {\bf Connector equations}:
Displacement between marker m0 to marker m1 positions,
\be
\Delta\! \LU{0}{\pv}= \LU{0}{\pv}_{m1} - \LU{0}{\pv}_{m0}
\ee
and relative velocity,
\be
\Delta\! \LU{0}{\vv}= \LU{0}{\vv}_{m1} - \LU{0}{\vv}_{m0}
\ee
If \texttt{activeConnector = True}, the spring force vector is computed as
\be
\fv_{SD} = \left(\kv\cdot(\Delta\! \LU{0}{\pv}-\vv_{\mathrm{off}}) + \dv \Delta\! \LU{0}{\vv} \right)
\ee
If the springForceUserFunction $\mathrm{UF}$ is defined, $\fv_{SD}$ instead becomes ($t$ is current time)
\be
\fv_{SD} = \mathrm{UF}(t, \Delta\! \LU{0}{\pv}, \Delta\! \LU{0}{\vv}, \kv, \dv, \vv_{\mathrm{off}})
\ee
if \texttt{activeConnector = False}, $\fv_{SD}$ is set to zero.
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
miniExample =
#example with mass at [1,1,0], 5kg under load 5N in -y direction
k=5000
nMass = mbs.AddNode(NodePoint(referenceCoordinates=[1,1,0]))
oMass = mbs.AddObject(MassPoint(physicsMass = 5, nodeNumber = nMass))
mMass = mbs.AddMarker(MarkerNodePosition(nodeNumber=nMass))
mGround = mbs.AddMarker(MarkerBodyPosition(bodyNumber=oGround, localPosition = [1,1,0]))
mbs.AddObject(CartesianSpringDamper(markerNumbers = [mGround, mMass],
stiffness = [k,k,k],
damping = [0,k*0.05,0], offset = [0,0,0]))
mbs.AddLoad(Force(markerNumber = mMass, loadVector = [0, -5, 0])) #static solution=-5/5000=-0.001m
#assemble and solve system for default parameters
mbs.Assemble()
SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', exu.SimulationSettings())
#check result at default integration time
testError = mbs.GetNodeOutput(nMass, exu.OutputVariableType.Displacement)[1] - (-0.00099999999997058)
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "connector's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "$[m0,m1]\tp$list of markers used in connector"
V, CP, stiffness, , , Vector3D, "Vector3D({0.,0.,0.})", , I, "$\kv$stiffness [SI:N/m] of springs; act against relative displacements in 0, 1, and 2-direction"
V, CP, damping, , , Vector3D, "Vector3D({0.,0.,0.})", , IO, "$\dv$damping [SI:N/(m s)] of dampers; act against relative velocities in 0, 1, and 2-direction"
V, CP, offset, , , Vector3D, "Vector3D({0.,0.,0.})", , IO, "$\vv_{\mathrm{off}}$offset between two springs"
V, CP, springForceUserFunction, , , PyFunctionVector3DScalar5Vector3D, 0, , IO, "A python function which computes the 3D force vector between the two marker points, if activeConnector=True; The function takes the relative displacement (3D) vector (m1.position-m0.position, etc.) and the relative velocity vector (3D), the spring striffness vector 3D, damping and offset parameter vectors (3D): f(time, displacement, velocity, stiffness, damping, offset); Example for python function: def f(t, u, v, k, d, offset): return [u[0]*k[0],u[1]*k[1],u[2]*k[2]]"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, IsPenaltyConnector, , , Bool, "return true;", , CI, "connector uses penalty formulation"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs, const MarkerDataStructure& markerData", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, ComputeJacobianODE2_ODE2, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_ODE2_t, const MarkerDataStructure& markerData", CDI, "Computational function: compute Jacobian of ODE2 RHS equations w.r.t. ODE coordinates (jacobian) and if JacobianType::ODE2_ODE2_t flag is set in GetAvailableJacobians() compute jacobian w.r.t. ODE_t coordinates"
#Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
#Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::Position;", , CI, "provide requested markerType for connector"
Fv, C, GetType, , , CObjectType,"return CObjectType::Connector;", , CI, "return object type (for node treatment in computation)"
F, C, ComputeSpringForce, , , void, , "const MarkerDataStructure& markerData, const CObjectConnectorCartesianSpringDamperParameters& parameters, Vector3D& vPos, Vector3D& vVel, Vector3D& fVec", CDI, "compute spring damper force helper function"
#Fv, C, GetODE2Size, , , Index, , , CDI, "NEEDED? should be done during preprocessing ==> written in global list; number of ODE2 coordinates the connector is related to; depends on coordinates of marker objects/nodes"
Fv, M, GetTypeName, , , const char*,"return 'ConnectorCartesianSpringDamper';", , CI, "Get type name of node (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , Bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = diameter of spring; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectConnectorRigidBodySpringDamper
classDescription = "An 3D spring-damper element acting on relative displacements and relative rotations of two rigid body (position+orientation) markers; connects to (position+orientation)-based markers and represents a penalty-based rigid joint (or prismatic, revolute, etc.)"
#; the resulting force in the spring-damper reads ($m0 = marker[0]$ and $m1 = marker[1]$): \be force_x = (A0loc \cdot A0) \cdot stiffness_x \cdot (A0loc \cdot A0)^T(m1.position_x - m0.position_x - offset_x) + (A0loc \cdot A0) \cdot damping_x \cdot (A0loc \cdot A0)^T (m1.velocity_x - m0.velocity_x), etc. \ee and accordingly for rotation coordinates, which act on $(rotationMarker0 \cdot Rxyz0)^T \cdot (rotationMarker1 \cdot Rxyz1) $ rotations (0...rotation of marker0, 1...rotation of marker1).
cParentClass = CObjectConnector
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = RigidBodySpringDamper
#addIncludesC = '#include "Linalg/BasicLinalg.h"\n'
outputVariables = "{'DisplacementLocal':'$\LU{J0}{\Delta\pv}$relative displacement in local joint0 coordinates', 'VelocityLocal':'$\LU{J0}{\Delta\vv}$relative translational velocity in local joint0 coordinates', 'Rotation':'$\LU{J0}{\ttheta}= [\theta_0,\theta_1,\theta_2]\tp$relative rotation parameters (Tait Bryan Rxyz); these are the angles used for calculation of joint torques (e.g. if cX is the diagonal rotational stiffness, the moment for axis X reads mX=cX*phiX, etc.)', 'AngularVelocityLocal':'$\LU{J0}{\Delta\tomega}$relative angular velocity in local joint0 coordinates', 'ForceLocal':'$\LU{J0}{\fv}$joint force in local joint0 coordinates', 'TorqueLocal':'$\LU{J0}{\mv}$joint torque in in local joint0 coordinates'}"
classType = Object
equations =
\vspace{6pt}\\
{\bf Definition of quantities}:
\startTable{input parameter}{symbol}{description}
\rowTable{stiffness}{$\kv \in \mathbb{R}^{6\times 6}$}{stiffness in $J0$ coordinates}
\rowTable{damping}{$\dv \in \mathbb{R}^{6\times 6}$}{damping in $J0$ coordinates}
\rowTable{offset}{$\LUR{J0}{\vv}{\mathrm{off}} \in \mathbb{R}^{6}$}{offset in $J0$ coordinates}
\rowTable{rotationMarker0}{$\LU{m0,J0}{\Rot}$}{rotation matrix which transforms from joint 0 into marker 0 coordinates}
\rowTable{rotationMarker1}{$\LU{m1,J1}{\Rot}$}{rotation matrix which transforms from joint 1 into marker 1 coordinates}
\rowTable{markerNumbers[0]}{$m0$}{global marker number m0}
\rowTable{markerNumbers[1]}{$m1$}{global marker number m1}
\finishTable
\startTable{intermediate variables}{symbol}{description}
\rowTable{marker m0 position}{$\LU{0}{\pv}_{m0}$}{current global position which is provided by marker m0}
\rowTable{marker m0 orientation}{$\LU{0,m0}{\Rot}$}{current rotation matrix provided by marker m0}
\rowTable{marker m1 position}{$\LU{0}{\pv}_{m1}$}{accordingly}
\rowTable{marker m1 orientation}{$\LU{0,m1}{\Rot}$}{current rotation matrix provided by marker m1}
%
\rowTable{marker m0 velocity}{$\LU{0}{\vv}_{m0}$}{current global velocity which is provided by marker m0}
\rowTable{marker m1 velocity}{$\LU{0}{\vv}_{m1}$}{accordingly}
\rowTable{marker m0 velocity}{$\LU{b}{\tomega}_{m0}$}{current local angular velocity vector provided by marker m0}
\rowTable{marker m1 velocity}{$\LU{b}{\tomega}_{m1}$}{current local angular velocity vector provided by marker m1}
\rowTable{Displacement}{$\LU{0}{\Delta\pv}$} {$\LU{0}{\pv}_{m1} - \LU{0}{\pv}_{m0}$}
\rowTable{Velocity}{$\LU{0}{\Delta\vv}$}{$\LU{0}{\vv}_{m1} - \LU{0}{\vv}_{m0}$}
%definition how output variables are computed:
\rowTable{DisplacementLocal}{$\LU{J0}{\Delta\pv}$}{$\left(\LU{0,m0}{\Rot}\LU{m0,J0}{\Rot}\right)\tp \LU{0}{\Delta\pv}$}
\rowTable{VelocityLocal}{$\LU{J0}{\Delta\vv}$}{$\left(\LU{0,m0}{\Rot}\LU{m0,J0}{\Rot}\right)\tp \LU{0}{\Delta\vv}$}
%
\rowTable{AngularVelocityLocal}{$\LU{J0}{\Delta\tomega}$}{$\left(\LU{0,m0}{\Rot}\LU{m0,J0}{\Rot}\right)\tp \left( \LU{0,m1}{\Rot} \LU{m1}{\tomega} - \LU{0,m0}{\Rot} \LU{m0}{\tomega} \right)$}
%\rowTable{Rotation}{$\LU{J0}{\ttheta} = [\theta_0,\theta_1,\theta_2]$}{Tait-Bryan angles retrieved from relative rotation matrix, ...}
%\rowTable{ForceLocal}{$\LU{J0}{\fv}$}{see below}
%\rowTable{TorqueLocal}{$\LU{J0}{\mv}$}{see below}
\finishTable
\noindent {\bf Connector equations}:
If \texttt{activeConnector = True}, the vector spring force is computed as
\be
\vp{\LU{J0}{\fv_{SD}}}{\LU{J0}{\mv_{SD}}} = \kv \left( \vp{\LU{J0}{\Delta\pv}}{\LU{J0}{\ttheta}} - \LUR{J0}{\vv}{\mathrm{off}}\right) +
\dv \vp{\LU{J0}{\Delta\vv}}{\LU{J0}{\Delta\omega}}
\ee
For the application of joint forces to markers, $[\LU{J0}{\fv_{SD}},\,\LU{J0}{\mv_{SD}}]\tp$ is transformed into global coordinates.
if \texttt{activeConnector = False}, $\LU{J0}{\fv_{SD}}$ and $\LU{J0}{\mv_{SD}}$ are set to zero.
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "connector's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "list of markers used in connector"
V, CP, stiffness, , , Matrix6D, "Matrix6D(6,6,0.)", , I, "stiffness [SI:N/m or Nm/rad] of translational, torsional and coupled springs; act against relative displacements in x, y, and z-direction as well as the relative angles (calculated as Euler angles); in the simplest case, the first 3 diagonal values correspond to the local stiffness in x,y,z direction and the last 3 diagonal values correspond to the rotational stiffness around x,y and z axis"
V, CP, damping, , , Matrix6D, "Matrix6D(6,6,0.)", , I, "damping [SI:N/(m/s) or Nm/(rad/s)] of translational, torsional and coupled dampers; very similar to stiffness, however, the rotational velocity is computed from the angular velocity vector"
V, CP, rotationMarker0, , , Matrix3D, "EXUmath::unitMatrix3D", , I, "local rotation matrix for marker 0; stiffness, damping, etc. components are measured in local coordinates relative to rotationMarker0"
V, CP, rotationMarker1, , , Matrix3D, "EXUmath::unitMatrix3D", , I, "local rotation matrix for marker 1; stiffness, damping, etc. components are measured in local coordinates relative to rotationMarker1"
#V, CP, damping, , , Vector3D, "Vector3D({0.,0.,0.})", , IO, "damping [SI:N/(m s)] of dampers; act against relative velocities in x, y, and z-direction"
V, CP, offset, , , Vector6D, "Vector6D({0.,0.,0.,0.,0.,0.})", , IO, "translational and rotational offset considered in the spring force calculation"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, IsPenaltyConnector, , , Bool, "return true;", , CI, "connector uses penalty formulation"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs, const MarkerDataStructure& markerData", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, ComputeJacobianODE2_ODE2, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_ODE2_t, const MarkerDataStructure& markerData", CDI, "Computational function: compute Jacobian of ODE2 RHS equations w.r.t. ODE coordinates (jacobian) and if JacobianType::ODE2_ODE2_t flag is set in GetAvailableJacobians() compute jacobian w.r.t. ODE_t coordinates"
#Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::ODE2_ODE2+JacobianType::ODE2_ODE2_t);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return (Marker::Type)((Index)Marker::Position + (Index)Marker::Orientation);", , CI, "provide requested markerType for connector"
Fv, C, GetType, , , CObjectType,"return CObjectType::Connector;", , CI, "return object type (for node treatment in computation)"
#Fv, C, GetODE2Size, , , Index, , , CDI, "NEEDED? should be done during preprocessing ==> written in global list; number of ODE2 coordinates the connector is related to; depends on coordinates of marker objects/nodes"
Fv, M, GetTypeName, , , const char*,"return 'ConnectorRigidBodySpringDamper';", , CI, "Get type name of node (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , Bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = diameter of spring; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectConnectorCoordinateSpringDamper
classDescription = "A 1D (scalar) spring-damper element acting on single ODE2 coordinates; connects to coordinate-based markers; NOTE that the coordinate markers only measure the coordinate (=displacement), but the reference position is not included as compared to position-based markers!; the spring-damper can also act on rotational coordinates."
cParentClass = CObjectConnector
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = CoordinateSpringDamper
classType = Object
outputVariables = "{'Displacement':'$\Delta q$relative scalar displacement of marker coordinates', 'Velocity':'$\Delta v$difference of scalar marker velocity coordinates', 'Force':'$f_{SD}$scalar spring force'}"
classType = Object
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
\vspace{6pt}\\
{\bf Definition of quantities}:
\startTable{intermediate variables}{symbol}{description}
\rowTable{marker m0 coordinate}{$q_{m0}$}{current displacement coordinate which is provided by marker m0; does NOT include reference coordinate!}
\rowTable{marker m1 coordinate}{$q_{m1}$}{}
\rowTable{marker m0 velocity coordinate}{$v_{m0}$}{current velocity coordinate which is provided by marker m0}
\rowTable{marker m1 velocity coordinate}{$v_{m1}$}{}
\finishTable
\noindent {\bf Connector equations}:
Displacement between marker m0 to marker m1 coordinates (does NOT include reference coordinates),
\be
\Delta q= q_{m1} - q_{m0}
\ee
and relative velocity,
\be
\Delta v= v_{m1} - v_{m0}
\ee
If $f_\mu > 0$, the friction force is computed as
\be
f_\mathrm{friction} = \left\{
\begin{aligned} \mathrm{Sgn}(\Delta v) \cdot f_\mu \quad \mathrm{if} \quad |\Delta v| \ge v_\mu \\
\frac{\Delta v}{v_\mu} f_\mu \quad \mathrm{if} \quad |\Delta v| < v_\mu
\end{aligned} \right.
\ee
If \texttt{activeConnector = True}, the scalar spring force vector is computed as
\be
f_{SD} = k \left( \Delta q - l_\mathrm{off} \right) + d \cdot \Delta v + f_\mathrm{friction}
\ee
If the springForceUserFunction $\mathrm{UF}$ is defined, $\fv_{SD}$ instead becomes ($t$ is current time)
\be
f_{SD} = \mathrm{UF}(t, \Delta q, \Delta v, k, d, l_\mathrm{off}, f_\mu, v_\mu)
\ee
if \texttt{activeConnector = False}, $f_{SD}$ is set to zero.
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
miniExample =
def springForce(t, u, v, k, d, offset, frictionForce, frictionProportionalZone):
return 0.1*k*u+k*u**3+v*d
nMass=mbs.AddNode(Point(referenceCoordinates = [2,0,0]))
massPoint = mbs.AddObject(MassPoint(physicsMass = 5, nodeNumber = nMass))
groundMarker=mbs.AddMarker(MarkerNodeCoordinate(nodeNumber= nGround, coordinate = 0))
nodeMarker =mbs.AddMarker(MarkerNodeCoordinate(nodeNumber= nMass, coordinate = 0))
#Spring-Damper between two marker coordinates
mbs.AddObject(CoordinateSpringDamper(markerNumbers = [groundMarker, nodeMarker],
stiffness = 5000, damping = 80, springForceUserFunction = springForce))
loadCoord = mbs.AddLoad(LoadCoordinate(markerNumber = nodeMarker, load = 1)) #static linear solution:0.002
#assemble and solve system for default parameters
mbs.Assemble()
SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', exu.SimulationSettings())
#check result at default integration time
testError = mbs.GetNodeOutput(nMass, exu.OutputVariableType.Displacement)[0] - 0.0019995158325691875
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "connector's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "list of markers used in connector"
V, CP, stiffness, , , Real, "0.", , I, "$k$stiffness [SI:N/m] of spring; acts against relative value of coordinates"
V, CP, damping, , , Real, "0.", , IO, "$d$damping [SI:N/(m s)] of damper; acts against relative velocity of coordinates"
V, CP, offset, , , Real, "0.", , IO, "$l_\mathrm{off}$offset between two coordinates (reference length of springs), see equation"
V, CP, dryFriction, , , Real, "0.", , IO, "$f_\mu$dry friction force [SI:N] against relative velocity; assuming a normal force $f_N$, the friction force can be interpreted as $f_\mu = \mu f_N$"
V, CP, dryFrictionProportionalZone, , , Real, "0.", , IO, "$v_\mu$limit velocity [m/s] up to which the friction is proportional to velocity (for regularization / avoid numerical oscillations)"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
V, CP, springForceUserFunction, , , PyFunctionScalar8, 0, , IO, "A python function which defines the spring force with 8 parameters, see equations section; Example for python function: def f(t, u, v, k, d, offset, frictionForce, frictionProportionalZone): return k*(u-offset) + d*v"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, IsPenaltyConnector, , , Bool, "return true;", , CI, "connector uses penalty formulation"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs, const MarkerDataStructure& markerData", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, ComputeJacobianODE2_ODE2, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_ODE2_t, const MarkerDataStructure& markerData", CDI, "Computational function: compute Jacobian of ODE2 RHS equations w.r.t. ODE coordinates (jacobian) and if JacobianType::ODE2_ODE2_t flag is set in GetAvailableJacobians() compute jacobian w.r.t. ODE_t coordinates"
#Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::ODE2_ODE2+JacobianType::ODE2_ODE2_t);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::Coordinate;", , CI, "provide requested markerType for connector"
Fv, C, GetType, , , CObjectType,"return CObjectType::Connector;", , CI, "return object type (for node treatment in computation)"
#Fv, C, GetODE2Size, , , Index, , , CDI, "NEEDED? should be done during preprocessing ==> written in global list; number of ODE2 coordinates the connector is related to; depends on coordinates of marker objects/nodes"
Fv, M, GetTypeName, , , const char*,"return 'ConnectorCoordinateSpringDamper';", , CI, "Get type name of node (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , Bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = diameter of spring; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectConnectorDistance
classDescription = "Connector which enforces constant or prescribed distance between two bodies/nodes."
cParentClass = CObjectConstraint
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = DistanceConstraint
classType = Object
outputVariables = "{'Displacement':'$\LU{0}{\Delta\pv}$relative displacement in global coordinates', 'Velocity':'$\LU{0}{\Delta\vv}$relative translational velocity in global coordinates', 'Distance':'$|\LU{0}{\Delta\pv}|$distance between markers (should stay constant; shows constraint deviation)', 'Force':'$\lambda_0$joint force in global coordinates'}"
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
{\bf Definition of quantities}:
\startTable{intermediate variables}{symbol}{description}
\rowTable{marker m0 position}{$\LU{0}{\pv}_{m0}$}{current global position which is provided by marker m0}
\rowTable{marker m1 position}{$\LU{0}{\pv}_{m1}$}{accordingly}
%
\rowTable{marker m0 velocity}{$\LU{0}{\vv}_{m0}$}{current global velocity which is provided by marker m0}
\rowTable{marker m1 velocity}{$\LU{0}{\vv}_{m1}$}{accordingly}
\rowTable{relative displacement}{$\LU{0}{\Delta\pv}$} {$\LU{0}{\pv}_{m1} - \LU{0}{\pv}_{m0}$}
\rowTable{relative velocity}{$\LU{0}{\Delta\vv}$}{$\LU{0}{\vv}_{m1} - \LU{0}{\vv}_{m0}$}
%
\rowTable{algebraicVariable}{$\lambda_0$}{Lagrange multiplier = force in constraint}
\finishTable
\noindent {\bf Algebraic constraint equations}:
If \texttt{activeConnector = True}, the index 3 algebraic equation reads
\be
\left|\LU{0}{\Delta\pv}\right| - d_0 = 0
\ee
The index 2 (velocity level) algebraic equation reads
\be
\left(\frac{\LU{0}{\Delta\pv}}{\left|\LU{0}{\Delta\pv}\right|}\right)\tp \Delta\vv = 0
\ee
if \texttt{activeConnector = False}, the algebraic equation reads
\be
\lambda_0 = 0
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
miniExample =
#example with 1m pendulum, 50kg under gravity
nMass = mbs.AddNode(NodePoint2D(referenceCoordinates=[1,0]))
oMass = mbs.AddObject(MassPoint2D(physicsMass = 50, nodeNumber = nMass))
mMass = mbs.AddMarker(MarkerNodePosition(nodeNumber=nMass))
mGround = mbs.AddMarker(MarkerBodyPosition(bodyNumber=oGround, localPosition = [0,0,0]))
oDistance = mbs.AddObject(DistanceConstraint(markerNumbers = [mGround, mMass], distance = 1))
mbs.AddLoad(Force(markerNumber = mMass, loadVector = [0, -50*9.81, 0]))
#assemble and solve system for default parameters
mbs.Assemble()
sims=exu.SimulationSettings()
sims.timeIntegration.generalizedAlpha.spectralRadius=0.7
SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', sims)
#check result at default integration time
testError = mbs.GetNodeOutput(nMass, exu.OutputVariableType.Position)[0] - (-0.9845225086606828)
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "constraints's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "$[m0,m1]\tp$list of markers used in connector"
V, CP, distance, , , UReal, 0., , I, "$d_0$prescribed distance [SI:m] of the used markers"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, IsPenaltyConnector, , , Bool, "return false;", , CI, "constraints uses Lagrance multiplier formulation"
#Fv, C, HasVelocityEquations, , , Bool, "return true;", , CI, "constraint also implements velocity level equations"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, const MarkerDataStructure& markerData, Real t, bool velocityLevel = false", CDI, "Computational function: compute algebraic equations and write residual into 'algebraicEquations'; velocityLevel: equation provided at velocity level"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE, const MarkerDataStructure& markerData, Real t", CDI, "compute derivative of algebraic equations w.r.t. ODE2 in jacobian [and w.r.t. ODE2_t coordinates in jacobian_t if flag ODE2_t_AE_function is set] [and w.r.t. AE coordinates if flag AE_AE_function is set in GetAvailableJacobians()]; jacobian[_t] has dimension GetAlgebraicEquationsSize() x (GetODE2Size() + GetODE1Size() [+GetAlgebraicEquationsSize()]); q are the system coordinates; markerData provides according marker information to compute jacobians"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, , , CDI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags; available jacobians is switched depending on velocity level and on activeConnector condition"
#Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::Position;", , CI, "provide requested markerType for connector"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Connector + (Index)CObjectType::Constraint);", , CI, "return object type (for node treatment in computation)"
Fv, C, GetAlgebraicEquationsSize, , , Index, "return 1;", , CI, "number of algebraic equations; independent of node/body coordinates"
Fv, M, GetTypeName, , , const char*,"return 'ConnectorDistance';", , CI, "Get type name of object (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = link size; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectConnectorCoordinate
classDescription = "A coordinate constraint which constrains two (scalar) coordinates of Marker[Node|Body]Coordinates attached to nodes or bodies. The constraint acts directly on coordinates, but does not include reference values, e.g., of nodal values."
# The constraint must fulfill the condition: \be factorValue1*marker[1].value-marker[0].value - offset = 0 \ee
cParentClass = CObjectConstraint
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = CoordinateConstraint
classType = Object
outputVariables = "{'Displacement':'$\Delta q$relative scalar displacement of marker coordinates, not including factorValue1', 'Velocity':'$\Delta v$difference of scalar marker velocity coordinates, not including factorValue1', 'ConstraintEquation':'$\cv$(residuum of) constraint equation', 'Force':'$\lambda_0$scalar constraint force (Lagrange multiplier)'}"
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
{\bf Definition of quantities}:
\startTable{intermediate variables}{symbol}{description}
\rowTable{marker m0 coordinate}{$q_{m0}$}{current displacement coordinate which is provided by marker m0; does NOT include reference coordinate!}
\rowTable{marker m1 coordinate}{$q_{m1}$}{}
\rowTable{marker m0 velocity coordinate}{$v_{m0}$}{current velocity coordinate which is provided by marker m0}
\rowTable{marker m1 velocity coordinate}{$v_{m1}$}{}
\rowTable{difference of coordinates}{$\Delta q = q_{m1} - q_{m0}$}{Displacement between marker m0 to marker m1 coordinates (does NOT include reference coordinates)}
\rowTable{difference of velocity coordinates}{$\Delta v= v_{m1} - v_{m0}$}{}
\finishTable
\noindent {\bf Algebraic constraint equations}:
If \texttt{activeConnector = True}, the index 3 algebraic equation reads
\be
\cv(q_{m0}, q_{m1}) = k_{m1} \cdot q_{m1} - q_{m0} - l_\mathrm{off} = 0
\ee
If the offsetUserFunction $\mathrm{UF}$ is defined, $\cv$ instead becomes ($t$ is current time)
\be
\cv(q_{m0}, q_{m1}) = k_{m1} \cdot q_{m1} - q_{m0} - \mathrm{UF}(t,l_\mathrm{off}) = 0
\ee
The \texttt{activeConnector = True}, index 2 (velocity level) algebraic equation reads
\be
\dot \cv(\dot q_{m0}, \dot q_{m1}) = k_{m1} \cdot \dot q_{m1} - \dot q_{m0} - d = 0
\ee
The factor $d$ in velocity level equations is zero, except if parameters.velocityLevel = True, then $d=l_\mathrm{off}$.
If velocity level constraints are active and the velocity level offsetUserFunction\_t $\mathrm{UF}_t$ is defined, $\dot \cv$ instead becomes ($t$ is current time)
\be
\dot \cv(\dot q_{m0}, \dot q_{m1}) = k_{m1} \cdot \dot q_{m1} - \dot q_{m0} - \mathrm{UF}_t(t,l_\mathrm{off}) = 0
\ee
Note that the index 2 equations are used, if the solver uses index 2 formulation OR if the flag parameters.velocityLevel = True (or both).
The user functions include dependency on time $t$, but this time dependency is not respected in the computation of initial accelerations. Therefore,
it is recommended that $\mathrm{UF}$ and $\mathrm{UF}_t$ does not include initial accelerations.
If \texttt{activeConnector = False}, the (index 1) algebraic equation reads for ALL cases:
\be
\cv(\lambda_0) = \lambda_0 = 0
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
miniExample =
def OffsetUF(t, lOffset): #gives 0.05 at t=1
return 0.5*(1-np.cos(2*3.141592653589793*0.25*t))*lOffset
nMass=mbs.AddNode(Point(referenceCoordinates = [2,0,0]))
massPoint = mbs.AddObject(MassPoint(physicsMass = 5, nodeNumber = nMass))
groundMarker=mbs.AddMarker(MarkerNodeCoordinate(nodeNumber= nGround, coordinate = 0))
nodeMarker =mbs.AddMarker(MarkerNodeCoordinate(nodeNumber= nMass, coordinate = 0))
#Spring-Damper between two marker coordinates
mbs.AddObject(CoordinateConstraint(markerNumbers = [groundMarker, nodeMarker],
offset = 0.1, offsetUserFunction = OffsetUF))
#assemble and solve system for default parameters
mbs.Assemble()
SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', exu.SimulationSettings())
#check result at default integration time
testError = mbs.GetNodeOutput(nMass, exu.OutputVariableType.Displacement)[0] - 0.049999999999272404
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "constraints's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "$[m0,m1]\tp$list of markers used in connector"
V, CP, offset, , , UReal, 0., , I, "$l_\mathrm{off}$An offset between the two values"
V, CP, factorValue1, , , UReal, 1., , I, "$k_{m1}$An additional factor multiplied with value1 used in algebraic equation"
V, CP, velocityLevel, , , bool, false, , I, "If true: connector constrains velocities (only works for ODE2 coordinates!); offset is used between velocities; in this case, the offsetUserFunction\_t is considered and offsetUserFunction is ignored"
V, CP, offsetUserFunction, , , PyFunctionScalar2, 0, , IO, "$\mathrm{UF}(t,l_\mathrm{off})$A python function which defines the time-dependent offset; it is highly RECOMMENDED to use sufficiently smooth functions, having consistent initial offsets with initial configuration of bodies, zero or compatible initial offset-velocity, and no accelerations; Example for python function: def UF(t, l\_offset): return l\_offset*(1-np.cos(t*10*2*np.pi))"
V, CP, offsetUserFunction_t, , , PyFunctionScalar2, 0, , IO, "$\mathrm{UF}_t(t,l_\mathrm{off})$time derivative of offsetUserFunction; needed for 'velocityLevel=True', or for index2 time integration and for computation of initial accelerations in SecondOrderImplicit integrators"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, IsPenaltyConnector, , , Bool, "return false;", , CI, "constraints uses Lagrance multiplier formulation"
Fv, C, IsTimeDependent, , , bool, "return (parameters.offsetUserFunction != 0 || parameters.offsetUserFunction_t != 0);", , CI, "connector is time dependent if user functions are defined"
#Fv, C, HasVelocityEquations, , , Bool, "return true;", , CI, "constraint also implements velocity level equations"
Fv, C, UsesVelocityLevel, , , Bool, "return parameters.velocityLevel;", , CI, "Return true, if constraint currently is formulated at velocity level (e.g. coordinate constraint ==> this information is needed for correct jacobian computation)"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, const MarkerDataStructure& markerData, Real t, bool velocityLevel = false", CDI, "Computational function: compute algebraic equations and write residual into 'algebraicEquations'; velocityLevel: equation provided at velocity level"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE, const MarkerDataStructure& markerData, Real t", CDI, "compute derivative of algebraic equations w.r.t. ODE2 in jacobian [and w.r.t. ODE2_t coordinates in jacobian_t if flag ODE2_t_AE_function is set] [and w.r.t. AE coordinates if flag AE_AE_function is set in GetAvailableJacobians()]; jacobian[_t] has dimension GetAlgebraicEquationsSize() x (GetODE2Size() + GetODE1Size() [+GetAlgebraicEquationsSize()]); q are the system coordinates; markerData provides according marker information to compute jacobians"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, , , CDI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags; available jacobians is switched depending on velocity level and on activeConnector condition"
#Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
#Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::Coordinate;", , CI, "provide requested markerType for connector"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Connector + (Index)CObjectType::Constraint);", , CI, "return object type (for node treatment in computation)"
Fv, C, GetAlgebraicEquationsSize, , , Index, "return 1;", , CI, "number of algebraic equations; independent of node/body coordinates"
Fv, M, GetTypeName, , , const char*,"return 'ConnectorCoordinate';", , CI, "Get type name of object (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = link size; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectConnectorCoordinateVector
classDescription = "A constraint which constrains the coordinate vectors of two markers Marker[Node|Object|Body]Coordinates attached to nodes or bodies. The marker uses the objects LTG-lists to build the according coordinate mappings."
# The constraint must fulfill the condition: \be factorValue1*marker[1].value-marker[0].value - offset = 0 \ee
cParentClass = CObjectConstraint
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = CoordinateVectorConstraint
classType = Object
outputVariables = "{'Displacement':'$\Delta \qv$relative scalar displacement of marker coordinates, not including scaling matrices', 'Velocity':'$\Delta \vv$difference of scalar marker velocity coordinates, not including scaling matrices', 'ConstraintEquation':'$\cv$(residuum of) constraint equations', 'Force':'$\tlambda$constraint force vector (vector of Lagrange multipliers), resulting from action of constraint equations'}"
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
{\bf Definition of quantities}:
\startTable{intermediate variables}{symbol}{description}
\rowTable{marker m0 coordinate vector}{$\qv_{m0} \in \Rcal^{n_{q_{m0}}}$}{coordinate vector provided by marker $m0$; depending on the marker, the coordinates may or may not include reference coordinates}
\rowTable{marker m1 coordinate vector}{$\qv_{m1} \in \Rcal^{n_{q_{m1}}}$}{coordinate vector provided by marker $m1$; depending on the marker, the coordinates may or may not include reference coordinates}
\rowTable{marker m0 velocity coordinate vector}{$\dot \qv_{m0} \in \Rcal^{n_{q_{m0}}}$}{velocity coordinate vector provided by marker $m0$}
\rowTable{marker m1 velocity coordinate vector}{$\dot \qv_{m1} \in \Rcal^{n_{q_{m1}}}$}{velocity coordinate vector provided by marker $m1$}
\rowTable{number of algebraic equations}{$n_{ae}$}{number of algebraic equations must be same as number of rows in $\Xm_{m0}$ and $\Xm_{m1}$}
%
\rowTable{difference of coordinates}{$\Delta \qv = \qv_{m1} - \qv_{m0}$}{Displacement between marker m0 to marker m1 coordinates}
\rowTable{difference of velocity coordinates}{$\Delta \vv= \dot \qv_{m1} - \dot \qv_{m0}$}{}
\finishTable
%
\noindent {\bf Remarks}:
The number of algebraic equations depends on the number of rows in $\Xm_{m0}$, which must be same as the
number of rows in $\Xm_{m1}$.
The number of columns in $\Xm_{m0}$ must agree with the length of the coordinate vector
$\qv_{m0}$ and the number of columns in $\Xm_{m1}$ must agree with the length of the coordinate vector
$\qv_{m1}$. If one marker $k$ is a ground marker (node/object), the length of $\qv_{m,k}$ is zero and also the according matrix
$\Xm_{m,k}$ has zero size and will not be considered in the computation of the constraint equations.
If the number of rows of $\Xm_{m0}$ plus the number of rows of $\Xm_{m1}$ is
larger than the total number of coordinates ( $\qv_{m0}$ and $\qv_{m1}$), the algebraic equations are
underdetermined and probably not solvable.
\noindent {\bf Algebraic constraint equations}:
If \texttt{activeConnector = True}, the index 3 algebraic equations
\be
\cv(\qv_{m0}, \qv_{m1}) = \Xm_{m1} \cdot \qv_{m1} - \Xm_{m0} \qv_{m0} - \vv_\mathrm{off} = 0
\ee
If the offsetUserFunction $\mathrm{UF}$ is defined, $\cv$ instead becomes ($t$ is current time)
\be
\cv(\qv_{m0}, \qv_{m1}) = \Xm_{m1} \cdot \qv_{m1} - \Xm_{m0} \qv_{m0} - \mathrm{UF}(t,\vv_\mathrm{off}) = 0
\ee
The \texttt{activeConnector = True}, index 2 (velocity level) algebraic equation reads
\be
\dot \cv(\dot \qv_{m0}, \dot \qv_{m1}) = \Xm_{m1} \cdot \dot \qv_{m1} - \Xm_{m0} \dot \qv_{m0} - \dv_\mathrm{off} = 0
\ee
The vector $dv$ in velocity level equations is zero, except if parameters.velocityLevel = True, then $\dv=\vv_\mathrm{off}$.
If velocity level constraints are active and the velocity level \texttt{offsetUserFunction\_t} $\mathrm{UF}_t$ is defined,
$\dot \cv$ instead becomes ($t$ is current time)
\be
\dot \cv(\dot \qv_{m0}, \dot \qv_{m1}) = \Xm_{m1} \cdot \dot \qv_{m1} - \Xm_{m0} \dot \qv_{m0} - \mathrm{UF}_t(t,\vv_\mathrm{off}) = 0
\ee
Note that the index 2 equations are used, if the solver uses index 2 formulation OR if the flag parameters.velocityLevel = True (or both).
The user functions include dependency on time $t$, but this time dependency is not respected in the computation of initial accelerations. Therefore,
it is recommended that $\mathrm{UF}$ and $\mathrm{UF}_t$ does not include initial accelerations.
If \texttt{activeConnector = False}, the (index 1) algebraic equation reads for ALL cases:
\be
\cv(\tlambda) = \tlambda = 0
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "constraints's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "$[m0,m1]\tp$list of markers used in connector"
V, CP, scalingMarker0, , , NumpyMatrix,"Matrix()", , I, "$\Xm_{m0} \in \Rcal^{n_{ae} \times n_{q_{m0}}}$linear scaling matrix for coordinate vector of marker 0; matrix provided in python numpy format"
V, CP, scalingMarker1, , , NumpyMatrix,"Matrix()", , I, "$\Xm_{m1} \in \Rcal^{n_{ae} \times n_{q_{m1}}}$linear scaling matrix for coordinate vector of marker 1; matrix provided in python numpy format"
V, CP, offset, , , NumpyVector,"Vector()", , I, "$\vv_\mathrm{off} \in \Rcal^{n_{ae}}$offset added to constraint equation; only active, if no userFunction is defined"
V, CP, velocityLevel, , , bool, false, , I, "If true: connector constrains velocities (only works for ODE2 coordinates!); offset is used between velocities; in this case, the offsetUserFunction\_t is considered and offsetUserFunction is ignored"
#V, CP, offsetUserFunction, , , PyFunctionScalar2, 0, , IO, "$\mathrm{UF}(t,l_\mathrm{off})$A python function which defines the time-dependent offset; it is highly RECOMMENDED to use sufficiently smooth functions, having consistent initial offsets with initial configuration of bodies, zero or compatible initial offset-velocity, and no accelerations; Example for python function: def UF(t, l\_offset): return l\_offset*(1-np.cos(t*10*2*np.pi))"
#V, CP, offsetUserFunction_t, , , PyFunctionScalar2, 0, , IO, "$\mathrm{UF}_t(t,l_\mathrm{off})$time derivative of offsetUserFunction; needed for 'velocityLevel=True', or for index2 time integration and for computation of initial accelerations in SecondOrderImplicit integrators"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, IsPenaltyConnector, , , Bool, "return false;", , CI, "constraints uses Lagrance multiplier formulation"
Fv, C, IsTimeDependent, , , bool, "return false;", , CI, "connector is time dependent if user functions are defined"
#Fv, C, IsTimeDependent, , , bool, "return (parameters.offsetUserFunction != 0 || parameters.offsetUserFunction_t != 0);", , CI, "connector is time dependent if user functions are defined"
#Fv, C, HasVelocityEquations, , , Bool, "return true;", , CI, "constraint also implements velocity level equations"
Fv, C, UsesVelocityLevel, , , Bool, "return parameters.velocityLevel;", , CI, "Return true, if constraint currently is formulated at velocity level (e.g. coordinate constraint ==> this information is needed for correct jacobian computation)"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, const MarkerDataStructure& markerData, Real t, bool velocityLevel = false", CDI, "Computational function: compute algebraic equations and write residual into 'algebraicEquations'; velocityLevel: equation provided at velocity level"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE, const MarkerDataStructure& markerData, Real t", CDI, "compute derivative of algebraic equations w.r.t. ODE2 in jacobian [and w.r.t. ODE2_t coordinates in jacobian_t if flag ODE2_t_AE_function is set] [and w.r.t. AE coordinates if flag AE_AE_function is set in GetAvailableJacobians()]; jacobian[_t] has dimension GetAlgebraicEquationsSize() x (GetODE2Size() + GetODE1Size() [+GetAlgebraicEquationsSize()]); q are the system coordinates; markerData provides according marker information to compute jacobians"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, , , CDI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags; available jacobians is switched depending on velocity level and on activeConnector condition"
#Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
#Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::Coordinate;", , CI, "provide requested markerType for connector"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Connector + (Index)CObjectType::Constraint);", , CI, "return object type (for node treatment in computation)"
Fv, C, GetAlgebraicEquationsSize, , , Index, , , CDI, "number of algebraic equations; independent of node/body coordinates"
Fv, M, GetTypeName, , , const char*,"return 'ConnectorCoordinate';", , CI, "Get type name of object (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", I, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
#V, V, drawSize, , , float, "-1.f", , IO, "drawing size = link size; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectConnectorRollingDiscPenalty
classDescription = "A (flexible) connector representing a rolling rigid disc (marker 1) on a flat surface (marker 0, ground body) in global $x$-$y$ plane. The connector is based on a penalty formulation and adds friction and slipping. The contraints works for discs as long as the disc axis and the plane normal vector are not parallel. Parameters may need to be adjusted for better convergence (e.g., dryFrictionProportionalZone). The formulation is still under development and needs further testing."
cParentClass = CObjectConnector
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = RollingDiscPenalty
addProtectedC = " static constexpr Index nDataVariables = 3; //number of data variables for tangential and normal contact\n"
outputVariables = "{'Position':'$\LU{0}{\pv}_{G}$current global position of contact point between rolling disc and ground', 'VelocityLocal':'$\LU{D}{\vv}_{G}$current velocity of the trail (contact) point in disc coordinates; this is the velocity with which the contact moves over the ground plane', 'ForceLocal':'$\LU{J1}{\fv}$disc-ground force in special marker 1 joint coordinates, $f_0$ being the lateral force, $f_1$ being the longitudinal force and $f_2$ being the normal force'}"
classType = Object
#add input quantities
#add equations
equations =
\vspace{6pt}\\
{\bf Definition of quantities}:
\startTable{intermediate variables}{symbol}{description}
\rowTable{marker m0 position}{$\LU{0}{\pv}_{m0}$}{current global position which is provided by marker m0, any ground reference position; currently unused}
\rowTable{marker m0 orientation}{$\LU{0,m0}{\Rot}$}{current rotation matrix provided by marker m0; currently unused}
\rowTable{marker m1 position}{$\LU{0}{\pv}_{m1}$}{center of disc}
\rowTable{marker m1 orientation}{$\LU{0,m1}{\Rot}$}{current rotation matrix provided by marker m1}
\rowTable{data coordinates}{$\xv=[x_0,\,x_1,\,x_2]\tp$}{data coordinates for $[x_0,\,x_1]$: hold the sliding velocity in lateral and longitudinal direction of last discontinuous iteration; $x_2$: represents gap of last discontinuous iteration (in contact normal direction)}
%
%\rowTable{marker m0 velocity}{$\LU{0}{\vv}_{m0}$}{current global velocity which is provided by marker m0}
\rowTable{marker m1 velocity}{$\LU{0}{\vv}_{m1}$}{accordingly}
%\rowTable{marker m0 angular velocity}{$\LU{0}{\tomega}_{m0}$}{current angular velocity vector provided by marker m0}
\rowTable{marker m1 angular velocity}{$\LU{0}{\tomega}_{m1}$}{current angular velocity vector provided by marker m1}
%
\rowTable{ground normal vector}{$\LU{0}{\vv_{PN}}$}{normalized normal vector to the ground, currently [0,0,1]}
\rowTable{ground position B}{$\LU{0}{\pv}_{B}$}{disc center point projected on ground (normal projection)}
\rowTable{ground position C}{$\LU{0}{\pv}_{C}$}{contact point of disc with ground}
\rowTable{ground velocity C}{$\LU{0}{\vv}_{C}$}{velocity of disc at ground contact point (must be zero at end of iteration)}
%\rowTable{ground vector}{$\LU{0}{\dv}$}{vector from ground to the disc center point , currently [0,0,\LU{0}{\pv}_{m1,z}]}
\rowTable{wheel axis vector}{$\LU{0}{\wv}_1 =\LU{0,m1}{\Rot} \cdot [1,0,0]\tp $}{normalized disc axis vector, currently $[1,0,0]\tp$ in local coordinates}
\rowTable{longitudinal vector}{$\LU{0}{\wv}_2$}{vector in longitudinal (motion) direction}
\rowTable{lateral vector}{$\LU{0}{\wv}_l = \LU{0}{\vv_{PN}} \times \LU{0}{\wv}_2 = [-\wv_{2,y}, \wv_{2,x}, 0]$}{vector in lateral direction, lies in ground plane}
\rowTable{contact point vector}{$\LU{0}{\wv}_3$}{normalized vector from disc center point in direction of contact point C}
%
\rowTable{connector forces}{$\LU{J1}{\fv}=[f_{t,x},\,f_{t,y},\,f_n]\tp$}{joint force vector at contact point in joint 1 coordinates: x=lateral direction, y=longitudinal direction, z=plane normal (contact normal)}
\finishTable
\vspace{6pt}
\noindent {\bf Geometric relations}:\\
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\noindent The main geometrical setup is shown in the following figure:
\begin{center}
\includegraphics[height=4cm]{figures/ObjectJointRollingDiscSketch.pdf}
\end{center}
First, the contact point $\LU{0}{\pv}_{C}$ must be computed.
%Using the point B which is the disc center point projeced to ground plane,
%\be
% \LU{0}{\pv}_{B} = \vr{\LU{0}{\pv}_{m1,x}}{\LU{0}{\pv}_{m1,y}}{0}
%\ee
%This provides the vector $\dv$,
%\be
% \LU{0}{\dv} = \vr{0}{0}{\LU{0}{\pv}_{m1,z}}
%\ee
With the helper vector,
\be
\LU{0}{\xv} = \LU{0}{\wv}_1 \times \LU{0}{\vv_{PN}}
\ee
we obtain a disc coordinate system, representing the longitudinal direction,
\be
\LU{0}{\wv}_2 = \frac{1}{|\LU{0}{\xv}|} \LU{0}{\xv}
\ee
and the vector to the contact point,
\be
\LU{0}{\wv}_3 = \LU{0}{\wv}_1 \times \LU{0}{\wv}_2
\ee
The contact point can be computed from
\be
\LU{0}{\pv}_{C} = \LU{0}{\pv}_{m1} + r \cdot \LU{0}{\wv}_3
\ee
The velocity of the contact point at the disc is computed from,
\be
\LU{0}{\vv}_{C} = \LU{0}{\vv}_{m1} + \LU{0}{\tomega}_{m1} \times (r\cdot \LU{0}{\wv}_3)
\ee
The connector forces at the contact point $C$ are computed as follows.
The normal contact force reads
\be
f_n = k_c \cdot \LU{0}{\pv}_{C,z} + d_c \cdot \LU{0}{\vv}_{C,z}
\ee
The tangential forces are computed from the inplane velocity $\vv_t = [\LU{0}{\vv}_{C,x},\, \LU{0}{\vv}_{C,y}]\tp$
\be
\fv_t = \tmu \cdot \phi(|\vv_t|,v_\mu) \cdot f_n \cdot \ev_t
\ee
with the regularization function:
\be
\phi(v, v_\mu) =
\left\{
\begin{array}{ccl}
(2-\frac{v}{v_\mu})\frac{v}{v_\mu} & \mathrm{if} & v \le v_\mu \\
1 & \mathrm{if} & v > v_\mu \\
\end{array}
\right.
\ee
and the direction of tangential slip
\be
\ev_t = \frac{\vv_t}{|\vv_t|}
\ee
The friction coefficient matrix $\tmu$ is computed from
\be
\tmu = \mp{\mu_x}{0}{0}{\mu_y}
\ee
where for isotropic behaviour of surface and wheel, it will give a diagonal matrix with the friction coefficient in the diagonal.
In case that the dry friction angle $\alpha_t$ is not zero, the $\tmu$ changes to
\be
\tmu = \mp{\cos(\alpha_t)}{\sin(\alpha_t)}{-\sin(\alpha_t)}{\cos(\alpha_t)} \mp{\mu_x}{0}{0}{\mu_y} \mp{\cos(\alpha_t)}{-\sin(\alpha_t)}{\sin(\alpha_t)}{\cos(\alpha_t)}
\ee
Finally, the connector forces read in joint coordinates
\be
\LU{J1}{\fv} = \vr{f_{t,x}}{f_{t,y}}{f_n}
\ee
and in global coordinates, they are computed from
\be
\LU{0}{\fv} = f_{t,x}\wv_l + f_{t,y} \wv_2 + f_n \vv_{PN}
\ee
The moment caused by the contact forces are given as
\be
\LU{0}{\fv} = (r\cdot \LU{0}{\wv}_3) \times \LU{0}{\fv}
\ee
if \texttt{activeConnector = False},
\be
\LU{J1}{\fv} = \Null
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "constraints's unique name"
V, CP, markerNumbers, , 2, ArrayIndex, "ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "$[m0,m1]\tp$list of markers used in connector"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "$n_d$node number of a NodeGenericData (size=3) for 3 dataCoordinates"
#
#V, CP, constrainedAxes, , 3, ArrayIndex, "ArrayIndex({1,1,1})", , IO, "$\jv=[j_0,\,\ldots,\,j_2]$flag, which determines which constraints are active, in which $j_0,j_1$ represent the tangential motion and $j_2$ represents the normal (contact) direction"
V, CP, dryFrictionAngle, , , Real, "0.", , IO, "$\alpha_t$angle [SI:1 (rad)] which defines a rotation of the local tangential coordinates dry friction; this allows to model Mecanum wheels with specified roll angle"
V, CP, contactStiffness, , , Real, "0.", , I, "$k_c$normal contact stiffness [SI:N/m]"
V, CP, contactDamping, , , Real, "0.", , IO, "$d_c$normal contact damping [SI:N/(m s)]"
V, CP, dryFriction, , , Vector2D, "Vector2D({0,0})", , IO, "$[\mu_x,\mu_y]\tp$dry friction coefficients [SI:1] in local marker 1 joint $J1$ coordinates; if $\alpha_t==0$, lateral direction $l=x$ and forward direction $f=y$; assuming a normal force $f_n$, the local friction force can be computed as $\LU{J1}{\vp{f_{t,x}}{f_{t,y}}} = \vp{\mu_x f_n}{\mu_y f_n}$"
V, CP, dryFrictionProportionalZone, , , Real, "0.", , IO, "$v_\mu$limit velocity [m/s] up to which the friction is proportional to velocity (for regularization / avoid numerical oscillations)"
V, CP, rollingFrictionViscous, , , Real, "0.", , IO, "$\mu_r$rolling friction [SI:1], which acts against the velocity of the trail on ground and leads to a force proportional to the contact normal force; currently, only implemented for disc axis parallel to ground!"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
V, CP, discRadius, , , Real, "0", , I, "defines the disc radius"
V, CP, planeNormal, , , Vector3D, "Vector3D({0,0,1})", , , "normal to the contact / rolling plane; cannot be changed at the moment"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex == 0);\n return parameters.nodeNumber;", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 1;", , CI, "number of nodes; needed for every object"
Fv, C, GetDataVariablesSize, , , Index, "return nDataVariables;", , CI, "data (history) variable simplifies contact switching for implicit time integration and Newton method"
#
#Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::AE_ODE2);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, HasDiscontinuousIteration, , , Bool, "return true;", , CI, "flag to be set for connectors, which use DiscontinuousIteration"
Fv, C, PostNewtonStep, , , Real, , "const MarkerDataStructure& markerDataCurrent, PostNewtonFlags::Type& flags", DI, "function called after Newton method; returns a residual error (force)"
Fv, C, PostDiscontinuousIterationStep, , , void, , , DI, "function called after discontinuous iterations have been completed for one step (e.g. to finalize history variables and set initial values for next step)"
#
Fv, C, IsPenaltyConnector, , , Bool, "return true;", , CI, "connector uses penalty formulation"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs, const MarkerDataStructure& markerData", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, ComputeJacobianODE2_ODE2, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_ODE2_t, const MarkerDataStructure& markerData", CDI, "Computational function: compute Jacobian of ODE2 RHS equations w.r.t. ODE coordinates (jacobian) and if JacobianType::ODE2_ODE2_t flag is set in GetAvailableJacobians() compute jacobian w.r.t. ODE_t coordinates"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
F, C, ComputeContactForces, , , void, , "const MarkerDataStructure& markerData, const CObjectConnectorRollingDiscPenaltyParameters& parameters, bool computeCurrent, Vector3D& pC, Vector3D& vC, Vector3D& wLateral, Vector3D& w2, Vector3D& w3, Vector3D& fContact, Vector2D& localSlipVelocity", CDI, "compute contact kinematics and contact forces"
F, C, ComputeSlipForce, , , Vector2D, , "const CObjectConnectorRollingDiscPenaltyParameters& parameters, const Vector2D& localSlipVelocity, const Vector2D& dataLocalSlipVelocity, Real contactForce", CDI, "compute slip force vector for specific states"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return (Marker::Type)((Index)Marker::Position + (Index)Marker::Orientation);", , CI, "provide requested markerType for connector"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::GenericData;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return CObjectType::Connector;", , CI, "return object type (for node treatment in computation)"
Fv, M, GetTypeName, , , const char*,"return 'ConnectorRollingDiscPenalty';", , CI, "Get type name of node (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, discWidth, , , float, "0.1f", , IO, "width of disc for drawing"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",,IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectContactCoordinate
classDescription = "A penalty-based contact condition for one coordinate; the contact gap $g$ is defined as $g=marker.value[1]- marker.value[0] - offset$; the contact force $f_c$ is zero for $gap>0$ and otherwise computed from $f_c = g*contactStiffness + \dot g*contactDamping$; during Newton iterations, the contact force is actived only, if $dataCoordinate[0] <= 0$; dataCoordinate is set equal to gap in nonlinear iterations, but not modified in Newton iterations."
cParentClass = CObjectConnector
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
#pythonShortName = SpringDamper
classType = Object
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "connector's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "markers define contact gap"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "node number of a NodeGenericData for 1 dataCoordinate (used for active set strategy ==> holds the gap of the last discontinuous iteration)"
V, CP, contactStiffness, , , UReal, 0., , I, "contact (penalty) stiffness [SI:N/m]; acts only upon penetration"
V, CP, contactDamping, , , UReal, 0., , I, "contact damping [SI:N/(m s)]; acts only upon penetration"
V, CP, offset, , , UReal, 0., , I, "offset [SI:m] of contact"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex == 0);\n return parameters.nodeNumber;", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 1;", , CI, "number of nodes; needed for every object"
Fv, C, GetDataVariablesSize, , , Index, "return 1;", , CI, "needed in order to create ltg-lists for data variable of connector"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#computation functions:
F, C, ComputeGap, , , Real, , "const MarkerDataStructure& markerData", CDI, "compute gap for given MarkerData --> done for different configurations (current, start of step, ...)"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs, const MarkerDataStructure& markerData", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, ComputeJacobianODE2_ODE2, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_ODE2_t, const MarkerDataStructure& markerData", CDI, "Computational function: compute Jacobian of ODE2 RHS equations w.r.t. ODE coordinates (jacobian) and if JacobianType::ODE2_ODE2_t flag is set in GetAvailableJacobians() compute jacobian w.r.t. ODE_t coordinates"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::AE_ODE2);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, HasDiscontinuousIteration, , , Bool, "return true;", , CI, "flag to be set for connectors, which use DiscontinuousIteration"
Fv, C, PostNewtonStep, , , Real, , "const MarkerDataStructure& markerDataCurrent, PostNewtonFlags::Type& flags", DI, "function called after Newton method; returns a residual error (force)"
Fv, C, PostDiscontinuousIterationStep, , , void, , , DI, "function called after discontinuous iterations have been completed for one step (e.g. to finalize history variables and set initial values for next step)"
#TYPES and ACCESS:
Fv, C, IsPenaltyConnector, , , Bool, "return true;", , CI, "connector uses penalty formulation"
Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
#Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::Coordinate;", , CI, "provide requested markerType for connector"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::GenericData;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return CObjectType::Connector;", , CI, "return object type (for node treatment in computation)"
Fv, M, GetTypeName, , , const char*,"return 'ContactCoordinate';", , CI, "Get type name of node (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , Bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = diameter of spring; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectContactCircleCable2D
classDescription = "A very specialized penalty-based contact condition between a 2D circle (=marker0, any Position-marker) on a body and an ANCFCable2DShape (=marker1, Marker: BodyCable2DShape), in xy-plane; a node NodeGenericData is required with the number of cordinates according to the number of contact segments; the contact gap $g$ is integrated (piecewise linear) along the cable and circle; the contact force $f_c$ is zero for $gap>0$ and otherwise computed from $f_c = g*contactStiffness + \dot g*contactDamping$; during Newton iterations, the contact force is actived only, if $dataCoordinate[0] <= 0$; dataCoordinate is set equal to gap in nonlinear iterations, but not modified in Newton iterations."
cParentClass = CObjectConnector
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
addPublicC = " static constexpr Index maxNumberOfSegments = 12; //maximum number of contact segments\n"
classType = Object
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "connector's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "markers define contact gap"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "node number of a NodeGenericData for nSegments dataCoordinates (used for active set strategy ==> hold the gap of the last discontinuous iteration and the friction state)"
V, CP, numberOfContactSegments, , , Index, "3", , I, "number of linear contact segments to determine contact; each segment is a line and is associated to a data (history) variable; must be same as in according marker"
V, CP, contactStiffness, , , UReal, 0., , I, "contact (penalty) stiffness [SI:N/m/(contact segment)]; the stiffness is per contact segment; specific contact forces (per length) $f_N$ act in contact normal direction only upon penetration"
V, CP, contactDamping, , , UReal, 0., , I, "contact damping [SI:N/(m s)/(contact segment)]; the damping is per contact segment; acts in contact normal direction only upon penetration"
V, CP, circleRadius, , , UReal, 0., , I, "radius [SI:m] of contact circle"
#delete: this is done by position marker! V, CP, circleMidpoint, , , Vector2D, "Vector2D({0.,0.})", , I, "2D point [SI:m] of contact circle"
V, CP, offset, , , UReal, 0., , I, "offset [SI:m] of contact, e.g. to include thickness of cable element"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex == 0);\n return parameters.nodeNumber;", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 1;", , CI, "number of nodes; needed for every object"
Fv, C, GetDataVariablesSize, , , Index, "return parameters.numberOfContactSegments;", , CI, "Needs a data variable for every contact segment (tells if this segment is in contact or not)"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#computation functions:
F, C, ComputeGap, , , void, , "const MarkerDataStructure& markerData, ConstSizeVector<maxNumberOfSegments>& gapPerSegment, ConstSizeVector<maxNumberOfSegments>& referenceCoordinatePerSegment, ConstSizeVector<maxNumberOfSegments>& xDirectionGap, ConstSizeVector<maxNumberOfSegments>& yDirectionGap", CDI, "compute gap for given MarkerData; done for every contact point (numberOfSegments+1) --> in order to decide contact state for every segment; in case of positive gap, the area is distance*segment_length"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs, const MarkerDataStructure& markerData", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, ComputeJacobianODE2_ODE2, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_ODE2_t, const MarkerDataStructure& markerData", CDI, "Computational function: compute Jacobian of ODE2 RHS equations w.r.t. ODE coordinates (jacobian) and if JacobianType::ODE2_ODE2_t flag is set in GetAvailableJacobians() compute jacobian w.r.t. ODE_t coordinates"
#Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::AE_ODE2);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, HasDiscontinuousIteration, , , Bool, "return true;", , CI, "flag to be set for connectors, which use DiscontinuousIteration"
Fv, C, PostNewtonStep, , , Real, , "const MarkerDataStructure& markerDataCurrent, PostNewtonFlags::Type& flags", DI, "function called after Newton method; returns a residual error (force)"
Fv, C, PostDiscontinuousIterationStep, , , void, , , DI, "function called after discontinuous iterations have been completed for one step (e.g. to finalize history variables and set initial values for next step)"
#TYPES and ACCESS:
Fv, C, IsPenaltyConnector, , , Bool, "return true;", , CI, "connector uses penalty formulation"
Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
#Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::_None;", , CI, "provide requested markerType for connector; for different markerTypes in marker0/1 => set to ::\_None"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::GenericData;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return CObjectType::Connector;", , CI, "return object type (for node treatment in computation)"
Fv, M, GetTypeName, , , const char*,"return 'ContactCircleCable2D';", , CI, "Get type name of node (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, , , CDI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , Bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = diameter of spring; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectContactFrictionCircleCable2D
classDescription = "A very specialized penalty-based contact/friction condition between a 2D circle in the local x/y plane (=marker0, a Rigid-Body Marker) on a body and an ANCFCable2DShape (=marker1, Marker: BodyCable2DShape), in xy-plane; a node NodeGenericData is required with 3$\times$(number of contact segments) -- containing per segment: [contact gap, stick/slip (stick=1), last friction position]; the contact gap $g$ is integrated (piecewise linear) along the cable and circle; the contact force $f_c$ is zero for $gap>0$ and otherwise computed from $f_c = g*contactStiffness + \dot g*contactDamping$; during Newton iterations, the contact force is actived only, if $dataCoordinate[0] <= 0$; dataCoordinate is set equal to gap in nonlinear iterations, but not modified in Newton iterations."
cParentClass = CObjectConnector
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
addPublicC = " static constexpr Index maxNumberOfSegments = 12; //maximum number of contact segments\n"
classType = Object
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "connector's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "markers define contact gap"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "node number of a NodeGenericData with 3 $\times$ nSegments dataCoordinates (used for active set strategy ==> hold the gap of the last discontinuous iteration and the friction state)"
V, CP, numberOfContactSegments, , , Index, "3", , I, "number of linear contact segments to determine contact; each segment is a line and is associated to a data (history) variable; must be same as in according marker"
V, CP, contactStiffness, , , UReal, 0., , I, "contact (penalty) stiffness [SI:N/m/(contact segment)]; the stiffness is per contact segment; specific contact forces (per length) $f_N$ act in contact normal direction only upon penetration"
V, CP, contactDamping, , , UReal, 0., , I, "contact damping [SI:N/(m s)/(contact segment)]; the damping is per contact segment; acts in contact normal direction only upon penetration"
V, CP, frictionVelocityPenalty, , , UReal, 0., , I, "velocity dependent penalty coefficient for friction [SI:N/(m s)/(contact segment)]; the coefficient causes tangential (contact) forces against relative tangential velocities in the contact area"
V, CP, frictionStiffness, , , UReal, 0., , I, "CURRENTLY NOT IMPLEMENTED: displacement dependent penalty/stiffness coefficient for friction [SI:N/m/(contact segment)]; the coefficient causes tangential (contact) forces against relative tangential displacements in the contact area"
V, CP, frictionCoefficient, , , UReal, 0., , I, "friction coefficient $\mu$ [SI: 1]; tangential specific friction forces (per length) $f_T$ must fulfill the condition $f_T \le \mu f_N$"
V, CP, circleRadius, , , UReal, 0., , I, "radius [SI:m] of contact circle"
#delete: this is done by position marker! V, CP, circleMidpoint, , , Vector2D, "Vector2D({0.,0.})", , I, "2D point [SI:m] of contact circle"
V, CP, offset, , , UReal, 0., , I, "offset [SI:m] of contact, e.g. to include thickness of cable element"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex == 0);\n return parameters.nodeNumber;", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 1;", , CI, "number of nodes; needed for every object"
Fv, C, GetDataVariablesSize, , , Index, "return 3*parameters.numberOfContactSegments;", , CI, "Needs a data variable for every contact segment (tells if this segment is in contact or not), every friction condition (stick = 1, slip = 0), and the last sticking position in tangential direction in terms of an angle $\varphi$ in the local circle coordinates ($\varphi = 0$, if the vector to the contact position is aligned with the x-axis)"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#computation functions:
F, C, ComputeGap, , , void, , "const MarkerDataStructure& markerData, ConstSizeVector<maxNumberOfSegments>& gapPerSegment, ConstSizeVector<maxNumberOfSegments>& referenceCoordinatePerSegment, ConstSizeVector<maxNumberOfSegments>& xDirectionGap, ConstSizeVector<maxNumberOfSegments>& yDirectionGap", CDI, "compute gap for given MarkerData; done for every contact point (numberOfSegments+1) --> in order to decide contact state for every segment; in case of positive gap, the area is distance*segment_length"
Fv, C, ComputeODE2RHS, , , void, , "Vector& ode2Rhs, const MarkerDataStructure& markerData", CDI, "Computational function: compute right-hand-side (RHS) of second order ordinary differential equations (ODE) to 'ode2rhs'"
Fv, C, ComputeJacobianODE2_ODE2, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_ODE2_t, const MarkerDataStructure& markerData", CDI, "Computational function: compute Jacobian of ODE2 RHS equations w.r.t. ODE coordinates (jacobian) and if JacobianType::ODE2_ODE2_t flag is set in GetAvailableJacobians() compute jacobian w.r.t. ODE_t coordinates"
#Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::AE_ODE2);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, HasDiscontinuousIteration, , , Bool, "return true;", , CI, "flag to be set for connectors, which use DiscontinuousIteration"
Fv, C, PostNewtonStep, , , Real, , "const MarkerDataStructure& markerDataCurrent, PostNewtonFlags::Type& flags", DI, "function called after Newton method; returns a residual error (force)"
Fv, C, PostDiscontinuousIterationStep, , , void, , , DI, "function called after discontinuous iterations have been completed for one step (e.g. to finalize history variables and set initial values for next step)"
#TYPES and ACCESS:
Fv, C, IsPenaltyConnector, , , Bool, "return true;", , CI, "connector uses penalty formulation"
Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
#Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::_None;", , CI, "provide requested markerType for connector; for different markerTypes in marker0/1 => set to ::\_None"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::GenericData;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return CObjectType::Connector;", , CI, "return object type (for node treatment in computation)"
Fv, M, GetTypeName, , , const char*,"return 'ContactFrictionCircleCable2D';", , CI, "Get type name of node (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, , , CDI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , Bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = diameter of spring; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectJointGeneric
classDescription = "A generic joint in 3D; constrains components of the absolute position and rotations of two points given by PointMarkers or RigidMarkers; an additional local rotation can be used to define three rotation axes and/or sliding axes"
cParentClass = CObjectConstraint
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = GenericJoint
addProtectedC = " static constexpr Index nConstraints = 6;\n"
outputVariables = "{'Position':'$\LU{0}{\pv}_{m0}$current global position of position marker $m0$', 'Velocity':'$\LU{0}{\vv}_{m0}$current global velocity of position marker $m0$', 'DisplacementLocal':'$\LU{J0}{\Delta\pv}$relative displacement in local joint0 coordinates; uses local J0 coordinates even for spherical joint configuration', 'VelocityLocal':'$\LU{J0}{\Delta\vv}$relative translational velocity in local joint0 coordinates', 'Rotation':'$\LU{J0}{\ttheta}= [\theta_0,\theta_1,\theta_2]\tp$relative rotation parameters (Tait Bryan Rxyz); if all axes are fixed, this output represents the rotational drift; for a revolute joint, it contains the rotation of this axis', 'AngularVelocityLocal':'$\LU{J0}{\Delta\tomega}$relative angular velocity in local joint0 coordinates; if all axes are fixed, this output represents the angular velocity constraint error; for a revolute joint, it contains the angular velocity of this axis', 'ForceLocal':'$\LU{J0}{\fv}$joint force in local $J0$ coordinates', 'TorqueLocal':'$\LU{J0}{\mv}$joint torque in local $J0$ coordinates; depending on joint configuration, the result may not be the according torque vector'}"
#check if this is possible: 'TorqueLocal':'$\LU{J0}{\mv}$joint torque in in local joint0 coordinates'}"
classType = Object
#add input quantities
#add equations
equations =
\vspace{6pt}\\
{\bf Definition of quantities}:
\startTable{intermediate variables}{symbol}{description}
\rowTable{marker m0 position}{$\LU{0}{\pv}_{m0}$}{current global position which is provided by marker m0}
\rowTable{marker m0 orientation}{$\LU{0,m0}{\Rot}$}{current rotation matrix provided by marker m0}
\rowTable{joint J0 orientation}{$\LU{0,J0}{\Rot} = \LU{0,m0}{\Rot} \LU{m0,J0}{\Rot}$}{joint $J0$ rotation matrix}
\rowTable{joint J0 orientation vectors}{$\LU{0,J0}{\Rot} = [\vv_{x0},\,\vv_{y0},\,\vv_{z0}]\tp$}{orientation vectors used for definition of constraint equations}
\rowTable{marker m1 position}{$\LU{0}{\pv}_{m1}$}{accordingly}
\rowTable{marker m1 orientation}{$\LU{0,m1}{\Rot}$}{current rotation matrix provided by marker m1}
\rowTable{joint J1 orientation}{$\LU{0,J1}{\Rot} = \LU{0,m1}{\Rot} \LU{m1,J1}{\Rot}$}{joint $J1$ rotation matrix}
\rowTable{joint J1 orientation vectors}{$\LU{0,J1}{\Rot} = [\vv_{x1},\,\vv_{y1},\,\vv_{z1}]\tp$}{orientation vectors used for definition of constraint equations}
%
\rowTable{marker m0 velocity}{$\LU{0}{\vv}_{m0}$}{current global velocity which is provided by marker m0}
\rowTable{marker m1 velocity}{$\LU{0}{\vv}_{m1}$}{accordingly}
\rowTable{marker m0 velocity}{$\LU{b}{\tomega}_{m0}$}{current local angular velocity vector provided by marker m0}
\rowTable{marker m1 velocity}{$\LU{b}{\tomega}_{m1}$}{current local angular velocity vector provided by marker m1}
\rowTable{Displacement}{$\LU{0}{\Delta\pv}=\LU{0}{\pv}_{m1} - \LU{0}{\pv}_{m0}$} {used, if all translational axes are constrained}
\rowTable{Velocity}{$\LU{0}{\Delta\vv} = \LU{0}{\vv}_{m1} - \LU{0}{\vv}_{m0}$}{used, if all translational axes are constrained (velocity level)}
%
\rowTable{DisplacementLocal}{$\LU{J0}{\Delta\pv}$}{$\left(\LU{0,m0}{\Rot}\LU{m0,J0}{\Rot}\right)\tp \LU{0}{\Delta\pv}$}
\rowTable{VelocityLocal}{$\LU{J0}{\Delta\vv}$}{$\left(\LU{0,m0}{\Rot}\LU{m0,J0}{\Rot}\right)\tp \LU{0}{\Delta\vv}$ $\ldots$ note that this is the global relative velocity projected into the local $J0$ coordinate system}
\rowTable{AngularVelocityLocal}{$\LU{J0}{\Delta\omega}$}{$\left(\LU{0,m0}{\Rot}\LU{m0,J0}{\Rot}\right)\tp \left( \LU{0,m1}{\Rot} \LU{m1}{\omega} - \LU{0,m0}{\Rot} \LU{m0}{\omega} \right)$}
\rowTable{algebraic variables}{$\zv=[\lambda_0,\,\ldots,\,\lambda_5]\tp$}{vector of algebraic variables (Lagrange multipliers) according to the algebraic equations}
\finishTable
\vspace{6pt}
\noindent {\bf Connector equations for translational part (\texttt{activeConnector = True})}:\\
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If $[j_0,\,\ldots,\,j_2] = [1,1,1]\tp$, meaning that all translational coordinates are fixed,
the translational index 3 constraints read ($UF_{0,1,2}(t, \pv_{par})$ is the translational part of the user function $UF$),
\be
\LU{0}{\pv}_{m1} - \LU{0}{\pv}_{m0} - UF_{0,1,2}(t, \pv_{par}) = \Null
\ee
and the translational index 2 constraints read
\be
\LU{0}{\vv}_{m1} - \LU{0}{\vv}_{m0} - UF_{t;0,1,2}(t, \pv_{par})= \Null
\ee
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If $[j_0,\,\ldots,\,j_2] \neq [1,1,1]\tp$, meaning that at least one translational coordinate is free,
the translational index 3 constraints read for every component $k \in [0,1,2]$ of the vector $\LU{J0}{\Delta\pv}$
\bea
\LU{J0}{\Delta p_k} - UF_{k}(t, \pv_{par}) &=& 0 \quad \mathrm{if} \quad j_k = 1 \quad \mathrm{and}\\
\lambda_k &=& 0 \quad \mathrm{if} \quad j_k = 0 \\
\eea
and the translational index 2 constraints read for every component $k \in [0,1,2]$ of the vector $\LU{J0}{\Delta\vv}$
\bea
\LU{J0}{\Delta v_k} - UF_{t;k}(t, \pv_{par}) &=& 0 \quad \mathrm{if} \quad j_k = 1 \quad \mathrm{and}\\
\lambda_k &=& 0 \quad \mathrm{if} \quad j_k = 0 \\
\eea
%
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\noindent {\bf Connector equations for rotational part (\texttt{activeConnector = True})}:\\
The following equations are exemplarily for certain constrained rotation axes configurations, which shall represent all other possibilities.
Equations are only given for the index 3 case; the index 2 case can be derived from these equations easily (see C++ code...).
In case of user functions, the additional rotation matrix $\LU{J0,J0U}{\Rot}(UF_{3,4,5}(t, \pv_{par}))$, in which the three components of
$UF_{3,4,5}$ are interpreted as Tait-Bryan angles that are added to the joint frame.
If {\bf 3 rotation axes are constrained}, $[j_3,\,\ldots,\,j_5] = [1,1,1]\tp$, the index 3 constraint equations read
\bea
\vv_{z0}\tp \vv_{y1} &=& 0 \\
\vv_{z0}\tp \vv_{x1} &=& 0 \\
\vv_{x0}\tp \vv_{y1} &=& 0
\eea
If {\bf 2 rotation axes are constrained}, e.g., $[j_3,\,\ldots,\,j_5] = [0,1,1]\tp$, the index 3 constraint equations read
\bea
\lambda_3 &=& 0 \\
\vv_{x0}\tp \vv_{y1} &=& 0 \\
\vv_{x0}\tp \vv_{z1} &=& 0
\eea
If {\bf 1 rotation axis is constrained}, e.g., $[j_3,\,\ldots,\,j_5] = [1,0,0]\tp$, the index 3 constraint equations read
\bea
\vv_{y0}\tp \vv_{z1} &=& 0 \\
\lambda_4 &=& 0 \\
\lambda_5 &=& 0
\eea
%
if \texttt{activeConnector = False},
\be
\zv = \Null
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "constraints's unique name"
V, CP, markerNumbers, , 2, ArrayIndex, "ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "$[m0,m1]\tp$list of markers used in connector"
V, CP, constrainedAxes, , 6, ArrayIndex, "ArrayIndex({1,1,1,1,1,1})", , IO, "$\jv=[j_0,\,\ldots,\,j_5]$flag, which determines which translation (0,1,2) and rotation (3,4,5) axes are constrained; for $j_i$, two values are possible: 0=free axis, 1=constrained axis"
V, CP, rotationMarker0, , , Matrix3D, "EXUmath::unitMatrix3D", , I, "$\LU{m0,J0}{\Rot}$local rotation matrix for marker $m0$; translation and rotation axes for marker $m0$ are defined in the local body coordinate system and additionally transformed by rotationMarker0"
V, CP, rotationMarker1, , , Matrix3D, "EXUmath::unitMatrix3D", , I, "$\LU{m1,J1}{\Rot}$local rotation matrix for marker $m1$; translation and rotation axes for marker $m1$ are defined in the local body coordinate system and additionally transformed by rotationMarker1"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#V, CP, forceTorqueUserFunctionParameters, , , Vector6D, "Vector6D({0.,0.,0.,0.,0.,0.})", , I, "vector of 6 parameters for joint's forceTorqueUserFunction"
V, CP, offsetUserFunctionParameters, , , Vector6D, "Vector6D({0.,0.,0.,0.,0.,0.})", , I, "$\pv_{par}$vector of 6 parameters for joint's offsetUserFunction"
#V, CP, forceTorqueUserFunction, , , PyFunctionVector6DScalarVector6D, 0, , IO, "A python function which defines the time-dependent force (indices 0,1,2) and torque (indices 3,4,5) joint coordinates with parameters (t, forceTorqueUserFunctionParameters); the offset represents the current value of the object; it is highly RECOMMENDED to use sufficiently smooth functions, having consistent initial offsets with initial configuration of bodies, zero or compatible initial offset-velocity, and no accelerations; Example for python function: def f(t, forceTorqueUserFunctionParameters): return [forceTorqueUserFunctionParameters[0]*(1 - np.cos(t*10*2*np.pi)), 0,0,0,0,0]"
V, CP, offsetUserFunction, , , PyFunctionVector6DScalarVector6D, 0, , IO, "$UF(t, \pv_{par})$A python function which defines the time-dependent (fixed) offset of translation (indices 0,1,2) and rotation (indices 3,4,5) joint coordinates with parameters (t, offsetUserFunctionParameters); the offset represents the current value of the object; it is highly RECOMMENDED to use sufficiently smooth functions, having consistent initial offsets with initial configuration of bodies, zero or compatible initial offset-velocity, and no accelerations; Example for python function: def f(t, offsetUserFunctionParameters): return [offsetUserFunctionParameters[0]*(1 - np.cos(t*10*2*np.pi)), 0,0,0,0,0]"
V, CP, offsetUserFunction_t, , , PyFunctionVector6DScalarVector6D, 0, , IO, "$UF_t(t, \pv_{par})$(NOT IMPLEMENTED YET)time derivative of offsetUserFunction using the same parameters; needed for 'velocityLevel=True', or for index2 time integration and for computation of initial accelerations in SecondOrderImplicit integrators"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, IsPenaltyConnector, , , Bool, "return false;", , CI, "constraints uses Lagrance multiplier formulation"
#Fv, C, HasVelocityEquations, , , Bool, "return true;", , CI, "constraint also implements velocity level equations"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, const MarkerDataStructure& markerData, Real t, bool velocityLevel = false", CDI, "Computational function: compute algebraic equations and write residual into 'algebraicEquations'; velocityLevel: equation provided at velocity level"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE, const MarkerDataStructure& markerData, Real t", CDI, "compute derivative of algebraic equations w.r.t. ODE2 in jacobian [and w.r.t. ODE2_t coordinates in jacobian_t if flag ODE2_t_AE_function is set] [and w.r.t. AE coordinates if flag AE_AE_function is set in GetAvailableJacobians()]; jacobian[_t] has dimension GetAlgebraicEquationsSize() x (GetODE2Size() + GetODE1Size() [+GetAlgebraicEquationsSize()]); q are the system coordinates; markerData provides according marker information to compute jacobians"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, , , CDI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags; available jacobians is switched depending on velocity level and on activeConnector condition"
#Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return (Marker::Type)((Index)Marker::Position + (Index)Marker::Orientation);", , CI, "provide requested markerType for connector"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Connector + (Index)CObjectType::Constraint);", , CI, "return object type (for node treatment in computation)"
Fv, C, GetAlgebraicEquationsSize, , , Index, "return 6;", , CI, "number of algebraic equations; independent of node/body coordinates"
Fv, M, GetTypeName, , , const char*,"return 'JointGeneric';", , CI, "Get type name of object (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, axesRadius, , , float, "0.1f", , IO, "radius of joint axes to draw"
V, V, axesLength, , , float, "0.4f", , IO, "length of joint axes to draw"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectJointSpherical
classDescription = "A spherical joint, which constrains the relative translation between two position based markers."
cParentClass = CObjectConstraint
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = SphericalJoint
addProtectedC = " static constexpr Index nConstraints = 3;\n"
outputVariables = "{'Position':'$\LU{0}{\pv}_{m0}$current global position of position marker $m0$', 'Velocity':'$\LU{0}{\vv}_{m0}$current global velocity of position marker $m0$', 'Displacement':'$\LU{0}{\Delta\pv}=\LU{0}{\pv}_{m1} - \LU{0}{\pv}_{m0}$constraint drift or relative motion, if not all axes fixed', 'Force':'$\LU{0}{\fv}$joint force in global coordinates'}"
classType = Object
#add input quantities
#add equations
equations =
\vspace{6pt}\\
{\bf Definition of quantities}:
\startTable{intermediate variables}{symbol}{description}
\rowTable{marker m0 position}{$\LU{0}{\pv}_{m0}$}{current global position which is provided by marker $m0$}
\rowTable{marker m1 position}{$\LU{0}{\pv}_{m1}$}{current global position which is provided by marker $m1$}
\rowTable{marker m0 velocity}{$\LU{0}{\vv}_{m0}$}{current global velocity which is provided by marker $m0$}
\rowTable{marker m1 velocity}{$\LU{0}{\vv}_{m1}$}{current global velocity which is provided by marker $m1$}
%
\rowTable{relative velocity}{$\LU{0}{\Delta\vv} = \LU{0}{\vv}_{m1} - \LU{0}{\vv}_{m0}$}{constraint velocity error, or relative velocity if not all axes fixed}
%
\rowTable{algebraic variables}{$\zv=[\lambda_0,\,\ldots,\,\lambda_2]\tp$}{vector of algebraic variables (Lagrange multipliers) according to the algebraic equations}
\finishTable
%
\vspace{6pt}
\noindent {\bf Connector equations (\texttt{activeConnector = True})}:\\
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If $[j_0,\,\ldots,\,j_2] = [1,1,1]\tp$, meaning that all translational coordinates are fixed,
the translational index 3 constraints read
\be
\LU{0}{\pv}_{m1} - \LU{0}{\pv}_{m0} = \Null
\ee
and the translational index 2 constraints read
\be
\LU{0}{\vv}_{m1} - \LU{0}{\vv}_{m0} = \Null
\ee
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If $[j_0,\,\ldots,\,j_2] \neq [1,1,1]\tp$, meaning that at least one translational coordinate is free,
the translational index 3 constraints read for every component $k \in [0,1,2]$ of the vector $\LU{0}{\Delta\pv}$
\bea
\LU{0}{\Delta p_k} &=& 0 \quad \mathrm{if} \quad j_k = 1 \quad \mathrm{and}\\
\lambda_k &=& 0 \quad \mathrm{if} \quad j_k = 0 \\
\eea
and the translational index 2 constraints read for every component $k \in [0,1,2]$ of the vector $\LU{0}{\Delta\vv}$
\bea
\LU{0}{\Delta v_k} &=& 0 \quad \mathrm{if} \quad j_k = 1 \quad \mathrm{and}\\
\lambda_k &=& 0 \quad \mathrm{if} \quad j_k = 0 \\
\eea
%
if \texttt{activeConnector = False},
\be
\zv = \Null
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "constraints's unique name"
V, CP, markerNumbers, , 2, ArrayIndex, "ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "$[m0,m1]\tp$list of markers used in connector"
V, CP, constrainedAxes, , 3, ArrayIndex, "ArrayIndex({1,1,1})", , IO, "$\jv=[j_0,\,\ldots,\,j_2]$flag, which determines which translation (0,1,2) and rotation (3,4,5) axes are constrained; for $j_i$, two values are possible: 0=free axis, 1=constrained axis"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, IsPenaltyConnector, , , Bool, "return false;", , CI, "constraints uses Lagrance multiplier formulation"
#Fv, C, HasVelocityEquations, , , Bool, "return true;", , CI, "constraint also implements velocity level equations"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, const MarkerDataStructure& markerData, Real t, bool velocityLevel = false", CDI, "Computational function: compute algebraic equations and write residual into 'algebraicEquations'; velocityLevel: equation provided at velocity level"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE, const MarkerDataStructure& markerData, Real t", CDI, "compute derivative of algebraic equations w.r.t. ODE2 in jacobian [and w.r.t. ODE2_t coordinates in jacobian_t if flag ODE2_t_AE_function is set] [and w.r.t. AE coordinates if flag AE_AE_function is set in GetAvailableJacobians()]; jacobian[_t] has dimension GetAlgebraicEquationsSize() x (GetODE2Size() + GetODE1Size() [+GetAlgebraicEquationsSize()]); q are the system coordinates; markerData provides according marker information to compute jacobians"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, , , CDI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags; available jacobians is switched depending on velocity level and on activeConnector condition"
#Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::Position;", , CI, "provide requested markerType for connector"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Connector + (Index)CObjectType::Constraint);", , CI, "return object type (for node treatment in computation)"
Fv, C, GetAlgebraicEquationsSize, , , Index, "return 3;", , CI, "number of algebraic equations; independent of node/body coordinates"
Fv, M, GetTypeName, , , const char*,"return 'JointSpherical';", , CI, "Get type name of object (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, jointRadius, , , float, "0.1f", , IO, "radius of joint to draw"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectJointRollingDisc
classDescription = "A joint representing a rolling rigid disc (marker 1) on a flat surface (marker 0, ground body) in global $x$-$y$ plane. The contraint is based on an idealized rolling formulation with no slip. The contraints works for discs as long as the disc axis and the plane normal vector are not parallel. It must be assured that the disc has contact to ground in the initial configuration (adjust z-position of body accordingly)."
cParentClass = CObjectConstraint
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = RollingDiscJoint
addProtectedC = " static constexpr Index nConstraints = 3;\n"
outputVariables = "{'Position':'$\LU{0}{\pv}_{G}$current global position of contact point between rolling disc and ground', 'VelocityLocal':'$\LU{D}{\vv}_{G}$current velocity of the trail (contact) point in disc coordinates; this is the velocity with which the contact moves over the ground plane', 'ForceLocal':'$\LU{D}{\fv} = [-\zv^T \wv_l, \, -\zv^T \wv_2, \, -\zv_z]\tp$contact forces acting on disc, in special disc coordinates, $f_x$ being the lateral force, $f_y$ being the longitudinal force and $f_z$ being the normal force'}"
classType = Object
#add input quantities
#add equations
equations =
\vspace{6pt}\\
{\bf Definition of quantities}:
\startTable{intermediate variables}{symbol}{description}
\rowTable{marker m0 position}{$\LU{0}{\pv}_{m0}$}{current global position which is provided by marker m0, any ground reference position; currently unused}
\rowTable{marker m0 orientation}{$\LU{0,m0}{\Rot}$}{current rotation matrix provided by marker m0; currently unused}
\rowTable{marker m1 position}{$\LU{0}{\pv}_{m1}$}{center of disc}
\rowTable{marker m1 orientation}{$\LU{0,m1}{\Rot}$}{current rotation matrix provided by marker m1}
%
%\rowTable{marker m0 velocity}{$\LU{0}{\vv}_{m0}$}{current global velocity which is provided by marker m0}
\rowTable{marker m1 velocity}{$\LU{0}{\vv}_{m1}$}{accordingly}
%\rowTable{marker m0 angular velocity}{$\LU{0}{\tomega}_{m0}$}{current angular velocity vector provided by marker m0}
\rowTable{marker m1 angular velocity}{$\LU{0}{\tomega}_{m1}$}{current angular velocity vector provided by marker m1}
%
\rowTable{ground normal vector}{$\LU{0}{\vv_{PN}}$}{normalized normal vector to the ground plane, currently [0,0,1]}
\rowTable{ground position B}{$\LU{0}{\pv}_{B}$}{disc center point projected on ground (normal projection)}
\rowTable{ground position C}{$\LU{0}{\pv}_{C}$}{contact point of disc with ground}
\rowTable{ground velocity C}{$\LU{0}{\vv}_{C}$}{velocity of disc at ground contact point (must be zero at end of iteration)}
%\rowTable{ground vector}{$\LU{0}{\dv}$}{vector from ground to the disc center point , currently [0,0,\LU{0}{\pv}_{m1,z}]}
\rowTable{wheel axis vector}{$\LU{0}{\wv}_1 =\LU{0,m1}{\Rot} \cdot [1,0,0]\tp $}{normalized disc axis vector, currently $[1,0,0]\tp$ in local coordinates}
\rowTable{longitudinal vector}{$\LU{0}{\wv}_2$}{vector in longitudinal (motion) direction}
\rowTable{lateral vector}{$\LU{0}{\wv}_l = \LU{0}{\vv_{PN}} \times \LU{0}{\wv}_2 = [-\wv_{2,y}, \wv_{2,x}, 0]$}{vector in lateral direction, lies in ground plane}
\rowTable{contact point vector}{$\LU{0}{\wv}_3$}{normalized vector from disc center point in direction of contact point C}
%
\rowTable{algebraic variables}{$\zv=[\lambda_0,\,\lambda_1,\,\lambda_2]\tp$}{vector of algebraic variables (Lagrange multipliers) according to the algebraic equations}
\finishTable
\vspace{6pt}
\noindent {\bf Geometric relations}:\\
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\noindent The main geometrical setup is shown in the following figure:
\begin{center}
\includegraphics[height=4cm]{figures/ObjectJointRollingDiscSketch.pdf}
\end{center}
First, the contact point $\LU{0}{\pv}_{C}$ must be computed.
%Using the point B which is the disc center point projeced to ground plane,
%\be
% \LU{0}{\pv}_{B} = \vr{\LU{0}{\pv}_{m1,x}}{\LU{0}{\pv}_{m1,y}}{0}
%\ee
%This provides the vector $\dv$,
%\be
% \LU{0}{\dv} = \vr{0}{0}{\LU{0}{\pv}_{m1,z}}
%\ee
With the helper vector,
\be
\LU{0}{\xv} = \LU{0}{\wv}_1 \times \LU{0}{\vv_{PN}}
\ee
we obtain a disc coordinate system, representing the longitudinal direction,
\be
\LU{0}{\wv}_2 = \frac{1}{|\LU{0}{\xv}|} \LU{0}{\xv}
\ee
and the vector to the contact point,
\be
\LU{0}{\wv}_3 = \LU{0}{\wv}_1 \times \LU{0}{\wv}_2
\ee
The contact point can be computed from
\be
\LU{0}{\pv}_{C} = \LU{0}{\pv}_{m1} + r \cdot \LU{0}{\wv}_3
\ee
The velocity of the contact point at the disc is computed from,
\be
\LU{0}{\vv}_{C} = \LU{0}{\vv}_{m1} + \LU{0}{\tomega}_{m1} \times (r\cdot \LU{0}{\wv}_3)
\ee
\vspace{6pt}
\noindent {\bf Connector constraint equations (\texttt{activeConnector = True})}:\\
%The holonomic, index 3 constraint for the normal direction reads
%\be
% \LU{0}{\pv}_{C,z} = 0
%\ee
The non-holonomic, index 2 constraints for the tangential motion follow from (an index 3 formulation would be possible, but is not implemented yet because of mixing different jacobians)
\be
\vp{\LU{0}{\vv}_{C,x}}{\LU{0}{\vv}_{C,y}}= \Null
\ee
In the index 2 (velocity level) case, the constraint for the normal direction reads
\be
\LU{0}{\vv}_{C,z} = 0
\ee
if \texttt{activeConnector = False},
\be
\zv = \Null
\ee
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "constraints's unique name"
V, CP, markerNumbers, , 2, ArrayIndex, "ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "$[m0,m1]\tp$list of markers used in connector"
V, CP, constrainedAxes, , 3, ArrayIndex, "ArrayIndex({1,1,1})", , IO, "$\jv=[j_0,\,\ldots,\,j_2]$flag, which determines which constraints are active, in which $j_0,j_1$ represent the tangential motion and $j_2$ represents the normal (contact) direction"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
V, CP, discRadius, , , Real, "0", , I, "defines the disc radius"
V, CP, planeNormal, , , Vector3D, "Vector3D({0,0,1})", , , "normal to the contact / rolling plane; cannot be changed at the moment"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, IsPenaltyConnector, , , Bool, "return false;", , CI, "constraints uses Lagrance multiplier formulation"
#Fv, C, HasVelocityEquations, , , Bool, "return true;", , CI, "constraint also implements velocity level equations"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, const MarkerDataStructure& markerData, Real t, bool velocityLevel = false", CDI, "Computational function: compute algebraic equations and write residual into 'algebraicEquations'; velocityLevel: equation provided at velocity level"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE, const MarkerDataStructure& markerData, Real t", CDI, "compute derivative of algebraic equations w.r.t. ODE2 in jacobian [and w.r.t. ODE2_t coordinates in jacobian_t if flag ODE2_t_AE_function is set] [and w.r.t. AE coordinates if flag AE_AE_function is set in GetAvailableJacobians()]; jacobian[_t] has dimension GetAlgebraicEquationsSize() x (GetODE2Size() + GetODE1Size() [+GetAlgebraicEquationsSize()]); q are the system coordinates; markerData provides according marker information to compute jacobians"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, , , CDI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags; available jacobians is switched depending on velocity level and on activeConnector condition"
Fv, C, UsesVelocityLevel, , , Bool, "return true;", , CI, "Return true, if constraint currently is formulated at velocity level (e.g. coordinate constraint ==> this information is needed for correct jacobian computation)"
#Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return (Marker::Type)((Index)Marker::Position + (Index)Marker::Orientation);", , CI, "provide requested markerType for connector"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Connector + (Index)CObjectType::Constraint);", , CI, "return object type (for node treatment in computation)"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
Fv, C, GetAlgebraicEquationsSize, , , Index, "return 3;", , CI, "number of algebraic equations; independent of node/body coordinates"
Fv, M, GetTypeName, , , const char*,"return 'JointRollingDisc';", , CI, "Get type name of object (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, discWidth, , , float, "0.1f", , IO, "width of disc for drawing"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectJointRevolute2D
classDescription = "A revolute joint in 2D; constrains the absolute 2D position of two points given by PointMarkers or RigidMarkers"
cParentClass = CObjectConstraint
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = RevoluteJoint2D
classType = Object
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "constraints's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "list of markers used in connector"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, IsPenaltyConnector, , , Bool, "return false;", , CI, "constraints uses Lagrance multiplier formulation"
#Fv, C, HasVelocityEquations, , , Bool, "return true;", , CI, "constraint also implements velocity level equations"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, const MarkerDataStructure& markerData, Real t, bool velocityLevel = false", CDI, "Computational function: compute algebraic equations and write residual into 'algebraicEquations'; velocityLevel: equation provided at velocity level"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE, const MarkerDataStructure& markerData, Real t", CDI, "compute derivative of algebraic equations w.r.t. ODE2 in jacobian [and w.r.t. ODE2_t coordinates in jacobian_t if flag ODE2_t_AE_function is set] [and w.r.t. AE coordinates if flag AE_AE_function is set in GetAvailableJacobians()]; jacobian[_t] has dimension GetAlgebraicEquationsSize() x (GetODE2Size() + GetODE1Size() [+GetAlgebraicEquationsSize()]); q are the system coordinates; markerData provides according marker information to compute jacobians"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, , , CDI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags; available jacobians is switched depending on velocity level and on activeConnector condition"
Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::Position;", , CI, "provide requested markerType for connector"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Connector + (Index)CObjectType::Constraint);", , CI, "return object type (for node treatment in computation)"
Fv, C, GetAlgebraicEquationsSize, , , Index, "return 2;", , CI, "number of algebraic equations; independent of node/body coordinates"
Fv, M, GetTypeName, , , const char*,"return 'JointRevolute2D';", , CI, "Get type name of object (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = radius of revolute joint; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectJointPrismatic2D
classDescription = "A prismatic joint in 2D; allows the relative motion of two bodies, using two RigidMarkers; the vector $\tv_0$ = axisMarker0 is given in local coordinates of the first marker's (body) frame and defines the prismatic axis; the vector $\mathbf{n}_1$ = normalMarker1 is given in the second marker's (body) frame and is the normal vector to the prismatic axis; using the global position vector $\pv_0$ and rotation matrix $\Am_0$ of marker0 and the global position vector $\pv_1$ rotation matrix $\Am_1$ of marker1, the equations for the prismatic joint follow as \be (\pv_1-\pv_0)^T\cdot \Am_1 \cdot \mathbf{n}_1 = 0 \ee \be (\Am_0 \cdot \tv_0)^T \cdot \Am_1 \cdot \mathbf{n}_1 = 0\ee The lagrange multipliers follow for these two equations $[\lambda_0,\lambda_1]$, in which $\lambda_0$ is the transverse force and $\lambda_1$ is the torque in the joint."
cParentClass = CObjectConstraint
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = PrismaticJoint2D
classType = Object
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "constraints's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "list of markers used in connector"
V, CP, axisMarker0, , , Vector3D, "Vector3D({1.,0.,0.})", , I, "direction of prismatic axis, given as a 3D vector in Marker0 frame"
V, CP, normalMarker1, , , Vector3D, "Vector3D({0.,1.,0.})", , I, "direction of normal to prismatic axis, given as a 3D vector in Marker1 frame"
V, CP, constrainRotation, , , bool, "true", , IO, "flag, which determines, if the connector also constrains the relative rotation of the two objects; if set to false, the constraint will keep an algebraic equation set equal zero"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, IsPenaltyConnector, , , Bool, "return false;", , CI, "constraints uses Lagrance multiplier formulation"
#Fv, C, HasVelocityEquations, , , Bool, "return true;", , CI, "constraint also implements velocity level equations"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, const MarkerDataStructure& markerData, Real t, bool velocityLevel = false", CDI, "Computational function: compute algebraic equations and write residual into 'algebraicEquations'; velocityLevel: equation provided at velocity level"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE, const MarkerDataStructure& markerData, Real t", CDI, "compute derivative of algebraic equations w.r.t. ODE2 in jacobian [and w.r.t. ODE2_t coordinates in jacobian_t if flag ODE2_t_AE_function is set] [and w.r.t. AE coordinates if flag AE_AE_function is set in GetAvailableJacobians()]; jacobian[_t] has dimension GetAlgebraicEquationsSize() x (GetODE2Size() + GetODE1Size() [+GetAlgebraicEquationsSize()]); q are the system coordinates; markerData provides according marker information to compute jacobians"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, , , CDI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags; available jacobians is switched depending on velocity level and on activeConnector condition"
Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return (Marker::Type)(Marker::Position + Marker::Orientation);", , CI, "provide requested markerType for connector"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Connector + (Index)CObjectType::Constraint);", , CI, "return object type (for node treatment in computation)"
Fv, C, GetAlgebraicEquationsSize, , , Index, "return 2;", , CI, "number of algebraic equations; independent of node/body coordinates"
Fv, M, GetTypeName, , , const char*,"return 'JointPrismatic2D';", , CI, "Get type name of object (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = radius of revolute joint; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectJointSliding2D
classDescription = "A specialized sliding joint (without rotation) in 2D between a Cable2D (marker1) and a position-based marker (marker0); the data coordinate x[0] provides the current index in slidingMarkerNumbers, and x[1] the local position in the cable element at the beginning of the timestep."
cParentClass = CObjectConstraint
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = SlidingJoint2D
outputVariables = "{'Position':'position vector of joint given by marker0', 'Velocity':'velocity vector of joint given by marker0', 'SlidingCoordinate':'global sliding coordinate along all elements; the maximum sliding coordinate is equivalent to the reference lengths of all sliding elements', 'Force':'joint force vector (3D)'}"
classType = Object
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
\vspace{6pt}\\
{\bf Definition of quantities}:
%\startTable{input parameter}{symbol}{description}
%\rowTable{nodeNumber}{$n_{GD}$}{node number of generic data node}
%\rowTable{markerNumbers[0]}{$m0$}{position-marker of mass point or rigid body}
%\rowTable{markerNumbers[1]}{$m1$}{marker to a Cable2D element, which is {\bf updated} in every PostNewtonStep; if the sliding body ($m0$) is in the range of all sliding cable elements, $m1$ contains the current marker number, which is active for the sliding joint}
%\rowTable{slidingMarkerNumbers}{$[m_{s0}, \ldots, m_{sn}]\tp$}{a list of $sn$ (global) marker numbers which are are used to update marker1}
%\rowTable{slidingMarkerOffsets}{$[d_{s0}, \ldots, d_{sn}]$}{a list of $sn$ scalar offsets, which represent the (reference arc) length of all previous sliding cable elements}
%\finishTable
%
\startTable{intermediate variables}{symbol}{description}
\rowTable{data node}{$\xv=[x_{data0},\,x_{data1}]\tp$}{coordinates of node with node number $n_{GD}$}
\rowTable{data coordinate 0}{$x_{data0}$}{the current index in slidingMarkerNumbers}
\rowTable{data coordinate 1}{$x_{data1}$}{the global sliding coordinate (ranging from 0 to the total length of all sliding elements) at {\bf start-of-step} - beginning of the timestep}
\rowTable{marker m0 position}{$\LU{0}{\pv}_{m0}$}{current global position which is provided by marker m0}
\rowTable{marker m0 velocity}{$\LU{0}{\vv}_{m0}$}{current global velocity which is provided by marker m0}
%
\rowTable{cable coordinates}{$\qv_{ANCF,m1}$}{current coordiantes of the ANCF cable element with the current marker $m1$ is referring to}
\rowTable{sliding position}{$\LUR{0}{\rv}{ANCF} = \Sm(s_{el})\qv_{ANCF,m1}$}{current global position at the ANCF cable element, evaluated at local sliding position $s_{el}$}
\rowTable{sliding position slope}{$\LURU{0}{\rv}{ANCF}{\prime} = \Sm^\prime(s_{el})\qv_{ANCF,m1} = [r^\prime_0,\,r^\prime_1]\tp$}{current global slope vector of the ANCF cable element, evaluated at local sliding position $s_{el}$}
\rowTable{sliding velocity}{$\LUR{0}{\vv}{ANCF} = \Sm(s_{el})\dot\qv_{ANCF,m1}$}{current global velocity at the ANCF cable element, evaluated at local sliding position $s_{el}$ ($s_{el}$ not differentiated!!!)}
\rowTable{sliding velocity slope}{$\LURU{0}{\vv}{ANCF}{\prime} = \Sm^\prime(s_{el})\dot\qv_{ANCF,m1}$}{current global slope velocity vector of the ANCF cable element, evaluated at local sliding position $s_{el}$}
%
\rowTable{sliding normal vector}{$\LU{0}{\nv} = [-r^\prime_1,\,r^\prime_0]$}{2D normal vector computed from slope $\rv^\prime=\LURU{0}{\rv}{ANCF}{\prime}$}
\rowTable{sliding normal velocity vector}{$\LU{0}{\dot\nv} = [-\dot r^\prime_1,\,\dot r^\prime_0]$}{time derivative of 2D normal vector computed from slope velocity $\dot \rv^\prime=\LURU{0}{\dot \rv}{ANCF}{\prime}$}
%
\rowTable{algebraic coordinates}{$\zv=[\lambda_0,\,\lambda_1,\, s]\tp$}{algebraic coordinates composed of Lagrange multipliers $\lambda_0$ and $\lambda_1$ (in local cable coordinates: $\lambda_0$ is in axis direction) and the current sliding coordinate $s$, which is local in the current cable element. }
\rowTable{local sliding coordinate}{$s$}{local incremental sliding coordinate $s$: the (algebraic) sliding coordinate {\bf relative to the start-of-step value}. Thus, $s$ only contains small local increments.}
\finishTable
\startTable{output variables}{symbol}{formula}
\rowTable{Position}{$\LU{0}{\pv}_{m0}$}{current global position of position marker $m0$}
\rowTable{Velocity}{$\LU{0}{\vv}_{m0}$}{current global velocity of position marker $m0$}
\rowTable{SlidingCoordinate}{$s_g = s + x_{data1}$}{current value of the global sliding coordinate}
\rowTable{Force}{$\fv$}{see below}
\finishTable
%cable
Assume we have given the sliding coordinate $s$ (e.g., as a guess of the Newton method or beginning of the time step).
The element sliding coordinate (in the local coordinates of the current sliding element) is computed as
\be
s_{el} = s + x_{data1} - d_{m1} = s_g - d_{m1}.
\ee
The vector (=difference; error) between the marker $m0$ and the marker $m1$ (=$\rv_{ANCF}$) positions reads
\be
\LU{0}{\Delta\pv} = \LUR{0}{\rv}{ANCF} - \LU{0}{\pv}_{m0}
\ee
The vector (=difference; error) between the marker $m0$ and the marker $m1$ velocities reads
\be
\LU{0}{\Delta\vv} = \LUR{0}{\dot\rv}{ANCF} - \LU{0}{\vv}_{m0}
\ee
%
%+++++++++++++++++++++++++++++++++++++++++++++
\noindent {\bf Algebraic constraint equations (classicalFormulation=True)}:
The 2D sliding joint is implemented having 3 equations, using the special algebraic coordinates $\zv$.
The algebraic equations read
\bea
\LU{0}{\Delta\pv} &=& \Null, \quad \mbox{... 2 index 3 equations, ensuring the sliding body to stay at the cable}\\
\left[\lambda_0,\lambda_1\right] \cdot \LURU{0}{\rv}{ANCF}{\prime} &=& 0, \quad \mbox{... 1 index 1 equation, ensuring the force in sliding direction = 0} \\
\eea
No index 2 case exists, because no time derivative exists for $s_{el}$. The jacobian matrices for algebraic and ODE2 coordinates read
\be
J_{AE} = \mr{0}{0}{r^\prime_0} {0}{0}{r^\prime_1} {r^\prime_0}{r^\prime_1}{r^{\prime\prime}_0\lambda_0 + r^{\prime\prime}_1\lambda_1} %\LURU{0}{\rv}{ANCF}{\prime\prime \mathrm{T}} \vp{\lambda_0}{\lambda_1}}
\ee
\be
J_{ODE2} = \mp{-J_{pos,m0}}{\Sm(s_{el})} {\Null\tp}{\left[\lambda_0,\,\lambda_1\right]\cdot\Sm^\prime(s_{el}) }
\ee
if \texttt{activeConnector = False}, the algebraic equations are changed to:
\bea
\lambda_0 &=& 0, \\
\lambda_1 &=& 0, \\
s &=& 0
\eea
%the algebraic variables are \be \qv_{AE}=[\lambda_x\;\; \lambda_y \;\; s]^T \ee in which $\lambda_x$ and $\lambda_y$ are the Lagrange multipliers for the position of the sliding joint;
%+++++++++++++++++++++++++++++++++++++++++++++
\noindent {\bf Algebraic constraint equations (classicalFormulation=False)}:
The 2D sliding joint is implemented having 3 equations (first equation is dummy and could be eliminated), using the special algebraic coordinates $\zv$.
The algebraic equations read
\bea
\lambda_0 &=& 0, \quad \mbox{... this equation is not necessary, but can be used for switching to other modes} \\
\LU{0}{\Delta\pv\tp} \LU{0}{\nv} &=& 0, \quad \mbox{... equation ensures that sliding body stays at cable centerline; index3 equation}\\
\LU{0}{\Delta\pv\tp} \LURU{0}{\rv}{ANCF}{\prime} &=& 0. \quad \mbox{... resolves the sliding coordinate $s$; index1 equation!}
\eea
In the index 2 case, the second equation reads
\be
\LU{0}{\Delta\vv\tp} \LU{0}{\nv} + \LU{0}{\Delta\pv\tp} \LU{0}{\dot\nv} = 0
\ee
if \texttt{activeConnector = False}, the algebraic equations are changed to:
\bea
\lambda_0 &=& 0, \\
\lambda_1 &=& 0, \\
s &=& 0
\eea
%the algebraic variables are \be \qv_{AE}=[\lambda_x\;\; \lambda_y \;\; s]^T \ee in which $\lambda_x$ and $\lambda_y$ are the Lagrange multipliers for the position of the sliding joint;
%
%+++++++++++++++++++++++++++++++++++++++++++++
\noindent {\bf Post Newton Step}:
After the Newton solver has converged, a PostNewtonStep is performed for the element, which
updates the marker $m1$ index if necessary.
\bea
s_{el} < 0 \quad \ra \quad x_{data0}\;-\!\!=1 \nonumber\\
s_{el} > L \quad \ra \quad x_{data0}\;+\!\!=1
\eea
Furthermore, it is checked, if $x_{data0}$ becomes smaller than zero, which raises a warning and keeps $x_{data0}=0$.
The same results if $x_{data0}\ge sn$, then $x_{data0} = sn$.
Finally, the data coordinate is updated in order to provide the starting value for the next step,
\be
x_{data1} \;+\!\!= s.
\ee
%the data coordinates are \be \qv_{Data} = [i_{marker} \;\; s_{0}]^T \ee in which $i_{marker}$ is the current local index to the slidingMarkerNumber list and $s_{0}$ is the sliding coordinate (which is the total sliding length along all cable elements in the cableMarkerNumber list) at the beginning of the solution step.
%
{\bf Examples}: see TestModels!
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "constraints's unique name"
V, CP, markerNumbers, , , ArrayIndex,"ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "$[m0,m1]\tp$marker m0: position-marker of mass point or rigid body; marker m1: updated marker to Cable2D element, where the sliding joint currently is attached to; must be initialized with an appropriate (global) marker number according to the starting position of the sliding object; this marker changes with time (PostNewtonStep)"
V, CP, slidingMarkerNumbers, , , ArrayIndex,"ArrayIndex()", , I, "$[m_{s0}, \ldots, m_{sn}]\tp$these markers are used to update marker m1, if the sliding position exceeds the current cable's range; the markers must be sorted such that marker $m_{si}$ at x=cable(i).length is equal to marker(i+1) at x=0 of cable(i+1)"
V, CP, slidingMarkerOffsets, , , Vector,"Vector()", , I, "$[d_{s0}, \ldots, d_{sn}]$this list contains the offsets of every sliding object (given by slidingMarkerNumbers) w.r.t. to the initial position (0): marker m0: offset=0, marker m1: offset=Length(cable0), marker m2: offset=Length(cable0)+Length(cable1), ..."
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "$n_{GD}$node number of a NodeGenericData for 1 dataCoordinate showing the according marker number which is currently active and the start-of-step (global) sliding position"
V, CP, classicalFormulation, , , bool, "true", , IO, "uses a formulation with 3 equations, including the force in sliding direction to be zero; forces in global coordinates, only index 3; alternatively: use local formulation, which only needs two equations and can be used with index 2 formulation"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex == 0);\n return parameters.nodeNumber;", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 1;", , CI, "number of nodes; needed for every object"
Fv, C, GetDataVariablesSize, , , Index, "return 2;", , CI, "data variables: [0] showing the current (local) index in slidingMarkerNumber list --> providing the cable element active in sliding; coordinate [1] stores the previous sliding coordinate"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#
Fv, C, IsPenaltyConnector, , , Bool, "return false;", , CI, "constraints uses Lagrance multiplier formulation"
#Fv, C, HasVelocityEquations, , , Bool, "return false;", , CI, "constraint also implements velocity level equations"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, const MarkerDataStructure& markerData, Real t, bool velocityLevel = false", CDI, "Computational function: compute algebraic equations and write residual into 'algebraicEquations'; velocityLevel: equation provided at velocity level"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE, const MarkerDataStructure& markerData, Real t", CDI, "compute derivative of algebraic equations w.r.t. ODE2 in jacobian [and w.r.t. ODE2_t coordinates in jacobian_t if flag ODE2_t_AE_function is set] [and w.r.t. AE coordinates if flag AE_AE_function is set in GetAvailableJacobians()]; jacobian[_t] has dimension GetAlgebraicEquationsSize() x (GetODE2Size() + GetODE1Size() [+GetAlgebraicEquationsSize()]); q are the system coordinates; markerData provides according marker information to compute jacobians"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::AE_ODE2 + JacobianType::AE_ODE2_function + JacobianType::AE_AE + JacobianType::AE_AE_function);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, HasDiscontinuousIteration, , , Bool, "return true;", , CI, "flag to be set for connectors, which use DiscontinuousIteration"
Fv, C, PostNewtonStep, , , Real, , "const MarkerDataStructure& markerDataCurrent, PostNewtonFlags::Type& flags", DI, "function called after Newton method; returns a residual error (force)"
Fv, C, PostDiscontinuousIterationStep, , , void, , , DI, "function called after discontinuous iterations have been completed for one step (e.g. to finalize history variables and set initial values for next step)"
#
#Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
#Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::_None;", , CI, "provide requested markerType for connector; for different markerTypes in marker0/1 => set to ::\_None"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::GenericData;", , CI, "provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Connector + (Index)CObjectType::Constraint);", , CI, "return object type (for node treatment in computation)"
Fv, C, GetAlgebraicEquationsSize, , , Index, "return 3;", , CI, "q0=forceX of sliding joint, q1=forceY of sliding joint; q2=axial (sliding) coordinate at beam"
Fv, M, GetTypeName, , , const char*,"return 'JointSliding2D';", , CI, "Get type name of object (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#internal functions:
F, C, ComputeLocalSlidingCoordinate, , , Real, , "", CDI, "compute the (local) sliding coordinate within the current cable element"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = radius of revolute joint; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = ObjectJointALEMoving2D
classDescription = "A specialized axially moving joint (without rotation) in 2D between a ALE Cable2D (marker1) and a position-based marker (marker0); ALE=Arbitrary Lagrangian Eulerian; the data coordinate x[0] provides the current index in slidingMarkerNumbers, and the ODE2 coordinate q[0] provides the (given) moving coordinate in the cable element."
cParentClass = CObjectConstraint
mainParentClass = MainObjectConnector
visuParentClass = VisualizationObject
pythonShortName = ALEMovingJoint2D
outputVariables = "{'Position':'$\LU{0}{\pv}_{m0}$current global position of position marker $m0$', 'Velocity':'$\LU{0}{\vv}_{m0}$current global velocity of position marker $m0$', 'SlidingCoordinate':'$s_g = q_{ALE} + s_{off}$current value of the global sliding ALE coordinate, including offset; note that reference coordinate of $q_{ALE}$ is ignored!', 'Coordinates':'$[x_{data0},\,q_{ALE}]\tp$provides two values: [0] = current sliding marker index, [1] = ALE sliding coordinate', 'Coordinates_t':'$[\dot q_{ALE}]\tp$provides ALE sliding velocity', 'Force':'$\fv$joint force vector (3D)'}"
classType = Object
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
equations =
%\vspace{6pt}\\
%{\bf Definition of quantities}:
%\startTable{input parameter}{symbol}{description}
%\rowTable{nodeNumbers}{$[n_{GD}, n_{ALE}]$}{node number of NodeGenericData $n_{GD}$ with one data coordinate and $n_{ALE}$ of NodeGenericODE2 with one ODE2 coordinate}
%\rowTable{slidingOffset}{$s_{off}$}{sliding offset, which is added to the current value of the ALE node coordinate}
%\rowTable{markerNumbers[0]}{$m0$}{position-marker of mass point or rigid body}
%\rowTable{markerNumbers[1]}{$m1$}{marker to a Cable2D element, which is {\bf updated} in every PostNewtonStep; $m1$ contains the current marker number, which is active for the sliding joint; must be initialized appropriately}
%\rowTable{slidingMarkerNumbers}{$[m_{s0}, \ldots, m_{sn}]\tp$}{a list of $sn$ (global) marker numbers which are are used to update marker1}
%\rowTable{slidingMarkerOffsets}{$[d_{s0}, \ldots, d_{sn}]$}{a list of $sn$ scalar offsets, which represent the (reference arc) length of all previous sliding cable elements}
%\rowTable{penaltyStiffness}{$k$}{penalty stiffness coefficients for usePenaltyFormulation=True}
%\finishTable
%
\startTable{intermediate variables}{symbol}{description}
\rowTable{generic data node}{$\xv=[x_{data0}]\tp$}{coordinates of node with node number $n_{GD}$}
\rowTable{generic ODE2 node}{$\qv=[q_{0}]\tp$}{coordinates of node with node number $n_{ALE}$, which is shared with all ALE-ANCF and ALE sliding joint objects}
\rowTable{data coordinate}{$x_{data0}$}{the current index in slidingMarkerNumbers}
\rowTable{ALE coordinate}{$q_{ALE} = q_{0}$}{current ALE coordinate (in fact this is the Eulerian coordinate in the ALE formulation); note that reference coordinate of $q_{ALE}$ is ignored!}
\rowTable{marker m0 position}{$\LU{0}{\pv}_{m0}$}{current global position which is provided by marker m0}
\rowTable{marker m0 velocity}{$\LU{0}{\vv}_{m0}$}{current global velocity which is provided by marker m0}
%
\rowTable{cable coordinates}{$\qv_{ANCF,m1}$}{current coordiantes of the ANCF cable element with the current marker $m1$ is referring to}
\rowTable{sliding position}{$\LUR{0}{\rv}{ANCF} = \Sm(s_{el})\qv_{ANCF,m1}$}{current global position at the ANCF cable element, evaluated at local sliding position $s_{el}$}
\rowTable{sliding position slope}{$\LURU{0}{\rv}{ANCF}{\prime} = \Sm^\prime(s_{el})\qv_{ANCF,m1}$}{current global slope vector of the ANCF cable element, evaluated at local sliding position $s_{el}$}
\rowTable{sliding velocity}{$\LUR{0}{\vv}{ANCF} = \Sm(s_{el})\dot\qv_{ANCF,m1} + \dot q_{ALE} \LURU{0}{\rv}{ANCF}{\prime}$}{current global velocity at the ANCF cable element, evaluated at local sliding position $s_{el}$, including convective term}
%
\rowTable{sliding normal vector}{$\LU{0}{\nv} = [-r^\prime_1,\,r^\prime_0]$}{2D normal vector computed from slope $\rv^\prime=\LURU{0}{\rv}{ANCF}{\prime}$}
%\rowTable{sliding normal vector}{$\LU{0}{\dot\nv} = [-\dot r^\prime_1,\,\dot r^\prime_0]$}{time derivative of 2D normal vector computed from slope velocity $\dot \rv^\prime=\LURU{0}{\dot \rv}{ANCF}{\prime}$}
%
\rowTable{algebraic variables}{$\zv=[\lambda_0,\,\lambda_1]\tp$}{algebraic variables (Lagrange multipliers) according to the algebraic equations }
\finishTable
%\startTable{output variables}{symbol}{formula}
%\rowTable{Position}{$\LU{0}{\pv}_{m0}$}{current global position of position marker $m0$}
%\rowTable{Velocity}{$\LU{0}{\vv}_{m0}$}{current global velocity of position marker $m0$}
%\rowTable{SlidingCoordinate}{$s_g = q_{ALE} + s_{off}$}{current value of the global sliding ALE coordinate, including offset; note that reference coordinate of $q_{ALE}$ is ignored!}
%\rowTable{Coordinates}{$[x_{data0},\,q_{ALE}]\tp$}{}
%\rowTable{Coordinates\_t}{$[\dot q_{ALE}]\tp$}{}
%\rowTable{Force}{$\fv$}{see below}
%\finishTable
The element sliding coordinate (in the local coordinates of the current sliding element) is computed from the ALE coordinate
\be
s_{el} = q_{ALE} + s_{off} - d_{m1} = s_g - d_{m1}.
\ee
The vector (=difference; error) between the marker $m0$ and the marker $m1$ (=$\rv_{ANCF}$) positions reads
\be
\LU{0}{\Delta\pv} = \LUR{0}{\rv}{ANCF} - \LU{0}{\pv}_{m0}
\ee
The vector (=difference; error) between the marker $m0$ and the marker $m1$ velocities reads
\be
\LU{0}{\Delta\vv} = \LUR{0}{\vv}{ANCF} - \LU{0}{\vv}_{m0}
\ee
%
%+++++++++++++++++++++++++++++++++++++++++++++
\noindent {\bf Algebraic constraint equations}:
The 2D sliding joint is implemented having 2 equations, using the Lagrange multipliers $\zv$.
The algebraic (index 3) equations read
\be
\LU{0}{\Delta\pv} = 0
\ee
Note that the Lagrange multipliers $[\lambda_0,\,\lambda_1]\tp$are the global forces in the joint.
In the index 2 case the algebraic equations read
\be
\LU{0}{\Delta\vv} = 0
\ee
If \texttt{usePenalty = True}, the algebraic equations are changed to:
\be
\LU{0}{\Delta \pv} - \frac 1 k \zv = 0.
\ee
%
%not realized yet, because AE Jacobian becomes involved:
%If \texttt{usePenaltyFormulation = True}, the algebraic equations are changed to:
%\bea
% k_1 \LURU{0}{\rv}{ANCF}{\prime \mathrm{T}} \LU{0}{\Delta\pv} - \lambda_0 &=& 0, \nonumber \\
% k_2 \LU{0}{\nv\tp} \LU{0}{\Delta\pv} - \lambda_1 &=& 0.
%\eea
%Note that in this case, the Lagrange multipliers $[\lambda_0,\,\lambda_1]\tp$are the local ($m1$) forces in the joint.
\noindent If \texttt{activeConnector = False}, the algebraic equations are changed to:
\bea
\lambda_0 &=& 0, \\
\lambda_1 &=& 0.
\eea
%
%+++++++++++++++++++++++++++++++++++++++++++++
\noindent {\bf Post Newton Step}:
After the Newton solver has converged, a PostNewtonStep is performed for the element, which
updates the marker $m1$ index if necessary.
\bea
s_{el} < 0 \quad \ra \quad x_{data0} \;-\!\!=1 \nonumber\\
s_{el} > L \quad \ra \quad x_{data0} \;+\!\!=1
\eea
Furthermore, it is checked, if $x_{data0}$ becomes smaller than zero, which raises a warning and keeps $x_{data0}=0$.
The same results if $x_{data0}\ge sn$, then $x_{data0} = sn$.
Finally, the data coordinate is updated in order to provide the starting value for the next step,
\be
x_{data1} \;+\!\!= s.
\ee
%
{\bf Examples}: see TestModels!
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "constraints's unique name"
V, CP, markerNumbers, , , ArrayIndex, "ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "$[m0,\,m1]\tp$marker m0: position-marker of mass point or rigid body; marker m1: updated marker to ANCF Cable2D element, where the sliding joint currently is attached to; must be initialized with an appropriate (global) marker number according to the starting position of the sliding object; this marker changes with time (PostNewtonStep)"
V, CP, slidingMarkerNumbers, , , ArrayIndex, "ArrayIndex()", , I, "$[m_{s0}, \ldots, m_{sn}]\tp$a list of sn (global) marker numbers which are are used to update marker1"
V, CP, slidingMarkerOffsets, , , Vector, "Vector()", , I, "$[d_{s0}, \ldots, d_{sn}]$this list contains the offsets of every sliding object (given by slidingMarkerNumbers) w.r.t. to the initial position (0): marker0: offset=0, marker1: offset=Length(cable0), marker2: offset=Length(cable0)+Length(cable1), ..."
V, CP, slidingOffset, , , Real, 0., , I, "$s_{off}$sliding offset list [SI:m]: a list of sn scalar offsets, which represent the (reference arc) length of all previous sliding cable elements"
V, CP, nodeNumbers, , , ArrayIndex, "ArrayIndex({ EXUstd::InvalidIndex, EXUstd::InvalidIndex })", , I, "$[n_{GD}, n_{ALE}]$node number of NodeGenericData (GD) with one data coordinate and of NodeGenericODE2 (ALE) with one ODE2 coordinate"
V, CP, usePenaltyFormulation, , , bool, "false", , IO, "flag, which determines, if the connector is formulated with penalty, but still using algebraic equations (IsPenaltyConnector() still false)"
V, CP, penaltyStiffness, , , Real, 0., , I, "$k$penalty stiffness [SI:N/m] used if usePenaltyFormulation=True"
V, CP, activeConnector, , , bool, "true", , IO, "flag, which determines, if the connector is active; used to deactivate (temorarily) a connector or constraint"
#
Fv, C, GetMarkerNumbers, , , "const ArrayIndex&", "return parameters.markerNumbers;",,CI, "default function to return Marker numbers"
Fv, C, GetNodeNumber, , , Index, "release_assert(localIndex <= 1);\n return parameters.nodeNumbers[localIndex];", "Index localIndex", CI, "Get global node number (with local node index); needed for every object ==> does local mapping"
Fv, C, GetNumberOfNodes, , , Index, "return 2;", , CI, "number of nodes; needed for every object"
Fv, C, GetDataVariablesSize, , , Index, "return 1;", , CI, "data variables: [0] showing the current (local) index in slidingMarkerNumber list --> providing the cable element active in sliding; coordinate [1] stores the previous sliding coordinate"
#Done automatically? Fv, C, GetODE2Size, , , Index, "return 1;", , CI, "number of ODE2 coordinates; needed for object?"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#
Fv, C, IsPenaltyConnector, , , Bool, "return false;", , CI, "constraints uses Lagrance multiplier formulation"
#Fv, C, HasVelocityEquations, , , Bool, "return false;", , CI, "constraint also implements velocity level equations"
Fv, C, ComputeAlgebraicEquations, , , void, , "Vector& algebraicEquations, const MarkerDataStructure& markerData, Real t, bool velocityLevel = false", CDI, "Computational function: compute algebraic equations and write residual into 'algebraicEquations'; velocityLevel: equation provided at velocity level"
Fv, C, ComputeJacobianAE, , , void, , "ResizableMatrix& jacobian, ResizableMatrix& jacobian_t, ResizableMatrix& jacobian_AE, const MarkerDataStructure& markerData, Real t", CDI, "compute derivative of algebraic equations w.r.t. ODE2 in jacobian [and w.r.t. ODE2_t coordinates in jacobian_t if flag ODE2_t_AE_function is set] [and w.r.t. AE coordinates if flag AE_AE_function is set in GetAvailableJacobians()]; jacobian[_t] has dimension GetAlgebraicEquationsSize() x (GetODE2Size() + GetODE1Size() [+GetAlgebraicEquationsSize()]); q are the system coordinates; markerData provides according marker information to compute jacobians"
Fv, C, GetAvailableJacobians, , , JacobianType::Type, "return (JacobianType::Type)(JacobianType::AE_ODE2 + JacobianType::AE_ODE2_function + JacobianType::AE_AE + JacobianType::AE_AE_function);", , CI, "return the available jacobian dependencies and the jacobians which are available as a function; if jacobian dependencies exist but are not available as a function, it is computed numerically; can be combined with 2^i enum flags"
Fv, C, HasDiscontinuousIteration, , , Bool, "return true;", , CI, "flag to be set for connectors, which use DiscontinuousIteration"
Fv, C, PostNewtonStep, , , Real, , "const MarkerDataStructure& markerDataCurrent, PostNewtonFlags::Type& flags", DI, "function called after Newton method; returns a residual error (force)"
Fv, C, PostDiscontinuousIterationStep, , , void, , , DI, "function called after discontinuous iterations have been completed for one step (e.g. to finalize history variables and set initial values for next step)"
#
#Fv, C, GetOutputVariableTypes, , , OutputVariableType,, , CDI, "Flags to determine, which output variables are available (displacment, velocity, stress, ...)"
Fv, C, GetOutputVariableConnector, , , void, , "OutputVariableType variableType, const MarkerDataStructure& markerData, Vector& value", DC, "provide according output variable in 'value'"
#Fv, C, GetOutputVariable, , , void, , "OutputVariableType variableType, Vector& value", DC, "provide according output variable in 'value'"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::_None;", , CI, "provide requested markerType for connector; for different markerTypes in marker0/1 => set to ::\_None"
Fv, M, GetRequestedNodeType, , , Node::Type, "return Node::_None;", , CI, "must be checked in CheckPreAssembleConsistency(...); provide requested nodeType for objects; used for automatic checks in CheckSystemIntegrity()"
Fv, C, GetType, , , CObjectType,"return (CObjectType)((Index)CObjectType::Connector + (Index)CObjectType::Constraint);", , CI, "return object type (for node treatment in computation)"
Fv, C, GetAlgebraicEquationsSize, , , Index, "return 2;", , CI, "q0=forceX of sliding joint, q1=forceY of sliding joint"
Fv, M, GetTypeName, , , const char*,"return 'JointALEMoving2D';", , CI, "Get type name of object (without keyword 'Object'...!); could also be realized via a string -> type conversion?"
Fv, C, IsActive, , , Bool, "return parameters.activeConnector;", , CI, "return if connector is active-->speeds up computation"
#internal functions:
F, C, ComputeLocalSlidingCoordinate, , , Real, , "", CDI, "compute the (local) sliding coordinate within the current cable element; this is calculated from (globalSlidingCoordinate - slidingMarkerOffset) of the cable"
F, C, ComputeLocalSlidingCoordinate_t,, , Real, , "", CDI, "compute the (local=global) sliding velocity, which is equivalent to the ALE velocity!"
#VISUALIZATION:
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
Fv, V, IsConnector, , , Bool, "return true;", , CI, "this function is needed to distinguish connector objects from body objects"
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, drawSize, , , float, "-1.f", , IO, "drawing size = radius of revolute joint; size == -1.f means that default connector size is used"
V, V, color, , , Float4, "Float4({-1.f,-1.f,-1.f,-1.f})",, IO, "RGBA connector color; if R==-1, use default color"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = MarkerBodyMass
classDescription = "A marker attached to the body mass; use this marker to apply a body-load (e.g. gravitational force)."
cParentClass = CMarker
mainParentClass = MainMarker
visuParentClass = VisualizationMarker
classType = Marker
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, bodyNumber, , , ObjectIndex,"EXUstd::InvalidIndex", , I, "body number to which marker is attached to"
#
Fv, C, GetObjectNumber, , , Index, "return parameters.bodyNumber;", , CI, "general access to object number"
Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Body + Marker::Object + Marker::BodyMass);", , CI, "return marker type (for node treatment in computation)"
Fv, C, GetDimension, , , Index, "return 3;", "const CSystemData& cSystemData", CI, "return dimension of connector, which an attached connector would have; for coordinate markers, it gives the number of coordinates used by the marker"
Fv, C, GetPosition, , , void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of marker at local position (0,0,0) of the body"
#DONE in ComputeMarkerData: Fv, C, GetPositionJacobian, , , void, , "const CSystemData& cSystemData, Matrix& jacobian", CDI, "return current position Jacobian of marker"
Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
Fv, M, GetTypeName, , , const char*,"return 'BodyMass';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = MarkerBodyPosition
classDescription = "A position body-marker attached to local position (x,y,z) of the body."
cParentClass = CMarker
mainParentClass = MainMarker
visuParentClass = VisualizationMarker
classType = Marker
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, bodyNumber, , , ObjectIndex,"EXUstd::InvalidIndex", , I, "body number to which marker is attached to"
V, CP, localPosition, , 3, Vector3D, "Vector3D({0.,0.,0.})", , I, "local body position of marker; e.g. local (body-fixed) position where force is applied to"
#V, CP, bodyFixed, , , Bool, "false", , IO, "if bodyFixed is true, the force/sensor is using body-fixed coordinates (orientation); otherwise, it uses global coordinates"
#
Fv, C, GetObjectNumber, , , Index, "return parameters.bodyNumber;", , CI, "general access to object number"
Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Body + Marker::Object + Marker::Position);", , CI, "return marker type (for node treatment in computation)"
Fv, C, GetDimension, , , Index, "return 3;", "const CSystemData& cSystemData", CI, "return dimension of connector, which an attached connector would have; for coordinate markers, it gives the number of coordinates used by the marker"
Fv, C, GetPosition, , , void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of marker"
Fv, C, GetVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& velocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return velocity of marker"
#Fv, C, GetPositionJacobian, , , void, , "const CSystemData& cSystemData, Matrix& jacobian", CDI, "return current position Jacobian of marker"
Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
Fv, M, GetTypeName, , , const char*,"return 'BodyPosition';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = MarkerBodyRigid
classDescription = "A rigid-body (position+orientation) body-marker attached to local position (x,y,z) of the body."
cParentClass = CMarker
mainParentClass = MainMarker
visuParentClass = VisualizationMarker
classType = Marker
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, bodyNumber, , , ObjectIndex,"EXUstd::InvalidIndex", , I, "body number to which marker is attached to"
V, CP, localPosition, , 3, Vector3D, "Vector3D({0.,0.,0.})", , I, "local body position of marker; e.g. local (body-fixed) position where force is applied to"
#V, CP, localOrientation, , 3, Matrix3D, "Matrix3D({1.,0.,0., 0.,1.,0., 0.,0.,1.})", , , "local body orientation of marker; used e.g. to measure according direction or to define according rotation axes, etc."
#V, CP, bodyFixed, , , Bool, "false", , IO, "if bodyFixed is true, the load or sensor is using body-fixed coordinates (orientation); this option is usually not be available in connectors; if false: global coordinates are used for sensors, loads, etc."
#
Fv, C, GetObjectNumber, , , Index, "return parameters.bodyNumber;", , CI, "general access to object number"
Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Body + Marker::Object + Marker::Position + Marker::Orientation);", , CI, "return marker type (for node treatment in computation)"
Fv, C, GetDimension, , , Index, "return 3;", "const CSystemData& cSystemData", CI, "return dimension of connector, which an attached connector would have; for coordinate markers, it gives the number of coordinates used by the marker"
Fv, C, GetPosition, , , void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of marker"
Fv, C, GetVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& velocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return velocity of marker"
Fv, C, GetRotationMatrix, , , void, , "const CSystemData& cSystemData, Matrix3D& rotationMatrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Matrix"
Fv, C, GetAngularVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& angularVelocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector"
Fv, C, GetAngularVelocityLocal, , , void, , "const CSystemData& cSystemData, Vector3D& angularVelocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector"
#DONE in ComputeMarkerData: Fv, C, GetPositionJacobian, , , void, , "const CSystemData& cSystemData, Matrix& jacobian", CDI, "return current position Jacobian of marker"
Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
Fv, M, GetTypeName, , , const char*,"return 'BodyRigid';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = MarkerNodePosition
classDescription = "A node-Marker attached to a position-based node."
cParentClass = CMarker
mainParentClass = MainMarker
visuParentClass = VisualizationMarker
classType = Marker
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "node number to which marker is attached to"
#
Fv, C, GetNodeNumber, , , Index, "return parameters.nodeNumber;", , CI, "general access to node number"
Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Node + Marker::Position);", , CI, "return marker type (for node treatment in computation)"
Fv, C, GetDimension, , , Index, "return 3;", "const CSystemData& cSystemData", CI, "return dimension of connector, which an attached connector would have; for coordinate markers, it gives the number of coordinates used by the marker"
Fv, C, GetPosition, , , void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of marker"
Fv, C, GetVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& velocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return velocity of marker"
Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
Fv, M, GetTypeName, , , const char*,"return 'NodePosition';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = MarkerNodeRigid
classDescription = "A rigid-body (position+orientation) node-marker attached to a rigid-body node."
cParentClass = CMarker
mainParentClass = MainMarker
visuParentClass = VisualizationMarker
classType = Marker
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "node number to which marker is attached to"
#
Fv, C, GetNodeNumber, , , Index, "return parameters.nodeNumber;", , CI, "general access to node number"
Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Node + Marker::Position+ Marker::Orientation);", , CI, "return marker type (for node treatment in computation)"
Fv, C, GetDimension, , , Index, "return 3;", "const CSystemData& cSystemData", CI, "return dimension of connector, which an attached connector would have; for coordinate markers, it gives the number of coordinates used by the marker"
Fv, C, GetPosition, , , void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of marker"
Fv, C, GetVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& velocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return velocity of marker"
Fv, C, GetRotationMatrix, , , void, , "const CSystemData& cSystemData, Matrix3D& rotationMatrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Matrix"
Fv, C, GetAngularVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& angularVelocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector"
Fv, C, GetAngularVelocityLocal, , , void, , "const CSystemData& cSystemData, Vector3D& angularVelocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector"
#DONE in ComputeMarkerData: Fv, C, GetPositionJacobian, , , void, , "const CSystemData& cSystemData, Matrix& jacobian", CDI, "return current position Jacobian of marker"
Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
Fv, M, GetTypeName, , , const char*,"return 'NodeRigid';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = MarkerNodeCoordinate
classDescription = "A node-Marker attached to a ODE2 coordinate of a node; for other coordinates (ODE1,...) other markers need to be defined."
cParentClass = CMarker
mainParentClass = MainMarker
visuParentClass = VisualizationMarker
classType = Marker
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "node number to which marker is attached to"
V, CP, coordinate, , , Index, "EXUstd::InvalidIndex", , I, "coordinate of node to which marker is attached to"
#remove: velocities are often needed together with position (cf. MarkerNodePosition) ==> velocities are measured using according flags; V, CP, useVelocity, , , bool, "false", , I, "Flag: true, if marker is attached to ODE2 velocity coordinate (e.g. to constrain or measure velocities)"
#
Fv, C, GetNodeNumber, , , Index, "return parameters.nodeNumber;", , CI, "access to node number"
Fv, C, GetCoordinateNumber, , , Index, "return parameters.coordinate;", , CI, "access to coordinate index"
Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Node + Marker::Coordinate);", , CI, "return marker type (for node treatment in computation)"
Fv, C, GetDimension, , , Index, "return 1;", "const CSystemData& cSystemData", CI, "return dimension of connector, which an attached connector would have; for coordinate markers, it gives the number of coordinates used by the marker"
Fv, C, GetPosition, , 3, void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of marker"
#Fv, C, GetVelocity, , 3, void, , "const CSystemData& cSystemData, Vector3D& velocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return velocity of marker"
Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
Fv, M, GetTypeName, , , const char*,"return 'NodeCoordinate';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", I, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = MarkerNodeRotationCoordinate
classDescription = "A node-Marker attached to a a node containing rotation; the Marker measures a rotation coordinate (Tait-Bryan angles) or angular velocities on the velocity level"
cParentClass = CMarker
mainParentClass = MainMarker
visuParentClass = VisualizationMarker
classType = Marker
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "node number to which marker is attached to"
V, CP, rotationCoordinate, , , Index, "EXUstd::InvalidIndex", , I, "rotation coordinate: 0=x, 1=y, 2=z"
#
Fv, C, GetNodeNumber, , , Index, "return parameters.nodeNumber;", , CI, "access to node number"
F, C, GetRotationCoordinateNumber, , , Index, "return parameters.rotationCoordinate;", , CI, "access to coordinate index"
Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Node + Marker::Coordinate + Marker::Orientation);", , CI, "return marker type (for node treatment in computation)"
Fv, C, GetDimension, , , Index, "return 1;", "const CSystemData& cSystemData", CI, "return dimension of connector, which an attached connector would have; for coordinate markers, it gives the number of coordinates used by the marker"
Fv, C, GetPosition, , 3, void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of marker"
Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
Fv, M, GetTypeName, , , const char*,"return 'NodeRotationCoordinate';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";","const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", I, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = MarkerSuperElementPosition
classDescription = "A position marker attached to a SuperElement, such as ObjectFFRF, ObjectGenericODE2 and ObjectFFRFreducedOrder (for which it is inefficient for large number of meshNodeNumbers). The marker acts on the mesh (interface) nodes, not on the underlying nodes of the object."
cParentClass = CMarker
mainParentClass = MainMarker
visuParentClass = VisualizationMarker
classType = Marker
equations =
\vspace{6pt}\\
{\bf Definition of marker quantities}:
\startTable{intermediate variables}{symbol}{description}
\rowTable{number of mesh nodes}{$n_m$}{size of \texttt{meshNodeNumbers} and \texttt{weightingFactors} which are marked; this must not be the number of mesh nodes in the marked object}
\rowTable{mesh node number}{$i = k_i$}{abbreviation}
\rowTable{mesh node points}{$\LU{0}{\pv}_{i}$}{position of mesh node $k_i$ in object $n_b$}
\rowTable{mesh node velocities}{$\LU{0}{\vv}_{i}$}{velocity of mesh node $i$ in object $n_b$}
\rowTable{marker position}{$\LU{0}{\pv}_{m} = \sum_{i=0}^{n-1}w_i \cdot \LU{0}{\pv_i}$}{current global position which is provided by marker}
\rowTable{marker velocity}{$\LU{0}{\vv}_{m} = \sum_{i=0}^{n-1}w_i \cdot \LU{0}{\vv_i}$}{current global velocity which is provided by marker}
\finishTable
%
\vspace{6pt}
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\noindent {\bf Marker quantities}:\\
The marker provides a 'position' jacobian, which is the derivative of the marker velocity w.r.t.\ the
object velocity coordinates $\dot \qv_{n_b}$,
\be
\Jm_{m,pos} = \frac{\partial \LU{0}{\vv}_{m}}{\partial \dot \qv_{n_b}}
= \sum_{i=0}^{n-1}w_i \cdot \Jm_{i,pos}
\ee
in which $\Jm_{i,pos}$ denotes the position jacobian of mesh node $i$,
\be
\Jm_{i,pos} = \frac{\partial \LU{0}{\vv}_{i}}{\partial \dot \qv_{n_b}}
\ee
The jacobian $\Jm_{i,pos}$ usually contains mostly zeros for \texttt{ObjectGenericODE2}, because the jacobian only affects one single node.
In \texttt{ObjectFFRFreducedOrder}, the jacobian may affect all reduced coordinates.
Note that $\Jm_{m,pos}$ is actually computed by the
\texttt{ObjectSuperElement} within the function \texttt{GetAccessFunctionSuperElement}.
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
miniExample =
#set up a mechanical system with two nodes; it has the structure: |~~M0~~M1
#==>further examples see objectGenericODE2Test.py, objectFFRFTest2.py, etc.
nMass0 = mbs.AddNode(NodePoint(referenceCoordinates=[0,0,0]))
nMass1 = mbs.AddNode(NodePoint(referenceCoordinates=[1,0,0]))
mGround = mbs.AddMarker(MarkerBodyPosition(bodyNumber=oGround, localPosition = [1,0,0]))
mass = 0.5 * np.eye(3) #mass of nodes
stif = 5000 * np.eye(3) #stiffness of nodes
damp = 50 * np.eye(3) #damping of nodes
Z = 0. * np.eye(3) #matrix with zeros
#build mass, stiffness and damping matrices (:
M = np.block([[mass, 0.*np.eye(3)],
[0.*np.eye(3), mass ] ])
K = np.block([[2*stif, -stif],
[ -stif, stif] ])
D = np.block([[2*damp, -damp],
[ -damp, damp] ])
oGenericODE2 = mbs.AddObject(ObjectGenericODE2(nodeNumbers=[nMass0,nMass1],
massMatrix=M,
stiffnessMatrix=K,
dampingMatrix=D))
#EXAMPLE for single node marker on super element body, mesh node 1; compare results to ObjectGenericODE2 example!!!
mSuperElement = mbs.AddMarker(MarkerSuperElementPosition(bodyNumber=oGenericODE2, meshNodeNumbers=[1], weightingFactors=[1]))
mbs.AddLoad(Force(markerNumber = mSuperElement, loadVector = [10, 0, 0]))
#assemble and solve system for default parameters
mbs.Assemble()
sims=exu.SimulationSettings()
sims.timeIntegration.generalizedAlpha.spectralRadius=1
SC.TimeIntegrationSolve(mbs, 'GeneralizedAlpha', sims)
#check result at default integration time
testError = mbs.GetNodeOutput(nMass1, exu.OutputVariableType.Position)[0] - (1.0039999999354785)
/end
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, bodyNumber, , , ObjectIndex,"EXUstd::InvalidIndex", , I, "$n_b$body number to which marker is attached to"
V, CP, meshNodeNumbers, , , ArrayIndex, "ArrayIndex()", , I, "$[k_0,\,\ldots,\,k_{n_m-1}]\tp$a list of $n_m$ mesh node numbers of superelement (=interface nodes) which are used to compute the body-fixed marker position; the related nodes must provide 3D position information, such as NodePoint, NodePoint2D, NodeRigidBody[..]; in order to retrieve the global node number, the generic body needs to convert local into global node numbers"
V, CP, weightingFactors, , , Vector, "Vector()", , I, "$[w_{0},\,\ldots,\,w_{n_m-1}]\tp$a list of $n_m$ weighting factors per node to compute the final local position"
#V, CP, bodyFixed, , , Bool, "false", , IO, "if bodyFixed is true, the force/sensor is using body-fixed coordinates (orientation); otherwise, it uses global coordinates"
#
Fv, C, GetObjectNumber, , , Index, "return parameters.bodyNumber;", , CI, "general access to object number"
#Fv, C, GetNodeNumbers, , , ArrayIndex, "return parameters.nodeNumbers;", , CI, "access to node numbers"
Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Body + Marker::Object + Marker::Position + Marker::SuperElement);", , CI, "return marker type (for node treatment in computation)"
#Fv, C, GetDimension, , , Index, "return 3;", , CI, "return dimension of connector, which an attached connector would have"
Fv, C, GetDimension, , , Index, "return 3;", "const CSystemData& cSystemData", CI, "return dimension of connector, which an attached connector would have; for coordinate markers, it gives the number of coordinates used by the marker"
Fv, C, GetPosition, , , void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of marker"
Fv, C, GetVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& velocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return velocity of marker"
Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
Fv, M, GetTypeName, , , const char*,"return 'SuperElementPosition';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, showMarkerNodes, , , bool, "true", , IO, "set true, if all nodes are shown (similar to marker, but with less intensity)"
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = MarkerSuperElementRigid
classDescription = "A position and orientation (rigid-body) marker attached to a SuperElement, such as ObjectFFRF, ObjectGenericODE2 and ObjectFFRFreducedOrder (for which it may be inefficient). The marker acts on the mesh nodes, not on the underlying nodes of the object. Note that in contrast to the MarkerSuperElementPosition, this marker needs a set of interface nodes which are not aligned at one line, such that the can represent rigid body motion. Note that definitions of marker positions are slightly different from MarkerSuperElementPosition."
cParentClass = CMarker
mainParentClass = MainMarker
visuParentClass = VisualizationMarker
classType = Marker
equations =
\vspace{6pt}\\
{\bf Definition of marker quantities}:
\startTable{intermediate variables}{symbol}{description}
\rowTable{number of mesh nodes}{$n_m$}{size of \texttt{meshNodeNumbers} and \texttt{weightingFactors} which are marked; this must not be the number of mesh nodes in the marked object}
\rowTable{mesh node number}{$i = k_i$}{abbreviation}
\rowTable{mesh node local position}{$\LU{r}{\pv}_{i}$}{current local (within reference frame $r$) position of mesh node $k_i$ in object $n_b$}
\rowTable{mesh node local reference position}{$\LU{r}{\pv}_{ref,i}$}{local (within reference frame $r$) reference position of mesh node $k_i$ in object $n_b$}
\rowTable{mesh node local displacement}{$\LU{r}{\uv}_{i}$}{current local (within reference frame $r$) displacement of mesh node $k_i$ in object $n_b$}
\rowTable{mesh node local velocity}{$\LU{r}{\vv}_{i}$}{current local (within reference frame $r$) velocity of mesh node $k_i$ in object $n_b$}
\rowTable{super element reference position}{$\LU{0}{\pv}_r$}{current reference position of super element's floating frame (r), which is zero, if the object does not provide a reference frame (such as GenericODE2)}
\rowTable{super element rotation matrix}{$\LU{0r}{\Rot}$}{current rigid body transformation matrix of super element's floating frame (r), which is the identity matrix, if the object does not provide a reference frame (such as GenericODE2)}
\rowTable{super element angular velocity}{$\LU{r}{\tomega_r}$}{current local angular velocity of super element's floating frame (r), which is zero, if the object does not provide a reference frame (such as GenericODE2)}
\rowTable{marker reference position}{$\LU{0}{\pv}_{0} = \LU{0}{\pv}_r + \LU{0r}{\Rot} \LU{r}{\pv_{0,ref}}$}{current global marker reference position; note that $\LU{0}{\pv}_{0} = \LU{0r}{\Im} \LU{r}{\pv_{0,ref}}$, if the object does not provide a reference frame (such as GenericODE2)}
\rowTable{marker position}{$\LU{0}{\pv}_{m} = \LU{0}{\pv}_{0} + \LU{0r}{\Rot} \sum_{i=0}^{n-1}w_i \cdot \LU{r}{\uv_i}$}{current global position which is provided by marker}
\rowTable{marker velocity}{$\LU{0}{\vv}_{m} = \LU{0}{\dot \pv}_r + \LU{0r}{\Rot} \LU{r}{\tilde \tomega_r} \LU{r}{\pv_{0,ref}} +
\LU{0r}{\Rot} \left(\sum_{i=0}^{n-1}(w_i \cdot \LU{r}{\vv_i}) + \LU{r}{\tilde \tomega_r} \sum_{i=0}^{n-1}(w_i \LU{r}{\uv_i}) \right)$}{current global velocity which is provided by marker}
%
\rowTable{marker local rotation}{$\LU{r}{\ttheta}_{m} = \frac{\sum_{i=0}^{n-1}w_i \LU{r}{\pv_{ref,i}} \times \LU{r}{\uv_i}}{\sum_{i=0}^{n-1}w_i |\LU{r}{\pv_{i,ref}}|^2}$}{current local (within reference frame $r$) linearized rotation parameters}
\rowTable{marker rotation matrix}{$\LU{0b}{\Rot}_{m} = \LU{0r}{\Rot} \mr{1}{-\theta_2}{\theta_1} {\theta_2}{1}{-\theta_0} {-\theta_1}{\theta_0}{1}$}{current rotation matrix, which transforms the local marker coordinates and adds the rigid body transformation of floating frames $\LU{0r}{\Rot}$; only valid for small (linearized rotations)!}
%
\rowTable{marker local angular velocity}{$\LU{r}{\tomega}_{m} = \LU{r}{\dot \ttheta}_{m} = \frac{\sum_{i=0}^{n-1}w_i \LU{r}{\tilde \pv_{ref,i}} \LU{r}{\vv_i}}{\sum_{i=0}^{n-1}w_i |\LU{r}{\pv_{i,ref}}|^2}$}{local (within reference frame $r$) angular velocity due to mesh node velocity only}
\rowTable{marker inertial angular velocity}{$\LU{0}{\tomega}_{m} = \LU{0}{\tomega_{r}} + \LU{0r}{\Rot} \LU{r}{\tomega}_{m}$}{current inertial angular velocity}
\finishTable
%
\vspace{6pt}
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\noindent {\bf Marker quantities}:\\
The marker provides a 'position' jacobian, which is the derivative of the marker velocity w.r.t.\ the
object velocity coordinates $\dot \qv_{n_b}$,
\be
\Jm_{m,pos} = \frac{\partial \LU{0}{\vv}_{m}}{\dot \qv_{n_b}}
= ...
\ee
%in which $\Jm_{i,pos}$ denotes the position jacobian of mesh node $i$,
%\be
% \Jm_{i,pos} = \frac{\partial \LU{0}{\vv}_{i}}{\dot \qv_{n_b}}
%\ee
%The jacobian $\Jm_{i,pos}$ usually contains mostly zeros for \texttt{ObjectGenericODE2}, because the jacobian only affects one single node.
In \texttt{ObjectFFRFreducedOrder}, the jacobian may affect all reduced coordinates.
The marker also provides a 'rotation' jacobian, which is the derivative of the marker angular velocity $\LU{0}{\tomega}_{m}$ w.r.t.\ the
object velocity coordinates $\dot \qv_{n_b}$,
\be
\Jm_{m,rot} = \frac{\partial \LU{0}{\tomega}_{m}}{\partial \dot \qv_{n_b}}
= \frac{\partial \LU{0r}{\Rot}(\LU{r}{\tomega_{r}} + \LU{r}{\tomega}_{m})}{\partial \dot \qv_{n_b}}
= \LU{0r}{\Rot} (\Gm_{local} + \frac{\sum_{i=0}^{n-1}w_i \LU{r}{\tilde \pv_{ref,i}} \Jm_{i,pos}}{\sum_{i=0}^{n-1}w_i |\LU{r}{\pv_{i,ref}}|^2})
\ee
with the matrix $\Gm_{local} = \frac{\partial \LU{r}{\tomega}_{r}}{\partial \dot \qv_{n_b}}$.\vspace{6pt}\\
\noindent {\bf Alternative computation of rotation (under development)}:\\
In the alternative mode, where the weighting matrix $\Wm$ has the interpretation of an inertia tensor of built from nodes using weights $=$ node mass, and the local angular momentum reads
\be
\Wm \LU{r}{\tomega}_{m} = \sum_{i=0}^{n-1}w_i \LU{r}{\tilde \pv_{ref,i}} \LU{r}{\vv_i} =
-\sum_{i=0}^{n-1} \left( w_i \LU{r}{\tilde \pv_{i,ref}} \LU{r}{\tilde \pv_{i,ref}} \right) \LU{r}{\tomega}_{m}
\ee
and the marker local rotations and marker local angular velocity are defined as
\be
\LU{r}{\ttheta}_{m} = \Wm^{-1} \sum_{i=0}^{n-1}w_i \LU{r}{\tilde \pv_{ref,i}} \LU{r}{\uv_i}, \quad
\LU{r}{\tomega}_{m} = \Wm^{-1} \sum_{i=0}^{n-1} w_i \LU{r}{\tilde \pv_{ref,i}} \LU{r}{\vv_i},
\ee
with the weighting matrix (which must be invertable)
\be
\Wm = -\sum_{i=0}^{n-1} w_i \LU{r}{\tilde \pv_{i,ref}} \LU{r}{\tilde \pv_{i,ref}}
\ee
and in the alternative mode, the angular velocity is defined as
\be
\Jm_{m,rot} = \frac{\partial \LU{0}{\tomega}_{m}}{\partial \dot \qv_{n_b}}
= \frac{\partial \LU{0r}{\Rot}(\LU{r}{\tomega_{r}} + \LU{r}{\tomega}_{m})}{\partial \dot \qv_{n_b}}
= \LU{0r}{\Rot} (\Gm_{local} + \Wm^{-1} \sum_{i=0}^{n-1}w_i \LU{r}{\tilde \pv_{ref,i}} \Jm_{i,pos})
\ee
Note that $\Jm_{m,rot}$ is computed by the \texttt{ObjectSuperElement} within the function \texttt{GetAccessFunctionSuperElement}.
\noindent {\bf EXAMPLE for marker on body 4, mesh nodes 10,11,12,13}:\\
\texttt{MarkerSuperElementRigid(bodyNumber = 4, meshNodeNumber = [10, 11, 12, 13], weightingFactors = [0.25, 0.25, 0.25, 0.25], referencePosition=[0,0,0])}
\noindent For detailed examples, see \texttt{TestModels}.
/end
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, bodyNumber, , , ObjectIndex,"EXUstd::InvalidIndex", , I, "$n_b$body number to which marker is attached to"
V, CP, referencePosition, , 3, Vector3D, "Vector3D({0.,0.,0.})", , I, "$\LU{r}{\pv_{0,ref}}$local marker SuperElement reference position used to compute average displacement and average rotation; currently, this must be the center of weighted nodes of the marker"
V, CP, meshNodeNumbers, , , ArrayIndex, "ArrayIndex()", , I, "$[k_0,\,\ldots,\,k_{n_m-1}]\tp$a list of $n_m$ mesh node numbers of superelement (=interface nodes) which are used to compute the body-fixed marker position and orientation; the related nodes must provide 3D position information, such as NodePoint, NodePoint2D, NodeRigidBody[..]; in order to retrieve the global node number, the generic body needs to convert local into global node numbers"
V, CP, weightingFactors, , , Vector, "Vector()", , I, "$[w_{0},\,\ldots,\,w_{n_m-1}]\tp$a list of $n_m$ weighting factors per node to compute the final local position and orientation; these factors could be based on surface integrals of the constrained mesh faces"
#V, CP, bodyFixed, , , Bool, "false", , IO, "if bodyFixed is true, the force/sensor is using body-fixed coordinates (orientation); otherwise, it uses global coordinates"
#
Fv, C, GetObjectNumber, , , Index, "return parameters.bodyNumber;", , CI, "general access to object number"
#Fv, C, GetNodeNumbers, , , ArrayIndex, "return parameters.nodeNumbers;", , CI, "access to node numbers"
Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Body + Marker::Object + Marker::Position + Marker::Orientation + Marker::SuperElement);", , CI, "return marker type (for node treatment in computation)"
#Fv, C, GetDimension, , , Index, "return 3;", , CI, "return dimension of connector, which an attached connector would have"
Fv, C, GetDimension, , , Index, "return 3;", "const CSystemData& cSystemData", CI, "return dimension of connector, which an attached connector would have; for coordinate markers, it gives the number of coordinates used by the marker"
Fv, C, GetPosition, , , void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of marker"
Fv, C, GetVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& velocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return velocity of marker"
Fv, C, GetRotationMatrix, , , void, , "const CSystemData& cSystemData, Matrix3D& rotationMatrix, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent rotation matrix of node; returns always a 3D Matrix"
Fv, C, GetAngularVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& angularVelocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent angular velocity of node; returns always a 3D Vector"
Fv, C, GetAngularVelocityLocal, , , void, , "const CSystemData& cSystemData, Vector3D& angularVelocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return configuration dependent local (=body-fixed) angular velocity of node; returns always a 3D Vector"
Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
Fv, M, GetTypeName, , , const char*,"return 'SuperElementRigid';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#helper functions:
F, C, GetFloatingFrameNodeData, , , void, , "const CSystemData& cSystemData, Vector3D& framePosition, Matrix3D& frameRotationMatrix, Vector3D& frameVelocity, Vector3D& frameAngularVelocityLocal, ConfigurationType configuration = ConfigurationType::Current", CDI, "return parameters of underlying floating frame node (or default values for case that no frame exists)"
F, C, GetWeightedRotations, , , void, , "const CSystemData& cSystemData, Vector3D& weightedRotations, ConfigurationType configuration = ConfigurationType::Current", CDI, "return weighted (linearized) rotation from local mesh displacements"
F, C, GetWeightedAngularVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& weightedAngularVelocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return weighted angular velocity from local mesh velocities"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
V, V, showMarkerNodes, , , bool, "true", , IO, "set true, if all nodes are shown (similar to marker, but with less intensity)"
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = MarkerObjectODE2Coordinates
classDescription = "A Marker attached to all coordinates of an object (currently only body is possible), e.g. to apply special constraints or loads on all coordinates. The measured coordinates INCLUDE reference + current coordinates."
cParentClass = CMarker
mainParentClass = MainMarker
visuParentClass = VisualizationMarker
classType = Marker
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, objectNumber, , , ObjectIndex, "EXUstd::InvalidIndex", , I, "body number to which marker is attached to"
#
Fv, C, GetObjectNumber, , , Index, "return parameters.objectNumber;", , CI, "general access to object number"
Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Body + Marker::Object + Marker::Coordinate);", , CI, "return marker type (for node treatment in computation)"
Fv, C, GetDimension, , , Index, , "const CSystemData& cSystemData", CDI, "return dimension of connector, which an attached connector would have; for coordinate markers, it gives the number of coordinates used by the marker"
Fv, C, GetPosition, , , void, "position = Vector3D({0,0,0});", "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CI, "return position of marker"
#Fv, C, GetVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& velocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return velocity of marker"
Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
Fv, M, GetTypeName, , , const char*,"return 'ObjectODE2Coordinates';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
#
Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
F, C, GetObjectODE2Coordinates, , , void, , "const CSystemData& cSystemData, Vector& objectCoordinates, Vector& objectCoordinates_t", CDI, "return the ODE2 coordinate vectors (and derivative) of the attached object"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", I, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#class = MarkerSuperElementPositionReducedOrder
#acts directly on coordinates of reduced order elements, which is faster!
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#replaced by MarkerSuperElementPosition
#class = MarkerGenericBodyPosition
#classDescription = "!!THIS MARKER WILL BE DELETED IN FUTURE!!\nA position marker attached to a generic, discretized body, such as GenericODE2 or bodies modelled with the floating frame of reference formulation. The nodes of the body must provide position information. For a list of $n$ local node numbers, referencing to node points $\LU{b}{\pv_i}$ and weights $w_i$, the body-fixed marker position $\LU{b}{\pv_m}$ results in $\LU{b}{\pv_m} = \sum_{i=0}^{n-1}w_i \cdot \LU{b}{\pv_i}$. If the flag \texttt{useFirstNodeAsReferenceFrame} = \texttt{False}, then it follows that $\LU{0}{\pv_m} = \LU{b}{\pv_m}$. Otherwise $\LU{0}{\pv_m} = \LU{0b}{\Rot} \LU{b}{\pv_m}$, in which $\LU{0b}{\Rot}$ is the rotation matrix provided by the first node of the body, which also must provide orientation information."
#cParentClass = CMarker
#mainParentClass = MainMarker
#visuParentClass = VisualizationMarker
#classType = Marker
##V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
##CObjectMarkerBodyPosition* automatically inserted!
#Vp, M, name, , , String, "", , I, "marker's unique name"
#V, CP, bodyNumber, , , Index, "EXUstd::InvalidIndex", , I, "body number to which marker is attached to"
#V, CP, nodeNumbers, , , ArrayIndex, "ArrayIndex()", , I, "local node numbers of body which are used to compute the body-fixed marker position; the related nodes must provide 3D position information, such as NodePoint, NodePoint2D, NodeRigidBody[..]; in order to retrieve the global node number, the generic body needs to convert local into global node numbers"
#V, CP, weightingFactors, , , Vector, "Vector()", , I, "weighting factors per node to compute the final local position"
#V, CP, useFirstNodeAsReferenceFrame, , , bool, "false", , I, "if true, the first node of the body is used to transform the nodal coordinates from local (body-fixed) to global coordinates, which MUST provide position and orientation information; this is according to the floating frame of reference formulation (ffrf)"
##V, CP, bodyFixed, , , Bool, "false", , IO, "if bodyFixed is true, the force/sensor is using body-fixed coordinates (orientation); otherwise, it uses global coordinates"
##
#Fv, C, GetObjectNumber, , , Index, "return parameters.bodyNumber;", , CI, "general access to object number"
##Fv, C, GetNodeNumbers, , , ArrayIndex, "return parameters.nodeNumbers;", , CI, "access to node numbers"
#Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Body + Marker::Object + Marker::Position);", , CI, "return marker type (for node treatment in computation)"
#Fv, C, GetDimension, , , Index, "return 3;", , CI, "return dimension of connector, which an attached connector would have"
#Fv, C, GetPosition, , , void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of marker"
#Fv, C, GetVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& velocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return velocity of marker"
#Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
#Fv, M, GetTypeName, , , const char*,"return 'GenericBodyPosition';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
#Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
##VISUALIZATION:
#Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
#V, V, showMarkerNodes, , , bool, "true", , IO, "set true, if all nodes are shown (similar to marker, but with less intensity)"
#Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
##file names automatically determined from class name
#writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = MarkerBodyCable2DShape
classDescription = "A special Marker attached to a 2D ANCF beam finite element with cubic interpolation and 8 coordinates."
cParentClass = CMarker
mainParentClass = MainMarker
visuParentClass = VisualizationMarker
addProtectedC = " static constexpr Index maxNumberOfSegments = 12; //maximum number of contact segments\n"
classType = Marker
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, bodyNumber, , , ObjectIndex,"EXUstd::InvalidIndex", , I, "body number to which marker is attached to"
V, CP, numberOfSegments, , , Index, "3", , I, "number of number of segments; each segment is a line and is associated to a data (history) variable; must be same as in according contact element"
#V, CP, localPosition, , 3, Vector3D, "Vector3D({0.,0.,0.})", , I, "local body position of marker; e.g. local (body-fixed) position where force is applied to"
#
Fv, C, GetObjectNumber, , , Index, "return parameters.bodyNumber;", , CI, "general access to object number"
Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Body + Marker::Object + Marker::Coordinate);", , CI, "return marker type (for node treatment in computation)"
Fv, C, GetDimension, , , Index, "return 2;", "const CSystemData& cSystemData", CI, "return dimension of connector, which an attached connector would have; for coordinate markers, it gives the number of coordinates used by the marker"
Fv, C, GetPosition, , , void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of marker -> axis-midpoint of ANCF cable"
#Fv, C, GetVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& velocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return velocity of marker"
Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
Fv, M, GetTypeName, , , const char*,"return 'BodyCable2DShape';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = MarkerBodyCable2DCoordinates
classDescription = "A special Marker attached to the coordinates of a 2D ANCF beam finite element with cubic interpolation."
cParentClass = CMarker
mainParentClass = MainMarker
visuParentClass = VisualizationMarker
classType = Marker
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, bodyNumber, , , ObjectIndex,"EXUstd::InvalidIndex", , I, "body number to which marker is attached to"
#
Fv, C, GetObjectNumber, , , Index, "return parameters.bodyNumber;", , CI, "general access to object number"
Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Body + Marker::Object + Marker::Coordinate);", , CI, "return marker type (for node treatment in computation)"
Fv, C, GetDimension, , , Index, "return 2;", "const CSystemData& cSystemData", CI, "return dimension of connector, which an attached connector would have; for coordinate markers, it gives the number of coordinates used by the marker"
Fv, C, GetPosition, , , void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of marker -> axis-midpoint of ANCF cable"
#Fv, C, GetVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& velocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return velocity of marker"
Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
Fv, M, GetTypeName, , , const char*,"return 'BodyCable2DCoordinates';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
##++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#class = MarkerBodySlidingPosition
#classDescription = "A position marker attached to a sliding (along local x-coordinate) local position (x,y,z) of the body; ADDITIONALLY, a GenericNodeODE2 provides the sliding coordinate, which is the sliding position; needs to be attached to a body, which provides a SlopeVector()."
#cParentClass = CMarker
#mainParentClass = MainMarker
#visuParentClass = VisualizationMarker
#classType = Marker
##V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
##CObjectMarkerBodyPosition* automatically inserted!
#Vp, M, name, , , String, "", , I, "marker's unique name"
#V, CP, bodyNumber, , , Index, "EXUstd::InvalidIndex", , I, "Current sliding body number (e.g. beam)to which marker is CURRENTLY attached to (needs to be initialized accordingly)"
#V, CP, localPosition, , 3, Vector3D, "Vector3D({0.,0.,0.})", , I, "local body position of marker; e.g. local (body-fixed) position where force is applied to"
#V, CP, bodyFixed, , , Bool, "false", , IO, "if bodyFixed is true, the force/sensor is using body-fixed coordinates (orientation); otherwise, it uses global coordinates"
#V, CP, nodeNumber, , , Index, "EXUstd::InvalidIndex", , I, "node number which contains sliding coordinate"
#V, CP, cableNumbers, , , ArrayIndex, "ArrayIndex()", , I, "a list of Cable2D beam elements; the cable elements must be in a sequence, such that at beam(i),x=L the beam(i+1),x=0 needs to start"
##
#Fv, C, GetObjectNumber, , , Index, "return parameters.bodyNumber;", , CI, "general access to object number"
#Fv, C, GetNodeNumber, , , Index, "return parameters.nodeNumber;", , CI, "general access to node number"
#Fv, C, GetType, , , "Marker::Type", "return (Marker::Type)(Marker::Body + Marker::Object + Marker::Node + Marker::Position);", , CI, "return marker type (for node treatment in computation)"
#Fv, C, GetDimension, , , Index, "return 3;", , CI, "return dimension of connector, which an attached connector would have"
#Fv, C, GetPosition, , , void, , "const CSystemData& cSystemData, Vector3D& position, ConfigurationType configuration = ConfigurationType::Current", CDI, "return position of sliding point (body-marker)"
#Fv, C, GetVelocity, , , void, , "const CSystemData& cSystemData, Vector3D& velocity, ConfigurationType configuration = ConfigurationType::Current", CDI, "return velocity of sliding point (body-marker)"
##Fv, C, GetPositionJacobian, , , void, , "const CSystemData& cSystemData, Matrix& jacobian", CDI, "return current position Jacobian of marker"
#Fv, C, ComputeMarkerData, , , void, , "const CSystemData& cSystemData, bool computeJacobian, MarkerData& markerData", CDI, "Compute marker data (e.g. position and positionJacobian) for a marker"
#Fv, M, GetTypeName, , , const char*,"return 'BodyPosition';", , CI, "Get type name of marker (without keyword 'Marker'...!); could also be realized via a string -> type conversion?"
##VISUALIZATION:
#Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
#Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
##file names automatically determined from class name
#writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = LoadForceVector
classDescription = "Load with (3D) force vector; attached to position-based marker."
cParentClass = CLoad
mainParentClass = MainLoad
visuParentClass = VisualizationLoad
pythonShortName = Force
classType = Load
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "load's unique name"
V, CP, markerNumber, , , MarkerIndex,"EXUstd::InvalidIndex", , I, "marker's number to which load is applied"
V, CP, loadVector, , , Vector3D, "Vector3D({0.,0.,0.})", , I, "vector-valued load [SI:N]"
V, CP, bodyFixed, , , Bool, "false", , IO, "if bodyFixed is true, the load is defined in body-fixed (local) coordinates, leading to a follower force; if false: global coordinates are used"
V, CP, loadVectorUserFunction, , , PyFunctionVector3DScalarVector3D, 0, , IO, "A python function which defines the time-dependent load with parameters (Real t, Vector3D load); the load represents the current value of the load; WARNING: this factor does not work in combination with static computation (loadFactor); Example for python function: def f(t, loadVector): return [loadVector[0]*np.sin(t*10*2*3.1415),0,0]"
#
#dimension must be known (1=scalar, 3=vector) Fv, C, Dimension, , , Index, "return 3;", , CI, "dimensionality of load; 3D force vector==>dimension=3; scalar load==>dimension=1"
Fv, C, GetMarkerNumber, , , Index, "return parameters.markerNumber;", , CI, "get according marker number where load is applied"
Fv, C, SetMarkerNumber, , , void, "parameters.markerNumber = markerNumberInit;", "Index markerNumberInit", I, "set according marker number where load is applied"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::Position;", , CI, "provide requested markerType for connector"
#
Fv, C, GetType, , , LoadType, "return (LoadType)((Index)LoadType::Force);", , CI, "return force type"
Fv, C, IsVector, , , bool, "return true;", , CI, "true = load is of vector type"
Fv, C, GetLoadVector, , , Vector3D, , "Real t", CDI, "read access for force vector; returns user function in case it is defined"
Fv, C, IsBodyFixed, , , bool, "return parameters.bodyFixed;", , CI, "per default, forces/torques/... are applied in global coordinates; if IsBodyFixed()=true, the marker needs to provide a rotation (orientation) and forces/torques/... are applied in the local coordinate system"
Fv, M, GetTypeName, , , const char*,"return 'ForceVector';", , CI, "Get type name of load (without keyword 'Load'...!); could also be realized via a string -> type conversion?"
#Fv, M, CheckPreAssembleConsistency, , , bool, , "const MainSystem& mainSystem, STDstring& errorString", CDI, "Check consistency prior to CSystem::Assemble(); needs to find all possible violations such that Assemble() would fail"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
class = LoadTorqueVector
classDescription = "Load with (3D) torque vector; attached to rigidbody-based marker."
cParentClass = CLoad
mainParentClass = MainLoad
visuParentClass = VisualizationLoad
pythonShortName = Torque
classType = Load
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "load's unique name"
V, CP, markerNumber, , , MarkerIndex,"EXUstd::InvalidIndex", , I, "marker's number to which load is applied"
V, CP, loadVector, , , Vector3D, "Vector3D({0.,0.,0.})", , I, "vector-valued load [SI:N]"
V, CP, bodyFixed, , , Bool, "false", , IO, "if bodyFixed is true, the load is defined in body-fixed (local) coordinates, leading to a follower torque; if false: global coordinates are used"
V, CP, loadVectorUserFunction, , , PyFunctionVector3DScalarVector3D, 0, , IO, "A python function which defines the time-dependent load with parameters (Real t, Vector3D load); the load represents the current value of the load; WARNING: this factor does not work in combination with static computation (loadFactor); Example for python function: def f(t, loadVector): return [loadVector[0]*np.sin(t*10*2*3.1415),0,0]"
#
#dimension must be known (1=scalar, 3=vector) Fv, C, Dimension, , , Index, "return 3;", , CI, "dimensionality of load; 3D torque vector==>dimension=3; scalar load==>dimension=1"
Fv, C, GetMarkerNumber, , , Index, "return parameters.markerNumber;", , CI, "get according marker number where load is applied"
Fv, C, SetMarkerNumber, , , void, "parameters.markerNumber = markerNumberInit;", "Index markerNumberInit", I, "set according marker number where load is applied"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::Orientation;", , CI, "provide requested markerType for connector"
#
Fv, C, GetType, , , LoadType, "return (LoadType)((Index)LoadType::Torque);", , CI, "return load type"
Fv, C, IsVector, , , bool, "return true;", , CI, "true = load is of vector type"
Fv, C, GetLoadVector, , , Vector3D, , "Real t", CDI, "read access for load vector"
Fv, C, IsBodyFixed, , , bool, "return parameters.bodyFixed;", , CI, "per default, forces/torques/... are applied in global coordinates; if IsBodyFixed()=true, the marker needs to provide a rotation (orientation) and forces/torques/... are applied in the local coordinate system"
Fv, M, GetTypeName, , , const char* ,"return 'TorqueVector';", , CI, "Get type name of load (without keyword 'Load'...!); could also be realized via a string -> type conversion?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = LoadMassProportional
classDescription = "Load attached to BodyMass-based marker, applying a 3D vector load (e.g. the vector [0,-g,0] is used to apply gravitational loading of size g in negative y-direction)."
cParentClass = CLoad
mainParentClass = MainLoad
visuParentClass = VisualizationLoad
pythonShortName = Gravity
classType = Load
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "load's unique name"
V, CP, markerNumber, , , MarkerIndex,"EXUstd::InvalidIndex", , I, "marker's number to which load is applied"
V, CP, loadVector, , , Vector3D, "Vector3D({0.,0.,0.})", , I, "vector-valued load [SI:N/kg = m/s$^2$] "
V, CP, loadVectorUserFunction, , , PyFunctionVector3DScalarVector3D, 0, , IO, "A python function which defines the time-dependent load with parameters (Real t, Vector3D load); the load represents the current value of the load; WARNING: this factor does not work in combination with static computation (loadFactor); Example for python function: def f(t, loadVector): return [loadVector[0]*np.sin(t*10*2*3.1415),0,0]"
#
#dimension must be known (1=scalar, 3=vector) Fv, C, Dimension, , , Index, "return 3;", , CI, "dimensionality of load; 3D force vector==>dimension=3; scalar load==>dimension=1"
Fv, C, GetMarkerNumber, , , Index, "return parameters.markerNumber;", , CI, "get according marker number where load is applied"
Fv, C, SetMarkerNumber, , , void, "parameters.markerNumber = markerNumberInit;", "Index markerNumberInit", I, "set according marker number where load is applied"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::BodyMass;", , CI, "provide requested markerType for connector"
#
Fv, C, GetType, , , LoadType, "return (LoadType)((Index)LoadType::ForcePerMass);", , CI, "return load type"
Fv, C, IsVector, , , bool, "return true;", , CI, "true = load is of vector type"
#DELETE, not needed: Fv, C, GetLoadVector, , , Vector3D&, "return GetParameters().loadVector;", , I, "write override for force vector"
Fv, C, GetLoadVector, , , Vector3D, , "Real t", CDI, "read access for force vector"
Fv, M, GetTypeName, , , const char*,"return 'MassProportional';", , CI, "Get type name of load (without keyword 'Load'...!); could also be realized via a string -> type conversion?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
class = LoadCoordinate
classDescription = "Load with scalar value, which is attached to a coordinate-based marker; the load can be used e.g. to apply a force to a single axis of a body, a nodal coordinate of a finite element or a torque to the rotatory DOF of a rigid body."
cParentClass = CLoad
mainParentClass = MainLoad
visuParentClass = VisualizationLoad
#pythonShortName = GeneralizedForce?
classType = Load
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
#CObjectMarkerBodyPosition* automatically inserted!
Vp, M, name, , , String, "", , I, "load's unique name"
V, CP, markerNumber, , , MarkerIndex,"EXUstd::InvalidIndex", , I, "marker's number to which load is applied"
V, CP, load, , , Real, "0.", , I, "scalar load [SI:N]"
V, CP, loadUserFunction, , , PyFunctionScalar2, 0, , IO, "A python function which defines the time-dependent load with parameters (Real t, Real load); the load represents the current value of the load; WARNING: this factor does not work in combination with static computation (loadFactor); Example for python function: def f(t, load): return load*np.sin(t*10*2*3.1415)"
#
Fv, C, GetMarkerNumber, , , Index, "return parameters.markerNumber;", , CI, "get according marker number where load is applied"
Fv, C, SetMarkerNumber, , , void, "parameters.markerNumber = markerNumberInit;", "Index markerNumberInit", I, "set according marker number where load is applied"
Fv, C, GetRequestedMarkerType, , , Marker::Type, "return Marker::Coordinate;", , CI, "provide requested markerType for connector"
#
Fv, C, GetType, , , LoadType, "return (LoadType)((Index)LoadType::Coordinate);", , CI, "return load type"
Fv, C, IsVector, , , bool, "return false;", , CI, "true = load is of vector type"
#DELETE, not needed: Fv, C, GetLoadValue, , , Real&, "return GetParameters().load;", , I, "write override for load value (IsVector=false)"
Fv, C, GetLoadValue, , , Real, , "Real t", CDI, "read access for load value (IsVector=false)"
Fv, M, GetTypeName, , , const char* ,"return 'Coordinate';", , CI, "Get type name of load (without keyword 'Load'...!); could also be realized via a string -> type conversion?"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", I, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = SensorNode
classDescription = "A sensor attached to a node. The sensor measures OutputVariables and outputs values into a file, showing per line [time, sensorValue[0], sensorValue[1], ...]. A user function can be attached to modify sensor values accordingly."
cParentClass = CSensor
mainParentClass = MainSensor
visuParentClass = VisualizationSensor
classType = Sensor
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, nodeNumber, , , NodeIndex, "EXUstd::InvalidIndex", , I, "node number to which sensor is attached to"
V, CP, writeToFile, , , bool, true, , I, "true: write sensor output to file"
V, CP, fileName, , , String, "", , I, "directory and file name for sensor file output; default: empty string generates sensor + sensorNumber + outputVariableType; directory will be created if it does not exist"
V, CP, outputVariableType, , , OutputVariableType, "OutputVariableType::_None", , I, "OutputVariableType for sensor"
#
Fv, C, GetNodeNumber, , , Index, "return parameters.nodeNumber;", , CI, "general access to node number"
Fv, C, GetType, , , "SensorType", "return SensorType::Node;", , CI, "return sensor type"
#
Fv, C, GetWriteToFileFlag, , , bool, "return parameters.writeToFile;", , CI, "get writeToFile flag"
Fv, C, GetFileName, , , "STDstring", "return parameters.fileName;", , CI, "get file name"
Fv, C, GetOutputVariableType, , , OutputVariableType, "return parameters.outputVariableType;", , CI, "get OutputVariableType"
#
Fv, C, GetSensorValues, , , void, , "const CSystemData& cSystemData, Vector& values, ConfigurationType configuration = ConfigurationType::Current", CDI, "main function to generate sensor output values"
Fv, M, GetTypeName, , , const char*,"return 'Node';", , CI, "Get type name of sensor (without keyword 'Sensor'...!)"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = SensorObject
classDescription = "A sensor attached to any object except bodies (connectors, constraint, spring-damper, etc). As a difference to other SensorBody, the connector sensor measures quantities without a local position. The sensor measures OutputVariable and outputs values into a file, showing per line [time, sensorValue[0], sensorValue[1], ...]. A user function can be attached to postprocess sensor values accordingly."
cParentClass = CSensor
mainParentClass = MainSensor
visuParentClass = VisualizationSensor
classType = Sensor
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, objectNumber, , , ObjectIndex,"EXUstd::InvalidIndex", , I, "object (e.g. connector) number to which sensor is attached to"
V, CP, writeToFile, , , bool, true, , I, "true: write sensor output to file"
V, CP, fileName, , , String, "", , I, "directory and file name for sensor file output; default: empty string generates sensor + sensorNumber + outputVariableType; directory will be created if it does not exist"
V, CP, outputVariableType, , , OutputVariableType, "OutputVariableType::_None", , I, "OutputVariableType for sensor"
#
Fv, C, GetObjectNumber, , , Index, "return parameters.objectNumber;", , CI, "general access to object number"
Fv, C, GetType, , , "SensorType", "return SensorType::Object;", , CI, "return sensor type"
#
Fv, C, GetWriteToFileFlag, , , bool, "return parameters.writeToFile;", , CI, "get writeToFile flag"
Fv, C, GetFileName, , , "STDstring", "return parameters.fileName;", , CI, "get file name"
Fv, C, GetOutputVariableType, , , OutputVariableType, "return parameters.outputVariableType;", , CI, "get OutputVariableType"
#
Fv, C, GetSensorValues, , , void, , "const CSystemData& cSystemData, Vector& values, ConfigurationType configuration = ConfigurationType::Current", CDI, "main function to generate sensor output values"
Fv, M, GetTypeName, , , const char*,"return 'Object';", , CI, "Get type name of sensor (without keyword 'Sensor'...!)"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown; sensors can be shown at the position assiciated with the object - note that in some cases, there might be no such position (e.g. data object)!"
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = SensorBody
classDescription = "A sensor attached to a body-object with local position. As a difference to other ObjectSensors, the body sensor has a local position at which the sensor is attached to. The sensor measures OutputVariableBody and outputs values into a file, showing per line [time, sensorValue[0], sensorValue[1], ...]. A user function can be attached to postprocess sensor values accordingly."
cParentClass = CSensor
mainParentClass = MainSensor
visuParentClass = VisualizationSensor
classType = Sensor
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, bodyNumber, , , ObjectIndex,"EXUstd::InvalidIndex", , I, "body (=object) number to which sensor is attached to"
V, CP, localPosition, , 3, Vector3D, "Vector3D({0.,0.,0.})", , I, "local (body-fixed) body position of sensor"
V, CP, writeToFile, , , bool, true, , I, "true: write sensor output to file"
V, CP, fileName, , , String, "", , I, "directory and file name for sensor file output; default: empty string generates sensor + sensorNumber + outputVariableType; directory will be created if it does not exist"
V, CP, outputVariableType, , , OutputVariableType, "OutputVariableType::_None", , I, "OutputVariableType for sensor"
#
Fv, C, GetObjectNumber, , , Index, "return parameters.bodyNumber;", , CI, "general access to object number"
Fv, C, GetType, , , "SensorType", "return SensorType::Body;", , CI, "return sensor type"
#
F, C, GetBodyLocalPosition, , , Vector3D, "return parameters.localPosition;", , CI, "get local position"
Fv, C, GetWriteToFileFlag, , , bool, "return parameters.writeToFile;", , CI, "get writeToFile flag"
Fv, C, GetFileName, , , "STDstring", "return parameters.fileName;", , CI, "get file name"
Fv, C, GetOutputVariableType, , , OutputVariableType, "return parameters.outputVariableType;", , CI, "get OutputVariableType"
#
Fv, C, GetSensorValues, , , void, , "const CSystemData& cSystemData, Vector& values, ConfigurationType configuration = ConfigurationType::Current", CDI, "main function to generate sensor output values"
Fv, M, GetTypeName, , , const char*,"return 'Body';", , CI, "Get type name of sensor (without keyword 'Sensor'...!)"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = SensorSuperElement
classDescription = "A sensor attached to a SuperElement-object with mesh node number. As a difference to other ObjectSensors, the SuperElement sensor has a mesh node number at which the sensor is attached to. The sensor measures OutputVariableSuperElement and outputs values into a file, showing per line [time, sensorValue[0], sensorValue[1], ...]. A user function can be attached to postprocess sensor values accordingly."
cParentClass = CSensor
mainParentClass = MainSensor
visuParentClass = VisualizationSensor
classType = Sensor
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, bodyNumber, , , ObjectIndex,"EXUstd::InvalidIndex", , I, "body (=object) number to which sensor is attached to"
V, CP, meshNodeNumber, , , Index, "-1", , I, "mesh node number, which is a local node number with in the object (starting with 0); the node number may represent a real Node in mbs, or may be virtual and reconstructed from the object coordinates such as in ObjectFFRFreducedOrder"
V, CP, writeToFile, , , bool, true, , I, "true: write sensor output to file"
V, CP, fileName, , , String, "", , I, "directory and file name for sensor file output; default: empty string generates sensor + sensorNumber + outputVariableType; directory will be created if it does not exist"
V, CP, outputVariableType, , , OutputVariableType, "OutputVariableType::_None", , I, "OutputVariableType for sensor"
#
Fv, C, GetObjectNumber, , , Index, "return parameters.bodyNumber;", , CI, "general access to object number"
Fv, C, GetType, , , "SensorType", "return SensorType::SuperElement;", , CI, "return sensor type"
#
F, C, GetMeshNodeNumber, , , Index, "return parameters.meshNodeNumber;", , CI, "get local position"
Fv, C, GetWriteToFileFlag, , , bool, "return parameters.writeToFile;", , CI, "get writeToFile flag"
Fv, C, GetFileName, , , "STDstring","return parameters.fileName;", , CI, "get file name"
Fv, C, GetOutputVariableType, , , OutputVariableType, "return parameters.outputVariableType;", , CI, "get OutputVariableType"
#
Fv, C, GetSensorValues, , , void, , "const CSystemData& cSystemData, Vector& values, ConfigurationType configuration = ConfigurationType::Current", CDI, "main function to generate sensor output values"
Fv, M, GetTypeName, , , const char*,"return 'SuperElement';", , CI, "Get type name of sensor (without keyword 'Sensor'...!)"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown"
Fv, V, UpdateGraphics, , , void, , "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", DI, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class = SensorLoad
classDescription = "A sensor attached to a load. The sensor measures the load values and outputs values into a file, showing per line [time, sensorValue[0], sensorValue[1], ...]."
cParentClass = CSensor
mainParentClass = MainSensor
visuParentClass = VisualizationSensor
classType = Sensor
#V|F, Dest, pythonName, cplusplusName, size, type, (default)Value, Args, cFlags, parameterDescription
Vp, M, name, , , String, "", , I, "marker's unique name"
V, CP, loadNumber, , , LoadIndex, "EXUstd::InvalidIndex", , I, "load number to which sensor is attached to"
V, CP, writeToFile, , , bool, true, , I, "true: write sensor output to file"
V, CP, fileName, , , String, "", , I, "directory and file name for sensor file output; default: empty string generates sensor + sensorNumber + outputVariableType; directory will be created if it does not exist"
#V, CP, outputVariableType, , , OutputVariableType, 0, , I, "OutputVariableType for sensor"
#
Fv, C, GetLoadNumber, , , Index, "return parameters.loadNumber;", , CI, "general access to load number"
Fv, C, GetType, , , "SensorType", "return SensorType::Load;", , CI, "return sensor type"
#
Fv, C, GetWriteToFileFlag, , , bool, "return parameters.writeToFile;", , CI, "get writeToFile flag"
Fv, C, GetFileName, , , "STDstring", "return parameters.fileName;", , CI, "get file name"
Fv, C, GetOutputVariableType, , , OutputVariableType, "return OutputVariableType::_None;", , CI, "get OutputVariableType"
#
Fv, C, GetSensorValues, , , void, , "const CSystemData& cSystemData, Vector& values, ConfigurationType configuration = ConfigurationType::Current", CDI, "main function to generate sensor output values"
Fv, M, GetTypeName, , , const char*,"return 'Load';", , CI, "Get type name of sensor (without keyword 'Sensor'...!)"
#VISUALIZATION:
Vp, V, show, , , bool, "true", , IO, "set true, if item is shown in visualization and false if it is not shown; CURRENTLY NOT AVAILABLE"
Fv, V, UpdateGraphics, , , void, ";", "const VisualizationSettings& visualizationSettings, VisualizationSystem* vSystem, Index itemNumber", I, "Update visualizationSystem -> graphicsData for item; index shows item Number in CData"
#file names automatically determined from class name
writeFile = True
| 136.855513 | 1,656 | 0.573221 | 64,178 | 611,881 | 5.427857 | 0.032285 | 0.00689 | 0.00155 | 0.027128 | 0.867225 | 0.851563 | 0.835096 | 0.815105 | 0.802451 | 0.78976 | 0 | 0.013968 | 0.304187 | 611,881 | 4,470 | 1,657 | 136.88613 | 0.804223 | 0 | 0 | 0.652022 | 1 | 0.329357 | 0.452514 | 0.067906 | 0 | 0 | 0 | 0 | 0.004364 | 0 | null | null | 0 | 0 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 |
0f02ac45bfdfb25a6bd3a0014772b0659fcfef90 | 1,737 | py | Python | gen/constants_scene_nums.py | Chucooleg/alfred | 250cdc8b1e75dd6acb9e20d3c616beec63307a46 | [
"MIT"
] | 1 | 2021-07-19T01:58:51.000Z | 2021-07-19T01:58:51.000Z | gen/constants_scene_nums.py | Chucooleg/alfred | 250cdc8b1e75dd6acb9e20d3c616beec63307a46 | [
"MIT"
] | null | null | null | gen/constants_scene_nums.py | Chucooleg/alfred | 250cdc8b1e75dd6acb9e20d3c616beec63307a46 | [
"MIT"
] | null | null | null | ########################################################################################################################
# General Settings
TRAIN_SCENES = set([1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 216, 217, 218, 220, 221, 222, 223, 224, 225, 227, 228, 229, 230, 301, 302, 303, 304, 305, 306, 307, 309, 310, 311, 312, 313, 314, 316, 317, 318, 319, 320, 321, 322, 323, 324, 326, 327, 328, 329, 330, 401, 402, 403, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 426, 427, 428, 429, 430])
VALID_SEEN_SCENES = set([1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 201, 202, 203, 204, 205, 206, 207, 212, 213, 214, 216, 218, 222, 223, 224, 225, 227, 229, 230, 301, 302, 303, 304, 305, 309, 310, 311, 313, 314, 316, 318, 320, 323, 324, 326, 327, 328, 329, 330, 401, 402, 403, 405, 406, 407, 408, 409, 410, 412, 413, 414, 415, 417, 418, 419, 422, 423, 426, 427, 428, 429])
VALID_UNSEEN_SCENES = set([10, 219, 308, 424])
TEST_SEEN_SCENES = set([1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 216, 217, 218, 220, 221, 222, 223, 224, 225, 227, 228, 230, 301, 302, 303, 304, 305, 306, 307, 309, 310, 311, 312, 313, 314, 316, 317, 318, 319, 320, 321, 322, 323, 324, 326, 327, 328, 329, 330, 401, 402, 403, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 426, 427, 428, 429, 430])
TEST_UNSEEN_SCENES = set([215, 226, 29, 315, 325, 404, 425, 9]) | 144.75 | 525 | 0.545769 | 336 | 1,737 | 2.794643 | 0.383929 | 0.047923 | 0.031949 | 0.035144 | 0.829606 | 0.813632 | 0.794462 | 0.768903 | 0.768903 | 0.768903 | 0 | 0.595442 | 0.19171 | 1,737 | 12 | 526 | 144.75 | 0.073362 | 0.009211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 |
0f3b539e8cd794b301e6d70d80b19b5e9296960e | 12,729 | py | Python | stix_shifter_modules/datadog/test/stix_translation/test_datadog_stix_to_query.py | raizik/stix-shifter | e09e80c71901486f9486cac68891156b2bd3840f | [
"Apache-2.0"
] | null | null | null | stix_shifter_modules/datadog/test/stix_translation/test_datadog_stix_to_query.py | raizik/stix-shifter | e09e80c71901486f9486cac68891156b2bd3840f | [
"Apache-2.0"
] | null | null | null | stix_shifter_modules/datadog/test/stix_translation/test_datadog_stix_to_query.py | raizik/stix-shifter | e09e80c71901486f9486cac68891156b2bd3840f | [
"Apache-2.0"
] | null | null | null | import json
import unittest
from unittest.mock import patch
from stix_shifter.stix_translation import stix_translation
from stix_shifter_utils.utils.error_response import ErrorCode
translation = stix_translation.StixTranslation()
def _test_query_assertions(query, queries):
assert query['queries'] == queries
class TestStixToQuery(unittest.TestCase, object):
@patch('time.time', return_value=12345678)
def test_ipv4_query(self, mock_time):
stix_pattern = "[x-oca-event:code = 12345678 OR domain-name:value = 'abc.com']"
query = translation.translate('datadog', 'query', 'datadog', stix_pattern)
queries = ['{"query": {"host": "abc.com", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"id": 12345678, "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"id_str": "12345678", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"host": "abc.com", "start": 12345378, "end": 12345678}, "source": "processes"}',
'{"query": {"id": 12345678, "start": 12345378, "end": 12345678}, "source": "processes"}',
'{"query": {"id_str": "12345678", "start": 12345378, "end": 12345678}, "source": "processes"}']
assert query['queries'] == queries
@patch('time.time', return_value=12345678)
def test_domain_name_query(self, mock_time):
stix_pattern = "[domain-name:value = 'abc.com']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"host": "abc.com", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"host": "abc.com", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_event_id_query(self, mock_time):
stix_pattern = "[x-oca-event:code = 12345678]"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"id": 12345678, "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"id_str": "12345678", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"id": 12345678, "start": 12345378, "end": 12345678}, "source": "processes"}',
'{"query": {"id_str": "12345678", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_priority_query(self, mock_time):
stix_pattern = "[x-datadog-event:priority = 'info']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"priority": "info", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"priority": "info", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_title_query(self, mock_time):
stix_pattern = "[x-oca-event:outcome = 'title']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"title": "title", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"title": "title", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_text_query(self, mock_time):
stix_pattern = "[artifact:payload_bin = 'text']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"text": "text", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"text": "text", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_device_name_query(self, mock_time):
stix_pattern = "[x-oca-event:agent = 'Windows']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"device_name": "Windows", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"device_name": "Windows", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_source_query(self, mock_time):
stix_pattern = "[x-oca-event:module = 'source' AND x-oca-event:module = 'default']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"source": "default,source", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"source": "default,source", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_monitor_id_query(self, mock_time):
stix_pattern = "[x-datadog-event:monitor_id = '12345678']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"monitor_id": 12345678, "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"monitor_id": 12345678, "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_tags_query(self, mock_time):
stix_pattern = "[x-datadog-event:tags = 'tags']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"tags": "tags", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"tags": "tags", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_is_aggregate_query(self, mock_time):
stix_pattern = "[x-datadog-event:is_aggregate = 'true']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"unaggregated": "true", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"unaggregated": "true", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_alert_type_query(self, mock_time):
stix_pattern = "[x-datadog-event:alert_type = 'alert_type']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"alert_type": "alert_type", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"alert_type": "alert_type", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_start_query(self, mock_time):
stix_pattern = "[x-ibm-finding:start = '2021-01-28T12:24:01.009Z']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"start": 1611836641, "end": 12345678}, "source": "events"}',
'{"query": {"start": 1611836641, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
def test_end_query(self):
stix_pattern = "[x-ibm-finding:end = '2021-01-28T12:24:01.009Z']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"end": 1611836641, "start": 1611836341}, "source": "events"}',
'{"query": {"end": 1611836641, "start": 1611836341}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_time_observed_query(self, mock_time):
stix_pattern = "[x-ibm-finding:time_observed = '2021-01-28T12:24:01.009Z']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"date_happened": 1611836641, "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"date_happened": 1611836641, "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_process_cmdline_query(self, mock_time):
stix_pattern = "[process:command_line = 'System']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"cmdline": "System", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_process_pid_query(self, mock_time):
stix_pattern = "[process:pid = '92']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"pid": "92", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_process_creator_user_ref_query(self, mock_time):
stix_pattern = "[process:creator_user_ref = 2]"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"user": "2", "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_query_from_multiple_observation_expressions_joined_by_AND(self, mock_time):
stix_pattern = "[x-datadog-event:alert_type = 'alert_type'] AND [x-datadog-event:tags = 'tags']"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"alert_type": "alert_type", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"tags": "tags", "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"alert_type": "alert_type", "start": 12345378, "end": 12345678}, "source": "processes"}',
'{"query": {"tags": "tags", "start": 12345378, "end": 12345678}, "source": "processes"}']
assert query['queries'][0] == queries[0]
def test_query_comparator_operator_AND_with_same_field(self):
stix_pattern = "[domain-name:value = 'abc.com'] START t'2021-01-28T12:24:01.009Z' STOP t'2021-07-25T12:54:01.009Z'"
query = translation.translate('datadog', 'query', 'datadog', stix_pattern)
queries = ['{"query": {"host": "abc.com", "start": 1611836641, "end": 1627217641}, "source": "events"}',
'{"query": {"host": "abc.com", "start": 1611836641, "end": 1627217641}, "source": "processes"}']
_test_query_assertions(query, queries)
def test_query_comparator_operator_AND_with_different_field(self):
stix_pattern = "[domain-name:value = 'abc.com' AND x-datadog-event:alert_type = 'alert_type'] START t'2021-01-28T12:24:01.009Z' STOP t'2021-07-25T12:54:01.009Z'"
query = translation.translate('datadog', 'query', 'datadog', stix_pattern)
queries = ['{"query": {"alert_type": "alert_type", "host": "abc.com", "start": 1611836641, "end": 1627217641}, "source": "events"}',
'{"query": {"alert_type": "alert_type", "host": "abc.com", "start": 1611836641, "end": 1627217641}, "source": "processes"}']
_test_query_assertions(query, queries)
@patch('time.time', return_value=12345678)
def test_IN_query(self, mock_time):
stix_pattern = "[x-datadog-event:alert_type IN ('alert_type', 'default')]"
query = translation.translate('datadog', 'query', '{}', stix_pattern)
queries = ['{"query": {"alert_type": ["alert_type", "default"], "start": 12345378, "end": 12345678}, "source": "events"}',
'{"query": {"alert_type": ["alert_type", "default"], "start": 12345378, "end": 12345678}, "source": "processes"}']
_test_query_assertions(query, queries)
def test_invalid_stix_pattern(self):
stix_pattern = "[not_a_valid_pattern]"
result = translation.translate('datadog', 'query', '{}', stix_pattern, {'validate_pattern': 'true'})
assert False == result['success']
assert ErrorCode.TRANSLATION_STIX_VALIDATION.value == result['code']
assert stix_pattern[1:-1] in result['error']
| 63.645 | 169 | 0.616545 | 1,375 | 12,729 | 5.506182 | 0.090909 | 0.06974 | 0.096553 | 0.12997 | 0.885088 | 0.877295 | 0.852199 | 0.815084 | 0.778761 | 0.602959 | 0 | 0.118035 | 0.189331 | 12,729 | 199 | 170 | 63.964824 | 0.61566 | 0 | 0 | 0.438596 | 0 | 0.309942 | 0.478985 | 0.04203 | 0 | 0 | 0 | 0 | 0.157895 | 1 | 0.140351 | false | 0 | 0.02924 | 0 | 0.175439 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
0f7a0b2a98a3593124d512b9067102de0f237687 | 2,256 | py | Python | hint.py | NeverNotKilza/MiscPythonCode | eca83684ace3464790e90c9059267b83f4374cc2 | [
"MIT"
] | null | null | null | hint.py | NeverNotKilza/MiscPythonCode | eca83684ace3464790e90c9059267b83f4374cc2 | [
"MIT"
] | null | null | null | hint.py | NeverNotKilza/MiscPythonCode | eca83684ace3464790e90c9059267b83f4374cc2 | [
"MIT"
] | null | null | null | table = [
["0xF", "0x7", "0x6", "0x4", "0x5", "0x1", "0x0", "0x2", "0x3", "0xB", "0xA", "0x8", "0x9", "0xD", "0xC", "0xE"],
["0x2", "0x3", "0xB", "0xA", "0x8", "0x9", "0xD", "0xC", "0xE", "0xF", "0x7", "0x6", "0x4", "0x5", "0x1", "0x0"],
["0x6", "0x4", "0x5", "0x1", "0x0", "0x2", "0x3", "0xB", "0xA", "0x8", "0x9", "0xD", "0xC", "0xE", "0xF", "0x7"],
["0x8", "0x9", "0xD", "0xC", "0xE", "0xF", "0x7", "0x6", "0x4", "0x5", "0x1", "0x0", "0x2", "0x3", "0xB", "0xA"],
["0x5", "0x1", "0x0", "0x2", "0x3", "0xB", "0xA", "0x8", "0x9", "0xD", "0xC", "0xE", "0xF", "0x7", "0x6", "0x4"],
["0xB", "0xA", "0x8", "0x9", "0xD", "0xC", "0xE", "0xF", "0x7", "0x6", "0x4", "0x5", "0x1", "0x0", "0x2", "0x3"],
["0x0", "0x2", "0x3", "0xB", "0xA", "0x8", "0x9", "0xD", "0xC", "0xE", "0xF", "0x7", "0x6", "0x4", "0x5", "0x1"],
["0x7", "0x6", "0x4", "0x5", "0x1", "0x0", "0x2", "0x3", "0xB", "0xA", "0x8", "0x9", "0xD", "0xC", "0xE", "0xF"],
["0x3", "0xB", "0xA", "0x8", "0x9", "0xD", "0xC", "0xE", "0xF", "0x7", "0x6", "0x4", "0x5", "0x1", "0x0", "0x2"],
["0x1", "0x0", "0x2", "0x3", "0xB", "0xA", "0x8", "0x9", "0xD", "0xC", "0xE", "0xF", "0x7", "0x6", "0x4", "0x5"],
["0xA", "0x8", "0x9", "0xD", "0xC", "0xE", "0xF", "0x7", "0x6", "0x4", "0x5", "0x1", "0x0", "0x2", "0x3", "0xB"],
["0x4", "0x5", "0x1", "0x0", "0x2", "0x3", "0xB", "0xA", "0x8", "0x9", "0xD", "0xC", "0xE", "0xF", "0x7", "0x6"],
["0x9", "0xD", "0xC", "0xE", "0xF", "0x7", "0x6", "0x4", "0x5", "0x1", "0x0", "0x2", "0x3", "0xB", "0xA", "0x8"],
["0xD", "0xC", "0xE", "0xF", "0x7", "0x6", "0x4", "0x5", "0x1", "0x0", "0x2", "0x3", "0xB", "0xA", "0x8", "0x9"],
["0xC", "0xE", "0xF", "0x7", "0x6", "0x4", "0x5", "0x1", "0x0", "0x2", "0x3", "0xB", "0xA", "0x8", "0x9", "0xD"],
["0xE", "0xF", "0x7", "0x6", "0x4", "0x5", "0x1", "0x0", "0x2", "0x3", "0xB", "0xA", "0x8", "0x9", "0xD", "0xC"]
]
# Encryption process:
# cl = table[pl][kh]
# ch = table[ph][kl]
# Where cl = the low cipher byte, ch = the high cipher byte, pl = low plaintext
# byte, ph = high plaintext byte, kl = low key byte, kh = high key byte
# i.e. the cipher character is cl byte + ch byte
# Key is of length seven, not given.
key = [[?, ?], [?, ?], [?, ?], [?, ?], [?, ?], [?, ?], [?, ?]] | 80.571429 | 118 | 0.433954 | 312 | 2,256 | 3.137821 | 0.134615 | 0.091931 | 0.128703 | 0.159346 | 0.784474 | 0.784474 | 0.784474 | 0.784474 | 0.784474 | 0.784474 | 0 | 0.223776 | 0.175975 | 2,256 | 28 | 119 | 80.571429 | 0.302851 | 0.127216 | 0 | 0 | 0 | 0 | 0.391437 | 0 | 0 | 0 | 0.391437 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
7ea3f507b0c378853efe4de5a63f682042ac7e50 | 10,016 | py | Python | tests/middleware/test_pymemcache.py | anomaly/vishnu | 808febfd402842550390f72ca82ba97e43eb8155 | [
"Apache-2.0"
] | 4 | 2017-01-30T06:40:40.000Z | 2017-05-18T02:31:25.000Z | tests/middleware/test_pymemcache.py | anomaly/vishnu | 808febfd402842550390f72ca82ba97e43eb8155 | [
"Apache-2.0"
] | 24 | 2016-09-16T06:16:15.000Z | 2018-10-08T03:33:13.000Z | tests/middleware/test_pymemcache.py | anomaly/vishnu | 808febfd402842550390f72ca82ba97e43eb8155 | [
"Apache-2.0"
] | 1 | 2020-02-13T22:01:50.000Z | 2020-02-13T22:01:50.000Z |
def test_manual_save():
from vishnu.backend import PyMemcache
from ..middleware import test_app
app = test_app(use_https=True, backend=PyMemcache())
# check public before login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private before login
private_resp = app.get('/private', status=401)
assert private_resp.status_int == 401
# start session (manual save)
login_resp = app.post("/login/save")
assert login_resp.status_int == 200
# check public after login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private after login
private_resp = app.get('/private')
assert private_resp.status_int == 200
# end session
logout_resp = app.get("/logout")
assert logout_resp.status_int == 200
# check public after logout
public_resp = app.get("/public")
assert public_resp.status_int == 200
# check private after logout
private_resp = app.get("/private", status=401)
assert private_resp.status_int == 401
def test_auto_save():
from vishnu.backend import PyMemcache
from ..middleware import test_app
app = test_app(use_https=True, auto_save=True, backend=PyMemcache())
# check public before login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private before login
private_resp = app.get('/private', status=401)
assert private_resp.status_int == 401
# start session (manual save)
login_resp = app.post("/login/no/save")
assert login_resp.status_int == 200
# check public after login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private after login
private_resp = app.get('/private')
assert private_resp.status_int == 200
# end session
logout_resp = app.get("/logout")
assert logout_resp.status_int == 200
# check public after logout
public_resp = app.get("/public")
assert public_resp.status_int == 200
# check private after logout
private_resp = app.get("/private", status=401)
assert private_resp.status_int == 401
def test_default_cookie_name():
from vishnu.backend import PyMemcache
from vishnu.session import DEFAULT_COOKIE_NAME
from ..middleware import test_app
app = test_app(use_https=True, backend=PyMemcache())
# check public before login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private before login
private_resp = app.get('/private', status=401)
assert private_resp.status_int == 401
# start session (manual save)
login_resp = app.post("/login/save")
assert login_resp.status_int == 200
# check public after login
public_resp = app.get('/public')
assert public_resp.status_int == 200
assert DEFAULT_COOKIE_NAME in app.cookies
# check private after login
private_resp = app.get('/private')
assert private_resp.status_int == 200
# end session
logout_resp = app.get("/logout")
assert logout_resp.status_int == 200
# check public after logout
public_resp = app.get("/public")
assert public_resp.status_int == 200
# check private after logout
private_resp = app.get("/private", status=401)
assert private_resp.status_int == 401
def test_custom_cookie_name():
from vishnu.backend import PyMemcache
from ..middleware import test_app
custom_cookie_name = "my-cookie-name"
app = test_app(use_https=True, cookie_name=custom_cookie_name, backend=PyMemcache())
# check public before login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private before login
private_resp = app.get('/private', status=401)
assert private_resp.status_int == 401
# start session (manual save)
login_resp = app.post("/login/save")
assert login_resp.status_int == 200
# check public after login
public_resp = app.get('/public')
assert public_resp.status_int == 200
assert custom_cookie_name in app.cookies
# check private after login
private_resp = app.get('/private')
assert private_resp.status_int == 200
# end session
logout_resp = app.get("/logout")
assert logout_resp.status_int == 200
# check public after logout
public_resp = app.get("/public")
assert public_resp.status_int == 200
# check private after logout
private_resp = app.get("/private", status=401)
assert private_resp.status_int == 401
def test_encrypted():
from vishnu.backend import PyMemcache
from ..middleware import test_app
app = test_app(use_https=True, encrypt=True, backend=PyMemcache())
# check public before login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private before login
private_resp = app.get('/private', status=401)
assert private_resp.status_int == 401
# start session (manual save)
login_resp = app.post("/login/save")
assert login_resp.status_int == 200
# check public after login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private after login
private_resp = app.get('/private')
assert private_resp.status_int == 200
# end session
logout_resp = app.get("/logout")
assert logout_resp.status_int == 200
# check public after logout
public_resp = app.get("/public")
assert public_resp.status_int == 200
# check private after logout
private_resp = app.get("/private", status=401)
assert private_resp.status_int == 401
def test_unencrypted():
from vishnu.backend import PyMemcache
from ..middleware import test_app
app = test_app(use_https=True, encrypt=False, backend=PyMemcache())
# check public before login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private before login
private_resp = app.get('/private', status=401)
assert private_resp.status_int == 401
# start session (manual save)
login_resp = app.post("/login/save")
assert login_resp.status_int == 200
# check public after login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private after login
private_resp = app.get('/private')
assert private_resp.status_int == 200
# end session
logout_resp = app.get("/logout")
assert logout_resp.status_int == 200
# check public after logout
public_resp = app.get("/public")
assert public_resp.status_int == 200
# check private after logout
private_resp = app.get("/private", status=401)
assert private_resp.status_int == 401
def test_insecure_http():
from vishnu.backend import PyMemcache
from ..middleware import test_app
app = test_app(use_https=False, secure=False, backend=PyMemcache())
# check public before login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private before login
private_resp = app.get('/private', status=401)
assert private_resp.status_int == 401
# start session (manual save)
login_resp = app.post("/login/save")
assert login_resp.status_int == 200
# check public after login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private after login
private_resp = app.get('/private')
assert private_resp.status_int == 200
# end session
logout_resp = app.get("/logout")
assert logout_resp.status_int == 200
# check public after logout
public_resp = app.get("/public")
assert public_resp.status_int == 200
# check private after logout
private_resp = app.get("/private", status=401)
assert private_resp.status_int == 401
def test_secure_https():
from vishnu.backend import PyMemcache
from ..middleware import test_app
app = test_app(use_https=True, secure=True, backend=PyMemcache())
# check public before login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private before login
private_resp = app.get('/private', status=401)
assert private_resp.status_int == 401
# start session (manual save)
login_resp = app.post("/login/save")
assert login_resp.status_int == 200
# check public after login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private after login
private_resp = app.get('/private')
assert private_resp.status_int == 200
# end session
logout_resp = app.get("/logout")
assert logout_resp.status_int == 200
# check public after logout
public_resp = app.get("/public")
assert public_resp.status_int == 200
# check private after logout
private_resp = app.get("/private", status=401)
assert private_resp.status_int == 401
def test_secure_http():
from vishnu.backend import PyMemcache
from ..middleware import test_app
app = test_app(use_https=False, secure=True, backend=PyMemcache())
# check public before login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private before login
private_resp = app.get('/private', status=401)
assert private_resp.status_int == 401
# start session (manual save)
login_resp = app.post("/login/save")
assert login_resp.status_int == 200
# check public after login
public_resp = app.get('/public')
assert public_resp.status_int == 200
# check private after login
private_resp = app.get('/private', status=401)
assert private_resp.status_int == 401
# end session
logout_resp = app.get("/logout")
assert logout_resp.status_int == 200
# check public after logout
public_resp = app.get("/public")
assert public_resp.status_int == 200
# check private after logout
private_resp = app.get("/private", status=401)
assert private_resp.status_int == 401
| 28.864553 | 88 | 0.690795 | 1,353 | 10,016 | 4.912047 | 0.035477 | 0.075835 | 0.140837 | 0.127596 | 0.973518 | 0.973518 | 0.970208 | 0.970208 | 0.961631 | 0.961631 | 0 | 0.034448 | 0.208766 | 10,016 | 346 | 89 | 28.947977 | 0.804164 | 0.176917 | 0 | 0.88587 | 0 | 0 | 0.07149 | 0 | 0 | 0 | 0 | 0 | 0.402174 | 1 | 0.048913 | false | 0 | 0.103261 | 0 | 0.152174 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
0e33e7f6c62e4b74128321497a085ed73771c19b | 933 | py | Python | main.py | RobertoAssumpcao/pergunta_de_soma | 261f8ac9d0219ca4ba2e34516badeade6cba7877 | [
"Apache-2.0"
] | null | null | null | main.py | RobertoAssumpcao/pergunta_de_soma | 261f8ac9d0219ca4ba2e34516badeade6cba7877 | [
"Apache-2.0"
] | null | null | null | main.py | RobertoAssumpcao/pergunta_de_soma | 261f8ac9d0219ca4ba2e34516badeade6cba7877 | [
"Apache-2.0"
] | null | null | null | #import
import random
#iniciando variavel
acertos = 0
#gerando numero
numero_a = random.randrange(1, 100)
numero_b = random.randrange(1, 100)
#pergunta
resposta = int(input(f"Quanto é {numero_a} + {numero_b} ? \n"))
# soma numero
resultado = numero_a + numero_b
#resposta
print(f"A resposta é {resultado}")
#contando acerto
if resposta == resultado:
acertos = acertos + 1
else:
print("Resposta errada\n")
# ---------------------------------------------------------------- 2 -------------------------------
#gerando numero
numero_a = random.randrange(1, 100)
numero_b = random.randrange(1, 100)
#pergunta
resposta = int(input(f"Quanto é {numero_a} + {numero_b} ? \n"))
# soma numero
resultado = numero_a + numero_b
#resposta
print(f"A resposta é {resultado}")
#contando acerto
if resposta == resultado:
acertos = acertos + 1
else:
print("resposta errada")
print(f"Voce acertou {acertos} vezes")
| 18.66 | 100 | 0.625938 | 119 | 933 | 4.806723 | 0.277311 | 0.073427 | 0.111888 | 0.132867 | 0.870629 | 0.870629 | 0.870629 | 0.870629 | 0.870629 | 0.870629 | 0 | 0.02551 | 0.1597 | 933 | 49 | 101 | 19.040816 | 0.704082 | 0.254019 | 0 | 0.761905 | 0 | 0 | 0.267254 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.047619 | 0 | 0.047619 | 0.238095 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
0e6f5000e2962a696a102f739f0b69c66b727c82 | 8,330 | py | Python | sudoku_solver/src/uniquerectangle_solver.py | bcorso/sudoku-solver | f54cf328f23065eed2c38532bd5f2bde3f112355 | [
"MIT"
] | 3 | 2015-01-18T23:35:40.000Z | 2021-04-02T18:18:16.000Z | sudoku_solver/src/uniquerectangle_solver.py | bcorso/sudoku-solver | f54cf328f23065eed2c38532bd5f2bde3f112355 | [
"MIT"
] | 1 | 2015-09-30T11:25:05.000Z | 2015-10-01T03:39:28.000Z | sudoku_solver/src/uniquerectangle_solver.py | bcorso/sudoku-solver | f54cf328f23065eed2c38532bd5f2bde3f112355 | [
"MIT"
] | 1 | 2015-09-30T16:40:03.000Z | 2015-09-30T16:40:03.000Z | '''
Created on Feb 7, 2013
@author: Brad
'''
from naked_solver import NakedSolver
from solver import Solver, SolvedSet, visible_intersection, has_size, has_count, \
candidate_count
from sudoku_board import Cell
class UniqueRectangleSolver(Solver):
NAME = "Unique Rectangle"
def find(self, board, do_all = False):
solved_sets = []
rules = [self.find_rule1, self.find_rule2, self.find_rule3, self.find_rule4]
for rule in rules:
solved_sets += rule(board, do_all)
if solved_sets and not do_all:
return solved_sets
return solved_sets
def find_rule1(self, board, do_all = False):
naked_solver = NakedSolver(Solver.DOUBLE)
for row in range(board.N):
for floor in naked_solver.find_in_list(board.get_row(row)):
for i, f1 in enumerate(floor):
for j, f2 in enumerate(floor):
ceil1 = [cell for cell in board.get_col(f1.j) if i != j and cell != f1 and len(set([f1.k, f2.k, cell.k])) == 2 and cell.c == f1.c]
ceil2 = [board.get(cell.i, f2.j) for cell in ceil1 if board.get(cell.i, f2.j).check_remove(f1.c)]
if ceil1 and ceil2:
return [SolvedSet(UniqueRectangleSolver(0, Solver.TYPE1), list(floor) + ceil1 + ceil2, f1.c, ceil2)]
return []
def find_rule2(self, board, do_all = False):
naked_solver = NakedSolver(Solver.DOUBLE)
for row in range(board.N):
for floor in naked_solver.find_in_list(board.get_row(row)):
for i, f1 in enumerate(floor):
for j, f2 in enumerate(floor):
ceils1 = [cell for cell in board.get_col(f1.j) if i != j and cell != f1 and len(set([f1.k, f2.k, cell.k])) == 2 and cell.c.issuperset(f1.c) and not f1.c.issuperset(cell.c)]
for ceil1 in ceils1:
cell = board.get(ceil1.i, f2.j)
ceil2 = cell if cell.c.issuperset(ceil1.c) and ceil1.c.issuperset(cell.c) else None
if ceil2:
remove = [cell for cell in visible_intersection(board,[ceil1,ceil2]) if cell.check_remove(ceil1.c & ceil2.c - f1.c) ]
if remove:
return [SolvedSet(UniqueRectangleSolver(0, Solver.TYPE2), [f1,f2,ceil1,ceil2], ceil1.c & ceil2.c - f1.c, remove)]
for col in range(board.N):
for floor in naked_solver.find_in_list(board.get_col(col)):
for i, f1 in enumerate(floor):
for j, f2 in enumerate(floor):
ceils1 = [cell for cell in board.get_row(f1.i) if i != j and cell != f1 and len(set([f1.k, f2.k, cell.k])) == 2 and cell.c.issuperset(f1.c) and not f1.c.issuperset(cell.c)]
for ceil1 in ceils1:
cell = board.get(f2.i, ceil1.j)
ceil2 = cell if cell.c.issuperset(ceil1.c) and ceil1.c.issuperset(cell.c) else None
if ceil2:
print ceil2.c
print ceil1.c
remove = [cell for cell in visible_intersection(board,[ceil1,ceil2]) if cell.check_remove(ceil1.c & ceil2.c - f1.c) ]
if remove:
return [SolvedSet(UniqueRectangleSolver(0, Solver.TYPE2), [f1,f2,ceil1,ceil2], ceil1.c & ceil2.c - f1.c, remove)]
return []
def find_rule3(self, board, do_all = False):
naked_solver = NakedSolver(Solver.DOUBLE)
for row in range(board.N):
for floor in naked_solver.find_in_list(board.get_row(row)):
for i, f1 in enumerate(floor):
for j, f2 in enumerate(floor):
ceils1 = [cell for cell in board.get_col(f1.j) if i != j and cell != f1 and len(set([f1.k, f2.k, cell.k])) == 2 and cell.c.issuperset(f1.c) and len(cell.c - f1.c) == 1]
for ceil1 in ceils1:
cell = board.get(ceil1.i, f2.j)
ceil2 = cell if cell.c.issuperset(f1.c) and len(cell.c - f1.c) == 1 and not cell.c.issuperset(ceil1.c) else None
if ceil2:
pair = [cell for cell in visible_intersection(board,[ceil1,ceil2]) if cell != f1 and cell != f2 and cell.c == ceil1.c ^ ceil2.c ]
if pair:
remove = [cell for cell in visible_intersection(board,[ceil1,ceil2,pair[0]]) if cell != f1 and cell != f2 and cell.check_remove(pair[0].c)]
if remove:
return [SolvedSet(UniqueRectangleSolver(0, Solver.TYPE3), [f1,f2,ceil1,ceil2,pair[0]], pair[0].c, remove)]
for col in range(board.N):
for floor in naked_solver.find_in_list(board.get_col(col)):
for i, f1 in enumerate(floor):
for j, f2 in enumerate(floor):
ceils1 = [cell for cell in board.get_row(f1.i) if i != j and cell != f1 and len(set([f1.k, f2.k, cell.k])) == 2 and cell.c.issuperset(f1.c) and len(cell.c - f1.c) == 1]
for ceil1 in ceils1:
cell = board.get(f2.i, ceil1.j)
ceil2 = cell if cell.c.issuperset(f1.c) and len(cell.c - f1.c) == 1 and not cell.c.issuperset(ceil1.c) else None
if ceil2:
pair = [cell for cell in visible_intersection(board,[ceil1,ceil2]) if cell != f1 and cell != f2 and cell.c == ceil1.c ^ ceil2.c ]
if pair:
remove = [cell for cell in visible_intersection(board,[ceil1,ceil2,pair[0]]) if cell != f1 and cell != f2 and cell.check_remove(pair[0].c)]
if remove:
return [SolvedSet(UniqueRectangleSolver(0, Solver.TYPE3), [f1,f2,ceil1,ceil2,pair[0]], pair[0].c, remove)]
return []
def find_rule4(self, board, do_all = False):
naked_solver = NakedSolver(Solver.DOUBLE)
for row in range(board.N):
for floor in naked_solver.find_in_list(board.get_row(row)):
for i, f1 in enumerate(floor):
for j, f2 in enumerate(floor):
ceils1 = [cell for cell in board.get_col(f1.j) if i != j and cell != f1 and len(set([f1.k, f2.k, cell.k])) == 2 and cell.c.issuperset(f1.c) and not f1.c.issuperset(cell.c)]
for ceil1 in ceils1:
ceil2 = board.get(ceil1.i, f2.j)
for x in f1.c:
if ceil2.c.issuperset(f1.c) and len(ceil2.c - f1.c) > 0 and (candidate_count(board.get_row(ceil2.i),x) == 2 or candidate_count(board.get_box(ceil2.k),x) == 2):
return [SolvedSet(UniqueRectangleSolver(0, Solver.TYPE4), [f1,f2,ceil1,ceil2], f1.c - set([x]), [ceil1,ceil2])]
for col in range(board.N):
for floor in naked_solver.find_in_list(board.get_col(col)):
for i, f1 in enumerate(floor):
for j, f2 in enumerate(floor):
ceils1 = [cell for cell in board.get_row(f1.i) if i != j and cell != f1 and len(set([f1.k, f2.k, cell.k])) == 2 and cell.c.issuperset(f1.c) and not f1.c.issuperset(cell.c)]
for ceil1 in ceils1:
ceil2 = board.get(f2.i, ceil1.j)
for x in f1.c:
if ceil2.c.issuperset(f1.c) and len(ceil2.c - f1.c) > 0 and (candidate_count(board.get_col(ceil2.j),x) == 2 or candidate_count(board.get_box(ceil2.k),x) == 2):
return [SolvedSet(UniqueRectangleSolver(0, Solver.TYPE4), [f1,f2,ceil1,ceil2], f1.c - set([x]), [ceil1,ceil2])]
return [] | 70 | 209 | 0.513325 | 1,133 | 8,330 | 3.699912 | 0.074139 | 0.022185 | 0.053435 | 0.040315 | 0.867128 | 0.846136 | 0.834685 | 0.834685 | 0.834685 | 0.834685 | 0 | 0.04814 | 0.37407 | 8,330 | 119 | 210 | 70 | 0.75585 | 0 | 0 | 0.740741 | 0 | 0 | 0.001931 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.027778 | null | null | 0.018519 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
7ec07566f083cbe90440c73b5d65aa462bf59801 | 20,864 | py | Python | tests/stress/rainflow/test_compat.py | alexander-maier/pylife | a9dceb3f364af16bf0a2d3015e34fa47192bfcf6 | [
"Apache-2.0",
"MIT"
] | 57 | 2019-11-29T23:45:08.000Z | 2022-03-31T09:11:20.000Z | tests/stress/rainflow/test_compat.py | alexander-maier/pylife | a9dceb3f364af16bf0a2d3015e34fa47192bfcf6 | [
"Apache-2.0",
"MIT"
] | 6 | 2021-03-29T10:40:42.000Z | 2022-03-30T12:29:10.000Z | tests/stress/rainflow/test_compat.py | alexander-maier/pylife | a9dceb3f364af16bf0a2d3015e34fa47192bfcf6 | [
"Apache-2.0",
"MIT"
] | 10 | 2020-09-28T17:44:47.000Z | 2022-01-21T17:59:19.000Z | # Copyright (c) 2019-2021 - for information on the respective copyright owner
# see the NOTICE file and/or the repository
# https://github.com/boschresearch/pylife
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__author__ = "Johannes Mueller"
__maintainer__ = __author__
import numpy as np
import pandas as pd
import pylife.stress.rainflow as RF
from pylife.stress.timesignal import TimeSignalGenerator
def make_empty_rainflow_matrix(f1, f2, t1, t2, num):
f_idx = pd.IntervalIndex.from_breaks(np.linspace(f1, f2, num+1))
t_idx = pd.IntervalIndex.from_breaks(np.linspace(t1, t2, num+1))
m_idx = pd.MultiIndex.from_product([f_idx, t_idx], names=['from', 'to'])
return pd.DataFrame(data=np.zeros(num*num), index=m_idx)
def test_rainflow_simple_sine():
signal = np.array([0., 1., -1., 1., -1., 0])
rfc = RF.RainflowCounterThreePoint()
res = rfc.process(signal).get_rainflow_matrix_frame((np.linspace(-1.5, 1.5, 5), np.linspace(-0.25, 1.25, 5)))
expected = make_empty_rainflow_matrix(-1.5, 1.5, -0.25, 1.25, 4)
expected.loc[(-1, 1)] = 1
pd.testing.assert_frame_equal(res, expected)
def test_rainflow_two_amplitudes():
signal = np.array([0, 1., 0., 1., -1., 1., 0., 1., -1., 1., 0])
rfc = RF.RainflowCounterThreePoint()
res = rfc.process(signal).get_rainflow_matrix_frame((np.linspace(-1.25, 1.25, 5), np.linspace(-0.25, 1.25, 5)))
expected = make_empty_rainflow_matrix(-1.25, 1.25, -0.25, 1.25, 4)
expected.loc[(-1, 1)] = 1
expected.loc[(1, 0)] = 2
pd.testing.assert_frame_equal(res, expected)
def test_rainflow_hits():
r'''
1 2 3 4 5 6
--------------------------------------------------------------------------------------------------------------------
6 x | | | | | | |
----------------/-\-------------------------------------------------------------------------------------------------
5 / \ x x | 1 | | | | | |
--------------/-----\-----------------/-\---------------------------------/-\---------------------------------------
4 / \ x / \ x x x / \ | 1 | | | 3 | | |
------------/---------\---------/-\-/-----\---------/-\-/-\---------/-\-/-----\-/-----------------------------------
3 \ / x \ / x \ / x x | | | | | | |
------------------------\-----/-------------\-----/---------\-----/-------------------------------------------------
2 \ / \ / \ / | | | | | | |
--------------------------\-/-----------------\-/-------------\-/---------------------------------------------------
1 x x x | | | | | | |
--------------------------------------------------------------------------------------------------------------------
'''
signal = np.array([3, 6, 1, 4, 3, 5, 1, 4, 3, 4, 1, 4, 3, 5, 3, 4]) - 0.5
rfc = RF.RainflowCounterThreePoint()
res = rfc.process(signal).get_rainflow_matrix_frame((np.linspace(0, 6, 7), np.linspace(0, 6, 7)))
expected = make_empty_rainflow_matrix(0, 6, 0, 6, 6)
expected.loc[(1, 5)] = 1
expected.loc[(4, 3)] = 3
expected.loc[(1, 4)] = 1
pd.testing.assert_frame_equal(res, expected)
def test_rainflow_haibach_example():
r'''
Example from fig 3.3-30 of E. Haibach "Betriebsfestigkeit"
1 2 3 4 5 6
------------------------------------------------------------------------------------------------------------------
6 6 6 | 1 | | | | | |
----------------/-\-----------------/-\---------------------------------------------------------------------------
5 5 / \ | | 5 | | | | | | |
------/-\-----/-----\--------------/---\----------------------------------/-\-------------------------------------
4 / \ / \ | | 4 4 / \ 4 | 1 | | 1 | | | |
----/-----\-/---------\-----------/-----\-------/-\-------------/-\-----/-----\-/-\-------------------------------
3 / 3 \ 3 | | / \ 3 / \ / 3 \ | | 2 | | | 1 | |
--/---------------------\-/-\----/-------\----/-----\-/-\-----/-----\-/-------------\-----------------------------
2 2 \ | | / 2 \ / 2 2 | | | | 1 | | |
------------------------------\-/---------\-/-------------\-/-----------------------------------------------------
1 1 1 1 | | | | | | |
------------------------------------------------------------------------------------------------------------------
'''
signal = np.array([2, 5, 3, 6, 2, 3, 1, 6, 1, 4, 2, 3, 1, 4, 2, 5, 3, 4, 2]) - 0.5
rfc = RF.RainflowCounterThreePoint()
res = rfc.process(signal).get_rainflow_matrix_frame((np.linspace(0, 6, 7), np.linspace(0, 6, 7)))
expected = make_empty_rainflow_matrix(0, 6, 0, 6, 6)
expected.loc[(1, 6)] = 1
expected.loc[(1, 4)] = 1
expected.loc[(2, 3)] = 2
expected.loc[(3, 4)] = 1
expected.loc[(4, 2)] = 1
expected.loc[(5, 3)] = 1
expected_residuals = np.array([2, 6, 1, 5, 2])
pd.testing.assert_frame_equal(res, expected)
np.testing.assert_array_equal(np.ceil(rfc.residuals()).astype(int), expected_residuals)
def test_rainflow_lecture_example():
r'''
1 2 3 4 5 6
-------------------/\------------------------------------------------------------------------
6 / \ x | | 1 | | | | |
-----------------/----\-------------------------/-\------------------------------------------
5 / \ x / \ | | | | | | |
---------------/--------\-------------/-\-----/-----\----------------------------------------
4 / \ x / \ / \ | | | 1 | | | |
-------------/------------\-/-\-----/-----\-/---------\--------------------------------------
3 / x \ / x \ | | | | | 1 | |
-----------/--------------------\-/---------------------\------------------------------------
2 / x \ | | | | | | |
---------/------------------------------------------------\-/--------------------------------
1 x | | | | | | |
---------------------------------------------------------------------------------------------
'''
signal = np.array([1, 7, 4, 3, 4, 2, 5, 3, 6, 1, 2]) - 0.5
rfc = RF.RainflowCounterThreePoint()
res = rfc.process(signal).get_rainflow_matrix_frame((np.linspace(0., 6., 7), np.linspace(0., 6., 7)))
expected = make_empty_rainflow_matrix(0, 6, 0, 6, 6)
expected.loc[(2, 6)] = 1
expected.loc[(3, 4)] = 1
expected.loc[(5, 3)] = 1
expected_residuals = np.array([1, 7, 1, 2])
pd.testing.assert_frame_equal(res, expected)
np.testing.assert_array_equal(np.ceil(rfc.residuals()).astype(int), expected_residuals)
def test_rainflow_lower_after_main():
r'''
1 2 3 4 5 6
---------------------------------------------------------------------
6 x | | | | | | |
--------/-\----------------------------------------------------------
5 / \ x x | | | | 1 | | |
------/-----\-/-\---------/-\----------------------------------------
4 / x \ / \ | | | | | | |
--\-/-------------\-----/-----\--------------------------------------
3 x \ / \ | | | | | | |
--------------------\-/----------------------------------------------
2 x | | | | | | |
---------------------------------------------------------------------
1 | | | | | | |
---------------------------------------------------------------------
'''
signal = np.array([4, 3, 6, 4, 5, 2, 5, 3]) - 0.5
rfc = RF.RainflowCounterThreePoint()
res = rfc.process(signal).get_rainflow_matrix_frame((np.linspace(0., 6., 7), np.linspace(0., 6., 7)))
expected = make_empty_rainflow_matrix(0, 6, 0, 6, 6)
expected.loc[(4, 5)] = 1
expected_residuals = np.array([4, 3, 6, 2, 5, 3])
pd.testing.assert_frame_equal(res, expected)
np.testing.assert_array_equal(np.ceil(rfc.residuals()).astype(int), expected_residuals)
def test_rainflow_lower_after_main_one_more_close():
r'''
1 2 3 4 5 6
--------------------------------|------------------------------------
6 x | | | | | | | |
--------/-\---------------------|------------------------------------
5 / \ x x | | | 1 | | 1 | | |
------/-----\-/-\---------/-\---|------------------------------------
4 / x \ / \ | | | | | | | |
--\-/-------------\-----/-----\-|------------------------------------
3 x \ / \| | | | | | | |
--------------------\-/---------|------------------------------------
2 x |\ | | | | | | |
--------------------------------|-\-/--------------------------------
1 | x | | | | | | |
--------------------------------|------------------------------------
'''
signal = np.array([4, 3, 6, 4, 5, 2, 5, 3]) - 0.5
signal2 = np.array([1, 2]) - 0.5
rfc = RF.RainflowCounterThreePoint()
res = rfc.process(signal).process(signal2).get_rainflow_matrix_frame((np.linspace(0., 6., 7), np.linspace(0., 6., 7)))
expected = make_empty_rainflow_matrix(0, 6, 0, 6, 6)
expected.loc[(4, 5)] = 1
expected.loc[(2, 5)] = 1
expected_residuals = np.array([4, 3, 6, 1, 2])
pd.testing.assert_frame_equal(res, expected)
np.testing.assert_array_equal(np.ceil(rfc.residuals()).astype(int), expected_residuals)
def test_rainflow_dampening():
r'''
1 2 3 4 5 6
-------------------------------------------------------------------------------------------------------
6 6 | | | | | | |
-----------/-\-----------------------------------------------------------------------------------------
5 / \ 5 | | | | | | |
---------/-----\---------/-\---------------------------------------------------------------------------
4 / \ / \ 4 | | | | | | |
-------/---------\-----/-----\-/-----------------------------------------------------------------------
3 / \ / 3 | | | | | | |
-----/-------------\-/---------------------------------------------------------------------------------
2 / 2 | | | | | | |
---/---------------------------------------------------------------------------------------------------
1 1 | | | | | | |
-------------------------------------------------------------------------------------------------------
'''
signal = np.array([1, 6, 2, 5, 3, 4]) - 0.5
rfc = RF.RainflowCounterThreePoint()
res = rfc.process(signal).get_rainflow_matrix_frame((np.linspace(0., 6., 7), np.linspace(0., 6., 7)))
expected = make_empty_rainflow_matrix(0, 6, 0, 6, 6)
expected_residuals = np.array([1, 6, 2, 5, 3, 4])
pd.testing.assert_frame_equal(res, expected)
np.testing.assert_array_equal(np.ceil(rfc.residuals()).astype(int), expected_residuals)
def test_rainflow_dampening_closed():
r'''
1 2 3 4 5 6
-------------------------------------------------------------------------------------------------------
6 6 | | | | | | |
-----------/-\-----------------------------------------------------------------------------------------
5 / \ 5 | | | | | | |
---------/-----\---------/-\---------------------------------------------------------------------------
4 / \ / \ 4 | | | 1 | | | |
-------/---------\-----/-----\-/-\---------------------------------------------------------------------
3 / \ / 3 \ | | 1 | | | | |
-----/-------------\-/-------------\-------------------------------------------------------------------
2 / 2 \ | | | | | | |
---/---------------------------------\-----------------------------------------------------------------
1 1 1 | | | | | | |
-------------------------------------------------------------------------------------------------------
'''
signal = np.array([1, 6, 2, 5, 3, 4, 1]) - 0.5
rfc = RF.RainflowCounterThreePoint()
res = rfc.process(signal).get_rainflow_matrix_frame((np.linspace(0., 6., 7), np.linspace(0., 6., 7)))
expected = make_empty_rainflow_matrix(0, 6, 0, 6, 6)
expected.loc[(3, 4)] = 1
expected.loc[(2, 5)] = 1
expected_residuals = np.array([1, 6, 1])
pd.testing.assert_frame_equal(res, expected)
np.testing.assert_array_equal(np.ceil(rfc.residuals()).astype(int), expected_residuals)
def test_rainflow_partial_signals_general_FKM():
tsgen = TimeSignalGenerator(10, {'number': 50,
'amplitude_median': 1.0, 'amplitude_std_dev': 0.5,
'frequency_median': 4, 'frequency_std_dev': 3,
'offset_median': 0, 'offset_std_dev': 0.4},
None, None)
signal_tot = tsgen.query(10000)
rfc_tot = RF.RainflowCounterFKM().process(signal_tot)
rfc_partial = RF.RainflowCounterFKM().process(signal_tot[:3424]).process(signal_tot[3424:])
np.testing.assert_array_almost_equal(rfc_tot.loops_from, rfc_partial.loops_from)
np.testing.assert_array_almost_equal(rfc_tot.loops_to, rfc_partial.loops_to)
def test_rainflow_partial_signals_general_three_point():
tsgen = TimeSignalGenerator(10, {'number': 50,
'amplitude_median': 1.0, 'amplitude_std_dev': 0.5,
'frequency_median': 4, 'frequency_std_dev': 3,
'offset_median': 0, 'offset_std_dev': 0.4},
None, None)
signal_tot = tsgen.query(10000)
rfc_tot = RF.RainflowCounterThreePoint().process(signal_tot)
rfc_partial = RF.RainflowCounterThreePoint().process(signal_tot[:3424]).process(signal_tot[3424:])
np.testing.assert_array_almost_equal(rfc_tot.loops_from, rfc_partial.loops_from)
np.testing.assert_array_almost_equal(rfc_tot.loops_to, rfc_partial.loops_to)
def test_rainflow_partial_signals_splitturn_FKM():
tsgen = TimeSignalGenerator(10, {'number': 50,
'amplitude_median': 1.0, 'amplitude_std_dev': 0.5,
'frequency_median': 4, 'frequency_std_dev': 3,
'offset_median': 0, 'offset_std_dev': 0.4},
None, None)
signal_tot = tsgen.query(10000)
rfc_tot = RF.RainflowCounterFKM().process(signal_tot)
turn_points, _ = RF.find_turns(signal_tot)
turn_points = np.insert(turn_points, 0, 0)
turn_num = turn_points.shape[0]
split_points = [int(np.ceil(turn_num*x)) for x in [0.0, 0.137, 0.23, 0.42, 1.0 ]]
rfc_partial = RF.RainflowCounterFKM()
for i in range(len(split_points)-1):
lower = turn_points[split_points[i]]
upper = 10000 if split_points[i+1] == turn_points.shape[0] else turn_points[split_points[i+1]]
rfc_partial.process(signal_tot[lower:upper])
np.testing.assert_array_almost_equal(rfc_tot.loops_from, rfc_partial.loops_from)
np.testing.assert_array_almost_equal(rfc_tot.loops_to, rfc_partial.loops_to)
def test_rainflow_partial_signals_splitturn():
tsgen = TimeSignalGenerator(10, {'number': 50,
'amplitude_median': 1.0, 'amplitude_std_dev': 0.5,
'frequency_median': 4, 'frequency_std_dev': 3,
'offset_median': 0, 'offset_std_dev': 0.4},
None, None)
signal_tot = tsgen.query(10000)
rfc_tot = RF.RainflowCounterThreePoint().process(signal_tot)
turn_points, _ = RF.find_turns(signal_tot)
turn_points = np.insert(turn_points, 0, 0)
turn_num = turn_points.shape[0]
split_points = [int(np.ceil(turn_num*x)) for x in [0.0, 0.137, 0.23, 0.42, 1.0]]
rfc_partial = RF.RainflowCounterThreePoint()
for i in range(len(split_points)-1):
lower = turn_points[split_points[i]]
upper = 10000 if split_points[i+1] == turn_points.shape[0] else turn_points[split_points[i+1]]
_, tot_turns = RF.find_turns(signal_tot[:upper])
rfc_partial.process(signal_tot[lower:upper])
np.testing.assert_array_almost_equal(rfc_tot.loops_from, rfc_partial.loops_from)
np.testing.assert_array_almost_equal(rfc_tot.loops_to, rfc_partial.loops_to)
def test_rainflow_FKM_memory1_inner():
signal = np.array([0., 100., 0., 80., 20., 60., 40., 100., 0., 80., 20., 60., 40., 45.])
rfc = RF.RainflowCounterFKM().process(signal)
np.testing.assert_array_equal(rfc.loops_from, np.array([60., 80., 100.]))
np.testing.assert_array_equal(rfc.loops_to, np.array([40., 20., 0.]))
np.testing.assert_array_equal(rfc.residuals(), np.array([100., 0., 80., 20., 60., 40.]))
def test_rainflow_FKM_memory1_2_3():
signal = np.array([0.,
1., -1., 1., -2., -1., -2., 2., 0., 2., -2.,
1., -1., 1., -2., -1., -2., 2., 0., 2., -2.,
-1.8])
rfc = RF.RainflowCounterFKM().process(signal)
np.testing.assert_array_equal(rfc.loops_from, np.array([1., -2., 2., -2., 1., -2., -2., 2., -2.]))
np.testing.assert_array_equal(rfc.loops_to, np.array([-1., -1., 0., 2., -1., 1., -1., 0., 2.]))
np.testing.assert_array_equal(rfc.residuals(), np.array([1., -2.]))
| 55.489362 | 122 | 0.346242 | 1,825 | 20,864 | 3.767123 | 0.115068 | 0.054836 | 0.043636 | 0.058182 | 0.813818 | 0.791127 | 0.771636 | 0.747636 | 0.7424 | 0.725091 | 0 | 0.051652 | 0.328173 | 20,864 | 375 | 123 | 55.637333 | 0.438824 | 0.482218 | 0 | 0.596685 | 0 | 0 | 0.04084 | 0 | 0 | 0 | 0 | 0 | 0.160221 | 1 | 0.088398 | false | 0 | 0.022099 | 0 | 0.116022 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
7eeb10b243d40e6e2f57723eee5986a65d754c4e | 144 | py | Python | wormsextractor/__init__.py | sharkdata/species | d83df0a17cb9ff435ae5aa4a6527f6de09e49702 | [
"MIT"
] | null | null | null | wormsextractor/__init__.py | sharkdata/species | d83df0a17cb9ff435ae5aa4a6527f6de09e49702 | [
"MIT"
] | null | null | null | wormsextractor/__init__.py | sharkdata/species | d83df0a17cb9ff435ae5aa4a6527f6de09e49702 | [
"MIT"
] | null | null | null |
from wormsextractor.worms_rest_client import WormsRestWebserviceClient
from wormsextractor.worms_extract_taxa import SharkSpeciesListGenerator
| 36 | 71 | 0.923611 | 14 | 144 | 9.214286 | 0.714286 | 0.27907 | 0.356589 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0625 | 144 | 3 | 72 | 48 | 0.955556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
7eec2c0a89c8f98fd30140ac0e2e4aa5486d66e1 | 4,919 | py | Python | trimesh/sample.py | maganrobotics/UR3e-manipulation | ceaf650b1a811d0bfc3baf175d353fc7f4a33522 | [
"MIT"
] | null | null | null | trimesh/sample.py | maganrobotics/UR3e-manipulation | ceaf650b1a811d0bfc3baf175d353fc7f4a33522 | [
"MIT"
] | null | null | null | trimesh/sample.py | maganrobotics/UR3e-manipulation | ceaf650b1a811d0bfc3baf175d353fc7f4a33522 | [
"MIT"
] | null | null | null | import numpy as np
def sample_surface(mesh, count):
'''
Sample the surface of a mesh, returning the specified number of points
For individual triangle sampling uses this method:
http://mathworld.wolfram.com/TrianglePointPicking.html
Arguments
---------
mesh: Trimesh object
count: number of points to return
Returns
---------
samples: (count,3) points in space on the surface of mesh
'''
#len(mesh.faces) float array of the areas of each face of the mesh
area = mesh.area_faces
# total area (float)
area_sum = np.sum(area)
# cumulative area (len(mesh.faces))
area_cum = np.cumsum(area)
face_pick = np.random.random(count) * area_sum
face_index = np.searchsorted(area_cum, face_pick)
# pull triangles into the form of an origin + 2 vectors
tri_origins = mesh.triangles[:,0]
tri_vectors = mesh.triangles[:,1:].copy()
tri_vectors -= np.tile(tri_origins, (1,2)).reshape((-1,2,3))
# pull the vectors for the faces we are going to sample from
tri_origins = tri_origins[face_index]
tri_vectors = tri_vectors[face_index]
# randomly generate two 0-1 scalar components to multiply edge vectors by
random_lengths = np.random.random((len(tri_vectors), 2, 1))
# points will be distributed on a quadrilateral if we use 2 0-1 samples
# if the two scalar components sum less than 1.0 the point will be
# inside the triangle, so we find vectors longer than 1.0 and
# transform them to be inside the triangle
random_test = random_lengths.sum(axis=1).reshape(-1) > 1.0
random_lengths[random_test] -= 1.0
random_lengths = np.abs(random_lengths)
# multiply triangle edge vectors by the random lengths and sum
sample_vector = (tri_vectors*random_lengths).sum(axis=1)
# finally, offset by the origin to generate
# (n,3) points in space on the triangle
samples = sample_vector + tri_origins
return samples
def sample_surface_withfaceid(mesh, count):
'''
Sample the surface of a mesh, returning the specified number of points
For individual triangle sampling uses this method:
http://mathworld.wolfram.com/TrianglePointPicking.html
Arguments
---------
mesh: Trimesh object
count: number of points to return
Returns
---------
samples: (count,3) points in space on the surface of mesh
'''
#len(mesh.faces) float array of the areas of each face of the mesh
area = mesh.area_faces
# total area (float)
area_sum = np.sum(area)
# cumulative area (len(mesh.faces))
area_cum = np.cumsum(area)
face_pick = np.random.random(count) * area_sum
face_index = np.searchsorted(area_cum, face_pick)
# pull triangles into the form of an origin + 2 vectors
tri_origins = mesh.triangles[:,0]
tri_vectors = mesh.triangles[:,1:].copy()
tri_vectors -= np.tile(tri_origins, (1,2)).reshape((-1,2,3))
# pull the vectors for the faces we are going to sample from
tri_origins = tri_origins[face_index]
tri_vectors = tri_vectors[face_index]
# randomly generate two 0-1 scalar components to multiply edge vectors by
random_lengths = np.random.random((len(tri_vectors), 2, 1))
# points will be distributed on a quadrilateral if we use 2 0-1 samples
# if the two scalar components sum less than 1.0 the point will be
# inside the triangle, so we find vectors longer than 1.0 and
# transform them to be inside the triangle
random_test = random_lengths.sum(axis=1).reshape(-1) > 1.0
random_lengths[random_test] -= 1.0
random_lengths = np.abs(random_lengths)
# multiply triangle edge vectors by the random lengths and sum
sample_vector = (tri_vectors*random_lengths).sum(axis=1)
# finally, offset by the origin to generate
# (n,3) points in space on the triangle
samples = sample_vector + tri_origins
return samples, face_index
def sample_volume(mesh, count):
'''
'''
points = (np.random.random((count, 3))*mesh.extents) + mesh.bounds[0]
contained = mesh.contains(points)
samples = points[contained]
return samples
def sample_surface_even(mesh, count):
'''
Sample the surface of a mesh, returning samples which are
approximately evenly spaced.
'''
from .points import remove_close
radius = np.sqrt(mesh.area / (2*count))
samples = sample_surface(mesh, count*5)
result = remove_close(samples, radius)
return result
def sample_surface_even_withfaceid(mesh, count):
'''
Sample the surface of a mesh, returning samples which are
approximately evenly spaced.
'''
from .points import remove_close_withfaceid
radius = np.sqrt(mesh.area / (2*count))
samples, face_index = sample_surface_withfaceid(mesh, count*5)
result = remove_close_withfaceid(samples, face_index, radius)
return result
| 33.462585 | 77 | 0.688961 | 716 | 4,919 | 4.617318 | 0.174581 | 0.055051 | 0.021779 | 0.021779 | 0.913491 | 0.892922 | 0.876588 | 0.876588 | 0.856624 | 0.856624 | 0 | 0.016142 | 0.21915 | 4,919 | 146 | 78 | 33.691781 | 0.844572 | 0.450295 | 0 | 0.703704 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.092593 | false | 0 | 0.055556 | 0 | 0.240741 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
7d17e9ca314961fc0b8d3f595ae0340bdda18710 | 10,736 | py | Python | cloverapi/services/merchant_service.py | Ordrslip/clover-api-python | ad42a09c3fe209cab4d8afc8e8aec95faa8b9839 | [
"MIT"
] | null | null | null | cloverapi/services/merchant_service.py | Ordrslip/clover-api-python | ad42a09c3fe209cab4d8afc8e8aec95faa8b9839 | [
"MIT"
] | 1 | 2019-03-28T19:53:37.000Z | 2019-03-28T19:53:37.000Z | cloverapi/services/merchant_service.py | Ordrslip/clover-api-python | ad42a09c3fe209cab4d8afc8e8aec95faa8b9839 | [
"MIT"
] | 1 | 2019-05-25T23:35:09.000Z | 2019-05-25T23:35:09.000Z | import requests
class MerchantService(object):
def __init__(self, api_authorization, api_url, merchant_id):
self.url = api_url.rstrip('/')
self.merchant_id = merchant_id
self.auth = api_authorization
# Merchants
def get_merchant(self):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id, auth=self.auth, timeout=30, params=payload)
return r.json()
def update_merchant(self, merchant):
# Define Payload
payload = merchant
# Send Request
r = requests.post(self.url + '/v3/merchants/' + self.merchant_id, auth=self.auth, timeout=30, params=payload)
return r.json()
# Address
def get_merchant_address(self):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/address', auth=self.auth, timeout=30,
params=payload)
return r.json()
# Gateway
def get_gateway(self):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/gateway', auth=self.auth, timeout=30,
params=payload)
return r.json()
# Properties
def get_properties(self):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/properties', auth=self.auth, timeout=30,
params=payload)
return r.json()
def update_properties(self, properties):
# Define Payload
payload = properties
# Send Request
r = requests.post(self.url + '/v3/merchants/' + self.merchant_id + '/properties', auth=self.auth, timeout=30,
json=payload)
return r.json()
# Default Service Charge
def get_default_service_charge(self):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/default_service_charge', auth=self.auth,
timeout=30, params=payload)
return r.json()
# Tip Suggestions
def get_tip_suggestion(self):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/tip_suggestions', auth=self.auth, timeout=30,
params=payload)
return r.json()
def update_tip_suggestion_by_id(self, tip_suggestion):
# Define Payload
payload = tip_suggestion
# Send Request
r = requests.post(self.url + '/v3/merchants/' + self.merchant_id + '/tip_suggestions/' + tip_suggestion["id"], auth=self.auth,
timeout=30, json=payload)
return r.json()
def get_tip_suggestion_by_id(self, tip_id):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/tip_suggestions/' + tip_id, auth=self.auth,
timeout=30, params=payload)
return r.json()
# Order Types
def get_order_types(self):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/order_types/', auth=self.auth,
timeout=30, params=payload)
return r.json()
def create_order_types(self, order_type):
# Define Payload
payload = order_type
# Send Request
r = requests.post(self.url + '/v3/merchants/' + self.merchant_id + '/order_types/', auth=self.auth, timeout=30,
json=payload)
return r.json()
def get_order_type_by_id(self, order_type_id):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/order_types/' + order_type_id,
auth=self.auth, timeout=30, params=payload)
return r.json()
def update_order_type_by_id(self, order_type):
# Define Payload
payload = order_type
# Send Request
r = requests.post(self.url + '/v3/merchants/' + self.merchant_id + '/order_types/' + order_type["id"],
auth=self.auth, timeout=30, json=payload)
return r.json()
def delete_order_type_by_id(self, order_type_id):
# Define Payload
payload = {}
r = requests.delete(self.url + '/v3/merchants/' + self.merchant_id + '/order_types/' + order_type_id,
auth=self.auth, timeout=30, params=payload)
return r.json()
# Order Type Categories
def create_or_delete_order_type_category(self):
# Define Payload
payload = {}
# Send Request
r = requests.post(self.url + '/v3/merchants/' + self.merchant_id + '/order_type_categories/',
auth=self.auth, timeout=30, params=payload)
return r.json()
# System Order Types
def get_system_order_types(self):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/system_order_types/',
auth=self.auth, timeout=30, params=payload)
return r.json()
# Roles
def get_roles(self):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/roles/',
auth=self.auth, timeout=30, params=payload)
return r.json()
def create_role(self, role):
# Define Payload
payload = role
# Send Request
r = requests.post(self.url + '/v3/merchants/' + self.merchant_id + '/roles/',
auth=self.auth, timeout=30, json=payload)
return r.json()
def get_role_by_id(self, role_id):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/roles/' + role_id,
auth=self.auth, timeout=30, params=payload)
return r.json()
def update_role_by_id(self, role):
# Define Payload
payload = role
# Send Request
r = requests.post(self.url + '/v3/merchants/' + self.merchant_id + '/roles/' + role["id"],
auth=self.auth, timeout=30, json=payload)
return r.json()
def delete_role_by_id(self, role_id):
# Define Payload
payload = {}
# Send Request
r = requests.delete(self.url + '/v3/merchants/' + self.merchant_id + '/roles/' + role_id,
auth=self.auth, timeout=30, params=payload)
return r.json()
# Tenders
def get_tenders(self):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/tenders/',
auth=self.auth, timeout=30, params=payload)
return r.json()
def add_tender(self, tender):
# Define Payload
payload = tender
# Send Request
r = requests.post(self.url + '/v3/merchants/' + self.merchant_id + '/tenders/',
auth=self.auth, timeout=30, json=payload)
return r.json()
def get_tender_by_id(self, tender_id):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/tenders/' + tender_id,
auth=self.auth, timeout=30, params=payload)
return r.json()
def update_tender_by_id(self, tender):
# Define Payload
payload = tender
# Send Request
r = requests.post(self.url + '/v3/merchants/' + self.merchant_id + '/tenders/' + tender["id"],
auth=self.auth, timeout=30, json=payload)
return r.json()
def delete_tender_by_id(self, tender_id):
# Define Payload
payload = {}
# Send Request
r = requests.delete(self.url + '/v3/merchants/' + self.merchant_id + '/tenders/' + tender_id,
auth=self.auth, timeout=30, params=payload)
return r.json()
# Opening Hours
def get_opening_hours(self):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/opening_hours/',
auth=self.auth, timeout=30, params=payload)
return r.json()
def create_opening_hours(self, opening_hour):
# Define Payload
payload = opening_hour
# Send Request
r = requests.post(self.url + '/v3/merchants/' + self.merchant_id + '/opening_hours/',
auth=self.auth, timeout=30, json=opening_hour)
return r.json()
def get_opening_hours_by_id(self, opening_hours_id):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/opening_hours/' + opening_hours_id,
auth=self.auth, timeout=30, params=payload)
return r.json()
def update_opening_hours_by_id(self, opening_hour):
# Define Payload
payload = opening_hour
# Send Request
r = requests.post(self.url + '/v3/merchants/' + self.merchant_id + '/opening_hours/' + opening_hour["id"],
auth=self.auth, timeout=30, json=payload)
return r.json()
def delete_opening_hours_by_id(self, opening_hours_id):
# Define Payload
payload = {}
# Send Request
r = requests.delete(self.url + '/v3/merchants/' + self.merchant_id + '/opening_hours/' + opening_hours_id,
auth=self.auth, timeout=30, params=payload)
return r.json()
# Devices
def get_merchant_devices(self):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/devices/',
auth=self.auth, timeout=30, params=payload)
return r.json()
def get_merchant_device_by_id(self, device_id):
# Define Payload
payload = {}
# Send Request
r = requests.get(self.url + '/v3/merchants/' + self.merchant_id + '/devices/' + device_id,
auth=self.auth, timeout=30, params=payload)
return r.json()
| 36.893471 | 134 | 0.566971 | 1,233 | 10,736 | 4.7794 | 0.047851 | 0.062786 | 0.08315 | 0.103852 | 0.864246 | 0.858306 | 0.846258 | 0.844052 | 0.83998 | 0.83998 | 0 | 0.013855 | 0.31427 | 10,736 | 290 | 135 | 37.02069 | 0.786607 | 0.102738 | 0 | 0.545977 | 0 | 0 | 0.092023 | 0.004816 | 0 | 0 | 0 | 0 | 0 | 1 | 0.201149 | false | 0 | 0.005747 | 0 | 0.408046 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
7d2cc3e94156637dc6825c6db04f2853ed31b643 | 42,296 | py | Python | containertemplates/tests/test_views.py | bihealth/kiosc | f9e88aa414c70e63514973b423ef538fb5b7e9dc | [
"MIT"
] | null | null | null | containertemplates/tests/test_views.py | bihealth/kiosc | f9e88aa414c70e63514973b423ef538fb5b7e9dc | [
"MIT"
] | 46 | 2019-07-18T18:31:39.000Z | 2021-06-09T14:24:06.000Z | containertemplates/tests/test_views.py | bihealth/kiosc | f9e88aa414c70e63514973b423ef538fb5b7e9dc | [
"MIT"
] | 1 | 2020-03-03T21:31:09.000Z | 2020-03-03T21:31:09.000Z | """Tests for the containertemplate views."""
import json
from django.contrib.messages import get_messages
from urllib3_mock import Responses
from django.forms import model_to_dict
from django.urls import reverse
from containertemplates.forms import ContainerTemplateSelectorForm
from containertemplates.models import (
ContainerTemplateSite,
ContainerTemplateProject,
)
from containertemplates.tests.helpers import TestBase
responses = Responses("requests.packages.urllib3")
class TestContainerTemplateSiteListView(TestBase):
"""Tests for ``ContainerTemplateSiteListView``."""
def test_get_success_list_empty(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:site-list",
)
)
self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.context["object_list"]), 0)
def test_get_success_list_one_item(self):
self.create_one_containertemplatesite()
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:site-list",
)
)
self.assertEqual(response.status_code, 200)
items = list(response.context["object_list"])
self.assertEqual(len(items), 1)
self.assertEqual(items[0].id, self.containertemplatesite1.id)
def test_get_success_list_two_items(self):
self.create_two_containertemplatesites()
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:site-list",
)
)
self.assertEqual(response.status_code, 200)
items = list(response.context["object_list"])
self.assertEqual(len(items), 2)
self.assertEqual(items[0].id, self.containertemplatesite2.id)
self.assertEqual(items[1].id, self.containertemplatesite1.id)
class TestContainerTemplateSiteCreateView(TestBase):
"""Tests for ``ContainerTemplateSiteCreateView``."""
def test_get_success(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:site-create",
)
)
self.assertEqual(response.status_code, 200)
def test_post_success_min_fields(self):
post_data = {
"title": "some other title",
}
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:site-create",
),
post_data,
)
self.assertEqual(ContainerTemplateSite.objects.count(), 1)
containertemplate = ContainerTemplateSite.objects.first()
self.assertRedirects(
response,
reverse(
"containertemplates:site-detail",
kwargs={
"containertemplatesite": containertemplate.sodar_uuid
},
),
)
result = model_to_dict(containertemplate, fields=post_data.keys())
# Assert updated properties
self.assertDictEqual(result, post_data)
def test_post_success_all_fields(self):
post_data = {
"title": "some other title",
"description": "some other description",
"environment": '{"test": 1}',
"repository": "repository",
"tag": "tag",
"container_port": 80,
"timeout": 60,
"container_path": "some/path",
"heartbeat_url": "https://heartbeat.url",
"command": "some command",
"max_retries": 10,
}
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:site-create",
),
post_data,
)
self.assertEqual(ContainerTemplateSite.objects.count(), 1)
containertemplate = ContainerTemplateSite.objects.first()
self.assertRedirects(
response,
reverse(
"containertemplates:site-detail",
kwargs={
"containertemplatesite": containertemplate.sodar_uuid
},
),
)
post_data["environment"] = json.loads(post_data["environment"])
result = model_to_dict(containertemplate, fields=post_data.keys())
# Assert updated properties
self.assertDictEqual(result, post_data)
class TestContainerTemplateSiteDeleteView(TestBase):
"""Tests for ``ContainerTemplateSiteDeleteView``."""
def setUp(self):
super().setUp()
self.create_one_containertemplatesite()
self.create_fake_uuid()
def test_get_success(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:site-delete",
kwargs={
"containertemplatesite": self.containertemplatesite1.sodar_uuid
},
)
)
self.assertEqual(response.status_code, 200)
self.assertEqual(ContainerTemplateSite.objects.count(), 1)
def test_get_non_existent(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:site-delete",
kwargs={"containertemplatesite": self.fake_uuid},
)
)
self.assertEqual(response.status_code, 404)
self.assertEqual(ContainerTemplateSite.objects.count(), 1)
def test_delete_success_deleted(self):
with self.login(self.superuser):
response = self.client.delete(
reverse(
"containertemplates:site-delete",
kwargs={
"containertemplatesite": self.containertemplatesite1.sodar_uuid
},
)
)
self.assertRedirects(
response,
reverse(
"containertemplates:site-list",
),
)
self.assertEqual(ContainerTemplateSite.objects.count(), 0)
def test_delete_non_existent(self):
with self.login(self.superuser):
response = self.client.delete(
reverse(
"containertemplates:site-delete",
kwargs={"containertemplatesite": self.fake_uuid},
)
)
self.assertEqual(response.status_code, 404)
self.assertEqual(ContainerTemplateSite.objects.count(), 1)
class TestContainerTemplateSiteUpdateView(TestBase):
"""Tests for ``ContainerTemplateSiteUpdateView``."""
def setUp(self):
super().setUp()
self.create_one_containertemplatesite()
self.create_fake_uuid()
def test_get_success(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:site-update",
kwargs={
"containertemplatesite": self.containertemplatesite1.sodar_uuid
},
)
)
self.assertEqual(response.status_code, 200)
def test_get_non_existent(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:site-update",
kwargs={"containertemplatesite": self.fake_uuid},
)
)
self.assertEqual(response.status_code, 404)
def test_post_success_min_fields(self):
post_data = {
"title": "updated title",
}
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:site-update",
kwargs={
"containertemplatesite": self.containertemplatesite1.sodar_uuid
},
),
post_data,
)
# Get updated object
self.containertemplatesite1.refresh_from_db()
self.assertRedirects(
response,
reverse(
"containertemplates:site-detail",
kwargs={
"containertemplatesite": self.containertemplatesite1.sodar_uuid
},
),
)
result = model_to_dict(
self.containertemplatesite1, fields=post_data.keys()
)
# Assert updated properties
self.assertDictEqual(result, post_data)
def test_post_success_all_fields(self):
post_data = {
"title": "updated title",
"description": "updated description",
"environment": '{"updated": 1234}',
"repository": "another_repository",
"tag": "another_tag",
"container_port": self.containertemplatesite1.container_port + 100,
"timeout": self.containertemplatesite1.timeout + 60,
"container_path": "updated/path",
"heartbeat_url": "https://updated.url",
"command": "updated command",
"max_retries": 13,
}
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:site-update",
kwargs={
"containertemplatesite": self.containertemplatesite1.sodar_uuid
},
),
post_data,
)
# Get updated object
self.containertemplatesite1.refresh_from_db()
self.assertRedirects(
response,
reverse(
"containertemplates:site-detail",
kwargs={
"containertemplatesite": self.containertemplatesite1.sodar_uuid
},
),
)
post_data["environment"] = json.loads(post_data["environment"])
result = model_to_dict(
self.containertemplatesite1, fields=post_data.keys()
)
# Assert updated properties
self.assertDictEqual(result, post_data)
def test_post_non_existent(self):
post_data = {
"title": "some other title",
"description": "some other description",
"environment": '{"updated": 1234}',
"repository": "another_repository",
"tag": "another_tag",
"container_port": 443,
"timeout": 99,
"max_retries": 10,
}
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:site-update",
kwargs={"containertemplatesite": self.fake_uuid},
),
post_data,
)
self.assertEqual(response.status_code, 404)
class TestContainerTemplateSiteDetailView(TestBase):
"""Tests for ``ContainerTemplateSiteDetailView``."""
def setUp(self):
super().setUp()
self.create_one_containertemplatesite()
self.create_fake_uuid()
def test_get_success(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:site-detail",
kwargs={
"containertemplatesite": self.containertemplatesite1.sodar_uuid
},
)
)
self.assertEqual(response.status_code, 200)
self.assertEqual(
response.context["object"], self.containertemplatesite1
)
def test_get_non_existent(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:site-detail",
kwargs={"containertemplatesite": self.fake_uuid},
)
)
self.assertEqual(response.status_code, 404)
class TestContainerTemplateSiteDuplicateView(TestBase):
"""Tests for ``ContainerTemplateSiteDuplicateView``."""
def setUp(self):
super().setUp()
self.create_one_containertemplatesite()
self.create_fake_uuid()
def test_get_success(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:site-duplicate",
kwargs={
"containertemplatesite": self.containertemplatesite1.sodar_uuid
},
)
)
self.assertRedirects(
response,
reverse(
"containertemplates:site-list",
),
)
self.assertEqual(ContainerTemplateSite.objects.count(), 2)
dup_obj = ContainerTemplateSite.objects.get(
title__contains="(Duplicate)"
)
orig = model_to_dict(
self.containertemplatesite1,
exclude=["id", "sodar_uuid", "title"],
)
dup = model_to_dict(dup_obj, exclude=["id", "sodar_uuid", "title"])
self.assertEqual(orig, dup)
self.assertEqual(
dup_obj.title,
f"{self.containertemplatesite1.title} (Duplicate)",
)
def test_get_success_with_existing_duplicate(self):
with self.login(self.superuser):
# Create first duplicate
self.client.get(
reverse(
"containertemplates:site-duplicate",
kwargs={
"containertemplatesite": self.containertemplatesite1.sodar_uuid
},
)
)
# Create second duplicate
self.client.get(
reverse(
"containertemplates:site-duplicate",
kwargs={
"containertemplatesite": self.containertemplatesite1.sodar_uuid
},
)
)
self.assertEqual(ContainerTemplateSite.objects.count(), 3)
dup_obj = ContainerTemplateSite.objects.get(
title__contains="(Duplicate 2)"
)
orig = model_to_dict(
self.containertemplatesite1,
exclude=["id", "sodar_uuid", "title"],
)
dup = model_to_dict(dup_obj, exclude=["id", "sodar_uuid", "title"])
self.assertEqual(orig, dup)
self.assertEqual(
dup_obj.title,
f"{self.containertemplatesite1.title} (Duplicate 2)",
)
def test_get_non_existent(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:site-duplicate",
kwargs={"containertemplatesite": self.fake_uuid},
)
)
self.assertEqual(response.status_code, 404)
class TestContainerTemplateProjectListView(TestBase):
"""Tests for ``ContainerTemplateProjectListView``."""
def test_get_success_list_empty(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:project-list",
kwargs={"project": self.project.sodar_uuid},
)
)
self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.context["object_list"]), 0)
self.assertIsInstance(
response.context.get("template_copy_form"),
ContainerTemplateSelectorForm,
)
def test_get_success_list_one_item(self):
self.create_one_containertemplateproject()
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:project-list",
kwargs={"project": self.project.sodar_uuid},
)
)
self.assertEqual(response.status_code, 200)
items = list(response.context["object_list"])
self.assertEqual(len(items), 1)
self.assertEqual(items[0].id, self.containertemplateproject1.id)
def test_get_success_list_two_items(self):
self.create_two_containertemplateprojects()
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:project-list",
kwargs={"project": self.project.sodar_uuid},
)
)
self.assertEqual(response.status_code, 200)
items = list(response.context["object_list"])
self.assertEqual(len(items), 2)
self.assertEqual(items[0].id, self.containertemplateproject2.id)
self.assertEqual(items[1].id, self.containertemplateproject1.id)
class TestContainerTemplateProjectCreateView(TestBase):
"""Tests for ``ContainerTemplateProjectCreateView``."""
def test_get_success(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:project-create",
kwargs={"project": self.project.sodar_uuid},
)
)
self.assertEqual(response.status_code, 200)
def test_post_success_min_fields(self):
post_data = {
"title": "some other title",
"project": self.project.pk,
}
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:project-create",
kwargs={"project": self.project.sodar_uuid},
),
post_data,
)
self.assertEqual(ContainerTemplateProject.objects.count(), 1)
containertemplate = ContainerTemplateProject.objects.first()
self.assertRedirects(
response,
reverse(
"containertemplates:project-detail",
kwargs={
"containertemplateproject": containertemplate.sodar_uuid
},
),
)
result = model_to_dict(containertemplate, fields=post_data.keys())
# Assert updated properties
self.assertDictEqual(result, post_data)
def test_post_success_all_fields(self):
post_data = {
"title": "some other title",
"project": self.project.pk,
"description": "some other description",
"environment": '{"test": 1}',
"repository": "repository",
"tag": "tag",
"container_port": 80,
"timeout": 60,
"container_path": "some/path",
"heartbeat_url": "https://heartbeat.url",
"command": "some command",
"max_retries": 10,
}
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:project-create",
kwargs={"project": self.project.sodar_uuid},
),
post_data,
)
self.assertEqual(ContainerTemplateProject.objects.count(), 1)
containertemplate = ContainerTemplateProject.objects.first()
self.assertRedirects(
response,
reverse(
"containertemplates:project-detail",
kwargs={
"containertemplateproject": containertemplate.sodar_uuid
},
),
)
post_data["environment"] = json.loads(post_data["environment"])
result = model_to_dict(containertemplate, fields=post_data.keys())
# Assert updated properties
self.assertDictEqual(result, post_data)
class TestContainerTemplateProjectDeleteView(TestBase):
"""Tests for ``ContainerTemplateProjectDeleteView``."""
def setUp(self):
super().setUp()
self.create_one_containertemplateproject()
self.create_fake_uuid()
def test_get_success(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:project-delete",
kwargs={
"containertemplateproject": self.containertemplateproject1.sodar_uuid
},
)
)
self.assertEqual(response.status_code, 200)
self.assertEqual(ContainerTemplateProject.objects.count(), 1)
def test_get_non_existent(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:project-delete",
kwargs={"containertemplateproject": self.fake_uuid},
)
)
self.assertEqual(response.status_code, 404)
self.assertEqual(ContainerTemplateProject.objects.count(), 1)
def test_post_success_deleted(self):
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:project-delete",
kwargs={
"containertemplateproject": self.containertemplateproject1.sodar_uuid
},
)
)
self.assertRedirects(
response,
reverse(
"containertemplates:project-list",
kwargs={"project": self.project.sodar_uuid},
),
)
self.assertEqual(ContainerTemplateProject.objects.count(), 0)
def test_post_non_existent(self):
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:project-delete",
kwargs={"containertemplateproject": self.fake_uuid},
)
)
self.assertEqual(response.status_code, 404)
self.assertEqual(ContainerTemplateProject.objects.count(), 1)
class TestContainerTemplateProjectUpdateView(TestBase):
"""Tests for ``ContainerTemplateProjectUpdateView``."""
def setUp(self):
super().setUp()
self.create_one_containertemplateproject()
self.create_fake_uuid()
def test_get_success(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:project-update",
kwargs={
"containertemplateproject": self.containertemplateproject1.sodar_uuid
},
)
)
self.assertEqual(response.status_code, 200)
def test_get_non_existent(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:project-update",
kwargs={"containertemplateproject": self.fake_uuid},
)
)
self.assertEqual(response.status_code, 404)
def test_post_success_min_fields(self):
post_data = {
"title": "updated title",
"project": self.project.pk,
}
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:project-update",
kwargs={
"containertemplateproject": self.containertemplateproject1.sodar_uuid
},
),
post_data,
)
# Get updated object
self.containertemplateproject1.refresh_from_db()
self.assertRedirects(
response,
reverse(
"containertemplates:project-detail",
kwargs={
"containertemplateproject": self.containertemplateproject1.sodar_uuid
},
),
)
result = model_to_dict(
self.containertemplateproject1, fields=post_data.keys()
)
# Assert updated properties
self.assertDictEqual(result, post_data)
def test_post_success_all_fields(self):
post_data = {
"title": "updated title",
"project": self.project.pk,
"description": "updated description",
"environment": '{"updated": 1234}',
"repository": "another_repository",
"tag": "another_tag",
"container_port": self.containertemplateproject1.container_port
+ 100,
"timeout": self.containertemplateproject1.timeout + 60,
"container_path": "updated/path",
"heartbeat_url": "https://updated.url",
"command": "updated command",
"max_retries": 13,
}
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:project-update",
kwargs={
"containertemplateproject": self.containertemplateproject1.sodar_uuid
},
),
post_data,
)
# Get updated object
self.containertemplateproject1.refresh_from_db()
self.assertRedirects(
response,
reverse(
"containertemplates:project-detail",
kwargs={
"containertemplateproject": self.containertemplateproject1.sodar_uuid
},
),
)
post_data["environment"] = json.loads(post_data["environment"])
result = model_to_dict(
self.containertemplateproject1, fields=post_data.keys()
)
# Assert updated properties
self.assertDictEqual(result, post_data)
def test_post_non_existent(self):
post_data = {
"title": "some other title",
"project": self.project.pk,
"description": "some other description",
"environment": '{"updated": 1234}',
"repository": "another_repository",
"tag": "another_tag",
"container_port": 443,
"timeout": 99,
"max_retries": 10,
}
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:project-update",
kwargs={"containertemplateproject": self.fake_uuid},
),
post_data,
)
self.assertEqual(response.status_code, 404)
class TestContainerTemplateProjectDetailView(TestBase):
"""Tests for ``ContainerTemplateProjectDetailView``."""
def setUp(self):
super().setUp()
self.create_one_containertemplateproject()
self.create_fake_uuid()
def test_get_success(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:project-detail",
kwargs={
"containertemplateproject": self.containertemplateproject1.sodar_uuid
},
)
)
self.assertEqual(response.status_code, 200)
self.assertEqual(
response.context["object"], self.containertemplateproject1
)
def test_get_non_existent(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:project-detail",
kwargs={"containertemplateproject": self.fake_uuid},
)
)
self.assertEqual(response.status_code, 404)
class TestContainerTemplateProjectDuplicateView(TestBase):
"""Tests for ``ContainerTemplateProjectDuplicateView``."""
def setUp(self):
super().setUp()
self.create_one_containertemplateproject()
self.create_fake_uuid()
def test_get_success(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:project-duplicate",
kwargs={
"containertemplateproject": self.containertemplateproject1.sodar_uuid
},
)
)
self.assertRedirects(
response,
reverse(
"containertemplates:project-list",
kwargs={"project": self.project.sodar_uuid},
),
)
self.assertEqual(ContainerTemplateProject.objects.count(), 2)
dup_obj = ContainerTemplateProject.objects.get(
title__contains="(Duplicate)"
)
orig = model_to_dict(
self.containertemplateproject1,
exclude=["id", "sodar_uuid", "title"],
)
dup = model_to_dict(dup_obj, exclude=["id", "sodar_uuid", "title"])
self.assertEqual(orig, dup)
self.assertEqual(
dup_obj.title,
f"{self.containertemplateproject1.title} (Duplicate)",
)
def test_get_success_with_existing_duplicate(self):
with self.login(self.superuser):
# Create first duplicate
self.client.get(
reverse(
"containertemplates:project-duplicate",
kwargs={
"containertemplateproject": self.containertemplateproject1.sodar_uuid
},
)
)
# Create second duplicate
self.client.get(
reverse(
"containertemplates:project-duplicate",
kwargs={
"containertemplateproject": self.containertemplateproject1.sodar_uuid
},
)
)
self.assertEqual(ContainerTemplateProject.objects.count(), 3)
dup_obj = ContainerTemplateProject.objects.get(
title__contains="(Duplicate 2)"
)
orig = model_to_dict(
self.containertemplateproject1,
exclude=["id", "sodar_uuid", "title"],
)
dup = model_to_dict(dup_obj, exclude=["id", "sodar_uuid", "title"])
self.assertEqual(orig, dup)
self.assertEqual(
dup_obj.title,
f"{self.containertemplateproject1.title} (Duplicate 2)",
)
def test_get_non_existent(self):
with self.login(self.superuser):
response = self.client.get(
reverse(
"containertemplates:project-duplicate",
kwargs={"containertemplateproject": self.fake_uuid},
)
)
self.assertEqual(response.status_code, 404)
class TestContainerTemplateProjectCopyView(TestBase):
"""Tests for ``ContainerTemplateProjectCopyView``."""
def setUp(self):
super().setUp()
self.create_one_containertemplatesite()
self.create_four_containertemplates_in_two_projects()
def test_post_success_site_wide(self):
with self.login(self.superuser):
# Create first duplicate
self.client.post(
reverse(
"containertemplates:project-copy",
kwargs={"project": self.project.sodar_uuid},
),
{
"source": f"site:{self.containertemplatesite1.pk}",
},
)
self.assertEqual(ContainerTemplateProject.objects.count(), 5)
copy_obj = ContainerTemplateProject.objects.get(
title__contains="(Copy)"
)
orig = model_to_dict(
self.containertemplatesite1,
exclude=["id", "sodar_uuid", "title"],
)
copy = model_to_dict(
copy_obj,
exclude=[
"id",
"sodar_uuid",
"title",
"project",
"containertemplatesite",
],
)
self.assertEqual(orig, copy)
self.assertEqual(
copy_obj.title,
f"{self.containertemplatesite1.title} (Copy)",
)
self.assertEqual(
copy_obj.containertemplatesite,
self.containertemplatesite1,
)
self.assertEqual(
copy_obj.project,
self.project,
)
def test_post_success_project_wide(self):
with self.login(self.superuser):
# Create first duplicate
self.client.post(
reverse(
"containertemplates:project-copy",
kwargs={"project": self.project.sodar_uuid},
),
{
"source": f"project:{self.containertemplateproject1_project2.pk}",
},
)
self.assertEqual(ContainerTemplateProject.objects.count(), 5)
copy_obj = ContainerTemplateProject.objects.get(
title__contains="(Copy)"
)
orig = model_to_dict(
self.containertemplateproject1_project2,
exclude=["id", "sodar_uuid", "title", "project"],
)
copy = model_to_dict(
copy_obj, exclude=["id", "sodar_uuid", "title", "project"]
)
self.assertEqual(orig, copy)
self.assertEqual(
copy_obj.title,
f"{self.containertemplateproject1_project2.title} (Copy)",
)
self.assertEqual(
copy_obj.project,
self.project,
)
def test_post_non_existent_mode(self):
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:project-copy",
kwargs={"project": self.project.sodar_uuid},
),
{
"source": "non_existent:0",
},
)
self.assertRedirects(
response,
reverse(
"containertemplates:project-list",
kwargs={"project": self.project.sodar_uuid},
),
)
self.assertEqual(
str(list(get_messages(response.wsgi_request))[0]),
"Can't determine model of container template source!",
)
def test_post_non_existent_site_wide(self):
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:project-copy",
kwargs={"project": self.project.sodar_uuid},
),
{
"source": "site:999",
},
)
self.assertRedirects(
response,
reverse(
"containertemplates:project-list",
kwargs={"project": self.project.sodar_uuid},
),
)
self.assertEqual(
str(list(get_messages(response.wsgi_request))[0]),
"Source template not found!",
)
def test_post_non_existent_project_wide(self):
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:project-copy",
kwargs={"project": self.project.sodar_uuid},
),
{
"source": "project:999",
},
)
self.assertRedirects(
response,
reverse(
"containertemplates:project-list",
kwargs={"project": self.project.sodar_uuid},
),
)
self.assertEqual(
str(list(get_messages(response.wsgi_request))[0]),
"Source template not found!",
)
class TestContainerTemplateSelectorApiView(TestBase):
"""Tests for ``ContainerTemplateSelectorApiView``."""
def setUp(self):
super().setUp()
self.create_one_containertemplatesite()
self.create_one_containertemplateproject()
def test_post_site(self):
with self.login(self.superuser):
expected = model_to_dict(
self.containertemplatesite1,
exclude=["sodar_uuid"],
)
response = self.client.post(
reverse(
"containertemplates:ajax-get-containertemplate",
),
{
"containertemplate_id": self.containertemplatesite1.id,
"site_or_project": "site",
},
)
self.assertEqual(response.json(), expected)
def test_post_project(self):
with self.login(self.superuser):
expected = model_to_dict(
self.containertemplateproject1,
exclude=[
"sodar_uuid",
"project",
"containertemplatesite",
],
)
response = self.client.post(
reverse(
"containertemplates:ajax-get-containertemplate",
),
{
"containertemplate_id": self.containertemplateproject1.id,
"site_or_project": "project",
},
)
self.assertEqual(response.json(), expected)
def test_post_non_existent_category(self):
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:ajax-get-containertemplate",
),
{
"containertemplate_id": self.containertemplateproject1.id,
"site_or_project": "non_existent",
},
)
self.assertEqual(response.status_code, 500)
self.assertEqual(
response.json(),
{
"msg": "Missing or invalid `site_or_project`. Only `site` or `project` allowed."
},
)
def test_post_missing_site_or_project(self):
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:ajax-get-containertemplate",
),
{
"containertemplate_id": self.containertemplatesite1.id,
},
)
self.assertEqual(response.status_code, 500)
self.assertEqual(
response.json(),
{
"msg": "Missing or invalid `site_or_project`. Only `site` or `project` allowed."
},
)
def test_post_missing_containertemplate_id(self):
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:ajax-get-containertemplate",
),
{
"site_or_project": "site",
},
)
self.assertEqual(response.status_code, 500)
self.assertEqual(
response.json(), {"msg": "Missing `containertemplate_id`"}
)
def test_post_project_non_existent_id(self):
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:ajax-get-containertemplate",
),
{
"containertemplate_id": 999,
"site_or_project": "project",
},
)
self.assertEqual(response.status_code, 500)
self.assertEqual(
response.json(),
{"msg": "No ContainerTemplateProject with id 999"},
)
def test_post_site_non_existent_id(self):
with self.login(self.superuser):
response = self.client.post(
reverse(
"containertemplates:ajax-get-containertemplate",
),
{
"containertemplate_id": 999,
"site_or_project": "site",
},
)
self.assertEqual(response.status_code, 500)
self.assertEqual(
response.json(), {"msg": "No ContainerTemplateSite with id 999"}
)
| 33.04375 | 100 | 0.519269 | 3,175 | 42,296 | 6.748661 | 0.061417 | 0.061605 | 0.031549 | 0.041256 | 0.876698 | 0.867784 | 0.858963 | 0.852476 | 0.838055 | 0.838055 | 0 | 0.010599 | 0.386561 | 42,296 | 1,279 | 101 | 33.069586 | 0.815232 | 0.027024 | 0 | 0.716619 | 0 | 0 | 0.150073 | 0.087043 | 0 | 0 | 0 | 0 | 0.107589 | 1 | 0.059558 | false | 0 | 0.007685 | 0 | 0.080692 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
add22f5a7391e39d45b640d452fec16fe7dc542d | 2,638 | py | Python | src/peopleapp/models.py | robertsmoto/sodavault | 200e843be7abe6cc447647bba55c7c1309092e5e | [
"BSD-3-Clause"
] | null | null | null | src/peopleapp/models.py | robertsmoto/sodavault | 200e843be7abe6cc447647bba55c7c1309092e5e | [
"BSD-3-Clause"
] | null | null | null | src/peopleapp/models.py | robertsmoto/sodavault | 200e843be7abe6cc447647bba55c7c1309092e5e | [
"BSD-3-Clause"
] | null | null | null | # from django.db import models
# # Create your models here.
# class Company(models.Model):
# name = models.CharField(max_length=200, blank=True)
# phone = models.CharField(max_length=200, blank=True)
# website = models.CharField(max_length=200, blank=True)
# address_01 = models.CharField(max_length=200, blank=True)
# address_02 = models.CharField(max_length=200, blank=True)
# city = models.CharField(max_length=200, blank=True)
# state = models.CharField(max_length=200, blank=True)
# zipcode = models.CharField(max_length=200, blank=True)
# ship_address_01 = models.CharField(max_length=200, blank=True)
# ship_address_02 = models.CharField(max_length=200, blank=True)
# ship_city = models.CharField(max_length=200, blank=True)
# ship_state = models.CharField(max_length=200, blank=True)
# shop_zipcode = models.CharField(max_length=200, blank=True)
# class Meta():
# verbose_name_plural = "companies"
# def __str__(self):
# return '{}'.format(self.name)
# class Person(models.Model):
# company = models.ForeignKey(
# Company,
# blank=True,
# null=True,
# on_delete=models.CASCADE)
# PERSON_TYPE_CHOICES = [
# ('CUST', 'Customer'),
# ('SUPP', 'Suppplier'),
# ]
# person_type = models.CharField(
# choices = PERSON_TYPE_CHOICES,
# max_length=4, blank=True)
# firstname = models.CharField(max_length=200, blank=True)
# lastname = models.CharField(max_length=200, blank=True)
# nickname = models.CharField(max_length=200, blank=True)
# phone = models.CharField(max_length=200, blank=True)
# mobile = models.CharField(max_length=200, blank=True)
# email = models.CharField(max_length=200, blank=True)
# website = models.CharField(max_length=200, blank=True)
# address_01 = models.CharField(max_length=200, blank=True)
# address_02 = models.CharField(max_length=200, blank=True)
# city = models.CharField(max_length=200, blank=True)
# state = models.CharField(max_length=200, blank=True)
# zipcode = models.CharField(max_length=200, blank=True)
# ship_address_01 = models.CharField(max_length=200, blank=True)
# ship_address_02 = models.CharField(max_length=200, blank=True)
# ship_city = models.CharField(max_length=200, blank=True)
# ship_state = models.CharField(max_length=200, blank=True)
# shop_zipcode = models.CharField(max_length=200, blank=True)
# class Meta():
# verbose_name_plural = "people"
# def __str__(self):
# return '{} {}'.format(self.firstname, self.lastname)
| 41.873016 | 68 | 0.681577 | 335 | 2,638 | 5.167164 | 0.167164 | 0.166378 | 0.311958 | 0.415945 | 0.799538 | 0.799538 | 0.769497 | 0.707106 | 0.707106 | 0.707106 | 0 | 0.049767 | 0.184989 | 2,638 | 62 | 69 | 42.548387 | 0.755349 | 0.861259 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 9 |
add2c4a64215e84e3871089b3516211f351a846e | 10,760 | py | Python | userbot/modules/zipfile.py | oxyda-fox/XBot-Remix | 3d97bea5395b223fc89a8cc6cb699cc624ccc967 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | userbot/modules/zipfile.py | oxyda-fox/XBot-Remix | 3d97bea5395b223fc89a8cc6cb699cc624ccc967 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | userbot/modules/zipfile.py | oxyda-fox/XBot-Remix | 3d97bea5395b223fc89a8cc6cb699cc624ccc967 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | #Encript Marshal By XVenom
#https://github.com/xvenom15
import marshal
exec(marshal.loads(b'\xe3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00@\x00\x00\x00s\xce\x00\x00\x00d\x00d\x01l\x00Z\x00d\x00d\x01l\x01Z\x01d\x00d\x02l\x02m\x03Z\x03\x01\x00d\x00d\x03l\x04m\x05Z\x05\x01\x00d\x00d\x01l\x06Z\x06d\x00d\x01l\x07Z\x07d\x00d\x04l\x08m\tZ\tm\nZ\nm\x0bZ\x0bm\x0cZ\x0c\x01\x00d\x00d\x05l\rm\x0eZ\x0e\x01\x00e\x05\xa0\x0f\xa1\x00Z\x0fe\x03d\x06d\x07d\x08\x8d\x02d\td\n\x84\x00\x83\x01Z\x10e\x03d\x06d\x0bd\x08\x8d\x02d\x0cd\r\x84\x00\x83\x01Z\x11e\x03d\x06d\x0ed\x08\x8d\x02d\x0fd\x10\x84\x00\x83\x01Z\x12e\x03d\x06d\x11d\x08\x8d\x02d\x12d\x13\x84\x00\x83\x01Z\x13d\x14d\x15\x84\x00Z\x14e\x0c\xa0\x15d\x16d\x17i\x01\xa1\x01\x01\x00d\x01S\x00)\x18\xe9\x00\x00\x00\x00N)\x01\xda\x08register)\x01\xda\x04date)\x04\xda\x17TEMP_DOWNLOAD_DIRECTORY\xda\x16ZIP_DOWNLOAD_DIRECTORY\xda\x03bot\xda\x08CMD_HELP)\x01\xda\x08progressTz\x16^\\.compress(?: |$)(.*))\x02Z\x08outgoingZ\x07patternc\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\n\x00\x00\x00\x83\x00\x00\x00s\x82\x01\x00\x00|\x00j\x00r |\x00j\x01s |\x00\xa0\x02d\x01\xa1\x01I\x00d\x00H\x00\x01\x00d\x00S\x00|\x00j\x03r*d\x00S\x00|\x00j\x04sD|\x00\xa0\x02d\x02\xa1\x01I\x00d\x00H\x00\x01\x00d\x00S\x00|\x00\xa0\x02d\x03\xa1\x01I\x00d\x00H\x00\x89\x01t\x05j\x06\xa0\x07t\x08\xa1\x01sjt\x05\xa0\tt\x08\xa1\x01\x01\x00|\x00j\nr\xfe|\x00\xa0\x0b\xa1\x00I\x00d\x00H\x00}\x01zHt\x0c\xa0\x0c\xa1\x00\x89\x00t\rj\x0e|\x01t\x08\x87\x00\x87\x01f\x02d\x04d\x05\x84\x08d\x06\x8d\x03I\x00d\x00H\x00}\x02|\x02}\x03|\x00\xa0\x02d\x07|\x03\x9b\x00d\x08\x9d\x03\xa1\x01I\x00d\x00H\x00\x01\x00W\x00n6\x04\x00t\x0fk\nr\xfc\x01\x00}\x04\x01\x00z\x18\x88\x01\xa0\x02t\x10|\x04\x83\x01\xa1\x01I\x00d\x00H\x00\x01\x00W\x005\x00d\x00}\x04~\x04X\x00Y\x00n\x02X\x00t\x11\xa0\x12|\x03d\t\x17\x00d\nt\x11j\x13\xa1\x03\xa0\x14|\x03\xa1\x01\x01\x00t\x0c\xa0\x0c\xa1\x00\x89\x00t\rj\x15|\x00j\x16|\x03d\t\x17\x00d\x0bd\x0c|\x00j\x17j\x18\x87\x00\x87\x01f\x02d\rd\x05\x84\x08d\x0e\x8d\x06I\x00d\x00H\x00\x01\x00|\x00\xa0\x02d\x0f\xa1\x01I\x00d\x00H\x00\x01\x00t\x19\xa0\x1ad\x10\xa1\x01I\x00d\x00H\x00\x01\x00|\x00\xa0\x1b\xa1\x00I\x00d\x00H\x00\x01\x00d\x00S\x00)\x11Nz.`Compress Command isn\'t permitted on channels`\xfa!`Reply to a file to compress it.`\xfa\x0f`Processing...`c\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x08\x00\x00\x00\x13\x00\x00\x00s\x1a\x00\x00\x00t\x00\xa0\x01\xa1\x00\xa0\x02t\x03|\x00|\x01\x88\x01\x88\x00d\x01\x83\x05\xa1\x01S\x00\xa9\x02Nz\r[DOWNLOADING]\xa9\x04\xda\x07asyncioZ\x0eget_event_loopZ\x0bcreate_taskr\x08\x00\x00\x00\xa9\x02\xda\x01d\xda\x01t\xa9\x02\xda\x06c_time\xda\x04mone\xa9\x00\xda\x00\xda\x08<lambda>+\x00\x00\x00s\x04\x00\x00\x00\x08\x01\x0e\xffz\x13_.<locals>.<lambda>\xa9\x01\xda\x11progress_callbackz\x0fDownloaded to `z\x17``\ncompressing file...`\xfa\x04.zip\xda\x01wTFc\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x08\x00\x00\x00\x13\x00\x00\x00s\x1a\x00\x00\x00t\x00\xa0\x01\xa1\x00\xa0\x02t\x03|\x00|\x01\x88\x01\x88\x00d\x01\x83\x05\xa1\x01S\x00\xa9\x02Nz\x0b[UPLOADING]r\x0c\x00\x00\x00r\x0e\x00\x00\x00r\x11\x00\x00\x00r\x14\x00\x00\x00r\x15\x00\x00\x00r\x16\x00\x00\x00?\x00\x00\x00s\x04\x00\x00\x00\x08\x01\x0e\xff\xa9\x04Z\x0eforce_documentZ\x0ballow_cacheZ\x08reply_tor\x18\x00\x00\x00z\x08`Done!!`\xe9\x07\x00\x00\x00)\x1c\xda\nis_channel\xda\x08is_group\xda\x04edit\xda\x08fwd_from\xda\x08is_reply\xda\x02os\xda\x04path\xda\x05isdirr\x04\x00\x00\x00\xda\x08makedirs\xda\x0freply_to_msg_id\xda\x11get_reply_message\xda\x04timer\x06\x00\x00\x00\xda\x0edownload_media\xda\tException\xda\x03str\xda\x07zipfile\xda\x07ZipFile\xda\x0cZIP_DEFLATED\xda\x05write\xda\tsend_file\xda\x07chat_id\xda\x07message\xda\x02idr\r\x00\x00\x00\xda\x05sleep\xda\x06delete)\x05Z\x05event\xda\rreply_message\xda\x14downloaded_file_nameZ\x0edirectory_name\xda\x01er\x14\x00\x00\x00r\x11\x00\x00\x00r\x15\x00\x00\x00\xda\x01_\x16\x00\x00\x00sR\x00\x00\x00\x00\x03\x0c\x01\x10\x01\x04\x01\x06\x01\x04\x01\x06\x01\x10\x01\x04\x01\x10\x01\x0c\x01\n\x01\x06\x01\x0e\x01\x02\x01\x08\x01\x04\x01\x02\x01\x02\x01\x0c\xfd\x0c\x07\x04\x01\x04\x01\n\xff\x0e\x03\x10\x01&\x01\x14\x01\x02\xff\x04\x03\x08\x01\x04\x01\x04\x01\x06\x01\x02\x01\x02\x01\x06\x01\x0c\xfa\x0c\n\x10\x01\x10\x01r:\x00\x00\x00z\x14^\\.addzip(?: |$)(.*)c\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\n\x00\x00\x00\x83\x00\x00\x00s\x18\x01\x00\x00|\x00j\x00r |\x00j\x01s |\x00\xa0\x02d\x01\xa1\x01I\x00d\x02H\x00\x01\x00d\x02S\x00|\x00j\x03r*d\x02S\x00|\x00j\x04sD|\x00\xa0\x02d\x03\xa1\x01I\x00d\x02H\x00\x01\x00d\x02S\x00|\x00\xa0\x02d\x04\xa1\x01I\x00d\x02H\x00\x89\x01t\x05j\x06\xa0\x07t\x08\xa1\x01sjt\x05\xa0\tt\x08\xa1\x01\x01\x00|\x00j\n\x90\x01r\x14|\x00\xa0\x0b\xa1\x00I\x00d\x02H\x00}\x01zTt\x0c\xa0\x0c\xa1\x00\x89\x00t\rj\x0e|\x01t\x08\x87\x00\x87\x01f\x02d\x05d\x06\x84\x08d\x07\x8d\x03I\x00d\x02H\x00}\x02t\x0f|\x02\x83\x01\xa0\x10d\x08d\t\xa1\x02}\x03|\x00\xa0\x02d\n|\x03\x9b\x00d\x0b\x9d\x03\xa1\x01I\x00d\x02H\x00\x01\x00W\x00n>\x04\x00t\x11k\n\x90\x01r\x12\x01\x00}\x04\x01\x00z\x1e\x88\x01\xa0\x02t\x0f|\x04\x83\x01\xa1\x01I\x00d\x02H\x00\x01\x00W\x00Y\x00\xa2\x04d\x02S\x00d\x02}\x04~\x04X\x00Y\x00n\x02X\x00d\x02S\x00)\x0cz! Copyright (c) 2020 azrim @githubz%`Command isn\'t permitted on channels`Nr\t\x00\x00\x00r\n\x00\x00\x00c\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x08\x00\x00\x00\x13\x00\x00\x00s\x1a\x00\x00\x00t\x00\xa0\x01\xa1\x00\xa0\x02t\x03|\x00|\x01\x88\x01\x88\x00d\x01\x83\x05\xa1\x01S\x00r\x0b\x00\x00\x00r\x0c\x00\x00\x00r\x0e\x00\x00\x00r\x11\x00\x00\x00r\x14\x00\x00\x00r\x15\x00\x00\x00r\x16\x00\x00\x00^\x00\x00\x00s\x04\x00\x00\x00\x08\x01\x0e\xffz\x18addzip.<locals>.<lambda>r\x17\x00\x00\x00z\x07./zips/r\x15\x00\x00\x00\xfa\x01`z\x1c Successfully added to list`)\x12r\x1e\x00\x00\x00r\x1f\x00\x00\x00r \x00\x00\x00r!\x00\x00\x00r"\x00\x00\x00r#\x00\x00\x00r$\x00\x00\x00r%\x00\x00\x00r\x05\x00\x00\x00r&\x00\x00\x00r\'\x00\x00\x00r(\x00\x00\x00r)\x00\x00\x00r\x06\x00\x00\x00r*\x00\x00\x00r,\x00\x00\x00\xda\x07replacer+\x00\x00\x00)\x05\xda\x03addr7\x00\x00\x00r8\x00\x00\x00Z\x07successr9\x00\x00\x00r\x14\x00\x00\x00r\x11\x00\x00\x00r\x15\x00\x00\x00\xda\x06addzipH\x00\x00\x00s2\x00\x00\x00\x00\x04\x0c\x01\x10\x01\x04\x01\x06\x01\x04\x01\x06\x01\x10\x01\x04\x01\x10\x01\x0c\x01\n\x01\x08\x01\x0e\x01\x02\x01\x08\x01\x04\x01\x02\x01\x02\x01\x0c\xfd\x0c\x07\x10\x01\x1c\x01\x12\x01\x14\x01r>\x00\x00\x00z\x13^\\.upzip(?: |$)(.*)c\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\t\x00\x00\x00\x83\x00\x00\x00s\xd8\x00\x00\x00t\x00j\x01\xa0\x02t\x03\xa1\x01s |\x00\xa0\x04d\x01\xa1\x01I\x00d\x00H\x00\x01\x00d\x00S\x00|\x00\xa0\x04d\x02\xa1\x01I\x00d\x00H\x00\x89\x02|\x00j\x05\xa0\x06d\x03\xa1\x01\x89\x01t\x07\xa0\x08d\x04\xa1\x01}\x01\x88\x01rRt\t\x88\x01\x83\x01n\x08d\x05|\x01\x9b\x00\x17\x00}\x02t\n\xa0\x0b|\x02d\x06\x17\x00d\x07t\nj\x0c\xa1\x03}\x03t\rt\x03|\x03\x83\x02\x01\x00|\x03\xa0\x0e\xa1\x00\x01\x00t\x0f\xa0\x0f\xa1\x00\x89\x00t\x10j\x11|\x00j\x12|\x02d\x06\x17\x00d\x08d\t|\x00j\x13j\x14\x87\x00\x87\x01\x87\x02f\x03d\nd\x0b\x84\x08d\x0c\x8d\x06I\x00d\x00H\x00\x01\x00t\x00\xa0\x15t\x03\xa1\x01\x01\x00|\x00\xa0\x16\xa1\x00I\x00d\x00H\x00\x01\x00d\x00S\x00)\rNz\x11`Files not found`z\x11`Zipping File...`\xe9\x01\x00\x00\x00z\x06%m%d%yr-\x00\x00\x00r\x19\x00\x00\x00r\x1a\x00\x00\x00TFc\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\t\x00\x00\x00\x13\x00\x00\x00s\x1c\x00\x00\x00t\x00\xa0\x01\xa1\x00\xa0\x02t\x03|\x00|\x01\x88\x02\x88\x00d\x01\x88\x01\x83\x06\xa1\x01S\x00r\x1b\x00\x00\x00r\x0c\x00\x00\x00r\x0e\x00\x00\x00\xa9\x03r\x12\x00\x00\x00Z\tinput_strr\x13\x00\x00\x00r\x14\x00\x00\x00r\x15\x00\x00\x00r\x16\x00\x00\x00|\x00\x00\x00s\x04\x00\x00\x00\x08\x01\x10\xffz\x1cupload_zip.<locals>.<lambda>r\x1c\x00\x00\x00)\x17r#\x00\x00\x00r$\x00\x00\x00r%\x00\x00\x00r\x05\x00\x00\x00r \x00\x00\x00Z\rpattern_match\xda\x05group\xda\x05today\xda\x08strftimer,\x00\x00\x00r-\x00\x00\x00r.\x00\x00\x00r/\x00\x00\x00\xda\x06zipdir\xda\x05closer)\x00\x00\x00r\x06\x00\x00\x00r1\x00\x00\x00r2\x00\x00\x00r3\x00\x00\x00r4\x00\x00\x00\xda\x05rmdirr6\x00\x00\x00)\x04Z\x02upZ\x07curdate\xda\x05titleZ\x04zipfr\x14\x00\x00\x00r@\x00\x00\x00r\x15\x00\x00\x00\xda\nupload_zipi\x00\x00\x00s*\x00\x00\x00\x00\x02\x0c\x01\x10\x01\x04\x01\x10\x01\x0c\x01\n\x01\x16\x01\x14\x01\n\x01\x08\x01\x08\x01\x04\x01\x04\x01\x06\x01\x02\x01\x02\x01\x06\x01\x0e\xfa\x0c\n\n\x01rH\x00\x00\x00z\x13^\\.rmzip(?: |$)(.*)c\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x03\x00\x00\x00\xc3\x00\x00\x00s>\x00\x00\x00t\x00j\x01\xa0\x02t\x03\xa1\x01s |\x00\xa0\x04d\x01\xa1\x01I\x00d\x00H\x00\x01\x00d\x00S\x00t\x00\xa0\x05t\x03\xa1\x01\x01\x00|\x00\xa0\x04d\x02\xa1\x01I\x00d\x00H\x00\x01\x00d\x00S\x00)\x03Nz\x15`Directory not found`z\x12`Zip list removed`)\x06r#\x00\x00\x00r$\x00\x00\x00r%\x00\x00\x00r\x05\x00\x00\x00r \x00\x00\x00rF\x00\x00\x00)\x01Z\x02rmr\x14\x00\x00\x00r\x14\x00\x00\x00r\x15\x00\x00\x00\xda\nremove_dir\x84\x00\x00\x00s\n\x00\x00\x00\x00\x02\x0c\x01\x10\x01\x04\x01\n\x01rI\x00\x00\x00c\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x08\x00\x00\x00C\x00\x00\x00sL\x00\x00\x00t\x00\xa0\x01|\x00\xa1\x01D\x00]<\\\x03}\x02}\x03}\x04|\x04D\x00],}\x05|\x01\xa0\x02t\x00j\x03\xa0\x04|\x02|\x05\xa1\x02\xa1\x01\x01\x00t\x00\xa0\x05t\x00j\x03\xa0\x04|\x02|\x05\xa1\x02\xa1\x01\x01\x00q\x18q\nd\x00S\x00)\x01N)\x06r#\x00\x00\x00\xda\x04walkr0\x00\x00\x00r$\x00\x00\x00\xda\x04join\xda\x06remove)\x06r$\x00\x00\x00Z\x04ziph\xda\x04root\xda\x04dirs\xda\x05files\xda\x04filer\x14\x00\x00\x00r\x14\x00\x00\x00r\x15\x00\x00\x00rD\x00\x00\x00\x8d\x00\x00\x00s\x08\x00\x00\x00\x00\x02\x14\x01\x08\x01\x14\x01rD\x00\x00\x00r-\x00\x00\x00aN\x01\x00\x00`.compress` **[optional: <reply to file>]** \nUsage: make files to zip. \n`.addzip` **<reply to file>** \nUsage: add files to zip list. \n`.upzip` **[optional: <zip title>]** \nUsage: upload zip list. \n`.rmzip` **[optional: <zip title>]** \nUsage: clear zip list.)\x16r\r\x00\x00\x00r-\x00\x00\x00Z\x0euserbot.eventsr\x02\x00\x00\x00Z\x08datetimer\x03\x00\x00\x00r)\x00\x00\x00r#\x00\x00\x00Z\x07userbotr\x04\x00\x00\x00r\x05\x00\x00\x00r\x06\x00\x00\x00r\x07\x00\x00\x00Z\ruserbot.utilsr\x08\x00\x00\x00rB\x00\x00\x00r:\x00\x00\x00r>\x00\x00\x00rH\x00\x00\x00rI\x00\x00\x00rD\x00\x00\x00\xda\x06updater\x14\x00\x00\x00r\x14\x00\x00\x00r\x14\x00\x00\x00r\x15\x00\x00\x00\xda\x08<module>\x08\x00\x00\x00s*\x00\x00\x00\x08\x01\x08\x01\x0c\x01\x0c\x01\x08\x01\x08\x01\x18\x01\x0c\x03\x08\x04\n\x01\n1\n\x01\n \n\x01\n\x1a\n\x01\n\x08\x08\x08\x04\x01\x02\x01\x02\xfe')) | 2,690 | 10,689 | 0.751859 | 2,300 | 10,760 | 3.501304 | 0.156522 | 0.269713 | 0.182168 | 0.146033 | 0.504036 | 0.471377 | 0.424314 | 0.38259 | 0.368434 | 0.353905 | 0 | 0.353252 | 0.01552 | 10,760 | 4 | 10,689 | 2,690 | 0.406967 | 0.004833 | 0 | 0 | 0 | 1 | 0.266835 | 0.260671 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 10 |
cb0a84fd2e5311c44a7d5d1222f77d43e493df22 | 3,360 | py | Python | tests/core/utilities/test_prepare_transaction_replacement.py | bhardwajRahul/web3.py | efecadcdea64f9481fcace558a8ea103462e2923 | [
"MIT"
] | 3 | 2022-03-19T08:14:29.000Z | 2022-03-31T12:05:19.000Z | tests/core/utilities/test_prepare_transaction_replacement.py | bhardwajRahul/web3.py | efecadcdea64f9481fcace558a8ea103462e2923 | [
"MIT"
] | 1 | 2022-02-17T20:28:58.000Z | 2022-02-17T20:28:58.000Z | tests/core/utilities/test_prepare_transaction_replacement.py | bhardwajRahul/web3.py | efecadcdea64f9481fcace558a8ea103462e2923 | [
"MIT"
] | 1 | 2022-03-20T11:54:03.000Z | 2022-03-20T11:54:03.000Z | import pytest
from web3._utils.transactions import (
prepare_replacement_transaction,
)
SIMPLE_CURRENT_TRANSACTION = {
'blockHash': None,
'hash': '0x0',
'nonce': 2,
'gasPrice': 10,
}
def test_prepare_transaction_replacement(w3):
current_transaction = SIMPLE_CURRENT_TRANSACTION
new_transaction = {
'value': 1,
'nonce': 2,
}
replacement_transaction = prepare_replacement_transaction(
w3, current_transaction, new_transaction)
assert replacement_transaction == {
'value': 1,
'nonce': 2,
'gasPrice': 12,
}
def test_prepare_transaction_replacement_without_nonce_sets_correct_nonce(w3):
current_transaction = SIMPLE_CURRENT_TRANSACTION
new_transaction = {
'value': 1,
}
replacement_transaction = prepare_replacement_transaction(
w3, current_transaction, new_transaction)
assert replacement_transaction == {
'value': 1,
'nonce': 2,
'gasPrice': 12,
}
def test_prepare_transaction_replacement_already_mined_raises(w3):
with pytest.raises(ValueError):
prepare_replacement_transaction(
w3, {'blockHash': '0xa1a1a1', 'hash': '0x0'}, {'value': 2})
def test_prepare_transaction_replacement_nonce_mismatch_raises(w3):
with pytest.raises(ValueError):
prepare_replacement_transaction(w3, {
'blockHash': None,
'hash': '0x0',
'nonce': 1,
}, {
'nonce': 2,
})
def test_prepare_transaction_replacement_not_higher_gas_price_raises(w3):
current_transaction = SIMPLE_CURRENT_TRANSACTION
new_transaction = {
'value': 1,
'gasPrice': 5,
}
with pytest.raises(ValueError):
prepare_replacement_transaction(
w3, current_transaction, new_transaction)
# Also raises when equal to the current transaction
new_transaction['gasPrice'] = 10
with pytest.raises(ValueError):
prepare_replacement_transaction(w3, current_transaction, new_transaction)
def test_prepare_transaction_replacement_gas_price_defaulting(w3):
current_transaction = SIMPLE_CURRENT_TRANSACTION
new_transaction = {
'value': 2,
}
replacement_transaction = prepare_replacement_transaction(
w3, current_transaction, new_transaction)
assert replacement_transaction['gasPrice'] == 12
def test_prepare_transaction_replacement_gas_price_defaulting_when_strategy_higer(w3):
def higher_gas_price_strategy(w3, txn):
return 20
w3.eth.set_gas_price_strategy(higher_gas_price_strategy)
current_transaction = SIMPLE_CURRENT_TRANSACTION
new_transaction = {
'value': 2,
}
replacement_transaction = prepare_replacement_transaction(
w3, current_transaction, new_transaction)
assert replacement_transaction['gasPrice'] == 20
def test_prepare_transaction_replacement_gas_price_defaulting_when_strategy_lower(w3):
def lower_gas_price_strategy(w3, txn):
return 5
w3.eth.set_gas_price_strategy(lower_gas_price_strategy)
current_transaction = SIMPLE_CURRENT_TRANSACTION
new_transaction = {
'value': 2,
}
replacement_transaction = prepare_replacement_transaction(
w3, current_transaction, new_transaction)
assert replacement_transaction['gasPrice'] == 12
| 27.317073 | 86 | 0.704762 | 345 | 3,360 | 6.443478 | 0.162319 | 0.17004 | 0.132254 | 0.201529 | 0.851102 | 0.814215 | 0.735043 | 0.735043 | 0.710751 | 0.709852 | 0 | 0.024593 | 0.213393 | 3,360 | 122 | 87 | 27.540984 | 0.816496 | 0.014583 | 0 | 0.577778 | 0 | 0 | 0.05893 | 0 | 0 | 0 | 0.005138 | 0 | 0.055556 | 1 | 0.111111 | false | 0 | 0.022222 | 0.022222 | 0.155556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
cb8026474c66ebe89ca44aeb848f570fe8d537cf | 156 | py | Python | tests/test_tibanna/scripts/step2.py | graingert/snakemake | 4a63a26959cd0626e2113e48b4d4fe5a5421d954 | [
"MIT"
] | 1,326 | 2019-10-04T15:11:20.000Z | 2022-03-31T18:39:40.000Z | tests/test_tibanna/scripts/step2.py | graingert/snakemake | 4a63a26959cd0626e2113e48b4d4fe5a5421d954 | [
"MIT"
] | 1,496 | 2019-10-04T15:15:12.000Z | 2022-03-31T23:14:33.000Z | tests/test_tibanna/scripts/step2.py | graingert/snakemake | 4a63a26959cd0626e2113e48b4d4fe5a5421d954 | [
"MIT"
] | 375 | 2019-10-08T21:28:51.000Z | 2022-03-28T18:44:36.000Z | from shutil import copyfile
copyfile("message2", "snakemake-tibanna-test/1/final_message")
copyfile("message2", "snakemake-tibanna-test2/1/final_message")
| 31.2 | 63 | 0.801282 | 20 | 156 | 6.15 | 0.6 | 0.260163 | 0.406504 | 0.520325 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034014 | 0.057692 | 156 | 4 | 64 | 39 | 0.802721 | 0 | 0 | 0 | 0 | 0 | 0.596154 | 0.49359 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 8 |
cba8fa867ab793c91b430db08a91829d5f54695e | 1,981 | py | Python | main.py | christocs/MiningTenementsCsvTools | 22550d448ce52c41adce0acdb5c5651185919f9b | [
"MIT"
] | null | null | null | main.py | christocs/MiningTenementsCsvTools | 22550d448ce52c41adce0acdb5c5651185919f9b | [
"MIT"
] | null | null | null | main.py | christocs/MiningTenementsCsvTools | 22550d448ce52c41adce0acdb5c5651185919f9b | [
"MIT"
] | null | null | null | import sampleset
import miningTenementTemplate
import findtemplates
import profile
def main():
# sampleset.generateSampleSet()
# miningTenementTemplate.fix("tenement_templates_dupes_removed.csv", "tenement_templates_fixed.csv")
# miningTenementTemplate.generateRegex("tenement_templates_fixed.csv", "tenement_templates_regex.csv")
profile.run('miningTenementTemplate.generateRegex("tenement_templates_fixed.csv", "tenement_templates_regex.csv")')
# miningTenementTemplate.stripDuplicateRegex("tenement_templates_regex.csv",
# "tenement_templates_regex_no_overlapping_templates.csv")
# findtemplates.dumpMatchedRows("Conditions.csv", "tenement_templates_regex_no_overlapping_templates.csv", "ConditionsWithRegexMatches.csv")
# findtemplates.dumpMatchedRowsWhichOnlyMatchGreedyRegex("Conditions.csv", "tenement_templates_regex_no_overlapping_templates.csv",
# "ConditionsWithRegexMatchesThatOnlySatisfyGreedyRegex.csv")
# profile.run('findtemplates.printNoMatches("Conditions.csv", "tenement_templates_regex.csv", "CondText", False, False)')
profile.run('findtemplates.printNoMatches("Conditions.csv", "tenement_templates_regex.csv", "CondText", True, False)')
# Check templates match against themselves
# findtemplates.printNoMatches("tenement_templates_regex.csv", "tenement_templates_regex.csv", "Text", True)
# findtemplates.selfMatchTemplateFile("tenement_templates_regex.csv")
# findtemplates.selfMatchTemplateFileFindOverlappingTemplates("tenement_templates_regex.csv")
# findtemplates.dumpUnmatchedRows("Conditions.csv", "tenement_templates_regex.csv", "ConditionsNoRegexMatches.csv")
# findtemplates.selfMatchTemplateFileFindOverlappingTemplates("tenement_templates_regex.csv")
# findtemplates.selfMatchTemplateFileFindOverlappingTemplates("tenement_templates_regex_dupes_removed.csv")
if __name__ == '__main__':
main() | 63.903226 | 144 | 0.787986 | 167 | 1,981 | 9 | 0.245509 | 0.214904 | 0.219561 | 0.182967 | 0.600798 | 0.598802 | 0.57352 | 0.527611 | 0.443114 | 0.223553 | 0 | 0 | 0.114084 | 1,981 | 31 | 145 | 63.903226 | 0.85641 | 0.758708 | 0 | 0 | 1 | 0 | 0.45671 | 0.380952 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | true | 0 | 0.444444 | 0 | 0.555556 | 0.111111 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
1db492094b9581bfade024c95d14aafd1b8525e7 | 141 | py | Python | frappe-bench/apps/erpnext/erpnext/patches/v7_0/re_route.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | frappe-bench/apps/erpnext/erpnext/patches/v7_0/re_route.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | frappe-bench/apps/erpnext/erpnext/patches/v7_0/re_route.py | Semicheche/foa_frappe_docker | a186b65d5e807dd4caf049e8aeb3620a799c1225 | [
"MIT"
] | null | null | null | from frappe.patches.v7_0.re_route import update_routes
def execute():
update_routes(['Item', 'Item Group', 'Sales Partner', 'Job Opening']) | 35.25 | 70 | 0.751773 | 21 | 141 | 4.857143 | 0.857143 | 0.235294 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015748 | 0.099291 | 141 | 4 | 70 | 35.25 | 0.787402 | 0 | 0 | 0 | 0 | 0 | 0.267606 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | true | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
6992206f9cd18216c67aa598793456f1c967f172 | 49 | py | Python | quickmail/__init__.py | avikumar15/quick-mail-cli | 4282fb62794671de89d5d8efc3697b0a0d540230 | [
"MIT"
] | 7 | 2021-03-20T06:22:44.000Z | 2021-11-03T14:43:18.000Z | quickmail/__init__.py | avikumar15/quick-email-cli | 4282fb62794671de89d5d8efc3697b0a0d540230 | [
"MIT"
] | 2 | 2021-11-04T03:21:57.000Z | 2021-11-04T03:24:06.000Z | quickmail/__init__.py | avikumar15/quick-mail-cli | 4282fb62794671de89d5d8efc3697b0a0d540230 | [
"MIT"
] | null | null | null | import quickmail.commands
import quickmail.utils
| 16.333333 | 25 | 0.877551 | 6 | 49 | 7.166667 | 0.666667 | 0.697674 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081633 | 49 | 2 | 26 | 24.5 | 0.955556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
69d61ac99724f3424a9d3d8ce111babaa8ef74bf | 6,263 | py | Python | scarletio/utils/dict_iterator_bases.py | HuyaneMatsu/scarletio | 49e434a118bbf31586e2bf8631ac8d7c7a2f6ffb | [
"0BSD"
] | 3 | 2021-12-01T07:56:36.000Z | 2021-12-05T17:37:41.000Z | scarletio/utils/dict_iterator_bases.py | HuyaneMatsu/scarletio | 49e434a118bbf31586e2bf8631ac8d7c7a2f6ffb | [
"0BSD"
] | 7 | 2021-12-04T14:29:27.000Z | 2022-03-07T18:32:28.000Z | scarletio/utils/dict_iterator_bases.py | HuyaneMatsu/scarletio | 49e434a118bbf31586e2bf8631ac8d7c7a2f6ffb | [
"0BSD"
] | null | null | null | __all__ = ()
from .docs import has_docs
from .utils import is_iterable
@has_docs
class DictionaryKeyIteratorBase:
"""
Key iterator of a dictionary..
Attributes
----------
_parent : `dict`
The parent dictionary.
"""
__slots__ = ('_parent',)
@has_docs
def __init__(self, parent):
"""
Creates a new dictionary key iterator bound to the given dictionary.
Parameters
----------
parent : `dict`
The parent dictionary.
"""
self._parent = parent
@has_docs
def __iter__(self):
"""
Iterates over the dictionary's keys.
This method is an iterable generator.
Yields
------
key : `Any`
"""
return
yield
@has_docs
def __contains__(self, contains_key):
"""Returns whether the respective dictionary contains the given key."""
return False
@has_docs
def __len__(self):
"""Returns the respective dictionary's length."""
return len(self._parent)
@has_docs
def __repr__(self):
"""Returns the dictionary key iterator's representation."""
return f'<{self.__class__.__name__} to {self._parent!r}>'
@has_docs
def __eq__(self, other):
"""Returns whether the two dictionary key iterators are the same."""
if isinstance(other, type(self)):
return self._parent == other._parent
return self._parent.__eq__(other)
@has_docs
class DictionaryValueIteratorBase:
"""
Value iterator of a dictionary..
Attributes
----------
_parent : `dict`
The parent dictionary.
"""
__slots__ = ('_parent',)
@has_docs
def __init__(self, parent):
"""
Creates a new dictionary value iterator bound to the given dictionary.
Parameters
----------
parent : `dict`
The parent dictionary.
"""
self._parent = parent
@has_docs
def __iter__(self):
"""
Iterates over the dictionary's values.
This method is an iterable generator.
Yields
------
value : `Any`
"""
return
yield
@has_docs
def __contains__(self, contains_value):
"""Returns whether the respective dictionary contains the given value."""
return False
@has_docs
def __len__(self):
"""Returns the respective dictionary's length."""
return len(self._parent)
@has_docs
def __repr__(self):
"""Returns the dictionary value iterator's representation."""
return f'<{self.__class__.__name__} to {self._parent!r}>'
@has_docs
def __eq__(self, other):
"""Returns whether the two dictionary item iterators are the same."""
if isinstance(other, type(self)):
return self._parent == other._parent
elif isinstance(other, list):
if len(self) != len(other):
return False
other = other.copy()
elif is_iterable(other):
has_length_method = hasattr(type(other), '__len__')
if has_length_method:
if len(self) != len(other):
return False
other = list(other)
if not has_length_method:
if len(self) != len(other):
return False
else:
return NotImplemented
for value in self:
try:
other.remove(value)
except ValueError:
return False
if other:
return False
return True
@has_docs
class DictionaryItemIteratorBase:
"""
Item iterator of a dictionary..
Attributes
----------
_parent : `dict`
The parent dictionary.
"""
__slots__ = ('_parent',)
@has_docs
def __init__(self, parent):
"""
Creates a new dictionary item iterator bound to the given dictionary.
Parameters
----------
parent : `dict`
The parent dictionary.
"""
self._parent = parent
@has_docs
def __iter__(self):
"""
Iterates over the dictionary's items.
This method is an iterable generator.
Yields
------
item : `tuple` (`Any`, `str`)
"""
return
yield
@has_docs
def __contains__(self, contains_item):
"""Returns whether the respective dictionary contains the given item."""
return False
@has_docs
def __len__(self):
"""Returns the respective dictionary's length."""
return len(self._parent)
@has_docs
def __repr__(self):
"""Returns the dictionary item iterator's representation."""
return f'<{self.__class__.__name__} to {self._parent!r}>'
@has_docs
def __eq__(self, other):
"""Returns whether the two dictionary item iterators are the same."""
if isinstance(other, type(self)):
return self._parent == other._parent
elif isinstance(other, list):
if len(self) != len(other):
return False
other = other.copy()
elif is_iterable(other):
has_length_method = hasattr(type(other), '__len__')
if has_length_method:
if len(self) != len(other):
return False
other = list(other)
if not has_length_method:
if len(self) != len(other):
return False
else:
return NotImplemented
for item in self:
try:
other.remove(item)
except ValueError:
return False
if other:
return False
return True
| 23.456929 | 81 | 0.510299 | 597 | 6,263 | 5.041876 | 0.142379 | 0.051163 | 0.059801 | 0.047841 | 0.898671 | 0.885382 | 0.885382 | 0.848505 | 0.78206 | 0.752824 | 0 | 0 | 0.396934 | 6,263 | 266 | 82 | 23.545113 | 0.796929 | 0.275427 | 0 | 0.882353 | 0 | 0 | 0.044332 | 0.019647 | 0 | 0 | 0 | 0 | 0 | 1 | 0.151261 | false | 0 | 0.016807 | 0 | 0.470588 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
3886f73ddcaf71011b73098a36a1019327291cda | 197 | py | Python | tnia/napari/napari_demo/hooks.py | True-North-Intelligent-Algorithms/tnia-python | ab580716082e0ec655a27eb856dae629ebb1a3bf | [
"BSD-3-Clause"
] | 3 | 2022-02-08T16:30:05.000Z | 2022-02-18T22:28:50.000Z | tnia/napari/napari_demo/hooks.py | True-North-Intelligent-Algorithms/tnia-python | ab580716082e0ec655a27eb856dae629ebb1a3bf | [
"BSD-3-Clause"
] | null | null | null | tnia/napari/napari_demo/hooks.py | True-North-Intelligent-Algorithms/tnia-python | ab580716082e0ec655a27eb856dae629ebb1a3bf | [
"BSD-3-Clause"
] | null | null | null | from napari_plugin_engine import napari_hook_implementation
from .simple import simple_plugin
@napari_hook_implementation
def napari_experimental_provide_dock_widget():
return [simple_plugin]
| 28.142857 | 59 | 0.873096 | 25 | 197 | 6.4 | 0.56 | 0.125 | 0.3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.091371 | 197 | 6 | 60 | 32.833333 | 0.893855 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | true | 0 | 0.4 | 0.2 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 7 |
2a2f2297c40f532b6697d024f9f1e9fe0e93c3a2 | 94 | py | Python | pyuwb/pyuwb_test.py | Jiangshan00001/pyuwb | 9253c9f7481199eddac37dec544723fba31ba996 | [
"MIT"
] | 1 | 2022-03-24T03:08:46.000Z | 2022-03-24T03:08:46.000Z | pyuwb/pyuwb_test.py | Jiangshan00001/pyuwb | 9253c9f7481199eddac37dec544723fba31ba996 | [
"MIT"
] | null | null | null | pyuwb/pyuwb_test.py | Jiangshan00001/pyuwb | 9253c9f7481199eddac37dec544723fba31ba996 | [
"MIT"
] | null | null | null |
def console_cmd():
print('hello test')
def gui_cmd():
print('hello test gui_cmd')
| 10.444444 | 31 | 0.62766 | 14 | 94 | 4 | 0.5 | 0.285714 | 0.464286 | 0.607143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.223404 | 94 | 8 | 32 | 11.75 | 0.767123 | 0 | 0 | 0 | 0 | 0 | 0.304348 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | true | 0 | 0 | 0 | 0.5 | 0.5 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 8 |
2a3727437f16c6fa6166fa187dd7854283cfd403 | 23,786 | py | Python | sdk/python/pulumi_aws/ssm/maintenance_window_task.py | dixler/pulumi-aws | 88838ed6d412c092717a916b0b5b154f68226c3a | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_aws/ssm/maintenance_window_task.py | dixler/pulumi-aws | 88838ed6d412c092717a916b0b5b154f68226c3a | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_aws/ssm/maintenance_window_task.py | dixler/pulumi-aws | 88838ed6d412c092717a916b0b5b154f68226c3a | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
class MaintenanceWindowTask(pulumi.CustomResource):
description: pulumi.Output[str]
"""
The description of the maintenance window task.
"""
logging_info: pulumi.Output[dict]
"""
A structure containing information about an Amazon S3 bucket to write instance-level logs to. Use `task_invocation_parameters` configuration block `run_command_parameters` configuration block `output_s3_*` arguments instead. Conflicts with `task_invocation_parameters`. Documented below.
* `s3_bucket_name` (`str`)
* `s3BucketPrefix` (`str`)
* `s3_region` (`str`)
"""
max_concurrency: pulumi.Output[str]
"""
The maximum number of targets this task can be run for in parallel.
"""
max_errors: pulumi.Output[str]
"""
The maximum number of errors allowed before this task stops being scheduled.
"""
name: pulumi.Output[str]
"""
The parameter name.
"""
priority: pulumi.Output[float]
"""
The priority of the task in the Maintenance Window, the lower the number the higher the priority. Tasks in a Maintenance Window are scheduled in priority order with tasks that have the same priority scheduled in parallel.
"""
service_role_arn: pulumi.Output[str]
"""
The IAM service role to assume during task execution.
"""
targets: pulumi.Output[list]
"""
The targets (either instances or window target ids). Instances are specified using Key=InstanceIds,Values=instanceid1,instanceid2. Window target ids are specified using Key=WindowTargetIds,Values=window target id1, window target id2.
* `key` (`str`)
* `values` (`list`) - The array of strings.
"""
task_arn: pulumi.Output[str]
"""
The ARN of the task to execute.
"""
task_invocation_parameters: pulumi.Output[dict]
"""
The parameters for task execution. This argument is conflict with `task_parameters` and `logging_info`.
* `automationParameters` (`dict`) - The parameters for an AUTOMATION task type. Documented below.
* `document_version` (`str`) - The version of an Automation document to use during task execution.
* `parameters` (`list`) - The parameters for the RUN_COMMAND task execution. Documented below.
* `name` (`str`) - The parameter name.
* `values` (`list`) - The array of strings.
* `lambdaParameters` (`dict`) - The parameters for a LAMBDA task type. Documented below.
* `clientContext` (`str`) - Pass client-specific information to the Lambda function that you are invoking.
* `payload` (`str`) - JSON to provide to your Lambda function as input.
* `qualifier` (`str`) - Specify a Lambda function version or alias name.
* `runCommandParameters` (`dict`) - The parameters for a RUN_COMMAND task type. Documented below.
* `comment` (`str`) - Information about the command(s) to execute.
* `documentHash` (`str`) - The SHA-256 or SHA-1 hash created by the system when the document was created. SHA-1 hashes have been deprecated.
* `documentHashType` (`str`) - SHA-256 or SHA-1. SHA-1 hashes have been deprecated. Valid values: `Sha256` and `Sha1`
* `notificationConfig` (`dict`) - Configurations for sending notifications about command status changes on a per-instance basis. Documented below.
* `notificationArn` (`str`) - An Amazon Resource Name (ARN) for a Simple Notification Service (SNS) topic. Run Command pushes notifications about command status changes to this topic.
* `notificationEvents` (`list`) - The different events for which you can receive notifications. Valid values: `All`, `InProgress`, `Success`, `TimedOut`, `Cancelled`, and `Failed`
* `notification_type` (`str`) - When specified with `Command`, receive notification when the status of a command changes. When specified with `Invocation`, for commands sent to multiple instances, receive notification on a per-instance basis when the status of a command changes. Valid values: `Command` and `Invocation`
* `outputS3Bucket` (`str`) - The name of the Amazon S3 bucket.
* `outputS3KeyPrefix` (`str`) - The Amazon S3 bucket subfolder.
* `parameters` (`list`) - The parameters for the RUN_COMMAND task execution. Documented below.
* `name` (`str`) - The parameter name.
* `values` (`list`) - The array of strings.
* `service_role_arn` (`str`) - The IAM service role to assume during task execution.
* `timeoutSeconds` (`float`) - If this time is reached and the command has not already started executing, it doesn't run.
* `stepFunctionsParameters` (`dict`) - The parameters for a STEP_FUNCTIONS task type. Documented below.
* `input` (`str`) - The inputs for the STEP_FUNCTION task.
* `name` (`str`) - The parameter name.
"""
task_parameters: pulumi.Output[list]
"""
A structure containing information about parameters required by the particular `task_arn`. Use `parameter` configuration blocks under the `task_invocation_parameters` configuration block instead. Conflicts with `task_invocation_parameters`. Documented below.
* `name` (`str`) - The parameter name.
* `values` (`list`) - The array of strings.
"""
task_type: pulumi.Output[str]
"""
The type of task being registered. The only allowed value is `RUN_COMMAND`.
"""
window_id: pulumi.Output[str]
"""
The Id of the maintenance window to register the task with.
"""
def __init__(__self__, resource_name, opts=None, description=None, logging_info=None, max_concurrency=None, max_errors=None, name=None, priority=None, service_role_arn=None, targets=None, task_arn=None, task_invocation_parameters=None, task_parameters=None, task_type=None, window_id=None, __props__=None, __name__=None, __opts__=None):
"""
Provides an SSM Maintenance Window Task resource
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] description: The description of the maintenance window task.
:param pulumi.Input[dict] logging_info: A structure containing information about an Amazon S3 bucket to write instance-level logs to. Use `task_invocation_parameters` configuration block `run_command_parameters` configuration block `output_s3_*` arguments instead. Conflicts with `task_invocation_parameters`. Documented below.
:param pulumi.Input[str] max_concurrency: The maximum number of targets this task can be run for in parallel.
:param pulumi.Input[str] max_errors: The maximum number of errors allowed before this task stops being scheduled.
:param pulumi.Input[str] name: The parameter name.
:param pulumi.Input[float] priority: The priority of the task in the Maintenance Window, the lower the number the higher the priority. Tasks in a Maintenance Window are scheduled in priority order with tasks that have the same priority scheduled in parallel.
:param pulumi.Input[str] service_role_arn: The IAM service role to assume during task execution.
:param pulumi.Input[list] targets: The targets (either instances or window target ids). Instances are specified using Key=InstanceIds,Values=instanceid1,instanceid2. Window target ids are specified using Key=WindowTargetIds,Values=window target id1, window target id2.
:param pulumi.Input[str] task_arn: The ARN of the task to execute.
:param pulumi.Input[dict] task_invocation_parameters: The parameters for task execution. This argument is conflict with `task_parameters` and `logging_info`.
:param pulumi.Input[list] task_parameters: A structure containing information about parameters required by the particular `task_arn`. Use `parameter` configuration blocks under the `task_invocation_parameters` configuration block instead. Conflicts with `task_invocation_parameters`. Documented below.
:param pulumi.Input[str] task_type: The type of task being registered. The only allowed value is `RUN_COMMAND`.
:param pulumi.Input[str] window_id: The Id of the maintenance window to register the task with.
The **logging_info** object supports the following:
* `s3_bucket_name` (`pulumi.Input[str]`)
* `s3BucketPrefix` (`pulumi.Input[str]`)
* `s3_region` (`pulumi.Input[str]`)
The **targets** object supports the following:
* `key` (`pulumi.Input[str]`)
* `values` (`pulumi.Input[list]`) - The array of strings.
The **task_invocation_parameters** object supports the following:
* `automationParameters` (`pulumi.Input[dict]`) - The parameters for an AUTOMATION task type. Documented below.
* `document_version` (`pulumi.Input[str]`) - The version of an Automation document to use during task execution.
* `parameters` (`pulumi.Input[list]`) - The parameters for the RUN_COMMAND task execution. Documented below.
* `name` (`pulumi.Input[str]`) - The parameter name.
* `values` (`pulumi.Input[list]`) - The array of strings.
* `lambdaParameters` (`pulumi.Input[dict]`) - The parameters for a LAMBDA task type. Documented below.
* `clientContext` (`pulumi.Input[str]`) - Pass client-specific information to the Lambda function that you are invoking.
* `payload` (`pulumi.Input[str]`) - JSON to provide to your Lambda function as input.
* `qualifier` (`pulumi.Input[str]`) - Specify a Lambda function version or alias name.
* `runCommandParameters` (`pulumi.Input[dict]`) - The parameters for a RUN_COMMAND task type. Documented below.
* `comment` (`pulumi.Input[str]`) - Information about the command(s) to execute.
* `documentHash` (`pulumi.Input[str]`) - The SHA-256 or SHA-1 hash created by the system when the document was created. SHA-1 hashes have been deprecated.
* `documentHashType` (`pulumi.Input[str]`) - SHA-256 or SHA-1. SHA-1 hashes have been deprecated. Valid values: `Sha256` and `Sha1`
* `notificationConfig` (`pulumi.Input[dict]`) - Configurations for sending notifications about command status changes on a per-instance basis. Documented below.
* `notificationArn` (`pulumi.Input[str]`) - An Amazon Resource Name (ARN) for a Simple Notification Service (SNS) topic. Run Command pushes notifications about command status changes to this topic.
* `notificationEvents` (`pulumi.Input[list]`) - The different events for which you can receive notifications. Valid values: `All`, `InProgress`, `Success`, `TimedOut`, `Cancelled`, and `Failed`
* `notification_type` (`pulumi.Input[str]`) - When specified with `Command`, receive notification when the status of a command changes. When specified with `Invocation`, for commands sent to multiple instances, receive notification on a per-instance basis when the status of a command changes. Valid values: `Command` and `Invocation`
* `outputS3Bucket` (`pulumi.Input[str]`) - The name of the Amazon S3 bucket.
* `outputS3KeyPrefix` (`pulumi.Input[str]`) - The Amazon S3 bucket subfolder.
* `parameters` (`pulumi.Input[list]`) - The parameters for the RUN_COMMAND task execution. Documented below.
* `name` (`pulumi.Input[str]`) - The parameter name.
* `values` (`pulumi.Input[list]`) - The array of strings.
* `service_role_arn` (`pulumi.Input[str]`) - The IAM service role to assume during task execution.
* `timeoutSeconds` (`pulumi.Input[float]`) - If this time is reached and the command has not already started executing, it doesn't run.
* `stepFunctionsParameters` (`pulumi.Input[dict]`) - The parameters for a STEP_FUNCTIONS task type. Documented below.
* `input` (`pulumi.Input[str]`) - The inputs for the STEP_FUNCTION task.
* `name` (`pulumi.Input[str]`) - The parameter name.
The **task_parameters** object supports the following:
* `name` (`pulumi.Input[str]`) - The parameter name.
* `values` (`pulumi.Input[list]`) - The array of strings.
> This content is derived from https://github.com/terraform-providers/terraform-provider-aws/blob/master/website/docs/r/ssm_maintenance_window_task.html.markdown.
"""
if __name__ is not None:
warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
resource_name = __name__
if __opts__ is not None:
warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
opts = __opts__
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = dict()
__props__['description'] = description
__props__['logging_info'] = logging_info
if max_concurrency is None:
raise TypeError("Missing required property 'max_concurrency'")
__props__['max_concurrency'] = max_concurrency
if max_errors is None:
raise TypeError("Missing required property 'max_errors'")
__props__['max_errors'] = max_errors
__props__['name'] = name
__props__['priority'] = priority
if service_role_arn is None:
raise TypeError("Missing required property 'service_role_arn'")
__props__['service_role_arn'] = service_role_arn
if targets is None:
raise TypeError("Missing required property 'targets'")
__props__['targets'] = targets
if task_arn is None:
raise TypeError("Missing required property 'task_arn'")
__props__['task_arn'] = task_arn
__props__['task_invocation_parameters'] = task_invocation_parameters
__props__['task_parameters'] = task_parameters
if task_type is None:
raise TypeError("Missing required property 'task_type'")
__props__['task_type'] = task_type
if window_id is None:
raise TypeError("Missing required property 'window_id'")
__props__['window_id'] = window_id
super(MaintenanceWindowTask, __self__).__init__(
'aws:ssm/maintenanceWindowTask:MaintenanceWindowTask',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name, id, opts=None, description=None, logging_info=None, max_concurrency=None, max_errors=None, name=None, priority=None, service_role_arn=None, targets=None, task_arn=None, task_invocation_parameters=None, task_parameters=None, task_type=None, window_id=None):
"""
Get an existing MaintenanceWindowTask resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param str id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] description: The description of the maintenance window task.
:param pulumi.Input[dict] logging_info: A structure containing information about an Amazon S3 bucket to write instance-level logs to. Use `task_invocation_parameters` configuration block `run_command_parameters` configuration block `output_s3_*` arguments instead. Conflicts with `task_invocation_parameters`. Documented below.
:param pulumi.Input[str] max_concurrency: The maximum number of targets this task can be run for in parallel.
:param pulumi.Input[str] max_errors: The maximum number of errors allowed before this task stops being scheduled.
:param pulumi.Input[str] name: The parameter name.
:param pulumi.Input[float] priority: The priority of the task in the Maintenance Window, the lower the number the higher the priority. Tasks in a Maintenance Window are scheduled in priority order with tasks that have the same priority scheduled in parallel.
:param pulumi.Input[str] service_role_arn: The IAM service role to assume during task execution.
:param pulumi.Input[list] targets: The targets (either instances or window target ids). Instances are specified using Key=InstanceIds,Values=instanceid1,instanceid2. Window target ids are specified using Key=WindowTargetIds,Values=window target id1, window target id2.
:param pulumi.Input[str] task_arn: The ARN of the task to execute.
:param pulumi.Input[dict] task_invocation_parameters: The parameters for task execution. This argument is conflict with `task_parameters` and `logging_info`.
:param pulumi.Input[list] task_parameters: A structure containing information about parameters required by the particular `task_arn`. Use `parameter` configuration blocks under the `task_invocation_parameters` configuration block instead. Conflicts with `task_invocation_parameters`. Documented below.
:param pulumi.Input[str] task_type: The type of task being registered. The only allowed value is `RUN_COMMAND`.
:param pulumi.Input[str] window_id: The Id of the maintenance window to register the task with.
The **logging_info** object supports the following:
* `s3_bucket_name` (`pulumi.Input[str]`)
* `s3BucketPrefix` (`pulumi.Input[str]`)
* `s3_region` (`pulumi.Input[str]`)
The **targets** object supports the following:
* `key` (`pulumi.Input[str]`)
* `values` (`pulumi.Input[list]`) - The array of strings.
The **task_invocation_parameters** object supports the following:
* `automationParameters` (`pulumi.Input[dict]`) - The parameters for an AUTOMATION task type. Documented below.
* `document_version` (`pulumi.Input[str]`) - The version of an Automation document to use during task execution.
* `parameters` (`pulumi.Input[list]`) - The parameters for the RUN_COMMAND task execution. Documented below.
* `name` (`pulumi.Input[str]`) - The parameter name.
* `values` (`pulumi.Input[list]`) - The array of strings.
* `lambdaParameters` (`pulumi.Input[dict]`) - The parameters for a LAMBDA task type. Documented below.
* `clientContext` (`pulumi.Input[str]`) - Pass client-specific information to the Lambda function that you are invoking.
* `payload` (`pulumi.Input[str]`) - JSON to provide to your Lambda function as input.
* `qualifier` (`pulumi.Input[str]`) - Specify a Lambda function version or alias name.
* `runCommandParameters` (`pulumi.Input[dict]`) - The parameters for a RUN_COMMAND task type. Documented below.
* `comment` (`pulumi.Input[str]`) - Information about the command(s) to execute.
* `documentHash` (`pulumi.Input[str]`) - The SHA-256 or SHA-1 hash created by the system when the document was created. SHA-1 hashes have been deprecated.
* `documentHashType` (`pulumi.Input[str]`) - SHA-256 or SHA-1. SHA-1 hashes have been deprecated. Valid values: `Sha256` and `Sha1`
* `notificationConfig` (`pulumi.Input[dict]`) - Configurations for sending notifications about command status changes on a per-instance basis. Documented below.
* `notificationArn` (`pulumi.Input[str]`) - An Amazon Resource Name (ARN) for a Simple Notification Service (SNS) topic. Run Command pushes notifications about command status changes to this topic.
* `notificationEvents` (`pulumi.Input[list]`) - The different events for which you can receive notifications. Valid values: `All`, `InProgress`, `Success`, `TimedOut`, `Cancelled`, and `Failed`
* `notification_type` (`pulumi.Input[str]`) - When specified with `Command`, receive notification when the status of a command changes. When specified with `Invocation`, for commands sent to multiple instances, receive notification on a per-instance basis when the status of a command changes. Valid values: `Command` and `Invocation`
* `outputS3Bucket` (`pulumi.Input[str]`) - The name of the Amazon S3 bucket.
* `outputS3KeyPrefix` (`pulumi.Input[str]`) - The Amazon S3 bucket subfolder.
* `parameters` (`pulumi.Input[list]`) - The parameters for the RUN_COMMAND task execution. Documented below.
* `name` (`pulumi.Input[str]`) - The parameter name.
* `values` (`pulumi.Input[list]`) - The array of strings.
* `service_role_arn` (`pulumi.Input[str]`) - The IAM service role to assume during task execution.
* `timeoutSeconds` (`pulumi.Input[float]`) - If this time is reached and the command has not already started executing, it doesn't run.
* `stepFunctionsParameters` (`pulumi.Input[dict]`) - The parameters for a STEP_FUNCTIONS task type. Documented below.
* `input` (`pulumi.Input[str]`) - The inputs for the STEP_FUNCTION task.
* `name` (`pulumi.Input[str]`) - The parameter name.
The **task_parameters** object supports the following:
* `name` (`pulumi.Input[str]`) - The parameter name.
* `values` (`pulumi.Input[list]`) - The array of strings.
> This content is derived from https://github.com/terraform-providers/terraform-provider-aws/blob/master/website/docs/r/ssm_maintenance_window_task.html.markdown.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = dict()
__props__["description"] = description
__props__["logging_info"] = logging_info
__props__["max_concurrency"] = max_concurrency
__props__["max_errors"] = max_errors
__props__["name"] = name
__props__["priority"] = priority
__props__["service_role_arn"] = service_role_arn
__props__["targets"] = targets
__props__["task_arn"] = task_arn
__props__["task_invocation_parameters"] = task_invocation_parameters
__props__["task_parameters"] = task_parameters
__props__["task_type"] = task_type
__props__["window_id"] = window_id
return MaintenanceWindowTask(resource_name, opts=opts, __props__=__props__)
def translate_output_property(self, prop):
return tables._CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop
def translate_input_property(self, prop):
return tables._SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop
| 67.766382 | 348 | 0.680274 | 2,897 | 23,786 | 5.441491 | 0.101139 | 0.065592 | 0.05151 | 0.023725 | 0.883596 | 0.864311 | 0.860505 | 0.84084 | 0.820731 | 0.814578 | 0 | 0.004457 | 0.226562 | 23,786 | 350 | 349 | 67.96 | 0.852422 | 0.529765 | 0 | 0.021978 | 1 | 0 | 0.177174 | 0.02088 | 0 | 0 | 0 | 0 | 0 | 1 | 0.043956 | false | 0.010989 | 0.065934 | 0.021978 | 0.296703 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
aa526feba76c85a6e2fd71c69c673790483406d1 | 145 | py | Python | setup.py | gsiekaniec/GeneTree | a098a64117dbe8ebd6d84c3fdd184df9f93f5480 | [
"MIT"
] | null | null | null | setup.py | gsiekaniec/GeneTree | a098a64117dbe8ebd6d84c3fdd184df9f93f5480 | [
"MIT"
] | null | null | null | setup.py | gsiekaniec/GeneTree | a098a64117dbe8ebd6d84c3fdd184df9f93f5480 | [
"MIT"
] | null | null | null | from setuptools import setup
import os
setup()
os.system('rm -rf ./build')
os.system('rm -rf ./dist')
os.system('rm -rf ./GeneTree.egg-info')
| 14.5 | 39 | 0.675862 | 24 | 145 | 4.083333 | 0.541667 | 0.244898 | 0.306122 | 0.367347 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131034 | 145 | 9 | 40 | 16.111111 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0.365517 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 7 |
aa910efe096bc5d1febcfb461f84995c2ad09ec3 | 7,444 | py | Python | icclim/set_longname_units.py | bzah/icclim | 037c3e779350cceab6422d34879f2e7478df7916 | [
"Apache-2.0"
] | 48 | 2015-10-19T08:44:15.000Z | 2022-03-09T09:41:04.000Z | icclim/set_longname_units.py | bzah/icclim | 037c3e779350cceab6422d34879f2e7478df7916 | [
"Apache-2.0"
] | 86 | 2015-11-20T17:17:57.000Z | 2022-03-31T13:39:46.000Z | icclim/set_longname_units.py | bzah/icclim | 037c3e779350cceab6422d34879f2e7478df7916 | [
"Apache-2.0"
] | 30 | 2015-11-20T22:52:41.000Z | 2022-01-09T19:33:43.000Z | # Copyright CERFACS (http://cerfacs.fr/)
# Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
#
# Author: Natalia Tatarinova
# set the attributs "long_name" and "units" of indice variable in output meta data
def TG_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Mean of daily mean temperature')
var_nc.setncattr('units', 'K')
def TN_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Mean of daily minimum temperature')
var_nc.setncattr('units', 'K')
def TX_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Mean of daily maximum temperature')
var_nc.setncattr('units', 'K')
def TXx_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Max of daily maximum temperature')
var_nc.setncattr('units', 'K')
def TNx_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Max of daily minimum temperature')
var_nc.setncattr('units', 'K')
def TXn_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Min of daily maximum temperature')
var_nc.setncattr('units', 'K')
def TNn_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Min of daily minimum temperature')
var_nc.setncattr('units', 'K')
def DTR_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Mean of diurnal temperature range')
var_nc.setncattr('units', 'K')
def ETR_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Intra-period extreme temperature range')
var_nc.setncattr('units', 'K')
def vDTR_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Mean absolute day-to-day difference in DTR (DTR: mean of diurnal temperature range)')
var_nc.setncattr('units', 'K')
def SU_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Summer days (number of days where daily maximum temperature > 25 degrees)')
var_nc.setncattr('units', 'days')
def TR_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Tropical nights (number of days where daily minimum temperature > 20 degrees)')
var_nc.setncattr('units', 'days')
def CSU_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Maximum number of consecutive summer days(temperature > 25 degrees)')
var_nc.setncattr('units', 'days')
def PRCPTOT_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Precipitation sum)')
var_nc.setncattr('units', 'mm')
def RR1_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Wet days (precipitation >= 1 mm)')
var_nc.setncattr('units', 'days')
def CWD_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Maximum number of consecutive wet days (precipitation >= 1 mm)')
var_nc.setncattr('units', 'days')
def CDD_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Maximum number of consecutive dry days (precipitation < 1 mm)')
var_nc.setncattr('units', 'days')
def SDII_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Simple daily intensity index for wet days (mm/wet day)')
var_nc.setncattr('units', 'mm')
def R10mm_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Heavy precipitation days (precipitation >= 10 mm)')
var_nc.setncattr('units', 'days')
def R20mm_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Very heavy precipitation days (precipitation >= 20 mm)')
var_nc.setncattr('units', 'days')
def RX1day_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Highest 1-day precipitation amount')
var_nc.setncattr('units', 'mm')
def RX5day_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Highest 5-day precipitation amount')
var_nc.setncattr('units', 'mm')
def SD_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Mean of daily snow depth')
var_nc.setncattr('units', 'cm')
def SD1_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Number of days where the snow depth >= 1 cm')
var_nc.setncattr('units', 'days')
def SD5cm_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Number of days where the snow depth >= 5 cm')
var_nc.setncattr('units', 'days')
def SD50cm_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Number of days where the snow depth >= 50 cm')
var_nc.setncattr('units', 'days')
def FD_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Frost days (minimum temperature < 0 degrees)')
var_nc.setncattr('units', 'days')
def CFD_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Maximum number of consecutive frost days (minimum temperature < 0 degrees)')
var_nc.setncattr('units', 'days')
def ID_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Ice days (maximum temperature < 0 degrees)')
var_nc.setncattr('units', 'days')
def HD17_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Heating degree days (sum of 17 degrees - mean temperature)')
var_nc.setncattr('units', 'K')
def GD4_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Growing degree days (sum of TG > 4 degrees)')
var_nc.setncattr('units', 'K')
def GSL_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Growing season length')
var_nc.setncattr('units', 'days')
def TG90p_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Number of warm days')
var_nc.setncattr('units', 'days')
def TX90p_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Number of warm day-times')
var_nc.setncattr('units', 'days')
def TN90p_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Number of warm nights')
var_nc.setncattr('units', 'days')
def TG10p_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Number of cold days')
var_nc.setncattr('units', 'days')
def TX10p_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Number of cold day-times')
var_nc.setncattr('units', 'days')
def TN10p_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Number of cold nights')
var_nc.setncattr('units', 'days')
def WSDI_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Warm-spell duration index')
var_nc.setncattr('units', 'days')
def CSDI_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Cold-spell duration index')
var_nc.setncattr('units', 'days')
def R75p_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Moderate wet days')
var_nc.setncattr('units', 'days')
def R95p_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Very wet days')
var_nc.setncattr('units', 'days')
def R99p_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Extremely wet days')
var_nc.setncattr('units', 'days')
def R75pTOT_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Precipitation fraction due to moderate wet days')
var_nc.setncattr('units', '%')
def R95pTOT_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Precipitation fraction due to very wet days')
var_nc.setncattr('units', '%')
def R99pTOT_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Precipitation fraction due to extremely wet days')
var_nc.setncattr('units', '%')
def CD_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Cold and dry days')
var_nc.setncattr('units', 'days')
def CW_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Cold and wet days')
var_nc.setncattr('units', 'days')
def WD_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Warm and dry days')
var_nc.setncattr('units', 'days')
def WW_setvarattr(var_nc):
var_nc.setncattr('long_name', 'Warm and wet days')
var_nc.setncattr('units', 'days')
| 35.617225 | 120 | 0.704057 | 1,084 | 7,444 | 4.603321 | 0.137454 | 0.150301 | 0.280561 | 0.180361 | 0.857315 | 0.847094 | 0.827655 | 0.743086 | 0.592385 | 0.429259 | 0 | 0.010654 | 0.155159 | 7,444 | 208 | 121 | 35.788462 | 0.782795 | 0.029688 | 0 | 0.326667 | 0 | 0 | 0.375 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
aa9608db4d5302da4179e6d6614084827be2e80e | 24,561 | py | Python | sdk/python/pulumi_harvester/virtual_machine.py | huaxk/pulumi-harvester | 132af964d236173f5f4ec6cad8469dd3e7ac5389 | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2021-11-27T02:09:08.000Z | 2022-03-19T02:22:55.000Z | sdk/python/pulumi_harvester/virtual_machine.py | huaxk/pulumi-harvester | 132af964d236173f5f4ec6cad8469dd3e7ac5389 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_harvester/virtual_machine.py | huaxk/pulumi-harvester | 132af964d236173f5f4ec6cad8469dd3e7ac5389 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
from . import outputs
from ._inputs import *
__all__ = ['VirtualMachineArgs', 'VirtualMachine']
@pulumi.input_type
class VirtualMachineArgs:
def __init__(__self__, *,
disks: pulumi.Input[Sequence[pulumi.Input['VirtualMachineDiskArgs']]],
network_interfaces: pulumi.Input[Sequence[pulumi.Input['VirtualMachineNetworkInterfaceArgs']]],
cloudinit: Optional[pulumi.Input['VirtualMachineCloudinitArgs']] = None,
cpu: Optional[pulumi.Input[int]] = None,
description: Optional[pulumi.Input[str]] = None,
hostname: Optional[pulumi.Input[str]] = None,
machine_type: Optional[pulumi.Input[str]] = None,
memory: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
namespace: Optional[pulumi.Input[str]] = None,
ssh_keys: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
start: Optional[pulumi.Input[bool]] = None,
tags: Optional[pulumi.Input[Mapping[str, Any]]] = None):
"""
The set of arguments for constructing a VirtualMachine resource.
:param pulumi.Input[str] description: Any text you want that better describes this resource
:param pulumi.Input[str] name: A unique name
"""
pulumi.set(__self__, "disks", disks)
pulumi.set(__self__, "network_interfaces", network_interfaces)
if cloudinit is not None:
pulumi.set(__self__, "cloudinit", cloudinit)
if cpu is not None:
pulumi.set(__self__, "cpu", cpu)
if description is not None:
pulumi.set(__self__, "description", description)
if hostname is not None:
pulumi.set(__self__, "hostname", hostname)
if machine_type is not None:
pulumi.set(__self__, "machine_type", machine_type)
if memory is not None:
pulumi.set(__self__, "memory", memory)
if name is not None:
pulumi.set(__self__, "name", name)
if namespace is not None:
pulumi.set(__self__, "namespace", namespace)
if ssh_keys is not None:
pulumi.set(__self__, "ssh_keys", ssh_keys)
if start is not None:
pulumi.set(__self__, "start", start)
if tags is not None:
pulumi.set(__self__, "tags", tags)
@property
@pulumi.getter
def disks(self) -> pulumi.Input[Sequence[pulumi.Input['VirtualMachineDiskArgs']]]:
return pulumi.get(self, "disks")
@disks.setter
def disks(self, value: pulumi.Input[Sequence[pulumi.Input['VirtualMachineDiskArgs']]]):
pulumi.set(self, "disks", value)
@property
@pulumi.getter(name="networkInterfaces")
def network_interfaces(self) -> pulumi.Input[Sequence[pulumi.Input['VirtualMachineNetworkInterfaceArgs']]]:
return pulumi.get(self, "network_interfaces")
@network_interfaces.setter
def network_interfaces(self, value: pulumi.Input[Sequence[pulumi.Input['VirtualMachineNetworkInterfaceArgs']]]):
pulumi.set(self, "network_interfaces", value)
@property
@pulumi.getter
def cloudinit(self) -> Optional[pulumi.Input['VirtualMachineCloudinitArgs']]:
return pulumi.get(self, "cloudinit")
@cloudinit.setter
def cloudinit(self, value: Optional[pulumi.Input['VirtualMachineCloudinitArgs']]):
pulumi.set(self, "cloudinit", value)
@property
@pulumi.getter
def cpu(self) -> Optional[pulumi.Input[int]]:
return pulumi.get(self, "cpu")
@cpu.setter
def cpu(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "cpu", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
Any text you want that better describes this resource
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter
def hostname(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "hostname")
@hostname.setter
def hostname(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "hostname", value)
@property
@pulumi.getter(name="machineType")
def machine_type(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "machine_type")
@machine_type.setter
def machine_type(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "machine_type", value)
@property
@pulumi.getter
def memory(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "memory")
@memory.setter
def memory(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "memory", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
A unique name
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def namespace(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "namespace")
@namespace.setter
def namespace(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "namespace", value)
@property
@pulumi.getter(name="sshKeys")
def ssh_keys(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "ssh_keys")
@ssh_keys.setter
def ssh_keys(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "ssh_keys", value)
@property
@pulumi.getter
def start(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "start")
@start.setter
def start(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "start", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, Any]]]:
return pulumi.get(self, "tags")
@tags.setter
def tags(self, value: Optional[pulumi.Input[Mapping[str, Any]]]):
pulumi.set(self, "tags", value)
@pulumi.input_type
class _VirtualMachineState:
def __init__(__self__, *,
cloudinit: Optional[pulumi.Input['VirtualMachineCloudinitArgs']] = None,
cpu: Optional[pulumi.Input[int]] = None,
description: Optional[pulumi.Input[str]] = None,
disks: Optional[pulumi.Input[Sequence[pulumi.Input['VirtualMachineDiskArgs']]]] = None,
hostname: Optional[pulumi.Input[str]] = None,
machine_type: Optional[pulumi.Input[str]] = None,
memory: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
namespace: Optional[pulumi.Input[str]] = None,
network_interfaces: Optional[pulumi.Input[Sequence[pulumi.Input['VirtualMachineNetworkInterfaceArgs']]]] = None,
node_name: Optional[pulumi.Input[str]] = None,
ssh_keys: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
start: Optional[pulumi.Input[bool]] = None,
state: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, Any]]] = None):
"""
Input properties used for looking up and filtering VirtualMachine resources.
:param pulumi.Input[str] description: Any text you want that better describes this resource
:param pulumi.Input[str] name: A unique name
"""
if cloudinit is not None:
pulumi.set(__self__, "cloudinit", cloudinit)
if cpu is not None:
pulumi.set(__self__, "cpu", cpu)
if description is not None:
pulumi.set(__self__, "description", description)
if disks is not None:
pulumi.set(__self__, "disks", disks)
if hostname is not None:
pulumi.set(__self__, "hostname", hostname)
if machine_type is not None:
pulumi.set(__self__, "machine_type", machine_type)
if memory is not None:
pulumi.set(__self__, "memory", memory)
if name is not None:
pulumi.set(__self__, "name", name)
if namespace is not None:
pulumi.set(__self__, "namespace", namespace)
if network_interfaces is not None:
pulumi.set(__self__, "network_interfaces", network_interfaces)
if node_name is not None:
pulumi.set(__self__, "node_name", node_name)
if ssh_keys is not None:
pulumi.set(__self__, "ssh_keys", ssh_keys)
if start is not None:
pulumi.set(__self__, "start", start)
if state is not None:
pulumi.set(__self__, "state", state)
if tags is not None:
pulumi.set(__self__, "tags", tags)
@property
@pulumi.getter
def cloudinit(self) -> Optional[pulumi.Input['VirtualMachineCloudinitArgs']]:
return pulumi.get(self, "cloudinit")
@cloudinit.setter
def cloudinit(self, value: Optional[pulumi.Input['VirtualMachineCloudinitArgs']]):
pulumi.set(self, "cloudinit", value)
@property
@pulumi.getter
def cpu(self) -> Optional[pulumi.Input[int]]:
return pulumi.get(self, "cpu")
@cpu.setter
def cpu(self, value: Optional[pulumi.Input[int]]):
pulumi.set(self, "cpu", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
Any text you want that better describes this resource
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter
def disks(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['VirtualMachineDiskArgs']]]]:
return pulumi.get(self, "disks")
@disks.setter
def disks(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['VirtualMachineDiskArgs']]]]):
pulumi.set(self, "disks", value)
@property
@pulumi.getter
def hostname(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "hostname")
@hostname.setter
def hostname(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "hostname", value)
@property
@pulumi.getter(name="machineType")
def machine_type(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "machine_type")
@machine_type.setter
def machine_type(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "machine_type", value)
@property
@pulumi.getter
def memory(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "memory")
@memory.setter
def memory(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "memory", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
A unique name
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def namespace(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "namespace")
@namespace.setter
def namespace(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "namespace", value)
@property
@pulumi.getter(name="networkInterfaces")
def network_interfaces(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['VirtualMachineNetworkInterfaceArgs']]]]:
return pulumi.get(self, "network_interfaces")
@network_interfaces.setter
def network_interfaces(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['VirtualMachineNetworkInterfaceArgs']]]]):
pulumi.set(self, "network_interfaces", value)
@property
@pulumi.getter(name="nodeName")
def node_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "node_name")
@node_name.setter
def node_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "node_name", value)
@property
@pulumi.getter(name="sshKeys")
def ssh_keys(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "ssh_keys")
@ssh_keys.setter
def ssh_keys(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "ssh_keys", value)
@property
@pulumi.getter
def start(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "start")
@start.setter
def start(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "start", value)
@property
@pulumi.getter
def state(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "state")
@state.setter
def state(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "state", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, Any]]]:
return pulumi.get(self, "tags")
@tags.setter
def tags(self, value: Optional[pulumi.Input[Mapping[str, Any]]]):
pulumi.set(self, "tags", value)
class VirtualMachine(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
cloudinit: Optional[pulumi.Input[pulumi.InputType['VirtualMachineCloudinitArgs']]] = None,
cpu: Optional[pulumi.Input[int]] = None,
description: Optional[pulumi.Input[str]] = None,
disks: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['VirtualMachineDiskArgs']]]]] = None,
hostname: Optional[pulumi.Input[str]] = None,
machine_type: Optional[pulumi.Input[str]] = None,
memory: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
namespace: Optional[pulumi.Input[str]] = None,
network_interfaces: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['VirtualMachineNetworkInterfaceArgs']]]]] = None,
ssh_keys: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
start: Optional[pulumi.Input[bool]] = None,
tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
__props__=None):
"""
## Import
```sh
$ pulumi import harvester:index/virtualMachine:VirtualMachine foo <Namespace>/<Name>
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] description: Any text you want that better describes this resource
:param pulumi.Input[str] name: A unique name
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: VirtualMachineArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
## Import
```sh
$ pulumi import harvester:index/virtualMachine:VirtualMachine foo <Namespace>/<Name>
```
:param str resource_name: The name of the resource.
:param VirtualMachineArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(VirtualMachineArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
cloudinit: Optional[pulumi.Input[pulumi.InputType['VirtualMachineCloudinitArgs']]] = None,
cpu: Optional[pulumi.Input[int]] = None,
description: Optional[pulumi.Input[str]] = None,
disks: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['VirtualMachineDiskArgs']]]]] = None,
hostname: Optional[pulumi.Input[str]] = None,
machine_type: Optional[pulumi.Input[str]] = None,
memory: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
namespace: Optional[pulumi.Input[str]] = None,
network_interfaces: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['VirtualMachineNetworkInterfaceArgs']]]]] = None,
ssh_keys: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
start: Optional[pulumi.Input[bool]] = None,
tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
__props__=None):
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = VirtualMachineArgs.__new__(VirtualMachineArgs)
__props__.__dict__["cloudinit"] = cloudinit
__props__.__dict__["cpu"] = cpu
__props__.__dict__["description"] = description
if disks is None and not opts.urn:
raise TypeError("Missing required property 'disks'")
__props__.__dict__["disks"] = disks
__props__.__dict__["hostname"] = hostname
__props__.__dict__["machine_type"] = machine_type
__props__.__dict__["memory"] = memory
__props__.__dict__["name"] = name
__props__.__dict__["namespace"] = namespace
if network_interfaces is None and not opts.urn:
raise TypeError("Missing required property 'network_interfaces'")
__props__.__dict__["network_interfaces"] = network_interfaces
__props__.__dict__["ssh_keys"] = ssh_keys
__props__.__dict__["start"] = start
__props__.__dict__["tags"] = tags
__props__.__dict__["node_name"] = None
__props__.__dict__["state"] = None
super(VirtualMachine, __self__).__init__(
'harvester:index/virtualMachine:VirtualMachine',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
cloudinit: Optional[pulumi.Input[pulumi.InputType['VirtualMachineCloudinitArgs']]] = None,
cpu: Optional[pulumi.Input[int]] = None,
description: Optional[pulumi.Input[str]] = None,
disks: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['VirtualMachineDiskArgs']]]]] = None,
hostname: Optional[pulumi.Input[str]] = None,
machine_type: Optional[pulumi.Input[str]] = None,
memory: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
namespace: Optional[pulumi.Input[str]] = None,
network_interfaces: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['VirtualMachineNetworkInterfaceArgs']]]]] = None,
node_name: Optional[pulumi.Input[str]] = None,
ssh_keys: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
start: Optional[pulumi.Input[bool]] = None,
state: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, Any]]] = None) -> 'VirtualMachine':
"""
Get an existing VirtualMachine resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] description: Any text you want that better describes this resource
:param pulumi.Input[str] name: A unique name
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _VirtualMachineState.__new__(_VirtualMachineState)
__props__.__dict__["cloudinit"] = cloudinit
__props__.__dict__["cpu"] = cpu
__props__.__dict__["description"] = description
__props__.__dict__["disks"] = disks
__props__.__dict__["hostname"] = hostname
__props__.__dict__["machine_type"] = machine_type
__props__.__dict__["memory"] = memory
__props__.__dict__["name"] = name
__props__.__dict__["namespace"] = namespace
__props__.__dict__["network_interfaces"] = network_interfaces
__props__.__dict__["node_name"] = node_name
__props__.__dict__["ssh_keys"] = ssh_keys
__props__.__dict__["start"] = start
__props__.__dict__["state"] = state
__props__.__dict__["tags"] = tags
return VirtualMachine(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter
def cloudinit(self) -> pulumi.Output[Optional['outputs.VirtualMachineCloudinit']]:
return pulumi.get(self, "cloudinit")
@property
@pulumi.getter
def cpu(self) -> pulumi.Output[Optional[int]]:
return pulumi.get(self, "cpu")
@property
@pulumi.getter
def description(self) -> pulumi.Output[Optional[str]]:
"""
Any text you want that better describes this resource
"""
return pulumi.get(self, "description")
@property
@pulumi.getter
def disks(self) -> pulumi.Output[Sequence['outputs.VirtualMachineDisk']]:
return pulumi.get(self, "disks")
@property
@pulumi.getter
def hostname(self) -> pulumi.Output[str]:
return pulumi.get(self, "hostname")
@property
@pulumi.getter(name="machineType")
def machine_type(self) -> pulumi.Output[str]:
return pulumi.get(self, "machine_type")
@property
@pulumi.getter
def memory(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "memory")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
A unique name
"""
return pulumi.get(self, "name")
@property
@pulumi.getter
def namespace(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "namespace")
@property
@pulumi.getter(name="networkInterfaces")
def network_interfaces(self) -> pulumi.Output[Sequence['outputs.VirtualMachineNetworkInterface']]:
return pulumi.get(self, "network_interfaces")
@property
@pulumi.getter(name="nodeName")
def node_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "node_name")
@property
@pulumi.getter(name="sshKeys")
def ssh_keys(self) -> pulumi.Output[Optional[Sequence[str]]]:
return pulumi.get(self, "ssh_keys")
@property
@pulumi.getter
def start(self) -> pulumi.Output[Optional[bool]]:
return pulumi.get(self, "start")
@property
@pulumi.getter
def state(self) -> pulumi.Output[str]:
return pulumi.get(self, "state")
@property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[str, Any]]]:
return pulumi.get(self, "tags")
| 39.550725 | 147 | 0.632425 | 2,672 | 24,561 | 5.590569 | 0.060254 | 0.120766 | 0.151359 | 0.091311 | 0.863904 | 0.84101 | 0.797162 | 0.781899 | 0.752577 | 0.723725 | 0 | 0.000054 | 0.244656 | 24,561 | 620 | 148 | 39.614516 | 0.805142 | 0.079435 | 0 | 0.807203 | 1 | 0 | 0.103388 | 0.040011 | 0 | 0 | 0 | 0 | 0 | 1 | 0.165254 | false | 0.002119 | 0.014831 | 0.07839 | 0.279661 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
2ae409171b4ac898042f798b756f4dbf15601a81 | 16,424 | py | Python | pypom_form/tests/test_widgets.py | Ash1sh27/pypom_form | 5f2e838ef473ae089e939146db72be031a14edc3 | [
"Apache-2.0"
] | 8 | 2016-11-23T08:44:57.000Z | 2018-01-19T14:19:51.000Z | pypom_form/tests/test_widgets.py | Ash1sh27/pypom_form | 5f2e838ef473ae089e939146db72be031a14edc3 | [
"Apache-2.0"
] | 118 | 2016-11-29T09:05:32.000Z | 2017-11-16T02:06:17.000Z | pypom_form/tests/test_widgets.py | Ash1sh27/pypom_form | 5f2e838ef473ae089e939146db72be031a14edc3 | [
"Apache-2.0"
] | 1 | 2017-10-04T08:29:17.000Z | 2017-10-04T08:29:17.000Z | import pytest
import mock
def test_base_widget_1():
""" Assert widget is None """
from pypom_form.widgets import BaseWidget
widget = BaseWidget()
assert widget.field is None
def test_base_widget_2():
""" Assert options are stored """
from pypom_form.widgets import BaseWidget
widget = BaseWidget(options={'test': 1})
assert widget.options['test'] == 1
def test_base_widget_3():
""" Assert getter method is required """
from pypom_form.widgets import BaseWidget
widget = BaseWidget()
assert callable(widget.getter_factory)
with pytest.raises(NotImplementedError):
widget.getter_factory()
def test_base_widget_4():
""" Assert setter method is required """
from pypom_form.widgets import BaseWidget
widget = BaseWidget()
assert callable(widget.setter_factory)
with pytest.raises(NotImplementedError):
widget.setter_factory()
def test_string_widget_1():
""" Assert getter is implemented """
from pypom_form.widgets import StringWidget
import colander
widget_class = StringWidget
mock_field = colander.SchemaNode(
colander.String(),
selector=('id', 'id1'),
)
widget = widget_class(field=mock_field)
get_input_element_mock = mock.MagicMock()
get_input_element_mock.configure_mock(**{
'return_value.value': 'test ok'})
widget.get_input_element = get_input_element_mock
getter = widget.getter_factory()
page_mock = mock.MagicMock()
page_mock.__class__.getter = property(fget=getter)
assert page_mock.getter == 'test ok'
def test_string_widget_2():
""" Assert setter is implemented """
from pypom_form.widgets import StringWidget
import colander
widget_class = StringWidget
mock_field = colander.SchemaNode(
colander.String(),
selector=('id', 'id1'),
)
widget = widget_class(field=mock_field)
get_input_element_mock = mock.MagicMock()
widget.get_input_element = get_input_element_mock
setter = widget.setter_factory()
page_mock = mock.MagicMock()
page_mock.__class__.setter = property(fset=setter)
page_mock.setter = 'test ok'
assert get_input_element_mock. \
return_value.fill.assert_called_once_with('test ok') is None
def test_textarea_widget_1():
""" Assert getter is implemented """
from pypom_form.widgets import TextAreaWidget
import colander
widget_class = TextAreaWidget
mock_field = colander.SchemaNode(
colander.String(),
selector=('id', 'id1'),
pypom_widget=TextAreaWidget(),
)
widget = widget_class(field=mock_field)
get_input_element_mock = mock.MagicMock()
get_input_element_mock.configure_mock(**{
'return_value.value': 'test ok'})
widget.get_input_element = get_input_element_mock
getter = widget.getter_factory()
page_mock = mock.MagicMock()
page_mock.__class__.getter = property(fget=getter)
assert page_mock.getter == 'test ok'
def test_textarea_widget_2():
""" Assert setter is implemented """
from pypom_form.widgets import TextAreaWidget
import colander
widget_class = TextAreaWidget
mock_field = colander.SchemaNode(
colander.String(),
selector=('id', 'id1'),
pypom_widget=TextAreaWidget(),
)
widget = widget_class(field=mock_field)
get_input_element_mock = mock.MagicMock()
widget.get_input_element = get_input_element_mock
setter = widget.setter_factory()
page_mock = mock.MagicMock()
page_mock.__class__.setter = property(fset=setter)
page_mock.setter = 'test ok'
assert get_input_element_mock. \
return_value.fill.assert_called_once_with('test ok') is None
def test_checkbox_widget_1():
""" Assert getter is implemented """
from pypom_form.widgets import CheckboxWidget
import colander
widget_class = CheckboxWidget
mock_field = colander.SchemaNode(
colander.Bool(),
selector=('id', 'id1'),
)
widget = widget_class(field=mock_field)
get_input_element_mock = mock.MagicMock()
get_input_element_mock.configure_mock(**{
'return_value.checked': True})
widget.get_input_element = get_input_element_mock
getter = widget.getter_factory()
page_mock = mock.MagicMock()
page_mock.__class__.getter = property(fget=getter)
assert page_mock.getter is True
def test_checkbox_widget_2():
""" Assert setter is implemented. Set True, True """
from pypom_form.widgets import CheckboxWidget
import colander
widget_class = CheckboxWidget
mock_field = colander.SchemaNode(
colander.Bool(),
selector=('id', 'id1'),
)
widget = widget_class(field=mock_field)
get_input_element_mock = mock.MagicMock()
widget.get_input_element = get_input_element_mock
setter = widget.setter_factory()
page_mock = mock.MagicMock()
page_mock.__class__.setter = property(fset=setter)
page_mock.setter = True
# let's set True twice
page_mock.setter = True
assert get_input_element_mock. \
return_value.check.call_count == 2
assert get_input_element_mock. \
return_value.uncheck.call_count == 0
def test_checkbox_widget_3():
""" Assert setter is implemented. Set True, False """
from pypom_form.widgets import CheckboxWidget
import colander
widget_class = CheckboxWidget
mock_field = colander.SchemaNode(
colander.Bool(),
selector=('id', 'id1'),
)
widget = widget_class(field=mock_field)
get_input_element_mock = mock.MagicMock()
widget.get_input_element = get_input_element_mock
setter = widget.setter_factory()
page_mock = mock.MagicMock()
page_mock.__class__.setter = property(fset=setter)
page_mock.setter = True
# let's set False now
page_mock.setter = False
assert get_input_element_mock. \
return_value.check.call_count == 1
assert get_input_element_mock. \
return_value.uncheck.call_count == 1
def test_integer_widget_1():
""" Assert getter is implemented """
from pypom_form.widgets import StringWidget
import colander
widget_class = StringWidget
mock_field = colander.SchemaNode(
colander.Int(),
selector=('id', 'id1'),
)
widget = widget_class(field=mock_field)
get_input_element_mock = mock.MagicMock()
get_input_element_mock.configure_mock(**{
'return_value.value': '1'})
widget.get_input_element = get_input_element_mock
getter = widget.getter_factory()
page_mock = mock.MagicMock()
page_mock.__class__.getter = property(fget=getter)
assert page_mock.getter == 1
def test_integer_widget_2():
""" Assert setter is implemented """
from pypom_form.widgets import StringWidget
import colander
widget_class = StringWidget
mock_field = colander.SchemaNode(
colander.Int(),
selector=('id', 'id1'),
)
get_input_element_mock = mock.MagicMock()
widget = widget_class(field=mock_field)
widget.get_input_element = get_input_element_mock
setter = widget.setter_factory()
page_mock = mock.MagicMock()
page_mock.__class__.setter = property(fset=setter)
page_mock.setter = 1
assert get_input_element_mock. \
return_value.fill.assert_called_once_with('1') is None
def test_float_widget_1():
""" Assert getter is implemented """
from pypom_form.widgets import StringWidget
import colander
widget_class = StringWidget
mock_field = colander.SchemaNode(
colander.Float(),
selector=('id', 'id1'),
)
widget = widget_class(field=mock_field)
get_input_element_mock = mock.MagicMock()
get_input_element_mock.configure_mock(**{
'return_value.value': '-1.1'})
widget.get_input_element = get_input_element_mock
getter = widget.getter_factory()
page_mock = mock.MagicMock()
page_mock.__class__.getter = property(fget=getter)
assert page_mock.getter == -1.1
def test_float_widget_2():
""" Assert setter is implemented """
from pypom_form.widgets import StringWidget
import colander
widget_class = StringWidget
mock_field = colander.SchemaNode(
colander.Float(),
selector=('id', 'id1'),
)
get_input_element_mock = mock.MagicMock()
widget = widget_class(field=mock_field)
widget.get_input_element = get_input_element_mock
setter = widget.setter_factory()
page_mock = mock.MagicMock()
page_mock.__class__.setter = property(fset=setter)
page_mock.setter = -1.1
assert get_input_element_mock. \
return_value.fill.assert_called_once_with('-1.1') is None
def test_region_widget_not_implemented(browser):
""" Region widget """
import colander
from pypom_form.widgets import StringWidget
class MyStringWidget(StringWidget):
pass
class BaseFormSchema(colander.MappingSchema):
title = colander.SchemaNode(colander.String(),
selector=('id', 'id1'))
class SubFormSchema(BaseFormSchema):
name = colander.SchemaNode(colander.String(),
selector=('id', 'id2'),
pwidget=MyStringWidget(
options={'test': 1}))
from pypom_form.form import BaseFormPage
class SubFormPage(BaseFormPage):
schema_factory = SubFormSchema
subform = SubFormPage(browser)
from pypom_form.widgets import BaseWidgetRegion
with mock.patch(
'pypom_form.widgets.BaseWidgetRegion.wait_for_region_to_load') \
as wait_for_region_to_load:
wait_for_region_to_load.configure_mock(**{'return_value': None})
widget_region = BaseWidgetRegion(subform)
with pytest.raises(NotImplementedError):
widget_region.get_help()
with pytest.raises(NotImplementedError):
widget_region.get_validation_errors()
def test_region_widget_get_label(browser):
""" Region widget """
import colander
from pypom_form.widgets import StringWidget
class MyStringWidget(StringWidget):
pass
class BaseFormSchema(colander.MappingSchema):
title = colander.SchemaNode(colander.String(),
selector=('id', 'id1'))
class SubFormSchema(BaseFormSchema):
name = colander.SchemaNode(colander.String(),
selector=('id', 'id2'),
pwidget=MyStringWidget(
options={'test': 1}))
from pypom_form.form import BaseFormPage
class SubFormPage(BaseFormPage):
schema_factory = SubFormSchema
subform = SubFormPage(browser)
from pypom_form.widgets import BaseWidgetRegion
with mock.patch(
'pypom_form.widgets.BaseWidgetRegion.wait_for_region_to_load') \
as wait_for_region_to_load:
wait_for_region_to_load.configure_mock(**{'return_value': None})
widget_region = BaseWidgetRegion(subform)
widget_region.find_element = mock.MagicMock(**{
'return_value.value': 'title'})
assert widget_region.get_label() == 'title'
def test_widget_base_region_class():
from pypom_form.widgets import BaseWidget
from pypom_form.widgets import BaseWidgetRegion
assert BaseWidget.region_class == BaseWidgetRegion
widget = BaseWidget()
assert widget.region_class == BaseWidgetRegion
def test_widget_base_region_class_custom():
from pypom_form.widgets import BaseWidget
import pypom
widget = BaseWidget(region_class=pypom.Region)
assert widget.region_class == pypom.Region
def test_widget_base_input_selector_raises():
from pypom_form.widgets import BaseWidget
widget = BaseWidget()
with pytest.raises(NotImplementedError):
widget.input_selector
def test_widget_string_input_selector():
from pypom_form.widgets import StringWidget
widget = StringWidget()
assert widget.input_selector == ('tag', 'input')
def test_widget_checkbox_input_selector():
from pypom_form.widgets import CheckboxWidget
widget = CheckboxWidget()
assert widget.input_selector == ('css', 'input[type="checkbox"]')
def test_widget_region_root_selector(browser):
from pypom_form.widgets import BaseWidget
from pypom_form.widgets import BaseWidgetRegion
assert BaseWidget.region_class == BaseWidgetRegion
field = mock.MagicMock(**{'selector': ('id', 'xyz')})
widget = BaseWidget(field=field)
import pypom
page = pypom.Page(browser)
with mock.patch(
'pypom_form.widgets.BaseWidgetRegion.wait_for_region_to_load') \
as wait_for_region_to_load:
wait_for_region_to_load.configure_mock(**{'return_value': None})
assert widget.getWidgetRegion(page)._root_locator == ('id', 'xyz')
def test_widget_region_widget_reference(browser):
from pypom_form.widgets import BaseWidget
from pypom_form.widgets import BaseWidgetRegion
assert BaseWidget.region_class == BaseWidgetRegion
field = mock.MagicMock(**{'selector': ('id', 'xyz')})
widget = BaseWidget(field=field)
import pypom
page = pypom.Page(browser)
with mock.patch(
'pypom_form.widgets.BaseWidgetRegion.wait_for_region_to_load') \
as wait_for_region_to_load:
wait_for_region_to_load.configure_mock(**{'return_value': None})
assert widget.getWidgetRegion(page).__pypom_widget__ == widget
def test_get_input_element(browser):
from pypom_form.widgets import StringWidget
widget = StringWidget()
widget.getWidgetRegion = mock.MagicMock(
**{'return_value.find_element.return_value': 'element'})
import pypom
page = pypom.Page(browser)
widget.get_input_element(page) == 'element'
def test_get_input_element_no_container(browser):
from pypom_form.widgets import StringWidget
widget = StringWidget()
widget.getWidgetRegion = mock.MagicMock(
**{'return_value.find_element.return_value': None,
'return_value.root': 'root'})
import pypom
page = pypom.Page(browser)
widget.get_input_element(page) == 'root'
def test_widget_region_wait_timeout(browser):
import colander
from pypom_form.widgets import StringWidget
class MyStringWidget(StringWidget):
pass
class BaseFormSchema(colander.MappingSchema):
title = colander.SchemaNode(colander.String(),
selector=('id', 'id1'))
class SubFormSchema(BaseFormSchema):
name = colander.SchemaNode(colander.String(),
selector=('id', 'id2'),
pwidget=MyStringWidget(
options={'test': 1}))
from pypom_form.form import BaseFormPage
class SubFormPage(BaseFormPage):
schema_factory = SubFormSchema
subform = SubFormPage(browser)
subform.timeout = 0
from pypom_form.widgets import BaseWidgetRegion
with mock.patch(
'pypom_form.widgets.BaseWidgetRegion.root') \
as root:
root.configure_mock(**{'visible': False})
from selenium.common.exceptions import TimeoutException
with pytest.raises(TimeoutException):
BaseWidgetRegion(subform)
def test_widget_region_wait_not_timeout(browser):
import colander
from pypom_form.widgets import StringWidget
class MyStringWidget(StringWidget):
pass
class BaseFormSchema(colander.MappingSchema):
title = colander.SchemaNode(colander.String(),
selector=('id', 'id1'))
class SubFormSchema(BaseFormSchema):
name = colander.SchemaNode(colander.String(),
selector=('id', 'id2'),
pwidget=MyStringWidget(
options={'test': 1}))
from pypom_form.form import BaseFormPage
class SubFormPage(BaseFormPage):
schema_factory = SubFormSchema
subform = SubFormPage(browser)
subform.timeout = 0
from pypom_form.widgets import BaseWidgetRegion
with mock.patch(
'pypom_form.widgets.BaseWidgetRegion.root') \
as root:
root.configure_mock(**{'visible': True})
BaseWidgetRegion(subform)
| 29.120567 | 76 | 0.680955 | 1,837 | 16,424 | 5.790419 | 0.066413 | 0.037605 | 0.070509 | 0.065808 | 0.886152 | 0.868572 | 0.842907 | 0.828617 | 0.813481 | 0.808029 | 0 | 0.004564 | 0.226254 | 16,424 | 563 | 77 | 29.172291 | 0.832468 | 0.033609 | 0 | 0.777778 | 0 | 0 | 0.054668 | 0.026256 | 0 | 0 | 0 | 0 | 0.080103 | 1 | 0.072351 | false | 0.010336 | 0.160207 | 0 | 0.30491 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
2af3765b6e16219e05ab5c646c6f0a12bcc0ed75 | 18,655 | py | Python | Python Scripts/KNN Re-Ranking.py | RajanPatel97/Representation-and-Distance-Metric-Learning | 67c3386faeff57cd64fbe41767483f2d3f0efebb | [
"MIT"
] | null | null | null | Python Scripts/KNN Re-Ranking.py | RajanPatel97/Representation-and-Distance-Metric-Learning | 67c3386faeff57cd64fbe41767483f2d3f0efebb | [
"MIT"
] | null | null | null | Python Scripts/KNN Re-Ranking.py | RajanPatel97/Representation-and-Distance-Metric-Learning | 67c3386faeff57cd64fbe41767483f2d3f0efebb | [
"MIT"
] | 1 | 2019-12-03T18:50:44.000Z | 2019-12-03T18:50:44.000Z |
# coding: utf-8
# In[1]:
import numpy as np
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
#Store Data Variables
import json
with open('feature_data.json', 'r') as f:
features = json.load(f)
from scipy.io import loadmat
train_idxs = loadmat('cuhk03_new_protocol_config_labeled.mat')['train_idx'].flatten()
query_idxs = loadmat('cuhk03_new_protocol_config_labeled.mat')['query_idx'].flatten()
labels = loadmat('cuhk03_new_protocol_config_labeled.mat')['labels'].flatten()
gallery_idxs = loadmat('cuhk03_new_protocol_config_labeled.mat')['gallery_idx'].flatten()
filelist = loadmat('cuhk03_new_protocol_config_labeled.mat')['filelist'].flatten()
camId = loadmat('cuhk03_new_protocol_config_labeled.mat')['camId'].flatten()
# In[9]:
X = np.array(features)
y = np.array(labels)
filelist = np.array(filelist)
camId = np.array(camId)
# In[10]:
mask_train = np.array(train_idxs).ravel()
mask_query = np.array(query_idxs).ravel()
mask_gallery = np.array(gallery_idxs).ravel()
mask_train = np.subtract(mask_train, 1)
mask_query = np.subtract(mask_query, 1)
mask_gallery = np.subtract(mask_gallery, 1)
X_train, X_query, X_gallery = X[mask_train, :], X[mask_query, :], X[mask_gallery, :]
y_train, y_query, y_gallery = y[mask_train], y[mask_query], y[mask_gallery]
filelist_train, filelist_query, filelist_gallery = filelist[mask_train], filelist[mask_query], filelist[mask_gallery]
camId_train, camId_query, camId_gallery = camId[mask_train], camId[mask_query], camId[mask_gallery]
# In[72]:
def get_acc_score(y_valid, y_q, tot_label_occur):
recall = 0
true_positives = 0
k = 0
max_rank = 30
rank_A = np.zeros(max_rank)
AP_arr = np.zeros(11)
while ((recall < 1) or (k < max_rank)) and (k < y_valid.shape[0]):
if (y_valid[k] == y_q):
true_positives = true_positives + 1
recall = true_positives/tot_label_occur
precision = true_positives/(k+1)
AP_arr[round((recall-0.05)*10)] = precision
for n in range (k, max_rank):
rank_A[n] = 1
k = k+1
max_precision = 0
for i in range(10, -1, -1):
max_precision = max(max_precision, AP_arr[i])
AP_arr[i] = max_precision
AP_ = AP_arr.sum()/11
return AP_, rank_A
# In[122]:
from scipy.spatial import distance
from sklearn.metrics import pairwise
def evaluate_metric_rerank(X_query, camId_query, y_query, X_gallery, camId_gallery, y_gallery, metric = 'euclidian', parameters = None):
rank_accuracies = []
AP = []
max_rank = parameters
# Break condition for testing
#q = 0
for query, camId_q, y_q in zip(X_query, camId_query, y_query):
q_g_dists = []
y_valid = []
X_valid = []
for gallery, camId_g, y_g in zip(X_gallery, camId_gallery, y_gallery):
if ((camId_q == camId_g) and (y_q == y_g)):
continue
else:
if metric == 'sqeuclidean':
dist = distance.sqeuclidean(query, gallery)
else:
raise NameError('Specified metric not supported')
q_g_dists.append(dist)
y_valid.append(y_g)
X_valid.append(gallery)
q_g_dists = np.array(q_g_dists)
y_valid = np.array(y_valid)
X_valid = np.array(X_valid)
_indexes = np.argsort(q_g_dists)
# Sorted distances and labels
q_g_dists, y_valid, X_valid = q_g_dists[_indexes], y_valid[_indexes], X_valid[_indexes]
print ('\n')
print ('Looking for: ', y_q)
print ('Initial:\t', y_valid[0:10])
final_ranklist_labels = []
for gal1, dist_, y in zip(X_valid[0:max_rank-1], q_g_dists[0:max_rank-1], y_valid[0:max_rank-1]):
reciprocal_dists = []
for gal2 in X_valid[0:max_rank+150]:
if (np.array_equal(gal1, gal2)):
continue
else:
dist = distance.sqeuclidean(gal1, gal2)
reciprocal_dists.append(dist)
reciprocal_dists = np.array(reciprocal_dists)
_indexes = np.argsort(reciprocal_dists)
reciprocal_dists = reciprocal_dists[_indexes]
if dist_ < reciprocal_dists[max_rank-1]:
final_ranklist_labels.append(y)
tot_label_occur = final_ranklist_labels.count(y_q)
final_ranklist_labels = np.array(final_ranklist_labels)
print('After:\t\t', final_ranklist_labels[0:10])
AP_, rank_A = get_acc_score(final_ranklist_labels, y_q, tot_label_occur)
AP.append(AP_)
rank_accuracies.append(rank_A)
#if q > 5:
# break
#q = q+1
rank_accuracies = np.array(rank_accuracies)
total = rank_accuracies.shape[0]
rank_accuracies = rank_accuracies.sum(axis = 0)
rank_accuracies = np.divide(rank_accuracies, total)
i = 0
print ('Accuracies by Rank:')
while i < rank_accuracies.shape[0]:
print('Rank ', i+1, ' = %.2f%%' % (rank_accuracies[i] * 100), '\t',
'Rank ', i+2, ' = %.2f%%' % (rank_accuracies[i+1] * 100), '\t',
'Rank ', i+3, ' = %.2f%%' % (rank_accuracies[i+2] * 100), '\t',
'Rank ', i+4, ' = %.2f%%' % (rank_accuracies[i+3] * 100), '\t',
'Rank ', i+5, ' = %.2f%%' % (rank_accuracies[i+4] * 100))
i = i+5
AP = np.array(AP)
mAP = AP.sum()/AP.shape[0]
print('mAP = %.2f%%' % (mAP * 100))
return rank_accuracies, mAP
# In[123]:
rank_accuracies_l = []
mAP_l = []
metric_l = []
# In[128]:
k_rn = 10
# Re-Ranking
rank_accuracies, mAP = evaluate_metric_rerank(X_query, camId_query, y_query,
X_gallery, camId_gallery, y_gallery,
metric ='sqeuclidean',
parameters = k_rn)
rank_accuracies_l.append(rank_accuracies)
mAP_l.append(mAP)
metric_l.append('ReRank')
# In[ ]:
plt.figure(figsize=(8.0, 6.0))
color_list = ['green', 'blue', 'red', 'purple', 'orange', 'magenta', 'cyan', 'black', 'indianred', 'lightseagreen', 'gold', 'lightgreen']
for i in range(len(metric_l)):
plt.plot(np.arange(1, 31), 100*rank_accuracies_l[i], color=color_list[i], linestyle='dashed', label='k : '+str(metric_l[i]))
plt.title('CMC Curves for a range of standard distance metrics')
plt.xlabel('Rank')
plt.ylabel('Recogniton Accuracy / %')
plt.legend(loc='best')
# In[228]:
from scipy.spatial import distance
from sklearn.metrics import pairwise
from sklearn.neighbors import NearestNeighbors
def evaluate_metric_rerank_improved(X_query, camId_query, y_query, X_gallery, camId_gallery, y_gallery, metric = 'euclidian', parameters = None):
rank_accuracies = []
AP = []
max_rank = parameters
# Break condition for testing
q = 0
for query, camId_q, y_q in zip(X_query, camId_query, y_query):
q_g_dists = []
y_valid = []
X_valid = []
for gallery, camId_g, y_g in zip(X_gallery, camId_gallery, y_gallery):
if ((camId_q == camId_g) and (y_q == y_g)):
continue
else:
if metric == 'sqeuclidean':
dist = distance.sqeuclidean(query, gallery)
else:
raise NameError('Specified metric not supported')
q_g_dists.append(dist)
y_valid.append(y_g)
X_valid.append(gallery)
q_g_dists = np.array(q_g_dists)
y_valid = np.array(y_valid)
X_valid = np.array(X_valid)
_indexes = np.argsort(q_g_dists)
# Sorted distances and labels
q_g_dists, y_valid, X_valid = q_g_dists[_indexes], y_valid[_indexes], X_valid[_indexes]
#print ('\n')
#print ('Looking for: ', y_q)
#print ('Initial:\t', y_valid[0:10])
initial_ranklist_labels = []
initial_ranklist_elements = []
for gal1, dist_, y in zip(X_valid[0:max_rank-1], q_g_dists[0:max_rank-1], y_valid[0:max_rank-1]):
reciprocal_dists = []
for gal2 in X_valid[0:max_rank+150]:
if (np.array_equal(gal1, gal2)):
continue
else:
dist = distance.sqeuclidean(gal1, gal2)
reciprocal_dists.append(dist)
reciprocal_dists = np.array(reciprocal_dists)
_indexes = np.argsort(reciprocal_dists)
reciprocal_dists = reciprocal_dists[_indexes]
if dist_ < reciprocal_dists[max_rank-1]:
initial_ranklist_labels.append(y)
initial_ranklist_elements.append(gal1)
initial_ranklist_labels = np.array(initial_ranklist_labels)
initial_ranklist_elements = np.array(initial_ranklist_elements)
initial_ranklist_labels = list(initial_ranklist_labels)
print (initial_ranklist_labels)
if (len(initial_ranklist_labels) != 0):
nn = NearestNeighbors(n_neighbors = int(max_rank/2)+1)
nn.fit(X_valid[0:max_rank+150])
dist, indices = nn.kneighbors(initial_ranklist_elements, n_neighbors = int(max_rank/2)+1)
for indices_subset in indices:
for index in indices_subset[1:int(max_rank/2)+1]:
included = False
for x in initial_ranklist_elements:
if(np.array_equal(x, X_valid[index])):
included = True
if included == False:
initial_ranklist_elements = np.concatenate((initial_ranklist_elements, X_valid[index].reshape((-1, X_valid[index].shape[0]))))
initial_ranklist_labels.append(y_valid[index])
tot_label_occur = initial_ranklist_labels.count(y_q)
initial_ranklist_labels = np.array(initial_ranklist_labels)
#print('After:\t\t', initial_ranklist_labels[0:10])
AP_, rank_A = get_acc_score(initial_ranklist_labels, y_q, tot_label_occur)
AP.append(AP_)
rank_accuracies.append(rank_A)
#if q > 5:
# break
print ('Done query ', q)
q = q+1
rank_accuracies = np.array(rank_accuracies)
total = rank_accuracies.shape[0]
rank_accuracies = rank_accuracies.sum(axis = 0)
rank_accuracies = np.divide(rank_accuracies, total)
i = 0
print ('Accuracies by Rank:')
while i < rank_accuracies.shape[0]:
print('Rank ', i+1, ' = %.2f%%' % (rank_accuracies[i] * 100), '\t',
'Rank ', i+2, ' = %.2f%%' % (rank_accuracies[i+1] * 100), '\t',
'Rank ', i+3, ' = %.2f%%' % (rank_accuracies[i+2] * 100), '\t',
'Rank ', i+4, ' = %.2f%%' % (rank_accuracies[i+3] * 100), '\t',
'Rank ', i+5, ' = %.2f%%' % (rank_accuracies[i+4] * 100))
i = i+5
AP = np.array(AP)
mAP = AP.sum()/AP.shape[0]
print('mAP = %.2f%%' % (mAP * 100))
return rank_accuracies, mAP
# In[285]:
from scipy.spatial import distance
from sklearn.metrics import pairwise
from sklearn.neighbors import NearestNeighbors
def evaluate_metric_rerank_improved(X_query, camId_query, y_query, X_gallery, camId_gallery, y_gallery, metric = 'euclidian', parameters = None):
rank_accuracies = []
AP = []
max_rank = parameters
# Break condition for testing
q = 0
for query, camId_q, y_q in zip(X_query, camId_query, y_query):
q_g_dists = []
y_valid = []
X_valid = []
for gallery, camId_g, y_g in zip(X_gallery, camId_gallery, y_gallery):
if ((camId_q == camId_g) and (y_q == y_g)):
continue
else:
if metric == 'sqeuclidean':
dist = distance.sqeuclidean(query, gallery)
else:
raise NameError('Specified metric not supported')
q_g_dists.append(dist)
y_valid.append(y_g)
X_valid.append(gallery)
q_g_dists = np.array(q_g_dists)
y_valid = np.array(y_valid)
X_valid = np.array(X_valid)
_indexes = np.argsort(q_g_dists)
# Sorted distances and labels
q_g_dists, y_valid, X_valid = q_g_dists[_indexes], y_valid[_indexes], X_valid[_indexes]
#print ('\n')
#print ('Looking for: ', y_q)
#print ('Initial:\t', y_valid[0:10])
final_ranklist_labels = []
final_ranklist_elements = []
for gal1, dist_, y in zip(X_valid[0:max_rank-1], q_g_dists[0:max_rank-1], y_valid[0:max_rank-1]):
reciprocal_dists = []
for gal2 in X_valid[0:max_rank+150]:
if (np.array_equal(gal1, gal2)):
continue
else:
dist = distance.sqeuclidean(gal1, gal2)
reciprocal_dists.append(dist)
reciprocal_dists = np.array(reciprocal_dists)
_indexes = np.argsort(reciprocal_dists)
reciprocal_dists = reciprocal_dists[_indexes]
if dist_ < reciprocal_dists[max_rank-1]:
final_ranklist_labels.append(y)
final_ranklist_elements.append(gal1)
final_ranklist_labels = np.array(final_ranklist_labels)
final_ranklist_elements = np.array(final_ranklist_elements)
initial_ranklist_labels = []
initial_ranklist_elements = []
nn = NearestNeighbors(n_neighbors = int(max_rank/2)+1)
nn.fit(X_valid[0:max_rank+150])
dist, indices = nn.kneighbors(X_valid[0:max_rank-1], n_neighbors = int(max_rank/2)+1)
for indices_subset in indices:
for index in indices_subset[1:int(max_rank/2)+1]:
included = False
for x in final_ranklist_elements:
if(np.array_equal(x, X_valid[index])):
included = True
if included == False:
initial_ranklist_elements.append(X_valid[index])
initial_ranklist_labels.append(y_valid[index])
initial_ranklist_labels = np.array(initial_ranklist_labels)
initial_ranklist_elements = np.array(initial_ranklist_elements)
if (final_ranklist_elements.shape[0] != 0) and (initial_ranklist_elements.shape[0] != 0):
final_ranklist_labels = np.concatenate((final_ranklist_labels, initial_ranklist_labels))
final_ranklist_elements = np.concatenate((final_ranklist_elements, initial_ranklist_elements))
elif (initial_ranklist_elements.shape[0] != 0):
final_ranklist_labels = initial_ranklist_labels
final_ranklist_elements = initial_ranklist_elements
tot_label_occur = list(final_ranklist_labels).count(y_q)
#print('After:\t\t', final_ranklist_labels[0:10])
AP_, rank_A = get_acc_score(final_ranklist_labels, y_q, tot_label_occur)
AP.append(AP_)
rank_accuracies.append(rank_A)
#if q > 5:
# break
print ('Done query ', q)
q = q+1
rank_accuracies = np.array(rank_accuracies)
total = rank_accuracies.shape[0]
rank_accuracies = rank_accuracies.sum(axis = 0)
rank_accuracies = np.divide(rank_accuracies, total)
i = 0
print ('Accuracies by Rank:')
while i < rank_accuracies.shape[0]:
print('Rank ', i+1, ' = %.2f%%' % (rank_accuracies[i] * 100), '\t',
'Rank ', i+2, ' = %.2f%%' % (rank_accuracies[i+1] * 100), '\t',
'Rank ', i+3, ' = %.2f%%' % (rank_accuracies[i+2] * 100), '\t',
'Rank ', i+4, ' = %.2f%%' % (rank_accuracies[i+3] * 100), '\t',
'Rank ', i+5, ' = %.2f%%' % (rank_accuracies[i+4] * 100))
i = i+5
AP = np.array(AP)
mAP = AP.sum()/AP.shape[0]
print('mAP = %.2f%%' % (mAP * 100))
return rank_accuracies, mAP
# In[286]:
rank_accuracies_l = []
mAP_l = []
metric_l = []
# In[287]:
k_rn = 5
# Re-Ranking
rank_accuracies, mAP = evaluate_metric_rerank_improved(X_query, camId_query, y_query,
X_gallery, camId_gallery, y_gallery,
metric ='sqeuclidean',
parameters = k_rn)
rank_accuracies_l.append(rank_accuracies)
mAP_l.append(mAP)
metric_l.append('ReRank')
# In[192]:
plt.figure(figsize=(8.0, 6.0))
color_list = ['green', 'blue', 'red', 'purple', 'orange', 'magenta', 'cyan', 'black', 'indianred', 'lightseagreen', 'gold', 'lightgreen']
for i in range(len(metric_l)):
plt.plot(np.arange(1, 31), 100*rank_accuracies_l[i], color=color_list[i], linestyle='dashed', label='k : '+str(metric_l[i]))
plt.title('CMC Curves for a range of standard distance metrics')
plt.xlabel('Rank')
plt.ylabel('Recogniton Accuracy / %')
plt.legend(loc='best')
# In[ ]:
rank_accuracy_base = np.array([47.00, 54.57, 59.64, 63.93, 66.86, 69.29, 71.14, 72.36, 73.71, 74.93, 75.86, 76.79, 77.71, 78.50, 79.07, 79.86, 80.64, 81.57, 82.29, 83.21, 83.50, 83.71, 84.00, 84.29, 84.79, 85.29, 85.64, 85.93, 86.07, 86.36])
# In[ ]:
plt.figure(figsize=(8.0, 6.0))
color_list = ['green', 'blue', 'red', 'purple', 'orange', 'magenta', 'cyan', 'black', 'indianred', 'lightseagreen', 'gold', 'lightgreen']
for i in range(len(num_clusters_l)):
plt.plot(np.arange(1, 31), 100*rank_accuracies_l[i], color=color_list[i], linestyle='dashed', label='k = '+str(num_clusters_l[i]))
plt.plot(np.arange(1, 31), rank_accuracy_base, color='darkorange', linestyle=':', label='kNN baseline')
plt.title('CMC Curves for a range of number of neigbours ($k$)')
plt.xlabel('Rank')
plt.ylabel('Recogniton Accuracy / %')
plt.legend(loc='best')
| 30.885762 | 241 | 0.574377 | 2,384 | 18,655 | 4.225252 | 0.104446 | 0.082001 | 0.016678 | 0.025315 | 0.814355 | 0.800556 | 0.774149 | 0.754691 | 0.714286 | 0.694331 | 0 | 0.035103 | 0.302117 | 18,655 | 603 | 242 | 30.936982 | 0.738613 | 0.035862 | 0 | 0.741176 | 0 | 0 | 0.077416 | 0.012708 | 0 | 0 | 0 | 0 | 0 | 1 | 0.011765 | false | 0 | 0.041176 | 0 | 0.064706 | 0.047059 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
2af682c45971eceb0122227ad1144940c5381617 | 17,704 | py | Python | code/data_oversampling.py | onealwj/KDD-Cup-2020-MultimodalitiesRecall | a68f396e1b5b4f675f248150c7971c727147c3b5 | [
"MIT"
] | 5 | 2020-07-14T03:08:43.000Z | 2021-01-29T07:46:03.000Z | code/data_oversampling.py | browserliu/KDD-Cup-2020-MultimodalitiesRecall | a68f396e1b5b4f675f248150c7971c727147c3b5 | [
"MIT"
] | null | null | null | code/data_oversampling.py | browserliu/KDD-Cup-2020-MultimodalitiesRecall | a68f396e1b5b4f675f248150c7971c727147c3b5 | [
"MIT"
] | 3 | 2020-07-14T03:55:08.000Z | 2020-07-29T13:04:37.000Z | import torch
import torch.utils.data as data
import torchvision.transforms as transforms
import os
import nltk
import numpy as np
import json as jsonmod
import pandas as pd
import csv
import base64
import json
import random
class TrainDataset(data.Dataset):
def __init__(self, data_path, data_split, vocab, stopwords, opt):
self.vocab = vocab
self.loc = data_path + '/'
self.length = 3000000
self.data_split = data_split
self.nraws = 20000
self.shuffle = True
self.stopwords=stopwords
def initial(self):
self.reader = pd.read_csv(self.loc+'%s/train.tsv' % self.data_split, sep='\t', quoting=csv.QUOTE_NONE, iterator=True)
self.samples = list()
self.samples_new = list()
self.samples = self.reader.get_chunk(self.nraws)
class_label = {}
for i in range(len(self.samples)):
data = self.samples.iloc[i]
query_id = data['query_id']
if query_id not in class_label.keys():
class_label[query_id] = 1
elif query_id in class_label.keys():
class_label[query_id] = class_label[query_id]+1
for i in range(len(self.samples)):
data = self.samples.iloc[i]
query_id = data['query_id']
if class_label[query_id] <= 10:
self.samples_new.append(self.samples.iloc[i])
if class_label[query_id] > 10 and class_label[query_id]<=50:
if random.random()>0.4:
self.samples_new.append(self.samples.iloc[i])
if class_label[query_id] > 50 and class_label[query_id]<=100:
if random.random()>0.5:
self.samples_new.append(self.samples.iloc[i])
if class_label[query_id] > 100 and class_label[query_id]<=250:
if random.random()>0.6:
self.samples_new.append(self.samples.iloc[i])
if class_label[query_id] > 250 and class_label[query_id]<=500:
if random.random()>0.8:
self.samples_new.append(self.samples.iloc[i])
if class_label[query_id] > 500:
if random.random()>0.9:
self.samples_new.append(self.samples.iloc[i])
self.samples = self.samples_new
del self.samples_new
self.current_sample_num = len(self.samples)
self.num_load = 0
self.index = list(range(self.current_sample_num))
if self.shuffle:
random.shuffle(self.index)
def __getitem__(self, index):
idx = self.index[0]
data = self.samples[idx]
self.index = self.index[1:]
self.current_sample_num-=1
if self.current_sample_num<=0:
# all the samples in the memory have been used, need to get the new samples
del self.samples
self.samples = self.reader.get_chunk(self.nraws)
self.samples_new = list()
class_label = {}
for i in range(len(self.samples)):
data = self.samples.iloc[i]
query_id = data['query_id']
if query_id not in class_label.keys():
class_label[query_id] = 1
elif query_id in class_label.keys():
class_label[query_id] = class_label[query_id]+1
for i in range(len(self.samples)):
data = self.samples.iloc[i]
query_id = data['query_id']
if class_label[query_id] <= 10:
self.samples_new.append(self.samples.iloc[i])
if class_label[query_id] > 10 and class_label[query_id]<= 50:
if random.random()>0.4:
self.samples_new.append(self.samples.iloc[i])
if class_label[query_id] > 50 and class_label[query_id]<= 100:
if random.random()>0.5:
self.samples_new.append(self.samples.iloc[i])
if class_label[query_id] > 100 and class_label[query_id]<= 250:
if random.random()>0.6:
self.samples_new.append(self.samples.iloc[i])
if class_label[query_id] > 250 and class_label[query_id]<= 500:
if random.random()>0.8:
self.samples_new.append(self.samples.iloc[i])
if class_label[query_id] > 500:
if random.random()>0.9:
self.samples_new.append(self.samples.iloc[i])
self.samples = self.samples_new
del self.samples_new
self.current_sample_num = len(self.samples)
self.index = list(range(self.current_sample_num))
if self.shuffle:
random.shuffle(self.index)
num_boxes = int(data['num_boxes'])
image = np.frombuffer(base64.b64decode(data['features']), dtype=np.float32).reshape(num_boxes, 2048)
boxes = np.frombuffer(base64.b64decode(data['boxes']), dtype=np.float32).reshape(num_boxes, 4).copy()
class_labels = np.frombuffer(base64.b64decode(data['class_labels']), dtype=np.int64).reshape(num_boxes, 1)
caption = data['query']
query = data['query']
query_id = int(data['query_id'])
image_h = int(data['image_h'])
image_w = int(data['image_w'])
boxes[:,0] = boxes[:,0] / float(image_h)
boxes[:,2] = boxes[:,2] / float(image_h)
boxes[:,1] = boxes[:,1] / float(image_w)
boxes[:,3] = boxes[:,3] / float(image_h)
vocab = self.vocab
# Convert caption (string) to word ids.
tokens = nltk.tokenize.word_tokenize(
str(caption).lower().encode('utf-8').decode('utf-8'))
caption = []
caption.append(vocab('<start>'))
#caption.extend([vocab(token) for token in tokens])
'''
for token in tokens:
if token not in self.stopwords:
caption.append(vocab(token))
'''
#---py #stop and change to unk
change_flag = 0
rr=random.random()
#caption_mid = []
if rr>=0.8:
for token in tokens:
rrr=random.random()
if (rrr>=0.8) and (change_flag==0):
change_flag=1
token = '<unk>'
if token not in self.stopwords:
caption.append(vocab(token))
else:
for token in tokens:
if token not in self.stopwords:
caption.append(vocab(token))
#---py
#caption_mid = caption_mid + caption_mid
#caption = caption + caption_mid
caption.append(vocab('<end>'))
target = torch.Tensor(caption)
image = torch.Tensor(image)
boxes = torch.Tensor(boxes)
class_labels = torch.Tensor(class_labels)
#s = (boxes[:,2] - boxes[:,0])*(boxes[:,3] - boxes[:,1])
#_, index = torch.sort(s,0)
_, index = torch.sort(boxes[:,0],0)
image = image[index,:]
boxes = boxes[index,:]
class_labels = class_labels[index,:]
gf = torch.mean(image, dim=0, keepdim=True)
image = torch.cat([image, gf], dim=0)
return image, target, query_id, query, num_boxes, boxes, class_labels
def __len__(self):
return self.length
class ValidDataset(data.Dataset):
def __init__(self, data_path, data_split, vocab, stopwords):
self.vocab = vocab
self.loc = data_path + '/'
self.data_split = data_split
self.reader = pd.read_csv(self.loc+'%s/valid.tsv' % self.data_split, sep='\t', quoting=csv.QUOTE_NONE)
self.f = open(self.loc+'%s/valid_answer.json' % self.data_split)
self.answer = json.load(self.f)
self.length = self.reader.shape[0]
self.stopwords = stopwords
def __getitem__(self, index):
pair = self.reader.loc[index]
product_id = pair['product_id']
query_id = pair['query_id']
num_boxes = pair['num_boxes']
image = np.frombuffer(base64.b64decode(pair['features']), dtype=np.float32).reshape(num_boxes, 2048)
caption = pair['query']
vocab = self.vocab
boxes = np.frombuffer(base64.b64decode(pair['boxes']), dtype=np.float32).reshape(num_boxes, 4).copy()
image_h = int(pair['image_h'])
image_w = int(pair['image_w'])
boxes[:,0] = boxes[:,0] / float(image_h)
boxes[:,2] = boxes[:,2] / float(image_h)
boxes[:,1] = boxes[:,1] / float(image_w)
boxes[:,3] = boxes[:,3] / float(image_h)
boxes = torch.Tensor(boxes)
# Convert caption (string) to word ids.
tokens = nltk.tokenize.word_tokenize(
str(caption).lower().encode('utf-8').decode('utf-8'))
caption = []
#caption_mid = []
caption.append(vocab('<start>'))
for token in tokens:
if token not in self.stopwords:
caption.append(vocab(token))
#caption.extend([vocab(token) for token in tokens])
#caption_mid = caption_mid + caption_mid
#caption = caption + caption_mid
caption.append(vocab('<end>'))
target = torch.Tensor(caption)
image = torch.Tensor(image)
#s = (boxes[:,2] - boxes[:,0])*(boxes[:,3] - boxes[:,1])
#_, index = torch.sort(s,0)
_, index = torch.sort(boxes[:,0],0)
image = image[index,:]
boxes = boxes[index,:]
gf = torch.mean(image, dim=0, keepdim=True)
image = torch.cat([image, gf], dim=0)
return image, target, product_id, query_id, boxes
def __len__(self):
return self.length
class TestDataset(data.Dataset):
def __init__(self, data_path, data_split, vocab, stopwords):
self.vocab = vocab
self.loc = data_path + '/'
self.data_split = data_split
self.reader = pd.read_csv(self.loc+'%s/testA.tsv' % self.data_split, sep='\t', quoting=csv.QUOTE_NONE)
self.length = self.reader.shape[0]
self.stopwords = stopwords
def __getitem__(self, index):
pair = self.reader.loc[index]
product_id = pair['product_id']
query_id = pair['query_id']
num_boxes = pair['num_boxes']
image = np.frombuffer(base64.b64decode(pair['features']), dtype=np.float32).reshape(num_boxes, 2048)
caption = pair['query']
vocab = self.vocab
boxes = np.frombuffer(base64.b64decode(pair['boxes']), dtype=np.float32).reshape(num_boxes, 4).copy()
image_h = int(pair['image_h'])
image_w = int(pair['image_w'])
boxes[:,0] = boxes[:,0] / float(image_h)
boxes[:,2] = boxes[:,2] / float(image_h)
boxes[:,1] = boxes[:,1] / float(image_w)
boxes[:,3] = boxes[:,3] / float(image_h)
boxes = torch.Tensor(boxes)
# Convert caption (string) to word ids.
tokens = nltk.tokenize.word_tokenize(
str(caption).lower().encode('utf-8').decode('utf-8'))
caption = []
caption.append(vocab('<start>'))
for token in tokens:
if token not in self.stopwords:
caption.append(vocab(token))
#caption.extend([vocab(token) for token in tokens])
caption.append(vocab('<end>'))
target = torch.Tensor(caption)
image = torch.Tensor(image)
_, index = torch.sort(boxes[:,0],0)
image = image[index,:]
boxes = boxes[index,:]
gf = torch.mean(image, dim=0, keepdim=True)
image = torch.cat([image, gf], dim=0)
return image, target, product_id, query_id, boxes
def __len__(self):
return self.length
def train_collate_fn(data):
"""Build mini-batch tensors from a list of (image, caption) tuples.
Args:
data: list of (image, caption) tuple.
- image: torch tensor of shape (3, 256, 256).
- caption: torch tensor of shape (?); variable length.
Returns:
images: torch tensor of shape (batch_size, 3, 256, 256).
targets: torch tensor of shape (batch_size, padded_length).
lengths: list; valid length for each padded caption.
"""
# Sort a data list by caption length
data.sort(key=lambda x: len(x[1]), reverse=True)
images, captions, query_id, query, num_boxes, boxes, class_labels = zip(*data)
# Merge images (convert tuple of 3D tensor to 4D tensor)
images_lengths = [image.shape[0] for image in images]
images_tensor = torch.zeros(len(images), max(images_lengths), 2048)
images_masks = torch.zeros(len(images), max(images_lengths))
boxes_tensor = torch.zeros(len(images), max(images_lengths), 4)
class_labels_tensor = torch.ones(len(images), max(images_lengths), 1)*(-100)
for i, image in enumerate(images):
end = images_lengths[i]
images_tensor[i, :end,:] = image[:,:]
images_masks[i, :end] = 1
boxes_tensor[i, :end-1,:] = boxes[i][:,:]
class_labels_tensor[i, :end-1,:] = class_labels[i][:,:]
lengths = [len(cap) for cap in captions]
targets = torch.zeros(len(captions), max(lengths)).long()
txt_masks = torch.zeros(len(captions), max(lengths))
for i, cap in enumerate(captions):
end = lengths[i]
targets[i, :end] = cap[:end]
txt_masks[i, :end] = 1
return images_tensor, targets, lengths, txt_masks, images_lengths, images_masks, query_id, query, num_boxes, boxes_tensor, class_labels_tensor
def valid_collate_fn(data):
"""Build mini-batch tensors from a list of (image, caption) tuples.
Args:
data: list of (image, caption) tuple.
- image: torch tensor of shape (3, 256, 256).
- caption: torch tensor of shape (?); variable length.
Returns:
images: torch tensor of shape (batch_size, 3, 256, 256).
targets: torch tensor of shape (batch_size, padded_length).
lengths: list; valid length for each padded caption.
"""
# Sort a data list by caption length
data.sort(key=lambda x: len(x[1]), reverse=True)
images, captions, product_ids, query_ids, boxes = zip(*data)
# Merge images (convert tuple of 3D tensor to 4D tensor)
images_lengths = [image.shape[0] for image in images]
images_tensor = torch.zeros(len(images), max(images_lengths), 2048)
images_masks = torch.zeros(len(images), max(images_lengths))
boxes_tensor = torch.zeros(len(images), max(images_lengths), 4)
for i, image in enumerate(images):
end = images_lengths[i]
images_tensor[i, :end,:] = image[:,:]
images_masks[i, :end] = 1
boxes_tensor[i, :end-1,:] = boxes[i][:,:]
#images_tensor[i, :end,:] = image[:end,:]
#images = torch.stack(images, 0)
# Merget captions (convert tuple of 1D tensor to 2D tensor)
lengths = [len(cap) for cap in captions]
targets = torch.zeros(len(captions), max(lengths)).long()
txt_masks = torch.zeros(len(captions), max(lengths))
for i, cap in enumerate(captions):
end = lengths[i]
targets[i, :end] = cap[:end]
txt_masks[i, :end] = 1
return images_tensor, targets, images_lengths, lengths, images_masks, txt_masks, product_ids, query_ids, boxes_tensor
def get_train_loader(data_path, data_split, vocab, stopwords, opt, batch_size=100,
shuffle=True, num_workers=2):
"""Returns torch.utils.data.DataLoader for custom coco dataset."""
dset = TrainDataset(data_path, data_split, vocab, stopwords, opt)
data_loader = torch.utils.data.DataLoader(dataset=dset,
batch_size=batch_size,
shuffle=shuffle,
pin_memory=True,
collate_fn=train_collate_fn)
return data_loader
def get_valid_loader(data_path, data_split, vocab, stopwords, opt, batch_size=100,
shuffle=True, num_workers=2):
"""Returns torch.utils.data.DataLoader for custom coco dataset."""
dset = ValidDataset(data_path, data_split, vocab, stopwords)
data_loader = torch.utils.data.DataLoader(dataset=dset,
batch_size=batch_size,
shuffle=shuffle,
pin_memory=True,
collate_fn=valid_collate_fn)
return data_loader
def get_loaders(data_name, vocab, stopwords, batch_size, workers, opt, only_test=False):
dpath = opt.data_path
if not only_test:
train_loader = get_train_loader(dpath, 'train', vocab, stopwords, opt,
batch_size, True, workers)
val_loader = get_valid_loader(dpath, 'valid', vocab, stopwords, opt,
batch_size, False, workers)
else:
train_loader = None
val_loader = get_test_loader(dpath, 'testA', vocab, stopwords, opt,
batch_size, False, workers)
return train_loader, val_loader
def get_test_loader(data_path, data_split, vocab, stopwords, opt, batch_size=100,
shuffle=True, num_workers=2):
dset = TestDataset(data_path, data_split, vocab, stopwords)
data_loader = torch.utils.data.DataLoader(dataset=dset,
batch_size=batch_size,
shuffle=shuffle,
pin_memory=True,
collate_fn=valid_collate_fn)
return data_loader
| 40.605505 | 146 | 0.580321 | 2,251 | 17,704 | 4.395824 | 0.095513 | 0.034664 | 0.039414 | 0.044669 | 0.841536 | 0.823042 | 0.815462 | 0.792623 | 0.763517 | 0.759576 | 0 | 0.022965 | 0.296543 | 17,704 | 435 | 147 | 40.698851 | 0.771559 | 0.111839 | 0 | 0.760252 | 0 | 0 | 0.023726 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.050473 | false | 0 | 0.037855 | 0.009464 | 0.135647 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
632a040a16e70508fabfbc1d35228a8417d6db92 | 833 | py | Python | python/helpers/tests/generator3_tests/data/SkeletonGeneration/keyword_only_arguments_in_signatures/after/sdk_skeletons/mod.py | Sajaki/intellij-community | 6748af2c40567839d11fd652ec77ba263c074aad | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/helpers/tests/generator3_tests/data/SkeletonGeneration/keyword_only_arguments_in_signatures/after/sdk_skeletons/mod.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 2 | 2022-02-19T09:45:05.000Z | 2022-02-27T20:32:55.000Z | python/helpers/tests/generator3_tests/data/SkeletonGeneration/keyword_only_arguments_in_signatures/after/sdk_skeletons/mod.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | # encoding: utf-8
# module mod
# from mod.py
# by generator 1000.0
# no doc
# no imports
# functions
def f1(foo, *args, bar): # reliably restored by inspect
# no doc
pass
def f2(foo, *args, bar, baz=None): # reliably restored by inspect
# no doc
pass
def f3(foo, *args, baz=None): # reliably restored by inspect
# no doc
pass
def f4(foo, *, bar): # reliably restored by inspect
# no doc
pass
def f5(foo, *, bar, baz=None): # reliably restored by inspect
# no doc
pass
def f6(foo, *, baz=None): # reliably restored by inspect
# no doc
pass
def f7(*, bar): # reliably restored by inspect
# no doc
pass
def f8(*, bar, baz=None): # reliably restored by inspect
# no doc
pass
def f9(*, baz=None): # reliably restored by inspect
# no doc
pass
# no classes
| 17.723404 | 65 | 0.623049 | 127 | 833 | 4.086614 | 0.275591 | 0.096339 | 0.312139 | 0.433526 | 0.751445 | 0.751445 | 0.751445 | 0.751445 | 0.751445 | 0.441233 | 0 | 0.024631 | 0.268908 | 833 | 46 | 66 | 18.108696 | 0.827586 | 0.505402 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0.5 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 8 |
2d6a5135c6c452f1585dd90ae7de9ef9d919d22c | 2,834 | py | Python | ASR/waveminionet/models/encoders.py | ishine/pase | 2a41e63e54fa8673efd12c16cdcdd5ad4f0f125e | [
"MIT"
] | 428 | 2019-04-08T04:34:00.000Z | 2022-03-18T08:44:31.000Z | ASR/waveminionet/models/encoders.py | ishine/pase | 2a41e63e54fa8673efd12c16cdcdd5ad4f0f125e | [
"MIT"
] | 46 | 2019-04-07T23:38:53.000Z | 2022-02-19T12:06:12.000Z | ASR/waveminionet/models/encoders.py | ishine/pase | 2a41e63e54fa8673efd12c16cdcdd5ad4f0f125e | [
"MIT"
] | 89 | 2019-04-08T18:17:25.000Z | 2022-03-31T02:39:45.000Z | import torch
import torch.nn as nn
from .core import LayerNorm
class AhoCNNEncoder(nn.Module):
def __init__(self, input_dim, kwidth=3, dropout=0.5, layer_norm=False):
super().__init__()
pad = (kwidth - 1) // 2
if layer_norm:
norm_layer = LayerNorm
else:
norm_layer = nn.BatchNorm1d
self.enc = nn.Sequential(
nn.Conv1d(input_dim, 256, kwidth, stride=1, padding=pad),
norm_layer(256),
nn.PReLU(256),
nn.Conv1d(256, 256, kwidth, stride=1, padding=pad),
norm_layer(256),
nn.PReLU(256),
nn.MaxPool1d(2),
nn.Dropout(0.2),
nn.Conv1d(256, 512, kwidth, stride=1, padding=pad),
norm_layer(512),
nn.PReLU(512),
nn.Conv1d(512, 512, kwidth, stride=1, padding=pad),
norm_layer(512),
nn.PReLU(512),
nn.MaxPool1d(2),
nn.Dropout(0.2),
nn.Conv1d(512, 1024, kwidth, stride=1, padding=pad),
norm_layer(1024),
nn.PReLU(1024),
nn.Conv1d(1024, 1024, kwidth, stride=1, padding=pad),
norm_layer(1024),
nn.PReLU(1024),
nn.MaxPool1d(2),
nn.Dropout(0.2),
nn.Conv1d(1024, 1024, kwidth, stride=1, padding=pad),
)
def forward(self, x):
return self.enc(x)
class AhoCNNHourGlassEncoder(nn.Module):
def __init__(self, input_dim, kwidth=3, dropout=0.5, layer_norm=False):
super().__init__()
pad = (kwidth - 1) // 2
if layer_norm:
norm_layer = LayerNorm
else:
norm_layer = nn.BatchNorm1d
self.enc = nn.Sequential(
nn.Conv1d(input_dim, 64, kwidth, stride=1, padding=pad),
norm_layer(64),
nn.PReLU(64),
nn.Conv1d(64, 128, kwidth, stride=1, padding=pad),
norm_layer(128),
nn.PReLU(128),
nn.MaxPool1d(2),
nn.Dropout(dropout),
nn.Conv1d(128, 256, kwidth, stride=1, padding=pad),
norm_layer(256),
nn.PReLU(256),
nn.Conv1d(256, 512, kwidth, stride=1, padding=pad),
norm_layer(512),
nn.PReLU(512),
nn.MaxPool1d(2),
nn.Dropout(dropout),
nn.Conv1d(512, 256, kwidth, stride=1, padding=pad),
norm_layer(256),
nn.PReLU(256),
nn.Conv1d(256, 128, kwidth, stride=1, padding=pad),
norm_layer(128),
nn.PReLU(128),
nn.MaxPool1d(2),
nn.Dropout(dropout),
nn.Conv1d(128, 64, kwidth, stride=1, padding=pad),
norm_layer(64),
nn.PReLU(64),
)
def forward(self, x):
return self.enc(x)
| 30.804348 | 75 | 0.51729 | 348 | 2,834 | 4.094828 | 0.132184 | 0.107368 | 0.127719 | 0.196491 | 0.915088 | 0.915088 | 0.915088 | 0.915088 | 0.86386 | 0.792982 | 0 | 0.117647 | 0.352152 | 2,834 | 91 | 76 | 31.142857 | 0.658497 | 0 | 0 | 0.78481 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.050633 | false | 0 | 0.037975 | 0.025316 | 0.139241 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
2d6b63d6ad75b5657b9fe17430167af9b14ffecf | 99 | py | Python | anaadementia/assin/__init__.py | lbsantos/ANAA-Dementia | fb1b013f0de45526283d06291e99b70bf858a19d | [
"MIT"
] | null | null | null | anaadementia/assin/__init__.py | lbsantos/ANAA-Dementia | fb1b013f0de45526283d06291e99b70bf858a19d | [
"MIT"
] | null | null | null | anaadementia/assin/__init__.py | lbsantos/ANAA-Dementia | fb1b013f0de45526283d06291e99b70bf858a19d | [
"MIT"
] | null | null | null | from anaadementia.assin.assin_rte import AssinRTE
from anaadementia.assin.assin_sts import AssinSTS | 49.5 | 49 | 0.888889 | 14 | 99 | 6.142857 | 0.571429 | 0.372093 | 0.488372 | 0.604651 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070707 | 99 | 2 | 50 | 49.5 | 0.934783 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 8 |
2d8ba5e343e9d8efe2f2d5ebaa5836b46d3bfb54 | 342 | py | Python | demo/deep_learning/base/data_type_adapter.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | 1 | 2018-12-09T06:09:29.000Z | 2018-12-09T06:09:29.000Z | demo/deep_learning/base/data_type_adapter.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | null | null | null | demo/deep_learning/base/data_type_adapter.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
def _DefaultDataTypeAdapter(*args):
return args
def DefaultDataTypeAdapter(args, property_type='', **kwargs):
def generate_default_data_type_adapter():
return _DefaultDataTypeAdapter
return generate_default_data_type_adapter
def DefaultDataTypeAdapterArg(parser, property_type='', **kwargs):
pass
| 21.375 | 66 | 0.763158 | 35 | 342 | 7.114286 | 0.485714 | 0.200803 | 0.232932 | 0.184739 | 0.240964 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003436 | 0.149123 | 342 | 15 | 67 | 22.8 | 0.852234 | 0.035088 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0.125 | 0 | 0.25 | 0.875 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 8 |
2d9df41f0de66814ed13dccbc9dbda94280206a5 | 2,307 | py | Python | definitions.py | oliverloehmann/log_norm_fit | 23500e71f6e934d0e7576ec0c5b4f75fdec07bd1 | [
"MIT"
] | null | null | null | definitions.py | oliverloehmann/log_norm_fit | 23500e71f6e934d0e7576ec0c5b4f75fdec07bd1 | [
"MIT"
] | null | null | null | definitions.py | oliverloehmann/log_norm_fit | 23500e71f6e934d0e7576ec0c5b4f75fdec07bd1 | [
"MIT"
] | null | null | null | import numpy as np
# log norm distribution with 1 peak
def log_norm_func1(data,center1,sigma1,scale1):
return scale1*(1/(data*np.sqrt(2*np.pi*sigma1**2))*np.exp(-(((np.log(data)-center1)**2)/(2*sigma1**2))))
# log norm distribution with 2 peak
def log_norm_func2(data,center1,sigma1,scale1, center2,sigma2,scale2):
return scale1*(1/(data*sigma1*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center1)**2)/(2*sigma1**2)))) +\
scale2*(1/(data*sigma2*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center2)**2)/(2*sigma2**2))))
# log norm distribution with 3 peak
def log_norm_func3(data,center1,sigma1,scale1, center2,sigma2,scale2, center3,sigma3,scale3):
return scale1*(1/(data*sigma1*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center1)**2)/(2*sigma1**2)))) +\
scale2*(1/(data*sigma2*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center2)**2)/(2*sigma2**2)))) +\
scale3*(1/(data*sigma3*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center3)**2)/(2*sigma3**2))))
#log norm distribution with 4 peaks
def log_norm_func4(data,center1,sigma1,scale1, center2,sigma2,scale2, center3,sigma3,scale3, center4,sigma4,scale4):
return scale1*(1/(data*sigma1*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center1)**2)/(2*sigma1**2)))) +\
scale2*(1/(data*sigma2*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center2)**2)/(2*sigma2**2)))) +\
scale3*(1/(data*sigma3*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center3)**2)/(2*sigma3**2)))) +\
scale4*(1/(data*sigma4*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center4)**2)/(2*sigma4**2))))
#log norm distribution with 5 peaks
def log_norm_func5(data,center1,sigma1,scale1, center2,sigma2,scale2, center3,sigma3,scale3, center4,sigma4,scale4, center5,sigma5,scale5):
return scale1*(1/(data*sigma1*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center1)**2)/(2*sigma1**2)))) +\
scale2*(1/(data*sigma2*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center2)**2)/(2*sigma2**2)))) +\
scale3*(1/(data*sigma3*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center3)**2)/(2*sigma3**2)))) +\
scale4*(1/(data*sigma4*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center4)**2)/(2*sigma4**2)))) +\
scale5*(1/(data*sigma5*np.sqrt(2*np.pi))*np.exp(-(((np.log(data)-center5)**2)/(2*sigma5**2))))
| 72.09375 | 139 | 0.627655 | 395 | 2,307 | 3.640506 | 0.103797 | 0.055633 | 0.073018 | 0.09388 | 0.833797 | 0.76217 | 0.76217 | 0.732962 | 0.732962 | 0.732962 | 0 | 0.092048 | 0.100564 | 2,307 | 31 | 140 | 74.419355 | 0.600964 | 0.073255 | 0 | 0.428571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.238095 | false | 0 | 0.047619 | 0.238095 | 0.52381 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 9 |
2da0b1c6571b3a1e19cd8467b42210b868bc9984 | 152 | py | Python | src/utils/views.py | jsmesami/naovoce | 235c6e05ef37be23d3b9bd0b76d80080c58617a0 | [
"BSD-3-Clause"
] | 18 | 2016-02-23T15:34:58.000Z | 2022-02-28T08:15:30.000Z | src/utils/views.py | jsmesami/naovoce | 235c6e05ef37be23d3b9bd0b76d80080c58617a0 | [
"BSD-3-Clause"
] | 66 | 2016-03-15T19:59:09.000Z | 2022-03-11T23:25:41.000Z | src/utils/views.py | jsmesami/naovoce | 235c6e05ef37be23d3b9bd0b76d80080c58617a0 | [
"BSD-3-Clause"
] | 7 | 2016-03-24T09:13:07.000Z | 2018-09-16T17:04:50.000Z | from django.shortcuts import render
def plain_text_view(request, template_name):
return render(request, template_name, content_type='text/plain')
| 25.333333 | 68 | 0.802632 | 21 | 152 | 5.571429 | 0.714286 | 0.25641 | 0.324786 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111842 | 152 | 5 | 69 | 30.4 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0.065789 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0.333333 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 8 |
2da54911dc2b206248dbb4bb1f0fa71daf37816d | 283 | py | Python | confply/cpp_compiler/options/__init__.py | graehu/confply | 4471b520b3685d587a89d31dee7eec9ca7bf85de | [
"MIT"
] | null | null | null | confply/cpp_compiler/options/__init__.py | graehu/confply | 4471b520b3685d587a89d31dee7eec9ca7bf85de | [
"MIT"
] | null | null | null | confply/cpp_compiler/options/__init__.py | graehu/confply | 4471b520b3685d587a89d31dee7eec9ca7bf85de | [
"MIT"
] | null | null | null | import confply.cpp_compiler.options.defaults as defaults
import confply.cpp_compiler.options.standard as standard
import confply.cpp_compiler.options.warnings as warnings
import confply.cpp_compiler.options.output_type as output_type
import confply.cpp_compiler.options.tool as tool
| 47.166667 | 62 | 0.876325 | 42 | 283 | 5.738095 | 0.285714 | 0.26971 | 0.33195 | 0.497925 | 0.643154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070671 | 283 | 5 | 63 | 56.6 | 0.91635 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
2ddb15986660f44ad969c956245f130c958f6257 | 30,599 | py | Python | sdk/python/pulumi_azuredevops/service_endpoint_azure_ecr.py | pulumi/pulumi-azuredevops | e6d73d1501335037fb944ae627091a7afc7f0048 | [
"ECL-2.0",
"Apache-2.0"
] | 13 | 2020-06-28T11:39:32.000Z | 2022-03-05T13:34:16.000Z | sdk/python/pulumi_azuredevops/service_endpoint_azure_ecr.py | pulumi/pulumi-azuredevops | e6d73d1501335037fb944ae627091a7afc7f0048 | [
"ECL-2.0",
"Apache-2.0"
] | 58 | 2020-06-20T14:00:28.000Z | 2022-03-31T15:20:51.000Z | sdk/python/pulumi_azuredevops/service_endpoint_azure_ecr.py | pulumi/pulumi-azuredevops | e6d73d1501335037fb944ae627091a7afc7f0048 | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2020-10-21T03:22:01.000Z | 2021-12-10T18:26:59.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
__all__ = ['ServiceEndpointAzureEcrArgs', 'ServiceEndpointAzureEcr']
@pulumi.input_type
class ServiceEndpointAzureEcrArgs:
def __init__(__self__, *,
azurecr_name: pulumi.Input[str],
azurecr_spn_tenantid: pulumi.Input[str],
azurecr_subscription_id: pulumi.Input[str],
azurecr_subscription_name: pulumi.Input[str],
project_id: pulumi.Input[str],
resource_group: pulumi.Input[str],
service_endpoint_name: pulumi.Input[str],
authorization: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
description: Optional[pulumi.Input[str]] = None):
"""
The set of arguments for constructing a ServiceEndpointAzureEcr resource.
:param pulumi.Input[str] azurecr_name: The Azure container registry name.
:param pulumi.Input[str] azurecr_spn_tenantid: The tenant id of the service principal.
:param pulumi.Input[str] azurecr_subscription_id: The subscription id of the Azure targets.
:param pulumi.Input[str] azurecr_subscription_name: The subscription name of the Azure targets.
:param pulumi.Input[str] project_id: The project ID or project name.
:param pulumi.Input[str] resource_group: The resource group to which the container registry belongs.
:param pulumi.Input[str] service_endpoint_name: The name you will use to refer to this service connection in task inputs.
"""
pulumi.set(__self__, "azurecr_name", azurecr_name)
pulumi.set(__self__, "azurecr_spn_tenantid", azurecr_spn_tenantid)
pulumi.set(__self__, "azurecr_subscription_id", azurecr_subscription_id)
pulumi.set(__self__, "azurecr_subscription_name", azurecr_subscription_name)
pulumi.set(__self__, "project_id", project_id)
pulumi.set(__self__, "resource_group", resource_group)
pulumi.set(__self__, "service_endpoint_name", service_endpoint_name)
if authorization is not None:
pulumi.set(__self__, "authorization", authorization)
if description is not None:
pulumi.set(__self__, "description", description)
@property
@pulumi.getter(name="azurecrName")
def azurecr_name(self) -> pulumi.Input[str]:
"""
The Azure container registry name.
"""
return pulumi.get(self, "azurecr_name")
@azurecr_name.setter
def azurecr_name(self, value: pulumi.Input[str]):
pulumi.set(self, "azurecr_name", value)
@property
@pulumi.getter(name="azurecrSpnTenantid")
def azurecr_spn_tenantid(self) -> pulumi.Input[str]:
"""
The tenant id of the service principal.
"""
return pulumi.get(self, "azurecr_spn_tenantid")
@azurecr_spn_tenantid.setter
def azurecr_spn_tenantid(self, value: pulumi.Input[str]):
pulumi.set(self, "azurecr_spn_tenantid", value)
@property
@pulumi.getter(name="azurecrSubscriptionId")
def azurecr_subscription_id(self) -> pulumi.Input[str]:
"""
The subscription id of the Azure targets.
"""
return pulumi.get(self, "azurecr_subscription_id")
@azurecr_subscription_id.setter
def azurecr_subscription_id(self, value: pulumi.Input[str]):
pulumi.set(self, "azurecr_subscription_id", value)
@property
@pulumi.getter(name="azurecrSubscriptionName")
def azurecr_subscription_name(self) -> pulumi.Input[str]:
"""
The subscription name of the Azure targets.
"""
return pulumi.get(self, "azurecr_subscription_name")
@azurecr_subscription_name.setter
def azurecr_subscription_name(self, value: pulumi.Input[str]):
pulumi.set(self, "azurecr_subscription_name", value)
@property
@pulumi.getter(name="projectId")
def project_id(self) -> pulumi.Input[str]:
"""
The project ID or project name.
"""
return pulumi.get(self, "project_id")
@project_id.setter
def project_id(self, value: pulumi.Input[str]):
pulumi.set(self, "project_id", value)
@property
@pulumi.getter(name="resourceGroup")
def resource_group(self) -> pulumi.Input[str]:
"""
The resource group to which the container registry belongs.
"""
return pulumi.get(self, "resource_group")
@resource_group.setter
def resource_group(self, value: pulumi.Input[str]):
pulumi.set(self, "resource_group", value)
@property
@pulumi.getter(name="serviceEndpointName")
def service_endpoint_name(self) -> pulumi.Input[str]:
"""
The name you will use to refer to this service connection in task inputs.
"""
return pulumi.get(self, "service_endpoint_name")
@service_endpoint_name.setter
def service_endpoint_name(self, value: pulumi.Input[str]):
pulumi.set(self, "service_endpoint_name", value)
@property
@pulumi.getter
def authorization(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "authorization")
@authorization.setter
def authorization(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
pulumi.set(self, "authorization", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@pulumi.input_type
class _ServiceEndpointAzureEcrState:
def __init__(__self__, *,
app_object_id: Optional[pulumi.Input[str]] = None,
authorization: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
az_spn_role_assignment_id: Optional[pulumi.Input[str]] = None,
az_spn_role_permissions: Optional[pulumi.Input[str]] = None,
azurecr_name: Optional[pulumi.Input[str]] = None,
azurecr_spn_tenantid: Optional[pulumi.Input[str]] = None,
azurecr_subscription_id: Optional[pulumi.Input[str]] = None,
azurecr_subscription_name: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
project_id: Optional[pulumi.Input[str]] = None,
resource_group: Optional[pulumi.Input[str]] = None,
service_endpoint_name: Optional[pulumi.Input[str]] = None,
service_principal_id: Optional[pulumi.Input[str]] = None,
spn_object_id: Optional[pulumi.Input[str]] = None):
"""
Input properties used for looking up and filtering ServiceEndpointAzureEcr resources.
:param pulumi.Input[str] azurecr_name: The Azure container registry name.
:param pulumi.Input[str] azurecr_spn_tenantid: The tenant id of the service principal.
:param pulumi.Input[str] azurecr_subscription_id: The subscription id of the Azure targets.
:param pulumi.Input[str] azurecr_subscription_name: The subscription name of the Azure targets.
:param pulumi.Input[str] project_id: The project ID or project name.
:param pulumi.Input[str] resource_group: The resource group to which the container registry belongs.
:param pulumi.Input[str] service_endpoint_name: The name you will use to refer to this service connection in task inputs.
:param pulumi.Input[str] service_principal_id: The service principal ID.
"""
if app_object_id is not None:
pulumi.set(__self__, "app_object_id", app_object_id)
if authorization is not None:
pulumi.set(__self__, "authorization", authorization)
if az_spn_role_assignment_id is not None:
pulumi.set(__self__, "az_spn_role_assignment_id", az_spn_role_assignment_id)
if az_spn_role_permissions is not None:
pulumi.set(__self__, "az_spn_role_permissions", az_spn_role_permissions)
if azurecr_name is not None:
pulumi.set(__self__, "azurecr_name", azurecr_name)
if azurecr_spn_tenantid is not None:
pulumi.set(__self__, "azurecr_spn_tenantid", azurecr_spn_tenantid)
if azurecr_subscription_id is not None:
pulumi.set(__self__, "azurecr_subscription_id", azurecr_subscription_id)
if azurecr_subscription_name is not None:
pulumi.set(__self__, "azurecr_subscription_name", azurecr_subscription_name)
if description is not None:
pulumi.set(__self__, "description", description)
if project_id is not None:
pulumi.set(__self__, "project_id", project_id)
if resource_group is not None:
pulumi.set(__self__, "resource_group", resource_group)
if service_endpoint_name is not None:
pulumi.set(__self__, "service_endpoint_name", service_endpoint_name)
if service_principal_id is not None:
pulumi.set(__self__, "service_principal_id", service_principal_id)
if spn_object_id is not None:
pulumi.set(__self__, "spn_object_id", spn_object_id)
@property
@pulumi.getter(name="appObjectId")
def app_object_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "app_object_id")
@app_object_id.setter
def app_object_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "app_object_id", value)
@property
@pulumi.getter
def authorization(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "authorization")
@authorization.setter
def authorization(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
pulumi.set(self, "authorization", value)
@property
@pulumi.getter(name="azSpnRoleAssignmentId")
def az_spn_role_assignment_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "az_spn_role_assignment_id")
@az_spn_role_assignment_id.setter
def az_spn_role_assignment_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "az_spn_role_assignment_id", value)
@property
@pulumi.getter(name="azSpnRolePermissions")
def az_spn_role_permissions(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "az_spn_role_permissions")
@az_spn_role_permissions.setter
def az_spn_role_permissions(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "az_spn_role_permissions", value)
@property
@pulumi.getter(name="azurecrName")
def azurecr_name(self) -> Optional[pulumi.Input[str]]:
"""
The Azure container registry name.
"""
return pulumi.get(self, "azurecr_name")
@azurecr_name.setter
def azurecr_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "azurecr_name", value)
@property
@pulumi.getter(name="azurecrSpnTenantid")
def azurecr_spn_tenantid(self) -> Optional[pulumi.Input[str]]:
"""
The tenant id of the service principal.
"""
return pulumi.get(self, "azurecr_spn_tenantid")
@azurecr_spn_tenantid.setter
def azurecr_spn_tenantid(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "azurecr_spn_tenantid", value)
@property
@pulumi.getter(name="azurecrSubscriptionId")
def azurecr_subscription_id(self) -> Optional[pulumi.Input[str]]:
"""
The subscription id of the Azure targets.
"""
return pulumi.get(self, "azurecr_subscription_id")
@azurecr_subscription_id.setter
def azurecr_subscription_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "azurecr_subscription_id", value)
@property
@pulumi.getter(name="azurecrSubscriptionName")
def azurecr_subscription_name(self) -> Optional[pulumi.Input[str]]:
"""
The subscription name of the Azure targets.
"""
return pulumi.get(self, "azurecr_subscription_name")
@azurecr_subscription_name.setter
def azurecr_subscription_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "azurecr_subscription_name", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter(name="projectId")
def project_id(self) -> Optional[pulumi.Input[str]]:
"""
The project ID or project name.
"""
return pulumi.get(self, "project_id")
@project_id.setter
def project_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "project_id", value)
@property
@pulumi.getter(name="resourceGroup")
def resource_group(self) -> Optional[pulumi.Input[str]]:
"""
The resource group to which the container registry belongs.
"""
return pulumi.get(self, "resource_group")
@resource_group.setter
def resource_group(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "resource_group", value)
@property
@pulumi.getter(name="serviceEndpointName")
def service_endpoint_name(self) -> Optional[pulumi.Input[str]]:
"""
The name you will use to refer to this service connection in task inputs.
"""
return pulumi.get(self, "service_endpoint_name")
@service_endpoint_name.setter
def service_endpoint_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "service_endpoint_name", value)
@property
@pulumi.getter(name="servicePrincipalId")
def service_principal_id(self) -> Optional[pulumi.Input[str]]:
"""
The service principal ID.
"""
return pulumi.get(self, "service_principal_id")
@service_principal_id.setter
def service_principal_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "service_principal_id", value)
@property
@pulumi.getter(name="spnObjectId")
def spn_object_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "spn_object_id")
@spn_object_id.setter
def spn_object_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "spn_object_id", value)
class ServiceEndpointAzureEcr(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
authorization: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
azurecr_name: Optional[pulumi.Input[str]] = None,
azurecr_spn_tenantid: Optional[pulumi.Input[str]] = None,
azurecr_subscription_id: Optional[pulumi.Input[str]] = None,
azurecr_subscription_name: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
project_id: Optional[pulumi.Input[str]] = None,
resource_group: Optional[pulumi.Input[str]] = None,
service_endpoint_name: Optional[pulumi.Input[str]] = None,
__props__=None):
"""
Manages a Azure Container Registry service endpoint within Azure DevOps.
## Example Usage
```python
import pulumi
import pulumi_azuredevops as azuredevops
project = azuredevops.Project("project",
visibility="private",
version_control="Git",
work_item_template="Agile")
# azure container registry service connection
azurecr = azuredevops.ServiceEndpointAzureEcr("azurecr",
project_id=project.id,
service_endpoint_name="Sample AzureCR",
resource_group="sample-rg",
azurecr_spn_tenantid="00000000-0000-0000-0000-000000000000",
azurecr_name="sampleAcr",
azurecr_subscription_id="00000000-0000-0000-0000-000000000000",
azurecr_subscription_name="sampleSub")
```
## Relevant Links
- [Azure DevOps Service REST API 5.1 - Service Endpoints](https://docs.microsoft.com/en-us/rest/api/azure/devops/serviceendpoint/endpoints?view=azure-devops-rest-5.1)
- [Azure Container Registry REST API](https://docs.microsoft.com/en-us/rest/api/containerregistry/)
## Import
Azure DevOps Service Endpoint Azure Container Registry can be imported using **projectID/serviceEndpointID** or **projectName/serviceEndpointID**
```sh
$ pulumi import azuredevops:index/serviceEndpointAzureEcr:ServiceEndpointAzureEcr serviceendpoint 00000000-0000-0000-0000-000000000000/00000000-0000-0000-0000-000000000000
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] azurecr_name: The Azure container registry name.
:param pulumi.Input[str] azurecr_spn_tenantid: The tenant id of the service principal.
:param pulumi.Input[str] azurecr_subscription_id: The subscription id of the Azure targets.
:param pulumi.Input[str] azurecr_subscription_name: The subscription name of the Azure targets.
:param pulumi.Input[str] project_id: The project ID or project name.
:param pulumi.Input[str] resource_group: The resource group to which the container registry belongs.
:param pulumi.Input[str] service_endpoint_name: The name you will use to refer to this service connection in task inputs.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: ServiceEndpointAzureEcrArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
Manages a Azure Container Registry service endpoint within Azure DevOps.
## Example Usage
```python
import pulumi
import pulumi_azuredevops as azuredevops
project = azuredevops.Project("project",
visibility="private",
version_control="Git",
work_item_template="Agile")
# azure container registry service connection
azurecr = azuredevops.ServiceEndpointAzureEcr("azurecr",
project_id=project.id,
service_endpoint_name="Sample AzureCR",
resource_group="sample-rg",
azurecr_spn_tenantid="00000000-0000-0000-0000-000000000000",
azurecr_name="sampleAcr",
azurecr_subscription_id="00000000-0000-0000-0000-000000000000",
azurecr_subscription_name="sampleSub")
```
## Relevant Links
- [Azure DevOps Service REST API 5.1 - Service Endpoints](https://docs.microsoft.com/en-us/rest/api/azure/devops/serviceendpoint/endpoints?view=azure-devops-rest-5.1)
- [Azure Container Registry REST API](https://docs.microsoft.com/en-us/rest/api/containerregistry/)
## Import
Azure DevOps Service Endpoint Azure Container Registry can be imported using **projectID/serviceEndpointID** or **projectName/serviceEndpointID**
```sh
$ pulumi import azuredevops:index/serviceEndpointAzureEcr:ServiceEndpointAzureEcr serviceendpoint 00000000-0000-0000-0000-000000000000/00000000-0000-0000-0000-000000000000
```
:param str resource_name: The name of the resource.
:param ServiceEndpointAzureEcrArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(ServiceEndpointAzureEcrArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
authorization: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
azurecr_name: Optional[pulumi.Input[str]] = None,
azurecr_spn_tenantid: Optional[pulumi.Input[str]] = None,
azurecr_subscription_id: Optional[pulumi.Input[str]] = None,
azurecr_subscription_name: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
project_id: Optional[pulumi.Input[str]] = None,
resource_group: Optional[pulumi.Input[str]] = None,
service_endpoint_name: Optional[pulumi.Input[str]] = None,
__props__=None):
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = ServiceEndpointAzureEcrArgs.__new__(ServiceEndpointAzureEcrArgs)
__props__.__dict__["authorization"] = authorization
if azurecr_name is None and not opts.urn:
raise TypeError("Missing required property 'azurecr_name'")
__props__.__dict__["azurecr_name"] = azurecr_name
if azurecr_spn_tenantid is None and not opts.urn:
raise TypeError("Missing required property 'azurecr_spn_tenantid'")
__props__.__dict__["azurecr_spn_tenantid"] = azurecr_spn_tenantid
if azurecr_subscription_id is None and not opts.urn:
raise TypeError("Missing required property 'azurecr_subscription_id'")
__props__.__dict__["azurecr_subscription_id"] = azurecr_subscription_id
if azurecr_subscription_name is None and not opts.urn:
raise TypeError("Missing required property 'azurecr_subscription_name'")
__props__.__dict__["azurecr_subscription_name"] = azurecr_subscription_name
__props__.__dict__["description"] = description
if project_id is None and not opts.urn:
raise TypeError("Missing required property 'project_id'")
__props__.__dict__["project_id"] = project_id
if resource_group is None and not opts.urn:
raise TypeError("Missing required property 'resource_group'")
__props__.__dict__["resource_group"] = resource_group
if service_endpoint_name is None and not opts.urn:
raise TypeError("Missing required property 'service_endpoint_name'")
__props__.__dict__["service_endpoint_name"] = service_endpoint_name
__props__.__dict__["app_object_id"] = None
__props__.__dict__["az_spn_role_assignment_id"] = None
__props__.__dict__["az_spn_role_permissions"] = None
__props__.__dict__["service_principal_id"] = None
__props__.__dict__["spn_object_id"] = None
super(ServiceEndpointAzureEcr, __self__).__init__(
'azuredevops:index/serviceEndpointAzureEcr:ServiceEndpointAzureEcr',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
app_object_id: Optional[pulumi.Input[str]] = None,
authorization: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
az_spn_role_assignment_id: Optional[pulumi.Input[str]] = None,
az_spn_role_permissions: Optional[pulumi.Input[str]] = None,
azurecr_name: Optional[pulumi.Input[str]] = None,
azurecr_spn_tenantid: Optional[pulumi.Input[str]] = None,
azurecr_subscription_id: Optional[pulumi.Input[str]] = None,
azurecr_subscription_name: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
project_id: Optional[pulumi.Input[str]] = None,
resource_group: Optional[pulumi.Input[str]] = None,
service_endpoint_name: Optional[pulumi.Input[str]] = None,
service_principal_id: Optional[pulumi.Input[str]] = None,
spn_object_id: Optional[pulumi.Input[str]] = None) -> 'ServiceEndpointAzureEcr':
"""
Get an existing ServiceEndpointAzureEcr resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] azurecr_name: The Azure container registry name.
:param pulumi.Input[str] azurecr_spn_tenantid: The tenant id of the service principal.
:param pulumi.Input[str] azurecr_subscription_id: The subscription id of the Azure targets.
:param pulumi.Input[str] azurecr_subscription_name: The subscription name of the Azure targets.
:param pulumi.Input[str] project_id: The project ID or project name.
:param pulumi.Input[str] resource_group: The resource group to which the container registry belongs.
:param pulumi.Input[str] service_endpoint_name: The name you will use to refer to this service connection in task inputs.
:param pulumi.Input[str] service_principal_id: The service principal ID.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _ServiceEndpointAzureEcrState.__new__(_ServiceEndpointAzureEcrState)
__props__.__dict__["app_object_id"] = app_object_id
__props__.__dict__["authorization"] = authorization
__props__.__dict__["az_spn_role_assignment_id"] = az_spn_role_assignment_id
__props__.__dict__["az_spn_role_permissions"] = az_spn_role_permissions
__props__.__dict__["azurecr_name"] = azurecr_name
__props__.__dict__["azurecr_spn_tenantid"] = azurecr_spn_tenantid
__props__.__dict__["azurecr_subscription_id"] = azurecr_subscription_id
__props__.__dict__["azurecr_subscription_name"] = azurecr_subscription_name
__props__.__dict__["description"] = description
__props__.__dict__["project_id"] = project_id
__props__.__dict__["resource_group"] = resource_group
__props__.__dict__["service_endpoint_name"] = service_endpoint_name
__props__.__dict__["service_principal_id"] = service_principal_id
__props__.__dict__["spn_object_id"] = spn_object_id
return ServiceEndpointAzureEcr(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter(name="appObjectId")
def app_object_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "app_object_id")
@property
@pulumi.getter
def authorization(self) -> pulumi.Output[Mapping[str, str]]:
return pulumi.get(self, "authorization")
@property
@pulumi.getter(name="azSpnRoleAssignmentId")
def az_spn_role_assignment_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "az_spn_role_assignment_id")
@property
@pulumi.getter(name="azSpnRolePermissions")
def az_spn_role_permissions(self) -> pulumi.Output[str]:
return pulumi.get(self, "az_spn_role_permissions")
@property
@pulumi.getter(name="azurecrName")
def azurecr_name(self) -> pulumi.Output[str]:
"""
The Azure container registry name.
"""
return pulumi.get(self, "azurecr_name")
@property
@pulumi.getter(name="azurecrSpnTenantid")
def azurecr_spn_tenantid(self) -> pulumi.Output[str]:
"""
The tenant id of the service principal.
"""
return pulumi.get(self, "azurecr_spn_tenantid")
@property
@pulumi.getter(name="azurecrSubscriptionId")
def azurecr_subscription_id(self) -> pulumi.Output[str]:
"""
The subscription id of the Azure targets.
"""
return pulumi.get(self, "azurecr_subscription_id")
@property
@pulumi.getter(name="azurecrSubscriptionName")
def azurecr_subscription_name(self) -> pulumi.Output[str]:
"""
The subscription name of the Azure targets.
"""
return pulumi.get(self, "azurecr_subscription_name")
@property
@pulumi.getter
def description(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "description")
@property
@pulumi.getter(name="projectId")
def project_id(self) -> pulumi.Output[str]:
"""
The project ID or project name.
"""
return pulumi.get(self, "project_id")
@property
@pulumi.getter(name="resourceGroup")
def resource_group(self) -> pulumi.Output[str]:
"""
The resource group to which the container registry belongs.
"""
return pulumi.get(self, "resource_group")
@property
@pulumi.getter(name="serviceEndpointName")
def service_endpoint_name(self) -> pulumi.Output[str]:
"""
The name you will use to refer to this service connection in task inputs.
"""
return pulumi.get(self, "service_endpoint_name")
@property
@pulumi.getter(name="servicePrincipalId")
def service_principal_id(self) -> pulumi.Output[str]:
"""
The service principal ID.
"""
return pulumi.get(self, "service_principal_id")
@property
@pulumi.getter(name="spnObjectId")
def spn_object_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "spn_object_id")
| 45.064801 | 180 | 0.672898 | 3,502 | 30,599 | 5.581953 | 0.059966 | 0.081031 | 0.095253 | 0.079906 | 0.894311 | 0.876407 | 0.839472 | 0.811745 | 0.789799 | 0.758645 | 0 | 0.011211 | 0.227491 | 30,599 | 678 | 181 | 45.131268 | 0.815763 | 0.242492 | 0 | 0.629268 | 1 | 0 | 0.138742 | 0.06045 | 0 | 0 | 0 | 0 | 0 | 1 | 0.163415 | false | 0.002439 | 0.012195 | 0.034146 | 0.27561 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
93129c95771ca04d05eb2991fb85054ed49d3c82 | 15,794 | py | Python | pyboto3/outposts.py | gehad-shaat/pyboto3 | 4a0c2851a8bc04fb1c71c36086f7bb257e48181d | [
"MIT"
] | 91 | 2016-12-31T11:38:37.000Z | 2021-09-16T19:33:23.000Z | pyboto3/outposts.py | gehad-shaat/pyboto3 | 4a0c2851a8bc04fb1c71c36086f7bb257e48181d | [
"MIT"
] | 7 | 2017-01-02T18:54:23.000Z | 2020-08-11T13:54:02.000Z | pyboto3/outposts.py | gehad-shaat/pyboto3 | 4a0c2851a8bc04fb1c71c36086f7bb257e48181d | [
"MIT"
] | 26 | 2016-12-31T13:11:00.000Z | 2022-03-03T21:01:12.000Z | '''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''
def can_paginate(operation_name=None):
"""
Check if an operation can be paginated.
:type operation_name: string
:param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo').
"""
pass
def create_outpost(Name=None, Description=None, SiteId=None, AvailabilityZone=None, AvailabilityZoneId=None):
"""
Creates an Outpost.
See also: AWS API Documentation
Exceptions
:example: response = client.create_outpost(
Name='string',
Description='string',
SiteId='string',
AvailabilityZone='string',
AvailabilityZoneId='string'
)
:type Name: string
:param Name: The name of the Outpost.
:type Description: string
:param Description: The Outpost description.
:type SiteId: string
:param SiteId: [REQUIRED]\nThe ID of the site.\n
:type AvailabilityZone: string
:param AvailabilityZone: The Availability Zone.\nYou must specify AvailabilityZone or AvailabilityZoneId .\n
:type AvailabilityZoneId: string
:param AvailabilityZoneId: The ID of the Availability Zone.\nYou must specify AvailabilityZone or AvailabilityZoneId .\n
:rtype: dict
ReturnsResponse Syntax
{
'Outpost': {
'OutpostId': 'string',
'OwnerId': 'string',
'OutpostArn': 'string',
'SiteId': 'string',
'Name': 'string',
'Description': 'string',
'LifeCycleStatus': 'string',
'AvailabilityZone': 'string',
'AvailabilityZoneId': 'string'
}
}
Response Structure
(dict) --
Outpost (dict) --
Information about an Outpost.
OutpostId (string) --
The ID of the Outpost.
OwnerId (string) --
The AWS account ID of the Outpost owner.
OutpostArn (string) --
The Amazon Resource Name (ARN) of the Outpost.
SiteId (string) --
The ID of the site.
Name (string) --
The name of the Outpost.
Description (string) --
The Outpost description.
LifeCycleStatus (string) --
The life cycle status.
AvailabilityZone (string) --
The Availability Zone.
You must specify AvailabilityZone or AvailabilityZoneId .
AvailabilityZoneId (string) --
The ID of the Availability Zone.
You must specify AvailabilityZone or AvailabilityZoneId .
Exceptions
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.NotFoundException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
Outposts.Client.exceptions.ServiceQuotaExceededException
:return: {
'Outpost': {
'OutpostId': 'string',
'OwnerId': 'string',
'OutpostArn': 'string',
'SiteId': 'string',
'Name': 'string',
'Description': 'string',
'LifeCycleStatus': 'string',
'AvailabilityZone': 'string',
'AvailabilityZoneId': 'string'
}
}
:returns:
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.NotFoundException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
Outposts.Client.exceptions.ServiceQuotaExceededException
"""
pass
def delete_outpost(OutpostId=None):
"""
Deletes the Outpost.
See also: AWS API Documentation
Exceptions
:example: response = client.delete_outpost(
OutpostId='string'
)
:type OutpostId: string
:param OutpostId: [REQUIRED]\nThe ID of the Outpost.\n
:rtype: dict
ReturnsResponse Syntax{}
Response Structure
(dict) --
Exceptions
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.NotFoundException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
:return: {}
:returns:
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.NotFoundException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
"""
pass
def delete_site(SiteId=None):
"""
Deletes the site.
See also: AWS API Documentation
Exceptions
:example: response = client.delete_site(
SiteId='string'
)
:type SiteId: string
:param SiteId: [REQUIRED]\nThe ID of the site.\n
:rtype: dict
ReturnsResponse Syntax{}
Response Structure
(dict) --
Exceptions
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.NotFoundException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
:return: {}
:returns:
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.NotFoundException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
"""
pass
def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):
"""
Generate a presigned url given a client, its method, and arguments
:type ClientMethod: string
:param ClientMethod: The client method to presign for
:type Params: dict
:param Params: The parameters normally passed to\nClientMethod.
:type ExpiresIn: int
:param ExpiresIn: The number of seconds the presigned url is valid\nfor. By default it expires in an hour (3600 seconds)
:type HttpMethod: string
:param HttpMethod: The http method to use on the generated url. By\ndefault, the http method is whatever is used in the method\'s model.
"""
pass
def get_outpost(OutpostId=None):
"""
Gets information about the specified Outpost.
See also: AWS API Documentation
Exceptions
:example: response = client.get_outpost(
OutpostId='string'
)
:type OutpostId: string
:param OutpostId: [REQUIRED]\nThe ID of the Outpost.\n
:rtype: dict
ReturnsResponse Syntax{
'Outpost': {
'OutpostId': 'string',
'OwnerId': 'string',
'OutpostArn': 'string',
'SiteId': 'string',
'Name': 'string',
'Description': 'string',
'LifeCycleStatus': 'string',
'AvailabilityZone': 'string',
'AvailabilityZoneId': 'string'
}
}
Response Structure
(dict) --
Outpost (dict) --Information about an Outpost.
OutpostId (string) --The ID of the Outpost.
OwnerId (string) --The AWS account ID of the Outpost owner.
OutpostArn (string) --The Amazon Resource Name (ARN) of the Outpost.
SiteId (string) --The ID of the site.
Name (string) --The name of the Outpost.
Description (string) --The Outpost description.
LifeCycleStatus (string) --The life cycle status.
AvailabilityZone (string) --The Availability Zone.
You must specify AvailabilityZone or AvailabilityZoneId .
AvailabilityZoneId (string) --The ID of the Availability Zone.
You must specify AvailabilityZone or AvailabilityZoneId .
Exceptions
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.NotFoundException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
:return: {
'Outpost': {
'OutpostId': 'string',
'OwnerId': 'string',
'OutpostArn': 'string',
'SiteId': 'string',
'Name': 'string',
'Description': 'string',
'LifeCycleStatus': 'string',
'AvailabilityZone': 'string',
'AvailabilityZoneId': 'string'
}
}
"""
pass
def get_outpost_instance_types(OutpostId=None, NextToken=None, MaxResults=None):
"""
Lists the instance types for the specified Outpost.
See also: AWS API Documentation
Exceptions
:example: response = client.get_outpost_instance_types(
OutpostId='string',
NextToken='string',
MaxResults=123
)
:type OutpostId: string
:param OutpostId: [REQUIRED]\nThe ID of the Outpost.\n
:type NextToken: string
:param NextToken: The pagination token.
:type MaxResults: integer
:param MaxResults: The maximum page size.
:rtype: dict
ReturnsResponse Syntax
{
'InstanceTypes': [
{
'InstanceType': 'string'
},
],
'NextToken': 'string',
'OutpostId': 'string',
'OutpostArn': 'string'
}
Response Structure
(dict) --
InstanceTypes (list) --
Information about the instance types.
(dict) --
Information about an instance type.
InstanceType (string) --
The instance type.
NextToken (string) --
The pagination token.
OutpostId (string) --
The ID of the Outpost.
OutpostArn (string) --
The Amazon Resource Name (ARN) of the Outpost.
Exceptions
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.NotFoundException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
:return: {
'InstanceTypes': [
{
'InstanceType': 'string'
},
],
'NextToken': 'string',
'OutpostId': 'string',
'OutpostArn': 'string'
}
:returns:
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.NotFoundException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
"""
pass
def get_paginator(operation_name=None):
"""
Create a paginator for an operation.
:type operation_name: string
:param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo').
:rtype: L{botocore.paginate.Paginator}
ReturnsA paginator object.
"""
pass
def get_waiter(waiter_name=None):
"""
Returns an object that can wait for some condition.
:type waiter_name: str
:param waiter_name: The name of the waiter to get. See the waiters\nsection of the service docs for a list of available waiters.
:rtype: botocore.waiter.Waiter
"""
pass
def list_outposts(NextToken=None, MaxResults=None):
"""
List the Outposts for your AWS account.
See also: AWS API Documentation
Exceptions
:example: response = client.list_outposts(
NextToken='string',
MaxResults=123
)
:type NextToken: string
:param NextToken: The pagination token.
:type MaxResults: integer
:param MaxResults: The maximum page size.
:rtype: dict
ReturnsResponse Syntax
{
'Outposts': [
{
'OutpostId': 'string',
'OwnerId': 'string',
'OutpostArn': 'string',
'SiteId': 'string',
'Name': 'string',
'Description': 'string',
'LifeCycleStatus': 'string',
'AvailabilityZone': 'string',
'AvailabilityZoneId': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
Outposts (list) --
Information about the Outposts.
(dict) --
Information about an Outpost.
OutpostId (string) --
The ID of the Outpost.
OwnerId (string) --
The AWS account ID of the Outpost owner.
OutpostArn (string) --
The Amazon Resource Name (ARN) of the Outpost.
SiteId (string) --
The ID of the site.
Name (string) --
The name of the Outpost.
Description (string) --
The Outpost description.
LifeCycleStatus (string) --
The life cycle status.
AvailabilityZone (string) --
The Availability Zone.
You must specify AvailabilityZone or AvailabilityZoneId .
AvailabilityZoneId (string) --
The ID of the Availability Zone.
You must specify AvailabilityZone or AvailabilityZoneId .
NextToken (string) --
The pagination token.
Exceptions
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
:return: {
'Outposts': [
{
'OutpostId': 'string',
'OwnerId': 'string',
'OutpostArn': 'string',
'SiteId': 'string',
'Name': 'string',
'Description': 'string',
'LifeCycleStatus': 'string',
'AvailabilityZone': 'string',
'AvailabilityZoneId': 'string'
},
],
'NextToken': 'string'
}
:returns:
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
"""
pass
def list_sites(NextToken=None, MaxResults=None):
"""
Lists the sites for the specified AWS account.
See also: AWS API Documentation
Exceptions
:example: response = client.list_sites(
NextToken='string',
MaxResults=123
)
:type NextToken: string
:param NextToken: The pagination token.
:type MaxResults: integer
:param MaxResults: The maximum page size.
:rtype: dict
ReturnsResponse Syntax
{
'Sites': [
{
'SiteId': 'string',
'AccountId': 'string',
'Name': 'string',
'Description': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
Sites (list) --
Information about the sites.
(dict) --
Information about a site.
SiteId (string) --
The ID of the site.
AccountId (string) --
The ID of the AWS account.
Name (string) --
The name of the site.
Description (string) --
The description of the site.
NextToken (string) --
The pagination token.
Exceptions
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
:return: {
'Sites': [
{
'SiteId': 'string',
'AccountId': 'string',
'Name': 'string',
'Description': 'string'
},
],
'NextToken': 'string'
}
:returns:
Outposts.Client.exceptions.ValidationException
Outposts.Client.exceptions.AccessDeniedException
Outposts.Client.exceptions.InternalServerException
"""
pass
| 22.213783 | 330 | 0.668988 | 1,614 | 15,794 | 6.520446 | 0.152416 | 0.066515 | 0.114025 | 0.012353 | 0.74867 | 0.727575 | 0.714177 | 0.708666 | 0.708666 | 0.694603 | 0 | 0.001412 | 0.237749 | 15,794 | 710 | 331 | 22.24507 | 0.872747 | 0.944599 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0.5 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 8 |
9326315a37cd15a806d236bd264bfde918a27c1b | 221 | py | Python | statistik/views.py | almaaqila/tugas-tengah-semester-pbp | 7b7bc72ea19cedd61c77c26ed503efd9eb42bc0b | [
"MIT"
] | null | null | null | statistik/views.py | almaaqila/tugas-tengah-semester-pbp | 7b7bc72ea19cedd61c77c26ed503efd9eb42bc0b | [
"MIT"
] | null | null | null | statistik/views.py | almaaqila/tugas-tengah-semester-pbp | 7b7bc72ea19cedd61c77c26ed503efd9eb42bc0b | [
"MIT"
] | 5 | 2021-10-14T15:22:52.000Z | 2021-12-29T12:22:43.000Z | from django.shortcuts import render
# Create your views here.
def index(request):
return render(request, 'index_stats.html', {})
def index_mview(request):
return render(request, 'index_stats_mview.html', {}) | 27.625 | 56 | 0.723982 | 29 | 221 | 5.37931 | 0.551724 | 0.102564 | 0.24359 | 0.333333 | 0.461538 | 0.461538 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 221 | 8 | 56 | 27.625 | 0.834225 | 0.104072 | 0 | 0 | 0 | 0 | 0.192893 | 0.111675 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0.2 | 0.4 | 1 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 7 |
9352ad02ebaf37f820b25f4aa1e7a62435d17d0c | 3,609 | py | Python | pytext/torchscript/batchutils.py | jreese/pytext | 703922284c726fb625cbb1ad42e048b044b6d708 | [
"BSD-3-Clause"
] | 2 | 2022-01-21T17:04:19.000Z | 2022-01-21T17:04:25.000Z | pytext/torchscript/batchutils.py | jreese/pytext | 703922284c726fb625cbb1ad42e048b044b6d708 | [
"BSD-3-Clause"
] | null | null | null | pytext/torchscript/batchutils.py | jreese/pytext | 703922284c726fb625cbb1ad42e048b044b6d708 | [
"BSD-3-Clause"
] | 1 | 2021-11-21T06:17:30.000Z | 2021-11-21T06:17:30.000Z | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List, Optional, Tuple
class PytextEmbeddingModuleBatchSort:
def __init__(
self,
batchElement: Tuple[
Optional[List[str]], # texts
Optional[List[List[str]]], # multi_texts
Optional[List[List[str]]], # tokens
Optional[List[str]], # language,
Optional[List[List[float]]], # dense_feat
int,
],
argno: int = 0,
):
self.batchElement = batchElement
self.argno = argno
def __lt__(self, other: "PytextEmbeddingModuleBatchSort") -> bool:
argno = self.argno
if argno == 0:
this = self.batchElement[0]
that = other.batchElement[0]
if this is None:
return True
elif that is None:
return False
else:
# TBD: tokenize this and that,
# then sort by tokens instead of string length
# IGNORE LINTER message:
# torch.jit.frontend.UnsupportedNodeError: GeneratorExp aren't supported
return max([len(x) for x in this]) < max([len(x) for x in that]) # noqa
else:
raise NotImplementedError
return False
def be(
self,
) -> Tuple[
Optional[List[str]], # texts
Optional[List[List[str]]], # multi_texts
Optional[List[List[str]]], # tokens
Optional[List[str]], # language,
Optional[List[List[float]]], # dense_feat
int,
]:
"""return the batch element stored in this wrapper class"""
return self.batchElement
class PytextTwoTowerEmbeddingModuleBatchSort:
def __init__(
self,
batchElement: Tuple[
Optional[List[str]], # right_texts
Optional[List[str]], # left_texts
Optional[List[List[str]]], # right_tokens
Optional[List[List[str]]], # left_tokens
Optional[List[str]], # languages
Optional[List[List[float]]], # right_dense_feat
Optional[List[List[float]]], # left_dense_feat
int,
],
argno: int = 0,
):
self.batchElement = batchElement
self.argno = argno
def __lt__(self, other: "PytextTwoTowerEmbeddingModuleBatchSort") -> bool:
argno = self.argno
if argno == 0:
this = self.batchElement[0]
that = other.batchElement[0]
if this is None:
return True
elif that is None:
return False
else:
# TBD: tokenize this and that,
# then sort by tokens instead of string length
# IGNORE LINTER message:
# torch.jit.frontend.UnsupportedNodeError: GeneratorExp aren't supported
return max([len(x) for x in this]) < max([len(x) for x in that]) # noqa
else:
raise NotImplementedError
return False
def be(
self,
) -> Tuple[
Optional[List[str]], # right_texts
Optional[List[str]], # left_texts
Optional[List[List[str]]], # right_tokens
Optional[List[List[str]]], # left_tokens
Optional[List[str]], # languages
Optional[List[List[float]]], # right_dense_feat
Optional[List[List[float]]], # left_dense_feat
int,
]:
"""return the batch element stored in this wrapper class"""
return self.batchElement
| 31.657895 | 88 | 0.550568 | 374 | 3,609 | 5.216578 | 0.235294 | 0.147617 | 0.114813 | 0.077909 | 0.872373 | 0.872373 | 0.872373 | 0.872373 | 0.848795 | 0.848795 | 0 | 0.00384 | 0.350513 | 3,609 | 113 | 89 | 31.938053 | 0.828498 | 0.226656 | 0 | 0.941176 | 0 | 0 | 0.024772 | 0.024772 | 0 | 0 | 0 | 0 | 0 | 1 | 0.070588 | false | 0 | 0.011765 | 0 | 0.223529 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
93572282bdae2360ad163ddfb32c2e5c241e56a3 | 779 | py | Python | chapter2/oncodrivefm/tests.py | chris-zen/phd-thesis | 1eefdff8e7ca1910304e27ae42551dc64496b101 | [
"Unlicense"
] | 1 | 2015-12-22T00:53:18.000Z | 2015-12-22T00:53:18.000Z | chapter2/oncodrivefm/tests.py | chris-zen/phd-thesis | 1eefdff8e7ca1910304e27ae42551dc64496b101 | [
"Unlicense"
] | null | null | null | chapter2/oncodrivefm/tests.py | chris-zen/phd-thesis | 1eefdff8e7ca1910304e27ae42551dc64496b101 | [
"Unlicense"
] | null | null | null | import unittest as ut
# Test mapping --------------------------------------------------------------------------------------------------------
# TODO test mapping
# Test matrix and tdm -------------------------------------------------------------------------------------------------
# TODO test matrix and tdm
# Test methods --------------------------------------------------------------------------------------------------------
# TODO test methods
# Test analysis -------------------------------------------------------------------------------------------------------
# TODO test analysis
# Test commands -------------------------------------------------------------------------------------------------------
# TODO test commands
if __name__ == "__main__":
ut.main() | 32.458333 | 119 | 0.238768 | 38 | 779 | 4.684211 | 0.421053 | 0.224719 | 0.146067 | 0.179775 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.082157 | 779 | 24 | 120 | 32.458333 | 0.248951 | 0.883184 | 0 | 0 | 0 | 0 | 0.098765 | 0 | 0 | 0 | 0 | 0.041667 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 7 |
faeede5d5fadaf0bf27661937c265bcab1204b36 | 102 | py | Python | oblique_forests/tree/__init__.py | NeuroDataDesign/manifold_random_forests | 2c4b668c03f1f967c78d15fa9e6cb6c7f29b78c0 | [
"BSD-Source-Code"
] | 1 | 2021-04-28T02:58:55.000Z | 2021-04-28T02:58:55.000Z | oblique_forests/tree/__init__.py | NeuroDataDesign/manifold_random_forests | 2c4b668c03f1f967c78d15fa9e6cb6c7f29b78c0 | [
"BSD-Source-Code"
] | 4 | 2021-04-14T18:20:59.000Z | 2021-05-13T22:15:51.000Z | oblique_forests/tree/__init__.py | NeuroDataDesign/manifold_random_forests | 2c4b668c03f1f967c78d15fa9e6cb6c7f29b78c0 | [
"BSD-Source-Code"
] | null | null | null | from ._classes import ObliqueDecisionTreeClassifier
from ._classes import ObliqueDecisionTreeRegressor | 51 | 51 | 0.911765 | 8 | 102 | 11.375 | 0.625 | 0.241758 | 0.373626 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068627 | 102 | 2 | 52 | 51 | 0.957895 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 8 |
4f057b66927cf71532c8e5b37c23d4ca10f62e91 | 10,974 | py | Python | gcn/layers_gcn.py | ds4dm/GraphRL | b5b1519f6dd92b401625d51add9ae5829004a30b | [
"MIT"
] | 2 | 2021-02-26T18:51:01.000Z | 2021-07-12T05:20:18.000Z | gcn/layers_gcn.py | pandat8/GraphRL | b5b1519f6dd92b401625d51add9ae5829004a30b | [
"MIT"
] | 3 | 2019-05-09T20:59:10.000Z | 2020-05-13T14:03:50.000Z | gcn/layers_gcn.py | pandat8/GraphRL | b5b1519f6dd92b401625d51add9ae5829004a30b | [
"MIT"
] | 3 | 2018-08-13T20:43:29.000Z | 2020-05-13T14:00:57.000Z | import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.module import Module
from torch.nn.parameter import Parameter
class GraphConvolutionLayer(Module):
"""
Convolution layer for Graph
"""
def __init__(self, nfeatures_in, nfeatures_out, init='xavier', bias = True):
super(GraphConvolutionLayer, self).__init__()
self.nfeatures_in = nfeatures_in
self.nfeatures_out = nfeatures_out
# initialize the parameters
self.weight = nn.Parameter(nn.init.xavier_normal_(torch.Tensor(self.nfeatures_in, self.nfeatures_out).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor), gain=np.sqrt(2.0)), requires_grad=True)
#Parameter(torch.Tensor(self.nfeatures_in,self.nfeatures_out).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor))
if bias:
self.bias = nn.Parameter(nn.init.constant_(torch.Tensor(self.nfeatures_out).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor),0.0))
#Parameter(torch.Tensor(self.nfeatures_out).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor))
else:
self.register_parameter('bias',None)
if init == 'uniform':
print("| Uniform Initialization")
self.reset_parameters_uniform()
elif init == 'xavier':
print("| Xavier Initialization")
self.reset_parameters_xavier()
elif init == 'kaiming':
print("| Kaiming Initialization")
self.reset_parameters_kaiming()
else:
raise NotImplementedError
def reset_parameters_uniform(self):
stdv = 1. / math.sqrt(self.weight.size(1))
self.weight.data.uniform_(-stdv, stdv)
if self.bias is not None:
self.bias.data.uniform_(-stdv, stdv)
def reset_parameters_xavier(self):
nn.init.xavier_normal_(self.weight.data, gain=0.02) # Implement Xavier Uniform
if self.bias is not None:
nn.init.constant_(self.bias.data, 0.0)
def reset_parameters_kaiming(self):
nn.init.kaiming_normal_(self.weight.data, a=0, mode='fan_in')
if self.bias is not None:
nn.init.constant_(self.bias.data, 0.0)
def forward(self, features, adj_matrix):
features = torch.mm(features, self.weight) # features * weight
features = torch.mm(adj_matrix, features) # adjacency matrix * features
if self.bias is not None:
return features+ self.bias
else:
return features
def __repr__(self):
return self.__class__.__name__ \
+'('+str(self.nfeatures_in) \
+' -> '+str(self.nfeatures_out)+')'
class GraphConvolutionLayer_Sparse(Module):
"""
Convolution layer for Graph
"""
def __init__(self, nfeatures_in, nfeatures_out, init='xavier', bias = True):
super(GraphConvolutionLayer_Sparse, self).__init__()
self.nfeatures_in = nfeatures_in
self.nfeatures_out = nfeatures_out
# initialize the parameters
self.weight = nn.Parameter(nn.init.xavier_normal_(torch.Tensor(self.nfeatures_in, self.nfeatures_out).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor), gain=np.sqrt(2.0)), requires_grad=True)
#Parameter(torch.Tensor(self.nfeatures_in,self.nfeatures_out).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor))
if bias:
self.bias = nn.Parameter(nn.init.constant_(torch.Tensor(self.nfeatures_out).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor),0.0))
#Parameter(torch.Tensor(self.nfeatures_out).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor))
else:
self.register_parameter('bias',None)
if init == 'uniform':
print("| Uniform Initialization")
self.reset_parameters_uniform()
elif init == 'xavier':
print("| Xavier Initialization")
self.reset_parameters_xavier()
elif init == 'kaiming':
print("| Kaiming Initialization")
self.reset_parameters_kaiming()
else:
raise NotImplementedError
def reset_parameters_uniform(self):
stdv = 1. / math.sqrt(self.weight.size(1))
self.weight.data.uniform_(-stdv, stdv)
if self.bias is not None:
self.bias.data.uniform_(-stdv, stdv)
def reset_parameters_xavier(self):
nn.init.xavier_normal_(self.weight.data, gain=0.02) # Implement Xavier Uniform
if self.bias is not None:
nn.init.constant_(self.bias.data, 0.0)
def reset_parameters_kaiming(self):
nn.init.kaiming_normal_(self.weight.data, a=0, mode='fan_in')
if self.bias is not None:
nn.init.constant_(self.bias.data, 0.0)
def forward(self, features, adj_matrix):
features = torch.mm(features, self.weight) # features * weight
features = torch.spmm(adj_matrix, features) # adjacency matrix * features
if self.bias is not None:
return features+ self.bias
else:
return features
def __repr__(self):
return self.__class__.__name__ \
+'('+str(self.nfeatures_in) \
+' -> '+str(self.nfeatures_out)+')'
class GraphAttentionConvLayer(Module):
"""
Convolution layer for Graph
"""
def __init__(self, nfeatures_in, nfeatures_out, dropout, alpha, init='xavier', bias = True):
super(GraphAttentionConvLayer, self).__init__()
self.nfeatures_in = nfeatures_in
self.nfeatures_out = nfeatures_out
self.alpha = alpha
# initialize the parameters
self.weight = nn.Parameter(nn.init.xavier_normal_(torch.Tensor(self.nfeatures_in, self.nfeatures_out).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor), gain=np.sqrt(2.0)), requires_grad=True)
self.a = nn.Parameter(nn.init.xavier_normal_(torch.Tensor(2*nfeatures_out, 1).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor), gain=np.sqrt(2.0)),
requires_grad=True)
self.actvation = nn.LeakyReLU(alpha)
#Parameter(torch.Tensor(self.nfeatures_in,self.nfeatures_out).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor))
if bias:
self.bias = nn.Parameter(nn.init.constant_(torch.Tensor(self.nfeatures_out).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor),0.0))
#Parameter(torch.Tensor(self.nfeatures_out).type(torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor))
else:
self.register_parameter('bias',None)
if init == 'uniform':
print("| Uniform Initialization")
self.reset_parameters_uniform()
elif init == 'xavier':
print("| Xavier Initialization")
self.reset_parameters_xavier()
elif init == 'kaiming':
print("| Kaiming Initialization")
self.reset_parameters_kaiming()
else:
raise NotImplementedError
def reset_parameters_uniform(self):
stdv = 1. / math.sqrt(self.weight.size(1))
self.weight.data.uniform_(-stdv, stdv)
if self.bias is not None:
self.bias.data.uniform_(-stdv, stdv)
def reset_parameters_xavier(self):
nn.init.xavier_normal_(self.weight.data, gain=0.02) # Implement Xavier Uniform
if self.bias is not None:
nn.init.constant_(self.bias.data, 0.0)
def reset_parameters_kaiming(self):
nn.init.kaiming_normal_(self.weight.data, a=0, mode='fan_in')
if self.bias is not None:
nn.init.constant_(self.bias.data, 0.0)
# def __init__(self, nfeatures_in, nfeatures_out, dropout, alpha, bias = True):
#
# super(GraphAttentionConvLayer, self).__init__()
# self.nfeatures_in = nfeatures_in
# self.nfeatures_out = nfeatures_out
# self.dropout = dropout
# self.alpha = alpha
#
# self.weight = Parameter(torch.FloatTensor(nfeatures_in,nfeatures_out))
# self.a = Parameter(torch.FloatTensor(2*nfeatures_out,1))
# self.actvation = nn.LeakyReLU(alpha)
#
#
# if bias:
# self.bias = Parameter(torch.FloatTensor(nfeatures_out))
# else:
# self.register_parameter('bias',None)
# self.init_parameters()
# # self.sparse_softmax()
#
# def init_parameters(self):
# uni_dis = 1./ math.sqrt(self.weight.size(1))
# self.weight.data.uniform_(-uni_dis,uni_dis)
#
# uni_dis_a = 1./ math.sqrt(self.a.size(1))
# self.a.data.uniform_(-uni_dis_a,uni_dis_a)
# if self.bias is not None:
# self.bias.data.uniform_(-uni_dis,uni_dis)
def sparse_softmax(self, sparse_matrix, dim=0):
"""
Return the softmax of torch.sparse 2d-tensor on
:param sparse_matrix:
:return:
"""
i = sparse_matrix._indices()
v = sparse_matrix._values()
v =F.softmax(v)
# for n in range(i[dim,:].max()+1):
# set=np.where(i[dim,:]==n)[0]
# v[set]=F.softmax(v[set])
# # print(rowset)
# # print(a._values()[rowset])
# v = F.dropout(v, self.dropout, training=self.training)
sparse_matrix._values = v
return sparse_matrix
def forward(self, features, adj_sparse):
features = torch.mm(features, self.weight) # features parameterized by weight
if self.bias is not None:
features += self.bias
# build attention sparse matrix
adj_idx = adj_sparse._indices() # get index set of adj
if adj_idx.numel(): # if index set is not empty
adj_features = torch.cat([ features[adj_idx[0],:], features[adj_idx[1],:] ], dim=1) # get adj feature pairs
adj_v= self.actvation(torch.matmul(adj_features, self.a)) # calculate values of attention adj
adj_v = adj_v.view(-1)
if torch.cuda.is_available():
atten_sparse = torch.cuda.sparse.FloatTensor(adj_idx, adj_v, adj_sparse.size()) # build attention sparse adj matrix
else:
atten_sparse = torch.sparse.FloatTensor(adj_idx, adj_v, adj_sparse.size()) # build attention sparse adj matrix
# atten_sparse = self.sparse_softmax(sparse_matrix = atten_sparse, dim=0) # softmax of attention
features = torch.spmm(atten_sparse, features)
return features
# a1 = atten_sparse.to_dense()
def __repr__(self):
return self.__class__.__name__ \
+'('+str(self.nfeatures_in) \
+' -> '+str(self.nfeatures_out)+')'
| 40.345588 | 231 | 0.64343 | 1,370 | 10,974 | 4.951095 | 0.090511 | 0.068996 | 0.044818 | 0.026832 | 0.801415 | 0.785051 | 0.773846 | 0.767802 | 0.761905 | 0.753796 | 0 | 0.007437 | 0.240295 | 10,974 | 271 | 232 | 40.494465 | 0.806165 | 0.244305 | 0 | 0.76875 | 0 | 0 | 0.041656 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.11875 | false | 0 | 0.04375 | 0.01875 | 0.2375 | 0.05625 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
878a7d48d0ed138f38052b178259be70454454ab | 1,690 | py | Python | src/documents/forms.py | caeltarifa/Publicacion_diital | 6b5cdcd51d64b2e40268c716f37d548fa0113b33 | [
"CC0-1.0"
] | 1 | 2022-02-27T03:38:35.000Z | 2022-02-27T03:38:35.000Z | src/documents/forms.py | caeltarifa/Publicacion_diital | 6b5cdcd51d64b2e40268c716f37d548fa0113b33 | [
"CC0-1.0"
] | null | null | null | src/documents/forms.py | caeltarifa/Publicacion_diital | 6b5cdcd51d64b2e40268c716f37d548fa0113b33 | [
"CC0-1.0"
] | null | null | null | from django import forms
from django.core.validators import FileExtensionValidator
class AddDocument(forms.Form):
title = forms.CharField()
description = forms.CharField(required=False)
document = forms.FileField(validators=[FileExtensionValidator(
allowed_extensions=['pdf', 'odt', 'fodt']
)])
document2 = forms.FileField(validators=[FileExtensionValidator(
allowed_extensions=['pdf', 'odt', 'fodt']
)], required=False)
document3 = forms.FileField(validators=[FileExtensionValidator(
allowed_extensions=['pdf', 'odt', 'fodt']
)], required=False)
document4 = forms.FileField(validators=[FileExtensionValidator(
allowed_extensions=['pdf', 'odt', 'fodt']
)], required=False)
document5 = forms.FileField(validators=[FileExtensionValidator(
allowed_extensions=['pdf', 'odt', 'fodt']
)], required=False)
document6 = forms.FileField(validators=[FileExtensionValidator(
allowed_extensions=['pdf', 'odt', 'fodt']
)], required=False)
document7 = forms.FileField(validators=[FileExtensionValidator(
allowed_extensions=['pdf', 'odt', 'fodt']
)], required=False)
document8 = forms.FileField(validators=[FileExtensionValidator(
allowed_extensions=['pdf', 'odt', 'fodt']
)], required=False)
document9 = forms.FileField(validators=[FileExtensionValidator(
allowed_extensions=['pdf', 'odt', 'fodt']
)], required=False)
document10 = forms.FileField(validators=[FileExtensionValidator(
allowed_extensions=['pdf', 'odt', 'fodt']
)], required=False) | 46.944444 | 65 | 0.652071 | 140 | 1,690 | 7.8 | 0.221429 | 0.119048 | 0.21978 | 0.421245 | 0.775641 | 0.775641 | 0.775641 | 0.775641 | 0.775641 | 0.708791 | 0 | 0.007491 | 0.210059 | 1,690 | 36 | 66 | 46.944444 | 0.810487 | 0 | 0 | 0.542857 | 0 | 0 | 0.059137 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.057143 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
87e5aadd26c169a9afff6c8e6447adab971dd600 | 3,361 | py | Python | tests/test_main.py | abhaygupta97/moban | 203d5c368c0f64c1b2f1cdfebdff1ded2157d7df | [
"MIT"
] | null | null | null | tests/test_main.py | abhaygupta97/moban | 203d5c368c0f64c1b2f1cdfebdff1ded2157d7df | [
"MIT"
] | null | null | null | tests/test_main.py | abhaygupta97/moban | 203d5c368c0f64c1b2f1cdfebdff1ded2157d7df | [
"MIT"
] | null | null | null | import os
import sys
from shutil import copyfile
import moban.exceptions as exceptions
from mock import patch
from nose.tools import raises
class TestException:
def setUp(self):
self.moban_file = ".moban.yml"
self.data_file = "data.yml"
def tearDown(self):
if os.path.exists(self.moban_file):
os.unlink(self.moban_file)
if os.path.exists(self.data_file):
os.unlink(self.data_file)
if os.path.exists(".moban.hashes"):
os.unlink(".moban.hashes")
@raises(exceptions.MobanfileGrammarException)
def test_handle_moban_file(self):
copyfile(
os.path.join("tests", "fixtures", ".moban-version-1234.yml"),
self.moban_file,
)
import moban.main as main
main.handle_moban_file(self.moban_file, {})
@raises(exceptions.MobanfileGrammarException)
def test_version_1_is_recognized(self):
copyfile(
os.path.join("tests", "fixtures", ".moban-version-1.0.yml"),
self.moban_file,
)
copyfile(
os.path.join("tests", "fixtures", ".moban-version-1.0.yml"),
self.data_file,
)
import moban.main as main
main.handle_moban_file(self.moban_file, {})
@raises(SystemExit)
@patch("os.path.exists")
@patch("moban.main.handle_moban_file")
@patch("moban.reporter.report_error_message")
def test_directory_not_found(
self, fake_reporter, fake_moban_file, fake_file
):
fake_file.return_value = True
fake_moban_file.side_effect = exceptions.DirectoryNotFound
from moban.main import main
with patch.object(sys, "argv", ["moban"]):
main()
@raises(SystemExit)
@patch("os.path.exists")
@patch("moban.main.handle_moban_file")
@patch("moban.reporter.report_error_message")
def test_no_third_party_engine(
self, fake_reporter, fake_moban_file, fake_file
):
fake_file.return_value = True
fake_moban_file.side_effect = exceptions.NoThirdPartyEngine
from moban.main import main
with patch.object(sys, "argv", ["moban"]):
main()
class TestExitCodes:
def setUp(self):
self.moban_file = ".moban.yml"
self.data_file = "data.yml"
def tearDown(self):
if os.path.exists(self.moban_file):
os.unlink(self.moban_file)
if os.path.exists(self.data_file):
os.unlink(self.data_file)
if os.path.exists(".moban.hashes"):
os.unlink(".moban.hashes")
@raises(SystemExit)
@patch("moban.main.handle_moban_file")
@patch("moban.mobanfile.find_default_moban_file")
def test_has_many_files(self, fake_find_file, fake_moban_file):
fake_find_file.return_value = "abc"
fake_moban_file.return_value = 1
from moban.main import main
with patch.object(sys, "argv", ["moban"]):
main()
@raises(SystemExit)
@patch("moban.main.handle_command_line")
@patch("moban.mobanfile.find_default_moban_file")
def test_handle_single_change(self, fake_find_file, fake_command_line):
fake_find_file.return_value = None
fake_command_line.return_value = 1
from moban.main import main
with patch.object(sys, "argv", ["moban"]):
main()
| 30.554545 | 75 | 0.639988 | 423 | 3,361 | 4.855792 | 0.182033 | 0.105161 | 0.063291 | 0.040896 | 0.813048 | 0.730282 | 0.718111 | 0.718111 | 0.703992 | 0.634372 | 0 | 0.004331 | 0.244273 | 3,361 | 109 | 76 | 30.834862 | 0.804331 | 0 | 0 | 0.711111 | 0 | 0 | 0.155608 | 0.097888 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.133333 | 0 | 0.266667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
3558727542c2b1e9d03612da233084ce8982f2ff | 26,848 | py | Python | dakara_server/playlist/tests/test_device.py | DakaraProject/dakara-server | b28fc1a8561e431d562102932f3d6ff3607e545b | [
"MIT"
] | 4 | 2018-07-24T18:22:16.000Z | 2020-01-24T16:30:54.000Z | dakara_server/playlist/tests/test_device.py | DakaraProject/dakara-server | b28fc1a8561e431d562102932f3d6ff3607e545b | [
"MIT"
] | 88 | 2017-11-04T08:58:02.000Z | 2022-03-30T11:39:08.000Z | dakara_server/playlist/tests/test_device.py | DakaraProject/dakara-server | b28fc1a8561e431d562102932f3d6ff3607e545b | [
"MIT"
] | 1 | 2018-05-05T15:37:20.000Z | 2018-05-05T15:37:20.000Z | from datetime import timedelta
import pytest
from channels.db import database_sync_to_async
from channels.layers import get_channel_layer
from channels.testing import WebsocketCommunicator
from django.urls import reverse
from rest_framework import status
from dakara_server.asgi import application
from playlist import models
channel_layer = get_channel_layer()
@pytest.fixture
async def communicator(playlist_provider):
"""Gives a WebSockets communicator."""
# create a communicator
communicator = WebsocketCommunicator(application, "/ws/playlist/device/")
# artificially give it a user
communicator.scope["user"] = playlist_provider.player
await communicator.connect()
return communicator
@pytest.fixture
async def get_karaoke():
"""Allows to retrieve a karaoke"""
async def func():
return await database_sync_to_async(
lambda: models.Karaoke.objects.get_object()
)()
return func
@pytest.fixture
async def get_player(get_karaoke):
"""Allows to retrieve a player"""
async def func():
karaoke = await get_karaoke()
player, _ = await database_sync_to_async(
lambda: models.Player.cache.get_or_create(karaoke=karaoke)
)()
return player
return func
@pytest.mark.asyncio
@pytest.mark.django_db(transaction=True)
class TestDevice:
async def test_authenticate_basic(self, playlist_provider, get_karaoke):
"""Test to authenticate as the communicator fixture."""
# create a communicator
communicator = WebsocketCommunicator(application, "/ws/playlist/device/")
# artificially give it a user
communicator.scope["user"] = playlist_provider.player
# check there is no communicator registered
karaoke = await get_karaoke()
assert karaoke.channel_name is None
# connect and check connection is established
connected, _ = await communicator.connect()
assert connected
# check communicator is registered
karaoke = await get_karaoke()
assert karaoke.channel_name is not None
# close connection
await communicator.disconnect()
async def test_authenticate(self, playlist_provider, get_karaoke):
"""Test to authenticate with a token.
This is the normal mechanism of real-life connection. In the tests, we
assume the user is already in the scope.
"""
# create a token
headers = []
playlist_provider.authenticate(playlist_provider.player, headers=headers)
# create a communicator
communicator = WebsocketCommunicator(
application, "/ws/playlist/device/", headers=headers
)
# check there is no communicator registered
karaoke = await get_karaoke()
assert karaoke.channel_name is None
# connect and check connection is established
connected, _ = await communicator.connect()
assert connected
assert communicator.scope["user"] == playlist_provider.player
# check communicator is registered
karaoke = await get_karaoke()
assert karaoke.channel_name is not None
# close connection
await communicator.disconnect()
async def test_authenticate_player_twice_failed(self, playlist_provider):
"""Test to authenticate two players successively.
The second connection should be rejected.
"""
# authenticate first player
communicator_first = WebsocketCommunicator(application, "/ws/playlist/device/")
communicator_first.scope["user"] = playlist_provider.player
connected, _ = await communicator_first.connect()
assert connected
# authenticate second player
communicator_second = WebsocketCommunicator(application, "/ws/playlist/device/")
communicator_second.scope["user"] = playlist_provider.player
connected, _ = await communicator_second.connect()
assert not connected
# close connections
await communicator_first.disconnect()
await communicator_second.disconnect()
async def test_authenticate_user_failed(self, playlist_provider):
"""Test to authenticate as a normal user."""
communicator = WebsocketCommunicator(application, "/ws/playlist/device/")
communicator.scope["user"] = playlist_provider.user
connected, _ = await communicator.connect()
assert not connected
# close connection
await communicator.disconnect()
async def test_authenticate_anonymous_user_failed(
self, playlist_provider, get_karaoke
):
"""Test to authenticate as a anonymous user."""
# create a communicator
communicator = WebsocketCommunicator(application, "/ws/playlist/device/")
# check there is no communicator registered
karaoke = await get_karaoke()
assert karaoke.channel_name is None
# connect and check connection is not established
connected, _ = await communicator.connect()
assert not connected
# check communicator is registered
karaoke = await get_karaoke()
assert karaoke.channel_name is None
# close connection
await communicator.disconnect()
async def test_authenticate_playing_entry_playing(
self, playlist_provider, get_player
):
"""Test to authenticate when a playlist entry is supposed to be playing."""
# create a communicator
communicator = WebsocketCommunicator(application, "/ws/playlist/device/")
communicator.scope["user"] = playlist_provider.player
# set a playlist entry playing
playlist_provider.player_play_next_song(timing=timedelta(seconds=10))
playlist_entry = (await get_player()).playlist_entry
assert playlist_entry is not None
# connect and check connection is established
connected, _ = await communicator.connect()
assert connected
# check there are no playing playlist entry
playlist_entry = await database_sync_to_async(
lambda: models.PlaylistEntry.objects.get_playing()
)()
assert playlist_entry is None
# close connection
await communicator.disconnect()
async def test_receive_ready_send_playlist_entry(
self, playlist_provider, player, communicator
):
"""Test that a new song is requested to play when the player is ready.
There are playlist entries awaiting to be played.
"""
assert player.playlist_entry is None
# send the event
await communicator.send_json_to({"type": "ready"})
# get the new song event
event = await communicator.receive_json_from()
assert event["type"] == "playlist_entry"
assert event["data"]["id"] == playlist_provider.pe1.id
# check there are no other messages
done = await communicator.receive_nothing()
assert done
# close connection
await communicator.disconnect()
async def test_receive_ready_send_idle(
self, playlist_provider, player, communicator
):
"""Test that idle screen is requested to play when the player is ready.
The playlist is empty.
"""
# empty the playlist
await database_sync_to_async(
lambda: models.PlaylistEntry.objects.all().delete()
)()
assert player.playlist_entry is None
# send the event
await communicator.send_json_to({"type": "ready"})
# get the new song event
event = await communicator.receive_json_from()
assert event["type"] == "idle"
# check there are no other messages
done = await communicator.receive_nothing()
assert done
# close connection
await communicator.disconnect()
async def test_send_playlist_entry(
self, playlist_provider, player, communicator, get_karaoke, get_player
):
"""Test to send a new playlist entry to the device."""
# pre assert
assert playlist_provider.pe1.date_played is None
karaoke = await get_karaoke()
# call the method
await channel_layer.send(
karaoke.channel_name,
{"type": "send_playlist_entry", "playlist_entry": playlist_provider.pe1},
)
# wait the outcoming event
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "playlist_entry"
assert event["data"]["id"] == playlist_provider.pe1.id
# assert there are no side effects
player_new = await get_player()
assert player_new == player
# check there are no other messages
done = await communicator.receive_nothing()
assert done
# close connection
await communicator.disconnect()
async def test_send_playlist_entry_failed_none(
self, player, communicator, get_karaoke, get_player
):
"""Test a null playlist entry cannot be sent to the device."""
# pre assert
assert player.playlist_entry is None
karaoke = await get_karaoke()
# call the method
await channel_layer.send(
karaoke.channel_name,
{"type": "send_playlist_entry", "playlist_entry": None},
)
# wait the outcoming event
with pytest.raises(ValueError):
await communicator.wait()
# assert there are no side effects
player_new = await get_player()
assert player_new == player
# check there are no other messages
done = await communicator.receive_nothing()
assert done
# no need to close connection
async def test_send_idle(
self, playlist_provider, player, communicator, get_karaoke, get_player
):
"""Test to send a new playlist entry to the device."""
karaoke = await get_karaoke()
# call the method
await channel_layer.send(karaoke.channel_name, {"type": "send_idle"})
# wait the outcoming event
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "idle"
# assert there are no side effects
player_new = await get_player()
assert player_new == player
# check there are no other messages
done = await communicator.receive_nothing()
assert done
# close connection
await communicator.disconnect()
async def test_send_command_pause(
self, playlist_provider, player, communicator, get_karaoke, get_player
):
"""Test to send to the player a pause command."""
karaoke = await get_karaoke()
# call the method
await channel_layer.send(
karaoke.channel_name, {"type": "send_command", "command": "pause"}
)
# wait the outcoming event
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "command"
assert event["data"]["command"] == "pause"
# assert there are no side effects
player_new = await get_player()
assert player_new == player
# check there are no other messages
done = await communicator.receive_nothing()
assert done
# close connection
await communicator.disconnect()
async def test_send_command_play(
self, playlist_provider, player, communicator, get_karaoke, get_player
):
"""Test to send to the player a play command."""
karaoke = await get_karaoke()
# call the method
await channel_layer.send(
karaoke.channel_name, {"type": "send_command", "command": "play"}
)
# wait the outcoming event
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "command"
assert event["data"]["command"] == "play"
# assert there are no side effects
player_new = await get_player()
assert player_new == player
# check there are no other messages
done = await communicator.receive_nothing()
assert done
# close connection
await communicator.disconnect()
async def test_send_command_skip(
self, playlist_provider, player, communicator, get_karaoke, get_player
):
"""Test to send to the player a skip command."""
karaoke = await get_karaoke()
# call the method
await channel_layer.send(
karaoke.channel_name, {"type": "send_command", "command": "skip"}
)
# wait the outcoming event
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "command"
assert event["data"]["command"] == "skip"
# assert there are no side effects
player_new = await get_player()
assert player_new == player
# check there are no other messages
done = await communicator.receive_nothing()
assert done
# close connection
await communicator.disconnect()
async def test_send_command_failed(
self, player, communicator, get_karaoke, get_player
):
"""Test an invalid command cannot be sent to the player."""
karaoke = await get_karaoke()
# call the method
await channel_layer.send(
karaoke.channel_name, {"type": "send_command", "command": "unknown"}
)
# wait the outcoming event
with pytest.raises(ValueError):
await communicator.wait()
# assert there are no side effects
player_new = await get_player()
assert player_new == player
# check there are no other messages
done = await communicator.receive_nothing()
assert done
# no need to close connection
async def test_send_handle_next(
self,
playlist_provider,
player,
communicator,
client_drf,
mocker,
get_karaoke,
get_player,
):
"""Test to handle next playlist entries untill the end of the playlist."""
# configure HTTP client
url = reverse("playlist-player-status")
playlist_provider.authenticate(playlist_provider.player, client=client_drf)
# mock the broadcaster
# we cannot call it within an asynchronous test
mocker.patch("playlist.views.send_to_channel")
# mocked_send_to_channel = mocker.patch("playlist.views.send_to_channel")
# assert kara is ongoing and player play next song
karaoke = await get_karaoke()
assert karaoke.ongoing
assert karaoke.player_play_next_song
# assert player is currently idle
assert player.playlist_entry is None
# play the first playlist entry
await channel_layer.send(karaoke.channel_name, {"type": "handle_next"})
# wait for the event of the first playlist entry to play
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "playlist_entry"
assert event["data"]["id"] == playlist_provider.pe1.id
# notify the first playlist entry is being played
response = client_drf.put(
url,
data={
"event": "started_transition",
"playlist_entry_id": playlist_provider.pe1.id,
},
)
assert response.status_code == status.HTTP_200_OK
response = client_drf.put(
url,
data={
"event": "started_song",
"playlist_entry_id": playlist_provider.pe1.id,
},
)
assert response.status_code == status.HTTP_200_OK
# assert the player has been updated
player = await get_player()
assert player.playlist_entry == playlist_provider.pe1
# # assert the front has been notified
# mocked_send_to_channel.assert_called_with(
# "playlist.front", "send_player_status", {"player": player}
# )
# notify the first playlist entry has finished
response = client_drf.put(
url,
data={"event": "finished", "playlist_entry_id": playlist_provider.pe1.id},
)
assert response.status_code == status.HTTP_200_OK
# assert the player has been updated
player = await get_player()
assert player.playlist_entry is None
# play the second playlist entry
await channel_layer.send(karaoke.channel_name, {"type": "handle_next"})
# wait for the event of the second playlist entry to play
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "playlist_entry"
assert event["data"]["id"] == playlist_provider.pe2.id
# notify the second playlist entry is being played
response = client_drf.put(
url,
data={
"event": "started_transition",
"playlist_entry_id": playlist_provider.pe2.id,
},
)
assert response.status_code == status.HTTP_200_OK
response = client_drf.put(
url,
data={
"event": "started_song",
"playlist_entry_id": playlist_provider.pe2.id,
},
)
assert response.status_code == status.HTTP_200_OK
# assert the player has been updated
player = await get_player()
assert player.playlist_entry == playlist_provider.pe2
# notify the second playlist entry has finished
response = client_drf.put(
url,
data={"event": "finished", "playlist_entry_id": playlist_provider.pe2.id},
)
assert response.status_code == status.HTTP_200_OK
# assert the player has been updated
player = await get_player()
assert player.playlist_entry is None
# # assert the front has been notified
# mocked_send_to_channel.assert_called_with(
# "playlist.front", "send_player_status", {"player": player}
# )
# now the playlist should be empty
await channel_layer.send(karaoke.channel_name, {"type": "handle_next"})
# wait for the event of idle
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "idle"
# check there are no other messages
done = await communicator.receive_nothing()
assert done
# close connection
await communicator.disconnect()
async def test_send_handle_next_pause_skip(
self,
playlist_provider,
player,
communicator,
client_drf,
mocker,
get_karaoke,
get_player,
):
"""Test to handle next playlist entries then pause then skip."""
# configure HTTP client
url = reverse("playlist-player-status")
playlist_provider.authenticate(playlist_provider.player, client=client_drf)
# mock the broadcaster
# we cannot call it within an asynchronous test
mocker.patch("playlist.views.send_to_channel")
# assert player is currently idle
assert player.playlist_entry is None
# play the first playlist entry
karaoke = await get_karaoke()
await channel_layer.send(karaoke.channel_name, {"type": "handle_next"})
# wait for the event of the first playlist entry to play
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "playlist_entry"
assert event["data"]["id"] == playlist_provider.pe1.id
# notify the first playlist entry is being played
response = client_drf.put(
url,
data={
"event": "started_transition",
"playlist_entry_id": playlist_provider.pe1.id,
},
)
assert response.status_code == status.HTTP_200_OK
response = client_drf.put(
url,
data={
"event": "started_song",
"playlist_entry_id": playlist_provider.pe1.id,
},
)
assert response.status_code == status.HTTP_200_OK
# assert the player has been updated
player = await get_player()
assert player.playlist_entry == playlist_provider.pe1
# pause the player
await channel_layer.send(
karaoke.channel_name, {"type": "send_command", "command": "pause"}
)
# wait the outcoming event
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "command"
assert event["data"]["command"] == "pause"
# notify the player is paused
response = client_drf.put(
url,
data={
"event": "paused",
"playlist_entry_id": playlist_provider.pe1.id,
"timing": 2,
},
)
assert response.status_code == status.HTTP_200_OK
# assert the player has been updated
player = await get_player()
assert player.paused
# skip the current playlist entry
await channel_layer.send(
karaoke.channel_name, {"type": "send_command", "command": "skip"}
)
# wait the outcoming event
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "command"
assert event["data"]["command"] == "skip"
# notify the first playlist entry has finished
response = client_drf.put(
url,
data={"event": "finished", "playlist_entry_id": playlist_provider.pe1.id},
)
assert response.status_code == status.HTTP_200_OK
# assert the player has been updated
player2 = await get_player()
assert player2.playlist_entry is None
assert not player2.paused
# play the second playlist entry
await channel_layer.send(karaoke.channel_name, {"type": "handle_next"})
# wait for the event of the second playlist entry to play
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "playlist_entry"
assert event["data"]["id"] == playlist_provider.pe2.id
# close connection
await communicator.disconnect()
async def test_send_handle_next_karaoke_not_ongoing(
self, playlist_provider, player, communicator, get_karaoke, get_player
):
"""Test to handle next playlist entries when the karaoke is not ongoing."""
# set the karaoke not ongoing
await database_sync_to_async(
lambda: playlist_provider.set_karaoke(ongoing=False)
)()
karaoke = await get_karaoke()
# empty the playlist
await database_sync_to_async(
lambda: models.PlaylistEntry.objects.all().delete()
)()
# assert player is currently idle
assert player.playlist_entry is None
# the playlist should be empty
await channel_layer.send(karaoke.channel_name, {"type": "handle_next"})
# wait for the event of idle
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "idle"
# assert the player has not changed
player_new = await get_player()
assert player == player_new
# check there are no other messages
done = await communicator.receive_nothing()
assert done
# close connection
await communicator.disconnect()
async def test_send_handle_next_karaoke_not_play_next_song(
self, playlist_provider, player, communicator, get_karaoke, get_player
):
"""Test to handle next playlist entries when the player does not play
next song."""
# set player does not play next song
await database_sync_to_async(
lambda: playlist_provider.set_karaoke(player_play_next_song=False)
)()
karaoke = await get_karaoke()
# assert player is currently idle
assert player.playlist_entry is None
# there should not be anything to play for now
await channel_layer.send(karaoke.channel_name, {"type": "handle_next"})
# wait for the event of idle
event = await communicator.receive_json_from()
# assert the event
assert event["type"] == "idle"
# assert the player has not changed
player_new = await get_player()
assert player == player_new
# check there are no other messages
done = await communicator.receive_nothing()
assert done
# close connection
await communicator.disconnect()
async def test_connect_reset_playing_playlist_entry(
self, playlist_provider, player, get_player
):
"""Test to reset playing playlist entry."""
communicator = WebsocketCommunicator(application, "/ws/playlist/device/")
communicator.scope["user"] = playlist_provider.player
connected, _ = await communicator.connect()
# set player playing
await database_sync_to_async(
lambda: playlist_provider.player_play_next_song()
)()
assert player.playlist_entry is not None
# disconnect and reconnect the player
await communicator.disconnect()
communicator_new = WebsocketCommunicator(application, "/ws/playlist/device/")
communicator_new.scope["user"] = playlist_provider.player
connected, _ = await communicator_new.connect()
# check that the player is idle
player_new = await get_player()
assert player_new.playlist_entry is None
await communicator_new.disconnect()
async def test_disconnect_player_while_playing(
self, playlist_provider, player, communicator
):
"""Test that current playlist entry is reseted when player is disconnected."""
# start playing a song
await database_sync_to_async(
lambda: playlist_provider.player_play_next_song(timing=timedelta(seconds=1))
)()
assert player.playlist_entry == playlist_provider.pe1
# stop the player connection
await communicator.disconnect()
# assert the play is stopped
assert player.playlist_entry is None
assert player.timing == timedelta()
# check there are no other messages
done = await communicator.receive_nothing()
assert done
| 31.961905 | 88 | 0.635504 | 2,979 | 26,848 | 5.546828 | 0.074857 | 0.054285 | 0.042121 | 0.023965 | 0.853244 | 0.832123 | 0.800472 | 0.767006 | 0.738744 | 0.704914 | 0 | 0.003085 | 0.287731 | 26,848 | 839 | 89 | 32 | 0.861005 | 0.17059 | 0 | 0.7287 | 0 | 0 | 0.067482 | 0.005089 | 0 | 0 | 0 | 0 | 0.219731 | 1 | 0 | false | 0 | 0.020179 | 0 | 0.033632 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
357270a89050b28a229d31b3c3cde6502f53bda7 | 70 | py | Python | ConsoleInterface/wait.py | ChocolaKuma/KumasCookbook | 863626a873cecb0ce9e83fcdb906fa2b6636c0ff | [
"MIT"
] | 3 | 2017-04-03T05:54:46.000Z | 2020-11-17T23:28:15.000Z | ConsoleInterface/wait.py | ChocolaKuma/KumasCookbook | 863626a873cecb0ce9e83fcdb906fa2b6636c0ff | [
"MIT"
] | 1 | 2017-04-13T19:11:00.000Z | 2017-04-13T19:20:46.000Z | ConsoleInterface/wait.py | ChocolaKuma/KumasCookbook | 863626a873cecb0ce9e83fcdb906fa2b6636c0ff | [
"MIT"
] | 1 | 2020-11-17T23:28:17.000Z | 2020-11-17T23:28:17.000Z | def wait(time_to_wait):
import time
time.sleep(time_to_wait) | 23.333333 | 28 | 0.714286 | 12 | 70 | 3.833333 | 0.5 | 0.26087 | 0.434783 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 70 | 3 | 28 | 23.333333 | 0.821429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
35b73d24cf9d218057bae4745ef81f49352968a5 | 54,735 | py | Python | lib/klepto/_cache.py | JustinDeOcampo/Alfred-JapaneseTranslator | b8614c718384b2303813fdabb580d4ffd8e3f5c6 | [
"MIT"
] | 2 | 2020-07-13T00:04:23.000Z | 2021-02-05T17:07:39.000Z | lib/klepto/_cache.py | JustinDeOcampo/Alfred-JapaneseTranslator | b8614c718384b2303813fdabb580d4ffd8e3f5c6 | [
"MIT"
] | null | null | null | lib/klepto/_cache.py | JustinDeOcampo/Alfred-JapaneseTranslator | b8614c718384b2303813fdabb580d4ffd8e3f5c6 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#
# code inspired by Raymond Hettinger's LFU and LRU cache decorators
# on http://code.activestate.com/recipes/498245-lru-and-lfu-cache-decorators
# and subsequent forks as well as the version available in python3.3
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 2013-2016 California Institute of Technology.
# Copyright (c) 2016-2020 The Uncertainty Quantification Foundation.
# License: 3-clause BSD. The full license text is available at:
# - https://github.com/uqfoundation/klepto/blob/master/LICENSE
"""
a selection of caching decorators
"""
from functools import update_wrapper, partial
from klepto.archives import cache as archive_dict
from klepto.keymaps import hashmap
from klepto.tools import CacheInfo
from klepto.rounding import deep_round, simple_round
from ._inspect import _keygen
__all__ = ['no_cache','inf_cache','lfu_cache',\
'lru_cache','mru_cache','rr_cache']
class Counter(dict):
'Mapping where default values are zero'
def __missing__(self, key):
return 0
#XXX: what about caches that expire due to time, calls, etc...
#XXX: check the impact of not serializing by default, and hashmap by default
class no_cache(object):
"""empty (NO) cache decorator.
Unlike other cache decorators, this decorator does not cache. It is a
dummy that collects statistics and conforms to the caching interface. This
decorator takes an integer tolerance 'tol', equal to the number of decimal
places to which it will round off floats, and a bool 'deep' for whether the
rounding on inputs will be 'shallow' or 'deep'. Note that rounding is not
applied to the calculation of new results, but rather as a simple form of
cache interpolation. For example, with tol=0 and a cached value for f(3.0),
f(3.1) will lookup f(3.0) in the cache while f(3.6) will store a new value;
however if tol=1, both f(3.1) and f(3.6) will store new values.
maxsize = maximum cache size [fixed at maxsize=0]
cache = storage hashmap (default is {})
keymap = cache key encoder (default is keymaps.hashmap(flat=True))
ignore = function argument names and indicies to 'ignore' (default is None)
tol = integer tolerance for rounding (default is None)
deep = boolean for rounding depth (default is False, i.e. 'shallow')
purge = boolean for purge cache to archive at maxsize (fixed at True)
If *keymap* is given, it will replace the hashing algorithm for generating
cache keys. Several hashing algorithms are available in 'keymaps'. The
default keymap requires arguments to the cached function to be hashable.
If the keymap retains type information, then arguments of different types
will be cached separately. For example, f(3.0) and f(3) will be treated
as distinct calls with distinct results. Cache typing has a memory penalty,
and may also be ignored by some 'keymaps'. Here, the keymap is only used
to look up keys in an associated archive.
If *ignore* is given, the keymap will ignore the arguments with the names
and/or positional indicies provided. For example, if ignore=(0,), then
the key generated for f(1,2) will be identical to that of f(3,2) or f(4,2).
If ignore=('y',), then the key generated for f(x=3,y=4) will be identical
to that of f(x=3,y=0) or f(x=3,y=10). If ignore=('*','**'), all varargs
and varkwds will be 'ignored'. Ignored arguments never trigger a
recalculation (they only trigger cache lookups), and thus are 'ignored'.
When caching class methods, it may be useful to ignore=('self',).
View cache statistics (hit, miss, load, maxsize, size) with f.info().
Clear the cache and statistics with f.clear(). Replace the cache archive
with f.archive(obj). Load from the archive with f.load(), and dump from
the cache to the archive with f.dump().
"""
def __init__(self, maxsize=0, cache=None, keymap=None, ignore=None, tol=None, deep=False, purge=True):
#if maxsize is not 0: raise ValueError('maxsize cannot be set')
maxsize = 0 #XXX: allow maxsize to be given but ignored ?
purge = True #XXX: allow purge to be given but ignored ?
if cache is None: cache = archive_dict()
elif type(cache) is dict: cache = archive_dict(cache)
if keymap is None: keymap = hashmap(flat=True)
if ignore is None: ignore = tuple()
if deep: rounded = deep_round
else: rounded = simple_round
#else: rounded = shallow_round #FIXME: slow
@rounded(tol)
def rounded_args(*args, **kwds):
return (args, kwds)
# set state
self.__state__ = {
'maxsize': maxsize,
'cache': cache,
'keymap': keymap,
'ignore': ignore,
'roundargs': rounded_args,
'tol': tol,
'deep': deep,
'purge': purge,
}
return
def __call__(self, user_function):
#cache = dict() # mapping of args to results
stats = [0, 0, 0] # make statistics updateable non-locally
HIT, MISS, LOAD = 0, 1, 2 # names for the stats fields
_len = len # localize the global len() function
#lock = RLock() # linkedlist updates aren't threadsafe
maxsize = self.__state__['maxsize']
cache = self.__state__['cache']
keymap = self.__state__['keymap']
ignore = self.__state__['ignore']
rounded_args = self.__state__['roundargs']
def wrapper(*args, **kwds):
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
key = keymap(*_args, **_kwds)
# look in archive
if cache.archived():
cache.load(key)
try:
result = cache[key]
cache.clear()
stats[LOAD] += 1
except KeyError:
# if not found, then compute
result = user_function(*args, **kwds)
cache[key] = result
stats[MISS] += 1
# purge cache
if _len(cache) > maxsize:
#XXX: better: if cache is cache.archive ?
if cache.archived():
cache.dump()
cache.clear()
return result
def archive(obj):
"""Replace the cache archive"""
if isinstance(obj, archive_dict): cache.archive = obj.archive
else: cache.archive = obj
def key(*args, **kwds):
"""Get the cache key for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return keymap(*_args, **_kwds)
def lookup(*args, **kwds):
"""Get the stored value for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return cache[keymap(*_args, **_kwds)]
def __get_cache():
"""Get the cache"""
return cache
def __get_mask():
"""Get the (ignore) mask"""
return ignore
def __get_keymap():
"""Get the keymap"""
return keymap
def clear(keepstats=False):
"""Clear the cache and statistics"""
if not keepstats: stats[:] = [0, 0, 0]
def info():
"""Report cache statistics"""
return CacheInfo(stats[HIT], stats[MISS], stats[LOAD], maxsize, len(cache))
# interface
wrapper.__wrapped__ = user_function
#XXX: better is handle to key_function=keygen(ignore)(user_function) ?
wrapper.info = info
wrapper.clear = clear
wrapper.load = cache.load
wrapper.dump = cache.dump
wrapper.archive = archive
wrapper.archived = cache.archived
wrapper.key = key
wrapper.lookup = lookup
wrapper.__cache__ = __get_cache
wrapper.__mask__ = __get_mask
wrapper.__map__ = __get_keymap
#wrapper._queue = None #XXX
return update_wrapper(wrapper, user_function)
def __get__(self, obj, objtype):
"""support instance methods"""
return partial(self.__call__, obj)
def __reduce__(self):
cache = self.__state__['cache']
keymap = self.__state__['keymap']
ignore = self.__state__['ignore']
tol = self.__state__['tol']
deep = self.__state__['deep']
return (self.__class__, (0, cache, keymap, ignore, tol, deep, True))
class inf_cache(object):
"""infinitely-growing (INF) cache decorator.
This decorator memoizes a function's return value each time it is called.
If called later with the same arguments, the cached value is returned, and
not re-evaluated. This cache will grow without bound. To avoid memory
issues, it is suggested to frequently dump and clear the cache. This
decorator takes an integer tolerance 'tol', equal to the number of decimal
places to which it will round off floats, and a bool 'deep' for whether the
rounding on inputs will be 'shallow' or 'deep'. Note that rounding is not
applied to the calculation of new results, but rather as a simple form of
cache interpolation. For example, with tol=0 and a cached value for f(3.0),
f(3.1) will lookup f(3.0) in the cache while f(3.6) will store a new value;
however if tol=1, both f(3.1) and f(3.6) will store new values.
maxsize = maximum cache size [fixed at maxsize=None]
cache = storage hashmap (default is {})
keymap = cache key encoder (default is keymaps.hashmap(flat=True))
ignore = function argument names and indicies to 'ignore' (default is None)
tol = integer tolerance for rounding (default is None)
deep = boolean for rounding depth (default is False, i.e. 'shallow')
purge = boolean for purge cache to archive at maxsize (fixed at False)
If *keymap* is given, it will replace the hashing algorithm for generating
cache keys. Several hashing algorithms are available in 'keymaps'. The
default keymap requires arguments to the cached function to be hashable.
If the keymap retains type information, then arguments of different types
will be cached separately. For example, f(3.0) and f(3) will be treated
as distinct calls with distinct results. Cache typing has a memory penalty,
and may also be ignored by some 'keymaps'.
If *ignore* is given, the keymap will ignore the arguments with the names
and/or positional indicies provided. For example, if ignore=(0,), then
the key generated for f(1,2) will be identical to that of f(3,2) or f(4,2).
If ignore=('y',), then the key generated for f(x=3,y=4) will be identical
to that of f(x=3,y=0) or f(x=3,y=10). If ignore=('*','**'), all varargs
and varkwds will be 'ignored'. Ignored arguments never trigger a
recalculation (they only trigger cache lookups), and thus are 'ignored'.
When caching class methods, it may be useful to ignore=('self',).
View cache statistics (hit, miss, load, maxsize, size) with f.info().
Clear the cache and statistics with f.clear(). Replace the cache archive
with f.archive(obj). Load from the archive with f.load(), and dump from
the cache to the archive with f.dump().
"""
def __init__(self, maxsize=None, cache=None, keymap=None, ignore=None, tol=None, deep=False, purge=False):
#if maxsize is not None: raise ValueError('maxsize cannot be set')
maxsize = None #XXX: allow maxsize to be given but ignored ?
purge = False #XXX: allow purge to be given but ignored ?
if cache is None: cache = archive_dict()
elif type(cache) is dict: cache = archive_dict(cache)
if keymap is None: keymap = hashmap(flat=True)
if ignore is None: ignore = tuple()
if deep: rounded = deep_round
else: rounded = simple_round
#else: rounded = shallow_round #FIXME: slow
@rounded(tol)
def rounded_args(*args, **kwds):
return (args, kwds)
# set state
self.__state__ = {
'maxsize': maxsize,
'cache': cache,
'keymap': keymap,
'ignore': ignore,
'roundargs': rounded_args,
'tol': tol,
'deep': deep,
'purge': purge,
}
return
def __call__(self, user_function):
#cache = dict() # mapping of args to results
stats = [0, 0, 0] # make statistics updateable non-locally
HIT, MISS, LOAD = 0, 1, 2 # names for the stats fields
#_len = len # localize the global len() function
#lock = RLock() # linkedlist updates aren't threadsafe
maxsize = self.__state__['maxsize']
cache = self.__state__['cache']
keymap = self.__state__['keymap']
ignore = self.__state__['ignore']
rounded_args = self.__state__['roundargs']
def wrapper(*args, **kwds):
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
key = keymap(*_args, **_kwds)
try:
# get cache entry
result = cache[key]
stats[HIT] += 1
except KeyError:
# if not in cache, look in archive
if cache.archived():
cache.load(key)
try:
result = cache[key]
stats[LOAD] += 1
except KeyError:
# if not found, then compute
result = user_function(*args, **kwds)
cache[key] = result
stats[MISS] += 1
return result
def archive(obj):
"""Replace the cache archive"""
if isinstance(obj, archive_dict): cache.archive = obj.archive
else: cache.archive = obj
def key(*args, **kwds):
"""Get the cache key for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return keymap(*_args, **_kwds)
def lookup(*args, **kwds):
"""Get the stored value for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return cache[keymap(*_args, **_kwds)]
def __get_cache():
"""Get the cache"""
return cache
def __get_mask():
"""Get the (ignore) mask"""
return ignore
def __get_keymap():
"""Get the keymap"""
return keymap
def clear(keepstats=False):
"""Clear the cache and statistics"""
cache.clear()
if not keepstats: stats[:] = [0, 0, 0]
def info():
"""Report cache statistics"""
return CacheInfo(stats[HIT], stats[MISS], stats[LOAD], maxsize, len(cache))
# interface
wrapper.__wrapped__ = user_function
#XXX: better is handle to key_function=keygen(ignore)(user_function) ?
wrapper.info = info
wrapper.clear = clear
wrapper.load = cache.load
wrapper.dump = cache.dump
wrapper.archive = archive
wrapper.archived = cache.archived
wrapper.key = key
wrapper.lookup = lookup
wrapper.__cache__ = __get_cache
wrapper.__mask__ = __get_mask
wrapper.__map__ = __get_keymap
#wrapper._queue = None #XXX
return update_wrapper(wrapper, user_function)
def __get__(self, obj, objtype):
"""support instance methods"""
return partial(self.__call__, obj)
def __reduce__(self):
cache = self.__state__['cache']
keymap = self.__state__['keymap']
ignore = self.__state__['ignore']
tol = self.__state__['tol']
deep = self.__state__['deep']
return (self.__class__, (None, cache, keymap, ignore, tol, deep, False))
class lfu_cache(object):
"""least-frequenty-used (LFU) cache decorator.
This decorator memoizes a function's return value each time it is called.
If called later with the same arguments, the cached value is returned, and
not re-evaluated. To avoid memory issues, a maximum cache size is imposed.
For caches with an archive, the full cache dumps to archive upon reaching
maxsize. For caches without an archive, the LFU algorithm manages the cache.
Caches with an archive will use the latter behavior when 'purge' is False.
This decorator takes an integer tolerance 'tol', equal to the number of
decimal places to which it will round off floats, and a bool 'deep' for
whether the rounding on inputs will be 'shallow' or 'deep'. Note that
rounding is not applied to the calculation of new results, but rather as a
simple form of cache interpolation. For example, with tol=0 and a cached
value for f(3.0), f(3.1) will lookup f(3.0) in the cache while f(3.6) will
store a new value; however if tol=1, both f(3.1) and f(3.6) will store
new values.
maxsize = maximum cache size
cache = storage hashmap (default is {})
keymap = cache key encoder (default is keymaps.hashmap(flat=True))
ignore = function argument names and indicies to 'ignore' (default is None)
tol = integer tolerance for rounding (default is None)
deep = boolean for rounding depth (default is False, i.e. 'shallow')
purge = boolean for purge cache to archive at maxsize (default is False)
If *maxsize* is None, this cache will grow without bound.
If *keymap* is given, it will replace the hashing algorithm for generating
cache keys. Several hashing algorithms are available in 'keymaps'. The
default keymap requires arguments to the cached function to be hashable.
If the keymap retains type information, then arguments of different types
will be cached separately. For example, f(3.0) and f(3) will be treated
as distinct calls with distinct results. Cache typing has a memory penalty,
and may also be ignored by some 'keymaps'.
If *ignore* is given, the keymap will ignore the arguments with the names
and/or positional indicies provided. For example, if ignore=(0,), then
the key generated for f(1,2) will be identical to that of f(3,2) or f(4,2).
If ignore=('y',), then the key generated for f(x=3,y=4) will be identical
to that of f(x=3,y=0) or f(x=3,y=10). If ignore=('*','**'), all varargs
and varkwds will be 'ignored'. Ignored arguments never trigger a
recalculation (they only trigger cache lookups), and thus are 'ignored'.
When caching class methods, it may be useful to ignore=('self',).
View cache statistics (hit, miss, load, maxsize, size) with f.info().
Clear the cache and statistics with f.clear(). Replace the cache archive
with f.archive(obj). Load from the archive with f.load(), and dump from
the cache to the archive with f.dump().
See: http://en.wikipedia.org/wiki/Cache_algorithms#Least_Frequently_Used
"""
def __new__(cls, *args, **kwds):
maxsize = kwds.get('maxsize', -1)
if maxsize == 0:
return no_cache(*args, **kwds)
if maxsize is None:
return inf_cache(*args, **kwds)
return object.__new__(cls)
def __init__(self, maxsize=100, cache=None, keymap=None, ignore=None, tol=None, deep=False, purge=False):
if maxsize is None or maxsize == 0:
return
if cache is None: cache = archive_dict()
elif type(cache) is dict: cache = archive_dict(cache)
if keymap is None: keymap = hashmap(flat=True)
if ignore is None: ignore = tuple()
if deep: rounded = deep_round
else: rounded = simple_round
#else: rounded = shallow_round #FIXME: slow
@rounded(tol)
def rounded_args(*args, **kwds):
return (args, kwds)
# set state
self.__state__ = {
'maxsize': maxsize,
'cache': cache,
'keymap': keymap,
'ignore': ignore,
'roundargs': rounded_args,
'tol': tol,
'deep': deep,
'purge': purge,
}
return
def __call__(self, user_function):
from heapq import nsmallest
from operator import itemgetter
#cache = dict() # mapping of args to results
use_count = Counter() # times each key has been accessed
stats = [0, 0, 0] # make statistics updateable non-locally
HIT, MISS, LOAD = 0, 1, 2 # names for the stats fields
_len = len # localize the global len() function
#lock = RLock() # linkedlist updates aren't threadsafe
maxsize = self.__state__['maxsize']
cache = self.__state__['cache']
keymap = self.__state__['keymap']
ignore = self.__state__['ignore']
rounded_args = self.__state__['roundargs']
purge = self.__state__['purge']
def wrapper(*args, **kwds):
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
key = keymap(*_args, **_kwds)
try:
# get cache entry
result = cache[key]
use_count[key] += 1
stats[HIT] += 1
except KeyError:
# if not in cache, look in archive
if cache.archived():
cache.load(key)
try:
result = cache[key]
use_count[key] += 1
stats[LOAD] += 1
except KeyError:
# if not found, then compute
result = user_function(*args, **kwds)
cache[key] = result
use_count[key] += 1
stats[MISS] += 1
# purge cache
if _len(cache) > maxsize:
#XXX: better: if cache is cache.archive ?
if cache.archived() and purge:
cache.dump()
cache.clear()
use_count.clear()
else: # purge least frequent cache entries
for k, _ in nsmallest(max(2, maxsize // 10),
iter(use_count.items()),
key=itemgetter(1)):
if cache.archived(): cache.dump(k)
try: del cache[k]
except KeyError: pass #FIXME: possible less purged
use_count.pop(k, None)
return result
def archive(obj):
"""Replace the cache archive"""
if isinstance(obj, archive_dict): cache.archive = obj.archive
else: cache.archive = obj
def key(*args, **kwds):
"""Get the cache key for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return keymap(*_args, **_kwds)
def lookup(*args, **kwds):
"""Get the stored value for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return cache[keymap(*_args, **_kwds)]
def __get_cache():
"""Get the cache"""
return cache
def __get_mask():
"""Get the (ignore) mask"""
return ignore
def __get_keymap():
"""Get the keymap"""
return keymap
def clear(keepstats=False):
"""Clear the cache and statistics"""
cache.clear()
use_count.clear()
if not keepstats: stats[:] = [0, 0, 0]
def info():
"""Report cache statistics"""
return CacheInfo(stats[HIT], stats[MISS], stats[LOAD], maxsize, len(cache))
# interface
wrapper.__wrapped__ = user_function
#XXX: better is handle to key_function=keygen(ignore)(user_function) ?
wrapper.info = info
wrapper.clear = clear
wrapper.load = cache.load
wrapper.dump = cache.dump
wrapper.archive = archive
wrapper.archived = cache.archived
wrapper.key = key
wrapper.lookup = lookup
wrapper.__cache__ = __get_cache
wrapper.__mask__ = __get_mask
wrapper.__map__ = __get_keymap
#wrapper._queue = use_count #XXX
return update_wrapper(wrapper, user_function)
def __get__(self, obj, objtype):
"""support instance methods"""
return partial(self.__call__, obj)
def __reduce__(self):
maxsize = self.__state__['maxsize']
cache = self.__state__['cache']
keymap = self.__state__['keymap']
ignore = self.__state__['ignore']
tol = self.__state__['tol']
deep = self.__state__['deep']
purge = self.__state__['purge']
return (self.__class__, (maxsize, cache, keymap, ignore, tol, deep, purge))
class lru_cache(object):
"""least-recently-used (LRU) cache decorator.
This decorator memoizes a function's return value each time it is called.
If called later with the same arguments, the cached value is returned, and
not re-evaluated. To avoid memory issues, a maximum cache size is imposed.
For caches with an archive, the full cache dumps to archive upon reaching
maxsize. For caches without an archive, the LRU algorithm manages the cache.
Caches with an archive will use the latter behavior when 'purge' is False.
This decorator takes an integer tolerance 'tol', equal to the number of
decimal places to which it will round off floats, and a bool 'deep' for
whether the rounding on inputs will be 'shallow' or 'deep'. Note that
rounding is not applied to the calculation of new results, but rather as a
simple form of cache interpolation. For example, with tol=0 and a cached
value for f(3.0), f(3.1) will lookup f(3.0) in the cache while f(3.6) will
store a new value; however if tol=1, both f(3.1) and f(3.6) will store
new values.
maxsize = maximum cache size
cache = storage hashmap (default is {})
keymap = cache key encoder (default is keymaps.hashmap(flat=True))
ignore = function argument names and indicies to 'ignore' (default is None)
tol = integer tolerance for rounding (default is None)
deep = boolean for rounding depth (default is False, i.e. 'shallow')
purge = boolean for purge cache to archive at maxsize (default is False)
If *maxsize* is None, this cache will grow without bound.
If *keymap* is given, it will replace the hashing algorithm for generating
cache keys. Several hashing algorithms are available in 'keymaps'. The
default keymap requires arguments to the cached function to be hashable.
If the keymap retains type information, then arguments of different types
will be cached separately. For example, f(3.0) and f(3) will be treated
as distinct calls with distinct results. Cache typing has a memory penalty,
and may also be ignored by some 'keymaps'.
If *ignore* is given, the keymap will ignore the arguments with the names
and/or positional indicies provided. For example, if ignore=(0,), then
the key generated for f(1,2) will be identical to that of f(3,2) or f(4,2).
If ignore=('y',), then the key generated for f(x=3,y=4) will be identical
to that of f(x=3,y=0) or f(x=3,y=10). If ignore=('*','**'), all varargs
and varkwds will be 'ignored'. Ignored arguments never trigger a
recalculation (they only trigger cache lookups), and thus are 'ignored'.
When caching class methods, it may be useful to ignore=('self',).
View cache statistics (hit, miss, load, maxsize, size) with f.info().
Clear the cache and statistics with f.clear(). Replace the cache archive
with f.archive(obj). Load from the archive with f.load(), and dump from
the cache to the archive with f.dump().
See: http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used
"""
def __new__(cls, *args, **kwds):
maxsize = kwds.get('maxsize', -1)
if maxsize == 0:
return no_cache(*args, **kwds)
if maxsize is None:
return inf_cache(*args, **kwds)
return object.__new__(cls)
def __init__(self, maxsize=100, cache=None, keymap=None, ignore=None, tol=None, deep=False, purge=False):
if maxsize is None or maxsize == 0:
return
if cache is None: cache = archive_dict()
elif type(cache) is dict: cache = archive_dict(cache)
if keymap is None: keymap = hashmap(flat=True)
if ignore is None: ignore = tuple()
if deep: rounded = deep_round
else: rounded = simple_round
#else: rounded = shallow_round #FIXME: slow
@rounded(tol)
def rounded_args(*args, **kwds):
return (args, kwds)
# set state
self.__state__ = {
'maxsize': maxsize,
'cache': cache,
'keymap': keymap,
'ignore': ignore,
'roundargs': rounded_args,
'tol': tol,
'deep': deep,
'purge': purge,
}
return
def __call__(self, user_function):
from collections import deque
try:
from itertools import filterfalse
except ImportError:
from itertools import ifilterfalse as filterfalse
#cache = dict() # mapping of args to results
queue = deque() # order that keys have been used
refcount = Counter() # times each key is in the queue
sentinel = object() # marker for looping around the queue
stats = [0, 0, 0] # make statistics updateable non-locally
HIT, MISS, LOAD = 0, 1, 2 # names for the stats fields
_len = len # localize the global len() function
#lock = RLock() # linkedlist updates aren't threadsafe
maxsize = self.__state__['maxsize']
cache = self.__state__['cache']
keymap = self.__state__['keymap']
ignore = self.__state__['ignore']
rounded_args = self.__state__['roundargs']
purge = self.__state__['purge']
maxqueue = maxsize * 10 #XXX: settable? confirm this works as expected
# lookup optimizations (ugly but fast)
queue_append, queue_popleft = queue.append, queue.popleft
queue_appendleft, queue_pop = queue.appendleft, queue.pop
def wrapper(*args, **kwds):
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
key = keymap(*_args, **_kwds)
try:
# get cache entry
result = cache[key]
# record recent use of this key
queue_append(key)
refcount[key] += 1
stats[HIT] += 1
except KeyError:
# if not in cache, look in archive
if cache.archived():
cache.load(key)
try:
result = cache[key]
# record recent use of this key
queue_append(key)
refcount[key] += 1
stats[LOAD] += 1
except KeyError:
# if not found, then compute
result = user_function(*args, **kwds)
cache[key] = result
# record recent use of this key
queue_append(key)
refcount[key] += 1
stats[MISS] += 1
# purge cache
if _len(cache) > maxsize:
#XXX: better: if cache is cache.archive ?
if cache.archived() and purge:
cache.dump()
cache.clear()
queue.clear()
refcount.clear()
else: # purge least recently used cache entry
key = queue_popleft()
refcount[key] -= 1
while refcount[key]:
key = queue_popleft()
refcount[key] -= 1
if cache.archived(): cache.dump(key)
try: del cache[key]
except KeyError: pass #FIXME: possible none purged
refcount.pop(key, None)
# periodically compact the queue by eliminating duplicate keys
# while preserving order of most recent access
if _len(queue) > maxqueue:
refcount.clear()
queue_appendleft(sentinel)
for key in filterfalse(refcount.__contains__,
iter(queue_pop, sentinel)):
queue_appendleft(key)
refcount[key] = 1
return result
def archive(obj):
"""Replace the cache archive"""
if isinstance(obj, archive_dict): cache.archive = obj.archive
else: cache.archive = obj
def key(*args, **kwds):
"""Get the cache key for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return keymap(*_args, **_kwds)
def lookup(*args, **kwds):
"""Get the stored value for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return cache[keymap(*_args, **_kwds)]
def __get_cache():
"""Get the cache"""
return cache
def __get_mask():
"""Get the (ignore) mask"""
return ignore
def __get_keymap():
"""Get the keymap"""
return keymap
def clear(keepstats=False):
"""Clear the cache and statistics"""
cache.clear()
queue.clear()
refcount.clear()
if not keepstats: stats[:] = [0, 0, 0]
def info():
"""Report cache statistics"""
return CacheInfo(stats[HIT], stats[MISS], stats[LOAD], maxsize, len(cache))
# interface
wrapper.__wrapped__ = user_function
#XXX: better is handle to key_function=keygen(ignore)(user_function) ?
wrapper.info = info
wrapper.clear = clear
wrapper.load = cache.load
wrapper.dump = cache.dump
wrapper.archive = archive
wrapper.archived = cache.archived
wrapper.key = key
wrapper.lookup = lookup
wrapper.__cache__ = __get_cache
wrapper.__mask__ = __get_mask
wrapper.__map__ = __get_keymap
#wrapper._queue = queue #XXX
return update_wrapper(wrapper, user_function)
def __get__(self, obj, objtype):
"""support instance methods"""
return partial(self.__call__, obj)
def __reduce__(self):
maxsize = self.__state__['maxsize']
cache = self.__state__['cache']
keymap = self.__state__['keymap']
ignore = self.__state__['ignore']
tol = self.__state__['tol']
deep = self.__state__['deep']
purge = self.__state__['purge']
return (self.__class__, (maxsize, cache, keymap, ignore, tol, deep, purge))
class mru_cache(object):
"""most-recently-used (MRU) cache decorator.
This decorator memoizes a function's return value each time it is called.
If called later with the same arguments, the cached value is returned, and
not re-evaluated. To avoid memory issues, a maximum cache size is imposed.
For caches with an archive, the full cache dumps to archive upon reaching
maxsize. For caches without an archive, the MRU algorithm manages the cache.
Caches with an archive will use the latter behavior when 'purge' is False.
This decorator takes an integer tolerance 'tol', equal to the number of
decimal places to which it will round off floats, and a bool 'deep' for
whether the rounding on inputs will be 'shallow' or 'deep'. Note that
rounding is not applied to the calculation of new results, but rather as a
simple form of cache interpolation. For example, with tol=0 and a cached
value for f(3.0), f(3.1) will lookup f(3.0) in the cache while f(3.6) will
store a new value; however if tol=1, both f(3.1) and f(3.6) will store
new values.
maxsize = maximum cache size
cache = storage hashmap (default is {})
keymap = cache key encoder (default is keymaps.hashmap(flat=True))
ignore = function argument names and indicies to 'ignore' (default is None)
tol = integer tolerance for rounding (default is None)
deep = boolean for rounding depth (default is False, i.e. 'shallow')
purge = boolean for purge cache to archive at maxsize (default is False)
If *maxsize* is None, this cache will grow without bound.
If *keymap* is given, it will replace the hashing algorithm for generating
cache keys. Several hashing algorithms are available in 'keymaps'. The
default keymap requires arguments to the cached function to be hashable.
If the keymap retains type information, then arguments of different types
will be cached separately. For example, f(3.0) and f(3) will be treated
as distinct calls with distinct results. Cache typing has a memory penalty,
and may also be ignored by some 'keymaps'.
If *ignore* is given, the keymap will ignore the arguments with the names
and/or positional indicies provided. For example, if ignore=(0,), then
the key generated for f(1,2) will be identical to that of f(3,2) or f(4,2).
If ignore=('y',), then the key generated for f(x=3,y=4) will be identical
to that of f(x=3,y=0) or f(x=3,y=10). If ignore=('*','**'), all varargs
and varkwds will be 'ignored'. Ignored arguments never trigger a
recalculation (they only trigger cache lookups), and thus are 'ignored'.
When caching class methods, it may be useful to ignore=('self',).
View cache statistics (hit, miss, load, maxsize, size) with f.info().
Clear the cache and statistics with f.clear(). Replace the cache archive
with f.archive(obj). Load from the archive with f.load(), and dump from
the cache to the archive with f.dump().
See: http://en.wikipedia.org/wiki/Cache_algorithms#Most_Recently_Used
"""
def __new__(cls, *args, **kwds):
maxsize = kwds.get('maxsize', -1)
if maxsize == 0:
return no_cache(*args, **kwds)
if maxsize is None:
return inf_cache(*args, **kwds)
return object.__new__(cls)
def __init__(self, maxsize=100, cache=None, keymap=None, ignore=None, tol=None, deep=False, purge=False):
if maxsize is None or maxsize == 0:
return
if cache is None: cache = archive_dict()
elif type(cache) is dict: cache = archive_dict(cache)
if keymap is None: keymap = hashmap(flat=True)
if ignore is None: ignore = tuple()
if deep: rounded = deep_round
else: rounded = simple_round
#else: rounded = shallow_round #FIXME: slow
@rounded(tol)
def rounded_args(*args, **kwds):
return (args, kwds)
# set state
self.__state__ = {
'maxsize': maxsize,
'cache': cache,
'keymap': keymap,
'ignore': ignore,
'roundargs': rounded_args,
'tol': tol,
'deep': deep,
'purge': purge,
}
return
def __call__(self, user_function):
from collections import deque
#cache = dict() # mapping of args to results
queue = deque() # order that keys have been used
stats = [0, 0, 0] # make statistics updateable non-locally
HIT, MISS, LOAD = 0, 1, 2 # names for the stats fields
_len = len # localize the global len() function
#lock = RLock() # linkedlist updates aren't threadsafe
maxsize = self.__state__['maxsize']
cache = self.__state__['cache']
keymap = self.__state__['keymap']
ignore = self.__state__['ignore']
rounded_args = self.__state__['roundargs']
purge = self.__state__['purge']
# lookup optimizations (ugly but fast)
queue_append, queue_popleft = queue.append, queue.popleft
queue_appendleft, queue_pop = queue.appendleft, queue.pop
def wrapper(*args, **kwds):
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
key = keymap(*_args, **_kwds)
try:
# get cache entry
result = cache[key]
try: queue.remove(key)
except ValueError: pass
stats[HIT] += 1
except KeyError:
# if not in cache, look in archive
if cache.archived():
cache.load(key)
try:
result = cache[key]
stats[LOAD] += 1
except KeyError:
# if not found, then compute
result = user_function(*args, **kwds)
cache[key] = result
stats[MISS] += 1
# purge cache
if _len(cache) > maxsize:
#XXX: better: if cache is cache.archive ?
if cache.archived() and purge:
cache.dump()
cache.clear()
queue.clear()
else: # purge most recently used cache entry
k = queue_pop()
if cache.archived(): cache.dump(k)
try: del cache[k]
except KeyError: pass #FIXME: possible none purged
# record recent use of this key
queue_append(key)
return result
def archive(obj):
"""Replace the cache archive"""
if isinstance(obj, archive_dict): cache.archive = obj.archive
else: cache.archive = obj
def key(*args, **kwds):
"""Get the cache key for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return keymap(*_args, **_kwds)
def lookup(*args, **kwds):
"""Get the stored value for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return cache[keymap(*_args, **_kwds)]
def __get_cache():
"""Get the cache"""
return cache
def __get_mask():
"""Get the (ignore) mask"""
return ignore
def __get_keymap():
"""Get the keymap"""
return keymap
def clear(keepstats=False):
"""Clear the cache and statistics"""
cache.clear()
queue.clear()
if not keepstats: stats[:] = [0, 0, 0]
def info():
"""Report cache statistics"""
return CacheInfo(stats[HIT], stats[MISS], stats[LOAD], maxsize, len(cache))
# interface
wrapper.__wrapped__ = user_function
#XXX: better is handle to key_function=keygen(ignore)(user_function) ?
wrapper.info = info
wrapper.clear = clear
wrapper.load = cache.load
wrapper.dump = cache.dump
wrapper.archive = archive
wrapper.archived = cache.archived
wrapper.key = key
wrapper.lookup = lookup
wrapper.__cache__ = __get_cache
wrapper.__mask__ = __get_mask
wrapper.__map__ = __get_keymap
#wrapper._queue = queue #XXX
return update_wrapper(wrapper, user_function)
def __get__(self, obj, objtype):
"""support instance methods"""
return partial(self.__call__, obj)
def __reduce__(self):
maxsize = self.__state__['maxsize']
cache = self.__state__['cache']
keymap = self.__state__['keymap']
ignore = self.__state__['ignore']
tol = self.__state__['tol']
deep = self.__state__['deep']
purge = self.__state__['purge']
return (self.__class__, (maxsize, cache, keymap, ignore, tol, deep, purge))
class rr_cache(object):
"""random-replacement (RR) cache decorator.
This decorator memoizes a function's return value each time it is called.
If called later with the same arguments, the cached value is returned, and
not re-evaluated. To avoid memory issues, a maximum cache size is imposed.
For caches with an archive, the full cache dumps to archive upon reaching
maxsize. For caches without an archive, the RR algorithm manages the cache.
Caches with an archive will use the latter behavior when 'purge' is False.
This decorator takes an integer tolerance 'tol', equal to the number of
decimal places to which it will round off floats, and a bool 'deep' for
whether the rounding on inputs will be 'shallow' or 'deep'. Note that
rounding is not applied to the calculation of new results, but rather as a
simple form of cache interpolation. For example, with tol=0 and a cached
value for f(3.0), f(3.1) will lookup f(3.0) in the cache while f(3.6) will
store a new value; however if tol=1, both f(3.1) and f(3.6) will store
new values.
maxsize = maximum cache size
cache = storage hashmap (default is {})
keymap = cache key encoder (default is keymaps.hashmap(flat=True))
ignore = function argument names and indicies to 'ignore' (default is None)
tol = integer tolerance for rounding (default is None)
deep = boolean for rounding depth (default is False, i.e. 'shallow')
purge = boolean for purge cache to archive at maxsize (default is False)
If *maxsize* is None, this cache will grow without bound.
If *keymap* is given, it will replace the hashing algorithm for generating
cache keys. Several hashing algorithms are available in 'keymaps'. The
default keymap requires arguments to the cached function to be hashable.
If the keymap retains type information, then arguments of different types
will be cached separately. For example, f(3.0) and f(3) will be treated
as distinct calls with distinct results. Cache typing has a memory penalty,
and may also be ignored by some 'keymaps'.
If *ignore* is given, the keymap will ignore the arguments with the names
and/or positional indicies provided. For example, if ignore=(0,), then
the key generated for f(1,2) will be identical to that of f(3,2) or f(4,2).
If ignore=('y',), then the key generated for f(x=3,y=4) will be identical
to that of f(x=3,y=0) or f(x=3,y=10). If ignore=('*','**'), all varargs
and varkwds will be 'ignored'. Ignored arguments never trigger a
recalculation (they only trigger cache lookups), and thus are 'ignored'.
When caching class methods, it may be useful to ignore=('self',).
View cache statistics (hit, miss, load, maxsize, size) with f.info().
Clear the cache and statistics with f.clear(). Replace the cache archive
with f.archive(obj). Load from the archive with f.load(), and dump from
the cache to the archive with f.dump().
http://en.wikipedia.org/wiki/Cache_algorithms#Random_Replacement
"""
def __new__(cls, *args, **kwds):
maxsize = kwds.get('maxsize', -1)
if maxsize == 0:
return no_cache(*args, **kwds)
if maxsize is None:
return inf_cache(*args, **kwds)
return object.__new__(cls)
def __init__(self, maxsize=100, cache=None, keymap=None, ignore=None, tol=None, deep=False, purge=False):
if maxsize is None or maxsize == 0:
return
if cache is None: cache = archive_dict()
elif type(cache) is dict: cache = archive_dict(cache)
if keymap is None: keymap = hashmap(flat=True)
if ignore is None: ignore = tuple()
if deep: rounded = deep_round
else: rounded = simple_round
#else: rounded = shallow_round #FIXME: slow
@rounded(tol)
def rounded_args(*args, **kwds):
return (args, kwds)
# set state
self.__state__ = {
'maxsize': maxsize,
'cache': cache,
'keymap': keymap,
'ignore': ignore,
'roundargs': rounded_args,
'tol': tol,
'deep': deep,
'purge': purge,
}
return
def __call__(self, user_function):
#cache = dict() # mapping of args to results
stats = [0, 0, 0] # make statistics updateable non-locally
HIT, MISS, LOAD = 0, 1, 2 # names for the stats fields
_len = len # localize the global len() function
#lock = RLock() # linkedlist updates aren't threadsafe
maxsize = self.__state__['maxsize']
cache = self.__state__['cache']
keymap = self.__state__['keymap']
ignore = self.__state__['ignore']
rounded_args = self.__state__['roundargs']
purge = self.__state__['purge']
def wrapper(*args, **kwds):
from random import choice #XXX: biased?
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
key = keymap(*_args, **_kwds)
try:
# get cache entry
result = cache[key]
stats[HIT] += 1
except KeyError:
# if not in cache, look in archive
if cache.archived():
cache.load(key)
try:
result = cache[key]
stats[LOAD] += 1
except KeyError:
# if not found, then compute
result = user_function(*args, **kwds)
cache[key] = result
stats[MISS] += 1
# purge cache
if _len(cache) > maxsize:
#XXX: better: if cache is cache.archive ?
if cache.archived() and purge:
cache.dump()
cache.clear()
else: # purge random cache entry
key = choice(list(cache.keys()))
if cache.archived(): cache.dump(key)
try: del cache[key]
except KeyError: pass #FIXME: possible none purged
return result
def archive(obj):
"""Replace the cache archive"""
if isinstance(obj, archive_dict): cache.archive = obj.archive
else: cache.archive = obj
def key(*args, **kwds):
"""Get the cache key for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return keymap(*_args, **_kwds)
def lookup(*args, **kwds):
"""Get the stored value for the given *args,**kwds"""
_args, _kwds = rounded_args(*args, **kwds)
_args, _kwds = _keygen(user_function, ignore, *_args, **_kwds)
return cache[keymap(*_args, **_kwds)]
def __get_cache():
"""Get the cache"""
return cache
def __get_mask():
"""Get the (ignore) mask"""
return ignore
def __get_keymap():
"""Get the keymap"""
return keymap
def clear(keepstats=False):
"""Clear the cache and statistics"""
cache.clear()
if not keepstats: stats[:] = [0, 0, 0]
def info():
"""Report cache statistics"""
return CacheInfo(stats[HIT], stats[MISS], stats[LOAD], maxsize, len(cache))
# interface
wrapper.__wrapped__ = user_function
#XXX: better is handle to key_function=keygen(ignore)(user_function) ?
wrapper.info = info
wrapper.clear = clear
wrapper.load = cache.load
wrapper.dump = cache.dump
wrapper.archive = archive
wrapper.archived = cache.archived
wrapper.key = key
wrapper.lookup = lookup
wrapper.__cache__ = __get_cache
wrapper.__mask__ = __get_mask
wrapper.__map__ = __get_keymap
#wrapper._queue = None #XXX
return update_wrapper(wrapper, user_function)
def __get__(self, obj, objtype):
"""support instance methods"""
return partial(self.__call__, obj)
def __reduce__(self):
maxsize = self.__state__['maxsize']
cache = self.__state__['cache']
keymap = self.__state__['keymap']
ignore = self.__state__['ignore']
tol = self.__state__['tol']
deep = self.__state__['deep']
purge = self.__state__['purge']
return (self.__class__, (maxsize, cache, keymap, ignore, tol, deep, purge))
if __name__ == '__main__':
import dill
#@no_cache(10, tol=0)
#@inf_cache(10, tol=0)
#@lfu_cache(10, tol=0)
#@lru_cache(10, tol=0)
#@mru_cache(10, tol=0)
@rr_cache(10, tol=0)
def squared(x):
return x**2
res = squared(10)
assert res == dill.loads(dill.dumps(squared))(10)
# EOF
| 41.655251 | 110 | 0.5905 | 6,844 | 54,735 | 4.562537 | 0.060637 | 0.03843 | 0.01345 | 0.017934 | 0.917921 | 0.915167 | 0.911804 | 0.906744 | 0.906232 | 0.902517 | 0 | 0.009328 | 0.314515 | 54,735 | 1,313 | 111 | 41.686976 | 0.822921 | 0.421412 | 0 | 0.909471 | 0 | 0 | 0.026615 | 0 | 0 | 0 | 0 | 0.00457 | 0.001393 | 1 | 0.125348 | false | 0.006964 | 0.020891 | 0.011142 | 0.281337 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
ea196d205b3cdce437c434b3965ee1cee78f57e5 | 2,544 | py | Python | pyad/tests/tests_adquery.py | jcarswell/pyad | cc7455934bfab6aae1a760b0b5c2b3e6f609b5a3 | [
"Apache-2.0"
] | null | null | null | pyad/tests/tests_adquery.py | jcarswell/pyad | cc7455934bfab6aae1a760b0b5c2b3e6f609b5a3 | [
"Apache-2.0"
] | 1 | 2022-03-08T18:09:13.000Z | 2022-03-09T13:21:57.000Z | pyad/tests/tests_adquery.py | jcarswell/pyad | cc7455934bfab6aae1a760b0b5c2b3e6f609b5a3 | [
"Apache-2.0"
] | null | null | null | from .pyadunittest import ADTestCase
import pyad
class TestADQuery(ADTestCase):
def setUp(self):
self.ad_query = pyad.ADQuery()
def test_dne_rowcount(self):
query = "cn = '%s'" % self.KNOWN_DNE_OBJECT
self.ad_query.execute_query(where_clause = query)
self.assertEqual(self.ad_query.get_row_count(), 0)
def test_dne_single_result(self):
query = "cn = '%s'" % self.KNOWN_DNE_OBJECT
self.ad_query.execute_query(where_clause = query)
self.assertRaises(pyad.invalidResults, self.ad_query.get_single_result)
def test_dne_all_results(self):
query = "cn = '%s'" % self.KNOWN_DNE_OBJECT
self.ad_query.execute_query(where_clause = query)
self.assertEqual(self.ad_query.get_all_results(), [])
def test_single_rowcount(self):
query = "cn = '%s'" % self.KNOWN_EXISTS_USER
self.ad_query.execute_query(where_clause = query)
self.assertEqual(self.ad_query.get_row_count(), 1)
def test_single_single_result(self):
query = "cn = '%s'" % self.KNOWN_EXISTS_USER
self.ad_query.execute_query(attributes=("cn","distinguishedname"),where_clause = query)
self.assertEqual(self.ad_query.get_single_result()['cn'],self.KNOWN_EXISTS_USER)
def test_single_all_results(self):
query = "cn = '%s'" % self.KNOWN_EXISTS_USER
self.ad_query.execute_query(attributes=("cn","distinguishedname"),where_clause = query)
self.assertEqual(self.ad_query.get_all_results()[0]['cn'],self.KNOWN_EXISTS_USER)
def test_multiple_rowcount(self):
query = "cn = '%s' or cn = '%s'" % (self.KNOWN_EXISTS_USER, self.KNOWN_EXISTS_COMPUTER)
self.ad_query.execute_query(where_clause = query)
self.assertEqual(self.ad_query.get_row_count(), 2)
def test_multiple_single_result(self):
query = "cn = '%s' or cn = '%s'" % (self.KNOWN_EXISTS_USER, self.KNOWN_EXISTS_COMPUTER)
self.ad_query.execute_query(where_clause = query)
self.assertRaises(pyad.invalidResults, self.ad_query.get_single_result)
def test_multiple_all_results(self):
query = "cn = '%s' or cn = '%s'" % (self.KNOWN_EXISTS_USER, self.KNOWN_EXISTS_COMPUTER)
self.ad_query.execute_query(attributes=("cn","distinguishedname"),where_clause = query)
r = map(lambda x: x['cn'], self.ad_query.get_all_results())
k = [self.KNOWN_EXISTS_USER, self.KNOWN_EXISTS_COMPUTER]
self.assertEqual(r.sort(),k.sort()) | 48 | 96 | 0.674921 | 342 | 2,544 | 4.695906 | 0.143275 | 0.070984 | 0.130137 | 0.067248 | 0.858032 | 0.853051 | 0.816936 | 0.772105 | 0.744707 | 0.716065 | 0 | 0.001963 | 0.198899 | 2,544 | 53 | 97 | 48 | 0.786065 | 0 | 0 | 0.465116 | 0 | 0 | 0.073406 | 0 | 0 | 0 | 0 | 0 | 0.209302 | 1 | 0.232558 | false | 0 | 0.046512 | 0 | 0.302326 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
ea2a703092951fdc5fc325749e308692f2549a4d | 4,965 | py | Python | generate_k_table_pioneer_6.py | INTELYMEC/Double_QPID | 3a84d58d2ce22eed2e695eea1b0497c37a010266 | [
"MIT"
] | 13 | 2018-11-02T13:34:11.000Z | 2022-03-07T00:07:42.000Z | generate_k_table_pioneer_6.py | INTELYMEC/Double_QPID | 3a84d58d2ce22eed2e695eea1b0497c37a010266 | [
"MIT"
] | null | null | null | generate_k_table_pioneer_6.py | INTELYMEC/Double_QPID | 3a84d58d2ce22eed2e695eea1b0497c37a010266 | [
"MIT"
] | 4 | 2018-11-02T13:33:51.000Z | 2020-10-25T11:09:02.000Z | import numpy as np
def generate_k_table_pioneer_6(number_of_actions, k_step,k_min,k_max,k_size):
k1_step =k_step[0]
k1_min =k_min[0]
k1_max =k_max[0]
k1_size =k_size
k2_step =k_step[1]
k2_min = k_min[1]
k2_max = k_max[1]
k2_size =k_size
k3_step =k_step[2]
k3_min =k_min[2]
k3_max =k_max[2]
k3_size =k_size
k4_step =k_step[3]
k4_min = k_min[3]
k4_max = k_max[3]
k4_size =k_size
k5_step =k_step[4]
k5_min =k_min[4]
k5_max =k_max[4]
k5_size =k_size
k6_step =k_step[5]
k6_min = k_min[5]
k6_max = k_max[5]
k6_size =k_size
k_table = np.zeros((number_of_actions,6))
count = 0
for p in [k6_min, k6_min + k6_step, k6_max]:
for n in [k5_min, k5_min + k5_step, k5_max]:
for m in [k4_min, k4_min + k4_step, k4_max]:
for k in [k3_min, k3_min + k3_step, k3_max]:
for j in [k2_min, k2_min + k2_step, k2_max]:
for i in [k1_min, k1_min + k1_step, k1_max]:
k1=i
k2=j
k3=k
k4=m
k5=n
k6=p
if k1<0.:
k1 = 0.
if k2<=0.:
k2 = 0. + k2_step
if k3<0.:
k3 = 0.
if k4<0.:
k4 = 0.
if k5<0.:
k5 = 0. + k5_step
if k6<0.:
k6 = 0.
k_table[count]=np.array([k1, k2, k3, k4, k5, k6])
count = count + 1
return k_table
def generate_k_table_pioneer_4(number_of_actions, k_step,k_min,k_max,k_size):
k1_step =k_step[0]
k1_min =k_min[0]
k1_max =k_max[0]
k2_step =k_step[1]
k2_min = k_min[1]
k2_max = k_max[1]
k3_step =k_step[2]
k3_min =k_min[2]
k3_max =k_max[2]
k4_step =k_step[3]
k4_min = k_min[3]
k4_max = k_max[3]
k_table = np.zeros((number_of_actions,4))
count = 0
for m in [k4_min, k4_min + k4_step, k4_max]:
for k in [k3_min, k3_min + k3_step, k3_max]:
for j in [k2_min, k2_min + k2_step, k2_max]:
for i in [k1_min, k1_min + k1_step, k1_max]:
k1=i
k2=j
k3=k
k4=m
if k1<0.:
k1 = 0.
if k2<=0.:
k2 = 0. + k2_step
if k3<0.:
k3 = 0.
if k4<0.:
k4 = 0.
k_table[count]=np.array([k1, k2, k3, k4])
count = count + 1
return k_table
def generate_k_table_pioneer_3(number_of_actions, k_step,k_min,k_max,k_size):
k1_step = k_step[0]
k1_min = k_min[0]
k1_max = k_max[0]
k2_step = k_step[1]
k2_min = k_min[1]
k2_max = k_max[1]
k3_step = k_step[2]
k3_min = k_min[2]
k3_max = k_max[2]
k_table = np.zeros((number_of_actions,3))
count = 0
for k in [k3_min, k3_min + k3_step, k3_max]:
for j in [k2_min, k2_min + k2_step, k2_max]:
for i in [k1_min, k1_min + k1_step, k1_max]:
k1=i
k2=j
k3=k
if k1<0.:
k1 = 0.
if k2<=0.:
k2 = 0. + k2_step
if k3<0.:
k3 = 0.
k_table[count]=np.array([k1, k2, k3])
count = count + 1
return k_table
def generate_k_table_pioneer_2(number_of_actions, k_step,k_min,k_max,k_size):
k1_step = k_step[0]
k1_min = k_min[0]
k1_max = k_max[0]
k2_step = k_step[1]
k2_min = k_min[1]
k2_max = k_max[1]
k_table = np.zeros((number_of_actions,2))
count = 0
for j in [k2_min, k2_min + k2_step, k2_max]:
for i in [k1_min, k1_min + k1_step, k1_max]:
k1=i
k2=j
if k1<0.:
k1 = 0.
if k2<=0.:
k2 = 0. + k2_step
k_table[count]=np.array([k1, k2])
count = count + 1
return k_table
| 22.986111 | 77 | 0.393555 | 700 | 4,965 | 2.467143 | 0.058571 | 0.057904 | 0.07817 | 0.039375 | 0.848292 | 0.834395 | 0.821077 | 0.743486 | 0.743486 | 0.729589 | 0 | 0.111482 | 0.517623 | 4,965 | 215 | 78 | 23.093023 | 0.609603 | 0 | 0 | 0.757353 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.029412 | false | 0 | 0.007353 | 0 | 0.066176 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 |
17c749a51d86e071ac1d31d89f736d507c227a8a | 18,099 | py | Python | test/integration/helperscache_test/helperscache_test.py | onedata/oneclient | 46b2ca465bd4785f1b9a63aa7ce7fc5b2faaf130 | [
"MIT"
] | 4 | 2016-02-15T15:52:28.000Z | 2021-03-31T11:04:22.000Z | test/integration/helperscache_test/helperscache_test.py | onedata/oneclient | 46b2ca465bd4785f1b9a63aa7ce7fc5b2faaf130 | [
"MIT"
] | 11 | 2016-04-01T15:30:19.000Z | 2021-12-13T13:18:18.000Z | test/integration/helperscache_test/helperscache_test.py | onedata/oneclient | 46b2ca465bd4785f1b9a63aa7ce7fc5b2faaf130 | [
"MIT"
] | 3 | 2016-08-26T17:38:06.000Z | 2021-12-12T20:10:59.000Z | from __future__ import print_function
import random
__author__ = "Bartek Kryza"
__copyright__ = """(C) 2019 ACK CYFRONET AGH,
This software is released under the MIT license cited in 'LICENSE.txt'."""
import os
import sys
from threading import Thread
from multiprocessing import Pool
import time
import tempfile
import pytest
from stat import *
script_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.dirname(script_dir))
from test_common import reply, send, random_str
# noinspection PyUnresolvedReferences
from environment import appmock, common, docker
# noinspection PyUnresolvedReferences
import helperscache
# noinspection PyUnresolvedReferences
from proto import messages_pb2, fuse_messages_pb2, event_messages_pb2, \
common_messages_pb2, stream_messages_pb2
@pytest.yield_fixture
def endpoint(appmock_client):
app = appmock_client.tcp_endpoint(443)
yield app
appmock_client.reset_tcp_history()
@pytest.yield_fixture
def hc(endpoint):
cache = helperscache.HelpersCacheProxy(
endpoint.ip, endpoint.port,
'--no-buffer --provider-timeout=2 mountpoint')
yield cache
@pytest.yield_fixture
def hc_directio(endpoint):
cache = helperscache.HelpersCacheProxy(
endpoint.ip, endpoint.port,
'--no-buffer --provider-timeout=2 --force-direct-io mountpoint')
yield cache
@pytest.yield_fixture
def hc_proxyio(endpoint):
cache = helperscache.HelpersCacheProxy(
endpoint.ip, endpoint.port,
'--no-buffer --provider-timeout=2 --force-proxy-io mountpoint')
yield cache
@pytest.fixture
def storage_id():
return random_str()
@pytest.fixture
def space_id():
return random_str()
@pytest.fixture
def file_uuid():
return random_str()
@pytest.fixture
def file_content():
return random_str()
def prepare_posix_helper_params(storage_id, mount_point):
repl = fuse_messages_pb2.HelperParams()
repl.helper_name = 'posix'
p = repl.helper_args.add()
p.key = 'type'
p.value = 'posix'
p = repl.helper_args.add()
p.key = 'testMountPoint'
p.value = mount_point
p = repl.helper_args.add()
p.key = 'uid'
p.value = '-1'
p = repl.helper_args.add()
p.key = 'gid'
p.value = '-1'
p = repl.helper_args.add()
p.key = 'timeout'
p.value = '1'
return repl
def prepare_refresh_posix_helper_params(storage_id, mount_point):
repl = fuse_messages_pb2.HelperParams()
repl.helper_name = 'posix'
p = repl.helper_args.add()
p.key = 'type'
p.value = 'posix'
p = repl.helper_args.add()
p.key = 'mountPoint'
p.value = mount_point
p = repl.helper_args.add()
p.key = 'uid'
p.value = '-1'
p = repl.helper_args.add()
p.key = 'gid'
p.value = '-1'
p = repl.helper_args.add()
p.key = 'timeout'
p.value = '1'
return repl
def prepare_proxy_helper_response(storage_id):
helper_params = fuse_messages_pb2.HelperParams()
helper_params.helper_name = 'proxy'
p = helper_params.helper_args.add()
p.key = 'type'
p.value = 'proxy'
p = helper_params.helper_args.add()
p.key = 'storageId'
p.value = storage_id
p = helper_params.helper_args.add()
p.key = 'timeout'
p.value = '1'
server_response = messages_pb2.ServerMessage()
server_response.fuse_response.helper_params.CopyFrom(helper_params)
server_response.fuse_response.status.code = common_messages_pb2.Status.ok
return server_response
def prepare_posix_helper_params_response(storage_id, mount_point):
helper_params = prepare_posix_helper_params(storage_id, mount_point)
server_response = messages_pb2.ServerMessage()
server_response.fuse_response.helper_params.CopyFrom(helper_params)
server_response.fuse_response.status.code = common_messages_pb2.Status.ok
return server_response
def prepare_refresh_posix_helper_params_response(storage_id, mount_point):
helper_params = prepare_refresh_posix_helper_params(storage_id,
mount_point)
server_response = messages_pb2.ServerMessage()
server_response.fuse_response.helper_params.CopyFrom(helper_params)
server_response.fuse_response.status.code = common_messages_pb2.Status.ok
return server_response
def prepare_posix_create_storage_test_file(file_uuid, storage_id,
space_id, file_content, mount_point):
helper_params = prepare_posix_helper_params(storage_id, mount_point)
server_response = messages_pb2.ServerMessage()
server_response.fuse_response.storage_test_file.helper_params.CopyFrom(helper_params)
server_response.fuse_response.storage_test_file.space_id = space_id
server_response.fuse_response.storage_test_file.file_id = file_uuid
server_response.fuse_response.storage_test_file.file_content = file_content
server_response.fuse_response.status.code = common_messages_pb2.Status.ok
return server_response
def test_automatic_posix_helper_detection_should_work(endpoint, hc, storage_id,
space_id, file_uuid, file_content):
assert hc.is_directio_forced() is False
assert hc.is_proxyio_forced() is False
mount_point = tempfile.mkdtemp(suffix='helperscache')
create_storage_file_response = \
prepare_posix_create_storage_test_file(file_uuid, storage_id,
space_id, file_content, mount_point)
posix_helper_params = \
prepare_posix_helper_params_response(storage_id, mount_point)
# Write random content to file
with open(os.path.join(mount_point, file_uuid), 'wb') as test_file:
test_file.write(file_content)
verify_storage_test_file_response = messages_pb2.ServerMessage()
verify_storage_test_file_response.fuse_response.status.code = \
common_messages_pb2.Status.ok
create_storage_file_request = None
verify_storage_file_request = None
with reply(endpoint, [posix_helper_params,
create_storage_file_response,
verify_storage_test_file_response]) as queue:
res = hc.get(file_uuid, space_id, storage_id, False, False)
assert res
posix_helper_params_request = queue.get()
create_storage_file_request = queue.get()
verify_storage_file_request = queue.get()
assert create_storage_file_request.HasField('fuse_request')
create_storage_test_file = \
create_storage_file_request.fuse_request.create_storage_test_file
assert create_storage_test_file.storage_id == storage_id
assert create_storage_test_file.file_uuid == file_uuid
assert verify_storage_file_request.HasField('fuse_request')
verify_storage_test_file = \
verify_storage_file_request.fuse_request.verify_storage_test_file
assert verify_storage_test_file.storage_id == storage_id
assert verify_storage_test_file.space_id == space_id
assert verify_storage_test_file.file_id == file_uuid
file_contents = verify_storage_test_file.file_content
assert hc.get_access_type(storage_id) == "direct"
# Verify content written to the test file by storage access manager
with open(os.path.join(mount_point, file_uuid), 'rb') as test_file:
assert test_file.read() == file_contents
def test_directio_posix_helper_detection_should_work(endpoint, hc_directio,
storage_id, space_id, file_uuid, file_content):
assert hc_directio.is_directio_forced() is True
mount_point = tempfile.mkdtemp(suffix='helperscache')
posix_helper_params = \
prepare_posix_helper_params_response(storage_id, mount_point)
create_storage_file_response = \
prepare_posix_create_storage_test_file(file_uuid, storage_id,
space_id, file_content, mount_point)
# Write random content to file
with open(os.path.join(mount_point, file_uuid), 'wb') as test_file:
test_file.write(file_content)
verify_storage_test_file_response = messages_pb2.ServerMessage()
verify_storage_test_file_response.fuse_response.status.code = \
common_messages_pb2.Status.ok
get_helper_params_request = None
create_storage_file_request = None
verify_storage_file_request = None
with reply(endpoint, [posix_helper_params,
create_storage_file_response,
verify_storage_test_file_response]) as queue:
res = hc_directio.get(file_uuid, space_id, storage_id, False, False)
assert res
get_helper_params_request = queue.get()
create_storage_file_request = queue.get()
verify_storage_file_request = queue.get()
assert get_helper_params_request.HasField('fuse_request')
get_helper_params = \
get_helper_params_request.fuse_request.get_helper_params
assert get_helper_params.storage_id == storage_id
assert get_helper_params.space_id == space_id
assert get_helper_params.helper_mode == 3
assert create_storage_file_request.HasField('fuse_request')
create_storage_test_file = \
create_storage_file_request.fuse_request.create_storage_test_file
assert create_storage_test_file.storage_id == storage_id
assert create_storage_test_file.file_uuid == file_uuid
assert verify_storage_file_request.HasField('fuse_request')
verify_storage_test_file = \
verify_storage_file_request.fuse_request.verify_storage_test_file
assert verify_storage_test_file.storage_id == storage_id
assert verify_storage_test_file.space_id == space_id
assert verify_storage_test_file.file_id == file_uuid
file_contents = verify_storage_test_file.file_content
assert hc_directio.get_access_type(storage_id) == "direct"
# Verify content written to the test file by storage access manager
with open(os.path.join(mount_point, file_uuid), 'rb') as test_file:
assert test_file.read() == file_contents
def test_proxyio_posix_helper_detection_should_work(endpoint, hc_proxyio,
storage_id, space_id, file_uuid):
assert hc_proxyio.is_proxyio_forced() is True
proxy_helper_params_response = prepare_proxy_helper_response(storage_id)
proxy_helper_params_request = None
with reply(endpoint, [proxy_helper_params_response]) as queue:
res = hc_proxyio.get(file_uuid, space_id, storage_id, True, False)
assert res
proxy_helper_params_request = queue.get()
assert proxy_helper_params_request.HasField('fuse_request')
get_helper_params = proxy_helper_params_request.fuse_request.get_helper_params
assert get_helper_params.storage_id == storage_id
assert get_helper_params.space_id == space_id
assert get_helper_params.helper_mode == 2
assert hc_proxyio.get_access_type(storage_id) == "proxy"
def test_automatic_posix_helper_detection_should_fallback_to_proxy(endpoint,
hc, storage_id, space_id, file_uuid, file_content):
assert hc.is_directio_forced() is False
assert hc.is_proxyio_forced() is False
mount_point = tempfile.mkdtemp(suffix='helperscache')
mount_point_invalid = tempfile.mkdtemp(suffix='helperscache')
posix_helper_params = \
prepare_posix_helper_params_response(storage_id, mount_point)
create_storage_file_response = \
prepare_posix_create_storage_test_file(file_uuid, storage_id,
space_id, file_content, mount_point_invalid)
# Write random content to file
with open(os.path.join(mount_point, file_uuid), 'wb') as test_file:
test_file.write(file_content)
proxy_helper_params_response = prepare_proxy_helper_response(storage_id)
verify_storage_test_file_response = messages_pb2.ServerMessage()
verify_storage_test_file_response.fuse_response.status.code = \
common_messages_pb2.Status.ok
create_storage_file_request = None
proxy_helper_params_request = None
with reply(endpoint, [posix_helper_params,
create_storage_file_response,
proxy_helper_params_response,
create_storage_file_response]) as queue:
res = hc.get(file_uuid, space_id, storage_id, False, False)
posix_helper_params_request = queue.get()
create_storage_file_request = queue.get()
proxy_helper_params_request = queue.get()
create_storage_file_request = queue.get()
# Wait for storage detection to complete in background
time.sleep(15)
assert create_storage_file_request.HasField('fuse_request')
create_storage_test_file = \
create_storage_file_request.fuse_request.create_storage_test_file
assert create_storage_test_file.storage_id == storage_id
assert create_storage_test_file.file_uuid == file_uuid
assert proxy_helper_params_request.HasField('fuse_request')
get_helper_params = \
proxy_helper_params_request.fuse_request.get_helper_params
assert get_helper_params.storage_id == storage_id
assert get_helper_params.space_id == space_id
assert get_helper_params.helper_mode == 2
assert hc.get_access_type(storage_id) == "proxy"
def test_directio_posix_helper_detection_should_not_allow_proxy(
endpoint, hc_directio, storage_id, space_id, file_uuid):
assert hc_directio.is_directio_forced() is True
with pytest.raises(RuntimeError) as excinfo:
with reply(endpoint, []) as queue:
hc_directio.get(file_uuid, space_id, storage_id, True, False)
queue.get()
assert 'Operation not supported' in str(excinfo.value)
def test_directio_posix_helper_detection_should_fallback_to_proxy_on_eaccess(
endpoint, hc_directio, storage_id, space_id, file_uuid):
assert hc_directio.is_directio_forced() is True
proxy_helper_params_response = prepare_proxy_helper_response(storage_id)
proxy_helper_params_request = None
with reply(endpoint, [proxy_helper_params_response]) as queue:
res = hc_directio.get(file_uuid, space_id, storage_id, True, True)
assert res
proxy_helper_params_request = queue.get()
assert proxy_helper_params_request.HasField('fuse_request')
get_helper_params = proxy_helper_params_request.fuse_request.get_helper_params
assert get_helper_params.storage_id == storage_id
assert get_helper_params.space_id == space_id
assert get_helper_params.helper_mode == 2
assert hc_directio.get_access_type(storage_id) == "proxy"
def test_helper_should_refresh_parameters(
endpoint, hc_directio, storage_id, space_id, file_uuid, file_content):
assert hc_directio.is_directio_forced() is True
mount_point = tempfile.mkdtemp(suffix='helperscache')
posix_helper_params = \
prepare_posix_helper_params_response(storage_id, mount_point)
create_storage_file_response = \
prepare_posix_create_storage_test_file(file_uuid, storage_id,
space_id, file_content, mount_point)
# Write random content to file
with open(os.path.join(mount_point, file_uuid), 'wb') as test_file:
test_file.write(file_content)
verify_storage_test_file_response = messages_pb2.ServerMessage()
verify_storage_test_file_response.fuse_response.status.code = \
common_messages_pb2.Status.ok
get_helper_params_request = None
create_storage_file_request = None
verify_storage_file_request = None
with reply(endpoint, [posix_helper_params,
create_storage_file_response,
verify_storage_test_file_response]) as queue:
res = hc_directio.get(file_uuid, space_id, storage_id, False, False)
assert res
get_helper_params_request = queue.get()
create_storage_file_request = queue.get()
verify_storage_file_request = queue.get()
assert create_storage_file_request.HasField('fuse_request')
create_storage_test_file = \
create_storage_file_request.fuse_request.create_storage_test_file
assert create_storage_test_file.storage_id == storage_id
assert create_storage_test_file.file_uuid == file_uuid
assert verify_storage_file_request.HasField('fuse_request')
verify_storage_test_file = \
verify_storage_file_request.fuse_request.verify_storage_test_file
assert verify_storage_test_file.storage_id == storage_id
assert verify_storage_test_file.space_id == space_id
assert verify_storage_test_file.file_id == file_uuid
file_contents = verify_storage_test_file.file_content
assert hc_directio.get_access_type(storage_id) == "direct"
# Verify content written to the test file by storage access manager
with open(os.path.join(mount_point, file_uuid), 'rb') as test_file:
assert test_file.read() == file_contents
mount_point = tempfile.mkdtemp(suffix='helperscache')
posix_helper_params = \
prepare_refresh_posix_helper_params_response(storage_id,
mount_point)
get_helper_params_request = None
with reply(endpoint, [posix_helper_params]) as queue:
# Refresh helper parameters
hc_directio.refresh_helper_parameters(storage_id, space_id)
res = hc_directio.get(file_uuid, space_id, storage_id, False, False)
assert res
get_helper_params_request = queue.get()
assert get_helper_params_request.HasField('fuse_request')
get_helper_params = \
get_helper_params_request.fuse_request.get_helper_params
assert get_helper_params.storage_id == storage_id
assert get_helper_params.space_id == space_id
assert get_helper_params.helper_mode == 3
assert hc_directio.get_access_type(storage_id) == "direct"
# Write to a file in new mountpoint using refreshed helper
hc_directio.mknod('file1', space_id, storage_id, False)
handle = hc_directio.open('file1', space_id, storage_id, False)
file_contents = random_str()
handle.write(0, file_contents)
# Verify content written to the file by helper
with open(os.path.join(mount_point, 'file1'), 'rb') as test_file:
assert test_file.read() == file_contents
| 35.280702 | 89 | 0.742638 | 2,410 | 18,099 | 5.151037 | 0.075104 | 0.089899 | 0.065249 | 0.049058 | 0.880458 | 0.873127 | 0.86628 | 0.830192 | 0.801756 | 0.781456 | 0 | 0.003589 | 0.184099 | 18,099 | 512 | 90 | 35.349609 | 0.837069 | 0.033262 | 0 | 0.747222 | 0 | 0 | 0.040156 | 0 | 0 | 0 | 0 | 0 | 0.197222 | 1 | 0.058333 | false | 0 | 0.038889 | 0.011111 | 0.125 | 0.002778 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
17faa8a2610521820d0e1c144c39a85aa6095ef6 | 5,958 | py | Python | pyNastran/bdf/cards/test/test_other.py | ACea15/pyNastran | 5ffc37d784b52c882ea207f832bceb6b5eb0e6d4 | [
"BSD-3-Clause"
] | 1 | 2021-08-02T09:49:24.000Z | 2021-08-02T09:49:24.000Z | pyNastran/bdf/cards/test/test_other.py | ACea15/pyNastran | 5ffc37d784b52c882ea207f832bceb6b5eb0e6d4 | [
"BSD-3-Clause"
] | null | null | null | pyNastran/bdf/cards/test/test_other.py | ACea15/pyNastran | 5ffc37d784b52c882ea207f832bceb6b5eb0e6d4 | [
"BSD-3-Clause"
] | null | null | null | import unittest
#import pyNastran
from pyNastran.bdf.bdf import BDF, PARAM, BDFCard
#ROOT_PATH = pyNastran.__path__[0]
#test_path = os.path.join(ROOT_PATH, 'bdf', 'cards', 'test')
class TestOther(unittest.TestCase):
def test_param_01(self):
card = PARAM('NOCOMP', [-1])
#print('%r' % card)
assert str(card) == 'PARAM NOCOMP -1\n', '%r' % str(card)
cardi = BDFCard(['PARAM', 'NOCOMP', -1])
card = PARAM.add_card(cardi)
assert str(card) == 'PARAM NOCOMP -1\n', '%r' % str(card)
#print('%r' % card)
def test_param_02(self):
model = BDF(debug=False)
param = model.add_param('POST', -1, comment='param post')
param.raw_fields()
param.write_card(size=8, is_double=False)
param.write_card(size=16, is_double=False)
param.write_card(size=16, is_double=True)
param.write_card_16(is_double=False)
param.write_card_16(is_double=True)
def test_param_mystran(self):
model = BDF(debug=True, log=None, mode='mystran')
param1 = model.add_param('POST', -1, comment='')
str(param1)
fields = ['PARAM', 'EQCHECK', '0', 3, 3, None, None, None, -1.E10]
param2 = model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
str(param2)
fields = ['PARAM', 'AUTOSPC', 'Y', 1.0E-9, None, 'Y', 'Y']
param3 = model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
str(param3)
fields = ['PARAM', 'ART_MASS', 'Y', '0.', 1.E-6]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'EIGNORM2', 'Y']
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'GRDPNT', 0]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'MEFMLOC', 'CG']
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'RCONDK', 'Y']
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'SOLLIB', 'LAPACK']
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'WTMASS', .002591]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
# basic flags
fields = ['PARAM', 'PRTBASIC', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTCGLTM', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTDLR', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTGMN', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTGOA', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTSCP', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTTSET', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTHMN', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTIFLTM', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTKXX', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTMXX', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTPHIXA', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTPHIZL', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTQSYS', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTUO0', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTYS', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
# not basic flags
fields = ['PARAM', 'PRTCORD', '2']
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTDOF', 1]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTRMG', 3]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
# fancy flags
fields = ['PARAM', 'PRTSTIFF', 1, 3, 3, 3, 3]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTSTIFD', 1, 3, 3, 3, 3]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTFOR', 1, 3, 3, 3, 3]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
fields = ['PARAM', 'PRTMASS', 1, 3, 3, 3, 3]
model.add_card(fields, 'PARAM', comment='param', ifile=None, is_list=True, has_none=True)
if __name__ == '__main__': # pragma: no cover
unittest.main()
| 42.863309 | 106 | 0.61044 | 820 | 5,958 | 4.271951 | 0.132927 | 0.204111 | 0.10962 | 0.16443 | 0.758493 | 0.758493 | 0.737368 | 0.729089 | 0.729089 | 0.729089 | 0 | 0.018337 | 0.212823 | 5,958 | 138 | 107 | 43.173913 | 0.728571 | 0.033736 | 0 | 0.355556 | 0 | 0 | 0.142658 | 0 | 0 | 0 | 0 | 0 | 0.022222 | 1 | 0.033333 | false | 0 | 0.022222 | 0 | 0.066667 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
aa2e6de7809788a498db8748c689f5e5c72c48ee | 465 | py | Python | calculator.py | KotonBads/calcullator-functions | 5dfc3260376beca9647e3e1ed5caff4429cfcf12 | [
"MIT"
] | null | null | null | calculator.py | KotonBads/calcullator-functions | 5dfc3260376beca9647e3e1ed5caff4429cfcf12 | [
"MIT"
] | null | null | null | calculator.py | KotonBads/calcullator-functions | 5dfc3260376beca9647e3e1ed5caff4429cfcf12 | [
"MIT"
] | 1 | 2021-09-06T13:06:27.000Z | 2021-09-06T13:06:27.000Z | class add:
def __init__(self, num1, num2):
print(num1 + num2)
class subtr:
def __init__(self, num1, num2):
print(num1 - num2)
class multp:
def __init__(self, num1, num2):
print(num1 * num2)
class divs:
def __init__(self, num1, num2):
print(num1 / num2)
class pwr:
def __init__(self, num1, num2):
print(num1 ** num2)
class sqrt:
def __init__(self, num1):
print(num1 ** (1/2))
| 24.473684 | 36 | 0.567742 | 60 | 465 | 4 | 0.25 | 0.333333 | 0.275 | 0.375 | 0.770833 | 0.770833 | 0.770833 | 0.770833 | 0.770833 | 0 | 0 | 0.074534 | 0.307527 | 465 | 18 | 37 | 25.833333 | 0.670807 | 0 | 0 | 0.277778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0.333333 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 9 |
a4f24b5950b69fd816c45885037d94395404c8da | 11,422 | py | Python | pyvetherpools/utils_vether_abi.py | vetherasset/py-vether-pools | 38f5aa60a90bdfa8cb7035f16978f73896f6fdcd | [
"Unlicense"
] | 1 | 2021-05-02T01:23:57.000Z | 2021-05-02T01:23:57.000Z | pyvetherpools/utils_vether_abi.py | vetherasset/py-vether-pools | 38f5aa60a90bdfa8cb7035f16978f73896f6fdcd | [
"Unlicense"
] | null | null | null | pyvetherpools/utils_vether_abi.py | vetherasset/py-vether-pools | 38f5aa60a90bdfa8cb7035f16978f73896f6fdcd | [
"Unlicense"
] | null | null | null | utils_vether_abi = '[{"inputs":[],"stateMutability":"payable","type":"constructor"},{"inputs":[],"name":"BASE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DAO","outputs":[{"internalType":"contract iDAO","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPLOYER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allPools","outputs":[{"internalType":"address[]","name":"_allPools","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allTokens","outputs":[{"internalType":"address[]","name":"_allTokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"u","type":"uint256"},{"internalType":"uint256","name":"U","type":"uint256"},{"internalType":"uint256","name":"A","type":"uint256"}],"name":"calcAsymmetricShare","outputs":[{"internalType":"uint256","name":"share","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calcBasePPinToken","outputs":[{"internalType":"uint256","name":"_output","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"pool","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calcBasePPinTokenWithPool","outputs":[{"internalType":"uint256","name":"_output","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"bp","type":"uint256"},{"internalType":"uint256","name":"total","type":"uint256"}],"name":"calcPart","outputs":[{"internalType":"uint256","name":"part","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"part","type":"uint256"},{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calcShare","outputs":[{"internalType":"uint256","name":"share","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"b","type":"uint256"},{"internalType":"uint256","name":"B","type":"uint256"},{"internalType":"uint256","name":"t","type":"uint256"},{"internalType":"uint256","name":"T","type":"uint256"}],"name":"calcStakeUnits","outputs":[{"internalType":"uint256","name":"units","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"X","type":"uint256"},{"internalType":"uint256","name":"Y","type":"uint256"}],"name":"calcSwapFee","outputs":[{"internalType":"uint256","name":"output","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"X","type":"uint256"},{"internalType":"uint256","name":"Y","type":"uint256"}],"name":"calcSwapOutput","outputs":[{"internalType":"uint256","name":"output","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calcTokenPPinBase","outputs":[{"internalType":"uint256","name":"_output","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"pool","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calcTokenPPinBaseWithPool","outputs":[{"internalType":"uint256","name":"_output","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calcValueInBase","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"pool","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calcValueInBaseWithPool","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calcValueInToken","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"pool","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calcValueInTokenWithPool","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGlobalDetails","outputs":[{"components":[{"internalType":"uint256","name":"totalStaked","type":"uint256"},{"internalType":"uint256","name":"totalVolume","type":"uint256"},{"internalType":"uint256","name":"totalFees","type":"uint256"},{"internalType":"uint256","name":"unstakeTx","type":"uint256"},{"internalType":"uint256","name":"stakeTx","type":"uint256"},{"internalType":"uint256","name":"swapTx","type":"uint256"}],"internalType":"struct Utils_Vether.GlobalDetails","name":"globalDetails","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"member","type":"address"}],"name":"getMemberShare","outputs":[{"internalType":"uint256","name":"baseAmt","type":"uint256"},{"internalType":"uint256","name":"tokenAmt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getPool","outputs":[{"internalType":"address payable","name":"pool","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getPoolAPY","outputs":[{"internalType":"uint256","name":"apy","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getPoolAge","outputs":[{"internalType":"uint256","name":"daysSinceGenesis","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getPoolData","outputs":[{"components":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"uint256","name":"genesis","type":"uint256"},{"internalType":"uint256","name":"baseAmt","type":"uint256"},{"internalType":"uint256","name":"tokenAmt","type":"uint256"},{"internalType":"uint256","name":"baseAmtStaked","type":"uint256"},{"internalType":"uint256","name":"tokenAmtStaked","type":"uint256"},{"internalType":"uint256","name":"fees","type":"uint256"},{"internalType":"uint256","name":"volume","type":"uint256"},{"internalType":"uint256","name":"txCount","type":"uint256"},{"internalType":"uint256","name":"poolUnits","type":"uint256"}],"internalType":"struct Utils_Vether.PoolDataStruct","name":"poolData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getPoolROI","outputs":[{"internalType":"uint256","name":"roi","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"units","type":"uint256"}],"name":"getPoolShare","outputs":[{"internalType":"uint256","name":"baseAmt","type":"uint256"},{"internalType":"uint256","name":"tokenAmt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"units","type":"uint256"},{"internalType":"bool","name":"toBase","type":"bool"}],"name":"getPoolShareAssym","outputs":[{"internalType":"uint256","name":"baseAmt","type":"uint256"},{"internalType":"uint256","name":"tokenAmt","type":"uint256"},{"internalType":"uint256","name":"outputAmt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"member","type":"address"}],"name":"getShareOfBaseAmount","outputs":[{"internalType":"uint256","name":"baseAmt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"member","type":"address"}],"name":"getShareOfTokenAmount","outputs":[{"internalType":"uint256","name":"baseAmt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getTokenDetails","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"decimals","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"}],"internalType":"struct Utils_Vether.TokenDetails","name":"tokenDetails","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"member","type":"address"}],"name":"getTokenDetailsWithMember","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"decimals","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"}],"internalType":"struct Utils_Vether.TokenDetails","name":"tokenDetails","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"member","type":"address"}],"name":"isMember","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"poolsInRange","outputs":[{"internalType":"address[]","name":"somePools","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"dao","type":"address"}],"name":"setGenesisDao","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenCount","outputs":[{"internalType":"uint256","name":"count","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"tokensInRange","outputs":[{"internalType":"address[]","name":"someTokens","type":"address[]"}],"stateMutability":"view","type":"function"}]' | 11,422 | 11,422 | 0.669585 | 1,096 | 11,422 | 6.967153 | 0.10219 | 0.139733 | 0.240964 | 0.137507 | 0.826087 | 0.774227 | 0.746333 | 0.728523 | 0.696176 | 0.667496 | 0 | 0.042068 | 0.001051 | 11,422 | 1 | 11,422 | 11,422 | 0.627169 | 0 | 0 | 0 | 0 | 1 | 0.998074 | 0.997199 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 |
108f03bd8c407f2d13628353733c3d7599f21cc6 | 19,080 | py | Python | lambdas/jumpcloud/jcapiv1/apis/command_results_api.py | zimingd/aws-infra | 89922f6d2a148b14119a8b8164dd4b06d465d94e | [
"Apache-2.0"
] | null | null | null | lambdas/jumpcloud/jcapiv1/apis/command_results_api.py | zimingd/aws-infra | 89922f6d2a148b14119a8b8164dd4b06d465d94e | [
"Apache-2.0"
] | null | null | null | lambdas/jumpcloud/jcapiv1/apis/command_results_api.py | zimingd/aws-infra | 89922f6d2a148b14119a8b8164dd4b06d465d94e | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
JumpCloud APIs
V1 & V2 versions of JumpCloud's API. The previous version of JumpCloud's API. This set of endpoints allows JumpCloud customers to manage commands, systems, & system users.
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six import iteritems
from ..configuration import Configuration
from ..api_client import ApiClient
class CommandResultsApi(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
config = Configuration()
if api_client:
self.api_client = api_client
else:
if not config.api_client:
config.api_client = ApiClient()
self.api_client = config.api_client
def command_results_delete(self, id, content_type, accept, **kwargs):
"""
Delete a Command result
Deletes a specific command result.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.command_results_delete(id, content_type, accept, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str id: (required)
:param str content_type: (required)
:param str accept: (required)
:return: Commandresult
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.command_results_delete_with_http_info(id, content_type, accept, **kwargs)
else:
(data) = self.command_results_delete_with_http_info(id, content_type, accept, **kwargs)
return data
def command_results_delete_with_http_info(self, id, content_type, accept, **kwargs):
"""
Delete a Command result
Deletes a specific command result.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.command_results_delete_with_http_info(id, content_type, accept, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str id: (required)
:param str content_type: (required)
:param str accept: (required)
:return: Commandresult
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'content_type', 'accept']
all_params.append('callback')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method command_results_delete" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params) or (params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `command_results_delete`")
# verify the required parameter 'content_type' is set
if ('content_type' not in params) or (params['content_type'] is None):
raise ValueError("Missing the required parameter `content_type` when calling `command_results_delete`")
# verify the required parameter 'accept' is set
if ('accept' not in params) or (params['accept'] is None):
raise ValueError("Missing the required parameter `accept` when calling `command_results_delete`")
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id']
query_params = []
header_params = {}
if 'content_type' in params:
header_params['Content-Type'] = params['content_type']
if 'accept' in params:
header_params['Accept'] = params['accept']
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json; charset=utf-8'])
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = ['x-api-key']
return self.api_client.call_api('/commandresults/{id}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Commandresult',
auth_settings=auth_settings,
callback=params.get('callback'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def command_results_get(self, id, content_type, accept, **kwargs):
"""
List an individual Command result
Returns a specific command result.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.command_results_get(id, content_type, accept, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str id: (required)
:param str content_type: (required)
:param str accept: (required)
:param str fields: The comma separated fields included in the returned records. If omitted the default list of fields will be returned.
:param int limit: The number of records to return at once.
:param int skip: The offset into the records to return.
:param str sort: The comma separated fields used to sort the collection. Default sort is ascending, prefix with `-` to sort descending.
:return: Commandresult
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.command_results_get_with_http_info(id, content_type, accept, **kwargs)
else:
(data) = self.command_results_get_with_http_info(id, content_type, accept, **kwargs)
return data
def command_results_get_with_http_info(self, id, content_type, accept, **kwargs):
"""
List an individual Command result
Returns a specific command result.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.command_results_get_with_http_info(id, content_type, accept, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str id: (required)
:param str content_type: (required)
:param str accept: (required)
:param str fields: The comma separated fields included in the returned records. If omitted the default list of fields will be returned.
:param int limit: The number of records to return at once.
:param int skip: The offset into the records to return.
:param str sort: The comma separated fields used to sort the collection. Default sort is ascending, prefix with `-` to sort descending.
:return: Commandresult
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'content_type', 'accept', 'fields', 'limit', 'skip', 'sort']
all_params.append('callback')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method command_results_get" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params) or (params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `command_results_get`")
# verify the required parameter 'content_type' is set
if ('content_type' not in params) or (params['content_type'] is None):
raise ValueError("Missing the required parameter `content_type` when calling `command_results_get`")
# verify the required parameter 'accept' is set
if ('accept' not in params) or (params['accept'] is None):
raise ValueError("Missing the required parameter `accept` when calling `command_results_get`")
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id']
query_params = []
if 'fields' in params:
query_params.append(('fields', params['fields']))
if 'limit' in params:
query_params.append(('limit', params['limit']))
if 'skip' in params:
query_params.append(('skip', params['skip']))
if 'sort' in params:
query_params.append(('sort', params['sort']))
header_params = {}
if 'content_type' in params:
header_params['Content-Type'] = params['content_type']
if 'accept' in params:
header_params['Accept'] = params['accept']
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json; charset=utf-8'])
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = ['x-api-key']
return self.api_client.call_api('/commandresults/{id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Commandresult',
auth_settings=auth_settings,
callback=params.get('callback'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def command_results_list(self, content_type, accept, **kwargs):
"""
List all Command Results
Returns all command results.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.command_results_list(content_type, accept, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str content_type: (required)
:param str accept: (required)
:param str fields: The comma separated fields included in the returned records. If omitted the default list of fields will be returned.
:param int limit: The number of records to return at once.
:param int skip: The offset into the records to return.
:param str sort: The comma separated fields used to sort the collection. Default sort is ascending, prefix with `-` to sort descending.
:return: Commandresultslist
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.command_results_list_with_http_info(content_type, accept, **kwargs)
else:
(data) = self.command_results_list_with_http_info(content_type, accept, **kwargs)
return data
def command_results_list_with_http_info(self, content_type, accept, **kwargs):
"""
List all Command Results
Returns all command results.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.command_results_list_with_http_info(content_type, accept, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str content_type: (required)
:param str accept: (required)
:param str fields: The comma separated fields included in the returned records. If omitted the default list of fields will be returned.
:param int limit: The number of records to return at once.
:param int skip: The offset into the records to return.
:param str sort: The comma separated fields used to sort the collection. Default sort is ascending, prefix with `-` to sort descending.
:return: Commandresultslist
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['content_type', 'accept', 'fields', 'limit', 'skip', 'sort']
all_params.append('callback')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method command_results_list" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'content_type' is set
if ('content_type' not in params) or (params['content_type'] is None):
raise ValueError("Missing the required parameter `content_type` when calling `command_results_list`")
# verify the required parameter 'accept' is set
if ('accept' not in params) or (params['accept'] is None):
raise ValueError("Missing the required parameter `accept` when calling `command_results_list`")
collection_formats = {}
path_params = {}
query_params = []
if 'fields' in params:
query_params.append(('fields', params['fields']))
if 'limit' in params:
query_params.append(('limit', params['limit']))
if 'skip' in params:
query_params.append(('skip', params['skip']))
if 'sort' in params:
query_params.append(('sort', params['sort']))
header_params = {}
if 'content_type' in params:
header_params['Content-Type'] = params['content_type']
if 'accept' in params:
header_params['Accept'] = params['accept']
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json; charset=utf-8'])
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = ['x-api-key']
return self.api_client.call_api('/commandresults', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Commandresultslist',
auth_settings=auth_settings,
callback=params.get('callback'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
| 44.683841 | 175 | 0.593239 | 2,070 | 19,080 | 5.281643 | 0.092754 | 0.057349 | 0.032653 | 0.02433 | 0.937346 | 0.9314 | 0.929114 | 0.922162 | 0.922162 | 0.914022 | 0 | 0.000774 | 0.322694 | 19,080 | 426 | 176 | 44.788732 | 0.845237 | 0.353407 | 0 | 0.769231 | 0 | 0 | 0.191556 | 0.035467 | 0 | 0 | 0 | 0 | 0 | 1 | 0.033654 | false | 0 | 0.033654 | 0 | 0.115385 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
52b058fe3566dc826c2b3152c478bc57bbd42a7c | 171 | py | Python | overhave/publication/gitlab/tokenizer/__init__.py | TinkoffCreditSystems/overhave | b0ab705ef5c5c5a65fa0b14b173b64fd7310e187 | [
"Apache-2.0"
] | 33 | 2021-02-01T15:49:37.000Z | 2021-12-20T00:44:43.000Z | overhave/publication/gitlab/tokenizer/__init__.py | TinkoffCreditSystems/overhave | b0ab705ef5c5c5a65fa0b14b173b64fd7310e187 | [
"Apache-2.0"
] | 46 | 2021-02-03T12:56:52.000Z | 2021-12-19T18:50:27.000Z | overhave/publication/gitlab/tokenizer/__init__.py | TinkoffCreditSystems/overhave | b0ab705ef5c5c5a65fa0b14b173b64fd7310e187 | [
"Apache-2.0"
] | 1 | 2021-12-07T09:02:44.000Z | 2021-12-07T09:02:44.000Z | # flake8: noqa
from overhave.publication.gitlab.tokenizer.client import TokenizerClient
from overhave.publication.gitlab.tokenizer.settings import TokenizerClientSettings
| 42.75 | 82 | 0.877193 | 18 | 171 | 8.333333 | 0.666667 | 0.16 | 0.306667 | 0.386667 | 0.506667 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00625 | 0.064327 | 171 | 3 | 83 | 57 | 0.93125 | 0.070175 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
5e3b87aad52bd3d50c7b647ab53797799fa8d89a | 14,025 | py | Python | yandex/cloud/datatransfer/v1/transfer_service_pb2_grpc.py | korsar182/python-sdk | 873bf2a9b136a8f2faae72e86fae1f5b5c3d896a | [
"MIT"
] | 36 | 2018-12-23T13:51:50.000Z | 2022-03-25T07:48:24.000Z | yandex/cloud/datatransfer/v1/transfer_service_pb2_grpc.py | korsar182/python-sdk | 873bf2a9b136a8f2faae72e86fae1f5b5c3d896a | [
"MIT"
] | 15 | 2019-02-28T04:55:09.000Z | 2022-03-06T23:17:24.000Z | yandex/cloud/datatransfer/v1/transfer_service_pb2_grpc.py | korsar182/python-sdk | 873bf2a9b136a8f2faae72e86fae1f5b5c3d896a | [
"MIT"
] | 18 | 2019-02-23T07:10:57.000Z | 2022-03-28T14:41:08.000Z | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from yandex.cloud.datatransfer.v1 import transfer_pb2 as yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__pb2
from yandex.cloud.datatransfer.v1 import transfer_service_pb2 as yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2
from yandex.cloud.operation import operation_pb2 as yandex_dot_cloud_dot_operation_dot_operation__pb2
class TransferServiceStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.Create = channel.unary_unary(
'/yandex.cloud.datatransfer.v1.TransferService/Create',
request_serializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.CreateTransferRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
self.Update = channel.unary_unary(
'/yandex.cloud.datatransfer.v1.TransferService/Update',
request_serializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.UpdateTransferRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
self.Delete = channel.unary_unary(
'/yandex.cloud.datatransfer.v1.TransferService/Delete',
request_serializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.DeleteTransferRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
self.List = channel.unary_unary(
'/yandex.cloud.datatransfer.v1.TransferService/List',
request_serializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.ListTransfersRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.ListTransfersResponse.FromString,
)
self.Get = channel.unary_unary(
'/yandex.cloud.datatransfer.v1.TransferService/Get',
request_serializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.GetTransferRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__pb2.Transfer.FromString,
)
self.Deactivate = channel.unary_unary(
'/yandex.cloud.datatransfer.v1.TransferService/Deactivate',
request_serializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.DeactivateTransferRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
self.Activate = channel.unary_unary(
'/yandex.cloud.datatransfer.v1.TransferService/Activate',
request_serializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.ActivateTransferRequest.SerializeToString,
response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
)
class TransferServiceServicer(object):
"""Missing associated documentation comment in .proto file."""
def Create(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Update(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Delete(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def List(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Get(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Deactivate(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Activate(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_TransferServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'Create': grpc.unary_unary_rpc_method_handler(
servicer.Create,
request_deserializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.CreateTransferRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
'Update': grpc.unary_unary_rpc_method_handler(
servicer.Update,
request_deserializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.UpdateTransferRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
'Delete': grpc.unary_unary_rpc_method_handler(
servicer.Delete,
request_deserializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.DeleteTransferRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
'List': grpc.unary_unary_rpc_method_handler(
servicer.List,
request_deserializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.ListTransfersRequest.FromString,
response_serializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.ListTransfersResponse.SerializeToString,
),
'Get': grpc.unary_unary_rpc_method_handler(
servicer.Get,
request_deserializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.GetTransferRequest.FromString,
response_serializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__pb2.Transfer.SerializeToString,
),
'Deactivate': grpc.unary_unary_rpc_method_handler(
servicer.Deactivate,
request_deserializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.DeactivateTransferRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
'Activate': grpc.unary_unary_rpc_method_handler(
servicer.Activate,
request_deserializer=yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.ActivateTransferRequest.FromString,
response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'yandex.cloud.datatransfer.v1.TransferService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class TransferService(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def Create(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/yandex.cloud.datatransfer.v1.TransferService/Create',
yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.CreateTransferRequest.SerializeToString,
yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def Update(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/yandex.cloud.datatransfer.v1.TransferService/Update',
yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.UpdateTransferRequest.SerializeToString,
yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def Delete(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/yandex.cloud.datatransfer.v1.TransferService/Delete',
yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.DeleteTransferRequest.SerializeToString,
yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def List(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/yandex.cloud.datatransfer.v1.TransferService/List',
yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.ListTransfersRequest.SerializeToString,
yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.ListTransfersResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def Get(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/yandex.cloud.datatransfer.v1.TransferService/Get',
yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.GetTransferRequest.SerializeToString,
yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__pb2.Transfer.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def Deactivate(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/yandex.cloud.datatransfer.v1.TransferService/Deactivate',
yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.DeactivateTransferRequest.SerializeToString,
yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def Activate(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/yandex.cloud.datatransfer.v1.TransferService/Activate',
yandex_dot_cloud_dot_datatransfer_dot_v1_dot_transfer__service__pb2.ActivateTransferRequest.SerializeToString,
yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
| 52.52809 | 148 | 0.708806 | 1,398 | 14,025 | 6.659514 | 0.079399 | 0.043502 | 0.067669 | 0.08217 | 0.917186 | 0.912889 | 0.903115 | 0.865306 | 0.812245 | 0.8 | 0 | 0.00865 | 0.225169 | 14,025 | 266 | 149 | 52.725564 | 0.848072 | 0.057041 | 0 | 0.566964 | 1 | 0 | 0.086695 | 0.058913 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.017857 | 0.03125 | 0.133929 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
d8007d40268d27edc5441ed0077ba0d6b34c2a7d | 1,777 | py | Python | cmake-build-debug/mean-latency.py | bombework/FrequentSnapshot | cd1266a2c7dbc44b0ab38637d1704b54175da895 | [
"Apache-2.0"
] | 1 | 2019-11-28T05:25:57.000Z | 2019-11-28T05:25:57.000Z | cmake-build-debug/mean-latency.py | bombe-org/FrequentSnapshot | cd1266a2c7dbc44b0ab38637d1704b54175da895 | [
"Apache-2.0"
] | null | null | null | cmake-build-debug/mean-latency.py | bombe-org/FrequentSnapshot | cd1266a2c7dbc44b0ab38637d1704b54175da895 | [
"Apache-2.0"
] | 1 | 2019-03-12T04:37:16.000Z | 2019-03-12T04:37:16.000Z | #!/usr/bin/env python
import numpy as np
latencydir = "./log/latency/"
preparedir = "./log/overhead/"
for i in [0, 1, 2, 3, 4, 5, 6]:
for uf in [16, 32, 64, 128, 256]:
latency_path = latencydir + str(i) + "_latency_" + str(uf) + "k_250000_4096_0.log"
prepare_path = preparedir + str(i) + "_overhead_" + str(uf) + "k_250000_4096.log"
latency_file = open(latency_path)
prepare_file = open(prepare_path)
latencys = []
prepares = []
for eachline in latency_file.readlines():
timestart, time = eachline.split("\t")
latencys.append(float(time))
for el in prepare_file.readlines():
el.replace(' ', '')
prepare, overhead, total = el.split("\t")
prepares.append(float(prepare))
mean = (np.sum(latencys) - np.sum(prepares)) / (len(latencys) - len(prepares))
str2 = "%d" % (mean)
print(str2)
for size in [500000, 1000000, 2000000]:
latency_path = latencydir + str(i) + "_latency_256k_" + str(size) + "_4096_0.log"
prepare_path = preparedir + str(i) + "_overhead_256k_" + str(size) + "_4096.log"
latency_file = open(latency_path)
prepare_file = open(prepare_path)
latencys = []
prepares = []
for eachline in latency_file.readlines():
timestart, time = eachline.split("\t")
latencys.append(float(time))
for el in prepare_file.readlines():
el.replace(' ', '')
prepare, overhead, total = el.split("\t")
prepares.append(float(prepare))
mean = (np.sum(latencys) - np.sum(prepares)) / (len(latencys) - len(prepares))
str2 = "%d" % (mean)
print(str2)
| 43.341463 | 91 | 0.55937 | 208 | 1,777 | 4.615385 | 0.293269 | 0.045833 | 0.04375 | 0.05 | 0.839583 | 0.814583 | 0.747917 | 0.747917 | 0.747917 | 0.6625 | 0 | 0.062998 | 0.294316 | 1,777 | 40 | 92 | 44.425 | 0.702552 | 0.011255 | 0 | 0.736842 | 0 | 0 | 0.085664 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.026316 | 0 | 0.026316 | 0.052632 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
dc287ad82d585461fdf294bcd1723209b0abc2a8 | 41 | py | Python | templates/python.flask/{{cookiecutter.project_safe_name}}/app/main/views/__init__.py | by46/recipe | 203abd2141a536b66b4e57d073169a49395be1f0 | [
"MIT"
] | null | null | null | templates/python.flask/{{cookiecutter.project_safe_name}}/app/main/views/__init__.py | by46/recipe | 203abd2141a536b66b4e57d073169a49395be1f0 | [
"MIT"
] | null | null | null | templates/python.flask/{{cookiecutter.project_safe_name}}/app/main/views/__init__.py | by46/recipe | 203abd2141a536b66b4e57d073169a49395be1f0 | [
"MIT"
] | null | null | null | from . import misc
from . import index
| 13.666667 | 20 | 0.707317 | 6 | 41 | 4.833333 | 0.666667 | 0.689655 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.243902 | 41 | 2 | 21 | 20.5 | 0.935484 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
dc51b3de5974e397d0c7a62f3fcfb57222e45a16 | 731 | py | Python | behavior3/view.py | behavior3/behavior3.com | 800266b5e7f0b0ae1e4abdbec8d2c6f72cd00ae5 | [
"MIT"
] | 8 | 2015-06-30T20:22:09.000Z | 2021-11-08T12:51:27.000Z | behavior3/view.py | behavior3/behavior3.com | 800266b5e7f0b0ae1e4abdbec8d2c6f72cd00ae5 | [
"MIT"
] | 3 | 2016-02-09T21:03:19.000Z | 2020-05-31T20:38:08.000Z | behavior3/view.py | behavior3/behavior3.com | 800266b5e7f0b0ae1e4abdbec8d2c6f72cd00ae5 | [
"MIT"
] | 6 | 2017-08-10T01:20:58.000Z | 2021-01-17T08:05:35.000Z | import os
import json
import collections
from flask import abort
from flask import render_template
from flask import url_for
from flask import request
from flask import Response
from behavior3 import app
@app.route("/")
def home():
return render_template('m_home.jinja')
@app.route("/editor")
def editor():
return render_template('m_editor.jinja')
@app.route("/libraries")
def libraries():
return render_template('m_libraries.jinja')
@app.route("/documentation")
def documentation():
return render_template('m_documentation.jinja')
@app.route("/community")
def community():
return render_template('m_community.jinja')
@app.route("/donation")
def donation():
return render_template('m_donation.jinja')
| 21.5 | 51 | 0.753762 | 97 | 731 | 5.536082 | 0.268041 | 0.182495 | 0.223464 | 0.234637 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00156 | 0.123119 | 731 | 33 | 52 | 22.151515 | 0.836193 | 0 | 0 | 0 | 0 | 0 | 0.202462 | 0.028728 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | true | 0 | 0.333333 | 0.222222 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 7 |
5218d9b0ea47c5146d91c701bbef899068a3346f | 21,950 | py | Python | ref_code/trainer3.py | PandoraLS/Seq2Seq | 96851fd7d0fe2a7cbcaafb3b2d41d58541ad652b | [
"MIT"
] | null | null | null | ref_code/trainer3.py | PandoraLS/Seq2Seq | 96851fd7d0fe2a7cbcaafb3b2d41d58541ad652b | [
"MIT"
] | null | null | null | ref_code/trainer3.py | PandoraLS/Seq2Seq | 96851fd7d0fe2a7cbcaafb3b2d41d58541ad652b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Author:sen
# Date:2020/3/22 10:47
import torch
import numpy as np
from trainer.base_trainer import PLCBaseTrainer
import logging
from data_utils.big_dataset import batch_loader, plc_line_process
src_norm_max = np.array([288] * 12, dtype=np.float32)
src_norm_min = np.array([32] * 12, dtype=np.float32)
tar_norm_max = np.array([288] * 4, dtype=np.float32)
tar_norm_min = np.array([32] * 4, dtype=np.float32)
class PLCGeneralTrainer(PLCBaseTrainer):
def __init__(self,
config: dict,
resume: bool,
model,
optim,
loss_fucntion,
train_dl,
validation_dl,
visual):
super().__init__(config, resume, model, optim, loss_fucntion, visual)
self.train_dataloader = train_dl
self.validation_dataloader = validation_dl
self.visual = visual
def _visualize_weights_and_grads(self, model, epoch):
if self.visual:
for name, param in model.named_parameters():
self.writer.add_histogram("WEIGHT_" + name, param.clone().cpu().data.numpy(), epoch)
self.writer.add_histogram("GRAD_" + name, param.grad.cpu().numpy(), epoch)
def _train_epoch(self, epoch):
for i, (srcdata, groundtruth) in enumerate(self.train_dataloader, start=1):
# For visualization
batch_size = self.train_dataloader.batch_size
n_batch = len(self.train_dataloader)
n_iter = n_batch * batch_size * (epoch - 1) + i * batch_size
srcdata = srcdata.to(self.device) # [batch_size, 1, sample_length] eg.[600,1,20]
groundtruth = groundtruth.to(self.device) # [600,1,20]
predicted = self.model(srcdata) # [600, 1, 20]
loss_mean = []
"""================ Optimize model ================"""
self.optimizer.zero_grad()
loss = self.loss_function(predicted, groundtruth)
loss.backward()
self.optimizer.step()
loss_mean.append(loss.data.cpu().numpy())
# print("loss", loss)
with torch.no_grad():
predicted = self.model(srcdata)
if self.visual:
self.writer.add_scalars(f"模型/损失值_n_iter", {
"模型优化前": loss,
"模型优化后": self.loss_function(predicted, groundtruth)
}, n_iter)
logging.info("epoch / mean loss: {} / {:.4f}".format(epoch, np.mean(loss_mean)))
def _validation_epoch(self, epoch):
sample_length = self.validation_custom_config["sample_length"]
mean_err_score = [] # predicted与groundtruth之间的差异
for i, (srcdata, groundtruth) in enumerate(self.validation_dataloader, start=1):
srcdata = srcdata.to(self.device)
# 预测系数的这些数据没有必要归一化,归一化之后就预测不准了
# norm_max = torch.max(srcdata).item()
# norm_min = torch.min(srcdata).item()
# srcdata = 2 * (srcdata - norm_min) / (norm_max - norm_min) - 1 # 将音频数据归一化到[-1.0,1.0]
assert srcdata.dim() == 3
predicted = self.model(srcdata)
srcdata_value = srcdata.detach().cpu().numpy().reshape(-1)[:]
groundtruth_value = groundtruth.detach().cpu().numpy().reshape(-1)[:]
predicted_value = predicted.detach().cpu().numpy().reshape(-1)[:]
# print(predicted_value, end="*******");print(groundtruth_value)
single_data_err_score = [abs(groundtruth_value[i] - predicted_value[i]) for i in range(len(groundtruth_value))]
mean_err_score.append(np.mean(single_data_err_score))
# 返回平均指标
return np.mean(mean_err_score)
class PLCNormGeneralTrainer(PLCBaseTrainer):
def __init__(self,
config: dict,
resume: bool,
model,
optim,
loss_fucntion,
train_dl,
validation_dl,
visual):
super().__init__(config, resume, model, optim, loss_fucntion, visual)
self.train_dataloader = train_dl
self.validation_dataloader = validation_dl
self.visual = visual
def _visualize_weights_and_grads(self, model, epoch):
if self.visual:
for name, param in model.named_parameters():
self.writer.add_histogram("WEIGHT_" + name, param.clone().cpu().data.numpy(), epoch)
self.writer.add_histogram("GRAD_" + name, param.grad.cpu().numpy(), epoch)
def _train_epoch(self, epoch):
for i, (srcdata, groundtruth) in enumerate(self.train_dataloader, start=1):
# For visualization
batch_size = self.train_dataloader.batch_size
n_batch = len(self.train_dataloader)
n_iter = n_batch * batch_size * (epoch - 1) + i * batch_size
srcdata = srcdata.to(self.device) # [batch_size, 1, sample_length] eg.[600,1,20]
groundtruth = groundtruth.to(self.device) # [600,1,20]
predicted = self.model(srcdata) # [600, 1, 20]
loss_mean = []
"""================ Optimize model ================"""
self.optimizer.zero_grad()
loss = self.loss_function(predicted, groundtruth)
loss.backward()
self.optimizer.step()
loss_mean.append(loss.data.cpu().numpy())
print("loss", loss)
with torch.no_grad():
predicted = self.model(srcdata)
if self.visual:
self.writer.add_scalars(f"模型/损失值_n_iter", {
"模型优化前": loss,
"模型优化后": self.loss_function(predicted, groundtruth)
}, n_iter)
logging.info("epoch / mean loss: {} / {:.4f}".format(epoch, np.mean(loss_mean)))
def _validation_epoch(self, epoch):
sample_length = self.validation_custom_config["sample_length"]
mean_err_score = [] # predicted与groundtruth之间的差异
for i, (srcdata, groundtruth) in enumerate(self.validation_dataloader, start=1):
srcdata = srcdata.to(self.device)
# 预测系数的归一化
src_norm_max_tensor, src_norm_min_tensor = torch.Tensor(src_norm_max).to(self.device), torch.Tensor(src_norm_min).to(self.device)
srcdata = (srcdata - src_norm_min_tensor) / (src_norm_max_tensor - src_norm_min_tensor) # 将数据归一化到[0.0, 1.0]
assert srcdata.dim() == 3
predicted = self.model(srcdata)
tar_norm_max_tensor, tar_norm_min_tensor = torch.Tensor(tar_norm_max).to(self.device), torch.Tensor(tar_norm_min).to(self.device)
predicted = predicted * (tar_norm_max_tensor - tar_norm_min_tensor) + tar_norm_min_tensor
srcdata_value = srcdata.detach().cpu().numpy().reshape(-1)[:]
groundtruth_value = groundtruth.detach().cpu().numpy().reshape(-1)[:]
predicted_value = predicted.detach().cpu().numpy().reshape(-1)[:]
# print(predicted_value, end="*******");print(groundtruth_value)
single_data_err_score = [abs(groundtruth_value[i] - predicted_value[i]) for i in range(len(groundtruth_value))]
mean_err_score.append(np.mean(single_data_err_score))
# 返回平均指标
return np.mean(mean_err_score)
class PLCGeneralTrainerRNN2(PLCBaseTrainer):
def __init__(self,
config: dict,
resume: bool,
model,
optim,
loss_fucntion,
train_dl,
validation_dl,
visual):
super().__init__(config, resume, model, optim, loss_fucntion, visual)
self.train_dataloader = train_dl
self.validation_dataloader = validation_dl
self.visual = visual
def _visualize_weights_and_grads(self, model, epoch):
if self.visual:
for name, param in model.named_parameters():
self.writer.add_histogram("WEIGHT_" + name, param.clone().cpu().data.numpy(), epoch)
self.writer.add_histogram("GRAD_" + name, param.grad.cpu().numpy(), epoch)
def _train_epoch(self, epoch):
for i, (srcdata, groundtruth) in enumerate(self.train_dataloader, start=1):
# For visualization
batch_size = self.train_dataloader.batch_size
n_batch = len(self.train_dataloader)
n_iter = n_batch * batch_size * (epoch - 1) + i * batch_size
srcdata = torch.tensor(srcdata, dtype=torch.float32)
srcdata = srcdata.to(self.device) # [batch_size, 1, sample_length] eg.[600,1,20]
groundtruth = groundtruth.to(self.device) # [batchsize,1,4]
groundtruth = groundtruth.view(batch_size, groundtruth.size(2)) # tensor.size([batchsize, 4])
groundtruth_trend = torch.zeros(batch_size, 3)
for i in range(batch_size):
for j in range(1,4):
groundtruth_trend[i][j-1] = groundtruth[i][j] - groundtruth[i][j-1]
predicted = self.model(srcdata) # [batchsize, 4]
predicted_trend = torch.zeros(batch_size, 3)
for i in range(batch_size):
for j in range(1, 4):
predicted_trend[i][j-1] = predicted[i][j] - predicted[i][j-1]
# TODO 目前rnn训练到最后阶段的时候会因为batchsize的原因报错,目前这个bug暂时没有修理
print(predicted.shape)
# predicted_trend =
predicted_int = predicted.detach().cpu().numpy().astype(int)
#
# predicted_recover = (predicted.detach().cpu().numpy() * 257. + 32.).astype(int)
# groundtruth_recover = (groundtruth.detach().cpu().numpy() * 257. + 32.)
loss_mean = []
# print(srcdata.shape)
# print(groundtruth.shape)
# print(predicted.shape)
"""================ Optimize model ================"""
self.optimizer.zero_grad()
loss_pre = self.loss_function(predicted, groundtruth)
loss_trend = self.loss_function(predicted_trend, groundtruth_trend)
loss = loss_pre + loss_trend
loss.backward()
self.optimizer.step()
loss_mean.append(loss.data.cpu().numpy())
# print(loss)
print(loss,'------', loss_pre, '--------', loss_trend, '-------')
print(predicted_int)
print( groundtruth)
# srcdata_value = srcdata.detach().cpu().numpy().reshape(-1)[:]
# print("loss", loss.detach().cpu().numpy(), end=" ")
# print("predict:", predicted.detach().cpu().numpy().reshape(-1)[:], end=" ")
# print("groundtruth:", groundtruth.detach().cpu().numpy().reshape(-1)[:])
with torch.no_grad():
predicted = self.model(srcdata)
if self.visual:
self.writer.add_scalars(f"模型/损失值_n_iter", {
"模型优化前": loss,
"模型优化后": self.loss_function(predicted, groundtruth)
}, n_iter)
logging.info("epoch / mean loss: {} / {:.4f}".format(epoch, np.mean(loss_mean)))
def _validation_epoch(self, epoch):
sample_length = self.validation_custom_config["sample_length"]
mean_err_score = [] # predicted与groundtruth之间的差异
for i, (srcdata, groundtruth) in enumerate(self.validation_dataloader, start=1):
srcdata = srcdata.to(self.device)
# 预测系数的归一化
src_norm_max_tensor, src_norm_min_tensor = torch.Tensor(src_norm_max).to(self.device), torch.Tensor(src_norm_min).to(self.device)
srcdata = (srcdata - src_norm_min_tensor) / (src_norm_max_tensor - src_norm_min_tensor) # 将数据归一化到[0.0, 1.0]
assert srcdata.dim() == 3
predicted = self.model(srcdata)
tar_norm_max_tensor, tar_norm_min_tensor = torch.Tensor(tar_norm_max).to(self.device), torch.Tensor(tar_norm_min).to(self.device)
predicted = predicted * (tar_norm_max_tensor - tar_norm_min_tensor) + tar_norm_min_tensor
srcdata_value = srcdata.detach().cpu().numpy().reshape(-1)[:]
groundtruth_value = groundtruth.detach().cpu().numpy().reshape(-1)[:]
predicted_value = predicted.detach().cpu().numpy().reshape(-1)[:]
# print(predicted_value, end="*******");print(groundtruth_value)
single_data_err_score = [abs(groundtruth_value[i] - predicted_value[i]) for i in range(len(groundtruth_value))]
mean_err_score.append(np.mean(single_data_err_score))
# 返回平均指标
return np.mean(mean_err_score)
class PLCBigGeneralTrainer(PLCBaseTrainer):
def __init__(self,
config: dict,
resume: bool,
model,
optim,
loss_fucntion,
train_dl,
validation_dl,
visual):
super().__init__(config, resume, model, optim, loss_fucntion, visual)
self.train_dataloader = train_dl
self.validation_dataloader = validation_dl
self.visual = visual
def _visualize_weights_and_grads(self, model, epoch):
if self.visual:
for name, param in model.named_parameters():
self.writer.add_histogram("WEIGHT_" + name, param.clone().cpu().data.numpy(), epoch)
self.writer.add_histogram("GRAD_" + name, param.grad.cpu().numpy(), epoch)
def _train_epoch(self, epoch):
for src_data, groundtruth in batch_loader(self.train_dataloader, line_process_func=plc_line_process, batch_size=5000,verbose_total_cnt=False):
src_data = torch.FloatTensor(src_data).to(self.device) # torch.size[batchsize, sample_length] eg.[400, 16]
groundtruth = torch.FloatTensor(groundtruth).to(self.device) # torch.size[batchsize, 16]
src_data = src_data.view(src_data.size(0), 1, src_data.size(1)) # torch.size[batchsize, 1, sample_length]
groundtruth = groundtruth.view(groundtruth.size(0), 1, groundtruth.size(1)) # torch.size [batchsize, 1, sample_length]
predicted = self.model(src_data) # torch.size[batchsize, 16]
loss_mean = []
# print(predicted.shape)
"""================ Optimize model ================"""
self.optimizer.zero_grad()
loss = self.loss_function(predicted, groundtruth)
loss.backward()
self.optimizer.step()
loss_mean.append(loss.data.cpu().numpy())
logging.info("epoch / mean loss: {} / {:.4f}".format(epoch, np.mean(loss_mean)))
def _validation_epoch(self, epoch):
sample_length = self.validation_custom_config["sample_length"]
mean_err_score = [] # predicted与groundtruth之间的差异
for i, (srcdata, groundtruth) in enumerate(self.validation_dataloader, start=1):
srcdata = srcdata.to(self.device)
# 预测系数的这些数据没有必要归一化,归一化之后就预测不准了
# norm_max = torch.max(srcdata).item()
# norm_min = torch.min(srcdata).item()
# srcdata = 2 * (srcdata - norm_min) / (norm_max - norm_min) - 1 # 将音频数据归一化到[-1.0,1.0]
assert srcdata.dim() == 3
predicted = self.model(srcdata)
srcdata_value = srcdata.detach().cpu().numpy().reshape(-1)[:]
groundtruth_value = groundtruth.detach().cpu().numpy().reshape(-1)[:]
predicted_value = predicted.detach().cpu().numpy().reshape(-1)[:]
single_data_err_score = [abs(groundtruth_value[i] - predicted_value[i]) for i in range(len(groundtruth_value))]
mean_err_score.append(np.mean(single_data_err_score))
# 返回平均指标
return np.mean(mean_err_score)
# def _validation_epoch(self, epoch):
# sample_length = self.validation_custom_config["sample_length"]
# mean_err_score = [] # predicted与groundtruth之间的差异
#
# batch_err_score = []
# with torch.no_grad():
# self.model.eval()
# for src_data, groundtruth in batch_loader(self.train_dataloader, line_process_func=plc_line_process, batch_size=10,verbose_total_cnt=False):
# src_data = torch.FloatTensor(src_data).to(self.device)
# groundtruth = torch.FloatTensor(groundtruth).to(self.device)
# src_data = src_data.view(src_data.size(0), 1,src_data.size(1)) # torch.size[batchsize, 1, sample_length]
# groundtruth = groundtruth.view(groundtruth.size(0), 1,groundtruth.size(1)) # torch.size [batchsize, 1, sample_length]
# predicted = self.model(src_data) # [batchsize, sample_length]
# c = torch.sum(torch.abs(predicted - groundtruth)).cpu().item()
# batch_err_score.append(c / (groundtruth.shape[0] * groundtruth.shape[1]))
# return sum(batch_err_score) / len(batch_err_score)
class PLCBigGeneralTrainerCNN(PLCBaseTrainer):
def __init__(self,
config: dict,
resume: bool,
model,
optim,
loss_fucntion,
train_dl,
validation_dl,
visual):
super().__init__(config, resume, model, optim, loss_fucntion, visual)
self.train_dataloader = train_dl
self.validation_dataloader = validation_dl
self.visual = visual
def _visualize_weights_and_grads(self, model, epoch):
if self.visual:
for name, param in model.named_parameters():
self.writer.add_histogram("WEIGHT_" + name, param.clone().cpu().data.numpy(), epoch)
self.writer.add_histogram("GRAD_" + name, param.grad.cpu().numpy(), epoch)
def _train_epoch(self, epoch):
for src_data, groundtruth in batch_loader(self.train_dataloader, line_process_func=plc_line_process, batch_size=8000,verbose_total_cnt=False):
src_data = torch.FloatTensor(src_data).to(self.device) # torch.size[batchsize, sample_length] eg.[400, 266]
groundtruth = torch.FloatTensor(groundtruth).to(self.device) # torch.size[batchsize, 266]
src_data = src_data.view(src_data.size(0), 1, src_data.size(1)) # torch.size[batchsize, 1, 266]
groundtruth = groundtruth.view(groundtruth.size(0), 1, groundtruth.size(1)) # torch.size [batchsize, 1, sample_length]
# print(src_data)
# 将数据变成2d的,然后通过cnn增强后变回原来的样子
segments = int(src_data.shape[2] / 38) # 将7帧1维的magnitude重新整理为7帧(每帧为38个数据点) segments = 7
batch = src_data.shape[0] # batch_size
src_data2d = torch.zeros(batch, 1, segments, 38) # torch.size([batch_size, 1, 7, 38])
for i in range(segments):
src_data2d[:,:, i,:] = src_data[:,:,i * 38: i *38 + 38]
src_data2d_1col = src_data2d[:,:,:,0].view(src_data2d.size(0), src_data2d.size(1), src_data2d.size(2), 1).to(self.device) # 重组数据的第一个点为能量,不能算作magnitude的一部分 [batch_size, 1, 7, 1]
src_data2d_mag = src_data2d[:,:,:,1:].to(self.device) # magnitude部分 [batch_size, 1, 7, 37]
predicted = self.model(src_data2d_mag) # torch.size[batch_size, 1, 7, 37]
predicted_recover = torch.cat((src_data2d_1col,predicted), dim=3) # torch.size[batch_size, 1, 7, 38]
predicted_recover_38 = torch.flatten(predicted_recover, start_dim=2) # torch.size[batch_size, 1, 266]
loss_mean = []
# print(predicted.shape)
"""================ Optimize model ================"""
self.optimizer.zero_grad()
loss = self.loss_function(predicted_recover_38, groundtruth)
loss.backward()
self.optimizer.step()
loss_mean.append(loss.data.cpu().numpy())
logging.info("epoch / mean loss: {} / {:.4f}".format(epoch, np.mean(loss_mean)))
def _validation_epoch(self, epoch):
sample_length = self.validation_custom_config["sample_length"]
mean_err_score = [] # predicted与groundtruth之间的差异
for i, (src_data, groundtruth) in enumerate(self.validation_dataloader, start=1):
# srcdata.shape = torch.Size([1, 1, 266]), groundtruth = torch.Size([1,1,266])
src_data, groundtruth = src_data.to(self.device), groundtruth.to(self.device)
assert src_data.dim() == 3
# 使用模型预测,模型只能处理二维部分
segments = int(src_data.shape[2] / 38) # 将7帧1维的magnitude重新整理为7帧(每帧为38个数据点) segments = 7
batch = src_data.shape[0] # batch_size
src_data2d = torch.zeros(batch, 1, segments, 38) # torch.size([batch_size, 1, 7, 38])
for i in range(segments):
src_data2d[:, :, i, :] = src_data[:, :, i * 38: i * 38 + 38]
src_data2d_1col = src_data2d[:, :, :, 0].view(src_data2d.size(0), src_data2d.size(1), src_data2d.size(2),1).to(self.device) # 重组数据的第一个点为能量,不能算作magnitude的一部分 [batch_size, 1, 7, 1]
src_data2d_mag = src_data2d[:, :, :, 1:].to(self.device) # magnitude部分 [batch_size, 1, 7, 37]
predicted = self.model(src_data2d_mag) # torch.size[batch_size, 1, 7, 37]
predicted_recover = torch.cat((src_data2d_1col, predicted), dim=3) # torch.size[batch_size, 1, 7, 38]
predicted_recover_38 = torch.flatten(predicted_recover, start_dim=2) # torch.size[batch_size, 1, 266]
# srcdata_value = src_data.detach().cpu().numpy().reshape(-1)[:]
groundtruth_value = groundtruth.detach().cpu().numpy().reshape(-1)[:]
predicted_value = predicted_recover_38.detach().cpu().numpy().reshape(-1)[:]
single_data_err_score = [abs(groundtruth_value[i] - predicted_value[i]) for i in range(len(groundtruth_value))]
mean_err_score.append(np.mean(single_data_err_score))
# 返回平均指标
return np.mean(mean_err_score)
| 49.886364 | 191 | 0.599772 | 2,556 | 21,950 | 4.910407 | 0.0759 | 0.026532 | 0.028683 | 0.030117 | 0.891403 | 0.87499 | 0.863915 | 0.859931 | 0.856665 | 0.851964 | 0 | 0.023001 | 0.267153 | 21,950 | 439 | 192 | 50 | 0.757242 | 0.178679 | 0 | 0.879085 | 0 | 0 | 0.020909 | 0 | 0 | 0 | 0 | 0.002278 | 0.01634 | 1 | 0.065359 | false | 0 | 0.01634 | 0 | 0.114379 | 0.01634 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
522af032e5efc9d441269a7636f3793adfdd6c49 | 2,012 | py | Python | src/utils/loggers.py | vpeopleonatank/segmentation | 6c93e14f465117ca1818e7d9cdd95ffc37e15f45 | [
"MIT"
] | null | null | null | src/utils/loggers.py | vpeopleonatank/segmentation | 6c93e14f465117ca1818e7d9cdd95ffc37e15f45 | [
"MIT"
] | null | null | null | src/utils/loggers.py | vpeopleonatank/segmentation | 6c93e14f465117ca1818e7d9cdd95ffc37e15f45 | [
"MIT"
] | null | null | null | import argparse
import csv
from typing import Dict, Optional, Union, Any
from pytorch_lightning.loggers import LightningLoggerBase
class CsvLogger(LightningLoggerBase):
# TODO Check if works
@property
def experiment(self) -> Any:
pass
def log_hyperparams(self, params: argparse.Namespace) -> Any:
pass
@property
def version(self) -> Union[int, str]:
pass
def __init__(self, csv_path: str = 'csv_log.csv'):
# TODO: add folder to filename
super().__init__()
self.csv_path = csv_path
def log_metrics(self, metrics: Dict[str, float], step: Optional[int] = None) -> Any:
if step == 0:
header = ['step'] + list(metrics.keys())
with open(self.csv_path, 'w') as f:
writer = csv.writer(f)
writer.writerow(header)
if step:
fields = [float(step)] + list(metrics.values())
else:
fields = list(metrics.values())
with open(self.csv_path, 'a') as f:
writer = csv.writer(f)
writer.writerow(fields)
@property
def name(self):
return 'CsvLogger'
class PrintLogger(LightningLoggerBase):
# TODO Check if works
@property
def experiment(self) -> Any:
pass
def log_hyperparams(self, params: argparse.Namespace) -> Any:
pass
@property
def version(self) -> Union[int, str]:
pass
def __init__(self, csv_path: str = 'csv_log.csv'):
# TODO: add folder to filename
super().__init__()
self.csv_path = csv_path
def log_metrics(self, metrics: Dict[str, float], step: Optional[int] = None) -> Any:
if step == 0:
header = ['step'] + list(metrics.keys())
print(header)
if step:
fields = [float(step)] + list(metrics.values())
else:
fields = list(metrics.values())
print(fields)
@property
def name(self):
return 'PrintLogger'
| 26.473684 | 88 | 0.577535 | 233 | 2,012 | 4.854077 | 0.261803 | 0.049514 | 0.058355 | 0.05305 | 0.847038 | 0.813439 | 0.758621 | 0.758621 | 0.700265 | 0.700265 | 0 | 0.001433 | 0.306163 | 2,012 | 75 | 89 | 26.826667 | 0.808739 | 0.048211 | 0 | 0.75 | 0 | 0 | 0.027225 | 0 | 0 | 0 | 0 | 0.013333 | 0 | 1 | 0.214286 | false | 0.107143 | 0.071429 | 0.035714 | 0.357143 | 0.035714 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 10 |
522e5918a5486f0763ea5ca29e0c8cdc02fcdc80 | 518 | py | Python | python/anyascii/_data/_01e.py | casept/anyascii | d4f426b91751254b68eaa84c6cd23099edd668e6 | [
"ISC"
] | null | null | null | python/anyascii/_data/_01e.py | casept/anyascii | d4f426b91751254b68eaa84c6cd23099edd668e6 | [
"ISC"
] | null | null | null | python/anyascii/_data/_01e.py | casept/anyascii | d4f426b91751254b68eaa84c6cd23099edd668e6 | [
"ISC"
] | null | null | null | b='A a B b B b B b C c D d D d D d D d D d E e E e E e E e E e F f G g H h H h H h H h H h I i I i K k K k K k L l L l L l L l M m M m M m N n N n N n N n O o O o O o O o P p P p R r R r R r R r S s S s S s S s S s T t T t T t T t U u U u U u U u U u V v V v W w W w W w W w W w X x X x Y y Z z Z z Z z h t w y a s s s Ss d A a A a A a A a A a A a A a A a A a A a A a A a E e E e E e E e E e E e E e E e I i I i O o O o O o O o O o O o O o O o O o O o O o O o U u U u U u U u U u U u U u Y y Y y Y y Y y Ll ll V v Y y' | 518 | 518 | 0.501931 | 257 | 518 | 1.011673 | 0.101167 | 0.230769 | 0.323077 | 0.4 | 0.807692 | 0.715385 | 0.715385 | 0.561538 | 0.530769 | 0.376923 | 0 | 0 | 0.492278 | 518 | 1 | 518 | 518 | 0.988593 | 0 | 0 | 0 | 0 | 1 | 0.990366 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 |
528f6e2fbb4821847068a1bcea9811d88aa7dc72 | 191 | py | Python | src/helpers/ltaproxy.py | micro-infrastructure/adaptor-lofar-stage | b80411ccfae15ecc8d539c1d1b0c48fd787d9394 | [
"MIT"
] | 1 | 2020-01-17T09:20:01.000Z | 2020-01-17T09:20:01.000Z | ContainerAdaptors/lofar-stage/src/helpers/ltaproxy.py | recap/MicroInfrastructure | 4e8baf6d2a29344b10d6d3d57d01fc24fef16342 | [
"MIT"
] | null | null | null | ContainerAdaptors/lofar-stage/src/helpers/ltaproxy.py | recap/MicroInfrastructure | 4e8baf6d2a29344b10d6d3d57d01fc24fef16342 | [
"MIT"
] | null | null | null | from xmlrpc import client as xmlrpclib
def get_ltaproxy(username, password):
return xmlrpclib.ServerProxy("https://"+username+':'+password+"@webportal.astron.nl/service-public/xmlrpc")
| 38.2 | 112 | 0.769634 | 23 | 191 | 6.347826 | 0.826087 | 0.219178 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.089005 | 191 | 4 | 113 | 47.75 | 0.83908 | 0 | 0 | 0 | 0 | 0 | 0.267016 | 0.219895 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0.666667 | 0.333333 | 0.333333 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 8 |
bfed6b0be357def3cc2a9f8550bfa68c9c6edcd1 | 37,212 | py | Python | simprod-scripts/python/modules/datatransfer.py | hschwane/offline_production | e14a6493782f613b8bbe64217559765d5213dc1e | [
"MIT"
] | 1 | 2020-12-24T22:00:01.000Z | 2020-12-24T22:00:01.000Z | simprod-scripts/python/modules/datatransfer.py | hschwane/offline_production | e14a6493782f613b8bbe64217559765d5213dc1e | [
"MIT"
] | null | null | null | simprod-scripts/python/modules/datatransfer.py | hschwane/offline_production | e14a6493782f613b8bbe64217559765d5213dc1e | [
"MIT"
] | 3 | 2020-07-17T09:20:29.000Z | 2021-03-30T16:44:18.000Z | #!/usr/bin/env python
################################ Tray 0 ##############################
#
# Code automatically generated by iceprod translator
# on 2009-07-21T16:33:23
#
######################################################################
import os,sys
from os.path import expandvars
from I3Tray import *
from .. import ipmodule
# Instantiate parameters expression parser
def boolcast(s): return s not in ["False","0","","[]"]
double = float
def upload_log(tray,logfile,destination,emul,suffix,parser):
if os.path.exists(logfile):
mod0 = "compress_"+os.path.basename(logfile)+suffix
mod1 = "upload_"+os.path.basename(logfile)+suffix
tray.AddModule("fileutils.CompressFile",mod0)(
('infile',logfile),
('outfile',logfile+".gz")
)
tray.AddModule("gsiftp.URLCopy",mod1)(
('source',"file:"+logfile+".gz"),
("destination",destination),
("emulate",emul)
)
tray.SetParser(mod0,parser)
tray.SetParser(mod1,parser)
class GridFTP(ipmodule.IPBaseClass):
"""
Wrapper class that copy files to storage units with GridFTP
"""
def __init__(self):
ipmodule.IPBaseClass.__init__(self)
self.AddParameter('gcdfile','GeoCalibDetStatus filename','$steering(gcdfile_09)')
self.AddParameter('outputfile','Output physics filename','$steering(outfile)')
self.AddParameter('summaryfile','summary file','$steering(summaryfile)')
self.AddParameter('histosfile','BasicHistos file','sanityfile.pkl')
self.AddParameter('target','Destination of files in Data Warehouse','$steering(TARGET::2009)')
self.AddParameter('emulate','Write XML inventory instead of transfering data',False)
self.AddParameter('EnableBasicHistos','Boolean flag to enable transfer of basic histos',False)
self.AddParameter('HistosPrescale','basic histos prescale',10)
def Execute(self,stats):
if not ipmodule.IPBaseClass.Execute(self,stats): return 0
gcdfile = self.GetParameter('gcdfile')
gcdfile = self.parser.parse(gcdfile) #in case we are using default
outputfile = self.GetParameter('outputfile')
outputfile = self.parser.parse(outputfile) #in case we are using default
summary = self.GetParameter('summaryfile')
try:
summary = self.parser.parse(summary) #in case we are using default
except:
summary = None
histosfile = self.GetParameter('histosfile')
histosfile = self.parser.parse(histosfile) #in case we are using default
histosfile_output = self.parser.parse('sanityhistos.$args(dataset).$args(procnum).pkl')
target = self.GetParameter('target')
target = self.parser.parse(target) #in case we are using default
if type(target) is list:
import random
target = random.choice(target)
emulate = self.GetParameter('emulate')
basicHisto = self.GetParameter('EnableBasicHistos')
histoPre = self.GetParameter('HistosPrescale')
from iceprod.modules import gsiftp
from iceprod.core.dataclasses import I3PostTray
post = I3PostTray()
job = int(self.parser.parse("$args(procnum)"))
key = self.parser.parse("$args(key)")
dataset = int(self.parser.parse("$args(dataset)"))
moniurl = self.parser.parse("$args(url)")
localcp = boolcast(self.parser.parse("$system(localcp)"))
if summary and os.path.exists(summary):
# Upload summary file to main target without tracking
post.AddModule("gsiftp.URLCopy","uploadsummary")(
("execute",not job % 10), # prescale
("source","file:%s" % os.path.join(os.getcwd(),summary)),
("destination",target),
("emulate",emulate),
)
# Upload main physics output file to main target with tracking
post.AddModule("gsiftp.TrackURLCopy","uploadphysics")(
("execute",True),
("source","file:%s" % os.path.join(os.getcwd(),outputfile)),
("destination",target),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploadphysics2")(
("execute",localcp),
("source","file:%s" % os.path.join(os.getcwd(),outputfile)),
("destination",self.parser.parse("$system(targeturl)")),
("emulate",emulate),
)
# Upload GCD file to main target with tracking
post.AddModule("gsiftp.TrackURLCopy","uploadgcd")(
("execute",not job % 1000), # prescale
("source","file:%s" % os.path.join(os.getcwd(),gcdfile)),
("destination",target),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload GCD file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploadgcd2")(
("execute",localcp and not job % 1000), # prescale
("source","file:%s" % os.path.join(os.getcwd(),gcdfile)),
("destination",self.parser.parse("$system(targeturl)")),
("emulate",emulate),
)
# Upload basichistos file to main target without tracking
post.AddModule("gsiftp.URLCopy","uploadhisto")(
("execute",basicHisto and histoPre and not job % histoPre), # prescale
("source","file:%s" % os.path.join(os.getcwd(),histosfile)),
("destination",os.path.join(target,'histos',histosfile_output)),
("emulate",emulate),
)
if summary and os.path.exists(summary):
post.SetParser('uploadsummary',self.parser)
post.SetParser('uploadphysics',self.parser)
post.SetParser('uploadphysics2',self.parser)
post.SetParser('uploadgcd',self.parser)
post.SetParser('uploadgcd2',self.parser)
post.SetParser('uploadhisto',self.parser)
# Execute the PostTray
post.Execute()
return 0
class FilterGridFTP(ipmodule.IPBaseClass):
"""
Wrapper class that copy files to storage units with GridFTP
"""
def __init__(self):
ipmodule.IPBaseClass.__init__(self)
self.AddParameter('gcdfile','GeoCalibDetStatus filename','$steering(gcdfile_09)')
self.AddParameter('l1file','Output physics filename','$steering(FILTER::outfile_l1)_EHE.i3.gz')
self.AddParameter('l2file','Output physics filename','$steering(FILTER::outfile_l2).i3.gz')
self.AddParameter('summaryfile','summary file','$steering(summaryfile)')
self.AddParameter('rootfile','Flat-ntuple root file','$steering(FILTER::outfile_l1).root')
self.AddParameter('histofile','ProcHistos root file','$steering(FILTER::outfile_l1)_ProcHists.root')
self.AddParameter('gapfile','Gaps text file','$steering(FILTER::outfile_l1)_gaps.txt')
self.AddParameter('target1','Destination of Level 1 files in Data Warehouse','$steering(TARGET::2009_L1)')
self.AddParameter('target2','Destination of Level 2 files in Data Warehouse','$steering(TARGET::2009_L2)')
self.AddParameter('emulate','Write XML inventory instead of transfering data',False)
self.AddParameter('EnableBasicHistos','Boolean flag to enable transfer of basic histos',False)
self.AddParameter('production','Boolean flag to enable production-mode specific flags',True)
self.AddParameter('dcorsfile','Output dcors filename','$steering(CORSIKA::infile)')
self.AddParameter('target3','Destination of dcorsika files in Data Warehouse','$steering(TARGET::2009_DCORS)')
self.AddParameter('KeepdCorsika','Boolean flag to enable transfer of dcorsika file',False)
self.AddParameter('uploadlogs','Boolean flag to enable transfer of log files',True)
def Execute(self,stats):
if not ipmodule.IPBaseClass.Execute(self,stats): return 0
gcdfile = self.GetParameter('gcdfile')
gcdfile = self.parser.parse(gcdfile) #in case we are using default
l1file = self.GetParameter('l1file')
l1file = self.parser.parse(l1file) #in case we are using default
l2file = self.GetParameter('l2file')
l2file = self.parser.parse(l2file) #in case we are using default
summary = self.GetParameter('summaryfile')
try:
summary = self.parser.parse(summary) #in case we are using default
except:
summary = None
rootfile = self.GetParameter('rootfile')
rootfile = self.parser.parse(rootfile) #in case we are using default
dcorsfile = self.GetParameter('dcorsfile')
dcorsfile = self.parser.parse(dcorsfile) #in case we are using default
histofile = self.GetParameter('histofile')
histofile = self.parser.parse(histofile) #in case we are using default
gapfile = self.GetParameter('gapfile')
gapfile = self.parser.parse(gapfile) #in case we are using default
target1 = self.GetParameter('target1')
target1 = self.parser.parse(target1) #in case we are using default
if type(target1) is list:
import random
target1 = random.choice(target1)
target2 = self.GetParameter('target2')
target2 = self.parser.parse(target2) #in case we are using default
if type(target2) is list:
import random
target2 = random.choice(target2)
target3 = self.GetParameter('target3')
target3 = self.parser.parse(target3) #in case we are using default
if type(target3) is list:
import random
target3 = random.choice(target3)
emulate = self.GetParameter('emulate')
basicHisto = self.GetParameter('EnableBasicHistos')
keepdcors = self.GetParameter('KeepdCorsika')
uploadlogs = self.GetParameter('uploadlogs')
from iceprod.modules import gsiftp
from iceprod.core.dataclasses import I3PostTray
post = I3PostTray()
dataset = int(self.parser.parse("$args(dataset)"))
localcp = boolcast(self.parser.parse("$system(localcp)"))
job = int(self.parser.parse("$args(procnum)"))
prod = self.GetParameter('production')
local_target1 = self.parser.parse("$system(targeturl)")
local_target2 = self.parser.parse("$system(targeturl)")
local_target3 = self.parser.parse("$system(targeturl)")
# production mode?
if prod:
key = self.parser.parse("$args(key)")
moniurl = self.parser.parse("$args(url)")
else:
key = ''
moniurl = ''
local_target1 = target2
local_target2 = target2
localcp = True
# ---------------------------------------------
if summary and os.path.exists(summary):
# Upload summary file to main target without tracking
post.AddModule("gsiftp.URLCopy","uploadsummary")(
("execute", False), # prescale
("source","file:%s" % os.path.join(os.getcwd(),summary)),
("destination",target2),
("emulate",emulate),
)
# ---------------------------------------------
# Upload main physics output file to main target with tracking
if prod:
post.AddModule("gsiftp.TrackURLCopy","uploadl1ehe")(
("execute",False),
("source","file:%s" % os.path.join(os.getcwd(),l1file)),
("destination",target1),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploadl1ehe2")(
("execute",False),
("source","file:%s" % os.path.join(os.getcwd(),l1file)),
("destination",local_target1),
("emulate",emulate),
)
# ---------------------------------------------
# Upload main physics output file to main target with tracking
if prod:
post.AddModule("gsiftp.TrackURLCopy","uploadl2i3")(
("execute",prod), # BECAUSE THIS DOESN'T WORK, TrackURLCopy will still try to set up a server with empty url
("source","file:%s" % os.path.join(os.getcwd(),l2file)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploadl2i32")(
("execute",localcp),
("source","file:%s" % os.path.join(os.getcwd(),l2file)),
("destination",local_target2),
("emulate",emulate),
)
# ---------------------------------------------
# Upload main physics output file to main target with tracking
if prod:
post.AddModule("gsiftp.TrackURLCopy","uploadl2root")(
("execute",prod),
("source","file:%s" % os.path.join(os.getcwd(),rootfile)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploadl2root2")(
("execute",localcp),
("source","file:%s" % os.path.join(os.getcwd(),rootfile)),
("destination",local_target2),
("emulate",emulate),
)
# ---------------------------------------------
# Upload main physics output file to main target with tracking
if keepdcors:
if prod:
post.AddModule("gsiftp.TrackURLCopy","uploaddcors")(
("execute",prod),
("source","file:%s" % os.path.join(os.getcwd(),dcorsfile)),
("destination",target3),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploaddcors2")(
("execute",localcp),
("source","file:%s" % os.path.join(os.getcwd(),dcorsfile)),
("destination",local_target3),
("emulate",emulate),
)
# ---------------------------------------------
# Upload main physics output file to main target with tracking
if prod:
post.AddModule("gsiftp.TrackURLCopy","uploadl2histo")(
("execute",False),
("source","file:%s" % os.path.join(os.getcwd(),histofile)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploadl2histo2")(
("execute",False),
("source","file:%s" % os.path.join(os.getcwd(),histofile)),
("destination",local_target2),
("emulate",emulate),
)
# ---------------------------------------------
# Upload main physics output file to main target with tracking
if prod:
post.AddModule("gsiftp.TrackURLCopy","uploadl2gap")(
("execute",False),
("source","file:%s" % os.path.join(os.getcwd(),gapfile)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploadl2gap2")(
("execute",False),
("source","file:%s" % os.path.join(os.getcwd(),gapfile)),
("destination",local_target2),
("emulate",emulate),
)
# ---------------------------------------------
# Upload GCD file to main target with tracking
if prod:
post.AddModule("gsiftp.TrackURLCopy","uploadgcd")(
("execute",prod and not job % 1000), # prescale
("source","file:%s" % os.path.join(os.getcwd(),gcdfile)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload GCD file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploadgcd2")(
("execute",localcp and not job % 1000), # prescale
("source","file:%s" % os.path.join(os.getcwd(),gcdfile)),
("destination",local_target2),
("emulate",emulate),
)
# ---------------------------------------------
if summary and os.path.exists(summary):
post.SetParser('uploadsummary',self.parser)
if prod:
post.SetParser('uploadl1ehe',self.parser)
post.SetParser('uploadl2root',self.parser)
if keepdcors:
post.SetParser('uploaddcors',self.parser)
post.SetParser('uploadl2histo',self.parser)
post.SetParser('uploadl2gap',self.parser)
post.SetParser('uploadgcd',self.parser)
post.SetParser('uploadl2i3',self.parser)
post.SetParser('uploadl1ehe2',self.parser)
post.SetParser('uploadl2i32',self.parser)
post.SetParser('uploadl2root2',self.parser)
if keepdcors:
post.SetParser('uploaddcors2',self.parser)
post.SetParser('uploadl2histo2',self.parser)
post.SetParser('uploadl2gap2',self.parser)
post.SetParser('uploadgcd2',self.parser)
if uploadlogs:
stdoutfile = expandvars("$ICEPROD_STDOUT")
stderrfile = expandvars("$ICEPROD_STDERR")
icetraylog = expandvars("$I3_TOPDIR/icetray.%06u.log" % job)
corsikalog = self.parser.parse("$I3_TOPDIR/$steering(CORSIKA::infile).log")
upload_log(post,stdoutfile,os.path.join(target2,"logs/"),emulate,"",self.parser)
upload_log(post,stderrfile,os.path.join(target2,"logs/"),emulate,"",self.parser)
upload_log(post,icetraylog,os.path.join(target2,"logs/"),emulate,"",self.parser)
upload_log(post,corsikalog,os.path.join(target2,"logs/"),emulate,"",self.parser)
# Execute the PostTray
post.Execute()
return 0
class IC79FilterGridFTP(ipmodule.IPBaseClass):
"""
Wrapper class that copy files to storage units with GridFTP
"""
def __init__(self):
ipmodule.IPBaseClass.__init__(self)
# No more separate L1 for IC79, new : optional : _IT and _IT.root
self.AddParameter('gcdfile','GeoCalibDetStatus filename','$steering(gcdfile_10)')
self.AddParameter('l2file','Output physics filename','$steering(FILTER::outfile_l2).i3.gz')
self.AddParameter('itl2file','Output IceTop physics filename','$steering(FILTER::outfile_l2)_IT.i3.gz')
self.AddParameter('summaryfile','summary file','$steering(summaryfile)')
self.AddParameter('rootfile','Flat-ntuple root file','$steering(FILTER::outfile_l2).root')
self.AddParameter('itrootfile','Flat-ntuple IceTop root file','$steering(FILTER::outfile_l2)_IT.root')
self.AddParameter('histofile','ProcHistos root file','$steering(FILTER::outfile_l2)_ProcHists.root')
self.AddParameter('gapfile','Gaps text file','$steering(FILTER::outfile_l2)_gaps.txt')
self.AddParameter('slopfile','Slow Monopole files','$steering(FILTER::outfile_l2)_SLOP.i3.gz')
self.AddParameter('target2','Destination of Level 2 files in Data Warehouse','$steering(TARGET::2010_L2)')
self.AddParameter('localtarget2','Destination of Level 2 files locally','$system(targeturl)')
self.AddParameter('emulate','Write XML inventory instead of transfering data',False)
self.AddParameter('EnableBasicHistos','Boolean flag to enable transfer of basic histos',False)
self.AddParameter('production','Boolean flag to enable production-mode specific flags',True)
self.AddParameter('IceTopProduction','Boolean flag to enable IceTop production-mode specific flags',False)
self.AddParameter('uploadlogs','Boolean flag to enable transfer of log files',True)
def Execute(self,stats):
if not ipmodule.IPBaseClass.Execute(self,stats): return 0
gcdfile = self.GetParameter('gcdfile')
gcdfile = self.parser.parse(gcdfile) #in case we are using default
l2file = self.GetParameter('l2file')
l2file = self.parser.parse(l2file) #in case we are using default
itl2file = self.GetParameter('itl2file')
itl2file = self.parser.parse(itl2file) #in case we are using default
slopfile = self.GetParameter('slopfile')
slopfile = self.parser.parse(slopfile) #in case we are using default
summary = self.GetParameter('summaryfile')
try:
summary = self.parser.parse(summary) #in case we are using default
except:
summary = None
rootfile = self.GetParameter('rootfile')
rootfile = self.parser.parse(rootfile) #in case we are using default
hdf5file = rootfile.replace(".root",".h5")
itrootfile = self.GetParameter('itrootfile')
itrootfile = self.parser.parse(itrootfile) #in case we are using default
ithdf5file = itrootfile.replace(".root",".h5")
histofile = self.GetParameter('histofile')
histofile = self.parser.parse(histofile) #in case we are using default
gapfile = self.GetParameter('gapfile')
gapfile = self.parser.parse(gapfile) #in case we are using default
target2 = self.GetParameter('target2')
target2 = self.parser.parse(target2) #in case we are using default
if type(target2) is list:
import random
target2 = random.choice(target2)
localtarget2 = self.GetParameter('localtarget2')
localtarget2 = self.parser.parse(localtarget2) #in case we are using default
emulate = self.GetParameter('emulate')
basicHisto = self.GetParameter('EnableBasicHistos')
from iceprod.modules import gsiftp
from iceprod.core.dataclasses import I3PostTray
post = I3PostTray()
dataset = int(self.parser.parse("$args(dataset)"))
localcp = boolcast(self.parser.parse("$system(localcp)"))
job = int(self.parser.parse("$args(procnum)"))
prod = self.GetParameter('production')
itprod = self.GetParameter('IceTopProduction')
uploadlogs = self.GetParameter('uploadlogs')
#local_target2 = self.parser.parse("$system(targeturl)")
local_target2 = localtarget2
local_emulate = emulate
if self.parser.sysopts.has_key('local_emulate'):
local_emulate = boolcast(self.parser.parse("$system(local_emulate)"))
# production mode?
if prod:
key = self.parser.parse("$args(key)")
moniurl = self.parser.parse("$args(url)")
else:
key = ''
moniurl = ''
local_target2 = target2
localcp = True
local_emulate = emulate
# ---------------------------------------------
if summary and os.path.exists(summary):
# Upload summary file to main target without tracking
post.AddModule("gsiftp.URLCopy","uploadsummary")(
("execute", False), # prescale
("source","file:%s" % os.path.join(os.getcwd(),summary)),
("destination",target2),
("emulate",emulate),
)
# ---------------------------------------------
# Upload main physics output file to main target with tracking
post.AddModule("gsiftp.TrackURLCopy","uploadl2i3")(
("execute",prod),
("source","file:%s" % os.path.join(os.getcwd(),l2file)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload SLOP output file to main target with tracking
post.AddModule("gsiftp.TrackURLCopy","uploadl2slop")(
("execute",prod and os.path.exists(os.path.join(os.getcwd(),slopfile))),
("source","file:%s" % os.path.join(os.getcwd(),slopfile)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload main physics output file to local target without tracking
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploadl2i32")(
("execute",localcp),
("source","file:%s" % os.path.join(os.getcwd(),l2file)),
("destination",local_target2),
("emulate",local_emulate),
)
# ---------------------------------------------
# Upload main physics output file to main target with tracking
if itprod:
if prod:
# Decided (CR-WG PhoneCall 23-02-2011) to not send _IT.i3 to data warehouse
# Can be done later if wanted and still available disk space.
post.AddModule("gsiftp.TrackURLCopy","uploaditl2i3")(
("execute",False),
("source","file:%s" % os.path.join(os.getcwd(),itl2file)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploaditl2i32")(
("execute",localcp),
("source","file:%s" % os.path.join(os.getcwd(),itl2file)),
("destination",local_target2),
("emulate",local_emulate),
)
# ---------------------------------------------
# Upload main physics output root file to main target with tracking
post.AddModule("gsiftp.TrackURLCopy","uploadl2root")(
("execute",prod and os.path.exists(os.path.join(os.getcwd(),rootfile))),
("source","file:%s" % os.path.join(os.getcwd(),rootfile)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload main physics output hdf5 file to main target with tracking
post.AddModule("gsiftp.TrackURLCopy","uploadl2hdf5")(
("execute",prod and os.path.exists(os.path.join(os.getcwd(),hdf5file))),
("source","file:%s" % os.path.join(os.getcwd(),hdf5file)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploadl2root2")(
("execute",localcp and os.path.exists(os.path.join(os.getcwd(),rootfile))),
("source","file:%s" % os.path.join(os.getcwd(),rootfile)),
("destination",local_target2),
("emulate",local_emulate),
)
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploadl2hdf52")(
("execute",localcp and os.path.exists(os.path.join(os.getcwd(),hdf5file))),
("source","file:%s" % os.path.join(os.getcwd(),hdf5file)),
("destination",local_target2),
("emulate",local_emulate),
)
# ---------------------------------------------
# Upload main physics output root file to main target with tracking
if itprod:
if prod:
# Decided (CR-WG PhoneCall 23-02-2011) to not send _IT.root to data warehouse
# Can be done later if wanted and still available disk space.
post.AddModule("gsiftp.TrackURLCopy","uploaditl2root")(
("execute",False),
("source","file:%s" % os.path.join(os.getcwd(),itrootfile)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
post.AddModule("gsiftp.TrackURLCopy","uploaditl2hdf5")(
("execute",False),
("source","file:%s" % os.path.join(os.getcwd(),ithdf5file)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploaditl2root2")(
("execute",localcp and os.path.exists(os.path.join(os.getcwd(),itrootfile))),
("source","file:%s" % os.path.join(os.getcwd(),itrootfile)),
("destination",local_target2),
("emulate",local_emulate),
)
# Upload main physics output file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploaditl2root2")(
("execute",localcp and os.path.exists(os.path.join(os.getcwd(),ithdf5file))),
("source","file:%s" % os.path.join(os.getcwd(),ithdf5file)),
("destination",local_target2),
("emulate",local_emulate),
)
# ---------------------------------------------
# Upload main physics output file to main target with tracking
if prod:
post.AddModule("gsiftp.TrackURLCopy","uploadl2histo")(
("execute",prod and os.path.exists(os.path.join(os.getcwd(),histofile))),
("source","file:%s" % os.path.join(os.getcwd(),histofile)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# ---------------------------------------------
# Upload main physics output file to main target with tracking
if prod:
post.AddModule("gsiftp.TrackURLCopy","uploadl2gap")(
("execute",prod and os.path.exists(os.path.join(os.getcwd(),gapfile))),
("source","file:%s" % os.path.join(os.getcwd(),gapfile)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# ---------------------------------------------
# Upload GCD file to main target with tracking
if prod:
post.AddModule("gsiftp.TrackURLCopy","uploadgcd")(
("execute",prod and not job % 1000), # prescale
("source","file:%s" % os.path.join(os.getcwd(),gcdfile)),
("destination",target2),
("monitorURL",moniurl),
("dataset",dataset),
("job",job),
("key",key),
("emulate",emulate),
)
# Upload GCD file to local target without tracking
post.AddModule("gsiftp.URLCopy","uploadgcd2")(
("execute",localcp and not job % 1000), # prescale
("source","file:%s" % os.path.join(os.getcwd(),gcdfile)),
("destination",local_target2),
("emulate",local_emulate),
)
# ---------------------------------------------
if summary and os.path.exists(summary):
post.SetParser('uploadsummary',self.parser)
if prod:
post.SetParser('uploadl2root',self.parser)
post.SetParser('uploadl2histo',self.parser)
post.SetParser('uploadl2gap',self.parser)
post.SetParser('uploadgcd',self.parser)
post.SetParser('uploadl2i3',self.parser)
if itprod:
post.SetParser('uploaditl2i3',self.parser)
post.SetParser('uploaditl2root',self.parser)
post.SetParser('uploadl2i32',self.parser)
post.SetParser('uploadl2root2',self.parser)
post.SetParser('uploadgcd2',self.parser)
if itprod:
post.SetParser('uploaditl2i32',self.parser)
post.SetParser('uploaditl2root2',self.parser)
if uploadlogs:
stdoutfile = expandvars("$ICEPROD_STDOUT")
stderrfile = expandvars("$ICEPROD_STDERR")
icetraylog = expandvars("$I3_TOPDIR/icetray.%06u.log" % job)
if self.parser.steering.parameters.has_key('CORSIKA::infile'):
corsikalog = self.parser.parse("$I3_TOPDIR/$steering(CORSIKA::infile).log")
upload_log(post,corsikalog,os.path.join(target2,"logs/"),emulate,"",self.parser)
upload_log(post,stdoutfile,os.path.join(target2,"logs/"),emulate,"",self.parser)
upload_log(post,stderrfile,os.path.join(target2,"logs/"),emulate,"",self.parser)
upload_log(post,icetraylog,os.path.join(target2,"logs/"),emulate,"",self.parser)
if localcp:
upload_log(post,stdoutfile,os.path.join(localtarget2,"logs/"),local_emulate,"_2",self.parser)
upload_log(post,stderrfile,os.path.join(localtarget2,"logs/"),local_emulate,"_2",self.parser)
upload_log(post,icetraylog,os.path.join(localtarget2,"logs/"),local_emulate,"_2",self.parser)
upload_log(post,corsikalog,os.path.join(localtarget2,"logs/"),local_emulate,"_2",self.parser)
# Execute the PostTray
post.Execute()
return 0
class IC86v1FilterGridFTP(IC79FilterGridFTP):
def __init__(self):
ipmodule.IPBaseClass.__init__(self)
self.AddParameter('gcdfile','GeoCalibDetStatus filename','$steering(gcdfile_10)')
self.AddParameter('l2file','Output physics filename','$steering(FILTER::outfile_l2).i3.bz2')
self.AddParameter('itl2file','Output IceTop physics filename','$steering(FILTER::outfile_l2)_IT.i3.bz2')
self.AddParameter('summaryfile','summary file','$steering(summaryfile)')
self.AddParameter('rootfile','Flat-ntuple root file','$steering(FILTER::outfile_l2).root')
self.AddParameter('itrootfile','Flat-ntuple IceTop root file','$steering(FILTER::outfile_l2)_IT.root')
self.AddParameter('histofile','ProcHistos root file','$steering(FILTER::outfile_l2)_ProcHists.root')
self.AddParameter('gapfile','Gaps text file','$steering(FILTER::outfile_l2)_gaps.txt')
self.AddParameter('slopfile','Slow Monopole files','$steering(FILTER::outfile_l2)_SLOP.i3.bz2')
self.AddParameter('target2','Destination of Level 2 files in Data Warehouse','$steering(TARGET::2010_L2)')
self.AddParameter('localtarget2','Destination of Level 2 files locally','$system(targeturl)')
self.AddParameter('emulate','Write XML inventory instead of transfering data',False)
self.AddParameter('EnableBasicHistos','Boolean flag to enable transfer of basic histos',False)
self.AddParameter('production','Boolean flag to enable production-mode specific flags',True)
self.AddParameter('IceTopProduction','Boolean flag to enable IceTop production-mode specific flags',False)
self.AddParameter('uploadlogs','Boolean flag to enable transfer of log files',True)
| 44.672269 | 125 | 0.57073 | 3,666 | 37,212 | 5.75341 | 0.079378 | 0.047411 | 0.028921 | 0.027309 | 0.84781 | 0.837995 | 0.815997 | 0.798739 | 0.775175 | 0.761474 | 0 | 0.014825 | 0.27131 | 37,212 | 832 | 126 | 44.725962 | 0.763018 | 0.132592 | 0 | 0.719685 | 1 | 0 | 0.252172 | 0.040789 | 0 | 0 | 0 | 0 | 0 | 1 | 0.014173 | false | 0 | 0.023622 | 0.001575 | 0.048819 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
8720544bced495f74d0d0db50a3dfc2ce35768b9 | 7,146 | py | Python | 1/main.py | misterwilliam/advent-of-code | b8ddcbc5efcf62c7e5e4244339029783ac9f90b6 | [
"MIT"
] | null | null | null | 1/main.py | misterwilliam/advent-of-code | b8ddcbc5efcf62c7e5e4244339029783ac9f90b6 | [
"MIT"
] | null | null | null | 1/main.py | misterwilliam/advent-of-code | b8ddcbc5efcf62c7e5e4244339029783ac9f90b6 | [
"MIT"
] | null | null | null | data = "()(((()))(()()()((((()(((())(()(()((((((()(()(((())))((()(((()))((())(()((()()()()(((())(((((((())))()()(()(()(())(((((()()()((())(((((()()))))()(())(((())(())((((((())())))(()())))()))))()())()())((()()((()()()()(()((((((((()()())((()()(((((()(((())((())(()))()((((()((((((((())()((()())(())((()))())((((()())(((((((((((()()(((((()(()))())(((()(()))())((()(()())())())(()(((())(())())()()(()(()((()))((()))))((((()(((()))))((((()(()(()())())()(((()((((())((((()(((()()(())()()()())((()((((((()((()()))()((()))()(()()((())))(((()(((()))((()((()(()))(((()()(()(()()()))))()()(((()(((())())))))((()(((())()(()(())((()())))((((())))(()(()(()())()((()())))(((()((()(())()()((()((())(()()((())(())()))()))((()(())()))())(((((((()(()()(()(())())))))))(()((((((())((((())((())())(()()))))()(())(()())()())((())(()))))(()))(()((()))()(()((((((()()()()((((((((()(()(())((()()(()()))(())()())()((())))()))()())(((()))(())()(())()))()((()((()(()()())(())()()()((())())))((()()(()()((()(())()()())(((()(()()))))(())))(()(()())()))()()))))))()))))((((((())))())))(()(())())(()())))))(()))()))))))()((()))))()))))(()(()((()())())(()()))))(((())()))())())())(((()(()()))(())()(())(())((((((()()))))((()(()))))))(()))())(((()()(()))()())()()()())))))))))))))(())(()))(()))((()(())(()())(())())(()())(())()()(()())))()()()))(())())()))())())(())((())))))))(())))(())))))()))))((())(()(((()))))(()))()((()(())))(()())(((((()))()())()()))))()))))()))())(()(()()()))()))))))((()))))))))))()((()))((()(())((())()()(()()))()(()))))()()(()))()))(((())))(())()((())(())(()())()())())))))))())))()((())))()))(()))()()))(((((((()))())(()()))(()()(()))()(()((()())()))))))(((()()()())))(())()))()())(()()))()()))))))))(())))()))()()))))))()))()())))()(())(())))))()(())()()(()()))))())((()))))()))))(()(((((()))))))))())))())()(())()()))))(())))())()()())()()())()(()))))()))()))))))))())))((()))()))()))())))()())()()())))())))(()((())()((()))())))))())()(())((())))))))))))())()())(())())())(()))(()))()))())(()(())())()())()()(()))))(()(())))))))(())))())(())))))))())()()(())())())))(())))))()))()(()())()(()))())())))))()()(()))()))))())))))))))()))))()))))))())()())()()))))()())))())))))))))))()()))))()()(((()))()()(())()))))((()))))(()))(())())))(())()))))))(()))()))))(())())))))()))(()())))))))))))))())))))))))()((()())(()())))))))((()))))(())(())))()(()())())))())())(()()()())))()))))))())))))())()()())))))))))))()()(()))))()())()))((()())(()))))()(()))))))))))()())())(((())(()))))())()))()))()))))))()))))))(()))))()))))()(())))(())))(()))())()()(()()))()))(()()))))))))()))(()))())(()()(()(()())()()))()))))))))(())))))((()()(()))())())))))()))())(()())()()))())))()(()()()()))((())())))())()(()()))()))))))))(()))(())))()))))(()(()())(()))))()())())()))()()))())))))))))))())()))))))()))))))))())))))()))))())(()())))(())()))())())))))()()(()()())(()())))()()))(((()))(()()()))))()))))()))))((())))()((((((()()))))))())))))))))))(((()))))))))))))(())())))))())(()))))))(()))((()))())))()(()((()))()))()))))))))))())()))()(()()))))())))())(())()(()))()))())(()))()))))(()()))()()(())))))()))(())(()(()()))(()()())))))(((()))))))()))))))))))))(())(()))))()())())()()((()()))())))))(()))))())))))))()()()))))))))())))()(((()()))(())))))(((())())))))((()))()(()))(()))))(()())))(()))())))))()))))(())(())))()((()))(())())))()()))()))))))))()))(()()()(()()()(()))())(())()())(((()))(())))))))))(((()())))()()))))))))()(())(()))()((((())(())(()())))()))(((())()()()))((()))(()))())())))())))(()))())()())())(()(())())()()()(())))())(())))(())))(())()))()))(()((()))))))))())(()))))))())(()()))()()))()(()(()())))()()(()((()((((((()))(())))()()()))())()))((()()(()))())((()(()(()))(()()))))()())))()))()())))))))()()((()())(())))()))(()))(())(()))())(()(())))()()))))))(((()(((()()))()(()(())())((()()))()))()))()))()(()()()(()))((()())()(())))()()))(((())()()())(())()((()()()()(()(())(()()))()(((((()())))((())))))(()()()))))(((()(())))()))((()((()(())()(()((())))((()())()(()))(((()())()()(()))(())(((()((()())()((())()())(((()()))((()((())(()))(()())(()()()))((()))(())(()((()()())((()))(())))(())(())(())))(()())))(((((()(()(((((()())((((()(()())(())(()()(((())((()(((()()(((()()((((((())))())(()((((((()(()))()))()()((()((()))))()(()()(()((()()))))))(((((()(((((())()()()(())())))))))()))((()()(())))(())(()()()())))))(()((((())))))))()()(((()(()(()(()(()())()()()(((((((((()()())()(()))((()()()()()(((((((()())()((())()))((((((()(()(()(()())(((()(((((((()(((())(((((((((())(())())()))((()(()))(((()()())(())(()(()()(((()(())()))())))(())((((((())(()()())()()(((()(((())(()(((())(((((((()(((((((((()))(())(()(()(()))))((()))()(())())())((()(()((()()))((()()((()(())(())(()((())(((())(((()()()((((((()()(())((((())()))))(())((()(()((())))(((((()(()()())())((())())))((())((()((()()((((((())(((()()(()())())(()(()))(()(()))())())()(((((((()(((()(())()()((())((()(()()((()(()()(((((((((((())((())((((((())((()((((()(()((((()(((((((())()((()))))())()((()((((()(()(((()((()())))(())())(((()(((())((((((()(((((((((()()(())))(()(((((()((((()())))((()((()((()(()()(((())((((((((((((()(((())(()(((((()))(()()(()()()()()()((())(((((((())(((((())))))())()(()()(()(()(((()()(((((())(()((()((()(((()()((()((((())()))()((((())(())))()())(((())(())(()()((()(((()()((((((((((()()(()())())(((((((((())((((()))()()((((())(()((((()(((())())(((((((((((()((((())))(())(()(((()(((()((())(((((()((()()(()(()()((((((()((((()((()(()((()(()((((((()))))()()(((((()((()(()(())()))(())(((((((()((((()())(()((()((()(()))())))(())((()))))(((((((()()()())(()))(()()((()())()((()((()()()(()(()()))(()())(())(((((()(((((((((((()((()(((()(((((((()()((((((()(((((()(()((()(((((())((((((()))((((())((()()((())(((())()(((((()()(((((()((()(()(((((((()(((((()((()((()((())(())((())(()))()()))(()()(()(()()(((((((()(((()(((())()(((((()((((((()())((((())()((()((()(()()())(()))((((()()((((((()((()(()(()((((()((()((())((((((()(()(())((((((()((((((((((()((())()))()(()(()(((((()()()))((())))()(()((((((((((((((()(((()((((()((())((()((()(((()()(()(((()((())(()()())))()(()(()(((((()()(()(()((((()(((((())()(()(()))(((((()()(((()()(())((((((((((((((())((())(((((((((((())()()()(())()(()(()(((((((((())(((()))(()()())(()((((()(())(((((()())(())((((((((())()((((()((((((())(()((()(())(((()((((()))(((((((((()()))((((()(())()()()(())(()((())((()()))()(((())(((((())((((((()()))(((((((((()((((((())))(((((((()((()(()(())))())(()(()))()(((((()())(()))()(()(())(((()))))())()())))(((((()))())()((()(()))))((()()()((((((()))()()((((((((())((()(()(((()(()((())((()())(()((((())(()(((()()()(()(()()))())())((((((((((())())((()))()((())(())(())))())()(()()(())))())(()))(((()(()()(((()(((())))()(((()(())()((((((())()))()))()((((((()(()(((((()())))()))))())()()(((()(((((())((()()(()((()((()(()(()(())))(()()()()((()(())(((()((()))((((()))())(())))())(()))()()()())()))(((()()())()((())))(())(()()()()(()())((()(()()((((())))((()((()(())((()(()((())()(()()(((()())()()())((()))((())(((()()(())))()()))(((()((())()(((((()())(())((())()())())((((((()(()(((((()))(()("
floor = 0
for i, c in enumerate(data):
if c == "(":
floor += 1
else:
floor -= 1
if floor == -1:
print i + 1
break | 649.636364 | 7,009 | 0.009656 | 23 | 7,146 | 3 | 0.565217 | 0.26087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.000705 | 0.007417 | 7,146 | 11 | 7,010 | 649.636364 | 0.009023 | 0 | 0 | 0 | 0 | 0 | 0.979572 | 0.979432 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.1 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
8770494ef03c7634de69e1a6c6b44fd437809e84 | 1,603 | py | Python | src/test.py | JamHsu/StageToRemote | b13939c28ac527ec28c70ad1689a7f6b00e8747c | [
"MIT"
] | null | null | null | src/test.py | JamHsu/StageToRemote | b13939c28ac527ec28c70ad1689a7f6b00e8747c | [
"MIT"
] | null | null | null | src/test.py | JamHsu/StageToRemote | b13939c28ac527ec28c70ad1689a7f6b00e8747c | [
"MIT"
] | null | null | null | import unittest
import util
class UtilTest(unittest.TestCase):
def testAppendEndSlash(self):
testData = 'src/abc'
expected = 'src/abc/'
result = util.appendEndSlash(testData)
self.assertEquals(expected, result)
testData = 'src/abc/'
expected = 'src/abc/'
result = util.appendEndSlash(testData)
self.assertEquals(expected, result)
def testRemoveEndSlash(self):
testData = 'src/abc/'
expected = 'src/abc'
result = util.removeEndSlash(testData)
self.assertEquals(expected, result)
testData = 'src/abc'
expected = 'src/abc'
result = util.removeEndSlash(testData)
self.assertEquals(expected, result)
def testAppendStartSlash(self):
testData = 'src/abc'
expected = '/src/abc'
result = util.appendStartSlash(testData)
self.assertEquals(expected, result)
testData = '/src/abc'
expected = '/src/abc'
result = util.appendStartSlash(testData)
self.assertEquals(expected, result)
def testRemoveStartSlash(self):
testData = '/src/abc'
expected = 'src/abc'
result = util.removeStartSlash(testData)
self.assertEquals(expected, result)
testData = 'src/abc'
expected = 'src/abc'
result = util.removeStartSlash(testData)
self.assertEquals(expected, result)
if __name__ == '__main__':
print 'test'
suite = (unittest.TestLoader()
.loadTestsFromTestCase(UtilTest))
unittest.TextTestRunner(verbosity=2).run(suite) | 29.145455 | 51 | 0.626326 | 148 | 1,603 | 6.72973 | 0.22973 | 0.096386 | 0.11245 | 0.176707 | 0.756024 | 0.756024 | 0.746988 | 0.746988 | 0.746988 | 0.730924 | 0 | 0.000848 | 0.264504 | 1,603 | 55 | 51 | 29.145455 | 0.843936 | 0 | 0 | 0.727273 | 0 | 0 | 0.082294 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 0 | null | null | 0 | 0.045455 | null | null | 0.022727 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
5e5419455bdb6519b34137506b86f5086bf0a547 | 59 | py | Python | text_dedup/__init__.py | lovit/text-dedup | fb136294366a324cf32dbc5a19cc92548106ccce | [
"Apache-2.0"
] | 3 | 2021-03-22T05:33:56.000Z | 2021-12-10T07:24:55.000Z | text_dedup/__init__.py | lovit/text-dedup | fb136294366a324cf32dbc5a19cc92548106ccce | [
"Apache-2.0"
] | null | null | null | text_dedup/__init__.py | lovit/text-dedup | fb136294366a324cf32dbc5a19cc92548106ccce | [
"Apache-2.0"
] | null | null | null | from .about import __version__
from .about import __name__
| 19.666667 | 30 | 0.830508 | 8 | 59 | 5.125 | 0.625 | 0.439024 | 0.731707 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135593 | 59 | 2 | 31 | 29.5 | 0.803922 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
5ec94c4d49c1063a8db2ee44e1ac62e9146868d3 | 162 | py | Python | 01-private-attributes/vehicle.py | 7xMind/Python-Turorials | 6417ee1484d9881050f9512bc16a72dcfdb8b891 | [
"MIT"
] | null | null | null | 01-private-attributes/vehicle.py | 7xMind/Python-Turorials | 6417ee1484d9881050f9512bc16a72dcfdb8b891 | [
"MIT"
] | null | null | null | 01-private-attributes/vehicle.py | 7xMind/Python-Turorials | 6417ee1484d9881050f9512bc16a72dcfdb8b891 | [
"MIT"
] | null | null | null | class Vehicle:
def __init__(self, horn):
self.__horn = horn
class MyCar(Vehicle):
def __init__(self, horn):
self.__horn=horn
| 13.5 | 29 | 0.58642 | 19 | 162 | 4.368421 | 0.368421 | 0.385542 | 0.337349 | 0.433735 | 0.819277 | 0.819277 | 0.819277 | 0.819277 | 0 | 0 | 0 | 0 | 0.314815 | 162 | 11 | 30 | 14.727273 | 0.747748 | 0 | 0 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 10 |
0d5912fe27fa5ad96fdd881a4cfd3ad737ce086f | 21,670 | py | Python | op.py | dndnddn/ATOM076 | 0ba0c403ca1a59b6c2eded46c24ce238322a2930 | [
"MIT"
] | null | null | null | op.py | dndnddn/ATOM076 | 0ba0c403ca1a59b6c2eded46c24ce238322a2930 | [
"MIT"
] | null | null | null | op.py | dndnddn/ATOM076 | 0ba0c403ca1a59b6c2eded46c24ce238322a2930 | [
"MIT"
] | 2 | 2020-11-19T08:28:31.000Z | 2020-11-23T04:18:06.000Z | import subprocess
import os
import time
from datetime import datetime
BASEDIR = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"))
import sys, termios, tty, os, time
def getch():
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
return ch
os.system("clear")
print ("1. OP_BACKUP - AUTO DIR BACKUP(branch_timestamp)")
print ("2. OP_RESTORE - AUTO RESTORE(LAST Bak DIR)")
print ("3. OP_BACKUP - MANUAL BACKUP + kegman.json")
print ("4. OP_RESTORE - MANUAL RESTORE + kegman.json")
print ("5. OP_INSTALL - Install OP new. If exist OP directory, will be renamed")
print ("6. OP_UPDATE - Run 'git pull' command to update OP latest")
print ("7. SEE_BRANCH - Confirm current branch")
print ("8. CH_BRANCH - Branch change(pull latest, quick change and reboot")
print ("t. LIVE_TUNE - Run live tune")
print ("r. REBOOT - Reboot your EON")
print ("EXIT: anykey")
print ("")
print ("Please select job what you want")
char = getch()
if (char == "1"):
os.system("clear")
print ("Copying openpilot to openpilot_branch_timestamp...")
os.system("cd /data; date +%Y%m%d%H%M%S > ctime.txt")
os.system("cd /data/openpilot; branch=`git branch | grep '*' | awk -F' ' '{print $2}' | tail -n 1`; cd /data; ct=`cat ctime.txt`; cp -rfp /data/openpilot /data/openpilot_${branch}_${ct}")
os.system("cd /data/openpilot; branch=`git branch | grep '*' | awk -F' ' '{print $2}' | tail -n 1`; cd /data; ct=`cat ctime.txt`; cp -f /data/kegman.json /data/kegman.json_${branch}_${ct}")
os.system("rm -f /data/ctime.txt")
print ("")
print ("Your backup dir and kegman file are below")
print ("")
os.system("ls -drt /data/openpilot_* | tail -n 1")
os.system("ls -tr /data/kegman* | tail -n 1")
print ("")
print ("Press p key to move first menu")
char1 = getch()
if (char1 == "p"):
os.system("cd /system/comma/home; ./op.sh")
elif (char == "2"):
os.system("clear")
print ("Your last backup dir and kegman file are here")
print ("")
os.system("cd /data; ls -drt /data/openpilot_* | tail -n 1")
os.system("ls -tr /data/kegman* | tail -n 1")
print ("")
print ("")
print ("This will remove your openpilot directory")
print ("and replace the op with current bak dir with kegman file")
print ("If you don't see the backup dir Press n key")
print ("Do yo want to continue?(y/n)")
char2 = getch()
if (char2 == "y"):
os.system("cd /data; date +%Y%m%d%H%M%S > ctime.txt")
os.system("cd /data/openpilot; git branch | grep '*' | awk -F' ' '{print $2}' | tail -n 1 > /data/branch.txt")
os.system("cd /data; curopdir=`ls -aldrt /data/openpilot_* | awk -F '/' '{print $3}' | tail -n 1`; ; cd /data; ct=`cat ctime.txt`; branch=`cat branch.txt`; mv openpilot openpilot_temp_12345; mv $curopdir openpilot; mv openpilot_temp_12345 openpilot_${branch}_${ct}")
os.system("cd /data; curkegman=`ls -altr /data/kegman.json_* | awk -F '/' '{print $3}' | tail -n 1`; cd /data; branch=`cat branch.txt`; ct=`cat ctime.txt`; mv kegman.json kegman.json_${branch}_${ct}; cp -f ${curkegman} kegman.json")
os.system("rm -f /data/ctime.txt")
os.system("rm -f /data/branch.txt")
print ("")
print ("Following is the result")
os.system("cd /data; ls -aldrt /data/openpilot*")
os.system("cd /data; ls -alrt /data/kegman.json*")
print ("")
print ("Do yo want to reboot?(y/n)")
char21 = getch()
if (char21 == "y"):
os.system("reboot")
elif (char21 == "n"):
os.system("cd /system/comma/home; ./op.sh")
elif (char2 == "n"):
os.system("cd /system/comma/home; ./op.sh")
elif (char == "3"):
os.system("clear")
print ("Please type backup name you want to make")
print ("")
bakdir = input('BACKUP DIR NAME: openpilot_')
os.system("clear")
print ("Copying openpilot to openpilot_%s..." %bakdir)
print ("Copying kegman.json to kegman.json_%s..." %bakdir)
print ("")
os.system("cp -rp /data/openpilot /data/openpilot_" + bakdir)
os.system("cp -f /data/kegman.json /data/kegman.json_" + bakdir)
print ("Your backup dir and kegman file are below")
print ("")
os.system("ls -drt /data/openpilot_" + bakdir + " | tail -n 1")
os.system("ls -tr /data/kegman.json_" + bakdir + " | tail -n 1")
print ("")
print ("Press p key to move first menu")
char3 = getch()
if (char3 == "p"):
os.system("cd /system/comma/home; ./op.sh")
elif (char == "4"):
os.system("clear")
print ("This will remove your openpilot directory")
print ("And replace the openpilot with the dir you selected")
print ("If the backup dir is not match or empty, Press n key")
print ("")
print ("Your BACKUP Directory is here")
os.system("cd /data; ls -d openpilot_* | grep openpilot_")
print ("")
print ("and kegman.json file")
os.system("cd /data; ls kegman.json_* | grep kegman.json_")
print ("")
print ("Next step, you can choose the bak dirs")
print ("Press y key to continue, p: move to first")
char4 = getch()
if (char4 == "y"):
os.system("clear")
print ("Please select the left side number you want to restore")
print ("will be restored with matched kegman.json backup file")
print ("If finished, will reboot automatically")
print ("")
os.system("cd /data; ls -d openpilot_* | grep -n openpilot_")
char41 = getch()
if (char41 == "1"):
os.system("cd /data; ls -d openpilot_* | grep -n openpilot_ | grep 1: | awk -F ':' '{print $2}' | tail -n 1 > dir_temp.txt")
fp = open('/data/dir_temp.txt', 'r')
dir_data = fp.readline()
fp.close()
if (dir_data != ""):
print ("")
print ("On restoring your openpilot backup dir to openpilot...")
os.system("rm -f /data/dir_temp.txt")
os.system("cd /data; rm -rf openpilot; tdir=`ls -d openpilot_* | grep -n openpilot_ | grep 1: | awk -F ':' '{print $2}' | tail -n 1`; mv $tdir openpilot; cp -rfp openpilot $tdir")
os.system("cd /data; tfile=`ls -d openpilot_* | grep -n openpilot_ | grep 1: | awk -F 'openpilot_' '{print $2}' | tail -n 1`; cp -f kegman.json_$tfile kegman.json")
print ("Done. will reboot now...")
os.system("reboot")
else:
os.system("rm -f /data/dir_temp.txt")
print ("")
print ("Aborted")
print ("Your backup Directory is invalid")
elif (char41 == "2"):
os.system("cd /data; ls -d openpilot_* | grep -n openpilot_ | grep 2: | awk -F ':' '{print $2}' | tail -n 1 > dir_temp.txt")
fp = open('/data/dir_temp.txt', 'r')
dir_data = fp.readline()
fp.close()
if (dir_data != ""):
print ("")
print ("On copying your openpilot backup dir to openpilot...")
os.system("rm -f /data/dir_temp.txt")
os.system("cd /data; rm -rf openpilot; tdir=`ls -d openpilot_* | grep -n openpilot_ | grep 2: | awk -F ':' '{print $2}' | tail -n 1`; mv $tdir openpilot; cp -rfp openpilot $tdir")
os.system("cd /data; tfile=`ls -d openpilot_* | grep -n openpilot_ | grep 2: | awk -F 'openpilot_' '{print $2}' | tail -n 1`; cp -f kegman.json_$tfile kegman.json")
print ("Done. will reboot now...")
os.system("reboot")
else:
os.system("rm -f /data/dir_temp.txt")
print ("")
print ("Aborted")
print ("Your backup Directory is invalid")
elif (char41 == "3"):
os.system("cd /data; ls -d openpilot_* | grep -n openpilot_ | grep 3: | awk -F ':' '{print $2}' | tail -n 1 > dir_temp.txt")
fp = open('/data/dir_temp.txt', 'r')
dir_data = fp.readline()
fp.close()
if (dir_data != ""):
print ("")
print ("On copying your openpilot backup dir to openpilot...")
os.system("rm -f /data/dir_temp.txt")
os.system("cd /data; rm -rf openpilot; tdir=`ls -d openpilot_* | grep -n openpilot_ | grep 3: | awk -F ':' '{print $2}' | tail -n 1`; mv $tdir openpilot; cp -rfp openpilot $tdir")
os.system("cd /data; tfile=`ls -d openpilot_* | grep -n openpilot_ | grep 3: | awk -F 'openpilot_' '{print $2}' | tail -n 1`; cp -f kegman.json_$tfile kegman.json")
print ("Done. will reboot now...")
os.system("reboot")
else:
os.system("rm -f /data/dir_temp.txt")
print ("")
print ("Aborted")
print ("Your backup Directory is invalid")
os.system("rm -f /data/dir_temp.txt")
elif (char41 == "4"):
os.system("cd /data; ls -d openpilot_* | grep -n openpilot_ | grep 4: | awk -F ':' '{print $2}' | tail -n 1 > dir_temp.txt")
fp = open('/data/dir_temp.txt', 'r')
dir_data = fp.readline()
fp.close()
if (dir_data != ""):
print ("")
print ("On copying your openpilot backup dir to openpilot...")
os.system("rm -f /data/dir_temp.txt")
os.system("cd /data; rm -rf openpilot; tdir=`ls -d openpilot_* | grep -n openpilot_ | grep 4: | awk -F ':' '{print $2}' | tail -n 1`; mv $tdir openpilot; cp -rfp openpilot $tdir")
os.system("cd /data; tfile=`ls -d openpilot_* | grep -n openpilot_ | grep 4: | awk -F 'openpilot_' '{print $2}' | tail -n 1`; cp -f kegman.json_$tfile kegman.json")
print ("Done. will reboot now...")
os.system("reboot")
else:
os.system("rm -f /data/dir_temp.txt")
print ("")
print ("Aborted")
print ("Your backup Directory is invalid")
elif (char41 == "5"):
os.system("cd /data; ls -d openpilot_* | grep -n openpilot_ | grep 5: | awk -F ':' '{print $2}' | tail -n 1 > dir_temp.txt")
fp = open('/data/dir_temp.txt', 'r')
dir_data = fp.readline()
fp.close()
if (dir_data != ""):
print ("")
print ("On copying your openpilot backup dir to openpilot...")
os.system("rm -f /data/dir_temp.txt")
os.system("cd /data; rm -rf openpilot; tdir=`ls -d openpilot_* | grep -n openpilot_ | grep 5: | awk -F ':' '{print $2}' | tail -n 1`; mv $tdir openpilot; cp -rfp openpilot $tdir")
os.system("cd /data; tfile=`ls -d openpilot_* | grep -n openpilot_ | grep 5: | awk -F 'openpilot_' '{print $2}' | tail -n 1`; cp -f kegman.json_$tfile kegman.json")
print ("Done. will reboot now...")
os.system("reboot")
else:
os.system("rm -f /data/dir_temp.txt")
print ("")
print ("Aborted")
print ("Your backup Directory is invalid")
elif (char41 == "6"):
os.system("cd /data; ls -d openpilot_* | grep -n openpilot_ | grep 6: | awk -F ':' '{print $2}' | tail -n 1 > dir_temp.txt")
fp = open('/data/dir_temp.txt', 'r')
dir_data = fp.readline()
fp.close()
if (dir_data != ""):
print ("")
print ("On copying your openpilot backup dir to openpilot...")
os.system("rm -f /data/dir_temp.txt")
os.system("cd /data; rm -rf openpilot; tdir=`ls -d openpilot_* | grep -n openpilot_ | grep 6: | awk -F ':' '{print $2}' | tail -n 1`; mv $tdir openpilot; cp -rfp openpilot $tdir")
os.system("cd /data; tfile=`ls -d openpilot_* | grep -n openpilot_ | grep 6: | awk -F 'openpilot_' '{print $2}' | tail -n 1`; cp -f kegman.json_$tfile kegman.json")
print ("Done. will reboot now...")
os.system("reboot")
else:
os.system("rm -f /data/dir_temp.txt")
print ("")
print ("Aborted")
print ("Your backup Directory is invalid")
elif (char41 == "7"):
os.system("cd /data; ls -d openpilot_* | grep -n openpilot_ | grep 7: | awk -F ':' '{print $2}' | tail -n 1 > dir_temp.txt")
fp = open('/data/dir_temp.txt', 'r')
dir_data = fp.readline()
fp.close()
if (dir_data != ""):
print ("")
print ("On copying your openpilot backup dir to openpilot...")
os.system("rm -f /data/dir_temp.txt")
os.system("cd /data; rm -rf openpilot; tdir=`ls -d openpilot_* | grep -n openpilot_ | grep 7: | awk -F ':' '{print $2}' | tail -n 1`; mv $tdir openpilot; cp -rfp openpilot $tdir")
os.system("cd /data; tfile=`ls -d openpilot_* | grep -n openpilot_ | grep 7: | awk -F 'openpilot_' '{print $2}' | tail -n 1`; cp -f kegman.json_$tfile kegman.json")
print ("Done. will reboot now...")
os.system("reboot")
else:
os.system("rm -f /data/dir_temp.txt")
print ("")
print ("Aborted")
print ("Your backup Directory is invalid")
elif (char41 == "8"):
os.system("cd /data; ls -d openpilot_* | grep -n openpilot_ | grep 8: | awk -F ':' '{print $2}' | tail -n 1 > dir_temp.txt")
fp = open('/data/dir_temp.txt', 'r')
dir_data = fp.readline()
fp.close()
if (dir_data != ""):
print ("")
print ("On copying your openpilot backup dir to openpilot...")
os.system("rm -f /data/dir_temp.txt")
os.system("cd /data; rm -rf openpilot; tdir=`ls -d openpilot_* | grep -n openpilot_ | grep 8: | awk -F ':' '{print $2}' | tail -n 1`; mv $tdir openpilot; cp -rfp openpilot $tdir")
os.system("cd /data; tfile=`ls -d openpilot_* | grep -n openpilot_ | grep 8: | awk -F 'openpilot_' '{print $2}' | tail -n 1`; cp -f kegman.json_$tfile kegman.json")
print ("Done. will reboot now...")
os.system("reboot")
else:
os.system("rm -f /data/dir_temp.txt")
print ("")
print ("Aborted")
print ("Your backup Directory is invalid")
elif (char41 == "9"):
os.system("cd /data; ls -d openpilot_* | grep -n openpilot_ | grep 9: | awk -F ':' '{print $2}' | tail -n 1 > dir_temp.txt")
fp = open('/data/dir_temp.txt', 'r')
dir_data = fp.readline()
fp.close()
if (dir_data != ""):
print ("")
print ("On copying your openpilot backup dir to openpilot...")
os.system("rm -f /data/dir_temp.txt")
os.system("cd /data; rm -rf openpilot; tdir=`ls -d openpilot_* | grep -n openpilot_ | grep 9: | awk -F ':' '{print $2}' | tail -n 1`; mv $tdir openpilot; cp -rfp openpilot $tdir")
os.system("cd /data; tfile=`ls -d openpilot_* | grep -n openpilot_ | grep 9: | awk -F 'openpilot_' '{print $2}' | tail -n 1`; cp -f kegman.json_$tfile kegman.json")
print ("Done. will reboot now...")
os.system("reboot")
else:
os.system("rm -f /data/dir_temp.txt")
print ("")
print ("Aborted")
print ("Your backup Directory is invalid")
elif (char4 == "p"):
os.system("cd /system/comma/home; ./op.sh")
elif (char == "5"):
os.system("clear")
print ("1. OPKR_0.7.3")
print ("2. OPKR_0.7.4")
print ("3. OPKR_0.7.5")
print ("4. OPKR_0.7.3_BOLT")
print ("5. OPKR_0.7.3_HKG_community")
print ("6. OPKR_0.7.3_ATOM")
print ("p. move to first menu")
print ("EXIT: anykey")
print ("")
print ("Select Branch you want to install(number)")
char5 = getch()
if (char5 == "1"):
os.system("cd /data; date +%Y%m%d%H%M%S > ctime.txt")
os.system("cd /data/openpilot; branch=`git branch | grep '*' | awk -F' ' '{print $2}' | tail -n 1`; cd /data; ct=`cat ctime.txt`; mv /data/openpilot /data/openpilot_${branch}_${ct}")
os.system("rm -f /data/ctime.txt")
os.system("cd /data; git clone https://github.com/multikyd/openpilot.git; cd openpilot; git checkout OPKR_0.7.3; reboot")
elif (char5 == "2"):
os.system("cd /data; date +%Y%m%d%H%M%S > ctime.txt")
os.system("cd /data/openpilot; branch=`git branch | grep '*' | awk -F' ' '{print $2}' | tail -n 1`; cd /data; ct=`cat ctime.txt`; mv /data/openpilot /data/openpilot_${branch}_${ct}")
os.system("rm -f /data/ctime.txt")
os.system("cd /data; git clone https://github.com/multikyd/openpilot.git; cd openpilot; git checkout OPKR_0.7.4; reboot")
elif (char5 == "3"):
os.system("cd /data; date +%Y%m%d%H%M%S > ctime.txt")
os.system("cd /data/openpilot; branch=`git branch | grep '*' | awk -F' ' '{print $2}' | tail -n 1`; cd /data; ct=`cat ctime.txt`; mv /data/openpilot /data/openpilot_${branch}_${ct}")
os.system("rm -f /data/ctime.txt")
os.system("cd /data; git clone https://github.com/multikyd/openpilot.git; cd openpilot; git checkout OPKR_0.7.5; reboot")
elif (char5 == "4"):
os.system("cd /data; date +%Y%m%d%H%M%S > ctime.txt")
os.system("cd /data/openpilot; branch=`git branch | grep '*' | awk -F' ' '{print $2}' | tail -n 1`; cd /data; ct=`cat ctime.txt`; mv /data/openpilot /data/openpilot_${branch}_${ct}")
os.system("rm -f /data/ctime.txt")
os.system("cd /data; git clone https://github.com/multikyd/openpilot.git; cd openpilot; git checkout OPKR_0.7.3_BOLT; reboot")
elif (char5 == "5"):
os.system("cd /data; date +%Y%m%d%H%M%S > ctime.txt")
os.system("cd /data/openpilot; branch=`git branch | grep '*' | awk -F' ' '{print $2}' | tail -n 1`; cd /data; ct=`cat ctime.txt`; mv /data/openpilot /data/openpilot_${branch}_${ct}")
os.system("rm -f /data/ctime.txt")
os.system("cd /data; git clone https://github.com/multikyd/openpilot.git; cd openpilot; git checkout OPKR_0.7.3_HKG_community; reboot")
elif (char5 == "6"):
os.system("cd /data; date +%Y%m%d%H%M%S > ctime.txt")
os.system("cd /data/openpilot; branch=`git branch | grep '*' | awk -F' ' '{print $2}' | tail -n 1`; cd /data; ct=`cat ctime.txt`; mv /data/openpilot /data/openpilot_${branch}_${ct}")
os.system("rm -f /data/ctime.txt")
os.system("cd /data; git clone https://github.com/multikyd/openpilot.git; cd openpilot; git checkout OPKR_0.7.3_ATOM; reboot")
elif (char5 == "p"):
os.system("cd /system/comma/home; ./op.sh")
elif (char == "6"):
print ("")
os.system("cd /data/openpilot; git pull")
print ("")
print ("Press p key to move first menu")
char6 = getch()
if (char6 == "p"):
os.system("cd /system/comma/home; ./op.sh")
elif (char == "7"):
print ("")
print ("Your current branch is")
os.system("cd /data/openpilot; git branch")
print ("")
print ("Press p key to move first menu")
char7 = getch()
if (char7 == "p"):
os.system("cd /system/comma/home; ./op.sh")
elif (char == "8"):
os.system("clear")
print ("1. OPKR_0.7.3")
print ("2. OPKR_0.7.4")
print ("3. OPKR_0.7.5")
print ("4. OPKR_0.7.3_BOLT")
print ("5. OPKR_0.7.3_HKG_community")
print ("6. OPKR_0.7.3_ATOM")
print ("p. move to first menu")
print ("EXIT: anykey")
print ("")
print ("Select Branch you want to change(number)")
print ("Changing the branch and reboot will occur automatically")
char8 = getch()
if (char8 == "1"):
os.system("cd /data/openpilot; git pull")
os.system("cd /data/openpilot; git checkout OPKR_0.7.3")
os.system("cd /data/openpilot; git pull")
os.system("reboot")
elif (char8 == "2"):
os.system("cd /data/openpilot; git pull")
os.system("cd /data/openpilot; git checkout OPKR_0.7.4")
os.system("cd /data/openpilot; git pull")
os.system("reboot")
elif (char8 == "3"):
os.system("cd /data/openpilot; git pull")
os.system("cd /data/openpilot; git checkout OPKR_0.7.5")
os.system("cd /data/openpilot; git pull")
os.system("reboot")
elif (char8 == "4"):
os.system("cd /data/openpilot; git pull")
os.system("cd /data/openpilot; git checkout OPKR_0.7.3_BOLT")
os.system("cd /data/openpilot; git pull")
os.system("reboot")
elif (char8 == "5"):
os.system("cd /data/openpilot; git pull")
os.system("cd /data/openpilot; git checkout OPKR_0.7.3_HKG_community")
os.system("cd /data/openpilot; git pull")
os.system("reboot")
elif (char8 == "6"):
os.system("cd /data/openpilot; git pull")
os.system("cd /data/openpilot; git checkout OPKR_0.7.3_ATOM")
os.system("cd /data/openpilot; git pull")
os.system("reboot")
elif (char8 == "p"):
os.system("cd /system/comma/home; ./op.sh")
elif (char == "t"):
os.system("cd /data/openpilot; ./tune.sh")
elif (char == "r"):
os.system("reboot") | 49.588101 | 274 | 0.548362 | 3,025 | 21,670 | 3.853554 | 0.070083 | 0.102256 | 0.075491 | 0.094879 | 0.811615 | 0.787767 | 0.783564 | 0.775414 | 0.753539 | 0.733036 | 0 | 0.018997 | 0.278542 | 21,670 | 437 | 275 | 49.588101 | 0.726621 | 0 | 0 | 0.5925 | 0 | 0.13 | 0.568917 | 0.021873 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0025 | false | 0 | 0.0125 | 0 | 0.0175 | 0.435 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 7 |
0d59494855d57068f86452caeb03310865f84624 | 29,674 | py | Python | avacloud_client_python/api/ava_conversion_api.py | Dangl-IT/avacloud-client-python | 66f555096bbbc87d02d02e4e2dfb0c6accb18f95 | [
"RSA-MD"
] | 1 | 2019-01-12T18:10:24.000Z | 2019-01-12T18:10:24.000Z | avacloud_client_python/api/ava_conversion_api.py | Dangl-IT/avacloud-client-python | 66f555096bbbc87d02d02e4e2dfb0c6accb18f95 | [
"RSA-MD"
] | null | null | null | avacloud_client_python/api/ava_conversion_api.py | Dangl-IT/avacloud-client-python | 66f555096bbbc87d02d02e4e2dfb0c6accb18f95 | [
"RSA-MD"
] | null | null | null | # coding: utf-8
"""
AVACloud API 1.17.3
AVACloud API specification # noqa: E501
OpenAPI spec version: 1.17.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from avacloud_client_python.api_client import ApiClient
class AvaConversionApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def ava_conversion_convert_to_ava(self, ava_project, **kwargs): # noqa: E501
"""Converts Dangl.AVA projects to Dangl.AVA. This is useful when you want to generate the calculated properties. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.ava_conversion_convert_to_ava(ava_project, async_req=True)
>>> result = thread.get()
:param async_req bool
:param ProjectDto ava_project: The Dangl.AVA project (required)
:param bool remove_plain_text_long_texts: If set to true, plain text long texts will be removed from the output to reduce response sizes
:param bool remove_html_long_texts: If set to true, html long texts will be removed from the output to reduce response sizes
:return: ProjectDto
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.ava_conversion_convert_to_ava_with_http_info(ava_project, **kwargs) # noqa: E501
else:
(data) = self.ava_conversion_convert_to_ava_with_http_info(ava_project, **kwargs) # noqa: E501
return data
def ava_conversion_convert_to_ava_with_http_info(self, ava_project, **kwargs): # noqa: E501
"""Converts Dangl.AVA projects to Dangl.AVA. This is useful when you want to generate the calculated properties. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.ava_conversion_convert_to_ava_with_http_info(ava_project, async_req=True)
>>> result = thread.get()
:param async_req bool
:param ProjectDto ava_project: The Dangl.AVA project (required)
:param bool remove_plain_text_long_texts: If set to true, plain text long texts will be removed from the output to reduce response sizes
:param bool remove_html_long_texts: If set to true, html long texts will be removed from the output to reduce response sizes
:return: ProjectDto
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ava_project', 'remove_plain_text_long_texts', 'remove_html_long_texts'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method ava_conversion_convert_to_ava" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ava_project' is set
if ('ava_project' not in params or
params['ava_project'] is None):
raise ValueError("Missing the required parameter `ava_project` when calling `ava_conversion_convert_to_ava`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'remove_plain_text_long_texts' in params:
query_params.append(('RemovePlainTextLongTexts', params['remove_plain_text_long_texts'])) # noqa: E501
if 'remove_html_long_texts' in params:
query_params.append(('RemoveHtmlLongTexts', params['remove_html_long_texts'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'ava_project' in params:
body_params = params['ava_project']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/vnd.com.dangl-it.ProjectDto.v1+json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']) # noqa: E501
# Authentication setting
auth_settings = ['Dangl.Identity'] # noqa: E501
return self.api_client.call_api(
'/conversion/ava/ava', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='ProjectDto', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def ava_conversion_convert_to_excel(self, ava_project, **kwargs): # noqa: E501
"""Converts Dangl.AVA projects to Excel # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.ava_conversion_convert_to_excel(ava_project, async_req=True)
>>> result = thread.get()
:param async_req bool
:param ProjectDto ava_project: The Dangl.AVA project (required)
:param bool write_prices: Defaults to true
:param bool write_long_texts: Defaults to true
:param str conversion_culture: The culture that should be used for the conversion process, to have localized Excel files
:return: file
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.ava_conversion_convert_to_excel_with_http_info(ava_project, **kwargs) # noqa: E501
else:
(data) = self.ava_conversion_convert_to_excel_with_http_info(ava_project, **kwargs) # noqa: E501
return data
def ava_conversion_convert_to_excel_with_http_info(self, ava_project, **kwargs): # noqa: E501
"""Converts Dangl.AVA projects to Excel # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.ava_conversion_convert_to_excel_with_http_info(ava_project, async_req=True)
>>> result = thread.get()
:param async_req bool
:param ProjectDto ava_project: The Dangl.AVA project (required)
:param bool write_prices: Defaults to true
:param bool write_long_texts: Defaults to true
:param str conversion_culture: The culture that should be used for the conversion process, to have localized Excel files
:return: file
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ava_project', 'write_prices', 'write_long_texts', 'conversion_culture'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method ava_conversion_convert_to_excel" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ava_project' is set
if ('ava_project' not in params or
params['ava_project'] is None):
raise ValueError("Missing the required parameter `ava_project` when calling `ava_conversion_convert_to_excel`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'write_prices' in params:
query_params.append(('WritePrices', params['write_prices'])) # noqa: E501
if 'write_long_texts' in params:
query_params.append(('WriteLongTexts', params['write_long_texts'])) # noqa: E501
if 'conversion_culture' in params:
query_params.append(('ConversionCulture', params['conversion_culture'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'ava_project' in params:
body_params = params['ava_project']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']) # noqa: E501
# Authentication setting
auth_settings = ['Dangl.Identity'] # noqa: E501
return self.api_client.call_api(
'/conversion/ava/excel', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='file', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def ava_conversion_convert_to_gaeb(self, ava_project, **kwargs): # noqa: E501
"""Converts Dangl.AVA projects to GAEB # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.ava_conversion_convert_to_gaeb(ava_project, async_req=True)
>>> result = thread.get()
:param async_req bool
:param ProjectDto ava_project: The Dangl.AVA project (required)
:param str destination_gaeb_type: Defaults to GAEB XML V3.2
:param str target_exchange_phase_transform: Defaults to none, meaning no transformation will be done
:param bool enforce_strict_offer_phase_long_text_output: Defaults to false. If this is enabled, exported long texts to GAEB XML that use text additions will be strictly schema compliant. If this is not enabled, any text that is marked to contain a text addition is exported in full to ensure that incorrectly used text additions are still preserved in the export.
:return: file
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.ava_conversion_convert_to_gaeb_with_http_info(ava_project, **kwargs) # noqa: E501
else:
(data) = self.ava_conversion_convert_to_gaeb_with_http_info(ava_project, **kwargs) # noqa: E501
return data
def ava_conversion_convert_to_gaeb_with_http_info(self, ava_project, **kwargs): # noqa: E501
"""Converts Dangl.AVA projects to GAEB # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.ava_conversion_convert_to_gaeb_with_http_info(ava_project, async_req=True)
>>> result = thread.get()
:param async_req bool
:param ProjectDto ava_project: The Dangl.AVA project (required)
:param str destination_gaeb_type: Defaults to GAEB XML V3.2
:param str target_exchange_phase_transform: Defaults to none, meaning no transformation will be done
:param bool enforce_strict_offer_phase_long_text_output: Defaults to false. If this is enabled, exported long texts to GAEB XML that use text additions will be strictly schema compliant. If this is not enabled, any text that is marked to contain a text addition is exported in full to ensure that incorrectly used text additions are still preserved in the export.
:return: file
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ava_project', 'destination_gaeb_type', 'target_exchange_phase_transform', 'enforce_strict_offer_phase_long_text_output'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method ava_conversion_convert_to_gaeb" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ava_project' is set
if ('ava_project' not in params or
params['ava_project'] is None):
raise ValueError("Missing the required parameter `ava_project` when calling `ava_conversion_convert_to_gaeb`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'destination_gaeb_type' in params:
query_params.append(('DestinationGaebType', params['destination_gaeb_type'])) # noqa: E501
if 'target_exchange_phase_transform' in params:
query_params.append(('TargetExchangePhaseTransform', params['target_exchange_phase_transform'])) # noqa: E501
if 'enforce_strict_offer_phase_long_text_output' in params:
query_params.append(('EnforceStrictOfferPhaseLongTextOutput', params['enforce_strict_offer_phase_long_text_output'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'ava_project' in params:
body_params = params['ava_project']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']) # noqa: E501
# Authentication setting
auth_settings = ['Dangl.Identity'] # noqa: E501
return self.api_client.call_api(
'/conversion/ava/gaeb', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='file', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def ava_conversion_convert_to_oenorm(self, ava_project, **kwargs): # noqa: E501
"""Converts Dangl.AVA projects to Oenorm # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.ava_conversion_convert_to_oenorm(ava_project, async_req=True)
>>> result = thread.get()
:param async_req bool
:param ProjectDto ava_project: The Dangl.AVA project (required)
:param str destination_oenorm_type: Defaults to Lv2015
:param bool try_repair_project_structure: Defaults to false. If this is enabled, the converter will try to ensure that the project structure can be mapped to Oenorm. It might introduce additional group levels to ensure a compatible target
:return: file
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.ava_conversion_convert_to_oenorm_with_http_info(ava_project, **kwargs) # noqa: E501
else:
(data) = self.ava_conversion_convert_to_oenorm_with_http_info(ava_project, **kwargs) # noqa: E501
return data
def ava_conversion_convert_to_oenorm_with_http_info(self, ava_project, **kwargs): # noqa: E501
"""Converts Dangl.AVA projects to Oenorm # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.ava_conversion_convert_to_oenorm_with_http_info(ava_project, async_req=True)
>>> result = thread.get()
:param async_req bool
:param ProjectDto ava_project: The Dangl.AVA project (required)
:param str destination_oenorm_type: Defaults to Lv2015
:param bool try_repair_project_structure: Defaults to false. If this is enabled, the converter will try to ensure that the project structure can be mapped to Oenorm. It might introduce additional group levels to ensure a compatible target
:return: file
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ava_project', 'destination_oenorm_type', 'try_repair_project_structure'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method ava_conversion_convert_to_oenorm" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ava_project' is set
if ('ava_project' not in params or
params['ava_project'] is None):
raise ValueError("Missing the required parameter `ava_project` when calling `ava_conversion_convert_to_oenorm`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'destination_oenorm_type' in params:
query_params.append(('DestinationOenormType', params['destination_oenorm_type'])) # noqa: E501
if 'try_repair_project_structure' in params:
query_params.append(('TryRepairProjectStructure', params['try_repair_project_structure'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'ava_project' in params:
body_params = params['ava_project']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']) # noqa: E501
# Authentication setting
auth_settings = ['Dangl.Identity'] # noqa: E501
return self.api_client.call_api(
'/conversion/ava/oenorm', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='file', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def ava_conversion_convert_to_reb(self, ava_project, **kwargs): # noqa: E501
"""Converts Dangl.AVA projects to REB # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.ava_conversion_convert_to_reb(ava_project, async_req=True)
>>> result = thread.get()
:param async_req bool
:param ProjectDto ava_project: The Dangl.AVA project (required)
:return: file
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.ava_conversion_convert_to_reb_with_http_info(ava_project, **kwargs) # noqa: E501
else:
(data) = self.ava_conversion_convert_to_reb_with_http_info(ava_project, **kwargs) # noqa: E501
return data
def ava_conversion_convert_to_reb_with_http_info(self, ava_project, **kwargs): # noqa: E501
"""Converts Dangl.AVA projects to REB # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.ava_conversion_convert_to_reb_with_http_info(ava_project, async_req=True)
>>> result = thread.get()
:param async_req bool
:param ProjectDto ava_project: The Dangl.AVA project (required)
:return: file
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ava_project'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method ava_conversion_convert_to_reb" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ava_project' is set
if ('ava_project' not in params or
params['ava_project'] is None):
raise ValueError("Missing the required parameter `ava_project` when calling `ava_conversion_convert_to_reb`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'ava_project' in params:
body_params = params['ava_project']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']) # noqa: E501
# Authentication setting
auth_settings = ['Dangl.Identity'] # noqa: E501
return self.api_client.call_api(
'/conversion/ava/reb', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='file', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def ava_conversion_convert_to_sia(self, ava_project, **kwargs): # noqa: E501
"""Converts Dangl.AVA projects to SIA 451 # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.ava_conversion_convert_to_sia(ava_project, async_req=True)
>>> result = thread.get()
:param async_req bool
:param ProjectDto ava_project: The Dangl.AVA project (required)
:return: file
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.ava_conversion_convert_to_sia_with_http_info(ava_project, **kwargs) # noqa: E501
else:
(data) = self.ava_conversion_convert_to_sia_with_http_info(ava_project, **kwargs) # noqa: E501
return data
def ava_conversion_convert_to_sia_with_http_info(self, ava_project, **kwargs): # noqa: E501
"""Converts Dangl.AVA projects to SIA 451 # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.ava_conversion_convert_to_sia_with_http_info(ava_project, async_req=True)
>>> result = thread.get()
:param async_req bool
:param ProjectDto ava_project: The Dangl.AVA project (required)
:return: file
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ava_project'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method ava_conversion_convert_to_sia" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ava_project' is set
if ('ava_project' not in params or
params['ava_project'] is None):
raise ValueError("Missing the required parameter `ava_project` when calling `ava_conversion_convert_to_sia`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'ava_project' in params:
body_params = params['ava_project']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json', 'application/problem+json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']) # noqa: E501
# Authentication setting
auth_settings = ['Dangl.Identity'] # noqa: E501
return self.api_client.call_api(
'/conversion/ava/sia', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='file', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
| 45.165906 | 371 | 0.646391 | 3,586 | 29,674 | 5.074456 | 0.068321 | 0.056053 | 0.052756 | 0.058032 | 0.939056 | 0.924493 | 0.913777 | 0.901962 | 0.900643 | 0.891301 | 0 | 0.0138 | 0.267406 | 29,674 | 656 | 372 | 45.234756 | 0.823267 | 0.348925 | 0 | 0.764873 | 1 | 0 | 0.247887 | 0.10495 | 0 | 0 | 0 | 0 | 0 | 1 | 0.036827 | false | 0 | 0.011331 | 0 | 0.101983 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
0d67c3ffdcd298a32ead64162538e6c1dc3b1249 | 13,831 | py | Python | bingads/v13/bulk/download_parameters.py | pawelulita/BingAds-Python-SDK | e7b5a618e87a43d0a5e2c79d9aa4626e208797bd | [
"MIT"
] | 86 | 2016-02-29T03:24:28.000Z | 2022-03-29T09:30:21.000Z | bingads/v13/bulk/download_parameters.py | pawelulita/BingAds-Python-SDK | e7b5a618e87a43d0a5e2c79d9aa4626e208797bd | [
"MIT"
] | 135 | 2016-04-12T13:31:28.000Z | 2022-03-29T02:18:51.000Z | bingads/v13/bulk/download_parameters.py | pawelulita/BingAds-Python-SDK | e7b5a618e87a43d0a5e2c79d9aa4626e208797bd | [
"MIT"
] | 154 | 2016-04-08T04:11:27.000Z | 2022-03-29T21:21:07.000Z | import os
class DownloadParameters:
""" Describes the related parameters when downloading file from server.
such as the type of entities and data scope that you want to download.
"""
def __init__(self,
result_file_directory=None,
result_file_name=None,
overwrite_result_file=False,
data_scope=None,
download_entities=None,
file_type='Csv',
campaign_ids=None,
last_sync_time_in_utc=None,
timeout_in_milliseconds=None):
""" Initialize an instance of this class.
:param result_file_directory: (optional) The directory where the file will be downloaded.
:type result_file_directory: str
:param result_file_name: (optional) The name of the download result file.
:type result_file_name: str
:param overwrite_result_file: (optional) Whether the local result file should be overwritten if it already exists, default is False.
:type overwrite_result_file: bool
:param data_scope: (optional) The scope or types of data to download.
For possible values, see DataScope Value Set at https://go.microsoft.com/fwlink/?linkid=846127.
:type data_scope: list[str]
:param download_entities: (optional) The type of entities to download.
For possible values, see BulkDownloadEntity Value Set at https://go.microsoft.com/fwlink/?linkid=846127.
:type download_entities: list[str]
:param file_type: (optional) The extension type of the downloaded file.
For possible values, see DownloadFileType Value Set at https://go.microsoft.com/fwlink/?linkid=846127.
:type file_type: str
:param campaign_ids: (optional) The campaigns to download.
You can specify a maximum of 1,000 campaigns. The campaigns that you specify must belong to the same account.
:type campaign_ids: list[int]
:param last_sync_time_in_utc: (optional) The last time that you requested a download.
The date and time is expressed in Coordinated Universal Time (UTC).
Typically, you request a full download the first time you call the operation by setting this element to null.
On all subsequent calls you set the last sync time to the time stamp of the previous download.
The download file contains the time stamp of the download in the SyncTime column of the Account record.
Use the time stamp to set LastSyncTimeInUTC the next time that you request a download.
If you specify the last sync time, only those entities that have changed (been updated or deleted)
since the specified date and time will be downloaded. However, if the campaign data has not been previously downloaded,
the operation performs a full download.
:type last_sync_time_in_utc: datetime
:param timeout_in_milliseconds: (optional) timeout for bulk download operations in milliseconds
:type timeout_in_milliseconds: int
"""
self._result_file_directory = result_file_directory
self._result_file_name = result_file_name
self._decompress_result_file = True
if result_file_name is not None:
_, ext = os.path.splitext(result_file_name)
if ext == '.zip':
self._decompress_result_file = False
self._overwrite_result_file = overwrite_result_file
self._submit_download_parameter = SubmitDownloadParameters(
data_scope=data_scope,
download_entities=download_entities,
file_type=file_type,
campaign_ids=campaign_ids,
last_sync_time_in_utc=last_sync_time_in_utc,
)
self._timeout_in_milliseconds = timeout_in_milliseconds
@property
def result_file_directory(self):
""" The directory where the file will be downloaded.
:rtype: str
"""
return self._result_file_directory
@property
def result_file_name(self):
""" The name of the download result file.
:rtype: str
"""
return self._result_file_name
@property
def overwrite_result_file(self):
""" Whether the local result file should be overwritten if it already exists.
:rtype: bool
"""
return self._overwrite_result_file
@result_file_directory.setter
def result_file_directory(self, result_file_directory):
self._result_file_directory = result_file_directory
@result_file_name.setter
def result_file_name(self, result_file_name):
self._result_file_name = result_file_name
@overwrite_result_file.setter
def overwrite_result_file(self, overwrite):
self._overwrite_result_file = overwrite
@property
def decompress_result_file(self):
""" If need to decompress the result file after download.
This property is determined by the result_file_name, by default will do decompression.
if the result_file_name has the extension of '.zip' then do not do decompression.
:rtype: bool
"""
return self._decompress_result_file
@property
def data_scope(self):
""" The scope or types of data to download.
For possible values, see DataScope Value Set at https://go.microsoft.com/fwlink/?linkid=846127.
:rtype: list[str]
"""
return self._submit_download_parameter.data_scope
@data_scope.setter
def data_scope(self, value):
self._submit_download_parameter.data_scope = value
@property
def download_entities(self):
""" The type of entities to download.
For possible values, see BulkDownloadEntity Value Set at https://go.microsoft.com/fwlink/?linkid=846127.
:rtype: list[str]
"""
return self._submit_download_parameter.download_entities
@download_entities.setter
def download_entities(self, value):
self._submit_download_parameter.download_entities = value
@property
def file_type(self):
""" The extension type of the downloaded file.
For possible values, see DownloadFileType Value Set at https://go.microsoft.com/fwlink/?linkid=846127.
:rtype: str
"""
return self._submit_download_parameter.file_type
@file_type.setter
def file_type(self, value):
self._submit_download_parameter.file_type = value
@property
def campaign_ids(self):
""" The campaigns to download.
You can specify a maximum of 1,000 campaigns. The campaigns that you specify must belong to the same account.
:rtype: list[int]
"""
return self._submit_download_parameter.campaign_ids
@campaign_ids.setter
def campaign_ids(self, value):
self._submit_download_parameter.campaign_ids = value
@property
def last_sync_time_in_utc(self):
""" The last time that you requested a download.
The date and time is expressed in Coordinated Universal Time (UTC).
Typically, you request a full download the first time you call the operation by setting this element to null.
On all subsequent calls you set the last sync time to the time stamp of the previous download.
The download file contains the time stamp of the download in the SyncTime column of the Account record.
Use the time stamp to set LastSyncTimeInUTC the next time that you request a download.
If you specify the last sync time, only those entities that have changed (been updated or deleted)
since the specified date and time will be downloaded. However, if the campaign data has not been previously downloaded,
the operation performs a full download.
:rtype: datetime
"""
return self._submit_download_parameter.last_sync_time_in_utc
@last_sync_time_in_utc.setter
def last_sync_time_in_utc(self, value):
self._submit_download_parameter.last_sync_time_in_utc = value
@property
def timeout_in_milliseconds(self):
return self._timeout_in_milliseconds
@timeout_in_milliseconds.setter
def timeout_in_milliseconds(self, value):
self._timeout_in_milliseconds = value
class SubmitDownloadParameters(object):
""" Describes the service request parameters such as the type of entities and data scope that you want to download. """
def __init__(self,
data_scope=None,
download_entities=None,
file_type='Csv',
campaign_ids=None,
last_sync_time_in_utc=None):
""" Initialize an object of this class.
:param data_scope: (optional) The scope or types of data to download.
For possible values, see DataScope Value Set at https://go.microsoft.com/fwlink/?linkid=846127.
:type data_scope: list[str]
:param download_entities: (optional) The type of entities to download.
For possible values, see BulkDownloadEntity Value Set at https://go.microsoft.com/fwlink/?linkid=846127.
:type download_entities: list[str]
:param file_type: (optional) The extension type of the downloaded file.
For possible values, see DownloadFileType Value Set at https://go.microsoft.com/fwlink/?linkid=846127.
:type file_type: str
:param campaign_ids: (optional) The campaigns to download.
You can specify a maximum of 1,000 campaigns. The campaigns that you specify must belong to the same account.
:type campaign_ids: list[int]
:param last_sync_time_in_utc: (optional) The last time that you requested a download.
The date and time is expressed in Coordinated Universal Time (UTC).
Typically, you request a full download the first time you call the operation by setting this element to null.
On all subsequent calls you set the last sync time to the time stamp of the previous download.
The download file contains the time stamp of the download in the SyncTime column of the Account record.
Use the time stamp to set LastSyncTimeInUTC the next time that you request a download.
If you specify the last sync time, only those entities that have changed (been updated or deleted)
since the specified date and time will be downloaded. However, if the campaign data has not been previously downloaded,
the operation performs a full download.
:type last_sync_time_in_utc: datetime
"""
self._data_scope = data_scope
self._download_entities = download_entities
self._file_type = file_type
self._campaign_ids = campaign_ids
self._last_sync_time_in_utc = last_sync_time_in_utc
@property
def data_scope(self):
""" The scope or types of data to download.
For possible values, see DataScope Value Set at https://go.microsoft.com/fwlink/?linkid=846127.
:rtype: list[str]
"""
return self._data_scope
@data_scope.setter
def data_scope(self, value):
self._data_scope = value
@property
def download_entities(self):
""" The type of entities to download.
For possible values, see BulkDownloadEntity Value Set at https://go.microsoft.com/fwlink/?linkid=846127.
:rtype: list[str]
"""
return self._download_entities
@download_entities.setter
def download_entities(self, value):
self._download_entities = value
@property
def file_type(self):
""" The extension type of the downloaded file.
For possible values, see DownloadFileType Value Set at https://go.microsoft.com/fwlink/?linkid=846127.
:rtype: str
"""
return self._file_type
@file_type.setter
def file_type(self, value):
self._file_type = value
@property
def campaign_ids(self):
""" The campaigns to download.
You can specify a maximum of 1,000 campaigns. The campaigns that you specify must belong to the same account.
:rtype: list[int]
"""
return self._campaign_ids
@campaign_ids.setter
def campaign_ids(self, value):
self._campaign_ids = value
@property
def last_sync_time_in_utc(self):
""" The last time that you requested a download.
The date and time is expressed in Coordinated Universal Time (UTC).
Typically, you request a full download the first time you call the operation by setting this element to null.
On all subsequent calls you set the last sync time to the time stamp of the previous download.
The download file contains the time stamp of the download in the SyncTime column of the Account record.
Use the time stamp to set LastSyncTimeInUTC the next time that you request a download.
If you specify the last sync time, only those entities that have changed (been updated or deleted)
since the specified date and time will be downloaded. However, if the campaign data has not been previously downloaded,
the operation performs a full download.
:rtype: datetime
"""
return self._last_sync_time_in_utc
@last_sync_time_in_utc.setter
def last_sync_time_in_utc(self, value):
self._last_sync_time_in_utc = value
| 41.286567 | 147 | 0.666257 | 1,787 | 13,831 | 4.968663 | 0.092893 | 0.052934 | 0.037842 | 0.031535 | 0.85156 | 0.81338 | 0.78849 | 0.746368 | 0.737358 | 0.730262 | 0 | 0.008809 | 0.277709 | 13,831 | 334 | 148 | 41.41018 | 0.87998 | 0.571325 | 0 | 0.464567 | 0 | 0 | 0.002028 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.244094 | false | 0 | 0.007874 | 0.007874 | 0.385827 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
0d703e57f90c18985cb07356a9d97fed0613e167 | 2,117 | py | Python | ui.py | OrionDark7/alakajam5 | 44018a0b02b0110a5da1261fa8bbc49f3014125b | [
"MIT"
] | null | null | null | ui.py | OrionDark7/alakajam5 | 44018a0b02b0110a5da1261fa8bbc49f3014125b | [
"MIT"
] | null | null | null | ui.py | OrionDark7/alakajam5 | 44018a0b02b0110a5da1261fa8bbc49f3014125b | [
"MIT"
] | null | null | null | import pygame
class button(pygame.sprite.Sprite):
def __init__(self, text, pos):
pygame.sprite.Sprite.__init__(self)
self.font = pygame.font.Font("./font/Lobster_1.3.otf", 24)
self.text = str(text)
self.image = self.font.render(str(text), 1, [0, 0, 0])
self.rect = self.image.get_rect()
self.rect.left, self.rect.top = list(pos)
self.clicked = False
def click(self, mouse):
if self.rect.collidepoint(mouse):
self.clicked = True
return self.clicked
def draw(self, surf):
surf.blit(self.image, [self.rect.left, self.rect.top])
def reset(self):
self.clicked = False
def color(self, color):
self.image = self.font.render(self.text, 1, list(color))
class bigbutton(pygame.sprite.Sprite):
def __init__(self, text, pos):
pygame.sprite.Sprite.__init__(self)
self.font = pygame.font.Font("./font/Lobster_1.3.otf", 48)
self.text = str(text)
self.image = self.font.render(str(text), 1, [0, 0, 0])
self.rect = self.image.get_rect()
self.rect.left, self.rect.top = list(pos)
self.clicked = False
def click(self, mouse):
if self.rect.collidepoint(mouse):
self.clicked = True
return self.clicked
def draw(self, surf):
surf.blit(self.image, [self.rect.left, self.rect.top])
def reset(self):
self.clicked = False
def color(self, color):
self.image = self.font.render(self.text, 1, list(color))
class imagebutton(pygame.sprite.Sprite):
def __init__(self, image, pos):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load("./images/"+str(image))
#self.image = pygame.transform.scale(self.image, list(size))
self.rect = self.image.get_rect()
self.rect.left, self.rect.top = list(pos)
def click(self, mouse):
clicked = False
if self.rect.collidepoint(mouse):
clicked = True
return clicked
def draw(self, surf):
surf.blit(self.image, [self.rect.left, self.rect.top]) | 35.283333 | 68 | 0.611242 | 291 | 2,117 | 4.347079 | 0.158076 | 0.113834 | 0.071937 | 0.075889 | 0.859289 | 0.837945 | 0.81502 | 0.788933 | 0.788933 | 0.788933 | 0 | 0.011271 | 0.245631 | 2,117 | 60 | 69 | 35.283333 | 0.780839 | 0.02787 | 0 | 0.788462 | 0 | 0 | 0.025753 | 0.02138 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.019231 | 0 | 0.384615 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
0dca5bd37948d8a98a879b4c4648d1604fa2f720 | 9,823 | py | Python | tests/tests/test_views.py | maykinmedia/djadyen | 8bde7172c72d68975d4a77c7ef6bed73412619dc | [
"BSD-3-Clause"
] | 3 | 2018-10-19T06:57:50.000Z | 2020-11-12T11:20:37.000Z | tests/tests/test_views.py | maykinmedia/djadyen | 8bde7172c72d68975d4a77c7ef6bed73412619dc | [
"BSD-3-Clause"
] | 16 | 2017-02-14T12:37:58.000Z | 2019-04-25T07:55:42.000Z | tests/tests/test_views.py | maykinmedia/djadyen | 8bde7172c72d68975d4a77c7ef6bed73412619dc | [
"BSD-3-Clause"
] | 2 | 2018-05-16T10:08:34.000Z | 2019-09-29T23:31:04.000Z | from django.test import override_settings
from django.urls import reverse
from django_webtest import WebTest
from webtest import AppError
from djadyen import settings
from djadyen.hpp import sign_params
from .factories import IssuerFactory, OrderFactory, PaymentOptionsFactory
class MyRedirectViewTests(WebTest):
def setUp(self):
self.order = OrderFactory()
self.url = reverse('redirect', kwargs={'reference': self.order.reference})
def test_redirection_page(self):
response = self.app.get(self.url)
self.assertEqual(response.status_code, 200)
form = response.forms['redirect-form']
response = form.submit()
self.assertEqual(response.status_code, 302)
def test_redirection_page_with_brand_code(self):
self.order.payment_option = PaymentOptionsFactory()
self.order.save()
response = self.app.get(self.url)
self.assertEqual(response.status_code, 200)
form = response.forms['redirect-form']
response = form.submit()
self.assertEqual(response.status_code, 302)
def test_redirection_page_with_issuer(self):
payment_option = PaymentOptionsFactory()
self.order.payment_option = payment_option
self.order.issuer = IssuerFactory(payment_option=payment_option)
self.order.save()
response = self.app.get(self.url)
self.assertEqual(response.status_code, 200)
form = response.forms['redirect-form']
response = form.submit()
self.assertEqual(response.status_code, 302)
@override_settings(ADYEN_ENABLED=True)
def test_redirection_page_adyen_enabled(self):
response = self.app.get(self.url)
self.assertEqual(response.status_code, 200)
form = response.forms['redirect-form']
with self.assertRaises(AppError):
response = form.submit()
@override_settings(ADYEN_ENABLED=True)
def test_redirection_page_with_brand_code_adyen_enabled(self):
self.order.payment_option = PaymentOptionsFactory()
self.order.save()
response = self.app.get(self.url)
self.assertEqual(response.status_code, 200)
form = response.forms['redirect-form']
with self.assertRaises(AppError):
response = form.submit()
@override_settings(ADYEN_ENABLED=True)
def test_redirection_page_with_issuer_adyen_enabled(self):
payment_option = PaymentOptionsFactory()
self.order.payment_option = payment_option
self.order.issuer = IssuerFactory(payment_option=payment_option)
self.order.save()
response = self.app.get(self.url)
self.assertEqual(response.status_code, 200)
form = response.forms['redirect-form']
with self.assertRaises(AppError):
response = form.submit()
@override_settings(ADYEN_ENABLED=True)
def test_redirection_page_post_with_adyen_enabled(self):
response = self.app.get(self.url)
self.assertEqual(response.status_code, 200)
form = response.forms['redirect-form']
with self.assertRaises(AppError):
response = form.submit()
class My2RedirectViewTests(WebTest):
def setUp(self):
self.order = OrderFactory(email='')
self.url = reverse('redirect2', kwargs={'reference': self.order.reference})
def test_redirection_page(self):
response = self.app.get(self.url)
self.assertEqual(response.status_code, 200)
form = response.forms['redirect-form']
response = form.submit()
self.assertEqual(response.status_code, 302)
def test_redirection_page_no_email(self):
response = self.app.get(self.url)
self.assertEqual(response.status_code, 200)
form = response.forms['redirect-form']
response = form.submit()
self.assertEqual(response.status_code, 302)
class My3RedirectViewTests(WebTest):
def setUp(self):
self.order = OrderFactory(email='')
self.url = reverse('redirect3', kwargs={'reference': self.order.reference})
def test_redirection_page(self):
self.order.email = ''
self.order.save()
with self.assertRaises(NotImplementedError):
response = self.app.get(self.url)
class ConfirmationView(WebTest):
def setUp(self):
self.order = OrderFactory()
self.url = reverse('confirm')
self.params = {
'merchantReturnData': 'test',
'paymentMethod': 'ideal',
'reason': 'test',
'shopperLocale': 'test',
'skinCode': 'test',
'merchantReference': self.order.reference
}
def _get_csrf_token(self):
url = reverse('redirect', kwargs={'reference': self.order.reference})
response = self.app.get(url)
return response.forms[0]['csrfmiddlewaretoken'].value
def test_empty_get(self):
with self.assertRaises(AppError):
self.app.get(self.url)
def test_wrong_signature_response(self):
params = {
'merchantReference': self.order.reference
}
response = self.app.get(self.url, params=params)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.text, '\n Success!\n\n')
def test_error_response(self):
self.params['authResult'] = 'ERROR'
params = sign_params(self.params)
response = self.app.get(self.url, params=params)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.text, '\n Success!\n\n')
def test_cancelled_response(self):
self.params['authResult'] = 'CANCELLED'
params = sign_params(self.params)
response = self.app.get(self.url, params=params)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.text, '\n Success!\n\n')
def test_refused_response(self):
self.params['authResult'] = 'REFUSED'
params = sign_params(self.params)
response = self.app.get(self.url, params=params)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.text, '\n Success!\n\n')
def test_pending_response(self):
self.params['authResult'] = 'PENDING'
params = sign_params(self.params)
response = self.app.get(self.url, params=params)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.text, '\n Success!\n\n')
def test_authorised_response(self):
self.params['authResult'] = 'AUTHORISED'
params = sign_params(self.params)
response = self.app.get(self.url, params=params)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.text, '\n Success!\n\n')
def test_other_response(self):
self.params['authResult'] = 'OTHER'
params = sign_params(self.params)
response = self.app.get(self.url, params=params)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.text, '\n Success!\n\n')
def test_post(self):
self.params['authResult'] = 'AUTHORISED'
params = sign_params(self.params)
params['csrfmiddlewaretoken'] = self._get_csrf_token()
response = self.app.post(self.url, params=params)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.text, '\n Success!\n\n')
def test_psp_reference(self):
self.params['pspReference'] = 'reference'
params = sign_params(self.params)
params['csrfmiddlewaretoken'] = self._get_csrf_token()
response = self.app.post(self.url, params=params)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.text, '\n Success!\n\n')
class Confirmation2View(WebTest):
def setUp(self):
self.order = OrderFactory()
self.url = reverse('confirm2')
self.params = {
'merchantReturnData': 'test',
'paymentMethod': 'ideal',
'reason': 'test',
'shopperLocale': 'test',
'skinCode': 'test',
'merchantReference': self.order.reference,
'pspReference': 'reference'
}
def test_wrong_signature_response(self):
params = {
'merchantReference': self.order.reference
}
with self.assertRaises(NotImplementedError):
self.app.get(self.url, params=params)
def test_error_response(self):
self.params['authResult'] = 'ERROR'
params = sign_params(self.params)
with self.assertRaises(NotImplementedError):
self.app.get(self.url, params=params)
def test_cancelled_response(self):
self.params['authResult'] = 'CANCELLED'
params = sign_params(self.params)
with self.assertRaises(NotImplementedError):
self.app.get(self.url, params=params)
def test_refused_response(self):
self.params['authResult'] = 'REFUSED'
params = sign_params(self.params)
with self.assertRaises(NotImplementedError):
self.app.get(self.url, params=params)
def test_pending_response(self):
self.params['authResult'] = 'PENDING'
params = sign_params(self.params)
with self.assertRaises(NotImplementedError):
self.app.get(self.url, params=params)
def test_authorised_response(self):
self.params['authResult'] = 'AUTHORISED'
params = sign_params(self.params)
with self.assertRaises(NotImplementedError):
self.app.get(self.url, params=params)
def test_other_response(self):
self.params['authResult'] = 'OTHER'
params = sign_params(self.params)
with self.assertRaises(NotImplementedError):
self.app.get(self.url, params=params)
| 36.113971 | 83 | 0.654179 | 1,084 | 9,823 | 5.793358 | 0.083948 | 0.064968 | 0.117197 | 0.055732 | 0.892675 | 0.889968 | 0.884076 | 0.878344 | 0.878344 | 0.859713 | 0 | 0.010045 | 0.229767 | 9,823 | 271 | 84 | 36.247232 | 0.819984 | 0 | 0 | 0.817352 | 0 | 0 | 0.093149 | 0 | 0 | 0 | 0 | 0 | 0.205479 | 1 | 0.150685 | false | 0 | 0.031963 | 0 | 0.210046 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
21837f5a364abf135441597bc83f2e3b2baa248a | 145,860 | py | Python | StressTesting/client.py | CDU55/FakeNews | 707bd48dd78851081d98ad21bbdadfc2720bd644 | [
"MIT"
] | null | null | null | StressTesting/client.py | CDU55/FakeNews | 707bd48dd78851081d98ad21bbdadfc2720bd644 | [
"MIT"
] | 37 | 2020-10-20T08:30:53.000Z | 2020-12-22T13:15:45.000Z | StressTesting/client.py | CDU55/FakeNews | 707bd48dd78851081d98ad21bbdadfc2720bd644 | [
"MIT"
] | 1 | 2020-10-19T14:55:23.000Z | 2020-10-19T14:55:23.000Z | import requests
import sys
import time
import threading
html="""
<!DOCTYPE html>
<html dir="ltr" lang="en" style="font-size: 15px;"><head><meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover">
<link rel="preconnect" href="//abs.twimg.com">
<link rel="preconnect" href="//api.twitter.com">
<link rel="preconnect" href="//pbs.twimg.com">
<link rel="preconnect" href="//t.co">
<link rel="preconnect" href="//video.twimg.com">
<link rel="dns-prefetch" href="//abs.twimg.com">
<link rel="dns-prefetch" href="//api.twitter.com">
<link rel="dns-prefetch" href="//pbs.twimg.com">
<link rel="dns-prefetch" href="//t.co">
<link rel="dns-prefetch" href="//video.twimg.com">
<link rel="preload" as="script" crossorigin="anonymous" href="https://abs.twimg.com/responsive-web/client-web/polyfills.18a65025.js" nonce="">
<link rel="preload" as="script" crossorigin="anonymous" href="https://abs.twimg.com/responsive-web/client-web/vendors~main.cf4df3f5.js" nonce="">
<link rel="preload" as="script" crossorigin="anonymous" href="https://abs.twimg.com/responsive-web/client-web/i18n/en.228ce9a5.js" nonce="">
<link rel="preload" as="script" crossorigin="anonymous" href="https://abs.twimg.com/responsive-web/client-web/main.972687a5.js" nonce="">
<meta property="fb:app_id" content="2231777543">
<meta property="og:site_name" content="Twitter">
<meta name="google-site-verification" content="V0yIS0Ec_o3Ii9KThrCoMCkwTYMMJ_JYx_RSaGhFYvw">
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials">
<link rel="alternate" hreflang="x-default" href="https://twitter.com/realdonaldtrump/status/1336148836495069185">
<link rel="alternate" hreflang="ar" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ar">
<link rel="alternate" hreflang="bg" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=bg">
<link rel="alternate" hreflang="bn" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=bn">
<link rel="alternate" hreflang="ca" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ca">
<link rel="alternate" hreflang="cs" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=cs">
<link rel="alternate" hreflang="da" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=da">
<link rel="alternate" hreflang="de" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=de">
<link rel="alternate" hreflang="el" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=el">
<link rel="alternate" hreflang="en" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=en">
<link rel="alternate" hreflang="en-GB" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=en-GB">
<link rel="alternate" hreflang="es" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=es">
<link rel="alternate" hreflang="eu" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=eu">
<link rel="alternate" hreflang="fa" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=fa">
<link rel="alternate" hreflang="fi" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=fi">
<link rel="alternate" hreflang="tl" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=tl">
<link rel="alternate" hreflang="fr" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=fr">
<link rel="alternate" hreflang="ga" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ga">
<link rel="alternate" hreflang="gl" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=gl">
<link rel="alternate" hreflang="gu" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=gu">
<link rel="alternate" hreflang="he" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=he">
<link rel="alternate" hreflang="hi" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=hi">
<link rel="alternate" hreflang="hr" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=hr">
<link rel="alternate" hreflang="hu" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=hu">
<link rel="alternate" hreflang="id" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=id">
<link rel="alternate" hreflang="it" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=it">
<link rel="alternate" hreflang="ja" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ja">
<link rel="alternate" hreflang="kn" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=kn">
<link rel="alternate" hreflang="ko" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ko">
<link rel="alternate" hreflang="mr" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=mr">
<link rel="alternate" hreflang="ms" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ms">
<link rel="alternate" hreflang="nb" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=nb">
<link rel="alternate" hreflang="nl" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=nl">
<link rel="alternate" hreflang="pl" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=pl">
<link rel="alternate" hreflang="pt" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=pt">
<link rel="alternate" hreflang="ro" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ro">
<link rel="alternate" hreflang="ru" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ru">
<link rel="alternate" hreflang="sk" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=sk">
<link rel="alternate" hreflang="sr" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=sr">
<link rel="alternate" hreflang="sv" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=sv">
<link rel="alternate" hreflang="ta" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ta">
<link rel="alternate" hreflang="th" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=th">
<link rel="alternate" hreflang="tr" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=tr">
<link rel="alternate" hreflang="uk" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=uk">
<link rel="alternate" hreflang="ur" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ur">
<link rel="alternate" hreflang="vi" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=vi">
<link rel="alternate" hreflang="zh" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=zh">
<link rel="alternate" hreflang="zh-Hant" href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=zh-Hant">
<link rel="canonical" href="https://twitter.com/realdonaldtrump/status/1336148836495069185">
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Twitter">
<link rel="mask-icon" sizes="any" href="https://abs.twimg.com/responsive-web/client-web/icon-svg.168b89d5.svg" color="#1da1f2">
<link rel="shortcut icon" href="//abs.twimg.com/favicons/twitter.ico" type="image/x-icon">
<link rel="apple-touch-icon" sizes="192x192" href="https://abs.twimg.com/responsive-web/client-web/icon-ios.b1fc7275.png">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="Twitter">
<meta name="apple-mobile-web-app-status-bar-style" content="white">
<meta name="theme-color" content="#FFFFFF">
<meta http-equiv="origin-trial" content="Apir4chqTX+4eFxKD+ErQlKRB/VtZ/dvnLfd9Y9Nenl5r1xJcf81alryTHYQiuUlz9Q49MqGXqyaiSmqWzHUqQwAAABneyJvcmlnaW4iOiJodHRwczovL3R3aXR0ZXIuY29tOjQ0MyIsImZlYXR1cmUiOiJDb250YWN0c01hbmFnZXIiLCJleHBpcnkiOjE1NzUwMzUyODMsImlzU3ViZG9tYWluIjp0cnVlfQ==">
<style>html,body{height: 100%;}body{-ms-overflow-style:scrollbar;overflow-y:scroll;overscroll-behavior-y:none;}</style>
<style id="react-native-stylesheet">[stylesheet-group="0"]{}
html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);}
body{margin:0;}
button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}
input::-webkit-inner-spin-button,input::-webkit-outer-spin-button,input::-webkit-search-cancel-button,input::-webkit-search-decoration,input::-webkit-search-results-button,input::-webkit-search-results-decoration{display:none;}
[stylesheet-group="0.1"]{}
:focus:not([data-focusvisible-polyfill]){outline: none;}
[stylesheet-group="1"]{}
.css-1dbjc4n{-ms-flex-align:stretch;-ms-flex-direction:column;-ms-flex-negative:0;-ms-flex-preferred-size:auto;-webkit-align-items:stretch;-webkit-box-align:stretch;-webkit-box-direction:normal;-webkit-box-orient:vertical;-webkit-flex-basis:auto;-webkit-flex-direction:column;-webkit-flex-shrink:0;align-items:stretch;border:0 solid black;box-sizing:border-box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;flex-basis:auto;flex-direction:column;flex-shrink:0;margin-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;min-height:0px;min-width:0px;padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px;position:relative;z-index:0;}
.css-901oao{border:0 solid black;box-sizing:border-box;color:rgba(0,0,0,1.00);display:inline;font:14px -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;margin-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px;white-space:pre-wrap;word-wrap:break-word;}
.css-16my406{color:inherit;font:inherit;white-space:inherit;}
[stylesheet-group="2"]{}
.r-13awgt0{-ms-flex:1 1 0%;-webkit-flex:1;flex:1;}
.r-4qtqp9{display:inline-block;}
.r-ywje51{margin-bottom:auto;margin-left:auto;margin-right:auto;margin-top:auto;}
.r-hvic4v{display:none;}
.r-1adg3ll{display:block;}
[stylesheet-group="2.2"]{}
.r-12vffkv>*{pointer-events:auto;}
.r-12vffkv{pointer-events:none!important;}
.r-14lw9ot{background-color:rgba(255,255,255,1.00);}
.r-1p0dtai{bottom:0px;}
.r-1d2f490{left:0px;}
.r-1xcajam{position:fixed;}
.r-zchlnj{right:0px;}
.r-ipm5af{top:0px;}
.r-yyyyoo{fill:currentcolor;}
.r-1xvli5t{height:1.25em;}
.r-dnmrzs{max-width:100%;}
.r-bnwqim{position:relative;}
.r-1plcrui{vertical-align:text-bottom;}
.r-lrvibr{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none;}
.r-13gxpu9{color:rgba(29,161,242,1.00);}
.r-wy61xf{height:72px;}
.r-u8s1d{position:absolute;}
.r-1blnp2b{width:72px;}
.r-1ykxob0{top:60%;}
.r-1b2b6em{line-height:2em;}
.r-q4m81j{text-align:center;}</style>
<script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/sharedCore.a32e7c45.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/ondemand.Dropdown.cd28a975.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/loader.AppModules.b79a31b5.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/loader.SideNav.911fe7c5.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/bundle.Conversation.0d483265.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/bundle.NetworkInstrument.8cd49fb5.js"></script><title>Donald J. Trump on Twitter: "Georgia Lt. Governor @GeoffDuncanGA is a RINO Never Trumper who got himself elected as LG by falsely claiming to be “pro-Trump”. Too dumb or corrupt to recognize massive evidence of fraud in GA &amp; should be replaced! We need every great Georgian to call him out! #SpecialSession!" / Twitter</title><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/ondemand.BranchSdk.12a3a9f5.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/loader.NewTweetsPill.ff8ee8b5.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/loader.TimelineRenderer.48da6375.js"></script><script async="" src="https://www.google-analytics.com/analytics.js"></script><meta content="article" property="og:type" data-rh="true"><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/loader.AbsolutePower.62d14ea5.js"></script><link href="https://twitter.com/realDonaldTrump/status/1336148836495069185" rel="canonical" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185" hreflang="x-default" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ar" hreflang="ar" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=bg" hreflang="bg" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=bn" hreflang="bn" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ca" hreflang="ca" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=cs" hreflang="cs" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=da" hreflang="da" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=de" hreflang="de" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=el" hreflang="el" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=en" hreflang="en" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=en-GB" hreflang="en-GB" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=es" hreflang="es" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=eu" hreflang="eu" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=fa" hreflang="fa" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=fi" hreflang="fi" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=tl" hreflang="tl" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=fr" hreflang="fr" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ga" hreflang="ga" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=gl" hreflang="gl" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=gu" hreflang="gu" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=he" hreflang="he" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=hi" hreflang="hi" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=hr" hreflang="hr" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=hu" hreflang="hu" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=id" hreflang="id" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=it" hreflang="it" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ja" hreflang="ja" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=kn" hreflang="kn" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ko" hreflang="ko" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=mr" hreflang="mr" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ms" hreflang="ms" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=nb" hreflang="nb" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=nl" hreflang="nl" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=pl" hreflang="pl" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=pt" hreflang="pt" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ro" hreflang="ro" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ru" hreflang="ru" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=sk" hreflang="sk" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=sr" hreflang="sr" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=sv" hreflang="sv" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ta" hreflang="ta" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=th" hreflang="th" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=tr" hreflang="tr" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=uk" hreflang="uk" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=ur" hreflang="ur" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=vi" hreflang="vi" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=zh" hreflang="zh" rel="alternate" data-rh="true"><link href="https://twitter.com/realdonaldtrump/status/1336148836495069185?lang=zh-Hant" hreflang="zh-Hant" rel="alternate" data-rh="true"><meta content="https://twitter.com/realDonaldTrump/status/1336148836495069185" property="og:url" data-rh="true"><meta content="Donald J. Trump on Twitter" property="og:title" data-rh="true"><meta content="https://pbs.twimg.com/profile_images/874276197357596672/kUuht00m_normal.jpg" property="og:image" data-rh="true"><meta content="Georgia Lt. Governor @GeoffDuncanGA is a RINO Never Trumper who got himself elected as LG by falsely claiming to be “pro-Trump”. Too dumb or corrupt to recognize massive evidence of fraud in GA &amp; should be replaced! We need every great Georgian to call him out! #SpecialSession!" property="og:description" data-rh="true"><meta content="twitter://status?id=1336148836495069185" property="al:ios:url" data-rh="true"><meta content="333903271" property="al:ios:app_store_id" data-rh="true"><meta content="Twitter" property="al:ios:app_name" data-rh="true"><meta content="twitter://status?id=1336148836495069185" property="al:android:url" data-rh="true"><meta content="com.twitter.android" property="al:android:package" data-rh="true"><meta content="Twitter" property="al:android:app_name" data-rh="true"><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/ondemand.LottieWeb.a03d07a5.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/loader.WideLayout.55321115.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/shared~loader.Typeahead~bundle.UserLists.ffdf8b05.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/loader.Typeahead.28089845.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/loader.SignupModule.c1142645.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/shared~bundle.Explore~loader.ExploreSidebar.043a7465.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/loader.ExploreSidebar.f0fd58f5.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/ondemand.emoji.en.b13f7c85.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/shared~ondemand.EmojiPickerData~ondemand.EmojiPicker.c8bd3f05.js"></script><script charset="utf-8" src="https://abs.twimg.com/responsive-web/client-web/ondemand.HoverCard.c76f0fb5.js"></script></head><body style="background-color: rgb(255, 255, 255);">
<noscript>
<form action="https://mobile.twitter.com/i/nojs_router?path=%2FrealDonaldTrump%2Fstatus%2F1336148836495069185%3FprefetchTimestamp%3D1607976023947"
method="POST"
style="background-color: #fff; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999;">
<div style="font-size: 18px; font-family: Helvetica,sans-serif; line-height: 24px; margin: 10%; width: 80%;">
<p>We've detected that JavaScript is disabled in your browser. Would you like to proceed to legacy Twitter?</p>
<p style="margin: 20px 0;">
<button type="submit"
style="background-color: #1da1f2; border-radius: 100px; border: none; box-shadow: none; color: #fff; cursor: pointer; font-size: 14px; font-weight: bold; line-height: 20px; padding: 6px 16px;">Yes</button>
</p>
</div>
</form>
</noscript>
<div id="react-root" style="height:100%;display:flex;"><div class="css-1dbjc4n r-13awgt0 r-12vffkv"><div class="css-1dbjc4n r-13awgt0 r-12vffkv"><div id="layers" class="r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-184en5c" style=""><div class="css-1dbjc4n r-aqfbo4 r-1p0dtai r-1d2f490 r-12vffkv r-1xcajam r-zchlnj"><div class="css-1dbjc4n r-12vffkv"><div class="css-1dbjc4n r-12vffkv"><div class="css-1dbjc4n r-urgr8i r-1upvrn0"><div class="css-1dbjc4n r-18u37iz r-1777fci r-zg41ew"><div class="css-1dbjc4n r-o96wvk"></div><div class="css-1dbjc4n r-1awozwy r-18u37iz r-1wtj0ep r-rthrr5"><div class="css-1dbjc4n"><div dir="auto" class="css-901oao r-jwli3a r-1qd0xha r-1blvdjr r-b88u0q r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Don’t miss what’s happening</span></div><div dir="auto" class="css-901oao r-jwli3a r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">People on Twitter are the first to know.</span></div></div><div class="css-1dbjc4n r-1oy2gb8"><div class="css-1dbjc4n r-1awozwy r-1pz39u2 r-18u37iz r-16y2uox"><div class="css-1dbjc4n r-16y2uox"><a href="/login" role="button" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-1niwhzg r-11mg6pl r-sdzlij r-1phboty r-rs99b7 r-1loqt21 r-1w2pmg r-1vuscfd r-1dhvaqw r-1ny4l3l r-1fneopy r-o7ynqc r-6416eg r-lrvibr" data-testid="login"><div dir="auto" class="css-901oao r-1awozwy r-jwli3a r-6koalj r-18u37iz r-16y2uox r-1qd0xha r-a023e6 r-b88u0q r-1777fci r-eljoum r-dnmrzs r-bcqeeo r-q4m81j r-qvutc0"><span class="css-901oao css-16my406 css-bfa6kz r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Log in</span></span></div></a></div><div class="css-1dbjc4n r-16y2uox r-1n0xq6e"><a href="/i/flow/signup" role="button" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-14lw9ot r-42olwf r-sdzlij r-1phboty r-rs99b7 r-1loqt21 r-1w2pmg r-1vuscfd r-1dhvaqw r-1ny4l3l r-1fneopy r-o7ynqc r-6416eg r-lrvibr" data-testid="signup"><div dir="auto" class="css-901oao r-1awozwy r-13gxpu9 r-6koalj r-18u37iz r-16y2uox r-1qd0xha r-a023e6 r-b88u0q r-1777fci r-eljoum r-dnmrzs r-bcqeeo r-q4m81j r-qvutc0"><span class="css-901oao css-16my406 css-bfa6kz r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Sign up</span></span></div></a></div></div></div></div></div></div></div></div><div class="css-1dbjc4n r-12vffkv"><div class="css-1dbjc4n r-12vffkv"><div class="css-1dbjc4n"></div></div></div></div></div><div class="css-1dbjc4n r-18u37iz r-13qz1uu r-417010" aria-hidden="false" style="min-height: 625px;"><div aria-label="Skip to recommended content" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1niwhzg r-9uxtqv r-sdzlij r-1phboty r-4iw3lz r-1xk2f4g r-109y4c4 r-1vuscfd r-1dhvaqw r-1ny4l3l r-1udh08x r-wwvuq4 r-1fneopy r-u8s1d r-o7ynqc r-6416eg r-lrvibr r-92ng3h"><div dir="auto" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-18u37iz r-16y2uox r-1qd0xha r-a023e6 r-b88u0q r-1777fci r-eljoum r-dnmrzs r-bcqeeo r-q4m81j r-qvutc0"><span class="css-901oao css-16my406 css-bfa6kz r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"></span></div></div><div aria-label="Skip to secondary content" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1niwhzg r-9uxtqv r-sdzlij r-1phboty r-4iw3lz r-1xk2f4g r-109y4c4 r-1vuscfd r-1dhvaqw r-1ny4l3l r-1udh08x r-wwvuq4 r-1fneopy r-u8s1d r-o7ynqc r-6416eg r-lrvibr r-92ng3h"><div dir="auto" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-18u37iz r-16y2uox r-1qd0xha r-a023e6 r-b88u0q r-1777fci r-eljoum r-dnmrzs r-bcqeeo r-q4m81j r-qvutc0"><span class="css-901oao css-16my406 css-bfa6kz r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"></span></div></div><header role="banner" class="css-1dbjc4n r-obd0qt r-16y2uox r-lrvibr r-1g40b8q"><div class="css-1dbjc4n r-o96wvk"><div class="css-1dbjc4n r-aqfbo4 r-1pi2tsx r-1xcajam r-ipm5af"><div class="css-1dbjc4n r-1pi2tsx r-1wtj0ep r-1rnoaur r-utggzx r-o96wvk"><div class="css-1dbjc4n r-1habvwh"><div class="css-1dbjc4n r-dnmrzs r-1vvnge1"><h1 role="heading" class="css-4rbku5 css-1dbjc4n r-1awozwy r-1pz39u2 r-1loqt21 r-6koalj r-16y2uox r-1777fci r-18qmn74"><a href="/" aria-label="Twitter" role="button" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-1niwhzg r-42olwf r-sdzlij r-1phboty r-rs99b7 r-1loqt21 r-1w2pmg r-1jayybb r-mtrfb5 r-1ny4l3l r-mk0yit r-o7ynqc r-6416eg r-lrvibr"><div dir="auto" class="css-901oao r-1awozwy r-13gxpu9 r-6koalj r-18u37iz r-16y2uox r-1qd0xha r-a023e6 r-b88u0q r-1777fci r-eljoum r-dnmrzs r-bcqeeo r-q4m81j r-qvutc0"><svg viewBox="0 0 24 24" class="r-13gxpu9 r-4qtqp9 r-yyyyoo r-16y2uox r-1q142lx r-8kz0gk r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1srniue"><g><path d="M23.643 4.937c-.835.37-1.732.62-2.675.733.962-.576 1.7-1.49 2.048-2.578-.9.534-1.897.922-2.958 1.13-.85-.904-2.06-1.47-3.4-1.47-2.572 0-4.658 2.086-4.658 4.66 0 .364.042.718.12 1.06-3.873-.195-7.304-2.05-9.602-4.868-.4.69-.63 1.49-.63 2.342 0 1.616.823 3.043 2.072 3.878-.764-.025-1.482-.234-2.11-.583v.06c0 2.257 1.605 4.14 3.737 4.568-.392.106-.803.162-1.227.162-.3 0-.593-.028-.877-.082.593 1.85 2.313 3.198 4.352 3.234-1.595 1.25-3.604 1.995-5.786 1.995-.376 0-.747-.022-1.112-.065 2.062 1.323 4.51 2.093 7.14 2.093 8.57 0 13.255-7.098 13.255-13.254 0-.2-.005-.402-.014-.602.91-.658 1.7-1.477 2.323-2.41z"></path></g></svg><span class="css-901oao css-16my406 css-bfa6kz r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"></span></div></a></h1></div><div class="css-1dbjc4n r-d0pm55 r-1bymd8e r-13qz1uu"><nav aria-label="Primary" role="navigation" class="css-1dbjc4n r-1habvwh r-eqz5dr"><a href="/explore" aria-label="Search and explore" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-1habvwh r-1loqt21 r-6koalj r-eqz5dr r-16y2uox r-1ny4l3l r-rjfia r-13qz1uu" data-testid="AppTabBar_Explore_Link"><div class="css-1dbjc4n r-1awozwy r-sdzlij r-18u37iz r-1777fci r-dnmrzs r-1sp51qo r-o7ynqc r-6416eg"><div class="css-1dbjc4n"><svg viewBox="0 0 24 24" class="r-18jsvk2 r-4qtqp9 r-yyyyoo r-lwhw9o r-dnmrzs r-bnwqim r-1plcrui r-lrvibr"><g><path d="M21 7.337h-3.93l.372-4.272c.036-.412-.27-.775-.682-.812-.417-.03-.776.27-.812.683l-.383 4.4h-6.32l.37-4.27c.037-.413-.27-.776-.68-.813-.42-.03-.777.27-.813.683l-.382 4.4H3.782c-.414 0-.75.337-.75.75s.336.75.75.75H7.61l-.55 6.327H3c-.414 0-.75.336-.75.75s.336.75.75.75h3.93l-.372 4.272c-.036.412.27.775.682.812l.066.003c.385 0 .712-.295.746-.686l.383-4.4h6.32l-.37 4.27c-.036.413.27.776.682.813l.066.003c.385 0 .712-.295.746-.686l.382-4.4h3.957c.413 0 .75-.337.75-.75s-.337-.75-.75-.75H16.39l.55-6.327H21c.414 0 .75-.336.75-.75s-.336-.75-.75-.75zm-6.115 7.826h-6.32l.55-6.326h6.32l-.55 6.326z"></path></g></svg></div><div dir="auto" class="css-901oao css-bfa6kz r-18jsvk2 r-1qd0xha r-1b6yd1w r-b88u0q r-ad9z0x r-1joea0r r-y3t9qe r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Explore</span></div></div></a><a href="/settings" aria-label="Settings" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-1habvwh r-1loqt21 r-6koalj r-eqz5dr r-16y2uox r-1ny4l3l r-rjfia r-13qz1uu"><div class="css-1dbjc4n r-1awozwy r-sdzlij r-18u37iz r-1777fci r-dnmrzs r-1sp51qo r-o7ynqc r-6416eg"><div class="css-1dbjc4n"><svg viewBox="0 0 24 24" class="r-18jsvk2 r-4qtqp9 r-yyyyoo r-lwhw9o r-dnmrzs r-bnwqim r-1plcrui r-lrvibr"><g><path d="M12 8.21c-2.09 0-3.79 1.7-3.79 3.79s1.7 3.79 3.79 3.79 3.79-1.7 3.79-3.79-1.7-3.79-3.79-3.79zm0 6.08c-1.262 0-2.29-1.026-2.29-2.29S10.74 9.71 12 9.71s2.29 1.026 2.29 2.29-1.028 2.29-2.29 2.29z"></path><path d="M12.36 22.375h-.722c-1.183 0-2.154-.888-2.262-2.064l-.014-.147c-.025-.287-.207-.533-.472-.644-.286-.12-.582-.065-.798.115l-.116.097c-.868.725-2.253.663-3.06-.14l-.51-.51c-.836-.84-.896-2.154-.14-3.06l.098-.118c.186-.222.23-.523.122-.787-.11-.272-.358-.454-.646-.48l-.15-.014c-1.18-.107-2.067-1.08-2.067-2.262v-.722c0-1.183.888-2.154 2.064-2.262l.156-.014c.285-.025.53-.207.642-.473.11-.27.065-.573-.12-.795l-.094-.116c-.757-.908-.698-2.223.137-3.06l.512-.512c.804-.804 2.188-.865 3.06-.14l.116.098c.218.184.528.23.79.122.27-.112.452-.358.477-.643l.014-.153c.107-1.18 1.08-2.066 2.262-2.066h.722c1.183 0 2.154.888 2.262 2.064l.014.156c.025.285.206.53.472.64.277.117.58.062.794-.117l.12-.102c.867-.723 2.254-.662 3.06.14l.51.512c.836.838.896 2.153.14 3.06l-.1.118c-.188.22-.234.522-.123.788.112.27.36.45.646.478l.152.014c1.18.107 2.067 1.08 2.067 2.262v.723c0 1.183-.888 2.154-2.064 2.262l-.155.014c-.284.024-.53.205-.64.47-.113.272-.067.574.117.795l.1.12c.756.905.696 2.22-.14 3.06l-.51.51c-.807.804-2.19.864-3.06.14l-.115-.096c-.217-.183-.53-.23-.79-.122-.273.114-.455.36-.48.646l-.014.15c-.107 1.173-1.08 2.06-2.262 2.06zm-3.773-4.42c.3 0 .593.06.87.175.79.328 1.324 1.054 1.4 1.896l.014.147c.037.4.367.7.77.7h.722c.4 0 .73-.3.768-.7l.014-.148c.076-.842.61-1.567 1.392-1.892.793-.33 1.696-.182 2.333.35l.113.094c.178.148.366.18.493.18.206 0 .4-.08.546-.227l.51-.51c.284-.284.305-.73.048-1.038l-.1-.12c-.542-.65-.677-1.54-.352-2.323.326-.79 1.052-1.32 1.894-1.397l.155-.014c.397-.037.7-.367.7-.77v-.722c0-.4-.303-.73-.702-.768l-.152-.014c-.846-.078-1.57-.61-1.895-1.393-.326-.788-.19-1.678.353-2.327l.1-.118c.257-.31.236-.756-.048-1.04l-.51-.51c-.146-.147-.34-.227-.546-.227-.127 0-.315.032-.492.18l-.12.1c-.634.528-1.55.67-2.322.354-.788-.327-1.32-1.052-1.397-1.896l-.014-.155c-.035-.397-.365-.7-.767-.7h-.723c-.4 0-.73.303-.768.702l-.014.152c-.076.843-.608 1.568-1.39 1.893-.787.326-1.693.183-2.33-.35l-.118-.096c-.18-.15-.368-.18-.495-.18-.206 0-.4.08-.546.226l-.512.51c-.282.284-.303.73-.046 1.038l.1.118c.54.653.677 1.544.352 2.325-.327.788-1.052 1.32-1.895 1.397l-.156.014c-.397.037-.7.367-.7.77v.722c0 .4.303.73.702.768l.15.014c.848.078 1.573.612 1.897 1.396.325.786.19 1.675-.353 2.325l-.096.115c-.26.31-.238.756.046 1.04l.51.51c.146.147.34.227.546.227.127 0 .315-.03.492-.18l.116-.096c.406-.336.923-.524 1.453-.524z"></path></g></svg></div><div dir="auto" class="css-901oao css-bfa6kz r-18jsvk2 r-1qd0xha r-1b6yd1w r-b88u0q r-ad9z0x r-1joea0r r-y3t9qe r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Settings</span></div></div></a></nav></div></div></div></div></div></header><main role="main" class="css-1dbjc4n r-1habvwh r-16y2uox r-1wbh5a2"><div class="css-1dbjc4n r-150rngu r-16y2uox r-1wbh5a2 r-rthrr5"><div class="css-1dbjc4n r-aqfbo4 r-16y2uox"><div class="css-1dbjc4n r-1oszu61 r-1niwhzg r-18u37iz r-16y2uox r-1wtj0ep r-2llsf r-13qz1uu"><div class="css-1dbjc4n r-14lw9ot r-1gm7m50 r-1ljd8xs r-13l2t4g r-1phboty r-1jgb5lz r-11wrixw r-61z16t r-1ye8kvj r-13qz1uu r-184en5c" data-testid="primaryColumn"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-aqfbo4 r-14lw9ot r-j7yic r-rull8r r-qklmqi r-gtdqiz r-ipm5af r-1g40b8q"><div class="css-1dbjc4n r-1loqt21 r-136ojw6"><div class="css-1dbjc4n r-1h3ijdo r-136ojw6"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-14lw9ot r-1h3ijdo r-1j3t67a"><div class="css-1dbjc4n r-1awozwy r-18u37iz r-1h3ijdo r-1777fci r-1jgb5lz r-sb58tz r-13qz1uu"><div class="css-1dbjc4n r-1habvwh r-1pz39u2 r-1777fci r-1vsu8ta r-u0dd49"><div aria-label="Back" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1niwhzg r-42olwf r-sdzlij r-1phboty r-rs99b7 r-1w2pmg r-1vuscfd r-53xb7h r-1ny4l3l r-mk0yit r-o7ynqc r-6416eg r-lrvibr" style="margin-left: calc(5px + (-1 * (41px - 1.5em)) / 2);"><div dir="auto" class="css-901oao r-1awozwy r-13gxpu9 r-6koalj r-18u37iz r-16y2uox r-1qd0xha r-a023e6 r-b88u0q r-1777fci r-eljoum r-dnmrzs r-bcqeeo r-q4m81j r-qvutc0"><svg viewBox="0 0 24 24" class="r-13gxpu9 r-4qtqp9 r-yyyyoo r-1q142lx r-50lct3 r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1srniue"><g><path d="M20 11H7.414l4.293-4.293c.39-.39.39-1.023 0-1.414s-1.023-.39-1.414 0l-6 6c-.39.39-.39 1.023 0 1.414l6 6c.195.195.45.293.707.293s.512-.098.707-.293c.39-.39.39-1.023 0-1.414L7.414 13H20c.553 0 1-.447 1-1s-.447-1-1-1z"></path></g></svg><span class="css-901oao css-16my406 css-bfa6kz r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"></span></div></div></div><div class="css-1dbjc4n r-16y2uox r-1wbh5a2 r-1pi2tsx r-1777fci"><div class="css-1dbjc4n r-1habvwh"><h2 aria-level="2" dir="auto" role="heading" class="css-4rbku5 css-901oao css-bfa6kz r-18jsvk2 r-1qd0xha r-1b6yd1w r-1vr29t4 r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Tweet</span></h2></div></div><div class="css-1dbjc4n r-obd0qt r-1pz39u2 r-1777fci r-1joea0r r-1vsu8ta r-18qmn74"><div class="css-1dbjc4n r-1awozwy r-18u37iz"></div></div></div></div></div></div></div><div class="css-1dbjc4n r-1p0dtai r-18u37iz r-1777fci r-1d2f490 r-12vffkv r-u8s1d r-zchlnj r-1wyyakw"><div role="status" class="css-1dbjc4n"><div aria-label="New Tweets are available. Push period to go to the beginning of your timeline and view them" role="button" aria-hidden="true" class="css-18t94o4 css-1dbjc4n r-urgr8i r-sdzlij r-y3da5r r-1777fci r-orgf3d r-1ny4l3l r-1j3t67a r-d3hbe1 r-o7ynqc r-6416eg r-nx0j10"><div class="css-1dbjc4n r-18u37iz r-atwnbb"><svg viewBox="0 0 24 24" class="r-1kihuf0 r-jwli3a r-4qtqp9 r-yyyyoo r-1xvli5t r-7o8qx1 r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-19wmn03"><g><path d="M18.707 10.293l-6-6c-.39-.39-1.023-.39-1.414 0l-6 6c-.39.39-.39 1.023 0 1.414.195.195.45.293.707.293s.512-.098.707-.293L11 7.414V20c0 .553.447 1 1 1s1-.447 1-1V7.414l4.293 4.293c.195.195.45.293.707.293s.512-.098.707-.293c.39-.39.39-1.023 0-1.414z"></path></g></svg><div class="css-1dbjc4n"><div class="css-1dbjc4n r-18u37iz r-1q142lx"></div></div><div dir="auto" class="css-901oao css-bfa6kz r-jwli3a r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">See new Tweets</span></div></div></div></div></div></div><div class="css-1dbjc4n"><div class="css-1dbjc4n"><section aria-labelledby="accessible-list-6" role="region" class="css-1dbjc4n"><h1 aria-level="1" dir="auto" role="heading" class="css-4rbku5 css-901oao r-4iw3lz r-1xk2f4g r-109y4c4 r-1udh08x r-wwvuq4 r-u8s1d r-92ng3h" id="accessible-list-6">Conversation</h1><div aria-label="Timeline: Conversation" class="css-1dbjc4n"><div style="position: relative; min-height: 2749px;"><div style="position: absolute; width: 100%; transform: translateY(0px); transition: opacity 0.3s ease-out 0s;"><div class="css-1dbjc4n r-j7yic r-qklmqi r-1adg3ll r-1ny4l3l"><div class="css-1dbjc4n"><article role="article" data-focusable="true" tabindex="0" class="css-1dbjc4n r-18u37iz r-1ny4l3l r-1udh08x r-1yt7n81 r-ry3cjt"><div class="css-1dbjc4n r-eqz5dr r-16y2uox r-1wbh5a2"><div class="css-1dbjc4n r-16y2uox r-1wbh5a2 r-1ny4l3l"><div class="css-1dbjc4n"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-18u37iz"><div class="css-1dbjc4n r-1iusvr4 r-16y2uox r-m611by"></div></div></div><div class="css-1dbjc4n r-18u37iz r-d0pm55" data-testid="tweet"><div class="css-1dbjc4n r-1awozwy r-18kxxzh r-zso239" style="flex-basis: 49px;"><div class="css-1dbjc4n r-18kxxzh r-1wbh5a2 r-13qz1uu"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs"><a href="/realDonaldTrump" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-sdzlij r-1loqt21 r-1adg3ll r-ahm1il r-1ny4l3l r-1udh08x r-o7ynqc r-6416eg r-13qz1uu"><div class="css-1dbjc4n r-1adg3ll r-1udh08x" style=""><div class="r-1adg3ll r-13qz1uu" style="padding-bottom: 100%;"></div><div class="r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-ipm5af r-13qz1uu"><div aria-label="" class="css-1dbjc4n r-sdzlij r-1p0dtai r-1mlwlqe r-1d2f490 r-1udh08x r-u8s1d r-zchlnj r-ipm5af r-417010"><div class="css-1dbjc4n r-1niwhzg r-vvn4in r-u6sd8q r-4gszlv r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-13qz1uu r-1wyyakw" style="background-image: url("https://pbs.twimg.com/profile_images/874276197357596672/kUuht00m_bigger.jpg");"></div><img alt="" draggable="true" src="https://pbs.twimg.com/profile_images/874276197357596672/kUuht00m_bigger.jpg" class="css-9pa8cd"></div></div></div><div class="css-1dbjc4n r-1twgtwe r-sdzlij r-rs99b7 r-1p0dtai r-1mi75qu r-1d2f490 r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div></a></div></div></div><div class="css-1dbjc4n r-1iusvr4 r-16y2uox r-1777fci"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-zl2h9q"><div class="css-1dbjc4n r-k4xj1c r-18u37iz r-1wtj0ep"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs"><a href="/realDonaldTrump" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-1loqt21 r-1wbh5a2 r-dnmrzs r-1ny4l3l"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs r-1ny4l3l"><div class="css-1dbjc4n r-1awozwy r-18u37iz r-dnmrzs"><div dir="auto" class="css-901oao css-bfa6kz r-18jsvk2 r-1qd0xha r-a023e6 r-b88u0q r-ad9z0x r-bcqeeo r-3s2u2q r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Donald J. Trump</span></span></div><div dir="auto" class="css-901oao r-18jsvk2 r-18u37iz r-1q142lx r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><svg viewBox="0 0 24 24" aria-label="Verified account" class="r-13gxpu9 r-4qtqp9 r-yyyyoo r-1xvli5t r-9cviqr r-dnmrzs r-bnwqim r-1plcrui r-lrvibr"><g><path d="M22.5 12.5c0-1.58-.875-2.95-2.148-3.6.154-.435.238-.905.238-1.4 0-2.21-1.71-3.998-3.818-3.998-.47 0-.92.084-1.336.25C14.818 2.415 13.51 1.5 12 1.5s-2.816.917-3.437 2.25c-.415-.165-.866-.25-1.336-.25-2.11 0-3.818 1.79-3.818 4 0 .494.083.964.237 1.4-1.272.65-2.147 2.018-2.147 3.6 0 1.495.782 2.798 1.942 3.486-.02.17-.032.34-.032.514 0 2.21 1.708 4 3.818 4 .47 0 .92-.086 1.335-.25.62 1.334 1.926 2.25 3.437 2.25 1.512 0 2.818-.916 3.437-2.25.415.163.865.248 1.336.248 2.11 0 3.818-1.79 3.818-4 0-.174-.012-.344-.033-.513 1.158-.687 1.943-1.99 1.943-3.484zm-6.616-3.334l-4.334 6.5c-.145.217-.382.334-.625.334-.143 0-.288-.04-.416-.126l-.115-.094-2.415-2.415c-.293-.293-.293-.768 0-1.06s.768-.294 1.06 0l1.77 1.767 3.825-5.74c.23-.345.696-.436 1.04-.207.346.23.44.696.21 1.04z"></path></g></svg></div></div><div class="css-1dbjc4n r-18u37iz r-1wbh5a2"><div dir="ltr" class="css-901oao css-bfa6kz r-m0bqgq r-18u37iz r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">@realDonaldTrump</span></div></div></div></a></div><div class="css-1dbjc4n r-18u37iz r-1h0z5md r-1joea0r"><div aria-expanded="false" aria-haspopup="true" aria-label="More" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="caret"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M19.39 14.882c-1.58 0-2.862-1.283-2.862-2.86s1.283-2.862 2.86-2.862 2.862 1.283 2.862 2.86-1.284 2.862-2.86 2.862zm0-4.223c-.75 0-1.362.61-1.362 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36zM12 14.882c-1.578 0-2.86-1.283-2.86-2.86S10.42 9.158 12 9.158s2.86 1.282 2.86 2.86S13.578 14.88 12 14.88zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.362 1.36 1.362 1.36-.61 1.36-1.36-.61-1.363-1.36-1.363zm-7.39 4.223c-1.577 0-2.86-1.283-2.86-2.86S3.034 9.16 4.61 9.16s2.862 1.283 2.862 2.86-1.283 2.862-2.86 2.862zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36z"></path></g></svg></div></div></div></div></div></div></div></div></div><div class="css-1dbjc4n"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-156q2ks"><div lang="en" dir="auto" class="css-901oao r-18jsvk2 r-1qd0xha r-1blvdjr r-16dba41 r-ad9z0x r-bcqeeo r-bnwqim r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Georgia Lt. Governor </span><div class="css-1dbjc4n r-xoduu5"><span class="r-18u37iz"><a dir="ltr" href="/GeoffDuncanGA" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao css-16my406 r-1n1174f r-1loqt21 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">@GeoffDuncanGA</a></span></div><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"> is a RINO Never Trumper who got himself elected as LG by falsely claiming to be “pro-Trump”. Too dumb or corrupt to recognize massive evidence of fraud in GA & should be replaced! We need every great Georgian to call him out! </span><span class="r-18u37iz"><a dir="ltr" href="/hashtag/SpecialSession?src=hashtag_click" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao css-16my406 r-1n1174f r-1loqt21 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">#SpecialSession</a></span><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">!</span></div></div></div><div class="css-1dbjc4n"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-1g94qm0"><a href="/i/events/1308626736066617344" dir="auto" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao r-j7yic r-rull8r r-qklmqi r-1n1174f r-1loqt21 r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-1inuy60 r-m611by r-1w50u8q r-qvutc0"><div class="css-1dbjc4n r-1awozwy r-xoduu5 r-18u37iz r-16y2uox"><svg viewBox="0 0 24 24" class="r-k200y r-13gxpu9 r-4qtqp9 r-yyyyoo r-1q142lx r-1g7fiml r-zso239 r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-199wky7"><g><circle cx="12.025" cy="16.437" r="1.281"></circle><path d="M14.39 7.194c-.094-.127-.242-.2-.4-.2h-3.928c-.158 0-.307.073-.4.2-.096.126-.125.29-.08.442l1.814 6.098c.063.212.258.357.48.357h.298c.222 0 .416-.145.48-.356l1.813-6.098c.047-.152.017-.316-.077-.442z"></path><path d="M12 22.75C6.072 22.75 1.25 17.928 1.25 12S6.072 1.25 12 1.25 22.75 6.072 22.75 12 17.928 22.75 12 22.75zm0-20C6.9 2.75 2.75 6.9 2.75 12S6.9 21.25 12 21.25s9.25-4.15 9.25-9.25S17.1 2.75 12 2.75z"></path></g></svg><span class="css-901oao css-16my406 css-cens5h r-13gxpu9 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0" style="-webkit-line-clamp: 3;"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">This claim about election fraud is disputed</span></span></div></a></div></div></div><div class="css-1dbjc4n r-vpgt9t"><div class="css-1dbjc4n r-1awozwy r-18u37iz r-1wtj0ep"><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-zso239 r-bcqeeo r-qvutc0"><a href="/realDonaldTrump/status/1336148836495069185" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao css-16my406 r-m0bqgq r-1loqt21 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">5:21 AM · Dec 8, 2020</span></a><span aria-hidden="true" class="css-901oao css-16my406 r-m0bqgq r-1q142lx r-1qd0xha r-ad9z0x r-bcqeeo r-ou255f r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">·</span></span><a href="https://help.twitter.com/using-twitter/how-to-tweet#source-labels" target="_blank" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao css-16my406 r-m0bqgq r-1loqt21 r-1qd0xha r-ad9z0x r-bcqeeo r-1jeg54m r-qvutc0" rel=" noopener noreferrer"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Twitter for iPhone</span></a></div><div class="css-1dbjc4n r-18u37iz"></div></div></div><div class="css-1dbjc4n"><div class="css-1dbjc4n r-mxfbl1 r-1efd50x r-5kkj8d r-13awgt0 r-18u37iz r-tzz3ar r-ou255f r-9qu9m4"><div class="css-1dbjc4n r-1mf7evn"><div class="css-1dbjc4n"><a href="/realDonaldTrump/status/1336148836495069185/retweets" dir="auto" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao r-18jsvk2 r-1loqt21 r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><div class="css-1dbjc4n r-xoduu5 r-1udh08x"><span class="css-901oao css-16my406 r-1qd0xha r-b88u0q r-ad9z0x r-bcqeeo r-d3hbe1 r-1wgg2b2 r-axxi2z r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">37.9K</span></span></div> <span class="css-901oao css-16my406 r-m0bqgq r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Retweets</span></span></a></div></div><div class="css-1dbjc4n r-1mf7evn"><div class="css-1dbjc4n"><a href="/realDonaldTrump/status/1336148836495069185/retweets/with_comments" dir="auto" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao r-18jsvk2 r-1loqt21 r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><div class="css-1dbjc4n r-xoduu5 r-1udh08x"><span class="css-901oao css-16my406 r-1qd0xha r-b88u0q r-ad9z0x r-bcqeeo r-d3hbe1 r-1wgg2b2 r-axxi2z r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">3.7K</span></span></div> <span class="css-901oao css-16my406 r-m0bqgq r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Quote Tweets</span></span></a></div></div><div class="css-1dbjc4n"><div class="css-1dbjc4n"><a href="/realDonaldTrump/status/1336148836495069185/likes" dir="auto" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao r-18jsvk2 r-1loqt21 r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><div class="css-1dbjc4n r-xoduu5 r-1udh08x"><span class="css-901oao css-16my406 r-1qd0xha r-b88u0q r-ad9z0x r-bcqeeo r-d3hbe1 r-1wgg2b2 r-axxi2z r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">152.2K</span></span></div> <span class="css-901oao css-16my406 r-m0bqgq r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Likes</span></span></a></div></div></div></div><div role="group" class="css-1dbjc4n r-1oszu61 r-mxfbl1 r-1efd50x r-5kkj8d r-18u37iz r-ahm1il r-a2tzq0"><div class="css-1dbjc4n r-18u37iz r-1h0z5md r-3qxfft r-ou255f r-rjfia"><div aria-label="Reply" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="reply"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-50lct3 r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1srniue"><g><path d="M14.046 2.242l-4.148-.01h-.002c-4.374 0-7.8 3.427-7.8 7.802 0 4.098 3.186 7.206 7.465 7.37v3.828c0 .108.044.286.12.403.142.225.384.347.632.347.138 0 .277-.038.402-.118.264-.168 6.473-4.14 8.088-5.506 1.902-1.61 3.04-3.97 3.043-6.312v-.017c-.006-4.367-3.43-7.787-7.8-7.788zm3.787 12.972c-1.134.96-4.862 3.405-6.772 4.643V16.67c0-.414-.335-.75-.75-.75h-.396c-3.66 0-6.318-2.476-6.318-5.886 0-3.534 2.768-6.302 6.3-6.302l4.147.01h.002c3.532 0 6.3 2.766 6.302 6.296-.003 1.91-.942 3.844-2.514 5.176z"></path></g></svg></div></div></div></div><div class="css-1dbjc4n r-18u37iz r-1h0z5md r-3qxfft r-ou255f r-rjfia"><div aria-label="Retweet" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="retweet"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-50lct3 r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1srniue"><g><path d="M23.77 15.67c-.292-.293-.767-.293-1.06 0l-2.22 2.22V7.65c0-2.068-1.683-3.75-3.75-3.75h-5.85c-.414 0-.75.336-.75.75s.336.75.75.75h5.85c1.24 0 2.25 1.01 2.25 2.25v10.24l-2.22-2.22c-.293-.293-.768-.293-1.06 0s-.294.768 0 1.06l3.5 3.5c.145.147.337.22.53.22s.383-.072.53-.22l3.5-3.5c.294-.292.294-.767 0-1.06zm-10.66 3.28H7.26c-1.24 0-2.25-1.01-2.25-2.25V6.46l2.22 2.22c.148.147.34.22.532.22s.384-.073.53-.22c.293-.293.293-.768 0-1.06l-3.5-3.5c-.293-.294-.768-.294-1.06 0l-3.5 3.5c-.294.292-.294.767 0 1.06s.767.293 1.06 0l2.22-2.22V16.7c0 2.068 1.683 3.75 3.75 3.75h5.85c.414 0 .75-.336.75-.75s-.337-.75-.75-.75z"></path></g></svg></div></div></div></div><div class="css-1dbjc4n r-18u37iz r-1h0z5md r-3qxfft r-ou255f r-rjfia"><div aria-expanded="false" aria-haspopup="true" aria-label="Like" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="like"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-50lct3 r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1srniue"><g><path d="M12 21.638h-.014C9.403 21.59 1.95 14.856 1.95 8.478c0-3.064 2.525-5.754 5.403-5.754 2.29 0 3.83 1.58 4.646 2.73.814-1.148 2.354-2.73 4.645-2.73 2.88 0 5.404 2.69 5.404 5.755 0 6.376-7.454 13.11-10.037 13.157H12zM7.354 4.225c-2.08 0-3.903 1.988-3.903 4.255 0 5.74 7.034 11.596 8.55 11.658 1.518-.062 8.55-5.917 8.55-11.658 0-2.267-1.823-4.255-3.903-4.255-2.528 0-3.94 2.936-3.952 2.965-.23.562-1.156.562-1.387 0-.014-.03-1.425-2.965-3.954-2.965z"></path></g></svg></div></div></div></div><div class="css-1dbjc4n r-18u37iz r-1h0z5md r-3qxfft r-ou255f r-rjfia"><div aria-expanded="false" aria-haspopup="true" aria-label="Share Tweet" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-50lct3 r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1srniue"><g><path d="M17.53 7.47l-5-5c-.293-.293-.768-.293-1.06 0l-5 5c-.294.293-.294.768 0 1.06s.767.294 1.06 0l3.72-3.72V15c0 .414.336.75.75.75s.75-.336.75-.75V4.81l3.72 3.72c.146.147.338.22.53.22s.384-.072.53-.22c.293-.293.293-.767 0-1.06z"></path><path d="M19.708 21.944H4.292C3.028 21.944 2 20.916 2 19.652V14c0-.414.336-.75.75-.75s.75.336.75.75v5.652c0 .437.355.792.792.792h15.416c.437 0 .792-.355.792-.792V14c0-.414.336-.75.75-.75s.75.336.75.75v5.652c0 1.264-1.028 2.292-2.292 2.292z"></path></g></svg></div></div></div></div></div></div></div></div></div></article></div></div></div><div style="position: absolute; width: 100%; transform: translateY(458px); transition: opacity 0.3s ease-out 0s;"><div class="css-1dbjc4n r-1adg3ll r-1ny4l3l"></div></div><div style="position: absolute; width: 100%; transform: translateY(458px); transition: opacity 0.3s ease-out 0s;"><div class="css-1dbjc4n r-1adg3ll r-1ny4l3l"><div class="css-1dbjc4n"><article role="article" data-focusable="true" tabindex="0" class="css-1dbjc4n r-1loqt21 r-18u37iz r-1ny4l3l r-1udh08x r-1yt7n81 r-ry3cjt r-o7ynqc r-6416eg"><div class="css-1dbjc4n r-eqz5dr r-16y2uox r-1wbh5a2"><div class="css-1dbjc4n r-16y2uox r-1wbh5a2 r-1ny4l3l"><div class="css-1dbjc4n"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-18u37iz"><div class="css-1dbjc4n r-1iusvr4 r-16y2uox r-m611by"></div></div></div><div class="css-1dbjc4n r-18u37iz" data-testid="tweet"><div class="css-1dbjc4n r-1awozwy r-18kxxzh r-zso239" style="flex-basis: 49px;"><div class="css-1dbjc4n r-18kxxzh r-1wbh5a2 r-13qz1uu"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs"><a href="/CeoDebasis" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-sdzlij r-1loqt21 r-1adg3ll r-ahm1il r-1ny4l3l r-1udh08x r-o7ynqc r-6416eg r-13qz1uu"><div class="css-1dbjc4n r-1adg3ll r-1udh08x" style=""><div class="r-1adg3ll r-13qz1uu" style="padding-bottom: 100%;"></div><div class="r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-ipm5af r-13qz1uu"><div aria-label="" class="css-1dbjc4n r-sdzlij r-1p0dtai r-1mlwlqe r-1d2f490 r-1udh08x r-u8s1d r-zchlnj r-ipm5af r-417010"><div class="css-1dbjc4n r-1niwhzg r-vvn4in r-u6sd8q r-4gszlv r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-13qz1uu r-1wyyakw" style="background-image: url("https://pbs.twimg.com/profile_images/1217048965981536257/dPvLqh4R_bigger.jpg");"></div><img alt="" draggable="true" src="https://pbs.twimg.com/profile_images/1217048965981536257/dPvLqh4R_bigger.jpg" class="css-9pa8cd"></div></div></div><div class="css-1dbjc4n r-1twgtwe r-sdzlij r-rs99b7 r-1p0dtai r-1mi75qu r-1d2f490 r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div></a></div></div><div class="css-1dbjc4n r-1ymxuuo r-16y2uox r-1jgb5lz r-1g94qm0 r-m5arl1"></div></div><div class="css-1dbjc4n r-1iusvr4 r-16y2uox r-1777fci r-1mi0q7o"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-zl2h9q"><div class="css-1dbjc4n r-k4xj1c r-18u37iz r-1wtj0ep"><div class="css-1dbjc4n r-1d09ksm r-18u37iz r-1wbh5a2"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs"><a href="/CeoDebasis" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-1loqt21 r-1wbh5a2 r-dnmrzs r-1ny4l3l"><div class="css-1dbjc4n r-1awozwy r-18u37iz r-1wbh5a2 r-dnmrzs r-1ny4l3l"><div class="css-1dbjc4n r-1awozwy r-18u37iz r-dnmrzs"><div dir="auto" class="css-901oao css-bfa6kz r-18jsvk2 r-1qd0xha r-a023e6 r-b88u0q r-ad9z0x r-bcqeeo r-3s2u2q r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Debasis Chakraborty</span></span></div><div dir="auto" class="css-901oao r-18jsvk2 r-18u37iz r-1q142lx r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"></div></div><div class="css-1dbjc4n r-18u37iz r-1wbh5a2 r-1f6r7vd"><div dir="ltr" class="css-901oao css-bfa6kz r-m0bqgq r-18u37iz r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">@CeoDebasis</span></div></div></div></a></div><div dir="auto" aria-hidden="true" class="css-901oao r-m0bqgq r-1q142lx r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-ou255f r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">·</span></div><a href="/CeoDebasis/status/1336148924395114499" dir="auto" aria-label="Dec 8" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao r-m0bqgq r-1loqt21 r-1q142lx r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-3s2u2q r-qvutc0"><time datetime="2020-12-08T03:21:42.000Z">Dec 8</time></a></div><div class="css-1dbjc4n r-18u37iz r-1h0z5md r-1joea0r"><div aria-expanded="false" aria-haspopup="true" aria-label="More" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="caret"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M19.39 14.882c-1.58 0-2.862-1.283-2.862-2.86s1.283-2.862 2.86-2.862 2.862 1.283 2.862 2.86-1.284 2.862-2.86 2.862zm0-4.223c-.75 0-1.362.61-1.362 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36zM12 14.882c-1.578 0-2.86-1.283-2.86-2.86S10.42 9.158 12 9.158s2.86 1.282 2.86 2.86S13.578 14.88 12 14.88zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.362 1.36 1.362 1.36-.61 1.36-1.36-.61-1.363-1.36-1.363zm-7.39 4.223c-1.577 0-2.86-1.283-2.86-2.86S3.034 9.16 4.61 9.16s2.862 1.283 2.862 2.86-1.283 2.862-2.86 2.862zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36z"></path></g></svg></div></div></div></div></div></div></div><div class="css-1dbjc4n"><div class="css-1dbjc4n r-4qtqp9 r-18u37iz r-1wtj0ep r-zl2h9q"><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0">Replying to <div class="css-1dbjc4n r-xoduu5"><a href="/realDonaldTrump" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao css-16my406 r-1n1174f r-1loqt21 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">@realDonaldTrump</span></a></div> <span class="css-901oao css-16my406 r-1n1174f r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">and</span></span> <div class="css-1dbjc4n r-xoduu5"><a href="/GeoffDuncanGA" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao css-16my406 r-1n1174f r-1loqt21 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">@GeoffDuncanGA</span></a></div></div></div><div class="css-1dbjc4n"><div lang="en" dir="auto" class="css-901oao r-18jsvk2 r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-bnwqim r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">we will win !</span></div></div><div class="css-1dbjc4n"></div><div aria-label="58 replies, 1 Retweet, 35 likes" role="group" class="css-1dbjc4n r-18u37iz r-1wtj0ep r-156q2ks r-1mdbhws"><div class="css-1dbjc4n r-18u37iz r-1h0z5md"><div aria-label="58 Replies. Reply" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="reply"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M14.046 2.242l-4.148-.01h-.002c-4.374 0-7.8 3.427-7.8 7.802 0 4.098 3.186 7.206 7.465 7.37v3.828c0 .108.044.286.12.403.142.225.384.347.632.347.138 0 .277-.038.402-.118.264-.168 6.473-4.14 8.088-5.506 1.902-1.61 3.04-3.97 3.043-6.312v-.017c-.006-4.367-3.43-7.787-7.8-7.788zm3.787 12.972c-1.134.96-4.862 3.405-6.772 4.643V16.67c0-.414-.335-.75-.75-.75h-.396c-3.66 0-6.318-2.476-6.318-5.886 0-3.534 2.768-6.302 6.3-6.302l4.147.01h.002c3.532 0 6.3 2.766 6.302 6.296-.003 1.91-.942 3.844-2.514 5.176z"></path></g></svg></div><div class="css-1dbjc4n r-xoduu5 r-1udh08x"><span class="css-901oao css-16my406 r-1qd0xha r-n6v787 r-1sf4r6n r-1j6idkz r-utggzx r-d3hbe1 r-1wgg2b2 r-axxi2z r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">58</span></span></div></div></div></div><div class="css-1dbjc4n r-18u37iz r-1h0z5md"><div aria-label="1 Retweet. Retweet" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="retweet"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M23.77 15.67c-.292-.293-.767-.293-1.06 0l-2.22 2.22V7.65c0-2.068-1.683-3.75-3.75-3.75h-5.85c-.414 0-.75.336-.75.75s.336.75.75.75h5.85c1.24 0 2.25 1.01 2.25 2.25v10.24l-2.22-2.22c-.293-.293-.768-.293-1.06 0s-.294.768 0 1.06l3.5 3.5c.145.147.337.22.53.22s.383-.072.53-.22l3.5-3.5c.294-.292.294-.767 0-1.06zm-10.66 3.28H7.26c-1.24 0-2.25-1.01-2.25-2.25V6.46l2.22 2.22c.148.147.34.22.532.22s.384-.073.53-.22c.293-.293.293-.768 0-1.06l-3.5-3.5c-.293-.294-.768-.294-1.06 0l-3.5 3.5c-.294.292-.294.767 0 1.06s.767.293 1.06 0l2.22-2.22V16.7c0 2.068 1.683 3.75 3.75 3.75h5.85c.414 0 .75-.336.75-.75s-.337-.75-.75-.75z"></path></g></svg></div><div class="css-1dbjc4n r-xoduu5 r-1udh08x"><span class="css-901oao css-16my406 r-1qd0xha r-n6v787 r-1sf4r6n r-1j6idkz r-utggzx r-d3hbe1 r-1wgg2b2 r-axxi2z r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">1</span></span></div></div></div></div><div class="css-1dbjc4n r-18u37iz r-1h0z5md"><div aria-label="35 Likes. Like" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="like"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M12 21.638h-.014C9.403 21.59 1.95 14.856 1.95 8.478c0-3.064 2.525-5.754 5.403-5.754 2.29 0 3.83 1.58 4.646 2.73.814-1.148 2.354-2.73 4.645-2.73 2.88 0 5.404 2.69 5.404 5.755 0 6.376-7.454 13.11-10.037 13.157H12zM7.354 4.225c-2.08 0-3.903 1.988-3.903 4.255 0 5.74 7.034 11.596 8.55 11.658 1.518-.062 8.55-5.917 8.55-11.658 0-2.267-1.823-4.255-3.903-4.255-2.528 0-3.94 2.936-3.952 2.965-.23.562-1.156.562-1.387 0-.014-.03-1.425-2.965-3.954-2.965z"></path></g></svg></div><div class="css-1dbjc4n r-xoduu5 r-1udh08x"><span class="css-901oao css-16my406 r-1qd0xha r-n6v787 r-1sf4r6n r-1j6idkz r-utggzx r-d3hbe1 r-1wgg2b2 r-axxi2z r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">35</span></span></div></div></div></div><div class="css-1dbjc4n r-18u37iz r-1h0z5md"><div aria-expanded="false" aria-haspopup="true" aria-label="Share Tweet" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M17.53 7.47l-5-5c-.293-.293-.768-.293-1.06 0l-5 5c-.294.293-.294.768 0 1.06s.767.294 1.06 0l3.72-3.72V15c0 .414.336.75.75.75s.75-.336.75-.75V4.81l3.72 3.72c.146.147.338.22.53.22s.384-.072.53-.22c.293-.293.293-.767 0-1.06z"></path><path d="M19.708 21.944H4.292C3.028 21.944 2 20.916 2 19.652V14c0-.414.336-.75.75-.75s.75.336.75.75v5.652c0 .437.355.792.792.792h15.416c.437 0 .792-.355.792-.792V14c0-.414.336-.75.75-.75s.75.336.75.75v5.652c0 1.264-1.028 2.292-2.292 2.292z"></path></g></svg></div></div></div></div></div></div></div></div></div></div></div></article></div></div></div><div style="position: absolute; width: 100%; transform: translateY(568px); transition: opacity 0.3s ease-out 0s;"><div class="css-1dbjc4n r-1adg3ll r-1ny4l3l"><div class="css-1dbjc4n"><article role="article" data-focusable="true" tabindex="0" class="css-1dbjc4n r-1loqt21 r-18u37iz r-1ny4l3l r-1udh08x r-1yt7n81 r-ry3cjt r-o7ynqc r-6416eg"><div class="css-1dbjc4n r-eqz5dr r-16y2uox r-1wbh5a2"><div class="css-1dbjc4n r-16y2uox r-1wbh5a2 r-1ny4l3l"><div class="css-1dbjc4n"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-18u37iz"><div class="css-1dbjc4n r-18kxxzh r-d0pm55 r-zso239" style="flex-basis: 49px;"><div class="css-1dbjc4n r-1ymxuuo r-1p0dtai r-1d2f490 r-1jgb5lz r-u8s1d r-zchlnj r-ipm5af r-m5arl1"></div></div><div class="css-1dbjc4n r-1iusvr4 r-16y2uox r-m611by"></div></div></div><div class="css-1dbjc4n r-18u37iz" data-testid="tweet"><div class="css-1dbjc4n r-1awozwy r-18kxxzh r-zso239" style="flex-basis: 49px;"><div class="css-1dbjc4n r-18kxxzh r-1wbh5a2 r-13qz1uu"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs"><a href="/QGessner" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-sdzlij r-1loqt21 r-1adg3ll r-ahm1il r-1ny4l3l r-1udh08x r-o7ynqc r-6416eg r-13qz1uu"><div class="css-1dbjc4n r-1adg3ll r-1udh08x" style=""><div class="r-1adg3ll r-13qz1uu" style="padding-bottom: 100%;"></div><div class="r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-ipm5af r-13qz1uu"><div aria-label="" class="css-1dbjc4n r-sdzlij r-1p0dtai r-1mlwlqe r-1d2f490 r-1udh08x r-u8s1d r-zchlnj r-ipm5af r-417010"><div class="css-1dbjc4n r-1niwhzg r-vvn4in r-u6sd8q r-4gszlv r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-13qz1uu r-1wyyakw" style="background-image: url("https://pbs.twimg.com/profile_images/3646140063/c50afb957d0ee817a632385280d64e93_bigger.png");"></div><img alt="" draggable="true" src="https://pbs.twimg.com/profile_images/3646140063/c50afb957d0ee817a632385280d64e93_bigger.png" class="css-9pa8cd"></div></div></div><div class="css-1dbjc4n r-1twgtwe r-sdzlij r-rs99b7 r-1p0dtai r-1mi75qu r-1d2f490 r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div></a></div></div><div class="css-1dbjc4n r-1ymxuuo r-16y2uox r-1jgb5lz r-1g94qm0 r-m5arl1"></div></div><div class="css-1dbjc4n r-1iusvr4 r-16y2uox r-1777fci r-1mi0q7o"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-zl2h9q"><div class="css-1dbjc4n r-k4xj1c r-18u37iz r-1wtj0ep"><div class="css-1dbjc4n r-1d09ksm r-18u37iz r-1wbh5a2"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs"><a href="/QGessner" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-1loqt21 r-1wbh5a2 r-dnmrzs r-1ny4l3l"><div class="css-1dbjc4n r-1awozwy r-18u37iz r-1wbh5a2 r-dnmrzs r-1ny4l3l"><div class="css-1dbjc4n r-1awozwy r-18u37iz r-dnmrzs"><div dir="auto" class="css-901oao css-bfa6kz r-18jsvk2 r-1qd0xha r-a023e6 r-b88u0q r-ad9z0x r-bcqeeo r-3s2u2q r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Tom Gessner</span></span></div><div dir="auto" class="css-901oao r-18jsvk2 r-18u37iz r-1q142lx r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"></div></div><div class="css-1dbjc4n r-18u37iz r-1wbh5a2 r-1f6r7vd"><div dir="ltr" class="css-901oao css-bfa6kz r-m0bqgq r-18u37iz r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">@QGessner</span></div></div></div></a></div><div dir="auto" aria-hidden="true" class="css-901oao r-m0bqgq r-1q142lx r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-ou255f r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">·</span></div><a href="/QGessner/status/1336150225057161218" dir="auto" aria-label="Dec 8" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao r-m0bqgq r-1loqt21 r-1q142lx r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-3s2u2q r-qvutc0"><time datetime="2020-12-08T03:26:52.000Z">Dec 8</time></a></div><div class="css-1dbjc4n r-18u37iz r-1h0z5md r-1joea0r"><div aria-expanded="false" aria-haspopup="true" aria-label="More" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="caret"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M19.39 14.882c-1.58 0-2.862-1.283-2.862-2.86s1.283-2.862 2.86-2.862 2.862 1.283 2.862 2.86-1.284 2.862-2.86 2.862zm0-4.223c-.75 0-1.362.61-1.362 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36zM12 14.882c-1.578 0-2.86-1.283-2.86-2.86S10.42 9.158 12 9.158s2.86 1.282 2.86 2.86S13.578 14.88 12 14.88zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.362 1.36 1.362 1.36-.61 1.36-1.36-.61-1.363-1.36-1.363zm-7.39 4.223c-1.577 0-2.86-1.283-2.86-2.86S3.034 9.16 4.61 9.16s2.862 1.283 2.862 2.86-1.283 2.862-2.86 2.862zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36z"></path></g></svg></div></div></div></div></div></div></div><div class="css-1dbjc4n"><div class="css-1dbjc4n"><div lang="en" dir="auto" class="css-901oao r-18jsvk2 r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-bnwqim r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">We did!</span></div></div><div class="css-1dbjc4n"><div class="css-1dbjc4n"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-1bs4hfb r-1867qdf r-1phboty r-rs99b7 r-156q2ks r-1ny4l3l r-1udh08x r-o7ynqc r-6416eg"><div class="css-1dbjc4n"><a href="/QGessner/status/1336150225057161218/photo/1" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-1loqt21 r-1ny4l3l"><div class="css-1dbjc4n r-1adg3ll r-1udh08x" style=""><div class="r-1adg3ll r-13qz1uu" style="padding-bottom: 52.9224%;"></div><div class="r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-ipm5af r-13qz1uu"><div aria-label="Image" class="css-1dbjc4n r-1p0dtai r-1mlwlqe r-1d2f490 r-11wrixw r-61z16t r-1udh08x r-u8s1d r-zchlnj r-ipm5af r-417010" data-testid="tweetPhoto" style="margin-bottom: 0px; margin-top: 0px;"><div class="css-1dbjc4n r-1niwhzg r-vvn4in r-u6sd8q r-4gszlv r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-13qz1uu r-1wyyakw" style="background-image: url("https://pbs.twimg.com/media/Eor1jCeXIAE5dP0?format=jpg&name=small");"></div><img alt="Image" draggable="true" src="https://pbs.twimg.com/media/Eor1jCeXIAE5dP0?format=jpg&name=small" class="css-9pa8cd"></div></div></div></a></div></div></div></div></div><div aria-label="17 replies, 3 Retweets, 149 likes" role="group" class="css-1dbjc4n r-18u37iz r-1wtj0ep r-156q2ks r-1mdbhws"><div class="css-1dbjc4n r-18u37iz r-1h0z5md"><div aria-label="17 Replies. Reply" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="reply"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M14.046 2.242l-4.148-.01h-.002c-4.374 0-7.8 3.427-7.8 7.802 0 4.098 3.186 7.206 7.465 7.37v3.828c0 .108.044.286.12.403.142.225.384.347.632.347.138 0 .277-.038.402-.118.264-.168 6.473-4.14 8.088-5.506 1.902-1.61 3.04-3.97 3.043-6.312v-.017c-.006-4.367-3.43-7.787-7.8-7.788zm3.787 12.972c-1.134.96-4.862 3.405-6.772 4.643V16.67c0-.414-.335-.75-.75-.75h-.396c-3.66 0-6.318-2.476-6.318-5.886 0-3.534 2.768-6.302 6.3-6.302l4.147.01h.002c3.532 0 6.3 2.766 6.302 6.296-.003 1.91-.942 3.844-2.514 5.176z"></path></g></svg></div><div class="css-1dbjc4n r-xoduu5 r-1udh08x"><span class="css-901oao css-16my406 r-1qd0xha r-n6v787 r-1sf4r6n r-1j6idkz r-utggzx r-d3hbe1 r-1wgg2b2 r-axxi2z r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">17</span></span></div></div></div></div><div class="css-1dbjc4n r-18u37iz r-1h0z5md"><div aria-label="3 Retweets. Retweet" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="retweet"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M23.77 15.67c-.292-.293-.767-.293-1.06 0l-2.22 2.22V7.65c0-2.068-1.683-3.75-3.75-3.75h-5.85c-.414 0-.75.336-.75.75s.336.75.75.75h5.85c1.24 0 2.25 1.01 2.25 2.25v10.24l-2.22-2.22c-.293-.293-.768-.293-1.06 0s-.294.768 0 1.06l3.5 3.5c.145.147.337.22.53.22s.383-.072.53-.22l3.5-3.5c.294-.292.294-.767 0-1.06zm-10.66 3.28H7.26c-1.24 0-2.25-1.01-2.25-2.25V6.46l2.22 2.22c.148.147.34.22.532.22s.384-.073.53-.22c.293-.293.293-.768 0-1.06l-3.5-3.5c-.293-.294-.768-.294-1.06 0l-3.5 3.5c-.294.292-.294.767 0 1.06s.767.293 1.06 0l2.22-2.22V16.7c0 2.068 1.683 3.75 3.75 3.75h5.85c.414 0 .75-.336.75-.75s-.337-.75-.75-.75z"></path></g></svg></div><div class="css-1dbjc4n r-xoduu5 r-1udh08x"><span class="css-901oao css-16my406 r-1qd0xha r-n6v787 r-1sf4r6n r-1j6idkz r-utggzx r-d3hbe1 r-1wgg2b2 r-axxi2z r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">3</span></span></div></div></div></div><div class="css-1dbjc4n r-18u37iz r-1h0z5md"><div aria-label="149 Likes. Like" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="like"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M12 21.638h-.014C9.403 21.59 1.95 14.856 1.95 8.478c0-3.064 2.525-5.754 5.403-5.754 2.29 0 3.83 1.58 4.646 2.73.814-1.148 2.354-2.73 4.645-2.73 2.88 0 5.404 2.69 5.404 5.755 0 6.376-7.454 13.11-10.037 13.157H12zM7.354 4.225c-2.08 0-3.903 1.988-3.903 4.255 0 5.74 7.034 11.596 8.55 11.658 1.518-.062 8.55-5.917 8.55-11.658 0-2.267-1.823-4.255-3.903-4.255-2.528 0-3.94 2.936-3.952 2.965-.23.562-1.156.562-1.387 0-.014-.03-1.425-2.965-3.954-2.965z"></path></g></svg></div><div class="css-1dbjc4n r-xoduu5 r-1udh08x"><span class="css-901oao css-16my406 r-1qd0xha r-n6v787 r-1sf4r6n r-1j6idkz r-utggzx r-d3hbe1 r-1wgg2b2 r-axxi2z r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">149</span></span></div></div></div></div><div class="css-1dbjc4n r-18u37iz r-1h0z5md"><div aria-expanded="false" aria-haspopup="true" aria-label="Share Tweet" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M17.53 7.47l-5-5c-.293-.293-.768-.293-1.06 0l-5 5c-.294.293-.294.768 0 1.06s.767.294 1.06 0l3.72-3.72V15c0 .414.336.75.75.75s.75-.336.75-.75V4.81l3.72 3.72c.146.147.338.22.53.22s.384-.072.53-.22c.293-.293.293-.767 0-1.06z"></path><path d="M19.708 21.944H4.292C3.028 21.944 2 20.916 2 19.652V14c0-.414.336-.75.75-.75s.75.336.75.75v5.652c0 .437.355.792.792.792h15.416c.437 0 .792-.355.792-.792V14c0-.414.336-.75.75-.75s.75.336.75.75v5.652c0 1.264-1.028 2.292-2.292 2.292z"></path></g></svg></div></div></div></div></div></div></div></div></div></div></div></article></div></div></div></div></div></section></div></div></div></div><div class="css-1dbjc4n r-aqfbo4 r-zso239 r-1hycxz" data-testid="sidebarColumn"><div class="css-1dbjc4n r-1pi2tsx" style="min-height: 1171px;"><div class="css-1dbjc4n" style="margin-top: 0px;"></div><div class="css-1dbjc4n r-gtdqiz r-1hycxz" style="top: -556px;"><div class="css-1dbjc4n r-1adg3ll"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-1l5qxre r-m611by"><div class="css-1dbjc4n r-1awozwy r-aqfbo4 r-14lw9ot r-18u37iz r-1h3ijdo r-15d164r r-1vsu8ta r-1xcajam r-ipm5af r-1hycxz r-136ojw6"><div class="css-1dbjc4n r-1oszu61 r-1iusvr4 r-18u37iz r-16y2uox"><div class="css-1dbjc4n r-13awgt0 r-eqz5dr r-bnwqim r-8fdsdq"><div class="r-1oszu61 r-1phboty r-1yadl64 r-deolkf r-6koalj r-13awgt0 r-eqz5dr r-crgep1 r-ifefl9 r-bcqeeo r-t60dpp r-bnwqim r-417010"><form action="#" aria-label="Search Twitter" role="search" class="r-1oszu61 r-1phboty r-1yadl64 r-deolkf r-6koalj r-13awgt0 r-eqz5dr r-crgep1 r-ifefl9 r-bcqeeo r-t60dpp r-bnwqim r-417010"><div class="css-1dbjc4n r-1wbh5a2"><div class="css-1dbjc4n r-z1a2ur r-42olwf r-sdzlij r-1phboty r-rs99b7 r-eqz5dr r-16y2uox r-1wbh5a2 r-1777fci"><div class="css-1dbjc4n r-18u37iz"><div class="css-1dbjc4n r-6koalj r-1777fci"><svg viewBox="0 0 24 24" class="r-m0bqgq r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-18qmn74 r-1hfyk0a r-bnwqim r-1plcrui r-lrvibr"><g><path d="M21.53 20.47l-3.66-3.66C19.195 15.24 20 13.214 20 11c0-4.97-4.03-9-9-9s-9 4.03-9 9 4.03 9 9 9c2.215 0 4.24-.804 5.808-2.13l3.66 3.66c.147.146.34.22.53.22s.385-.073.53-.22c.295-.293.295-.767.002-1.06zM3.5 11c0-4.135 3.365-7.5 7.5-7.5s7.5 3.365 7.5 7.5-3.365 7.5-7.5 7.5-7.5-3.365-7.5-7.5z"></path></g></svg></div><div dir="auto" class="css-901oao r-18jsvk2 r-6koalj r-16y2uox r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><input aria-activedescendant="typeaheadFocus-0.8964335274850133" aria-autocomplete="list" aria-label="Search query" aria-owns="typeaheadDropdown-1" autocapitalize="sentences" autocomplete="off" autocorrect="off" placeholder="Search Twitter" role="combobox" spellcheck="false" enterkeyhint="search" type="text" dir="auto" data-focusable="true" class="r-30o5oe r-1niwhzg r-17gur6a r-1yadl64 r-deolkf r-homxoj r-poiln3 r-7cikom r-1ny4l3l r-1sp51qo r-ny71av r-1dz5y72 r-fdjqy7 r-13qz1uu" data-testid="SearchBox_Search_Input" value=""></div><div class="css-1dbjc4n r-6koalj r-1777fci"></div></div></div></div><div class="css-1dbjc4n r-13awgt0 r-bnwqim"></div></form></div></div></div></div><div class="css-1dbjc4n r-1h3ijdo"></div><div class="css-1dbjc4n r-14lw9ot r-1gm7m50 r-1867qdf r-1phboty r-rs99b7 r-ku1wi2 r-1udh08x"><section aria-label="Sign up" role="region" class="css-1dbjc4n"><div class="css-1dbjc4n r-1wtj0ep r-1j3t67a r-1w50u8q"><h2 aria-level="2" role="heading" class="css-4rbku5 css-1dbjc4n r-18u37iz"><div class="css-1dbjc4n r-k200y r-z80fyv r-1777fci r-1bymd8e"></div><div dir="auto" class="css-901oao css-cens5h r-18jsvk2 r-1qd0xha r-1b6yd1w r-1vr29t4 r-ad9z0x r-bcqeeo r-qvutc0" style="-webkit-line-clamp: 3;"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">New to Twitter?</span></div></h2></div><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-bcqeeo r-1hfyk0a r-1qfoi16 r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Sign up now to get your own personalized timeline!</span></div><a href="/i/flow/signup" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-urgr8i r-42olwf r-sdzlij r-1phboty r-rs99b7 r-1loqt21 r-1w2pmg r-ku1wi2 r-1n0xq6e r-zso239 r-19h5ruw r-1vuscfd r-1dhvaqw r-1ny4l3l r-1fneopy r-o7ynqc r-6416eg r-lrvibr"><div dir="auto" class="css-901oao r-1awozwy r-jwli3a r-6koalj r-18u37iz r-16y2uox r-1qd0xha r-a023e6 r-b88u0q r-1777fci r-eljoum r-dnmrzs r-bcqeeo r-q4m81j r-qvutc0"><span class="css-901oao css-16my406 css-bfa6kz r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Sign up</span></span></div></a></section></div><div class="css-1dbjc4n r-14lw9ot r-1gm7m50 r-1867qdf r-1phboty r-rs99b7 r-ku1wi2 r-1udh08x"><aside aria-label="Relevant people" role="complementary" class="css-1dbjc4n"><div class="css-1dbjc4n r-j7yic r-rull8r r-qklmqi r-1wtj0ep r-1j3t67a r-1w50u8q"><h2 aria-level="2" role="heading" class="css-4rbku5 css-1dbjc4n r-18u37iz"><div class="css-1dbjc4n r-k200y r-z80fyv r-1777fci r-1bymd8e"></div><div dir="auto" class="css-901oao css-cens5h r-18jsvk2 r-1qd0xha r-1b6yd1w r-1vr29t4 r-ad9z0x r-bcqeeo r-qvutc0" style="-webkit-line-clamp: 3;"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Relevant people</span></div></h2></div><div class="css-1dbjc4n"><div role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-j7yic r-rull8r r-qklmqi r-1ny4l3l r-1j3t67a r-1w50u8q r-o7ynqc r-6416eg" data-testid="UserCell"><div class="css-1dbjc4n r-18u37iz"><div class="css-1dbjc4n r-18kxxzh r-1h0z5md r-zso239" style="flex-basis: 49px;"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs"><a href="/realDonaldTrump" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-sdzlij r-1loqt21 r-1adg3ll r-ahm1il r-1ny4l3l r-1udh08x r-o7ynqc r-6416eg r-13qz1uu"><div class="css-1dbjc4n r-1adg3ll r-1udh08x" style=""><div class="r-1adg3ll r-13qz1uu" style="padding-bottom: 100%;"></div><div class="r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-ipm5af r-13qz1uu"><div aria-label="" class="css-1dbjc4n r-sdzlij r-1p0dtai r-1mlwlqe r-1d2f490 r-1udh08x r-u8s1d r-zchlnj r-ipm5af r-417010"><div class="css-1dbjc4n r-1niwhzg r-vvn4in r-u6sd8q r-4gszlv r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-13qz1uu r-1wyyakw" style="background-image: url("https://pbs.twimg.com/profile_images/874276197357596672/kUuht00m_bigger.jpg");"></div><img alt="" draggable="true" src="https://pbs.twimg.com/profile_images/874276197357596672/kUuht00m_bigger.jpg" class="css-9pa8cd"></div></div></div><div class="css-1dbjc4n r-1twgtwe r-sdzlij r-rs99b7 r-1p0dtai r-1mi75qu r-1d2f490 r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div></a></div></div><div class="css-1dbjc4n r-1iusvr4 r-16y2uox"><div class="css-1dbjc4n r-1awozwy r-18u37iz r-1wtj0ep"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs"><a href="/realDonaldTrump" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-1loqt21 r-1wbh5a2 r-dnmrzs r-1ny4l3l"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs r-1ny4l3l"><div class="css-1dbjc4n r-1awozwy r-18u37iz r-dnmrzs"><div dir="auto" class="css-901oao css-bfa6kz r-18jsvk2 r-1qd0xha r-a023e6 r-b88u0q r-ad9z0x r-bcqeeo r-3s2u2q r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Donald J. Trump</span></span></div><div dir="auto" class="css-901oao r-18jsvk2 r-18u37iz r-1q142lx r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><svg viewBox="0 0 24 24" aria-label="Verified account" class="r-13gxpu9 r-4qtqp9 r-yyyyoo r-1xvli5t r-9cviqr r-dnmrzs r-bnwqim r-1plcrui r-lrvibr"><g><path d="M22.5 12.5c0-1.58-.875-2.95-2.148-3.6.154-.435.238-.905.238-1.4 0-2.21-1.71-3.998-3.818-3.998-.47 0-.92.084-1.336.25C14.818 2.415 13.51 1.5 12 1.5s-2.816.917-3.437 2.25c-.415-.165-.866-.25-1.336-.25-2.11 0-3.818 1.79-3.818 4 0 .494.083.964.237 1.4-1.272.65-2.147 2.018-2.147 3.6 0 1.495.782 2.798 1.942 3.486-.02.17-.032.34-.032.514 0 2.21 1.708 4 3.818 4 .47 0 .92-.086 1.335-.25.62 1.334 1.926 2.25 3.437 2.25 1.512 0 2.818-.916 3.437-2.25.415.163.865.248 1.336.248 2.11 0 3.818-1.79 3.818-4 0-.174-.012-.344-.033-.513 1.158-.687 1.943-1.99 1.943-3.484zm-6.616-3.334l-4.334 6.5c-.145.217-.382.334-.625.334-.143 0-.288-.04-.416-.126l-.115-.094-2.415-2.415c-.293-.293-.293-.768 0-1.06s.768-.294 1.06 0l1.77 1.767 3.825-5.74c.23-.345.696-.436 1.04-.207.346.23.44.696.21 1.04z"></path></g></svg></div></div><div class="css-1dbjc4n r-18u37iz r-1wbh5a2"><div dir="ltr" class="css-901oao css-bfa6kz r-m0bqgq r-18u37iz r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">@realDonaldTrump</span></div></div></div></a></div><div class="css-1dbjc4n r-1n0xq6e" style="min-width: 79px;"><div role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1niwhzg r-p1n3y5 r-sdzlij r-1phboty r-rs99b7 r-1w2pmg r-1vsu8ta r-aj3cln r-1ny4l3l r-1fneopy r-o7ynqc r-6416eg r-lrvibr" data-testid="25073877-follow"><div dir="auto" class="css-901oao r-1awozwy r-13gxpu9 r-6koalj r-18u37iz r-16y2uox r-1qd0xha r-a023e6 r-b88u0q r-1777fci r-eljoum r-dnmrzs r-bcqeeo r-q4m81j r-qvutc0"><span class="css-901oao css-16my406 css-bfa6kz r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Follow</span></span></div></div></div></div><div dir="auto" class="css-901oao r-18jsvk2 r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-glunga r-1jeg54m r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">45th President of the United States of America</span><span class="css-901oao css-16my406 r-4qtqp9 r-ip8ujx r-sjv1od r-zw8f10 r-bnwqim r-h9hxbl"><div aria-label="🇺🇸" class="css-1dbjc4n r-xoduu5 r-1mlwlqe r-1d2f490 r-1udh08x r-u8s1d r-h9hxbl r-417010" style="height: 1.2em;"><div class="css-1dbjc4n r-1niwhzg r-vvn4in r-u6sd8q r-x3cy2q r-1p0dtai r-xoduu5 r-1pi2tsx r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-13qz1uu r-1wyyakw" style="background-image: url("https://abs-0.twimg.com/emoji/v2/svg/1f1fa-1f1f8.svg");"></div><img alt="🇺🇸" draggable="false" src="https://abs-0.twimg.com/emoji/v2/svg/1f1fa-1f1f8.svg" class="css-9pa8cd"></div></span></div></div></div></div><div role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1ny4l3l r-1j3t67a r-1w50u8q r-o7ynqc r-6416eg" data-testid="UserCell"><div class="css-1dbjc4n r-18u37iz"><div class="css-1dbjc4n r-18kxxzh r-1h0z5md r-zso239" style="flex-basis: 49px;"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs"><a href="/GeoffDuncanGA" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-sdzlij r-1loqt21 r-1adg3ll r-ahm1il r-1ny4l3l r-1udh08x r-o7ynqc r-6416eg r-13qz1uu"><div class="css-1dbjc4n r-1adg3ll r-1udh08x" style=""><div class="r-1adg3ll r-13qz1uu" style="padding-bottom: 100%;"></div><div class="r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-ipm5af r-13qz1uu"><div aria-label="" class="css-1dbjc4n r-sdzlij r-1p0dtai r-1mlwlqe r-1d2f490 r-1udh08x r-u8s1d r-zchlnj r-ipm5af r-417010"><div class="css-1dbjc4n r-1niwhzg r-vvn4in r-u6sd8q r-4gszlv r-1p0dtai r-1pi2tsx r-1d2f490 r-u8s1d r-zchlnj r-ipm5af r-13qz1uu r-1wyyakw" style="background-image: url("https://pbs.twimg.com/profile_images/1214346510369865728/4V-mA4BN_bigger.jpg");"></div><img alt="" draggable="true" src="https://pbs.twimg.com/profile_images/1214346510369865728/4V-mA4BN_bigger.jpg" class="css-9pa8cd"></div></div></div><div class="css-1dbjc4n r-1twgtwe r-sdzlij r-rs99b7 r-1p0dtai r-1mi75qu r-1d2f490 r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div></a></div></div><div class="css-1dbjc4n r-1iusvr4 r-16y2uox"><div class="css-1dbjc4n r-1awozwy r-18u37iz r-1wtj0ep"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs"><a href="/GeoffDuncanGA" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-1loqt21 r-1wbh5a2 r-dnmrzs r-1ny4l3l"><div class="css-1dbjc4n r-1wbh5a2 r-dnmrzs r-1ny4l3l"><div class="css-1dbjc4n r-1awozwy r-18u37iz r-dnmrzs"><div dir="auto" class="css-901oao css-bfa6kz r-18jsvk2 r-1qd0xha r-a023e6 r-b88u0q r-ad9z0x r-bcqeeo r-3s2u2q r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Geoff Duncan</span></span></div><div dir="auto" class="css-901oao r-18jsvk2 r-18u37iz r-1q142lx r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><svg viewBox="0 0 24 24" aria-label="Verified account" class="r-13gxpu9 r-4qtqp9 r-yyyyoo r-1xvli5t r-9cviqr r-dnmrzs r-bnwqim r-1plcrui r-lrvibr"><g><path d="M22.5 12.5c0-1.58-.875-2.95-2.148-3.6.154-.435.238-.905.238-1.4 0-2.21-1.71-3.998-3.818-3.998-.47 0-.92.084-1.336.25C14.818 2.415 13.51 1.5 12 1.5s-2.816.917-3.437 2.25c-.415-.165-.866-.25-1.336-.25-2.11 0-3.818 1.79-3.818 4 0 .494.083.964.237 1.4-1.272.65-2.147 2.018-2.147 3.6 0 1.495.782 2.798 1.942 3.486-.02.17-.032.34-.032.514 0 2.21 1.708 4 3.818 4 .47 0 .92-.086 1.335-.25.62 1.334 1.926 2.25 3.437 2.25 1.512 0 2.818-.916 3.437-2.25.415.163.865.248 1.336.248 2.11 0 3.818-1.79 3.818-4 0-.174-.012-.344-.033-.513 1.158-.687 1.943-1.99 1.943-3.484zm-6.616-3.334l-4.334 6.5c-.145.217-.382.334-.625.334-.143 0-.288-.04-.416-.126l-.115-.094-2.415-2.415c-.293-.293-.293-.768 0-1.06s.768-.294 1.06 0l1.77 1.767 3.825-5.74c.23-.345.696-.436 1.04-.207.346.23.44.696.21 1.04z"></path></g></svg></div></div><div class="css-1dbjc4n r-18u37iz r-1wbh5a2"><div dir="ltr" class="css-901oao css-bfa6kz r-m0bqgq r-18u37iz r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">@GeoffDuncanGA</span></div></div></div></a></div><div class="css-1dbjc4n r-1n0xq6e" style="min-width: 79px;"><div role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1niwhzg r-p1n3y5 r-sdzlij r-1phboty r-rs99b7 r-1w2pmg r-1vsu8ta r-aj3cln r-1ny4l3l r-1fneopy r-o7ynqc r-6416eg r-lrvibr" data-testid="907144981-follow"><div dir="auto" class="css-901oao r-1awozwy r-13gxpu9 r-6koalj r-18u37iz r-16y2uox r-1qd0xha r-a023e6 r-b88u0q r-1777fci r-eljoum r-dnmrzs r-bcqeeo r-q4m81j r-qvutc0"><span class="css-901oao css-16my406 css-bfa6kz r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Follow</span></span></div></div></div></div><div dir="auto" class="css-901oao r-18jsvk2 r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-glunga r-1jeg54m r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Proud father of 3 boys, Happily married to my best friend Brooke, Lt. Governor of Georgia </span><span class="r-18u37iz"><a dir="ltr" href="/search?q=%23TeamDuncan&src=hashtag_click" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao css-16my406 r-1n1174f r-1loqt21 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">#TeamDuncan</a></span><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"> // Neh 6:3</span></div></div></div></div></div></aside></div><div class="css-1dbjc4n r-1ihkh82 r-1in3vh1 r-1867qdf r-1phboty r-rs99b7 r-ku1wi2 r-1udh08x"><div class="css-1dbjc4n"><div class="css-1dbjc4n"><section aria-labelledby="accessible-list-1" role="region" class="css-1dbjc4n"><h1 aria-level="1" dir="auto" role="heading" class="css-4rbku5 css-901oao r-4iw3lz r-1xk2f4g r-109y4c4 r-1udh08x r-wwvuq4 r-u8s1d r-92ng3h" id="accessible-list-1">Trending now</h1><div aria-label="Timeline: Trending now" class="css-1dbjc4n"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-1adg3ll r-1ny4l3l"><div class="css-1dbjc4n"><div class="css-1dbjc4n r-j7yic r-rull8r r-qklmqi r-1wtj0ep r-1j3t67a r-1w50u8q"><h2 aria-level="2" role="heading" class="css-4rbku5 css-1dbjc4n r-18u37iz"><div class="css-1dbjc4n r-k200y r-z80fyv r-1777fci r-1bymd8e"></div><div dir="auto" class="css-901oao css-cens5h r-1habvwh r-18jsvk2 r-16y2uox r-1wbh5a2 r-1qd0xha r-1b6yd1w r-1vr29t4 r-1pi2tsx r-1777fci r-ad9z0x r-bcqeeo r-qvutc0" style="-webkit-line-clamp: 3;"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Trends for you</span></div><div class="css-1dbjc4n r-k200y r-z80fyv r-1777fci r-1bymd8e"><a href="/settings/trends" aria-label="Settings" role="button" data-focusable="true" class="css-4rbku5 css-18t94o4 css-1dbjc4n r-1niwhzg r-42olwf r-sdzlij r-1phboty r-rs99b7 r-1loqt21 r-1w2pmg r-5pqaiu r-1vuscfd r-53xb7h r-1ny4l3l r-mk0yit r-o7ynqc r-6416eg r-lrvibr" style="margin-right: calc(0px + (-1 * (41px - 1.5em)) / 2);"><div dir="auto" class="css-901oao r-1awozwy r-13gxpu9 r-6koalj r-18u37iz r-16y2uox r-1qd0xha r-a023e6 r-b88u0q r-1777fci r-eljoum r-dnmrzs r-bcqeeo r-q4m81j r-qvutc0"><svg viewBox="0 0 24 24" class="r-13gxpu9 r-4qtqp9 r-yyyyoo r-1q142lx r-50lct3 r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1srniue"><g><path d="M12 8.21c-2.09 0-3.79 1.7-3.79 3.79s1.7 3.79 3.79 3.79 3.79-1.7 3.79-3.79-1.7-3.79-3.79-3.79zm0 6.08c-1.262 0-2.29-1.026-2.29-2.29S10.74 9.71 12 9.71s2.29 1.026 2.29 2.29-1.028 2.29-2.29 2.29z"></path><path d="M12.36 22.375h-.722c-1.183 0-2.154-.888-2.262-2.064l-.014-.147c-.025-.287-.207-.533-.472-.644-.286-.12-.582-.065-.798.115l-.116.097c-.868.725-2.253.663-3.06-.14l-.51-.51c-.836-.84-.896-2.154-.14-3.06l.098-.118c.186-.222.23-.523.122-.787-.11-.272-.358-.454-.646-.48l-.15-.014c-1.18-.107-2.067-1.08-2.067-2.262v-.722c0-1.183.888-2.154 2.064-2.262l.156-.014c.285-.025.53-.207.642-.473.11-.27.065-.573-.12-.795l-.094-.116c-.757-.908-.698-2.223.137-3.06l.512-.512c.804-.804 2.188-.865 3.06-.14l.116.098c.218.184.528.23.79.122.27-.112.452-.358.477-.643l.014-.153c.107-1.18 1.08-2.066 2.262-2.066h.722c1.183 0 2.154.888 2.262 2.064l.014.156c.025.285.206.53.472.64.277.117.58.062.794-.117l.12-.102c.867-.723 2.254-.662 3.06.14l.51.512c.836.838.896 2.153.14 3.06l-.1.118c-.188.22-.234.522-.123.788.112.27.36.45.646.478l.152.014c1.18.107 2.067 1.08 2.067 2.262v.723c0 1.183-.888 2.154-2.064 2.262l-.155.014c-.284.024-.53.205-.64.47-.113.272-.067.574.117.795l.1.12c.756.905.696 2.22-.14 3.06l-.51.51c-.807.804-2.19.864-3.06.14l-.115-.096c-.217-.183-.53-.23-.79-.122-.273.114-.455.36-.48.646l-.014.15c-.107 1.173-1.08 2.06-2.262 2.06zm-3.773-4.42c.3 0 .593.06.87.175.79.328 1.324 1.054 1.4 1.896l.014.147c.037.4.367.7.77.7h.722c.4 0 .73-.3.768-.7l.014-.148c.076-.842.61-1.567 1.392-1.892.793-.33 1.696-.182 2.333.35l.113.094c.178.148.366.18.493.18.206 0 .4-.08.546-.227l.51-.51c.284-.284.305-.73.048-1.038l-.1-.12c-.542-.65-.677-1.54-.352-2.323.326-.79 1.052-1.32 1.894-1.397l.155-.014c.397-.037.7-.367.7-.77v-.722c0-.4-.303-.73-.702-.768l-.152-.014c-.846-.078-1.57-.61-1.895-1.393-.326-.788-.19-1.678.353-2.327l.1-.118c.257-.31.236-.756-.048-1.04l-.51-.51c-.146-.147-.34-.227-.546-.227-.127 0-.315.032-.492.18l-.12.1c-.634.528-1.55.67-2.322.354-.788-.327-1.32-1.052-1.397-1.896l-.014-.155c-.035-.397-.365-.7-.767-.7h-.723c-.4 0-.73.303-.768.702l-.014.152c-.076.843-.608 1.568-1.39 1.893-.787.326-1.693.183-2.33-.35l-.118-.096c-.18-.15-.368-.18-.495-.18-.206 0-.4.08-.546.226l-.512.51c-.282.284-.303.73-.046 1.038l.1.118c.54.653.677 1.544.352 2.325-.327.788-1.052 1.32-1.895 1.397l-.156.014c-.397.037-.7.367-.7.77v.722c0 .4.303.73.702.768l.15.014c.848.078 1.573.612 1.897 1.396.325.786.19 1.675-.353 2.325l-.096.115c-.26.31-.238.756.046 1.04l.51.51c.146.147.34.227.546.227.127 0 .315-.03.492-.18l.116-.096c.406-.336.923-.524 1.453-.524z"></path></g></svg><span class="css-901oao css-16my406 css-bfa6kz r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0"></span></div></a></div></h2></div><div class="css-1dbjc4n r-j7yic r-qklmqi r-1adg3ll r-1ny4l3l"><div data-focusable="true" tabindex="0" class="css-1dbjc4n r-1loqt21 r-6koalj r-1ny4l3l r-1j3t67a r-1w50u8q r-o7ynqc r-6416eg" data-testid="trend" role="link"><div class="css-1dbjc4n r-16y2uox r-bnwqim"><div class="css-1dbjc4n r-1d09ksm r-18u37iz r-1wbh5a2"><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Politics · Trending</span></div></div><div dir="ltr" class="css-901oao r-18jsvk2 r-1qd0xha r-a023e6 r-b88u0q r-ad9z0x r-bcqeeo r-vmopo1 r-qvutc0"><span class="r-18u37iz"><span dir="ltr" class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">#FamilyMeeting</span></span></div><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-1g94qm0 r-bcqeeo r-qvutc0" data-testid="metadata"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">11.6K Tweets</span></div><div class="css-1dbjc4n r-u8s1d r-zchlnj r-1jy2w8o"><div class="css-1dbjc4n r-18u37iz r-1h0z5md r-1joea0r"><div aria-expanded="false" aria-haspopup="true" aria-label="More" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="caret"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M19.39 14.882c-1.58 0-2.862-1.283-2.862-2.86s1.283-2.862 2.86-2.862 2.862 1.283 2.862 2.86-1.284 2.862-2.86 2.862zm0-4.223c-.75 0-1.362.61-1.362 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36zM12 14.882c-1.578 0-2.86-1.283-2.86-2.86S10.42 9.158 12 9.158s2.86 1.282 2.86 2.86S13.578 14.88 12 14.88zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.362 1.36 1.362 1.36-.61 1.36-1.36-.61-1.363-1.36-1.363zm-7.39 4.223c-1.577 0-2.86-1.283-2.86-2.86S3.034 9.16 4.61 9.16s2.862 1.283 2.862 2.86-1.283 2.862-2.86 2.862zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36z"></path></g></svg></div></div></div></div></div></div></div></div><div class="css-1dbjc4n r-j7yic r-qklmqi r-1adg3ll r-1ny4l3l"><div data-focusable="true" tabindex="0" class="css-1dbjc4n r-1loqt21 r-6koalj r-1ny4l3l r-1j3t67a r-1w50u8q r-o7ynqc r-6416eg" data-testid="trend" role="link"><div class="css-1dbjc4n r-16y2uox r-bnwqim"><div class="css-1dbjc4n r-1d09ksm r-18u37iz r-1wbh5a2"><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Trending worldwide</span></div></div><div dir="ltr" class="css-901oao r-18jsvk2 r-1qd0xha r-a023e6 r-b88u0q r-ad9z0x r-bcqeeo r-vmopo1 r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">31 Aralık Perşembe</span></div><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-1g94qm0 r-bcqeeo r-qvutc0" data-testid="metadata"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">6,567 Tweets</span></div><div class="css-1dbjc4n r-u8s1d r-zchlnj r-1jy2w8o"><div class="css-1dbjc4n r-18u37iz r-1h0z5md r-1joea0r"><div aria-expanded="false" aria-haspopup="true" aria-label="More" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="caret"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M19.39 14.882c-1.58 0-2.862-1.283-2.862-2.86s1.283-2.862 2.86-2.862 2.862 1.283 2.862 2.86-1.284 2.862-2.86 2.862zm0-4.223c-.75 0-1.362.61-1.362 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36zM12 14.882c-1.578 0-2.86-1.283-2.86-2.86S10.42 9.158 12 9.158s2.86 1.282 2.86 2.86S13.578 14.88 12 14.88zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.362 1.36 1.362 1.36-.61 1.36-1.36-.61-1.363-1.36-1.363zm-7.39 4.223c-1.577 0-2.86-1.283-2.86-2.86S3.034 9.16 4.61 9.16s2.862 1.283 2.862 2.86-1.283 2.862-2.86 2.862zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36z"></path></g></svg></div></div></div></div></div></div></div></div><div class="css-1dbjc4n r-j7yic r-qklmqi r-1adg3ll r-1ny4l3l"><div data-focusable="true" tabindex="0" class="css-1dbjc4n r-1loqt21 r-6koalj r-1ny4l3l r-1j3t67a r-1w50u8q r-o7ynqc r-6416eg" data-testid="trend" role="link"><div class="css-1dbjc4n r-16y2uox r-bnwqim"><div class="css-1dbjc4n r-1d09ksm r-18u37iz r-1wbh5a2"><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Trending worldwide</span></div></div><div dir="ltr" class="css-901oao r-18jsvk2 r-1qd0xha r-a023e6 r-b88u0q r-ad9z0x r-bcqeeo r-vmopo1 r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">TL'ye</span></div><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-1g94qm0 r-bcqeeo r-qvutc0" data-testid="metadata"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">7,232 Tweets</span></div><div class="css-1dbjc4n r-u8s1d r-zchlnj r-1jy2w8o"><div class="css-1dbjc4n r-18u37iz r-1h0z5md r-1joea0r"><div aria-expanded="false" aria-haspopup="true" aria-label="More" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="caret"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M19.39 14.882c-1.58 0-2.862-1.283-2.862-2.86s1.283-2.862 2.86-2.862 2.862 1.283 2.862 2.86-1.284 2.862-2.86 2.862zm0-4.223c-.75 0-1.362.61-1.362 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36zM12 14.882c-1.578 0-2.86-1.283-2.86-2.86S10.42 9.158 12 9.158s2.86 1.282 2.86 2.86S13.578 14.88 12 14.88zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.362 1.36 1.362 1.36-.61 1.36-1.36-.61-1.363-1.36-1.363zm-7.39 4.223c-1.577 0-2.86-1.283-2.86-2.86S3.034 9.16 4.61 9.16s2.862 1.283 2.862 2.86-1.283 2.862-2.86 2.862zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36z"></path></g></svg></div></div></div></div></div></div></div></div><div class="css-1dbjc4n r-j7yic r-qklmqi r-1adg3ll r-1ny4l3l"><div data-focusable="true" tabindex="0" class="css-1dbjc4n r-1loqt21 r-6koalj r-1ny4l3l r-1j3t67a r-1w50u8q r-o7ynqc r-6416eg" data-testid="trend" role="link"><div class="css-1dbjc4n r-16y2uox r-bnwqim"><div class="css-1dbjc4n r-1d09ksm r-18u37iz r-1wbh5a2"><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Politics · Trending</span></div></div><div dir="ltr" class="css-901oao r-18jsvk2 r-1qd0xha r-a023e6 r-b88u0q r-ad9z0x r-bcqeeo r-vmopo1 r-qvutc0"><span class="r-18u37iz"><span dir="ltr" class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">#toespraakrutte</span></span></div><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-1g94qm0 r-bcqeeo r-qvutc0" data-testid="metadata"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">8,555 Tweets</span></div><div class="css-1dbjc4n r-u8s1d r-zchlnj r-1jy2w8o"><div class="css-1dbjc4n r-18u37iz r-1h0z5md r-1joea0r"><div aria-expanded="false" aria-haspopup="true" aria-label="More" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="caret"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M19.39 14.882c-1.58 0-2.862-1.283-2.862-2.86s1.283-2.862 2.86-2.862 2.862 1.283 2.862 2.86-1.284 2.862-2.86 2.862zm0-4.223c-.75 0-1.362.61-1.362 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36zM12 14.882c-1.578 0-2.86-1.283-2.86-2.86S10.42 9.158 12 9.158s2.86 1.282 2.86 2.86S13.578 14.88 12 14.88zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.362 1.36 1.362 1.36-.61 1.36-1.36-.61-1.363-1.36-1.363zm-7.39 4.223c-1.577 0-2.86-1.283-2.86-2.86S3.034 9.16 4.61 9.16s2.862 1.283 2.862 2.86-1.283 2.862-2.86 2.862zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36z"></path></g></svg></div></div></div></div></div></div></div></div><div class="css-1dbjc4n r-j7yic r-qklmqi r-1adg3ll r-1ny4l3l"><div data-focusable="true" tabindex="0" class="css-1dbjc4n r-1loqt21 r-6koalj r-1ny4l3l r-1j3t67a r-1w50u8q r-o7ynqc r-6416eg" data-testid="trend" role="link"><div class="css-1dbjc4n r-16y2uox r-bnwqim"><div class="css-1dbjc4n r-1d09ksm r-18u37iz r-1wbh5a2"><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Entertainment · Trending</span></div></div><div dir="ltr" class="css-901oao r-18jsvk2 r-1qd0xha r-a023e6 r-b88u0q r-ad9z0x r-bcqeeo r-vmopo1 r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Cüneyt Özdemir</span></div><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-1g94qm0 r-bcqeeo r-qvutc0" data-testid="metadata"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">2,199 Tweets</span></div><div class="css-1dbjc4n r-u8s1d r-zchlnj r-1jy2w8o"><div class="css-1dbjc4n r-18u37iz r-1h0z5md r-1joea0r"><div aria-expanded="false" aria-haspopup="true" aria-label="More" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1777fci r-11cpok1 r-1ny4l3l r-bztko3 r-lrvibr" data-testid="caret"><div dir="ltr" class="css-901oao r-1awozwy r-m0bqgq r-6koalj r-1qd0xha r-a023e6 r-16dba41 r-1h0z5md r-ad9z0x r-bcqeeo r-o7ynqc r-clp7b1 r-3s2u2q r-qvutc0"><div class="css-1dbjc4n r-xoduu5"><div class="css-1dbjc4n r-1niwhzg r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-1ny4l3l r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg"></div><svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-1hdv0qi"><g><path d="M19.39 14.882c-1.58 0-2.862-1.283-2.862-2.86s1.283-2.862 2.86-2.862 2.862 1.283 2.862 2.86-1.284 2.862-2.86 2.862zm0-4.223c-.75 0-1.362.61-1.362 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36zM12 14.882c-1.578 0-2.86-1.283-2.86-2.86S10.42 9.158 12 9.158s2.86 1.282 2.86 2.86S13.578 14.88 12 14.88zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.362 1.36 1.362 1.36-.61 1.36-1.36-.61-1.363-1.36-1.363zm-7.39 4.223c-1.577 0-2.86-1.283-2.86-2.86S3.034 9.16 4.61 9.16s2.862 1.283 2.862 2.86-1.283 2.862-2.86 2.862zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36z"></path></g></svg></div></div></div></div></div></div></div></div><div role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-1pp923h r-1moyyf3 r-1ny4l3l r-1j3t67a r-9qu9m4 r-o7ynqc r-6416eg"><div dir="auto" class="css-901oao r-13gxpu9 r-1qd0xha r-a023e6 r-16dba41 r-ad9z0x r-bcqeeo r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Show more</span></div></div></div></div></div></div></section></div></div></div><div class="css-1dbjc4n r-1niwhzg r-1gm7m50 r-1867qdf r-1phboty r-1yadl64 r-ku1wi2 r-1udh08x"><nav aria-label="Footer" role="navigation" class="css-1dbjc4n r-18u37iz r-1w6e6rj r-1j3t67a"><a href="https://twitter.com/tos" target="_blank" dir="auto" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao r-m0bqgq r-1loqt21 r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-hrzydr r-bcqeeo r-1qfoi16 r-qvutc0" rel=" noopener noreferrer"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Terms of Service</span></a><a href="https://twitter.com/privacy" target="_blank" dir="auto" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao r-m0bqgq r-1loqt21 r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-hrzydr r-bcqeeo r-1qfoi16 r-qvutc0" rel=" noopener noreferrer"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Privacy Policy</span></a><a href="https://support.twitter.com/articles/20170514" target="_blank" dir="auto" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao r-m0bqgq r-1loqt21 r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-hrzydr r-bcqeeo r-1qfoi16 r-qvutc0" rel=" noopener noreferrer"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Cookie Policy</span></a><a href="https://business.twitter.com/en/help/troubleshooting/how-twitter-ads-work.html" target="_blank" dir="auto" role="link" data-focusable="true" class="css-4rbku5 css-18t94o4 css-901oao r-m0bqgq r-1loqt21 r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-hrzydr r-bcqeeo r-1qfoi16 r-qvutc0" rel=" noopener noreferrer"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">Ads info</span></a><div aria-expanded="false" aria-haspopup="true" aria-label="More" role="button" data-focusable="true" tabindex="0" class="css-18t94o4 css-1dbjc4n r-hrzydr r-1qfoi16"><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-bcqeeo r-qvutc0">More<svg viewBox="0 0 24 24" class="r-4qtqp9 r-yyyyoo r-ip8ujx r-dnmrzs r-1p4rafz r-bnwqim r-1plcrui r-lrvibr"><g><path d="M19.39 14.882c-1.58 0-2.862-1.283-2.862-2.86s1.283-2.862 2.86-2.862 2.862 1.283 2.862 2.86-1.284 2.862-2.86 2.862zm0-4.223c-.75 0-1.362.61-1.362 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36zM12 14.882c-1.578 0-2.86-1.283-2.86-2.86S10.42 9.158 12 9.158s2.86 1.282 2.86 2.86S13.578 14.88 12 14.88zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.362 1.36 1.362 1.36-.61 1.36-1.36-.61-1.363-1.36-1.363zm-7.39 4.223c-1.577 0-2.86-1.283-2.86-2.86S3.034 9.16 4.61 9.16s2.862 1.283 2.862 2.86-1.283 2.862-2.86 2.862zm0-4.223c-.75 0-1.36.61-1.36 1.36s.61 1.36 1.36 1.36 1.362-.61 1.362-1.36-.61-1.36-1.36-1.36z"></path></g></svg></div></div><div dir="auto" class="css-901oao r-m0bqgq r-1qd0xha r-n6v787 r-16dba41 r-1sf4r6n r-hrzydr r-bcqeeo r-1qfoi16 r-qvutc0"><span class="css-901oao css-16my406 r-1qd0xha r-ad9z0x r-bcqeeo r-qvutc0">© 2020 Twitter, Inc.</span></div></nav></div></div></div></div></div></div></div></div></div></div></main></div></div></div></div><script nonce="">
window.__INITIAL_STATE__ = {"optimist":[],"urt":{},"entities":{"users":{"entities":{},"errors":{},"fetchStatus":{}},"tweets":{"entities":{},"errors":{},"fetchStatus":{}},"cards":{"entities":{},"errors":{},"fetchStatus":{}},"moments":{"entities":{},"errors":{},"fetchStatus":{}},"imageCache":{"entities":{},"errors":{},"fetchStatus":{}}},"featureSwitch":{"config":{"2fa_multikey_management_enabled":{"value":false},"account_country_setting_countries_whitelist":{"value":["ad","ae","af","ag","ai","al","am","ao","ar","as","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","bj","bl","bm","bn","bo","bq","br","bs","bt","bv","bw","by","bz","ca","cc","cd","cf","cg","ch","ci","ck","cl","cm","co","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","ee","eg","er","es","et","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gp","gq","gr","gs","gt","gu","gw","gy","hk","hn","hr","ht","hu","id","ie","il","im","in","io","iq","ir","is","it","je","jm","jo","jp","ke","kg","kh","ki","km","kn","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mf","mg","mh","mk","ml","mn","mo","mp","mq","mr","ms","mt","mu","mv","mw","mx","my","mz","na","nc","ne","nf","ng","ni","nl","no","np","nr","nu","nz","om","pa","pe","pf","pg","ph","pk","pl","pm","pn","pr","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","se","sg","sh","si","sk","sl","sm","sn","so","sr","st","sv","sx","sz","tc","td","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","us","uy","uz","va","vc","ve","vi","vn","vu","wf","ws","xk","ye","yt","za","zm","zw"]},"author_moderated_replies_urt_container_enabled":{"value":false},"content_language_setting_enabled":{"value":true},"conversation_controls_flexible_participation_enabled":{"value":false},"conversation_controls_flexible_participation_reply_enabled":{"value":true},"conversation_controls_limited_replies_consumption_configuration":{"value":"no_reply"},"conversation_controls_limited_replies_creation_enabled":{"value":true},"conversation_controls_notifying_participants_enabled":{"value":true},"dm_conversations_muting_enabled":{"value":false},"dm_conversations_nsfw_media_filter_enabled":{"value":false},"dm_reactions_config_active_reactions":{"value":["😂:funny","😲:surprised","😢:sad","❤:like","🔥:excited","👍:agree","👎:disagree"]},"dm_reactions_config_inactive_reactions":{"value":["😠:angry","😷:mask"]},"dm_voice_rendering_enabled":{"value":true},"employee_role":{"value":false},"explore_settings_trends_policy_url":{"value":""},"guest_broadcasting_timeline_decorations_enabled":{"value":true},"hashflags_animation_like_button_enabled":{"value":true},"home_timeline_latest_timeline_autoswitch_half_life_minutes":{"value":43200},"home_timeline_latest_timeline_autoswitch_threshold_multiplier":{"value":2},"home_timeline_latest_timeline_max_time_to_autoswitch_minutes":{"value":5256000},"home_timeline_latest_timeline_min_time_to_autoswitch_minutes":{"value":5256000},"home_timeline_latest_timeline_switch_enabled":{"value":true},"home_timeline_latest_timeline_threshold_to_increase_autoswitch_seconds":{"value":60},"home_timeline_spheres_copy_variant":{"value":"list_follow"},"home_timeline_spheres_custom_banner_image_reads_enabled":{"value":true},"home_timeline_spheres_detail_page_muting_enabled":{"value":true},"home_timeline_spheres_list_cell_thumbnail_enabled":{"value":true},"home_timeline_spheres_max_user_owned_or_subscribed_lists_count":{"value":5},"home_timeline_spheres_ranking_mode_control_enabled":{"value":true},"identity_verification_debadging_notification_enabled":{"value":false},"identity_verification_educational_prompt_enabled":{"value":false},"identity_verification_intake_enabled":{"value":false},"list_management_page_urt_timeline_enabled":{"value":false},"live_event_docking_enabled":{"value":true},"live_event_extra_attribution_enabled":{"value":true},"live_event_multi_video_auto_advance_dock_enabled":{"value":true},"live_event_multi_video_auto_advance_enabled":{"value":true},"live_event_multi_video_auto_advance_fullscreen_enabled":{"value":false},"live_event_multi_video_auto_advance_transition_duration_seconds":{"value":5},"live_event_multi_video_enabled":{"value":true},"live_event_timeline_default_refresh_rate_interval_seconds":{"value":30},"live_event_timeline_minimum_refresh_rate_interval_seconds":{"value":10},"live_event_timeline_server_controlled_refresh_rate_enabled":{"value":true},"livepipeline_client_enabled":{"value":true},"livepipeline_dm_features_enabled":{"value":true},"livepipeline_tweetengagement_enabled":{"value":true},"moment_annotations_enabled":{"value":true},"network_layer_503_backoff_mode":{"value":"host"},"project_friday_enabled":{"value":true},"responsive_web_alt_svc":{"value":false},"responsive_web_alt_text_badge_enabled":{"value":false},"responsive_web_api_transition_enabled":{"value":true},"responsive_web_auto_logout_multiaccount_enabled":{"value":true},"responsive_web_auto_logout_restrictedauthtoken_enabled":{"value":true},"responsive_web_auto_logout_twid_enabled":{"value":true},"responsive_web_birdwatch_consumption_enabled":{"value":false},"responsive_web_birdwatch_contribution_enabled":{"value":false},"responsive_web_birdwatch_hcomp_user":{"value":false},"responsive_web_branch_cpid_enabled":{"value":true},"responsive_web_branch_sdk_enabled":{"value":true},"responsive_web_card_preload_mode":{"value":false},"responsive_web_carousels_convert_to_single_media":{"value":false},"responsive_web_check_browser_support_enabled":{"value":true},"responsive_web_cleanup_macaw_swift_indexed_db":{"value":true},"responsive_web_constrained_viewport_enabled":{"value":false},"responsive_web_continue_as_always_enabled":{"value":false},"responsive_web_continue_as_param_enabled":{"value":true},"responsive_web_conversation_tree_enabled":{"value":false},"responsive_web_conversation_tree_toggle":{"value":false},"responsive_web_csrf_clientside_enabled":{"value":true},"responsive_web_dcm_2_enabled":{"value":true},"responsive_web_dm_health_inbox_request_cell_social_proof_enabled":{"value":false},"responsive_web_dm_quick_access_enabled":{"value":true},"responsive_web_dm_quick_access_no_empty_drawer_enabled":{"value":true},"responsive_web_dm_quick_access_with_close_enabled":{"value":false},"responsive_web_eu_compliance_double_click_disabled":{"value":false},"responsive_web_eu_compliance_ga_disabled":{"value":false},"responsive_web_eu_compliance_player_card_disabled":{"value":false},"responsive_web_eu_compliance_sentry_disabled":{"value":false},"responsive_web_eu_countries":{"value":["at","be","bg","ch","cy","cz","de","dk","ee","es","fi","fr","gb","gr","hr","hu","ie","is","it","li","lt","lu","lv","mt","nl","no","pl","pt","ro","se","si","sk"]},"responsive_web_events_page_horizon_video_enabled":{"value":true},"responsive_web_extension_compatibility_hide":{"value":false},"responsive_web_extension_compatibility_impression_guard":{"value":true},"responsive_web_extension_compatibility_override_param":{"value":false},"responsive_web_extension_compatibility_scribe":{"value":true},"responsive_web_extension_compatibility_size_threshold":{"value":50},"responsive_web_fake_root_twitter_domain_for_testing":{"value":false},"responsive_web_fetch_hashflags_on_boot":{"value":true},"responsive_web_fleets_dm_consumption_enabled":{"value":false},"responsive_web_fleets_notification_screen_enabled":{"value":false},"responsive_web_fleets_viewer_screen_enabled":{"value":false},"responsive_web_framerate_tracking_home_enabled":{"value":false},"responsive_web_graphql_amr_timeline":{"value":false},"responsive_web_graphql_bookmarks":{"value":false},"responsive_web_graphql_conversations_enabled":{"value":false},"responsive_web_graphql_dark_reads_probability":{"value":0},"responsive_web_graphql_likes_timeline":{"value":false},"responsive_web_graphql_list_management_timelines_enabled":{"value":false},"responsive_web_graphql_list_members_subscribers_enabled":{"value":false},"responsive_web_graphql_list_operations":{"value":false},"responsive_web_graphql_profile_timeline":{"value":false},"responsive_web_graphql_redux_module_users":{"value":false},"responsive_web_graphql_topic_timeline_enabled":{"value":false},"responsive_web_graphql_tweet_results":{"value":false},"responsive_web_graphql_user_by_rest_id":{"value":false},"responsive_web_graphql_user_profile_screen":{"value":false},"responsive_web_graphql_user_results":{"value":false},"responsive_web_graphql_users_by_rest_ids":{"value":false},"responsive_web_hoisting_anchor_invalidation_enabled":{"value":false},"responsive_web_hover_on_mousemove_enabled":{"value":false},"responsive_web_html_archive_renderer_enabled":{"value":true},"responsive_web_inline_login_box_enabled":{"value":"full"},"responsive_web_inline_reply_enabled":{"value":false},"responsive_web_inline_reply_with_fab_enabled":{"value":false},"responsive_web_install_banner_show_immediate":{"value":false},"responsive_web_instream_video_redesign_enabled":{"value":false},"responsive_web_left_nav_refresh_connect_enabled":{"value":false},"responsive_web_left_nav_refresh_topics_enabled":{"value":false},"responsive_web_list_hover_cards_enabled":{"value":true},"responsive_web_live_video_parity_periscope_auth_enabled":{"value":false},"responsive_web_login_input_type_email_enabled":{"value":false},"responsive_web_login_signup_sheet_app_install_cta_enabled":{"value":true},"responsive_web_media_upload_limit_2g":{"value":250},"responsive_web_media_upload_limit_3g":{"value":1500},"responsive_web_media_upload_limit_slow_2g":{"value":150},"responsive_web_media_upload_md5_hashing_enabled":{"value":false},"responsive_web_media_upload_target_jpg_pixels_per_byte":{"value":1},"responsive_web_menu_section_divider_enabled":{"value":false},"responsive_web_modal_close_enabled":{"value":true},"responsive_web_moment_maker_annotations_enabled":{"value":false},"responsive_web_moment_maker_enabled":{"value":false},"responsive_web_multiple_account_limit":{"value":5},"responsive_web_mute_unmute_toast_with_user_screen_name_enabled":{"value":true},"responsive_web_new_client_events_enabled":{"value":false},"responsive_web_new_copy_security_key_2fa_enabled":{"value":true},"responsive_web_ntab_verified_mentions_vit_internal_dogfood":{"value":false},"responsive_web_ocf_sms_autoverify_darkwrite":{"value":false},"responsive_web_ocf_sms_autoverify_enabled":{"value":false},"responsive_web_prerolls_fullscreen_disabled_on_ios":{"value":false},"responsive_web_promoted_tweet_param_append_enabled":{"value":true},"responsive_web_promoted_tweet_url_rewrite_enabled":{"value":false},"responsive_web_quick_promote_enabled":{"value":true},"responsive_web_quick_promote_smaller_budgets_enabled":{"value":false},"responsive_web_report_page_not_found":{"value":false},"responsive_web_rich_tweet_landing_enabled":{"value":true},"responsive_web_scroller_autopoll_enabled":{"value":false},"responsive_web_scroller_v3_enabled":{"value":true},"responsive_web_search_dms_enabled":{"value":true},"responsive_web_second_degree_replies_nudge_force_enabled":{"value":false},"responsive_web_second_degree_replies_nudge_get_enabled":{"value":false},"responsive_web_second_degree_replies_nudge_show_enabled":{"value":false},"responsive_web_serviceworker_safari_disabled":{"value":false},"responsive_web_settings_revamp_enabled":{"value":false},"responsive_web_settings_timeline_polling_enabled":{"value":false},"responsive_web_settings_timeline_polling_interval_ms":{"value":0},"responsive_web_settings_timeline_refresh_background_interval":{"value":0},"responsive_web_settings_timeline_refresh_enabled":{"value":false},"responsive_web_settings_timeline_refresh_instant_default":{"value":true},"responsive_web_sports_carousel":{"value":false},"responsive_web_suggested_follows_tab_candidate_source":{"value":"combined"},"responsive_web_suggested_follows_tab_enabled":{"value":false},"responsive_web_trends_setting_new_endpoints":{"value":true},"responsive_web_trigger_test_backoff_on_bookmark":{"value":false},"responsive_web_tweets_pill_local_enabled":{"value":true},"responsive_web_unsupported_entry_tombstone":{"value":false},"responsive_web_use_app_prompt_copy_variant":{"value":"prompt_better"},"responsive_web_use_app_prompt_enabled":{"value":true},"responsive_web_video_pcomplete_enabled":{"value":true},"responsive_web_video_promoted_logging_enabled":{"value":true},"responsive_web_vod_muted_captions_enabled":{"value":true},"responsive_web_vs_config_desktop_assumed_item_height":{"value":100},"responsive_web_vs_config_resize_observer_enabled":{"value":true},"responsive_web_zipkin_api_requests_enabled":{"value":false},"responsive_web_zipkin_api_requests_paths_allowlist":{"value":["/2/timeline/home.json"]},"rito_smart_block_list_enabled":{"value":false},"scribe_api_error_sample_size":{"value":0},"scribe_api_sample_size":{"value":100},"scribe_cdn_host_list":{"value":["si0.twimg.com","si1.twimg.com","si2.twimg.com","si3.twimg.com","a0.twimg.com","a1.twimg.com","a2.twimg.com","a3.twimg.com","abs.twimg.com","amp.twimg.com","o.twimg.com","pbs.twimg.com","pbs-eb.twimg.com","pbs-ec.twimg.com","pbs-v6.twimg.com","pbs-h1.twimg.com","pbs-h2.twimg.com","video.twimg.com","platform.twitter.com","cdn.api.twitter.com","ton.twimg.com","v.cdn.vine.co","mtc.cdn.vine.co","edge.vncdn.co","mid.vncdn.co"]},"scribe_cdn_sample_size":{"value":50},"search_channels_description_enabled":{"value":true},"search_channels_discovery_page_enabled":{"value":false},"soft_interventions_like_nudge_enabled":{"value":true},"soft_interventions_nudge_backend_control_enabled":{"value":false},"soft_interventions_retweet_nudge_enabled":{"value":true},"soft_interventions_share_nudge_enabled":{"value":false},"topic_landing_page_condensed_header_enabled":{"value":false},"topic_landing_page_enabled":{"value":true},"topic_landing_page_share_enabled":{"value":true},"topics_discovery_page_enabled":{"value":false},"topics_discovery_topic_picker_page_enabled":{"value":false},"topics_new_social_context_bottom_border_enabled":{"value":true},"topics_new_social_context_enabled":{"value":true},"topics_new_social_context_icon_color_enabled":{"value":false},"topics_peek_home_enabled":{"value":false},"topics_peek_search_enabled":{"value":false},"topics_tweet_details_recommended_topic_context_enabled":{"value":true},"traffic_rewrite_map":{"value":[]},"tweet_limited_actions_config_enabled":{"value":true},"tweet_limited_actions_config_non_compliant":{"value":["reply","retweet","like","send_via_dm","add_to_bookmarks","add_to_moment","pin_to_profile","view_tweet_activity","share_tweet_via"]},"unified_cards_cta_color_blue_cta":{"value":true},"user_display_name_max_limit":{"value":50},"voice_consumption_enabled":{"value":false},"web_video_bitrate_persistence_enabled":{"value":false},"web_video_hls_android_mse_enabled":{"value":true},"web_video_hls_mp4_threshold_sec":{"value":0},"web_video_hlsjs_version":{"value":""},"web_video_prefetch_playlist_autoplay_disabled":{"value":false},"web_video_smart_buffering_enabled":{"value":false},"web_video_smart_buffering_preroll_prebuffering_enabled":{"value":false}},"debug":{},"impression_pointers":{},"impressions":{},"featureSetToken":"041b2e27ae7a40f0eb40ec359a05b0c1e01bd0c7","isLoaded":true,"isLoading":false,"keysRead":{},"settingsVersion":"3f894ac35f17b2097933f270b1229736"},"toasts":[],"devices":{"browserPush":{"fetchStatus":"none","pushNotificationsPrompt":{"dismissed":false,"fetchStatus":"none"},"subscribed":false,"supported":null},"devices":{"data":{"emails":[],"phone_numbers":[]},"fetchStatus":"none"},"notificationSettings":{"push_settings":{"error":null,"fetchStatus":"none"},"push_settings_template":{"template":{"settings":[]}},"sms_settings":{"error":null,"fetchStatus":"none"},"sms_settings_template":{"template":{"settings":[]}},"checkin_time":null}},"typeaheadUsers":{"fetchStatus":"none","users":{},"denylist":{},"lastUpdated":0,"index":{}},"session":{"country":"RO","emailLiteLoginEligibility":{"fetchStatus":"none"},"guestId":"159449992016510361","language":"en","oneFactorLoginEligibility":{"fetchStatus":"none"}},"settings":{"local":{"nextPushCheckin":0,"shouldAutoPlayGif":false,"scale":"normal","themeColor":"blue500","highContrastEnabled":false,"themeBackground":"light","loginPromptLastShown":0,"reducedMotionEnabled":false,"conversationTreeEnabled":false,"showTweetMediaDetailDrawer":true,"autoPollNewTweets":false},"remote":{"settings":{"display_sensitive_media":false},"fetchStatus":"none"},"dataSaver":{"dataSaverMode":false},"transient":{"dtabBarInfo":{"hide":false},"loginPromptShown":false,"lastViewedDmInboxPath":"/messages","themeFocus":""}},"hashflags":{"fetchStatus":"none","hashflags":{}},"friendships":{"pendingFollowers":{"acceptedIds":[],"ids":[],"fetchStatus":{"bottom":"none","top":"none"},"hydratedIds":[]}},"homeTimeline":{"useLatest":false,"fetchStatus":"none"},"multiAccount":{"fetchStatus":"none","users":[],"badgeCounts":{},"addAccountFetchStatus":"none"},"badgeCount":{"unreadDMCount":0},"ocf_location":{"startLocation":{}},"navigation":{},"teams":{"fetchStatus":"none","teams":{}}};
window.__META_DATA__ = {"env":"prod","isLoggedIn":false,"isRTL":false,"hasMultiAccountCookie":false,"uaParserTags":["m2","rweb","msw"],"serverDate":1607976025252,"sha":"6b20cfcd5dd6ce82a0302ce9477371bb198b0032"};
</script>
<script id="nonce-csp" nonce=""></script><script type="text/javascript" charset="utf-8" nonce="">window.__SCRIPTS_LOADED__ = {};!function(e){function n(n){for(var o,t,i=n[0],c=n[1],l=n[2],s=0,m=[];s<i.length;s++)t=i[s],Object.prototype.hasOwnProperty.call(a,t)&&a[t]&&m.push(a[t][0]),a[t]=0;for(o in c)Object.prototype.hasOwnProperty.call(c,o)&&(e[o]=c[o]);for(u&&u(n);m.length;)m.shift()();return r.push.apply(r,l||[]),d()}function d(){for(var e,n=0;n<r.length;n++){for(var d=r[n],o=!0,i=1;i<d.length;i++){var c=d[i];0!==a[c]&&(o=!1)}o&&(r.splice(n--,1),e=t(t.s=d[0]))}return e}var o={},a={1:0},r=[];function t(n){if(o[n])return o[n].exports;var d=o[n]={i:n,l:!1,exports:{}};return e[n].call(d.exports,d,d.exports,t),d.l=!0,d.exports}t.e=function(e){var n=[],d=a[e];if(0!==d)if(d)n.push(d[2]);else{var o=new Promise((function(n,o){d=a[e]=[n,o]}));n.push(d[2]=o);var r,i=document.createElement("script");i.charset="utf-8",i.timeout=120,t.nc&&i.setAttribute("nonce",t.nc),i.src=function(e){return t.p+""+({0:"sharedCore",3:"shared~loader.DMDrawer~bundle.Compose~bundle.RichTextCompose~bundle.DirectMessages~bundle.DMRichTextCompose~b",4:"shared~bundle.Settings~ondemand.SettingsInternals~bundle.SettingsTransparency~bundle.SettingsRevamp~ondemand.",5:"shared~bundle.ComposeMedia~bundle.Ocf~bundle.SettingsProfile~bundle.UserLists",6:"shared~bundle.Compose~bundle.RichTextCompose~bundle.PlainTextCompose",7:"shared~bundle.DirectMessages~bundle.TweetMediaDetail~bundle.UserAvatar",8:"shared~bundle.RichTextCompose~bundle.DMRichTextCompose~ondemand.RichText",9:"shared~bundle.Settings~bundle.SettingsRevamp~bundle.SettingsTransparency",10:"shared~loader.DMDrawer~bundle.DirectMessages~bundle.DMRichTextCompose",11:"shared~bundle.Explore~loader.ExploreSidebar",12:"shared~bundle.LiveEvent~bundle.UserMoments",13:"shared~bundle.TopicPeek~ondemand.EmojiPicker",14:"shared~loader.DashMenu~bundle.Account",15:"shared~loader.Typeahead~bundle.UserLists",16:"shared~loaders.video.VideoPlayerDefaultUI~loaders.video.VideoPlayerEventsUI",17:"shared~ondemand.EmojiPickerData~ondemand.EmojiPicker",18:"shared~ondemand.GraphQLModule~ondemand.UserProfileGraphQL",19:"shared~ondemand.InlinePlayer~loader.AudioOnlyVideoPlayer",20:"shared~ondemand.SettingsInternals~ondemand.SettingsRevamp",21:"bundle.AboutThisAd",22:"bundle.Account",23:"bundle.AdvancedSearch",24:"bundle.BadgeViolationsNotification",25:"bundle.Birdwatch",26:"bundle.Bookmarks",27:"bundle.Collection",28:"bundle.Compose",29:"bundle.ComposeMedia",30:"bundle.ConnectTab",31:"bundle.Conversation",32:"bundle.ConversationParticipants",33:"bundle.DMRichTextCompose",34:"bundle.DirectMessages",35:"bundle.Display",36:"bundle.Download",37:"bundle.Explore",38:"bundle.ExploreTopics",39:"bundle.FleetsNotification",40:"bundle.FollowerRequests",41:"bundle.GenericTimeline",42:"bundle.GifSearch",43:"bundle.HomeTimeline",44:"bundle.KeyboardShortcuts",45:"bundle.LiveEvent",46:"bundle.LoggedOutHome",47:"bundle.Login",48:"bundle.Logout",49:"bundle.Moment",50:"bundle.MomentMaker",51:"bundle.MultiAccount",52:"bundle.NetworkInstrument",53:"bundle.NewsLanding",54:"bundle.NotMyAccount",55:"bundle.NotificationDetail",56:"bundle.Notifications",57:"bundle.Ocf",58:"bundle.Place",59:"bundle.PlainTextCompose",60:"bundle.ProfileRedirect",61:"bundle.QuoteTweetActivity",62:"bundle.Report",63:"bundle.RichTextCompose",64:"bundle.Search",65:"bundle.Settings",66:"bundle.SettingsInternals",67:"bundle.SettingsProfile",68:"bundle.SettingsRevamp",69:"bundle.SettingsTransparency",70:"bundle.SmsLogin",71:"bundle.TopicPeek",72:"bundle.Topics",73:"bundle.Trends",74:"bundle.TweetActivity",75:"bundle.TweetMediaDetail",76:"bundle.TweetMediaTags",77:"bundle.Twitterversary",78:"bundle.UserAvatar",79:"bundle.UserFollowLists",80:"bundle.UserLists",81:"bundle.UserMoments",82:"bundle.UserProfile",83:"bundle.UserRedirect",133:"loader.AbsolutePower",134:"loader.AppModules",135:"loader.AudioOnlyVideoPlayer",136:"loader.DMDrawer",137:"loader.DashMenu",138:"loader.ExploreSidebar",139:"loader.FeedbackSheet",140:"loader.FeedbackTombstone",141:"loader.HWCard",142:"loader.NewTweetsPill",143:"loader.ProfileClusterFollow",144:"loader.PushNotificationsPrompt",145:"loader.SideNav",146:"loader.SignupModule",147:"loader.TimelineRenderer",148:"loader.TweetCurationActionMenu",149:"loader.Typeahead",150:"loader.WideLayout",151:"loader.directMessagesData",152:"loader.graphQLDarkReads",153:"loader.personalizationData",154:"loaders.video.PlayerBase",155:"loaders.video.PlayerHls13",156:"loaders.video.PlayerUi",157:"loaders.video.VideoPlayerDefaultUI",158:"loaders.video.VideoPlayerEventsUI",160:"ondemand.Balloons",161:"ondemand.BranchSdk",162:"ondemand.CarouselScroller",163:"ondemand.ComposeScheduling",164:"ondemand.Dropdown",165:"ondemand.EditBirthdate",166:"ondemand.EditPinned",167:"ondemand.EmojiPicker",168:"ondemand.FleetMediaDetail",169:"ondemand.GraphQLModule",170:"ondemand.HoverCard",171:"ondemand.InlinePlayer",172:"ondemand.IntentPrompt",173:"ondemand.LottieWeb",174:"ondemand.MicrosoftInterface",175:"ondemand.ProfileSidebar",176:"ondemand.ReactBeautifulDnd",177:"ondemand.RichText",178:"ondemand.SettingsInternals",179:"ondemand.SettingsRevamp",180:"ondemand.UserProfileGraphQL",181:"ondemand.countries-ar",182:"ondemand.countries-bg",183:"ondemand.countries-bn",184:"ondemand.countries-ca",185:"ondemand.countries-cs",186:"ondemand.countries-da",187:"ondemand.countries-de",188:"ondemand.countries-el",189:"ondemand.countries-en",190:"ondemand.countries-en-GB",191:"ondemand.countries-es",192:"ondemand.countries-eu",193:"ondemand.countries-fa",194:"ondemand.countries-fi",195:"ondemand.countries-fil",196:"ondemand.countries-fr",197:"ondemand.countries-ga",198:"ondemand.countries-gl",199:"ondemand.countries-gu",200:"ondemand.countries-he",201:"ondemand.countries-hi",202:"ondemand.countries-hr",203:"ondemand.countries-hu",204:"ondemand.countries-id",205:"ondemand.countries-it",206:"ondemand.countries-ja",207:"ondemand.countries-kn",208:"ondemand.countries-ko",209:"ondemand.countries-mr",210:"ondemand.countries-ms",211:"ondemand.countries-nb",212:"ondemand.countries-nl",213:"ondemand.countries-pl",214:"ondemand.countries-pt",215:"ondemand.countries-ro",216:"ondemand.countries-ru",217:"ondemand.countries-sk",218:"ondemand.countries-sr",219:"ondemand.countries-sv",220:"ondemand.countries-ta",221:"ondemand.countries-th",222:"ondemand.countries-tr",223:"ondemand.countries-uk",224:"ondemand.countries-ur",225:"ondemand.countries-zh",226:"ondemand.countries-zh-Hant",227:"ondemand.emoji.ar",228:"ondemand.emoji.bg",229:"ondemand.emoji.bn",230:"ondemand.emoji.ca",231:"ondemand.emoji.cs",232:"ondemand.emoji.da",233:"ondemand.emoji.de",234:"ondemand.emoji.el",235:"ondemand.emoji.en",236:"ondemand.emoji.en-GB",237:"ondemand.emoji.en-ss",238:"ondemand.emoji.en-xx",239:"ondemand.emoji.es",240:"ondemand.emoji.eu",241:"ondemand.emoji.fa",242:"ondemand.emoji.fi",243:"ondemand.emoji.fil",244:"ondemand.emoji.fr",245:"ondemand.emoji.ga",246:"ondemand.emoji.gl",247:"ondemand.emoji.gu",248:"ondemand.emoji.he",249:"ondemand.emoji.hi",250:"ondemand.emoji.hr",251:"ondemand.emoji.hu",252:"ondemand.emoji.id",253:"ondemand.emoji.it",254:"ondemand.emoji.ja",255:"ondemand.emoji.kn",256:"ondemand.emoji.ko",257:"ondemand.emoji.mr",258:"ondemand.emoji.ms",259:"ondemand.emoji.nb",260:"ondemand.emoji.nl",261:"ondemand.emoji.pl",262:"ondemand.emoji.pt",263:"ondemand.emoji.ro",264:"ondemand.emoji.ru",265:"ondemand.emoji.sk",266:"ondemand.emoji.sr",267:"ondemand.emoji.sv",268:"ondemand.emoji.ta",269:"ondemand.emoji.th",270:"ondemand.emoji.tr",271:"ondemand.emoji.uk",272:"ondemand.emoji.ur",273:"ondemand.emoji.vi",274:"ondemand.emoji.zh",275:"ondemand.emoji.zh-Hant",276:"ondemand.framerateTracking",277:"ondemand.video.PlayerHls12"}[e]||e)+"."+{0:"a32e7c4",3:"d27aed3",4:"b3f25ee",5:"b370e4a",6:"8e551ae",7:"b41932d",8:"c2c4332",9:"1e6e702",10:"c6f88bd",11:"043a746",12:"c71d609",13:"c36755e",14:"a5ac294",15:"ffdf8b0",16:"c5c7822",17:"c8bd3f0",18:"36fc96e",19:"9c4123e",20:"fd1a38b",21:"79f00d1",22:"c64f3f5",23:"c5f763a",24:"5c31593",25:"5fc4faf",26:"953cd98",27:"823054e",28:"59ca45b",29:"d9fbbfb",30:"e908184",31:"0d48326",32:"efae00c",33:"39f7aaa",34:"83008d8",35:"ec57a16",36:"574613b",37:"d02ec40",38:"e286e60",39:"85c6680",40:"a85b540",41:"8937d07",42:"3e71549",43:"528d19b",44:"043890f",45:"2ead6be",46:"fc38cca",47:"0aa39fb",48:"c63c2d2",49:"c7b04d1",50:"6081856",51:"1478a4a",52:"8cd49fb",53:"fbb67d9",54:"f45acf7",55:"a425e5a",56:"cba2e0a",57:"b58d27b",58:"b65a70c",59:"93dd658",60:"7f6b593",61:"e581762",62:"df69b6d",63:"3798576",64:"4d8e29d",65:"86aee5e",66:"deb6977",67:"ae6a13d",68:"56231b0",69:"3f2754d",70:"cf87c9c",71:"b44bbaf",72:"bfb00cc",73:"08911ee",74:"5a268b0",75:"8f489b2",76:"6a6ac82",77:"b721227",78:"5140126",79:"c89ab62",80:"04e54a1",81:"243fb45",82:"77dace8",83:"190b30b",133:"62d14ea",134:"b79a31b",135:"6679fa1",136:"62b7b56",137:"cc787be",138:"f0fd58f",139:"e3a2d64",140:"9cc9174",141:"ab3e9bc",142:"ff8ee8b",143:"1fedf12",144:"52cacfb",145:"911fe7c",146:"c114264",147:"48da637",148:"7997b78",149:"2808984",150:"5532111",151:"3dcc75a",152:"8e6ad05",153:"7f52eac",154:"6d73bb8",155:"82ed2c5",156:"dec5fdb",157:"76d2257",158:"7cf33d4",160:"2bc74f7",161:"12a3a9f",162:"1f0c8b4",163:"306d153",164:"cd28a97",165:"7bda8b1",166:"440eadf",167:"6e9f5dd",168:"ed4ee30",169:"0109dc0",170:"c76f0fb",171:"0dc9b51",172:"c1b802e",173:"a03d07a",174:"bb22e10",175:"8c66adf",176:"c193495",177:"ba3c441",178:"f32e9b7",179:"9b4d223",180:"2b2b102",181:"60ea979",182:"905c724",183:"37abec2",184:"a0e33ca",185:"30668bd",186:"143bdd3",187:"0005e86",188:"ff1d315",189:"961a953",190:"7ab0c86",191:"eab5714",192:"c6dad2f",193:"271570a",194:"3a4302e",195:"2be5da1",196:"7cbf391",197:"e206d15",198:"a442dbd",199:"2be44ee",200:"114804d",201:"260ab7f",202:"8b325aa",203:"90752e1",204:"9506c55",205:"41cbf8e",206:"cce5991",207:"00615f5",208:"cb8bacd",209:"3cf2c76",210:"9e68559",211:"3c69a5d",212:"8425e06",213:"97ffa13",214:"671f073",215:"f74cbe9",216:"39159ba",217:"5d1ded9",218:"9c14ddc",219:"96cc5b7",220:"360ab9d",221:"61f2b4f",222:"8734969",223:"68d1232",224:"5808a05",225:"c9cfca1",226:"80f2eca",227:"782a67a",228:"a2ca9fd",229:"200e041",230:"b38450f",231:"8726b73",232:"276c77d",233:"c713ca3",234:"3ac1446",235:"b13f7c8",236:"5e35eec",237:"e85ad4f",238:"ad85278",239:"24c68a4",240:"ed1eb45",241:"ca03f8c",242:"b55f0e9",243:"4e7b384",244:"44f3c4d",245:"9189f00",246:"2642261",247:"627e3fb",248:"3ab1611",249:"ad93626",250:"c19a86c",251:"bc65a3d",252:"dc71031",253:"098c488",254:"f153174",255:"67f5cee",256:"3babed1",257:"164fc5e",258:"37c84a0",259:"9ea87f1",260:"69c3cf7",261:"e25b24e",262:"a4ea32a",263:"8338aad",264:"b8c27bc",265:"9ca60b9",266:"d1f322a",267:"5c443b5",268:"20a32d4",269:"7b849e7",270:"1f18554",271:"3e70a6e",272:"3c91cba",273:"93738f7",274:"7078b23",275:"6b43e2d",276:"14d8011",277:"8516511"}[e]+"5.js"}(e);var c=new Error;r=function(n){i.onerror=i.onload=null,clearTimeout(l);var d=a[e];if(0!==d){if(d){var o=n&&("load"===n.type?"missing":n.type),r=n&&n.target&&n.target.src;c.message="Loading chunk "+e+" failed.\n("+o+": "+r+")",c.name="ChunkLoadError",c.type=o,c.request=r,d[1](c)}a[e]=void 0}};var l=setTimeout((function(){r({type:"timeout",target:i})}),12e4);i.onerror=i.onload=r,document.head.appendChild(i)}return Promise.all(n)},t.m=e,t.c=o,t.d=function(e,n,d){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:d})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var d=Object.create(null);if(t.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(d,o,function(n){return e[n]}.bind(null,o));return d},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="https://abs.twimg.com/responsive-web/client-web/",t.oe=function(e){throw e};var i=window.webpackJsonp=window.webpackJsonp||[],c=i.push.bind(i);i.push=n,i=i.slice();for(var l=0;l<i.length;l++)n(i[l]);var u=c;d()}([]),window.__SCRIPTS_LOADED__.runtime=!0;
//# sourceMappingURL=https://ton.twitter.com/responsive-web-internal/sourcemaps/client-web/runtime.b92b11d5.js.map</script><script type="text/javascript" charset="utf-8" nonce="" crossorigin="anonymous" src="https://abs.twimg.com/responsive-web/client-web/polyfills.18a65025.js"></script><script type="text/javascript" charset="utf-8" nonce="" crossorigin="anonymous" src="https://abs.twimg.com/responsive-web/client-web/vendors~main.cf4df3f5.js"></script><script type="text/javascript" charset="utf-8" nonce="" crossorigin="anonymous" src="https://abs.twimg.com/responsive-web/client-web/i18n/en.228ce9a5.js"></script><script type="text/javascript" charset="utf-8" nonce="" crossorigin="anonymous" src="https://abs.twimg.com/responsive-web/client-web/main.972687a5.js"></script><script nonce="">(function () {
if (!window.__SCRIPTS_LOADED__['main']) {
document.getElementById('ScriptLoadFailure').style.display = 'block';
var criticalScripts = ["polyfills","vendors~main","i18n","main"];
for (var i = 0; i < criticalScripts.length; i++) {
var criticalScript = criticalScripts[i];
if (!window.__SCRIPTS_LOADED__[criticalScript]) {
document.getElementsByName('failedScript')[0].value = criticalScript;
break;
}
}
}
})();</script></body></html>
"""
def make_request(request_count):
start_time=time.time()
url_addr="http://127.0.0.1:5000/"
results=[]
for request_index in range(0,request_count):
response=requests.post(url_addr,data=request_body)
results.append(response)
execution_time=time.time()-start_time
return results,execution_time
link="https://twitter.com/realDonaldTrump/status/1336148836495069185"
request_body={"url":link,"html":html}
def append_results_to_list(url,list):
list.append(requests.post(url,data=request_body))
def make_request_threads(request_count):
start_time=time.time()
url_addr="http://127.0.0.1:5000/"
results=[]
threads=[]
for request_index in range(0,request_count):
thread=threading.Thread(target=append_results_to_list,args=(url_addr,results))
threads.append(thread)
thread.start()
for thread in threads:
thread.join()
execution_time=time.time()-start_time
return results,execution_time
requests_number=int(sys.argv[1])
#results,time_elapsed=make_request(requests_number)
#print("One thread requests time for {} requests : {}".format(requests_number,time_elapsed))
results,time_elapsed=make_request_threads(requests_number)
print("Multi thread requests time for {} requests : {}".format(requests_number,time_elapsed))
success=0
fail=0
for result in results:
print(result.json())
if result.status_code==200:
success+=1
else:
fail+=1
print("Successful request : {}".format(success))
print("Failed request : {}".format(fail))
| 697.894737 | 91,143 | 0.741074 | 26,721 | 145,860 | 4.001871 | 0.103028 | 0.045336 | 0.047553 | 0.052182 | 0.739166 | 0.703499 | 0.679887 | 0.661249 | 0.648288 | 0.606383 | 0 | 0.202238 | 0.054593 | 145,860 | 208 | 91,144 | 701.25 | 0.573073 | 0.000967 | 0 | 0.061224 | 0 | 0.413265 | 0.991264 | 0.394743 | 0 | 0 | 0 | 0 | 0 | 1 | 0.015306 | false | 0 | 0.02551 | 0 | 0.05102 | 0.020408 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
21ea37c667d78611b99d2bb5047269fa1092ad16 | 4,480 | py | Python | src/pdn/models.py | ricardogsilva/nexus-geonode | b3c1d428fe0c246bcc3195ebcbd54554b726dbe2 | [
"BSD-2-Clause"
] | null | null | null | src/pdn/models.py | ricardogsilva/nexus-geonode | b3c1d428fe0c246bcc3195ebcbd54554b726dbe2 | [
"BSD-2-Clause"
] | null | null | null | src/pdn/models.py | ricardogsilva/nexus-geonode | b3c1d428fe0c246bcc3195ebcbd54554b726dbe2 | [
"BSD-2-Clause"
] | null | null | null | from django.db import models
class News(models.Model):
remote_id = models.BigIntegerField(unique=True)
source_id = models.BigIntegerField()
title = models.CharField(max_length=250)
url = models.CharField(max_length=1000)
country = models.CharField(max_length=255)
country_code = models.CharField(max_length=10, blank=True)
date = models.DateTimeField()
source = models.CharField(max_length=255)
class Project(models.Model):
remote_id = models.BigIntegerField(unique=True)
name = models.CharField(max_length=250)
acronym = models.CharField(max_length=250)
description = models.TextField()
logo_url = models.CharField(max_length=1000)
url = models.CharField(max_length=1000)
active = models.BooleanField(default=False)
class Alert(models.Model):
remote_id = models.BigIntegerField(unique=True)
title = models.CharField(max_length=2500, blank=True)
title_detail = models.CharField(max_length=2500, blank=True)
summary = models.CharField(max_length=2500, blank=True)
summary_detail = models.CharField(max_length=2500, blank=True)
links = models.CharField(max_length=2500, blank=True)
gdacs_temporary = models.CharField(max_length=2500, blank=True)
link = models.CharField(max_length=2500, blank=True)
published = models.CharField(max_length=2500, blank=True)
published_parsed = models.CharField(max_length=2500, blank=True)
gdacs_iscurrent = models.CharField(max_length=2500, blank=True)
gdacs_fromdate = models.DateTimeField()
gdacs_todate = models.DateTimeField()
gdacs_durationinweek = models.CharField(max_length=2500, blank=True)
gdacs_year = models.CharField(max_length=2500, blank=True)
tags = models.CharField(max_length=2500, blank=True)
uid = models.CharField(max_length=2500, blank=True)
guidislink = models.CharField(max_length=2500, blank=True)
geo_lat = models.CharField(max_length=2500, blank=True)
geo_long = models.CharField(max_length=2500, blank=True)
geo_point = models.CharField(max_length=2500, blank=True)
gdacs_bbox = models.CharField(max_length=2500, blank=True)
gdacs_cap = models.CharField(max_length=2500, blank=True)
gdacs_icon = models.CharField(max_length=2500, blank=True)
gdacs_version = models.CharField(max_length=2500, blank=True)
gdacs_eventtype = models.CharField(max_length=2500, blank=True)
gdacs_alertlevel = models.CharField(max_length=2500, blank=True)
gdacs_alertscore = models.CharField(max_length=2500, blank=True)
gdacs_episodealertlevel = models.CharField(max_length=2500, blank=True)
gdacs_episodealertscore = models.CharField(max_length=2500, blank=True)
gdacs_eventname = models.CharField(max_length=2500, blank=True)
gdacs_eventid = models.CharField(max_length=2500, blank=True)
gdacs_episodeid = models.CharField(max_length=2500, blank=True)
gdacs_calculationtype = models.CharField(max_length=2500, blank=True)
gdacs_severity = models.CharField(max_length=2500, blank=True)
gdacs_population = models.CharField(max_length=2500, blank=True)
gdacs_vulnerability = models.CharField(max_length=2500, blank=True)
gdacs_iso3 = models.CharField(max_length=2500, blank=True)
gdacs_country = models.CharField(max_length=2500, blank=True)
gdacs_glide = models.CharField(max_length=2500, blank=True)
gdacs_mapimage = models.CharField(max_length=2500, blank=True)
gdacs_maplink = models.CharField(max_length=2500, blank=True)
gdacs_gtsimage = models.CharField(max_length=2500, blank=True)
gdacs_gtslink = models.CharField(max_length=2500, blank=True)
gdacs_resource = models.CharField(max_length=2500, blank=True)
gdacs_title = models.CharField(max_length=2500, blank=True)
gdacs_description = models.CharField(max_length=2500, blank=True)
gdacs_acknowledgements = models.CharField(max_length=2500, blank=True)
gdacs_accesslevel = models.CharField(max_length=2500, blank=True)
gdacs_resources = models.CharField(max_length=2500, blank=True)
class Expert(models.Model):
remote_id = models.BigIntegerField(unique=True)
name = models.CharField(max_length=250)
title = models.CharField(max_length=250)
country = models.CharField(max_length=255)
country_code = models.CharField(max_length=10, blank=True)
email = models.CharField(max_length=250)
ministry = models.CharField(max_length=250)
country_id = models.CharField(max_length=100, blank=True)
| 51.494253 | 75 | 0.763839 | 589 | 4,480 | 5.617997 | 0.152801 | 0.285585 | 0.342702 | 0.456936 | 0.806286 | 0.779692 | 0.72197 | 0.666062 | 0.09731 | 0.09731 | 0 | 0.061041 | 0.129688 | 4,480 | 86 | 76 | 52.093023 | 0.787638 | 0 | 0 | 0.179487 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.012821 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 7 |
21f6222261dd1a1f6d9f38674552c12818f8411f | 78,169 | py | Python | imagedata.py | cachilders/pecker | a5a9fa85685f9c1660a428da3d9f86f95c2f06bc | [
"Unlicense"
] | null | null | null | imagedata.py | cachilders/pecker | a5a9fa85685f9c1660a428da3d9f86f95c2f06bc | [
"Unlicense"
] | null | null | null | imagedata.py | cachilders/pecker | a5a9fa85685f9c1660a428da3d9f86f95c2f06bc | [
"Unlicense"
] | null | null | null | ##
# @filename : imagedata.py
# @brief : data file for epd demo
#
# Copyright (C) Waveshare July 10 2017
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
MONOCOLOR_BITMAP = [ # 0X00,0X01,0X90,0X01,0X2C,0X01, #
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF7,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC3,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,
0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XF0,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XC0,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFE,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE3,0XD0,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XCF,0XEB,0X03,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X03,0XE3,0X83,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X43,0XF3,
0XC3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF9,
0XC3,0XF3,0XE3,0XFC,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XF3,0XE3,0XF9,0XE3,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XE5,0XFF,0XFB,0XF3,0XE0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XC8,0XFF,0XFB,0XF3,0XC0,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X92,0XFF,0XFB,0XF7,0X00,0X7F,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X30,0XFF,0XF3,0XF4,0X00,0X7F,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X5B,0XFF,0XF3,0XF0,0X70,
0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X0B,0XFF,0XF3,
0XE1,0XF8,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFC,0X09,
0XFF,0XF3,0X85,0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XF9,0X4C,0XFF,0XE7,0X3D,0XFE,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XF2,0X7E,0X7F,0XE6,0XFD,0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XF0,0X3F,0XBF,0XE1,0X9D,0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE4,0X3F,0XDF,0XE3,0X9D,0XFF,0X3F,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE4,0XDF,0XFF,0XC6,0X7D,0XFF,0X3F,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XEF,0XFF,0XFF,0XDE,0XFF,0XFF,
0X9F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XCF,0XFF,0XFF,0X93,
0XFF,0XFF,0X9F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XCD,0XFF,
0XFF,0X33,0XFF,0XFF,0X9F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XC0,0XFF,0XFE,0X1F,0XFD,0XFF,0X9F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XC9,0XFF,0XFC,0X8F,0XFF,0XFF,0X9F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XC9,0XFF,0XF9,0XFF,0XFD,0XFF,0X8F,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XCF,0XFF,0XF0,0XFF,0XF5,0XFF,0X8F,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE7,0XFF,0XF6,0X7F,0XF7,0XFF,0X8F,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE7,0XFF,0XE3,0X3F,0XFD,0XFF,
0X8F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF3,0XFF,0XEF,0X9F,
0X0B,0XFF,0X87,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF3,0XFF,
0XCE,0X4F,0XA1,0XFF,0X87,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XF9,0XFF,0XD7,0X27,0XF3,0XFF,0X97,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFC,0XFB,0XD3,0XC3,0XFB,0XFF,0X97,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFE,0X7C,0XD3,0XE1,0XFB,0XFF,0X97,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0X0F,0X3E,0X1F,0XF1,0XFF,0XFF,0XC7,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC0,0X00,0X8F,0X93,0XF8,0XDF,0XFF,0XC7,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XCF,0XFC,0X03,0X93,0XFE,0X5F,0XFF,
0XC7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XA3,0XFF,0XE0,0XCF,0XFF,
0X7F,0XFF,0XC7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X79,0XFF,0XFC,
0X0F,0XFF,0X3F,0X7F,0XE7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0XFE,
0X7F,0XF8,0XF7,0XFF,0X9F,0X7F,0XE3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFE,0XFF,0XFF,0XF3,0XD3,0XF7,0XDF,0XBF,0XE3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFC,0XBF,0XFF,0XC1,0XEB,0XFB,0XCF,0X9F,0XE3,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFC,0X0F,0XFF,0XDC,0X71,0XFB,0XEF,0XCF,0XE7,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF9,0XBF,0XFF,0XAF,0XFC,0XF9,0XFF,0XEF,0XE7,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFB,0XFF,0XFF,0X47,0XFE,0X79,0XF7,0XF7,
0XA7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFB,0XFF,0XFE,0X47,0XFF,0X39,
0XF7,0XFB,0XA7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFA,0X3F,0XFC,0XEF,
0XFF,0X99,0XFB,0XFD,0X87,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFA,0X3F,
0XFC,0XFF,0XFF,0XC9,0XFD,0XFC,0X87,0XF8,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFA,0X07,0XFD,0XFF,0XFF,0XE0,0XFC,0XFE,0X07,0XC0,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XF8,0X7F,0XF9,0XFF,0XFF,0XF8,0X7E,0X7E,0X0F,0X9F,0XF3,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XF3,0XFF,0XFB,0XFF,0XFF,0XFE,0X3F,0X39,0X0F,0X20,0X19,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF3,0XFF,0XFB,0XFF,0XFF,0XFF,0X0F,0X98,0X0E,0X0F,
0XC1,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF2,0X3F,0XFB,0XFF,0XFF,0XFF,0XC7,0XC0,
0X0C,0X7F,0XF3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFA,0X3F,0XFB,0XFF,0XFF,0XFF,
0XF0,0X20,0X09,0XFF,0XF9,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFB,0XFF,0XF3,0XFF,
0XFF,0XFF,0XFC,0X00,0X01,0XFF,0XF9,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFB,0XFF,
0XEB,0XFF,0X80,0X3F,0XFE,0X00,0X07,0XFF,0XFC,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XF9,0X3F,0XDB,0XD8,0X1F,0XC7,0XFF,0X80,0X0F,0XFF,0XFC,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XF9,0X3E,0X5B,0XEC,0X7F,0XFC,0X3F,0X80,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFC,0XFF,0X1B,0XFF,0X8F,0XFF,0X80,0X00,0X1F,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFC,0XFF,0X3B,0XFF,0XF9,0XFF,0XFF,0X00,0X1F,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X7E,0XBB,0XFF,0XFF,0XFF,0XFF,0X80,
0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X3E,0XBB,0XFF,0XFF,0XEF,
0XFF,0X00,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBE,0X53,0XFF,
0XFF,0XF3,0XFE,0X00,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X9F,
0X13,0XFF,0XFF,0XF8,0XFC,0X04,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XCF,0X83,0XFF,0XFF,0XFE,0X18,0X0C,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XE7,0XC3,0XFF,0XFF,0XFF,0XC0,0X1C,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XF3,0XE7,0XFF,0XFF,0XFF,0XFE,0X7C,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X01,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF9,0XE3,0XFF,0XFF,0XFF,0XF9,0XFD,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,
0X00,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X73,0XFF,0XFE,0XFF,0XE3,0XFD,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XF1,0XFF,0X83,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X33,0XFD,0XFE,0XF8,
0X8F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XE7,0XFF,0XF0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X93,0XEB,
0X7E,0XF8,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XDF,0XFF,0XD8,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XC3,0XF8,0XFF,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X9F,0XFB,0XDB,0X1F,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XE1,0XF9,0XFF,0XC3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7F,0XF3,0XBF,0XF8,0X0B,0XCF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XF9,0XF3,0XFF,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X1F,0X81,0X3F,0XFF,0XE3,0XE7,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFC,0XF7,0XF8,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0XCF,0X1C,0X3F,0XFF,0XF3,
0XE3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X77,0XC1,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0XE0,0X9C,0X3F,
0XFF,0XFB,0XCB,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X20,0X1F,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFC,0XF1,
0X9C,0X1F,0XFF,0XF3,0XD9,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0X7E,0XFE,0XD9,0X9F,0XFF,0XF7,0X9C,0XFF,0X87,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFE,0X3E,0X3E,0X59,0XCE,0XFF,0XE4,0X1C,0XFF,0X23,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0X7F,0X1F,0X19,0XCC,0XFF,0XE0,0XC6,0XFE,0XF9,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X1F,0X19,0XE5,0XFF,0XC7,0XE0,0X7E,0XF9,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X1F,0X93,0XE4,0XFF,0XCF,0XFF,0X7F,
0XF9,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X2F,0X93,0XF4,0XFF,0X9F,
0XFF,0X7D,0XF9,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X6F,0XC7,0XF0,
0X3F,0X3F,0XFF,0X3D,0XF9,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0X7F,
0XCF,0XF2,0X7E,0X7F,0XFF,0X3D,0XF9,0XFD,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XEF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0X80,0X3F,0XCF,0XF0,0XFC,0XFF,0XFF,0X39,0XF8,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFE,0X07,0X8F,0XCF,0XF1,0XF9,0XFF,0XFF,0X33,0XFC,0X78,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XF8,0XE3,0XE7,0XE7,0XF1,0XF3,0XFF,0XFF,0X27,0XFF,0X1F,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XF1,0XF1,0XF3,0XE7,0XF3,0XF7,0XFF,0XFF,0X0F,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE7,0XF9,0XFD,0XE3,0XE3,0XE7,0XFF,0XFF,0X3F,
0XF3,0XFF,0XFD,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XCF,0XFC,0XFC,0XE1,0XE7,0XE7,0XFF,
0XFE,0X7F,0XF7,0XFF,0XFD,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XDF,0XFC,0XFE,0X75,0XCF,
0XCF,0XFF,0XF8,0X7F,0XF7,0XF3,0XFD,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X9F,0XFE,0XFF,
0X74,0X9F,0XCF,0XFE,0X00,0XFF,0XFF,0XF7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X87,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X9F,
0XFE,0X7F,0X3A,0X3F,0X8F,0XE0,0X05,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,
0X10,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XBF,0XFE,0X7F,0X38,0X7F,0X8F,0X80,0X19,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XF9,0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X19,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0X3F,0XFF,0X3F,0XBC,0X7F,0X8F,0X03,0XF3,0XFF,0XFF,0XFF,0XF3,0XFF,
0XFF,0XFF,0XFF,0XE7,0XFF,0X8F,0XFF,0XFF,0XFF,0XFC,0X00,0XE0,0X00,0X0C,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0X3F,0XFF,0X3F,0X9C,0X7F,0X8E,0X03,0XC7,0XFF,0XFF,0XFF,
0XF3,0XFF,0XFF,0XFF,0XFF,0X1F,0XFF,0XE7,0XFF,0XFF,0XFF,0XF1,0X3F,0XFF,0XF0,0X04,
0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X3F,0XFF,0X9F,0XCD,0X3F,0X8C,0X07,0X1F,0XFF,
0XFF,0XFF,0XF7,0XFF,0XFF,0XFF,0XFC,0X7F,0XFF,0XF3,0XFF,0XFF,0XFF,0XC6,0XFF,0XFF,
0XF8,0X42,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7F,0XFF,0X8F,0XC5,0X9F,0X84,0X1C,
0X7F,0XFF,0X00,0XFF,0XFF,0XFF,0XFF,0XFF,0XF3,0XFF,0X00,0XFD,0XFF,0XFF,0XFF,0X9D,
0XFF,0XFF,0XFE,0X22,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7F,0XF7,0XCF,0XC1,0X9F,
0X84,0X19,0XFF,0XFC,0X00,0X10,0X07,0XFF,0XFF,0XFF,0XCF,0XF8,0X3C,0X1C,0XFF,0XFF,
0XFF,0X3B,0XFF,0XFF,0XFE,0X10,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7F,0XE3,0XE3,
0XC0,0X8F,0X00,0X13,0XFF,0XF0,0XFF,0X00,0X00,0X47,0XFF,0XFC,0X7F,0XE3,0XFF,0XC6,
0X7F,0XFF,0XFC,0XF7,0XFF,0XFF,0XFF,0X18,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X3F,
0XE3,0XF0,0X00,0XCE,0X00,0X27,0XFF,0XE1,0XFF,0XE3,0XF8,0X03,0XFF,0XC3,0XFF,0XC7,
0XFF,0XF1,0X3F,0XFF,0XF9,0XE7,0XFF,0XFF,0XFF,0X88,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFE,0X3F,0XFF,0XFC,0X00,0X4C,0X00,0X27,0XFF,0X87,0XFF,0XF0,0X00,0X00,0X00,0X1F,
0XFF,0X9F,0XFF,0XFC,0X1F,0XFF,0XE3,0X8F,0XFF,0XFF,0XFF,0X88,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFE,0X1F,0XFF,0XFF,0X01,0X00,0X00,0X67,0XFC,0X0F,0XFF,0XF8,0X07,0XFE,
0X01,0XF9,0XFE,0X7F,0XFF,0XFF,0X0F,0XFF,0X07,0X3F,0XFF,0XFF,0XF9,0X88,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFE,0X4F,0XFF,0XFF,0XC1,0X80,0X70,0X00,0X00,0X3F,0XDF,0XFC,
0XFF,0XFF,0XFF,0XF9,0XFC,0XFF,0XFF,0XFF,0XC0,0X60,0X3C,0X7F,0XFF,0XFF,0XFD,0XC0,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X27,0XFF,0XFF,0XC1,0XC0,0X08,0X00,0X00,0XFF,
0X9F,0XFE,0X7F,0XFF,0XFF,0XFD,0XF9,0XFF,0XFF,0XFF,0XF8,0X00,0XC1,0XFF,0XFF,0XFF,
0XFF,0XE0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X33,0XFF,0XFF,0XC0,0XE0,0X00,0X38,
0X00,0XFF,0XBF,0XFE,0X7F,0XFF,0XFF,0XFF,0XF3,0XFF,0XFF,0XFF,0XFF,0XE0,0X3F,0XFF,
0XFF,0XFF,0XFF,0XE0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X1D,0XFF,0XFF,0XE0,0X70,
0X04,0X18,0X00,0X7F,0XFF,0XFF,0X7F,0XFF,0XFF,0XFF,0XE7,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X0E,0X7F,0XFF,
0XE0,0X10,0X04,0X08,0X18,0X3F,0XFF,0XFF,0X7F,0XFF,0XFF,0XFF,0XCF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X47,
0X1F,0XFF,0XF0,0X00,0X04,0X08,0X8E,0X3F,0XFF,0XFF,0X3F,0XFF,0XFF,0XFF,0XDF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X07,0X8F,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0X63,0XC7,0XFF,0XFC,0X00,0X0C,0X00,0X8F,0X3F,0XFF,0XFF,0X3F,0XFF,0XFF,0XFF,
0XBF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X03,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0X30,0XF1,0XFF,0XFF,0X82,0X18,0X01,0X87,0X3F,0XFF,0XFF,0XBF,0XFF,
0XFF,0XFF,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X8F,0XFF,
0XFD,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0X38,0X1C,0XE1,0XFF,0XF1,0XF0,0X01,0XC7,0X3F,0XFF,0XFF,
0X9F,0XFF,0XFF,0XFE,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XE3,0XFF,0XFB,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X3E,0X00,0X04,0X7F,0X00,0X01,0X03,0XC3,0X3F,
0XFF,0XFF,0X8F,0XFF,0XFF,0XFE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBF,0X87,0X83,0X00,0X00,0X00,0X61,
0XC3,0X9F,0XFF,0XFF,0X8F,0XFF,0XFF,0XFD,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFE,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X9F,0XFF,0XF1,0XE6,0X00,
0XC2,0X61,0XC3,0X9F,0XFF,0XFF,0X9F,0XFF,0XFF,0XF9,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XDF,0XFF,0XF0,
0X78,0X00,0X82,0X61,0XE1,0X9F,0XFF,0XFF,0X9F,0XFF,0XFF,0XF3,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XEF,0XE0,0X00,0X01,0X86,0X61,0XE1,0XFF,0XFF,0XFF,0X9F,0XFF,0XFF,0XE7,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0X3F,0XCF,0XE4,0X00,0X01,0X00,0X40,0XF0,0XFF,0XFF,0XFF,0X1F,0XFF,0XFF,0XCF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XF9,0XFF,0XFE,0X04,0X01,0X80,0X41,0XD0,0X7F,0XFF,0XFF,0X1F,0XFF,
0XFF,0X9F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFC,0X7F,0XF8,0X00,0X33,0X80,0X40,0X88,0X3F,0XFF,0XFF,
0X4F,0XFF,0XF8,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X0F,0XE0,0X23,0XE7,0XC2,0X00,0XCC,0X1F,
0XFF,0XFF,0X4F,0XFF,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X80,0X06,0X4F,0X8F,0XE3,0X00,
0XFE,0X07,0XFF,0XFE,0X47,0XFF,0XE1,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFC,0X7C,0X9C,0X3F,
0XF3,0X00,0XFF,0X80,0XFF,0XFE,0X13,0XFC,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF9,
0XB1,0XFF,0XF9,0X80,0X7F,0XC0,0X3F,0XFC,0X00,0X00,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XF1,0X07,0XFF,0XF9,0XC0,0X7F,0XF0,0X0F,0XFC,0X00,0X03,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XF3,0X1F,0XFF,0XF9,0XE0,0X3F,0XFE,0X01,0XF0,0X00,0X7F,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XE3,0X3F,0XFF,0XFC,0XF0,0X3F,0XFF,0X80,0X00,0X3F,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE7,0X3F,0XFF,0XFC,0X78,0X3F,0XFF,0XC0,0X01,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE7,0X3F,0XFF,0XFC,0X7E,0X1F,0XFF,
0XF0,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XCE,0X3F,0XFF,0XFC,0X3F,
0X8F,0XFF,0XF8,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XCE,0X3F,0XFF,
0XFC,0X9F,0XC7,0XFF,0XFC,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XCC,
0X9F,0XFF,0XFC,0X9F,0XE7,0XFF,0XFE,0X1F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XC8,0XCF,0XFF,0XFD,0X9F,0XE0,0XFF,0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XC0,0XE7,0XFC,0X79,0XDF,0XF0,0X7F,0XFE,0X7F,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XC1,0XF0,0XF0,0X73,0XDF,0XF0,0X7F,0XFC,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC1,0XFC,0X03,0X07,0XDF,0XF0,0XFF,0XF8,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC1,0XFF,0XFF,0XDF,0XDF,0XF2,0X7F,
0XE3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC1,0XFF,0XFF,0XFF,0XDF,
0XF3,0X0F,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC1,0XFF,0XFF,
0XFF,0XDF,0XF3,0X80,0X1F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC1,
0XFF,0XFF,0XFF,0X9F,0XF3,0XE0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XE1,0XFF,0XFF,0XFF,0X9F,0XF3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XE1,0XFF,0XFF,0XFF,0X9F,0XF3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XE1,0XFF,0XFF,0XFF,0X9F,0XF3,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF1,0XFE,0X7F,0XFF,0X9F,0XF3,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0XFF,0X7F,0XFF,0X9F,0XE7,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,0X3F,0XFF,0XFF,0X8F,
0XE7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF9,0X0F,0X80,
0X0F,0X8F,0XCF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFC,
0XC0,0X00,0X01,0X87,0XCF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFC,0XF8,0X7F,0XE0,0X17,0X9F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFC,0XFF,0XFF,0XFC,0X12,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X7F,0XFF,0XFF,0X00,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X7F,0XFF,0XFF,0X81,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X1F,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X87,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC3,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XF0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFE,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X3F,0XFF,0XFF,0XFF,0XFF,0X1F,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X3F,0XFF,0XFF,0XFF,0XFC,0X0F,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XBF,0XFF,0XFF,0XFF,0XF8,
0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X9F,0XFF,0XFF,
0XFF,0XF9,0XC3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X9F,
0XFF,0XFF,0XFF,0XF3,0XE3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XDF,0XFF,0XFF,0XFF,0XF3,0XE3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XDF,0XFF,0XFF,0XFF,0XE4,0X73,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XDF,0XFF,0XFF,0XFF,0XE0,0X33,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XDF,0XFF,0XFF,0XFF,0XC0,0X13,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XCF,0XFF,0XFF,0XFF,0X87,0X03,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XEF,0XFF,0XFF,0XFF,0X1F,
0X83,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE7,0XFF,0XFF,
0XFE,0X3F,0XC3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF7,
0XFF,0XFF,0XFC,0X7F,0XC7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFB,0XFF,0XFF,0XF9,0XFF,0XE7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XF9,0XFF,0XFF,0XE3,0XFF,0XE3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X7F,0XFF,0XCF,0XFF,0XE3,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X1F,0XFF,0X1F,0XFF,0XF3,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC7,0XFC,0X7F,0XFF,0XF3,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0X21,0XFF,0XFF,
0XF3,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XF9,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFD,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X87,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF9,0XE1,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XE1,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XFF,0XFC,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0X00,0X00,0X0F,0X00,0X01,0XE0,0X00,0X78,0X00,0X7F,0XFE,0X00,0X7C,0X00,
0X00,0X07,0XCF,0XFF,0XFF,0XFF,0X80,0X7F,0XFF,0XFE,0X1E,0X00,0X00,0X1E,0X00,0X3F,
0XFF,0X00,0X0F,0XFF,0XFF,0XE0,0X1F,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X07,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0X80,0X00,0X0F,0X00,0X01,0XE0,0X00,0X78,0X03,0XFF,0XFF,0X80,
0X3E,0X00,0X00,0X0F,0X8F,0XFF,0XFF,0XFF,0X81,0XFF,0XFF,0XFE,0X1E,0X00,0X00,0X1E,
0X00,0XFF,0XFF,0XC0,0X0F,0XFF,0XFF,0XF8,0X1F,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X07,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC0,0X00,0X0F,0X00,0X01,0XE0,0X00,0X78,0X07,0XFF,
0XFF,0XE0,0X3E,0X00,0X00,0X0F,0X8F,0XFF,0XFF,0XFF,0X83,0XFF,0XFF,0XFE,0X1E,0X00,
0X00,0X1E,0X03,0XFF,0XFF,0XF0,0X0F,0XFF,0XFF,0XFC,0X1F,0XFF,0XFF,0XFF,0X00,0X00,
0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XF9,0XFF,0XE0,0X00,0X0F,0X00,0X01,0XE0,0X00,0X78,
0X0F,0XFF,0XFF,0XF0,0X1F,0X00,0X00,0X1F,0X0F,0XFF,0XFF,0XFF,0X87,0XFF,0XFF,0XFE,
0X1E,0X00,0X00,0X1E,0X07,0XFF,0XFF,0XF8,0X0F,0XFF,0XFF,0XFE,0X1F,0XFF,0XFF,0XFF,
0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XF1,0XFF,0XF0,0X00,0X0F,0X00,0X01,0XE0,
0X00,0X78,0X1F,0XFF,0XFF,0XF8,0X1F,0X00,0X00,0X1F,0X0F,0XFF,0XFF,0XFF,0X87,0XFF,
0XFF,0XFE,0X1E,0X00,0X00,0X1E,0X0F,0XFF,0XFF,0XFC,0X0F,0XFF,0XFF,0XFF,0X1F,0XFF,
0XFF,0XFF,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XE1,0XFF,0XF8,0X00,0X0F,0X00,
0X01,0XE0,0X00,0X78,0X1F,0XF0,0X0F,0XF8,0X0F,0X80,0X00,0X3E,0X0F,0X80,0X00,0X00,
0X07,0XF0,0X00,0X00,0X1E,0X00,0X00,0X1E,0X0F,0XF8,0X07,0XFC,0X0F,0X00,0X01,0XFF,
0X1F,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XC1,0XFF,0XFC,0X00,
0X0F,0X00,0X01,0XE0,0X00,0X78,0X3F,0X80,0X01,0XFC,0X0F,0X80,0X00,0X3E,0X0F,0X00,
0X00,0X00,0X07,0X80,0X00,0X00,0X1E,0X00,0X00,0X1E,0X1F,0XC0,0X00,0XFE,0X0F,0X00,
0X00,0X1F,0X1E,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0X81,0XFF,
0XFC,0X00,0X0F,0X00,0X01,0XE0,0X00,0X78,0X3F,0X00,0X00,0X7C,0X07,0XC0,0X00,0X7C,
0X0F,0X00,0X00,0X00,0X07,0X80,0X00,0X00,0X1E,0X00,0X00,0X1E,0X1F,0X80,0X00,0X3E,
0X0F,0X00,0X00,0X0F,0X1E,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,
0X01,0XFF,0XFE,0X00,0X0F,0X00,0X01,0XE0,0X00,0X78,0X3E,0X00,0X00,0X7C,0X03,0XC0,
0X00,0X7C,0X0F,0X00,0X00,0X00,0X07,0X80,0X00,0X00,0X1E,0X00,0X00,0X1E,0X1F,0X00,
0X00,0X3E,0X0F,0X00,0X00,0X0F,0X1E,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,
0XFF,0XFE,0X01,0XFF,0XFF,0X00,0X0F,0X00,0X01,0XE0,0X00,0X78,0X3C,0X00,0X00,0X3C,
0X03,0XE0,0X00,0XF8,0X0F,0X80,0X00,0X00,0X07,0XC0,0X00,0X00,0X1F,0X00,0X00,0X1E,
0X1E,0X00,0X00,0X1E,0X0F,0X00,0X00,0X0F,0X1F,0X00,0X00,0X00,0X00,0X00,0X00,0X07,
0XFF,0XFF,0XFF,0XFC,0X01,0XFF,0XFF,0X00,0X0F,0X00,0X01,0XE0,0X00,0X78,0X3C,0X00,
0X00,0X3C,0X01,0XF0,0X00,0XF8,0X0F,0XFF,0XFF,0XF0,0X07,0XFF,0XFF,0XF0,0X1F,0XFF,
0XFF,0XFE,0X1E,0X00,0X00,0X1E,0X0F,0X00,0X00,0X0F,0X1F,0XFF,0XFF,0XE0,0X00,0X00,
0X00,0X07,0XFF,0XFF,0XFF,0XFC,0X01,0XFF,0XFF,0X80,0X0F,0X00,0X01,0XE0,0X00,0X78,
0X3C,0X00,0X00,0X3C,0X01,0XF0,0X01,0XF0,0X0F,0XFF,0XFF,0XF0,0X07,0XFF,0XFF,0XFC,
0X1F,0XFF,0XFF,0XFE,0X1E,0X00,0X00,0X1E,0X0F,0X00,0X00,0X0F,0X1F,0XFF,0XFF,0XE0,
0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XF8,0X01,0XFF,0XFF,0X80,0X0F,0X00,0X01,0XE0,
0X00,0X78,0X3C,0X00,0X00,0X3C,0X00,0XF8,0X01,0XF0,0X0F,0XFF,0XFF,0XF0,0X07,0XFF,
0XFF,0XFE,0X1F,0XFF,0XFF,0XFE,0X1E,0X00,0X00,0X1E,0X0F,0X00,0X00,0X0F,0X1F,0XFF,
0XFF,0XE0,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XF8,0X01,0XFF,0XFF,0XC0,0X0F,0X00,
0X01,0XE0,0X00,0X78,0X3C,0X00,0X00,0X3C,0X00,0XF8,0X03,0XE0,0X0F,0XFF,0XFF,0XF0,
0X01,0XFF,0XFF,0XFE,0X1F,0XFF,0XFF,0XFE,0X1E,0X00,0X00,0X1E,0X0F,0X00,0X00,0X1F,
0X1F,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X07,0XC0,0X1F,0X01,0XFC,0X01,0XE0,0XFF,0XC0,
0X0F,0X00,0X01,0XE0,0X00,0X78,0X3C,0X00,0X00,0X3C,0X00,0X7C,0X03,0XC0,0X0F,0XFF,
0XFF,0XF0,0X00,0X7F,0XFF,0XFF,0X1F,0XFF,0XFF,0XFE,0X1E,0X00,0X00,0X1E,0X0F,0XFF,
0XFF,0XFF,0X1F,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X07,0XC0,0X1F,0X01,0XF8,0X01,0XC0,
0X7F,0XC0,0X0F,0X00,0X01,0XE0,0X00,0X78,0X3F,0XFF,0XFF,0XFC,0X00,0X7C,0X07,0XC0,
0X0F,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0X1E,0X00,0X00,0X1E,0X1F,0XFF,0XFF,0XFE,
0X0F,0XFF,0XFF,0XFF,0X1F,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XC0,0X1F,0X01,0XF8,
0X01,0XC0,0X7F,0XE0,0X0F,0X00,0X01,0XE0,0X00,0X78,0X3F,0XFF,0XFF,0XFC,0X00,0X3E,
0X07,0X80,0X0F,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0X1E,0X00,0X00,0X1E,0X1F,0XFF,
0XFF,0XFE,0X0F,0XFF,0XFF,0XFE,0X1E,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XC0,0X1E,
0X00,0XF8,0X07,0XC0,0X3F,0XE0,0X0F,0X00,0X01,0XE0,0X00,0X78,0X3F,0XFF,0XFF,0XFC,
0X00,0X3E,0X0F,0X80,0X0F,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0X1E,0X00,0X00,0X1E,
0X1F,0XFF,0XFF,0XFE,0X0F,0XFF,0XFF,0XFC,0X1E,0X00,0X00,0X00,0X00,0X00,0X00,0X07,
0XC0,0X0E,0X00,0XF0,0X0F,0X80,0X3F,0XE0,0X0F,0X00,0X01,0XE0,0X00,0X78,0X3F,0XFF,
0XFF,0XFC,0X00,0X1F,0X0F,0X00,0X0F,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0X1E,0X00,
0X00,0X1E,0X1F,0XFF,0XFF,0XFE,0X0F,0XFF,0XFF,0XF8,0X1E,0X00,0X00,0X00,0X00,0X00,
0X00,0X07,0XE0,0X0E,0X00,0XF0,0X0F,0X80,0X1F,0XF0,0X0F,0X00,0X01,0XE0,0X00,0X78,
0X3F,0XFF,0XFF,0XFC,0X00,0X1F,0X1F,0X00,0X0F,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,
0X1E,0X00,0X00,0X1E,0X1F,0XFF,0XFF,0XFE,0X0F,0XFF,0XF7,0XC0,0X1E,0X00,0X00,0X00,
0X00,0X00,0X00,0X07,0XE0,0X04,0X00,0X60,0X0F,0X00,0X1F,0XF0,0X0F,0X00,0X01,0XE0,
0X00,0X78,0X3C,0X00,0X00,0X7C,0X00,0X0F,0XBE,0X00,0X0F,0X00,0X00,0X00,0X00,0X00,
0X00,0X0F,0X1E,0X00,0X00,0X1E,0X1F,0X00,0X00,0X1E,0X0F,0X0F,0XF0,0X00,0X1E,0X00,
0X00,0X00,0X00,0X00,0X00,0X07,0XE0,0X04,0X00,0X60,0X1F,0X00,0X0F,0XF0,0X0F,0X00,
0X01,0XE0,0X00,0X78,0X3C,0X00,0X00,0X3C,0X00,0X0F,0XBE,0X00,0X0F,0X00,0X00,0X00,
0X00,0X00,0X00,0X0F,0X1E,0X00,0X00,0X1E,0X1E,0X00,0X00,0X1E,0X0F,0X07,0XF8,0X00,
0X1E,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XF0,0X04,0X00,0X40,0X1E,0X00,0X0F,0XF0,
0X0F,0X00,0X01,0XE0,0X00,0X78,0X3C,0X00,0X00,0X3C,0X00,0X07,0XFC,0X00,0X0F,0X00,
0X00,0X00,0X00,0X00,0X00,0X0F,0X1E,0X00,0X00,0X1E,0X1E,0X00,0X00,0X1E,0X0F,0X01,
0XFE,0X00,0X1E,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X00,0X00,0X0E,0X00,
0X07,0XF0,0X0F,0X80,0X01,0XE0,0X00,0XF8,0X3C,0X00,0X00,0X3C,0X00,0X07,0XFC,0X00,
0X0F,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0X1E,0X00,0X00,0X1E,0X1E,0X00,0X00,0X1E,
0X0F,0X00,0XFF,0X00,0X1E,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X00,0X00,
0X0C,0X00,0X07,0XF0,0X0F,0XF0,0X03,0XE0,0X0F,0XF8,0X3C,0X00,0X00,0X3C,0X00,0X03,
0XF8,0X00,0X0F,0X80,0X00,0X00,0X00,0X00,0X01,0XFF,0X1E,0X00,0X00,0X1E,0X1E,0X00,
0X00,0X1E,0X0F,0X00,0X3F,0XC0,0X1F,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XF8,0X00,
0X00,0X00,0X04,0X00,0X03,0XF0,0X0F,0XFF,0XFF,0XFF,0XFF,0XF8,0X3C,0X00,0X00,0X3C,
0X00,0X03,0XF8,0X00,0X0F,0XFF,0XFF,0XFF,0X8F,0XFF,0XFF,0XFF,0X1E,0X00,0X00,0X1E,
0X1E,0X00,0X00,0X1E,0X0F,0X00,0X1F,0XE0,0X1F,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X07,
0XF8,0X00,0X00,0X00,0X04,0X00,0X03,0XF0,0X0F,0XFF,0XFF,0XFF,0XFF,0XF8,0X3C,0X00,
0X00,0X3C,0X00,0X01,0XF0,0X00,0X0F,0XFF,0XFF,0XFF,0X87,0XFF,0XFF,0XFE,0X1E,0X00,
0X00,0X1E,0X1E,0X00,0X00,0X1E,0X0F,0X00,0X07,0XF0,0X1F,0XFF,0XFF,0XFF,0X00,0X00,
0X00,0X07,0XF8,0X00,0X00,0X00,0X00,0X00,0X01,0XF0,0X07,0XFF,0XFF,0XFF,0XFF,0XF0,
0X3C,0X00,0X00,0X3C,0X00,0X01,0XF0,0X00,0X0F,0XFF,0XFF,0XFF,0X87,0XFF,0XFF,0XFC,
0X1E,0X00,0X00,0X1E,0X1E,0X00,0X00,0X1E,0X0F,0X00,0X03,0XFC,0X1F,0XFF,0XFF,0XFF,
0X00,0X00,0X00,0X03,0XFC,0X00,0X00,0X00,0X00,0X04,0X01,0XF0,0X01,0XFF,0XFF,0XFF,
0XFF,0XE0,0X3C,0X00,0X00,0X3C,0X00,0X00,0XE0,0X00,0X0F,0XFF,0XFF,0XFF,0X87,0XFF,
0XFF,0XF8,0X1E,0X00,0X00,0X1E,0X1E,0X00,0X00,0X1E,0X0F,0X00,0X01,0XFE,0X1F,0XFF,
0XFF,0XFF,0X00,0X00,0X00,0X03,0XFC,0X00,0X20,0X00,0X00,0X06,0X00,0XF0,0X00,0X3F,
0XFF,0XFF,0XFF,0X00,0X3C,0X00,0X00,0X3C,0X00,0X00,0XC0,0X00,0X0F,0XFF,0XFF,0XFF,
0X87,0XFF,0XFF,0XC0,0X1E,0X00,0X00,0X1E,0X1E,0X00,0X00,0X1E,0X0F,0X00,0X00,0X7F,
0X9F,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X03,0XFC,0X00,0X30,0X00,0X00,0X0E,0X00,0XF0,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFE,0X00,0X30,0X00,0X00,0X0F,
0X00,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFE,0X00,0X70,0X01,
0X00,0X0F,0X00,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFE,0X00,
0X78,0X03,0X00,0X1E,0X00,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,
0XFF,0X00,0X78,0X03,0X80,0X1E,0X01,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0X00,0XF8,0X03,0X80,0X3E,0X01,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X01,0XFF,0X00,0XFC,0X07,0X80,0X3C,0X03,0XF0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0X80,0XFC,0X07,0XC0,0X7C,0X03,0XF0,0X00,0X04,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X20,0X00,0X00,0X00,0X00,0X00,0X10,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0X81,0XFC,0X0F,0XC0,0X78,0X07,0XF0,
0X00,0X04,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X20,0X00,0X00,0X00,0X00,0X00,0X10,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0X81,0XFE,0X0F,0XFF,0XE0,
0X07,0XF0,0X00,0X04,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X20,0X00,0X00,0X00,0X00,0X00,
0X10,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X7F,0XFF,0XFF,0XFF,
0XFF,0XE0,0X0F,0XF0,0X00,0X04,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X20,0X00,0X00,0X00,
0X00,0X00,0X10,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0XFF,
0XFF,0XFF,0XFF,0XE0,0X1F,0XF0,0X0F,0X04,0X78,0X01,0XE2,0X13,0X03,0XE0,0X00,0X0F,
0X88,0X80,0X00,0X40,0XF8,0X07,0X80,0X7C,0X04,0X78,0X38,0X01,0XF0,0X00,0X23,0XC0,
0X0F,0X10,0X98,0X1F,0X10,0X00,0X00,0X81,0XF1,0X01,0X83,0XE0,0X00,0X00,0X00,0X00,
0X3F,0XFF,0XFF,0XFF,0XFF,0XE0,0X0F,0XF0,0X19,0X85,0X8C,0X06,0X1A,0X14,0X0C,0X30,
0X00,0X18,0XC8,0X80,0X80,0X43,0X8E,0X0C,0XC1,0XC6,0X04,0X8C,0XC6,0X06,0X18,0X00,
0X2C,0X60,0X30,0XD0,0XA0,0X71,0X91,0X01,0X00,0X87,0X19,0X1E,0X06,0X18,0X00,0X00,
0X00,0X00,0X1F,0XFF,0XFF,0XFF,0XFF,0XE0,0X0F,0XF0,0X10,0X06,0X06,0X0C,0X06,0X18,
0X18,0X08,0X00,0X20,0X38,0X80,0XC0,0X82,0X02,0X08,0X03,0X01,0X07,0X07,0X02,0X0C,
0X04,0X00,0X30,0X30,0X60,0X70,0XC0,0XC0,0X71,0X01,0X81,0X04,0X07,0X1C,0X08,0X0C,
0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XFF,0XFF,0XE0,0X1F,0XF0,0X10,0X06,0X02,0X18,
0X06,0X18,0X10,0X04,0X00,0X40,0X18,0X41,0XC0,0X84,0X01,0X08,0X02,0X00,0X86,0X03,
0X02,0X08,0X02,0X00,0X30,0X10,0XC0,0X30,0X80,0X80,0X30,0X83,0X81,0X08,0X03,0X18,
0X18,0X04,0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XFF,0XFF,0XE0,0X3F,0XF0,0X10,0X04,
0X02,0X10,0X02,0X10,0X30,0X04,0X00,0XC0,0X18,0X41,0X61,0X84,0X01,0X88,0X06,0X00,
0X86,0X02,0X03,0X18,0X02,0X00,0X20,0X10,0X80,0X10,0X81,0X80,0X30,0X82,0XC2,0X18,
0X03,0X18,0X10,0X02,0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XFF,0XE0,0X7F,0XF0,
0X0C,0X04,0X02,0X10,0X02,0X10,0X3F,0XFE,0X00,0X80,0X08,0X21,0X21,0X0F,0XFF,0X86,
0X04,0X00,0XC4,0X02,0X03,0X1F,0XFE,0X00,0X20,0X10,0X80,0X10,0X81,0X00,0X10,0XC6,
0X42,0X10,0X01,0X18,0X1F,0XFE,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XE0,
0XFF,0XF0,0X06,0X04,0X02,0X10,0X02,0X10,0X30,0X00,0X00,0X80,0X08,0X22,0X33,0X0C,
0X00,0X03,0X04,0X00,0XC4,0X02,0X03,0X18,0X00,0X00,0X20,0X10,0X80,0X10,0X81,0X00,
0X10,0X44,0X46,0X10,0X01,0X18,0X10,0X00,0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,0XFF,
0XFF,0XE1,0XFF,0XF0,0X01,0X84,0X02,0X10,0X02,0X10,0X20,0X00,0X00,0X80,0X08,0X32,
0X12,0X08,0X00,0X00,0XC4,0X00,0XC4,0X02,0X03,0X10,0X00,0X00,0X20,0X10,0X80,0X10,
0X81,0X00,0X10,0X44,0X24,0X10,0X01,0X18,0X10,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,
0XFF,0XFF,0XFF,0XE3,0XFF,0XF0,0X00,0X84,0X02,0X10,0X02,0X10,0X30,0X00,0X00,0XC0,
0X18,0X14,0X12,0X04,0X00,0X00,0X44,0X00,0X84,0X02,0X03,0X10,0X00,0X00,0X20,0X10,
0X80,0X10,0X81,0X80,0X30,0X28,0X24,0X18,0X03,0X18,0X10,0X00,0X00,0X00,0X00,0X00,
0X00,0X7F,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0X00,0X84,0X02,0X18,0X06,0X10,0X10,0X04,
0X00,0X40,0X18,0X1C,0X0C,0X04,0X01,0X00,0X42,0X00,0X84,0X02,0X03,0X08,0X02,0X00,
0X20,0X10,0XC0,0X30,0X80,0X80,0X30,0X38,0X18,0X08,0X03,0X18,0X18,0X04,0X00,0X00,
0X00,0X00,0X00,0X1F,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0X00,0X84,0X02,0X0C,0X06,0X10,
0X18,0X08,0X00,0X20,0X38,0X0C,0X0C,0X02,0X03,0X00,0X43,0X01,0X04,0X02,0X03,0X0C,
0X04,0X00,0X20,0X10,0X60,0X30,0X80,0XC0,0X70,0X10,0X18,0X0C,0X07,0X18,0X08,0X0C,
0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0X31,0X84,0X02,0X06,
0X1A,0X10,0X0C,0X30,0X00,0X38,0XC8,0X08,0X0C,0X03,0X8E,0X18,0XC1,0X86,0X04,0X02,
0X03,0X06,0X18,0X00,0X20,0X10,0X30,0XD0,0X80,0X71,0X90,0X10,0X10,0X07,0X19,0X18,
0X06,0X18,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,0X0E,0X04,
0X02,0X01,0XE2,0X10,0X03,0XE0,0X00,0X0F,0X88,0X00,0X00,0X00,0XF8,0X07,0X00,0X7C,
0X04,0X02,0X00,0X01,0XF0,0X00,0X20,0X10,0X0F,0X10,0X80,0X1F,0X10,0X00,0X00,0X01,
0XF1,0X00,0X03,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0XFF,0XFF,0XFF,0XF0,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XFF,
0XFF,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,
0XFF,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
]
| 80.753099 | 81 | 0.779529 | 15,186 | 78,169 | 4.012512 | 0.017582 | 1.174517 | 1.670004 | 2.137657 | 0.890012 | 0.878393 | 0.866774 | 0.856468 | 0.849181 | 0.838612 | 0 | 0.312722 | 0.02762 | 78,169 | 967 | 82 | 80.836608 | 0.488936 | 0.01484 | 0 | 0.503191 | 0 | 0 | 0 | 0 | 0 | 0 | 0.789359 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 |
10c4474bb27bf7c74214a1dc252311c83b7afd04 | 24,479 | py | Python | homepage/migrations/0001_initial.py | chadgates/thetravelling2 | 3646d64acb0fbf5106066700f482c9013f5fb7d0 | [
"MIT"
] | null | null | null | homepage/migrations/0001_initial.py | chadgates/thetravelling2 | 3646d64acb0fbf5106066700f482c9013f5fb7d0 | [
"MIT"
] | null | null | null | homepage/migrations/0001_initial.py | chadgates/thetravelling2 | 3646d64acb0fbf5106066700f482c9013f5fb7d0 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-02 09:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailimages.blocks
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtaildocs', '0007_merge'),
('wagtailimages', '0016_deprecate_rendition_filter_relation'),
('wagtailcore', '0032_add_bulk_delete_page_permission'),
]
operations = [
migrations.CreateModel(
name='AccommodationPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('TwoColumnBlock', wagtail.wagtailcore.blocks.StructBlock((('background', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[('theme-white', 'White'), ('theme-black', 'Black'), ('theme-darker', 'Dark Gray'), ('theme-body-color', 'Body Color'), ('theme-primary', 'Primary Color'), ('theme-secondary', 'Secondary Color')], default='white')), ('left_column', wagtail.wagtailcore.blocks.StreamBlock((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('google_map', wagtail.wagtailcore.blocks.StructBlock((('map_width', wagtail.wagtailcore.blocks.CharBlock(default='600', max_length=4, required=True)), ('map_height', wagtail.wagtailcore.blocks.CharBlock(default='450', max_length=4, required=True)), ('map_params', wagtail.wagtailcore.blocks.CharBlock(help_text='No spaces, add + instead', max_length=300, required=True)))))), icon='arrow-left', label='Left column content')), ('right_column', wagtail.wagtailcore.blocks.StreamBlock((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('google_map', wagtail.wagtailcore.blocks.StructBlock((('map_width', wagtail.wagtailcore.blocks.CharBlock(default='600', max_length=4, required=True)), ('map_height', wagtail.wagtailcore.blocks.CharBlock(default='450', max_length=4, required=True)), ('map_params', wagtail.wagtailcore.blocks.CharBlock(help_text='No spaces, add + instead', max_length=300, required=True)))))), icon='arrow-right', label='Right column content')))))), default='')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='BlockPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.wagtailcore.fields.StreamField((('CoupleBlock', wagtail.wagtailcore.blocks.StructBlock((('bg_gray', wagtail.wagtailcore.blocks.BooleanBlock(help_text='Select if background should by gray', required=False)), ('maintitle', wagtail.wagtailcore.blocks.CharBlock()), ('subtitle', wagtail.wagtailcore.blocks.CharBlock()), ('headline', wagtail.wagtailcore.blocks.CharBlock()), ('bridename', wagtail.wagtailcore.blocks.CharBlock()), ('bridetext', wagtail.wagtailcore.blocks.TextBlock()), ('bridephoto', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('groomame', wagtail.wagtailcore.blocks.CharBlock()), ('groomtext', wagtail.wagtailcore.blocks.TextBlock()), ('groomphoto', wagtail.wagtailimages.blocks.ImageChooserBlock())))), ('TwoColumnBlock', wagtail.wagtailcore.blocks.StructBlock((('background', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[('theme-white', 'White'), ('theme-black', 'Black'), ('theme-darker', 'Dark Gray'), ('theme-body-color', 'Body Color'), ('theme-primary', 'Primary Color'), ('theme-secondary', 'Secondary Color')], default='white')), ('left_column', wagtail.wagtailcore.blocks.StreamBlock((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('google_map', wagtail.wagtailcore.blocks.StructBlock((('map_width', wagtail.wagtailcore.blocks.CharBlock(default='600', max_length=4, required=True)), ('map_height', wagtail.wagtailcore.blocks.CharBlock(default='450', max_length=4, required=True)), ('map_params', wagtail.wagtailcore.blocks.CharBlock(help_text='No spaces, add + instead', max_length=300, required=True)))))), icon='arrow-left', label='Left column content')), ('right_column', wagtail.wagtailcore.blocks.StreamBlock((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('google_map', wagtail.wagtailcore.blocks.StructBlock((('map_width', wagtail.wagtailcore.blocks.CharBlock(default='600', max_length=4, required=True)), ('map_height', wagtail.wagtailcore.blocks.CharBlock(default='450', max_length=4, required=True)), ('map_params', wagtail.wagtailcore.blocks.CharBlock(help_text='No spaces, add + instead', max_length=300, required=True)))))), icon='arrow-right', label='Right column content'))))), ('GoogleMapBlock', wagtail.wagtailcore.blocks.StructBlock((('map_width', wagtail.wagtailcore.blocks.CharBlock(default='600', max_length=4, required=True)), ('map_height', wagtail.wagtailcore.blocks.CharBlock(default='450', max_length=4, required=True)), ('map_params', wagtail.wagtailcore.blocks.CharBlock(help_text='No spaces, add + instead', max_length=300, required=True))))), ('RichTextBlock', wagtail.wagtailcore.blocks.RichTextBlock()), ('TimeLineBlock', wagtail.wagtailcore.blocks.StructBlock((('bg_gray', wagtail.wagtailcore.blocks.BooleanBlock(help_text='Select if background should by gray', required=False)), ('headline', wagtail.wagtailcore.blocks.CharBlock()), ('maintitle', wagtail.wagtailcore.blocks.CharBlock()), ('text', wagtail.wagtailcore.blocks.TextBlock()), ('timelineentry', wagtail.wagtailcore.blocks.StreamBlock((('TimelineEntry', wagtail.wagtailcore.blocks.StructBlock((('headline', wagtail.wagtailcore.blocks.CharBlock()), ('date', wagtail.wagtailcore.blocks.CharBlock()), ('text', wagtail.wagtailcore.blocks.TextBlock()), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock())))),), default='')))))), default='')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='FormField',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('label', models.CharField(help_text='The label of the form field', max_length=255, verbose_name='label')),
('field_type', models.CharField(choices=[('singleline', 'Single line text'), ('multiline', 'Multi-line text'), ('email', 'Email'), ('number', 'Number'), ('url', 'URL'), ('checkbox', 'Checkbox'), ('checkboxes', 'Checkboxes'), ('dropdown', 'Drop down'), ('radio', 'Radio buttons'), ('date', 'Date'), ('datetime', 'Date/time')], max_length=16, verbose_name='field type')),
('required', models.BooleanField(default=True, verbose_name='required')),
('choices', models.TextField(blank=True, help_text='Comma separated list of choices. Only applicable in checkboxes, radio and dropdown.', verbose_name='choices')),
('default_value', models.CharField(blank=True, help_text='Default value. Comma separated values supported for checkboxes.', max_length=255, verbose_name='default value')),
('help_text', models.CharField(blank=True, max_length=255, verbose_name='help text')),
],
options={
'abstract': False,
'ordering': ['sort_order'],
},
),
migrations.CreateModel(
name='FormPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('to_address', models.CharField(blank=True, help_text='Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.', max_length=255, verbose_name='to address')),
('from_address', models.CharField(blank=True, max_length=255, verbose_name='from address')),
('subject', models.CharField(blank=True, max_length=255, verbose_name='subject')),
('intro', wagtail.wagtailcore.fields.RichTextField(blank=True, help_text='Edit the content you want to see before the form.')),
('thank_you_text', wagtail.wagtailcore.fields.RichTextField(blank=True, help_text='Set the message users will see after submitting the form.')),
],
options={
'verbose_name': 'Form submission page',
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='GoodToKnowPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('TwoColumnBlock', wagtail.wagtailcore.blocks.StructBlock((('background', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[('theme-white', 'White'), ('theme-black', 'Black'), ('theme-darker', 'Dark Gray'), ('theme-body-color', 'Body Color'), ('theme-primary', 'Primary Color'), ('theme-secondary', 'Secondary Color')], default='white')), ('left_column', wagtail.wagtailcore.blocks.StreamBlock((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('google_map', wagtail.wagtailcore.blocks.StructBlock((('map_width', wagtail.wagtailcore.blocks.CharBlock(default='600', max_length=4, required=True)), ('map_height', wagtail.wagtailcore.blocks.CharBlock(default='450', max_length=4, required=True)), ('map_params', wagtail.wagtailcore.blocks.CharBlock(help_text='No spaces, add + instead', max_length=300, required=True)))))), icon='arrow-left', label='Left column content')), ('right_column', wagtail.wagtailcore.blocks.StreamBlock((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('google_map', wagtail.wagtailcore.blocks.StructBlock((('map_width', wagtail.wagtailcore.blocks.CharBlock(default='600', max_length=4, required=True)), ('map_height', wagtail.wagtailcore.blocks.CharBlock(default='450', max_length=4, required=True)), ('map_params', wagtail.wagtailcore.blocks.CharBlock(help_text='No spaces, add + instead', max_length=300, required=True)))))), icon='arrow-right', label='Right column content')))))), default='')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='HomePage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('couplename', models.CharField(default='Someone & Someone', max_length=255)),
('subtitle', models.CharField(blank=True, default='We are getting married', max_length=255)),
('year', models.CharField(choices=[('2017', '2017'), ('2018', '2018'), ('2019', '2019')], default='2017', max_length=4)),
('month', models.CharField(choices=[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12')], default='7', max_length=2)),
('day', models.CharField(choices=[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12'), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'), ('18', '18'), ('19', '19'), ('20', '20'), ('21', '21'), ('22', '22'), ('23', '23'), ('24', '24'), ('25', '25'), ('26', '26'), ('27', '27'), ('28', '28'), ('29', '29'), ('30', '30'), ('31', '31')], default='1', max_length=2)),
('hour', models.CharField(choices=[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12'), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'), ('18', '18'), ('19', '19'), ('20', '20'), ('21', '21'), ('22', '22'), ('23', '23'), ('24', '24')], default='12', max_length=2)),
('minute', models.CharField(choices=[('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12'), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'), ('18', '18'), ('19', '19'), ('20', '20'), ('21', '21'), ('22', '22'), ('23', '23'), ('24', '24'), ('25', '25'), ('26', '26'), ('27', '27'), ('28', '28'), ('29', '29'), ('30', '30'), ('31', '31'), ('32', '32'), ('33', '33'), ('34', '34'), ('35', '35'), ('36', '36'), ('37', '37'), ('38', '38'), ('39', '39'), ('40', '40'), ('41', '41'), ('42', '42'), ('43', '43'), ('44', '44'), ('45', '45'), ('46', '46'), ('47', '47'), ('48', '48'), ('49', '49'), ('50', '50'), ('51', '51'), ('52', '52'), ('53', '53'), ('54', '54'), ('55', '55'), ('56', '56'), ('57', '57'), ('58', '58'), ('59', '59')], default='0', max_length=2)),
('seconds', models.CharField(choices=[('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12'), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'), ('18', '18'), ('19', '19'), ('20', '20'), ('21', '21'), ('22', '22'), ('23', '23'), ('24', '24'), ('25', '25'), ('26', '26'), ('27', '27'), ('28', '28'), ('29', '29'), ('30', '30'), ('31', '31'), ('32', '32'), ('33', '33'), ('34', '34'), ('35', '35'), ('36', '36'), ('37', '37'), ('38', '38'), ('39', '39'), ('40', '40'), ('41', '41'), ('42', '42'), ('43', '43'), ('44', '44'), ('45', '45'), ('46', '46'), ('47', '47'), ('48', '48'), ('49', '49'), ('50', '50'), ('51', '51'), ('52', '52'), ('53', '53'), ('54', '54'), ('55', '55'), ('56', '56'), ('57', '57'), ('58', '58'), ('59', '59')], default='0', max_length=2)),
('body', wagtail.wagtailcore.fields.StreamField((('CoupleBlock', wagtail.wagtailcore.blocks.StructBlock((('bg_gray', wagtail.wagtailcore.blocks.BooleanBlock(help_text='Select if background should by gray', required=False)), ('maintitle', wagtail.wagtailcore.blocks.CharBlock()), ('subtitle', wagtail.wagtailcore.blocks.CharBlock()), ('headline', wagtail.wagtailcore.blocks.CharBlock()), ('bridename', wagtail.wagtailcore.blocks.CharBlock()), ('bridetext', wagtail.wagtailcore.blocks.TextBlock()), ('bridephoto', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('groomame', wagtail.wagtailcore.blocks.CharBlock()), ('groomtext', wagtail.wagtailcore.blocks.TextBlock()), ('groomphoto', wagtail.wagtailimages.blocks.ImageChooserBlock())))), ('TimeLineBlock', wagtail.wagtailcore.blocks.StructBlock((('bg_gray', wagtail.wagtailcore.blocks.BooleanBlock(help_text='Select if background should by gray', required=False)), ('headline', wagtail.wagtailcore.blocks.CharBlock()), ('maintitle', wagtail.wagtailcore.blocks.CharBlock()), ('text', wagtail.wagtailcore.blocks.TextBlock()), ('timelineentry', wagtail.wagtailcore.blocks.StreamBlock((('TimelineEntry', wagtail.wagtailcore.blocks.StructBlock((('headline', wagtail.wagtailcore.blocks.CharBlock()), ('date', wagtail.wagtailcore.blocks.CharBlock()), ('text', wagtail.wagtailcore.blocks.TextBlock()), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock())))),), default='')))))), default='')),
('background', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image')),
('icsfile', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtaildocs.Document')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='ImpressumPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.wagtailcore.fields.RichTextField()),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='OurDayPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.wagtailcore.fields.StreamField((('MainTitle', wagtail.wagtailcore.blocks.StructBlock((('bg_gray', wagtail.wagtailcore.blocks.BooleanBlock(help_text='Select if background should by gray', required=False)), ('maintitle', wagtail.wagtailcore.blocks.CharBlock())))), ('Paragraph', wagtail.wagtailcore.blocks.StructBlock((('bg_gray', wagtail.wagtailcore.blocks.BooleanBlock(help_text='Select if background should by gray', required=False)), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock())))), ('Image', wagtail.wagtailcore.blocks.StructBlock((('bg_gray', wagtail.wagtailcore.blocks.BooleanBlock(help_text='Select if background should by gray', required=False)), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('endtoend', wagtail.wagtailcore.blocks.BooleanBlock()), ('width', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[('original', 'original'), ('1920', '1920'), ('800', '800'), ('640', '640'), ('400', '400')], default='800'))))), ('TwoColumnBlock', wagtail.wagtailcore.blocks.StructBlock((('background', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[('theme-white', 'White'), ('theme-black', 'Black'), ('theme-darker', 'Dark Gray'), ('theme-body-color', 'Body Color'), ('theme-primary', 'Primary Color'), ('theme-secondary', 'Secondary Color')], default='white')), ('left_column', wagtail.wagtailcore.blocks.StreamBlock((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('google_map', wagtail.wagtailcore.blocks.StructBlock((('map_width', wagtail.wagtailcore.blocks.CharBlock(default='600', max_length=4, required=True)), ('map_height', wagtail.wagtailcore.blocks.CharBlock(default='450', max_length=4, required=True)), ('map_params', wagtail.wagtailcore.blocks.CharBlock(help_text='No spaces, add + instead', max_length=300, required=True)))))), icon='arrow-left', label='Left column content')), ('right_column', wagtail.wagtailcore.blocks.StreamBlock((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('google_map', wagtail.wagtailcore.blocks.StructBlock((('map_width', wagtail.wagtailcore.blocks.CharBlock(default='600', max_length=4, required=True)), ('map_height', wagtail.wagtailcore.blocks.CharBlock(default='450', max_length=4, required=True)), ('map_params', wagtail.wagtailcore.blocks.CharBlock(help_text='No spaces, add + instead', max_length=300, required=True)))))), icon='arrow-right', label='Right column content'))))), ('EventBlock', wagtail.wagtailcore.blocks.StructBlock((('background', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('headline', wagtail.wagtailcore.blocks.CharBlock()), ('maintitle', wagtail.wagtailcore.blocks.CharBlock()), ('lefttitle', wagtail.wagtailcore.blocks.CharBlock()), ('lefttime', wagtail.wagtailcore.blocks.CharBlock()), ('leftdate', wagtail.wagtailcore.blocks.CharBlock()), ('lefttext', wagtail.wagtailcore.blocks.TextBlock()), ('righttitle', wagtail.wagtailcore.blocks.CharBlock()), ('righttime', wagtail.wagtailcore.blocks.CharBlock()), ('rightdate', wagtail.wagtailcore.blocks.CharBlock()), ('righttext', wagtail.wagtailcore.blocks.TextBlock()))))), default='')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.CreateModel(
name='OurWishPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
('body', wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('TwoColumnBlock', wagtail.wagtailcore.blocks.StructBlock((('background', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[('theme-white', 'White'), ('theme-black', 'Black'), ('theme-darker', 'Dark Gray'), ('theme-body-color', 'Body Color'), ('theme-primary', 'Primary Color'), ('theme-secondary', 'Secondary Color')], default='white')), ('left_column', wagtail.wagtailcore.blocks.StreamBlock((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('google_map', wagtail.wagtailcore.blocks.StructBlock((('map_width', wagtail.wagtailcore.blocks.CharBlock(default='600', max_length=4, required=True)), ('map_height', wagtail.wagtailcore.blocks.CharBlock(default='450', max_length=4, required=True)), ('map_params', wagtail.wagtailcore.blocks.CharBlock(help_text='No spaces, add + instead', max_length=300, required=True)))))), icon='arrow-left', label='Left column content')), ('right_column', wagtail.wagtailcore.blocks.StreamBlock((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('image', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('google_map', wagtail.wagtailcore.blocks.StructBlock((('map_width', wagtail.wagtailcore.blocks.CharBlock(default='600', max_length=4, required=True)), ('map_height', wagtail.wagtailcore.blocks.CharBlock(default='450', max_length=4, required=True)), ('map_params', wagtail.wagtailcore.blocks.CharBlock(help_text='No spaces, add + instead', max_length=300, required=True)))))), icon='arrow-right', label='Right column content')))))), default='')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.AddField(
model_name='formfield',
name='page',
field=modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='form_fields', to='homepage.FormPage'),
),
]
| 164.288591 | 3,602 | 0.655705 | 2,689 | 24,479 | 5.887691 | 0.114913 | 0.183047 | 0.228903 | 0.15216 | 0.838302 | 0.827375 | 0.815184 | 0.809626 | 0.802804 | 0.785687 | 0 | 0.041917 | 0.123861 | 24,479 | 148 | 3,603 | 165.398649 | 0.696275 | 0.002778 | 0 | 0.521429 | 1 | 0 | 0.228081 | 0.003114 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.05 | 0 | 0.078571 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 |
10e4c7246154fcee2d58d1b4e24e79e793c89430 | 191 | py | Python | loggingtestcase/__init__.py | chadrosenquist/logging-test-case | abad36fb3da3ccdb290d2b00defeadb9465d9891 | [
"MIT"
] | 4 | 2017-03-05T07:17:51.000Z | 2020-05-20T10:32:48.000Z | loggingtestcase/__init__.py | chadrosenquist/logging-test-case | abad36fb3da3ccdb290d2b00defeadb9465d9891 | [
"MIT"
] | 4 | 2018-04-16T03:14:42.000Z | 2018-12-02T22:16:00.000Z | loggingtestcase/__init__.py | chadrosenquist/logging-test-case | abad36fb3da3ccdb290d2b00defeadb9465d9891 | [
"MIT"
] | 2 | 2018-04-16T01:57:10.000Z | 2020-05-20T10:39:31.000Z | """Defines public APIs."""
from loggingtestcase.loggingtestcase import LoggingTestCase
from loggingtestcase.capturelogs import capturelogs
from loggingtestcase.capturelogs import DisplayLogs
| 38.2 | 59 | 0.86911 | 18 | 191 | 9.222222 | 0.444444 | 0.343373 | 0.361446 | 0.433735 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078534 | 191 | 4 | 60 | 47.75 | 0.943182 | 0.104712 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 7 |
1d3b12191470fa34b413a12f393d23cb9a04b610 | 36,974 | py | Python | azure-mgmt-resource/azure/mgmt/resource/locks/operations/management_locks_operations.py | HydAu/AzureSDKForPython | 5cbe34e9e0b8ea1faacc9f205633ccc0b885c0f3 | [
"Apache-2.0"
] | null | null | null | azure-mgmt-resource/azure/mgmt/resource/locks/operations/management_locks_operations.py | HydAu/AzureSDKForPython | 5cbe34e9e0b8ea1faacc9f205633ccc0b885c0f3 | [
"Apache-2.0"
] | null | null | null | azure-mgmt-resource/azure/mgmt/resource/locks/operations/management_locks_operations.py | HydAu/AzureSDKForPython | 5cbe34e9e0b8ea1faacc9f205633ccc0b885c0f3 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft and contributors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
import uuid
from .. import models
class ManagementLocksOperations(object):
"""ManagementLocksOperations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An objec model deserializer.
"""
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.config = config
def create_or_update_at_resource_group_level(
self, resource_group_name, lock_name, parameters, custom_headers=None, raw=False, **operation_config):
"""
Create or update a management lock at the resource group level.
:param resource_group_name: The resource group name.
:type resource_group_name: str
:param lock_name: The lock name.
:type lock_name: str
:param parameters: The management lock parameters.
:type parameters: :class:`ManagementLockObject
<azure.mgmt.resource.locks.models.ManagementLockObject>`
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: :class:`ManagementLockObject
<azure.mgmt.resource.locks.models.ManagementLockObject>`
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}'
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'lockName': self._serialize.url("lock_name", lock_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(parameters, 'ManagementLockObject')
# Construct and send request
request = self._client.put(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, **operation_config)
if response.status_code not in [200, 201]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ManagementLockObject', response)
if response.status_code == 201:
deserialized = self._deserialize('ManagementLockObject', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def create_or_update_at_resource_level(
self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers=None, raw=False, **operation_config):
"""
Create or update a management lock at the resource level or any level
below resource.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_provider_namespace: Resource identity.
:type resource_provider_namespace: str
:param parent_resource_path: Resource identity.
:type parent_resource_path: str
:param resource_type: Resource identity.
:type resource_type: str
:param resource_name: Resource identity.
:type resource_name: str
:param lock_name: The name of lock.
:type lock_name: str
:param parameters: Create or update management lock parameters.
:type parameters: :class:`ManagementLockObject
<azure.mgmt.resource.locks.models.ManagementLockObject>`
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: :class:`ManagementLockObject
<azure.mgmt.resource.locks.models.ManagementLockObject>`
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern='^[-\w\._]+$'),
'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'),
'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True),
'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True),
'resourceName': self._serialize.url("resource_name", resource_name, 'str'),
'lockName': self._serialize.url("lock_name", lock_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(parameters, 'ManagementLockObject')
# Construct and send request
request = self._client.put(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, **operation_config)
if response.status_code not in [200, 201]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ManagementLockObject', response)
if response.status_code == 201:
deserialized = self._deserialize('ManagementLockObject', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def delete_at_resource_level(
self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers=None, raw=False, **operation_config):
"""
Deletes the management lock of a resource or any level below resource.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_provider_namespace: Resource identity.
:type resource_provider_namespace: str
:param parent_resource_path: Resource identity.
:type parent_resource_path: str
:param resource_type: Resource identity.
:type resource_type: str
:param resource_name: Resource identity.
:type resource_name: str
:param lock_name: The name of lock.
:type lock_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: None
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'),
'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True),
'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True),
'resourceName': self._serialize.url("resource_name", resource_name, 'str'),
'lockName': self._serialize.url("lock_name", lock_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.delete(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [204, 200, 202]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
def create_or_update_at_subscription_level(
self, lock_name, parameters, custom_headers=None, raw=False, **operation_config):
"""
Create or update a management lock at the subscription level.
:param lock_name: The name of lock.
:type lock_name: str
:param parameters: The management lock parameters.
:type parameters: :class:`ManagementLockObject
<azure.mgmt.resource.locks.models.ManagementLockObject>`
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: :class:`ManagementLockObject
<azure.mgmt.resource.locks.models.ManagementLockObject>`
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
path_format_arguments = {
'lockName': self._serialize.url("lock_name", lock_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(parameters, 'ManagementLockObject')
# Construct and send request
request = self._client.put(url, query_parameters)
response = self._client.send(
request, header_parameters, body_content, **operation_config)
if response.status_code not in [201, 200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 201:
deserialized = self._deserialize('ManagementLockObject', response)
if response.status_code == 200:
deserialized = self._deserialize('ManagementLockObject', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def delete_at_subscription_level(
self, lock_name, custom_headers=None, raw=False, **operation_config):
"""
Deletes the management lock of a subscription.
:param lock_name: The name of lock.
:type lock_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: None
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
path_format_arguments = {
'lockName': self._serialize.url("lock_name", lock_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.delete(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [204, 200, 202]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
def get(
self, lock_name, custom_headers=None, raw=False, **operation_config):
"""
Gets the management lock of a scope.
:param lock_name: Name of the management lock.
:type lock_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: :class:`ManagementLockObject
<azure.mgmt.resource.locks.models.ManagementLockObject>`
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'
path_format_arguments = {
'lockName': self._serialize.url("lock_name", lock_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [200, 204]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ManagementLockObject', response)
if response.status_code == 204:
deserialized = self._deserialize('ManagementLockObject', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def delete_at_resource_group_level(
self, resource_group, lock_name, custom_headers=None, raw=False, **operation_config):
"""
Deletes the management lock of a resource group.
:param resource_group: The resource group names.
:type resource_group: str
:param lock_name: The name of lock.
:type lock_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: None
:rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
if raw=true
"""
# Construct URL
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Authorization/locks/{lockName}'
path_format_arguments = {
'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'),
'lockName': self._serialize.url("lock_name", lock_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.delete(url, query_parameters)
response = self._client.send(request, header_parameters, **operation_config)
if response.status_code not in [204, 200, 202]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
def list_at_resource_group_level(
self, resource_group_name, filter=None, custom_headers=None, raw=False, **operation_config):
"""
Gets all the management locks of a resource group.
:param resource_group_name: Resource group name.
:type resource_group_name: str
:param filter: The filter to apply on the operation.
:type filter: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: :class:`ManagementLockObjectPaged
<azure.mgmt.resource.locks.models.ManagementLockObjectPaged>`
"""
def internal_paging(next_link=None, raw=False):
if not next_link:
# Construct URL
url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks'
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')
query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
else:
url = next_link
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(
request, header_parameters, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
return response
# Deserialize response
deserialized = models.ManagementLockObjectPaged(internal_paging, self._deserialize.dependencies)
if raw:
header_dict = {}
client_raw_response = models.ManagementLockObjectPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response
return deserialized
def list_at_resource_level(
self, resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter=None, custom_headers=None, raw=False, **operation_config):
"""
Gets all the management locks of a resource or any level below
resource.
:param resource_group_name: The name of the resource group. The name
is case insensitive.
:type resource_group_name: str
:param resource_provider_namespace: Resource identity.
:type resource_provider_namespace: str
:param parent_resource_path: Resource identity.
:type parent_resource_path: str
:param resource_type: Resource identity.
:type resource_type: str
:param resource_name: Resource identity.
:type resource_name: str
:param filter: The filter to apply on the operation.
:type filter: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: :class:`ManagementLockObjectPaged
<azure.mgmt.resource.locks.models.ManagementLockObjectPaged>`
"""
def internal_paging(next_link=None, raw=False):
if not next_link:
# Construct URL
url = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks'
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern='^[-\w\._]+$'),
'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str'),
'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True),
'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True),
'resourceName': self._serialize.url("resource_name", resource_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')
query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
else:
url = next_link
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(
request, header_parameters, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
return response
# Deserialize response
deserialized = models.ManagementLockObjectPaged(internal_paging, self._deserialize.dependencies)
if raw:
header_dict = {}
client_raw_response = models.ManagementLockObjectPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response
return deserialized
def list_next(
self, next_link, custom_headers=None, raw=False, **operation_config):
"""
Get a list of management locks at resource level or below.
:param next_link: NextLink from the previous successful call to List
operation.
:type next_link: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: :class:`ManagementLockObjectPaged
<azure.mgmt.resource.locks.models.ManagementLockObjectPaged>`
"""
def internal_paging(next_link=None, raw=False):
if not next_link:
# Construct URL
url = '/{nextLink}'
path_format_arguments = {
'nextLink': self._serialize.url("next_link", next_link, 'str', skip_quote=True),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
else:
url = next_link
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(
request, header_parameters, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
return response
# Deserialize response
deserialized = models.ManagementLockObjectPaged(internal_paging, self._deserialize.dependencies)
if raw:
header_dict = {}
client_raw_response = models.ManagementLockObjectPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response
return deserialized
def list_at_subscription_level(
self, filter=None, custom_headers=None, raw=False, **operation_config):
"""
Gets all the management locks of a subscription.
:param filter: The filter to apply on the operation.
:type filter: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:rtype: :class:`ManagementLockObjectPaged
<azure.mgmt.resource.locks.models.ManagementLockObjectPaged>`
"""
def internal_paging(next_link=None, raw=False):
if not next_link:
# Construct URL
url = '/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks'
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
if filter is not None:
query_parameters['$filter'] = self._serialize.query("filter", filter, 'str')
query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')
else:
url = next_link
query_parameters = {}
# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters)
response = self._client.send(
request, header_parameters, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
return response
# Deserialize response
deserialized = models.ManagementLockObjectPaged(internal_paging, self._deserialize.dependencies)
if raw:
header_dict = {}
client_raw_response = models.ManagementLockObjectPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response
return deserialized
| 46.98094 | 222 | 0.658571 | 3,896 | 36,974 | 6.042351 | 0.056725 | 0.036957 | 0.025148 | 0.033643 | 0.935007 | 0.931269 | 0.927616 | 0.922008 | 0.916019 | 0.911091 | 0 | 0.004086 | 0.245497 | 36,974 | 786 | 223 | 47.040712 | 0.839768 | 0.259723 | 0 | 0.869018 | 0 | 0.007557 | 0.179852 | 0.096392 | 0 | 0 | 0 | 0 | 0 | 1 | 0.040302 | false | 0 | 0.010076 | 0 | 0.110831 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
1d4fa4ffcf7f644711f81e5f45978bf259e18ea0 | 4,146 | py | Python | testing.py | tatiblockchain/skolo-pythonTwitter | 5d98896efa8df65e6f0c5754375ec08a747cdfea | [
"Apache-2.0"
] | 2 | 2020-05-23T12:24:14.000Z | 2021-10-06T21:35:29.000Z | testing.py | tatiblockchain/skolo-pythonTwitter | 5d98896efa8df65e6f0c5754375ec08a747cdfea | [
"Apache-2.0"
] | null | null | null | testing.py | tatiblockchain/skolo-pythonTwitter | 5d98896efa8df65e6f0c5754375ec08a747cdfea | [
"Apache-2.0"
] | null | null | null | import config
import tweepy
import random
import time
num = 1 + 1
def randomStringPost():
access_token = "enter your access token here"
access_secret = "enter your access secret here"
api_key = "enter your api key here"
api_secret = "enter your api secret here"
auth = tweepy.OAuthHandler(config.api_key, config.api_secret)
auth.set_access_token(config.access_token, config.access_secret)
api = tweepy.API(auth)
st1 = "This is the day you get your amaxing nail set - shop now"
st2 = "find us at https://thetatistore.com today"
st3 = "Stay at home and Do your own nails - woop woop"
st4 = "Lockdown discount available in store >>> https://thetatistore.com"
st5 = "There is no better time than the present to start shopping for a bargain"
st6 = "The leading nail suppliers this side of the world - come visit us soon"
hashtags = ["#OnlineShopping", "#COVIDSale", "#SouthAfrica", "#SALE", "#salesalesale", "#Bargain", "#nails", "#nailsalon", "#polygel", "#NailsOfInstagram", "#polygelnails"]
tweet_strings = [st1, st2, st3, st4, st5, st6]
random_string = random.choice(tweet_strings)
selected_tweet = random_string + " " + random.choice(hashtags) + " " + random.choice(hashtags) + " " + random.choice(hashtags) + " "+ random.choice(hashtags)
if (len(selected_tweet) > 140):
time.sleep(1)
pass
else:
api.update_status(selected_tweet)
print("SUCCESS --- good to go")
def randomImagePost():
access_token = "enter your access token here"
access_secret = "enter your access secret here"
api_key = "enter your api key here"
api_secret = "enter your api secret here"
auth = tweepy.OAuthHandler(config.api_key, config.api_secret)
auth.set_access_token(config.access_token, config.access_secret)
api = tweepy.API(auth)
image1 = "day1Other.jpg"
image2 = "day2Other.jpg"
image3 = "day3Other.jpg"
image4 = "day4Other.jpg"
image5 = "day7Other.jpg"
image6 = "day8Other.jpg"
image7 = "day9Other.jpg"
image8 = "day10Other.jpg"
images = [image1, image2, image3, image4, image5, image6, image7]
selected_image = random.choice(images)
api.update_with_media(selected_image)
print("Image posted succesfully")
def randomTextRandomImage():
access_token = "enter your access token here"
access_secret = "enter your access secret here"
api_key = "enter your api key here"
api_secret = "enter your api secret here"
auth = tweepy.OAuthHandler(config.api_key, config.api_secret)
auth.set_access_token(config.access_token, config.access_secret)
api = tweepy.API(auth)
image1 = "day1Other.jpg"
image2 = "day2Other.jpg"
image3 = "day3Other.jpg"
image4 = "day4Other.jpg"
image5 = "day7Other.jpg"
image6 = "day8Other.jpg"
image7 = "day9Other.jpg"
image8 = "day10Other.jpg"
images = [image1, image2, image3, image4, image5, image6, image7]
selected_image = random.choice(images)
st1 = "This is the day you get your amaxing nail set - shop now"
st2 = "find us at https://thetatistore.com today"
st3 = "Stay at home and Do your own nails - woop woop"
st4 = "Lockdown discount available in store >>> https://thetatistore.com"
st5 = "There is no better time than the present to start shopping for a bargain"
st6 = "The leading nail suppliers this side of the world - come visit us soon"
hashtags = ["#OnlineShopping", "#COVIDSale", "#SouthAfrica", "#SALE", "#salesalesale", "#Bargain", "#nails", "#nailsalon", "#polygel", "#NailsOfInstagram", "#polygelnails"]
tweet_strings = [st1, st2, st3, st4, st5, st6]
random_string = random.choice(tweet_strings)
selected_tweet = random_string + " " + random.choice(hashtags) + " " + random.choice(hashtags) + " " + random.choice(hashtags) + " "+ random.choice(hashtags)
if (len(selected_tweet) > 140):
time.sleep(1)
pass
else:
api.update_with_media(selected_image, selected_tweet)
print("{} with Image posted Succesfull".format(selected_tweet))
print("SUCCESS --- good to go")
| 36.690265 | 176 | 0.678003 | 529 | 4,146 | 5.21172 | 0.241966 | 0.047878 | 0.058034 | 0.050054 | 0.929634 | 0.929634 | 0.91041 | 0.886471 | 0.886471 | 0.886471 | 0 | 0.024894 | 0.205499 | 4,146 | 112 | 177 | 37.017857 | 0.812083 | 0 | 0 | 0.845238 | 0 | 0 | 0.378437 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.035714 | false | 0.02381 | 0.047619 | 0 | 0.083333 | 0.047619 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
1d9145725d3048cc6391f9e58b0b93a5ec98ed23 | 17,891 | py | Python | lipydomics/identification/id_levels.py | dylanhross/lipydomics | c7c3b72d4549a1a9937f287f3b314eff8e7ed054 | [
"MIT"
] | 3 | 2020-10-30T02:49:08.000Z | 2021-03-30T22:51:45.000Z | lipydomics/identification/id_levels.py | dylanhross/lipydomics | c7c3b72d4549a1a9937f287f3b314eff8e7ed054 | [
"MIT"
] | 49 | 2019-09-27T19:17:50.000Z | 2021-04-12T16:44:29.000Z | lipydomics/identification/id_levels.py | dylanhross/lipydomics | c7c3b72d4549a1a9937f287f3b314eff8e7ed054 | [
"MIT"
] | 2 | 2021-06-22T16:35:50.000Z | 2022-02-15T19:31:10.000Z | """
lipydomics/identification/id_levels.py
Dylan H. Ross
2020/03/31
description:
definitions for individual ID functions at various confidence levels
"""
from lipydomics.util import get_score
def id_feat_pred_mz(cursor, mz, rt, ccs, tol_mz, tol_rt, tol_ccs, esi_mode, norm=None):
"""
id_feat_pred_mz
description:
identifies a feature on the basis of predicted m/z
parameters:
cursor (sqlite3.Cursor) -- cursor for querying lipids.db
mz (float) -- m/z to match
rt (float) -- retention time to match
ccs (float) -- CCS to match
tol_mz (float) -- tolerance for m/z
tol_rt (float) -- tolerance for retention time
tol_ccs (float) -- tolerance for CCS
esi_mode (str) -- filter results by ionization mode: 'neg', 'pos', or None for unspecified
[norm (None)] -- NOT USED just included to maintain the same interface as the other id functions
returns:
(str or list(str)), (str) -- putative identification(s) (or '' for no matches), identification level
"""
qry = 'SELECT name, adduct, mz FROM predicted_mz WHERE mz BETWEEN ? AND ?'
if esi_mode == 'pos':
qry += ' AND adduct LIKE "%+"'
elif esi_mode == 'neg':
qry += ' AND adduct LIKE "%-"'
mz_min = mz - tol_mz
mz_max = mz + tol_mz
putative_ids, putative_scores = [], []
for name, adduct, mz_x in cursor.execute(qry, (mz_min, mz_max)).fetchall():
putative_ids.append('{}_{}'.format(name, adduct))
putative_scores.append(get_score(tol_mz, tol_rt, tol_ccs, mz_q=mz, mz_x=mz_x))
if putative_ids:
return putative_ids, 'pred_mz', putative_scores
else:
return '', '', []
def id_feat_meas_mz(cursor, mz, rt, ccs, tol_mz, tol_rt, tol_ccs, esi_mode, norm=None):
"""
id_feat_meas_mz
description:
identifies a feature on the basis of measured m/z
parameters:
cursor (sqlite3.Cursor) -- cursor for querying lipids.db
mz (float) -- m/z to match
rt (float) -- retention time to match
ccs (float) -- CCS to match
tol_mz (float) -- tolerance for m/z
tol_rt (float) -- tolerance for retention time
tol_ccs (float) -- tolerance for CCS
esi_mode (str) -- filter results by ionization mode: 'neg', 'pos', or None for unspecified
[norm (None)] -- NOT USED just included to maintain the same interface as the other id functions
returns:
(str or list(str)), (str) -- putative identification(s) (or '' for no matches), identification level
"""
qry = 'SELECT name, adduct, mz FROM measured WHERE mz BETWEEN ? AND ?'
if esi_mode == 'pos':
qry += ' AND adduct LIKE "%+"'
elif esi_mode == 'neg':
qry += ' AND adduct LIKE "%-"'
mz_min = mz - tol_mz
mz_max = mz + tol_mz
putative_ids, putative_scores = [], []
for name, adduct, mz_x in cursor.execute(qry, (mz_min, mz_max)).fetchall():
putative_ids.append('{}_{}'.format(name, adduct))
putative_scores.append(get_score(tol_mz, tol_rt, tol_ccs, mz_q=mz, mz_x=mz_x))
if putative_ids:
return putative_ids, 'pred_mz', putative_scores
else:
return '', '', []
def id_feat_pred_mz_rt(cursor, mz, rt, ccs, tol_mz, tol_rt, tol_ccs, esi_mode, norm='l2'):
"""
id_feat_pred_mz_rt
description:
identifies a feature on the basis of predicted m/z and retention time
parameters:
cursor (sqlite3.Cursor) -- cursor for querying lipids.db
mz (float) -- m/z to match
rt (float) -- retention time to match
ccs (float) -- CCS to match
tol_mz (float) -- tolerance for m/z
tol_rt (float) -- tolerance for retention time
tol_ccs (float) -- tolerance for CCS
esi_mode (str) -- filter results by ionization mode: 'neg', 'pos', or None for unspecified
[norm (str)] -- specify l1 or l2 norm for computing scores [optional, default='l2']
returns:
(str or list(str)), (str) -- putative identification(s) (or '' for no matches), identification level
"""
qry = 'SELECT name, adduct, mz, rt FROM predicted_mz JOIN predicted_rt ON ' \
+ 'predicted_mz.t_id=predicted_rt.t_id WHERE mz BETWEEN ? AND ? AND rt BETWEEN ? and ?'
if esi_mode == 'pos':
qry += ' AND adduct LIKE "%+"'
elif esi_mode == 'neg':
qry += ' AND adduct LIKE "%-"'
mz_min = mz - tol_mz
mz_max = mz + tol_mz
rt_min = rt - tol_rt
rt_max = rt + tol_rt
putative_ids, putative_scores = [], []
for name, adduct, mz_x, rt_x in cursor.execute(qry, (mz_min, mz_max, rt_min, rt_max)).fetchall():
putative_ids.append('{}_{}'.format(name, adduct))
putative_scores.append(get_score(tol_mz, tol_rt, tol_ccs, mz_q=mz, rt_q=rt, mz_x=mz_x, rt_x=rt_x))
if putative_ids:
return putative_ids, 'pred_mz_rt', putative_scores
else:
return '', '', []
def id_feat_pred_mz_ccs(cursor, mz, rt, ccs, tol_mz, tol_rt, tol_ccs, esi_mode, norm='l2'):
"""
id_feat_pred_mz_ccs
description:
identifies a feature on the basis of predicted m/z and CCS
parameters:
cursor (sqlite3.Cursor) -- cursor for querying lipids.db
mz (float) -- m/z to match
rt (float) -- retention time to match
ccs (float) -- CCS to match
tol_mz (float) -- tolerance for m/z
tol_rt (float) -- tolerance for retention time
tol_ccs (float) -- tolerance for CCS
esi_mode (str) -- filter results by ionization mode: 'neg', 'pos', or None for unspecified
[norm (str)] -- specify l1 or l2 norm for computing scores [optional, default='l2']
returns:
(str or list(str)), (str) -- putative identification(s) (or '' for no matches), identification level
"""
qry = 'SELECT name, adduct, mz, ccs FROM predicted_mz JOIN predicted_ccs ON ' \
+ 'predicted_mz.t_id=predicted_ccs.t_id WHERE mz BETWEEN ? AND ? AND ccs BETWEEN ? and ?'
if esi_mode == 'pos':
qry += ' AND adduct LIKE "%+"'
elif esi_mode == 'neg':
qry += ' AND adduct LIKE "%-"'
mz_min = mz - tol_mz
mz_max = mz + tol_mz
ccs_min = ccs - tol_ccs
ccs_max = ccs + tol_ccs
putative_ids, putative_scores = [], []
for name, adduct, mz_x, ccs_x in cursor.execute(qry, (mz_min, mz_max, ccs_min, ccs_max)).fetchall():
putative_ids.append('{}_{}'.format(name, adduct))
putative_scores.append(get_score(tol_mz, tol_rt, tol_ccs, mz_q=mz, ccs_q=ccs, mz_x=mz_x, ccs_x=ccs_x))
if putative_ids:
return putative_ids, 'pred_mz_ccs', putative_scores
else:
return '', '', []
def id_feat_pred_mz_rt_ccs(cursor, mz, rt, ccs, tol_mz, tol_rt, tol_ccs, esi_mode, norm='l2'):
"""
id_feat_pred_mz_rt_ccs
description:
identifies a feature on the basis of predicted m/z, retention time, and CCS
parameters:
cursor (sqlite3.Cursor) -- cursor for querying lipids.db
mz (float) -- m/z to match
rt (float) -- retention time to match
ccs (float) -- CCS to match
tol_mz (float) -- tolerance for m/z
tol_rt (float) -- tolerance for retention time
tol_ccs (float) -- tolerance for CCS
esi_mode (str) -- filter results by ionization mode: 'neg', 'pos', or None for unspecified
[norm (str)] -- specify l1 or l2 norm for computing scores [optional, default='l2']
returns:
(str or list(str)), (str) -- putative identification(s) (or '' for no matches), identification level
"""
qry = 'SELECT name, adduct, mz, rt, ccs FROM predicted_mz JOIN predicted_ccs ON ' \
+ 'predicted_mz.t_id=predicted_ccs.t_id JOIN predicted_rt ON ' \
+ 'predicted_mz.t_id=predicted_rt.t_id WHERE mz BETWEEN ? AND ? AND ccs BETWEEN ? AND ? AND ' \
+ 'rt BETWEEN ? AND ?'
if esi_mode == 'pos':
qry += ' AND adduct LIKE "%+"'
elif esi_mode == 'neg':
qry += ' AND adduct LIKE "%-"'
mz_min = mz - tol_mz
mz_max = mz + tol_mz
ccs_min = ccs - tol_ccs
ccs_max = ccs + tol_ccs
rt_min = rt - tol_rt
rt_max = rt + tol_rt
putative_ids, putative_scores = [], []
qdata = (mz_min, mz_max, ccs_min, ccs_max, rt_min, rt_max)
for name, adduct, mz_x, rt_x, ccs_x in cursor.execute(qry, qdata).fetchall():
putative_ids.append('{}_{}'.format(name, adduct))
putative_scores.append(get_score(tol_mz, tol_rt, tol_ccs,
mz_q=mz, rt_q=rt, ccs_q=ccs,
mz_x=mz_x, rt_x=rt_x, ccs_x=ccs_x))
if putative_ids:
return putative_ids, 'pred_mz_rt_ccs', putative_scores
else:
return '', '', []
def id_feat_meas_mz_ccs(cursor, mz, rt, ccs, tol_mz, tol_rt, tol_ccs, esi_mode, norm='l2'):
"""
id_feat_pred_meas_mz_ccs
description:
identifies a feature by matching a reference value on m/z, and CCS within tolerances
parameters:
cursor (sqlite3.Cursor) -- cursor for querying lipids.db
mz (float) -- m/z to match
rt (float) -- retention time to match
ccs (float) -- CCS to match
tol_mz (float) -- tolerance for m/z
tol_rt (float) -- tolerance for retention time
tol_ccs (float) -- tolerance for CCS
esi_mode (str) -- filter results by ionization mode: 'neg', 'pos', or None for unspecified
[norm (str)] -- specify l1 or l2 norm for computing scores [optional, default='l2']
returns:
(str or list(str)), (str) -- putative identification(s) (or '' for no matches), identification level
"""
qry = 'SELECT name, adduct, mz, ccs FROM measured WHERE mz BETWEEN ? AND ? AND ccs BETWEEN ? and ?'
if esi_mode == 'pos':
qry += ' AND adduct LIKE "%+"'
elif esi_mode == 'neg':
qry += ' AND adduct LIKE "%-"'
mz_min = mz - tol_mz
mz_max = mz + tol_mz
ccs_min = ccs - tol_ccs
ccs_max = ccs + tol_ccs
putative_ids, putative_scores = [], []
qdata = (mz_min, mz_max, ccs_min, ccs_max)
for name, adduct, mz_x, ccs_x in cursor.execute(qry, qdata).fetchall():
putative_ids.append('{}_{}'.format(name, adduct))
putative_scores.append(get_score(tol_mz, tol_rt, tol_ccs, mz_q=mz, ccs_q=ccs, mz_x=mz_x, ccs_x=ccs_x))
if putative_ids:
return putative_ids, 'meas_mz_ccs', putative_scores
else:
return '', '', []
def id_feat_meas_mz_rt(cursor, mz, rt, ccs, tol_mz, tol_rt, tol_ccs, esi_mode, norm='l2'):
"""
id_feat_meas_mz_rt
description:
identifies a feature on the basis of measured m/z and retention time
parameters:
cursor (sqlite3.Cursor) -- cursor for querying lipids.db
mz (float) -- m/z to match
rt (float) -- retention time to match
ccs (float) -- CCS to match
tol_mz (float) -- tolerance for m/z
tol_rt (float) -- tolerance for retention time
tol_ccs (float) -- tolerance for CCS
esi_mode (str) -- filter results by ionization mode: 'neg', 'pos', or None for unspecified
[norm (str)] -- specify l1 or l2 norm for computing scores [optional, default='l2']
returns:
(str or list(str)), (str) -- putative identification(s) (or '' for no matches), identification level
"""
qry = 'SELECT name, adduct, mz, rt FROM measured WHERE mz BETWEEN ? AND ? AND rt BETWEEN ? and ?'
if esi_mode == 'pos':
qry += ' AND adduct LIKE "%+"'
elif esi_mode == 'neg':
qry += ' AND adduct LIKE "%-"'
mz_min = mz - tol_mz
mz_max = mz + tol_mz
rt_min = rt - tol_rt
rt_max = rt + tol_rt
putative_ids, putative_scores = [], []
for name, adduct, mz_x, rt_x in cursor.execute(qry, (mz_min, mz_max, rt_min, rt_max)).fetchall():
putative_ids.append('{}_{}'.format(name, adduct))
putative_scores.append(get_score(tol_mz, tol_rt, tol_ccs, mz_q=mz, rt_q=rt, mz_x=mz_x, rt_x=rt_x))
if putative_ids:
return putative_ids, 'pred_mz_rt', putative_scores
else:
return '', '', []
def id_feat_meas_mz_rt_ccs(cursor, mz, rt, ccs, tol_mz, tol_rt, tol_ccs, esi_mode, norm='l2'):
"""
id_feat_pred_meas_mz_rt_ccs
description:
identifies a feature by matching a reference value on m/z, rt, and CCS within tolerances
parameters:
cursor (sqlite3.Cursor) -- cursor for querying lipids.db
mz (float) -- m/z to match
rt (float) -- retention time to match
ccs (float) -- CCS to match
tol_mz (float) -- tolerance for m/z
tol_rt (float) -- tolerance for retention time
tol_ccs (float) -- tolerance for CCS
esi_mode (str) -- filter results by ionization mode: 'neg', 'pos', or None for unspecified
[norm (str)] -- specify l1 or l2 norm for computing scores [optional, default='l2']
returns:
(str or list(str)), (str) -- putative identification(s) (or '' for no matches), identification level
"""
qry = 'SELECT name, adduct, mz, rt, ccs FROM measured WHERE ' + \
'mz BETWEEN ? AND ? AND rt BETWEEN ? and ? AND ccs BETWEEN ? and ?'
if esi_mode == 'pos':
qry += ' AND adduct LIKE "%+"'
elif esi_mode == 'neg':
qry += ' AND adduct LIKE "%-"'
mz_min = mz - tol_mz
mz_max = mz + tol_mz
rt_min = rt - tol_rt
rt_max = rt + tol_rt
ccs_min = ccs - tol_ccs
ccs_max = ccs + tol_ccs
putative_ids, putative_scores = [], []
qdata = (mz_min, mz_max, rt_min, rt_max, ccs_min, ccs_max)
for name, adduct, mz_x, rt_x, ccs_x in cursor.execute(qry, qdata).fetchall():
putative_ids.append('{}_{}'.format(name, adduct))
putative_scores.append(get_score(tol_mz, tol_rt, tol_ccs,
mz_q=mz, rt_q=rt, ccs_q=ccs,
mz_x=mz_x, rt_x=rt_x, ccs_x=ccs_x))
if putative_ids:
return putative_ids, 'meas_mz_rt_ccs', putative_scores
else:
return '', '', []
def id_feat_any(cursor, mz, rt, ccs, tol_mz, tol_rt, tol_ccs, esi_mode, norm='l2', use_rt=True):
"""
id_feat_any
description:
Goes through all defined levels of identification, starting with the highest level, then tries lower levels
until an identification or identifications are made
parameters:
cursor (sqlite3.Cursor) -- cursor for querying lipids.db
mz (float) -- m/z to match
rt (float) -- retention time to match
ccs (float) -- CCS to match
tol_mz (float) -- tolerance for m/z
tol_rt (float) -- tolerance for retention time
tol_ccs (float) -- tolerance for CCS
esi_mode (str) -- filter results by ionization mode: 'neg', 'pos', or None for unspecified
[norm (str)] -- specify l1 or l2 norm for computing scores [optional, default='l2']
[use_rt (bool)] -- whether to use identification levels that involve retention time [optional, default=True]
returns:
(str or list(str)), (str) -- putative identification(s) (or '' for no matches), identification level
"""
if use_rt:
id_funcs = [
id_feat_meas_mz_rt_ccs,
id_feat_pred_mz_rt_ccs,
id_feat_meas_mz_rt,
id_feat_pred_mz_rt,
id_feat_meas_mz_ccs,
id_feat_pred_mz_ccs,
id_feat_meas_mz,
id_feat_pred_mz
]
else:
id_funcs = [
id_feat_meas_mz_ccs,
id_feat_pred_mz_ccs,
id_feat_meas_mz,
id_feat_pred_mz
]
for f in id_funcs:
fid, lvl, scr = f(cursor, mz, rt, ccs, tol_mz, tol_rt, tol_ccs, esi_mode, norm=norm)
if fid:
return fid, lvl, scr
return '', '', []
def id_feat_custom(levels, cursor, mz, rt, ccs, tol_mz, tol_rt, tol_ccs, esi_mode, norm='l2'):
"""
id_feat_custom
description:
Goes through identification levels specified in a custom list and attempts to identify lipid feature. The
identification levels are attempted in the order that they are provided until an identification is made.
parameters:
levels (list(str)) -- list of identification levels to try, will be attempted in the order they are provided
cursor (sqlite3.Cursor) -- cursor for querying lipids.db
mz (float) -- m/z to match
rt (float) -- retention time to match
ccs (float) -- CCS to match
tol_mz (float) -- tolerance for m/z
tol_rt (float) -- tolerance for retention time
tol_ccs (float) -- tolerance for CCS
esi_mode (str) -- filter results by ionization mode: 'neg', 'pos', or None for unspecified
[norm (str)] -- specify l1 or l2 norm for computing scores [optional, default='l2']
returns:
(str or list(str)), (str) -- putative identification(s) (or '' for no matches), identification level
"""
level_to_id_func = {
'meas_mz_rt_ccs': id_feat_meas_mz_rt_ccs,
'pred_mz_rt_ccs': id_feat_pred_mz_rt_ccs,
'meas_mz_rt': id_feat_meas_mz_rt,
'pred_mz_rt': id_feat_pred_mz_rt,
'meas_mz_ccs': id_feat_meas_mz_ccs,
'pred_mz_ccs': id_feat_pred_mz_ccs,
'meas_mz': id_feat_meas_mz,
'pred_mz': id_feat_pred_mz
}
# check that the identification levels are defined
for lvl in levels:
if lvl == 'any':
m = 'id_feat_custom: the special "any" ID level is invalid in a custom ID level list'
raise ValueError(m)
elif lvl not in level_to_id_func:
m = 'id_feat_custom: identification level "{}" is not defined'
raise ValueError(m.format(lvl))
id_funcs = [level_to_id_func[lvl] for lvl in levels]
for f in id_funcs:
fid, lvl, scr = f(cursor, mz, rt, ccs, tol_mz, tol_rt, tol_ccs, esi_mode, norm=norm)
if fid:
return fid, lvl, scr
return '', '', []
| 40.753986 | 116 | 0.621039 | 2,641 | 17,891 | 3.98334 | 0.063234 | 0.017871 | 0.048479 | 0.019011 | 0.898479 | 0.891825 | 0.884601 | 0.879468 | 0.873859 | 0.86692 | 0 | 0.003807 | 0.265832 | 17,891 | 438 | 117 | 40.847032 | 0.797107 | 0.468895 | 0 | 0.713592 | 0 | 0.009709 | 0.182263 | 0.0151 | 0 | 0 | 0 | 0 | 0 | 1 | 0.048544 | false | 0 | 0.004854 | 0 | 0.150485 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
d55441aa569d5f428396129048f288a21e392935 | 9,804 | py | Python | tests/browser/test_browser.py | mikiec84/wagtail-tag-manager | 27b565d3e07ea70a94dff2e246d0b170baa769ea | [
"BSD-3-Clause"
] | null | null | null | tests/browser/test_browser.py | mikiec84/wagtail-tag-manager | 27b565d3e07ea70a94dff2e246d0b170baa769ea | [
"BSD-3-Clause"
] | 2 | 2021-03-11T00:52:34.000Z | 2021-05-11T19:35:30.000Z | tests/browser/test_browser.py | mikiec84/wagtail-tag-manager | 27b565d3e07ea70a94dff2e246d0b170baa769ea | [
"BSD-3-Clause"
] | null | null | null | import re
import time
import pytest
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from tests.factories.tag import (
tag_lazy_delayed,
tag_lazy_traceable,
tag_instant_delayed,
tag_lazy_analytical,
tag_lazy_functional,
tag_instant_traceable,
tag_instant_analytical,
tag_instant_functional,
)
from wagtail_tag_manager.utils import parse_consent_state
def get_messages_for_log(driver, amount, iterations=5):
time.sleep(iterations)
log = driver.get_log("browser")
while len(log) < amount and iterations > 0:
log = driver.get_log("browser")
iterations = iterations - 1
time.sleep(1)
messages = []
for item in log:
search = re.search(r"\"(.+)\"", item.get("message"))
if search:
messages.append(search.group(1))
assert len(messages) == amount
return messages
def get_consent_state(driver, iterations=5):
time.sleep(iterations)
while True and iterations > 0:
for cookie in driver.get_cookies():
if cookie.get("name") == "wtm":
return parse_consent_state(cookie.get("value", ""))
iterations = iterations - 1
time.sleep(1)
@pytest.mark.django_db
def test_default_functionality(driver, site, live_server):
tag_instant_analytical()
tag_instant_delayed()
tag_instant_functional()
tag_instant_traceable()
tag_lazy_analytical()
tag_lazy_delayed()
tag_lazy_functional()
tag_lazy_traceable()
driver.get(live_server.url)
try:
WebDriverWait(driver, 30).until(
EC.visibility_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
get_messages_for_log(driver, 4)
consent_state = get_consent_state(driver)
assert consent_state.get("functional") == "true"
assert consent_state.get("analytical") == "unset"
assert consent_state.get("delayed") == "true"
assert consent_state.get("traceable") == "false"
driver.refresh()
try:
WebDriverWait(driver, 30).until(
EC.visibility_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
get_messages_for_log(driver, 6)
consent_state = get_consent_state(driver)
assert consent_state.get("functional") == "true"
assert consent_state.get("analytical") == "unset"
assert consent_state.get("delayed") == "true"
assert consent_state.get("traceable") == "false"
checkbox = driver.find_element_by_id("id_traceable")
checkbox.click()
submit = driver.find_element_by_css_selector("input[type=submit]")
submit.click()
try:
WebDriverWait(driver, 30).until(
EC.visibility_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
get_messages_for_log(driver, 8)
consent_state = get_consent_state(driver)
assert consent_state.get("functional") == "true"
assert consent_state.get("analytical") == "true"
assert consent_state.get("delayed") == "true"
assert consent_state.get("traceable") == "true"
@pytest.mark.django_db
def test_functional_only(driver, site, live_server):
tag_instant_analytical()
tag_instant_delayed()
tag_instant_functional()
tag_instant_traceable()
tag_lazy_analytical()
tag_lazy_delayed()
tag_lazy_functional()
tag_lazy_traceable()
driver.get(live_server.url)
try:
WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
link = driver.find_element_by_css_selector("li.manage-link a")
link.click()
try:
WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
check_analytical = driver.find_element_by_css_selector(".container #id_analytical")
check_analytical.click()
check_delayed = driver.find_element_by_css_selector(".container #id_delayed")
check_delayed.click()
# check_traceable = driver.find_element_by_css_selector(".container #id_traceable")
# check_traceable.click()
submit = driver.find_element_by_css_selector(".container input[type=submit]")
submit.click()
try:
WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
consent_state = get_consent_state(driver)
assert consent_state.get("functional") == "true"
assert consent_state.get("analytical") == "false"
assert consent_state.get("delayed") == "false"
assert consent_state.get("traceable") == "false"
@pytest.mark.django_db
def test_analytical_only(driver, site, live_server):
tag_instant_analytical()
tag_instant_delayed()
tag_instant_functional()
tag_instant_traceable()
tag_lazy_analytical()
tag_lazy_delayed()
tag_lazy_functional()
tag_lazy_traceable()
driver.get(live_server.url)
try:
WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
link = driver.find_element_by_css_selector("li.manage-link a")
link.click()
try:
WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
# check_analytical = driver.find_element_by_css_selector(".container #id_analytical")
# check_analytical.click()
check_delayed = driver.find_element_by_css_selector(".container #id_delayed")
check_delayed.click()
# check_traceable = driver.find_element_by_css_selector(".container #id_traceable")
# check_traceable.click()
submit = driver.find_element_by_css_selector(".container input[type=submit]")
submit.click()
try:
WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
consent_state = get_consent_state(driver)
assert consent_state.get("functional") == "true"
assert consent_state.get("analytical") == "true"
assert consent_state.get("delayed") == "false"
assert consent_state.get("traceable") == "false"
@pytest.mark.django_db
def test_delayed_only(driver, site, live_server):
tag_instant_analytical()
tag_instant_delayed()
tag_instant_functional()
tag_instant_traceable()
tag_lazy_analytical()
tag_lazy_delayed()
tag_lazy_functional()
tag_lazy_traceable()
driver.get(live_server.url)
try:
WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
link = driver.find_element_by_css_selector("li.manage-link a")
link.click()
try:
WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
check_analytical = driver.find_element_by_css_selector(".container #id_analytical")
check_analytical.click()
# check_delayed = driver.find_element_by_css_selector(".container #id_delayed")
# check_delayed.click()
# check_traceable = driver.find_element_by_css_selector(".container #id_traceable")
# check_traceable.click()
submit = driver.find_element_by_css_selector(".container input[type=submit]")
submit.click()
try:
WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
consent_state = get_consent_state(driver)
assert consent_state.get("functional") == "true"
assert consent_state.get("analytical") == "false"
assert consent_state.get("delayed") == "true"
assert consent_state.get("traceable") == "false"
@pytest.mark.django_db
def test_traceable_only(driver, site, live_server):
tag_instant_analytical()
tag_instant_delayed()
tag_instant_functional()
tag_instant_traceable()
tag_lazy_analytical()
tag_lazy_delayed()
tag_lazy_functional()
tag_lazy_traceable()
driver.get(live_server.url)
try:
WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
link = driver.find_element_by_css_selector("li.manage-link a")
link.click()
try:
WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
check_analytical = driver.find_element_by_css_selector(".container #id_analytical")
check_analytical.click()
check_delayed = driver.find_element_by_css_selector(".container #id_delayed")
check_delayed.click()
check_traceable = driver.find_element_by_css_selector(".container #id_traceable")
check_traceable.click()
submit = driver.find_element_by_css_selector(".container input[type=submit]")
submit.click()
try:
WebDriverWait(driver, 30).until(
EC.presence_of_element_located((By.ID, "wtm_cookie_bar"))
)
except TimeoutException:
pass
consent_state = get_consent_state(driver)
assert consent_state.get("functional") == "true"
assert consent_state.get("analytical") == "false"
assert consent_state.get("delayed") == "false"
assert consent_state.get("traceable") == "true"
| 30.542056 | 89 | 0.690024 | 1,171 | 9,804 | 5.441503 | 0.092229 | 0.084746 | 0.082392 | 0.092279 | 0.883396 | 0.847144 | 0.828311 | 0.828311 | 0.821877 | 0.821877 | 0 | 0.005363 | 0.201142 | 9,804 | 320 | 90 | 30.6375 | 0.808223 | 0.053142 | 0 | 0.763566 | 0 | 0 | 0.107478 | 0 | 0 | 0 | 0 | 0 | 0.112403 | 1 | 0.027132 | false | 0.05814 | 0.034884 | 0 | 0.069767 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 8 |
637ed992453cee4a5112c6fea3a33389dac56250 | 142 | py | Python | tests/settings.py | voteflux/voting-alpha-mini-sc | 121016277d3d5cdec6e41f16f3dcd0bf3f8fca12 | [
"MIT"
] | 2 | 2020-06-15T01:47:58.000Z | 2020-06-16T12:16:26.000Z | tests/settings.py | voteflux/voting-alpha-mini-sc | 121016277d3d5cdec6e41f16f3dcd0bf3f8fca12 | [
"MIT"
] | null | null | null | tests/settings.py | voteflux/voting-alpha-mini-sc | 121016277d3d5cdec6e41f16f3dcd0bf3f8fca12 | [
"MIT"
] | 2 | 2020-06-15T10:24:34.000Z | 2020-11-12T11:28:07.000Z |
TENPOW18 = 10 ** 18
ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
ETH_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'
| 20.285714 | 59 | 0.838028 | 9 | 142 | 13 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | 0.098592 | 142 | 6 | 60 | 23.666667 | 0.539063 | 0 | 0 | 0 | 0 | 0 | 0.604317 | 0.604317 | 0 | 0 | 0.604317 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
9829ee4d644e20c0b41c10ff14c0e9cea9bda548 | 205 | py | Python | test/testPyGameProtocol.test.py | Shuo625/pwnie-island-hack | eef1c3f00fdae235df0f55b7ab103ad62f4e4dad | [
"MIT"
] | null | null | null | test/testPyGameProtocol.test.py | Shuo625/pwnie-island-hack | eef1c3f00fdae235df0f55b7ab103ad62f4e4dad | [
"MIT"
] | null | null | null | test/testPyGameProtocol.test.py | Shuo625/pwnie-island-hack | eef1c3f00fdae235df0f55b7ab103ad62f4e4dad | [
"MIT"
] | null | null | null | from src.minimap_extension.gameProtocol import GameProtocol
GameProtocol.call_remote_command('/hello', ['shuo'], remote_port=8081)
GameProtocol.call_remote_command('/hello', ['linah'], remote_port=8081)
| 34.166667 | 71 | 0.804878 | 25 | 205 | 6.32 | 0.56 | 0.202532 | 0.278481 | 0.367089 | 0.43038 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041451 | 0.058537 | 205 | 5 | 72 | 41 | 0.777202 | 0 | 0 | 0 | 0 | 0 | 0.102439 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 7 |
9889ef043aa306d92cd03a686441fc1c61d78ff3 | 287 | py | Python | src/IceRayPy/utility/material/transmission/__init__.py | dmilos/IceRay | 4e01f141363c0d126d3c700c1f5f892967e3d520 | [
"MIT-0"
] | 2 | 2020-09-04T12:27:15.000Z | 2022-01-17T14:49:40.000Z | src/IceRayPy/utility/material/transmission/__init__.py | dmilos/IceRay | 4e01f141363c0d126d3c700c1f5f892967e3d520 | [
"MIT-0"
] | null | null | null | src/IceRayPy/utility/material/transmission/__init__.py | dmilos/IceRay | 4e01f141363c0d126d3c700c1f5f892967e3d520 | [
"MIT-0"
] | 1 | 2020-09-04T12:27:52.000Z | 2020-09-04T12:27:52.000Z | print( '<' + __name__ + ' name=\'' + __file__ + '\'>' )
import IceRayPy.utility.material.transmission.blossom
import IceRayPy.utility.material.transmission.reflect
import IceRayPy.utility.material.transmission.refract
print( '</' + __name__ + ' name=\'' + __file__ + '>' ) | 41 | 58 | 0.675958 | 26 | 287 | 6.846154 | 0.423077 | 0.235955 | 0.353933 | 0.488764 | 0.691011 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15331 | 287 | 7 | 59 | 41 | 0.73251 | 0 | 0 | 0 | 0 | 0 | 0.177305 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.6 | 0 | 0.6 | 0.4 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 8 |
7f3aface5ecc8ddc4e4067fdb2950d08ab8cf16a | 424 | py | Python | rmrb/rmrb_play_ctrl/core/ad_service/ad_req_interface.py | fjfhccfkuk/h_s_x_r_m_r_b_python | 46fe249b1b71f1245296c8b2dbd6e7c29dadade4 | [
"Unlicense"
] | null | null | null | rmrb/rmrb_play_ctrl/core/ad_service/ad_req_interface.py | fjfhccfkuk/h_s_x_r_m_r_b_python | 46fe249b1b71f1245296c8b2dbd6e7c29dadade4 | [
"Unlicense"
] | null | null | null | rmrb/rmrb_play_ctrl/core/ad_service/ad_req_interface.py | fjfhccfkuk/h_s_x_r_m_r_b_python | 46fe249b1b71f1245296c8b2dbd6e7c29dadade4 | [
"Unlicense"
] | null | null | null | class AdReqInterface(object):
def load_picture(self):
raise Exception("this method should be override by subclass")
def load_video(self):
raise Exception("this method should be override by subclass")
def obtain_picture(self):
raise Exception("this method should be override by subclass")
def obtain_video(self):
raise Exception("this method should be override by subclass") | 35.333333 | 69 | 0.709906 | 55 | 424 | 5.4 | 0.327273 | 0.121212 | 0.242424 | 0.296296 | 0.878788 | 0.878788 | 0.878788 | 0.878788 | 0.878788 | 0.878788 | 0 | 0 | 0.216981 | 424 | 12 | 70 | 35.333333 | 0.894578 | 0 | 0 | 0.444444 | 0 | 0 | 0.395294 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.444444 | false | 0 | 0 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 |
7f4f4f135c3b658e5cdffa29b10ac8bf4394dbc6 | 10,151 | py | Python | train.py | zeroRains/PictureTranslation | 8a2eb0608b0f7d727c75055f7b7aa0068aab4669 | [
"MIT"
] | 3 | 2021-11-04T07:36:47.000Z | 2021-11-30T04:01:25.000Z | train.py | zeroRains/PictureTranslation | 8a2eb0608b0f7d727c75055f7b7aa0068aab4669 | [
"MIT"
] | null | null | null | train.py | zeroRains/PictureTranslation | 8a2eb0608b0f7d727c75055f7b7aa0068aab4669 | [
"MIT"
] | null | null | null | from transform_tools import *
import datetime
from darknet import *
from tqdm import tqdm
def begin(path1, path2):
starttime = datetime.datetime.now()
# 选择内容图片和风格图片
content_img, w_c, h_c = loading(path1)
content_img = Variable(content_img).cuda()
styple_img, w_s, h_s = loading(path2)
styple_img = Variable(styple_img).cuda()
# 导入特征提取网络
cnn = models.vgg16(pretrained=False)
pre = torch.load("./model/vgg16-397923af.pth")
cnn.load_state_dict(pre)
# 提取VGG16的features部分
cnn = cnn.features
cnn = cnn.cuda()
# 重新创建我们的模型
model = copy.deepcopy(cnn)
# 提取内容所需要的卷积层
content_layer = ["Conv_3"]
# 提取风格所需要的的卷积层
style_layer = ["Conv_1", "Conv_2", "Conv_3", "Conv_4"]
# 定义内容和风格的损失值,用于控制内容和风格对最后合成图的影响程度
content_weight = 1
style_weight = 1000
# 存储每一个内容层和风格层的计算图列表
content_losses = []
style_losses = []
# 创建一个空模型,用来存储我们的迁移模型
new_model = torch.nn.Sequential()
gram = Gram_matrix()
new_model = new_model.cuda()
gram = gram.cuda()
# 构建迁移模型
index = 1
# 从VGG16中提取出前8层来当做风格迁移的特征提取层
print("模型重构中")
for layer in tqdm(list(model)[:8]):
# 如果这一层是我们的Conv2d类型,就将它加入到我们的新模型中
# if isinstance(layer, BasicBlock):
if isinstance(layer, torch.nn.Conv2d):
name = "Conv_" + str(index)
new_model.add_module(name, layer)
# 根据选择的层数分配为风格提取和内容提取
if name in content_layer:
# 创建特征提取层,
# 将内容图输入到模型中进行计算,获得卷积得到的feature map
target = new_model(content_img).clone()
# 将控制内容图的权重与feature map 构建内容损失函数对象
content_loss = Content_loss(content_weight, target)
# 将这个对象添加到模型中
new_model.add_module("content_loss_" + str(index), content_loss)
# 记录损失函数计算过程
content_losses.append(content_loss)
if name in style_layer:
# 将内容图输入到模型中进行计算,获得卷积得到的feature map
target = new_model(styple_img).clone()
# 将这个feature map构建格拉姆矩阵
target = gram(target)
# 实例化风格损失函数
style_loss = Style_loss(style_weight, target)
# 讲风格损失函数对象添加到模型中
new_model.add_module("style_loss_" + str(index), style_loss)
# 记录损失函数计算过程
style_losses.append(style_loss)
if isinstance(layer, torch.nn.ReLU):
# 激活函数正常激活即可
name = "Relu_" + str(index)
new_model.add_module(name, layer)
index = index + 1
if isinstance(layer, torch.nn.MaxPool2d):
# 最大池化层也正常池化即可
name = "MaxPool_" + str(index)
new_model.add_module(name, layer)
# 获取输入图片,避免在卷积过程中对原图产生影响因此使用了clone
input_img = content_img.clone()
# 将一个不可训练的tensor类型转化成可训练的Parameter类型,从而使得在训练过程中对input_img进行风格修改
parameter = torch.nn.Parameter(input_img.data)
# LBFGS也是一种优化方法,他最大的优点就在于它能够写出一个closure函数,
# 在函数中记录多个损失函数的计算图,并返回
# 通过优化器,实现反向传播和参数更新
# 这里传入的就是训练的图像,由于风格迁移和大多数的深度神经网络训练不大一样
# 在风格迁移中,我们生成的图像是根据内容图结合风格图,对像素进行优化的
# 而大部分的深度神经网络是对特征进行提取,这就是为什么我们这里选择LBFGS的原因
# 在LBFGS优化函数中,我们传入的parameter实际上就是我们图像的像素点,通过优化图像的像素点从而达到风格迁移的目的
optimizer = torch.optim.LBFGS([parameter])
epoch_n = 300
epoch = [0]
picture_index = 0
print("图像优化中")
while epoch[0] <= epoch_n:
def loss():
# 初始化梯度,避免梯度叠加
optimizer.zero_grad()
style_score = 0
content_score = 0
# 将图片的数值(0~255)压缩至0~1
parameter.data.clamp_(0, 1)
# 训练模型
new_model(parameter)
# 累加风格损失函数和内容损失函数的反向传播值
for sl in style_losses:
style_score += sl.backward()
for cl in content_losses:
content_score += cl.backward()
epoch[0] += 1
if epoch[0] % 50 == 0:
print("Epoch:{} Style Loss:{:4f} Content Loss:{:4f}".format(epoch, style_score.item(),
content_score.item()))
return style_score + content_score
optimizer.step(loss)
print("优化结束")
# torch.save(new_model, "./model/style-0.00007-content-0.000006.pth")
file_path = "./output/" + "nmsl" + "-" + "nmsl" + ".jpg"
tensor_picture_save(input_img, file_path, w_c, h_c)
# img = transform.ToPILImage()
# # 一般样本不可能只有一个,我们需要把他转化成网格输出
# img = torchvision.utils.make_grid([content_img.squeeze(0), styple_img.squeeze(0), input_img.squeeze(0)])
# # 其次,如果我们是在GPU上跑完的结果的话,我们需要再把结果带回cpu才能转化成numpy数组
# # 但是我们通过上面的size可以知道我们的颜色通道宽高是不对劲的,于是我们需要转变他的维度,就是我们的tran
# img = img.cpu().numpy().transpose(1, 2, 0)
# plt.imshow(img)
#
# # plt.savefig(file_path)
# plt.show()
endtime = datetime.datetime.now()
print("生成" + "nmsl" + "-" + "nmsl" + ".jpg" + "用时:", (endtime - starttime).seconds, "s")
return file_path
def gradually_get():
starttime = datetime.datetime.now()
# 选择内容图片和风格图片
content_name = "斯大林"
style_name = "毕加索"
content_img, w_c, h_c = loading("./content/" + content_name + ".jpg")
content_img = Variable(content_img).cuda()
styple_img, w_s, h_s = loading("./style/" + style_name + ".jpg")
styple_img = Variable(styple_img).cuda()
# 导入特征提取网络
cnn = models.vgg16(pretrained=False)
pre = torch.load("./model/vgg16-397923af.pth")
cnn.load_state_dict(pre)
# 提取VGG16的features部分
cnn = cnn.features
cnn = cnn.cuda()
# 重新创建我们的模型
model = copy.deepcopy(cnn)
# 提取内容所需要的卷积层
content_layer = ["Conv_3"]
# 提取风格所需要的的卷积层
style_layer = ["Conv_1", "Conv_2", "Conv_3", "Conv_4"]
# 定义内容和风格的损失值,用于控制内容和风格对最后合成图的影响程度
content_weight = 1
style_weight = 1000
# 存储每一个内容层和风格层的计算图列表
content_losses = []
style_losses = []
# 创建一个空模型,用来存储我们的迁移模型
new_model = torch.nn.Sequential()
gram = Gram_matrix()
new_model = new_model.cuda()
gram = gram.cuda()
# 构建迁移模型
index = 1
# 从VGG16中提取出前8层来当做风格迁移的特征提取层
print("模型重构中")
for layer in tqdm(list(model)[:8]):
# 如果这一层是我们的Conv2d类型,就将它加入到我们的新模型中
# if isinstance(layer, BasicBlock):
if isinstance(layer, torch.nn.Conv2d):
name = "Conv_" + str(index)
new_model.add_module(name, layer)
# 根据选择的层数分配为风格提取和内容提取
if name in content_layer:
# 创建特征提取层,
# 将内容图输入到模型中进行计算,获得卷积得到的feature map
target = new_model(content_img).clone()
# 将控制内容图的权重与feature map 构建内容损失函数对象
content_loss = Content_loss(content_weight, target)
# 将这个对象添加到模型中
new_model.add_module("content_loss_" + str(index), content_loss)
# 记录损失函数计算过程
content_losses.append(content_loss)
if name in style_layer:
# 将内容图输入到模型中进行计算,获得卷积得到的feature map
target = new_model(styple_img).clone()
# 将这个feature map构建格拉姆矩阵
target = gram(target)
# 实例化风格损失函数
style_loss = Style_loss(style_weight, target)
# 讲风格损失函数对象添加到模型中
new_model.add_module("style_loss_" + str(index), style_loss)
# 记录损失函数计算过程
style_losses.append(style_loss)
if isinstance(layer, torch.nn.ReLU):
# 激活函数正常激活即可
name = "Relu_" + str(index)
new_model.add_module(name, layer)
index = index + 1
if isinstance(layer, torch.nn.MaxPool2d):
# 最大池化层也正常池化即可
name = "MaxPool_" + str(index)
new_model.add_module(name, layer)
# 获取输入图片,避免在卷积过程中对原图产生影响因此使用了clone
input_img = content_img.clone()
# 将一个不可训练的tensor类型转化成可训练的Parameter类型,从而使得在训练过程中对input_img进行风格修改
parameter = torch.nn.Parameter(input_img.data)
# LBFGS也是一种优化方法,他最大的优点就在于它能够写出一个closure函数,
# 在函数中记录多个损失函数的计算图,并返回
# 通过优化器,实现反向传播和参数更新
# 这里传入的就是训练的图像,由于风格迁移和大多数的深度神经网络训练不大一样
# 在风格迁移中,我们生成的图像是根据内容图结合风格图,对像素进行优化的
# 而大部分的深度神经网络是对特征进行提取,这就是为什么我们这里选择LBFGS的原因
# 在LBFGS优化函数中,我们传入的parameter实际上就是我们图像的像素点,通过优化图像的像素点从而达到风格迁移的目的
optimizer = torch.optim.LBFGS([parameter])
epoch_n = 300
epoch = [0]
picture_index = 0
print("图像优化中")
while epoch[0] <= epoch_n:
def loss():
# 初始化梯度,避免梯度叠加
optimizer.zero_grad()
style_score = 0
content_score = 0
# 将图片的数值(0~255)压缩至0~1
parameter.data.clamp_(0, 1)
# 训练模型
new_model(parameter)
# 累加风格损失函数和内容损失函数的反向传播值
for sl in style_losses:
style_score += sl.backward()
for cl in content_losses:
content_score += cl.backward()
epoch[0] += 1
if epoch[0] % 50 == 0:
print("Epoch:{} Style Loss:{:4f} Content Loss:{:4f}".format(epoch, style_score.item(),
content_score.item()))
return style_score + content_score
path = "./gradually/" + str(picture_index) + ".jpg"
tensor_picture_save(input_img.clone(), path, w_c, h_c)
picture_index += 1
optimizer.step(loss)
print("优化结束")
torch.save(new_model, "./model/style-0.00007-content-0.000006.pth")
# img = transform.ToPILImage()
# 一般样本不可能只有一个,我们需要把他转化成网格输出
img = torchvision.utils.make_grid([content_img.squeeze(0), styple_img.squeeze(0), input_img.squeeze(0)])
# 其次,如果我们是在GPU上跑完的结果的话,我们需要再把结果带回cpu才能转化成numpy数组
# 但是我们通过上面的size可以知道我们的颜色通道宽高是不对劲的,于是我们需要转变他的维度,就是我们的tran
img = img.cpu().numpy().transpose(1, 2, 0)
plt.imshow(img)
plt.savefig("./output/" + content_name + "-" + style_name + ".jpg")
plt.show()
endtime = datetime.datetime.now()
print("生成" + content_name + "-" + style_name + ".jpg" + "用时:", (endtime - starttime).seconds, "s")
if __name__ == '__main__':
# name = begin("content/门口.jpg", "style/星空.jpg")
# gradually_get()
print()
| 34.527211 | 110 | 0.59738 | 1,038 | 10,151 | 5.640655 | 0.194605 | 0.032792 | 0.018787 | 0.029035 | 0.942101 | 0.932024 | 0.898036 | 0.890863 | 0.877199 | 0.877199 | 0 | 0.021387 | 0.295242 | 10,151 | 293 | 111 | 34.645051 | 0.797037 | 0.239582 | 0 | 0.831325 | 0 | 0 | 0.063 | 0.012338 | 0.006024 | 0 | 0 | 0 | 0 | 1 | 0.024096 | false | 0 | 0.024096 | 0 | 0.066265 | 0.066265 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
7f6db540ec3d874636aff3596db4264d2c6abecf | 19,859 | py | Python | synthetic/tests/test_stats.py | friendlyneighbourhoodhackerman/synthetic | 472781c328a841234c853fad3cf4b67ba36aea7a | [
"MIT"
] | 23 | 2016-06-22T13:25:35.000Z | 2022-03-07T21:32:00.000Z | synthetic/tests/test_stats.py | friendlyneighbourhoodhackerman/synthetic | 472781c328a841234c853fad3cf4b67ba36aea7a | [
"MIT"
] | 1 | 2021-09-15T09:02:02.000Z | 2021-09-15T09:02:02.000Z | synthetic/tests/test_stats.py | friendlyneighbourhoodhackerman/synthetic | 472781c328a841234c853fad3cf4b67ba36aea7a | [
"MIT"
] | 7 | 2015-01-06T01:34:04.000Z | 2022-02-22T04:25:44.000Z | import unittest
from synthetic.stats import create_stat, StatType, DistanceType
from synthetic.tests.graphs import *
class TestStats(unittest.TestCase):
def test_degrees_undir(self):
g = full_graph(directed=False)
s = create_stat(g, StatType.DEGREES, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertEqual(s.bin_edges[-1], 99.)
g = star_graph()
s = create_stat(g, StatType.DEGREES, bins=10)
self.assertListEqual(list(s.data), [99, 0, 0, 0, 0, 0, 0, 0, 0, 1])
self.assertEqual(s.bin_edges[-1], 99.)
g = ring_graph(directed=False)
s = create_stat(g, StatType.DEGREES, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertEqual(s.bin_edges[-1], 2.)
def test_degrees_dir(self):
g = full_graph(directed=True)
s = create_stat(g, StatType.DEGREES, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertEqual(s.bin_edges[-1], 198.)
g = in_star_graph()
s = create_stat(g, StatType.DEGREES, bins=10)
self.assertListEqual(list(s.data), [99, 0, 0, 0, 0, 0, 0, 0, 0, 1])
self.assertEqual(s.bin_edges[-1], 99.)
g = out_star_graph()
s = create_stat(g, StatType.DEGREES, bins=10)
self.assertListEqual(list(s.data), [99, 0, 0, 0, 0, 0, 0, 0, 0, 1])
self.assertEqual(s.bin_edges[-1], 99.)
g = ring_graph(directed=True)
s = create_stat(g, StatType.DEGREES, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertEqual(s.bin_edges[-1], 2.)
def test_in_degrees(self):
g = full_graph(directed=True)
s = create_stat(g, StatType.IN_DEGREES, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertEqual(s.bin_edges[-1], 99.)
g = in_star_graph()
s = create_stat(g, StatType.IN_DEGREES, bins=10)
self.assertListEqual(list(s.data), [99, 0, 0, 0, 0, 0, 0, 0, 0, 1])
self.assertEqual(s.bin_edges[-1], 99.)
g = out_star_graph()
s = create_stat(g, StatType.IN_DEGREES, bins=10)
self.assertListEqual(list(s.data), [1, 0, 0, 0, 0, 0, 0, 0, 0, 99])
self.assertEqual(s.bin_edges[-1], 1.)
g = ring_graph(directed=True)
s = create_stat(g, StatType.IN_DEGREES, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertEqual(s.bin_edges[-1], 1.)
def test_out_degrees(self):
g = full_graph(directed=True)
s = create_stat(g, StatType.OUT_DEGREES, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertEqual(s.bin_edges[-1], 99.)
g = in_star_graph()
s = create_stat(g, StatType.OUT_DEGREES, bins=10)
self.assertListEqual(list(s.data), [1, 0, 0, 0, 0, 0, 0, 0, 0, 99])
self.assertEqual(s.bin_edges[-1], 1.)
g = out_star_graph()
s = create_stat(g, StatType.OUT_DEGREES, bins=10)
self.assertListEqual(list(s.data), [99, 0, 0, 0, 0, 0, 0, 0, 0, 1])
self.assertEqual(s.bin_edges[-1], 99.)
g = ring_graph(directed=True)
s = create_stat(g, StatType.OUT_DEGREES, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertEqual(s.bin_edges[-1], 1.)
def test_u_page_ranks_undir(self):
g = full_graph(directed=False)
s = create_stat(g, StatType.U_PAGERANKS, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertAlmostEqual(s.bin_edges[-1], .01, places=2)
g = star_graph()
s = create_stat(g, StatType.U_PAGERANKS, bins=10)
self.assertListEqual(list(s.data), [99, 0, 0, 0, 0, 0, 0, 0, 0, 1])
self.assertAlmostEqual(s.bin_edges[-1], .46, places=2)
g = ring_graph(directed=False)
s = create_stat(g, StatType.U_PAGERANKS, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertAlmostEqual(s.bin_edges[-1], .01, places=2)
def test_u_page_ranks_dir(self):
g = full_graph(directed=True)
s = create_stat(g, StatType.U_PAGERANKS, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertAlmostEqual(s.bin_edges[-1], .01, places=2)
g = in_star_graph()
s = create_stat(g, StatType.U_PAGERANKS, bins=10)
self.assertListEqual(list(s.data), [99, 0, 0, 0, 0, 0, 0, 0, 0, 1])
self.assertAlmostEqual(s.bin_edges[-1], .46, places=2)
g = out_star_graph()
s = create_stat(g, StatType.U_PAGERANKS, bins=10)
self.assertListEqual(list(s.data), [99, 0, 0, 0, 0, 0, 0, 0, 0, 1])
self.assertAlmostEqual(s.bin_edges[-1], .46, places=2)
g = ring_graph(directed=True)
s = create_stat(g, StatType.U_PAGERANKS, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertAlmostEqual(s.bin_edges[-1], .01, places=2)
def test_d_page_ranks(self):
g = full_graph(directed=True)
s = create_stat(g, StatType.D_PAGERANKS, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertAlmostEqual(s.bin_edges[-1], .01, places=2)
g = in_star_graph()
s = create_stat(g, StatType.D_PAGERANKS, bins=10)
self.assertListEqual(list(s.data), [99, 0, 0, 0, 0, 0, 0, 0, 0, 1])
self.assertAlmostEqual(s.bin_edges[-1], .46, places=2)
g = out_star_graph()
s = create_stat(g, StatType.D_PAGERANKS, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertAlmostEqual(s.bin_edges[-1], .01, places=2)
g = ring_graph(directed=True)
s = create_stat(g, StatType.D_PAGERANKS, bins=10)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 100])
self.assertAlmostEqual(s.bin_edges[-1], .01, places=2)
def test_triad_census_undir(self):
g = full_graph(directed=False)
s = create_stat(g, StatType.TRIAD_CENSUS)
self.assertListEqual(list(s.data), [0, 0, 0, 161700])
g = star_graph()
s = create_stat(g, StatType.TRIAD_CENSUS)
self.assertListEqual(list(s.data), [0, 0, 4851, 0])
g = ring_graph(directed=False)
s = create_stat(g, StatType.TRIAD_CENSUS)
self.assertListEqual(list(s.data), [0, 0, 100, 0])
def test_triad_census_dir(self):
g = full_graph(directed=True)
s = create_stat(g, StatType.TRIAD_CENSUS)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 161700])
g = in_star_graph()
s = create_stat(g, StatType.TRIAD_CENSUS)
self.assertListEqual(list(s.data), [0, 0, 4851, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0])
g = out_star_graph()
s = create_stat(g, StatType.TRIAD_CENSUS)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 0, 0, 4851, 0, 0, 0, 0,
0, 0, 0, 0, 0])
g = ring_graph(directed=True)
s = create_stat(g, StatType.TRIAD_CENSUS)
self.assertListEqual(list(s.data), [0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0])
def test_u_dists_undir(self):
g = full_graph(directed=False)
s = create_stat(g, StatType.U_DISTS, max_dist=10)
self.assertListEqual(list(s.data), [9900, 0, 0, 0, 0, 0, 0, 0, 0, 0])
self.assertAlmostEqual(s.bin_edges[-1], 10., places=2)
g = star_graph()
s = create_stat(g, StatType.U_DISTS, max_dist=10)
self.assertListEqual(list(s.data), [198, 9702, 0, 0, 0, 0, 0, 0, 0, 0])
self.assertAlmostEqual(s.bin_edges[-1], 10., places=2)
g = ring_graph(directed=False)
s = create_stat(g, StatType.U_DISTS, max_dist=10)
self.assertListEqual(list(s.data), [200, 200, 200, 200, 200, 200, 200,
200, 200, 8100])
self.assertAlmostEqual(s.bin_edges[-1], 10., places=2)
def test_d_dists_dir(self):
g = full_graph(directed=True)
s = create_stat(g, StatType.D_DISTS, max_dist=10)
self.assertListEqual(list(s.data), [9900, 0, 0, 0, 0, 0, 0, 0, 0, 0])
self.assertAlmostEqual(s.bin_edges[-1], 10., places=2)
g = in_star_graph()
s = create_stat(g, StatType.D_DISTS, max_dist=10)
self.assertListEqual(list(s.data), [99, 0, 0, 0, 0, 0, 0, 0, 0, 9801])
self.assertAlmostEqual(s.bin_edges[-1], 10., places=2)
g = out_star_graph()
s = create_stat(g, StatType.D_DISTS, max_dist=10)
self.assertListEqual(list(s.data), [99, 0, 0, 0, 0, 0, 0, 0, 0, 9801])
self.assertAlmostEqual(s.bin_edges[-1], 10., places=2)
g = ring_graph(directed=True)
s = create_stat(g, StatType.D_DISTS, max_dist=10)
self.assertListEqual(list(s.data), [100, 100, 100, 100, 100, 100, 100,
100, 100, 9000])
self.assertAlmostEqual(s.bin_edges[-1], 10., places=2)
def test_unknown_stat_throws_exception(self):
g = star_graph()
with self.assertRaises(ValueError):
create_stat(g, 999999999)
def test_unsupported_distance_throws_exception(self):
g = star_graph()
s = create_stat(g, StatType.TRIAD_CENSUS)
with self.assertRaises(NotImplementedError):
s.distance(s, DistanceType.EARTH_MOVER)
def test_normalized_manhattan_distance_undir(self):
g1 = full_graph(directed=False)
s1 = create_stat(g1, StatType.TRIAD_CENSUS)
g2 = star_graph()
s2 = create_stat(g2, StatType.TRIAD_CENSUS)
g3 = ring_graph(directed=False)
s3 = create_stat(g3, StatType.TRIAD_CENSUS)
g4 = random_graph_sparse(directed=False)
s4 = create_stat(g4, StatType.TRIAD_CENSUS)
g5 = random_graph_sparse(directed=False)
s5 = create_stat(g5, StatType.TRIAD_CENSUS)
self.assertEqual(
s1.distance(s1, DistanceType.NORMALIZED_MANHATTAN), 0.)
self.assertEqual(
s2.distance(s2, DistanceType.NORMALIZED_MANHATTAN), 0.)
self.assertEqual(
s3.distance(s3, DistanceType.NORMALIZED_MANHATTAN), 0.)
self.assertEqual(
s4.distance(s4, DistanceType.NORMALIZED_MANHATTAN), 0.)
self.assertEqual(
s5.distance(s5, DistanceType.NORMALIZED_MANHATTAN), 0.)
self.assertAlmostEqual(
s1.distance(s2, DistanceType.NORMALIZED_MANHATTAN), 2., places=2)
self.assertAlmostEqual(
s1.distance(s3, DistanceType.NORMALIZED_MANHATTAN), 2., places=2)
self.assertAlmostEqual(
s2.distance(
s3, DistanceType.NORMALIZED_MANHATTAN), 0.979, places=2)
self.assertLess(s4.distance(s5, DistanceType.NORMALIZED_MANHATTAN), 2.)
self.assertGreaterEqual(
s1.distance(s3, DistanceType.NORMALIZED_MANHATTAN),
s4.distance(s5, DistanceType.NORMALIZED_MANHATTAN))
def test_normalized_manhattan_distance_dir(self):
g1 = full_graph(directed=True)
s1 = create_stat(g1, StatType.TRIAD_CENSUS)
g2 = in_star_graph()
s2 = create_stat(g2, StatType.TRIAD_CENSUS)
g3 = out_star_graph()
s3 = create_stat(g3, StatType.TRIAD_CENSUS)
g4 = ring_graph(directed=True)
s4 = create_stat(g4, StatType.TRIAD_CENSUS)
g5 = random_graph_sparse(directed=True)
s5 = create_stat(g5, StatType.TRIAD_CENSUS)
g6 = random_graph_sparse(directed=True)
s6 = create_stat(g6, StatType.TRIAD_CENSUS)
self.assertEqual(
s1.distance(s1, DistanceType.NORMALIZED_MANHATTAN), 0.)
self.assertEqual(
s2.distance(s2, DistanceType.NORMALIZED_MANHATTAN), 0.)
self.assertEqual(
s3.distance(s3, DistanceType.NORMALIZED_MANHATTAN), 0.)
self.assertEqual(
s4.distance(s4, DistanceType.NORMALIZED_MANHATTAN), 0.)
self.assertEqual(
s5.distance(s5, DistanceType.NORMALIZED_MANHATTAN), 0.)
self.assertEqual(
s6.distance(s6, DistanceType.NORMALIZED_MANHATTAN), 0.)
self.assertAlmostEqual(
s1.distance(s2, DistanceType.NORMALIZED_MANHATTAN), 2., places=2)
self.assertAlmostEqual(
s1.distance(s3, DistanceType.NORMALIZED_MANHATTAN), 2., places=2)
self.assertAlmostEqual(
s1.distance(s4, DistanceType.NORMALIZED_MANHATTAN), 2., places=2)
self.assertAlmostEqual(
s2.distance(s3, DistanceType.NORMALIZED_MANHATTAN), 2., places=2)
self.assertAlmostEqual(
s2.distance(s4, DistanceType.NORMALIZED_MANHATTAN), 2., places=2)
self.assertAlmostEqual(
s3.distance(s4, DistanceType.NORMALIZED_MANHATTAN), 2., places=2)
self.assertLess(
s5.distance(s6, DistanceType.NORMALIZED_MANHATTAN), 10.)
def test_earth_mover_distance_undir(self):
g1 = full_graph(directed=False)
s1 = create_stat(g1, StatType.DEGREES, bins=10)
g2 = star_graph()
s2 = create_stat(g2, StatType.DEGREES, bins=10)
g3 = ring_graph(directed=False)
s3 = create_stat(g3, StatType.DEGREES, bins=10)
g4 = random_graph_sparse(directed=False)
s4 = create_stat(g4, StatType.DEGREES, bins=10)
g5 = random_graph_sparse(directed=False)
s5 = create_stat(g5, StatType.DEGREES, bins=10)
self.assertEqual(s1.distance(s1, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s2.distance(s2, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s3.distance(s3, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s4.distance(s4, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s5.distance(s5, DistanceType.EARTH_MOVER), 0.)
self.assertAlmostEqual(
s1.distance(s2, DistanceType.EARTH_MOVER), 8820.9, places=2)
self.assertAlmostEqual(
s1.distance(s3, DistanceType.EARTH_MOVER), 0., places=2)
self.assertAlmostEqual(
s2.distance(s3, DistanceType.EARTH_MOVER), 8820.9, places=2)
self.assertLess(
s4.distance(s5, DistanceType.EARTH_MOVER), 1000.)
self.assertLessEqual(
s1.distance(s3, DistanceType.EARTH_MOVER),
s4.distance(s5, DistanceType.EARTH_MOVER))
def test_earth_mover_distance_undir_rel(self):
g1 = full_graph(directed=False)
s1 = create_stat(g1, StatType.DEGREES, bins=10)
g2 = star_graph()
s2 = create_stat(g2, StatType.DEGREES, bins=10, ref_stat=s1)
g3 = ring_graph(directed=False)
s3 = create_stat(g3, StatType.DEGREES, bins=10, ref_stat=s1)
g4 = random_graph_sparse(directed=False)
s4 = create_stat(g4, StatType.DEGREES, bins=10, ref_stat=s1)
g5 = random_graph_sparse(directed=False)
s5 = create_stat(g5, StatType.DEGREES, bins=10, ref_stat=s1)
self.assertEqual(s1.distance(s1, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s2.distance(s2, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s3.distance(s3, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s4.distance(s4, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s5.distance(s5, DistanceType.EARTH_MOVER), 0.)
self.assertAlmostEqual(
s1.distance(s2, DistanceType.EARTH_MOVER), 8820.9, places=2)
self.assertAlmostEqual(
s1.distance(s3, DistanceType.EARTH_MOVER), 8910., places=2)
self.assertAlmostEqual(
s2.distance(s3, DistanceType.EARTH_MOVER), 89.1, places=2)
self.assertLess(s4.distance(s5, DistanceType.EARTH_MOVER), 1000.)
self.assertGreater(
s1.distance(s3, DistanceType.EARTH_MOVER),
s4.distance(s5, DistanceType.EARTH_MOVER))
def test_earth_mover_distance_dir(self):
g1 = full_graph(directed=True)
s1 = create_stat(g1, StatType.IN_DEGREES, bins=10)
g2 = in_star_graph()
s2 = create_stat(g2, StatType.IN_DEGREES, bins=10)
g3 = out_star_graph()
s3 = create_stat(g3, StatType.IN_DEGREES, bins=10)
g4 = ring_graph(directed=True)
s4 = create_stat(g4, StatType.IN_DEGREES, bins=10)
g5 = random_graph_sparse(directed=True)
s5 = create_stat(g5, StatType.IN_DEGREES, bins=10)
g6 = random_graph_sparse(directed=True)
s6 = create_stat(g6, StatType.IN_DEGREES, bins=10)
self.assertEqual(s1.distance(s1, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s2.distance(s2, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s3.distance(s3, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s4.distance(s4, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s5.distance(s5, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s6.distance(s6, DistanceType.EARTH_MOVER), 0.)
self.assertAlmostEqual(
s1.distance(s2, DistanceType.EARTH_MOVER), 8820.9, places=2)
self.assertAlmostEqual(
s1.distance(s3, DistanceType.EARTH_MOVER), 89.1, places=2)
self.assertAlmostEqual(
s1.distance(s4, DistanceType.EARTH_MOVER), 0., places=2)
self.assertAlmostEqual(
s2.distance(s3, DistanceType.EARTH_MOVER), 8731.8, places=2)
self.assertAlmostEqual(
s2.distance(s4, DistanceType.EARTH_MOVER), 8820.9, places=2)
self.assertAlmostEqual(
s3.distance(s4, DistanceType.EARTH_MOVER), 0.9, places=2)
self.assertLess(s5.distance(s6, DistanceType.EARTH_MOVER), 1000.)
def test_earth_mover_distance_dir_rel(self):
g1 = full_graph(directed=True)
s1 = create_stat(g1, StatType.IN_DEGREES, bins=10)
g2 = in_star_graph()
s2 = create_stat(g2, StatType.IN_DEGREES, bins=10, ref_stat=s1)
g3 = out_star_graph()
s3 = create_stat(g3, StatType.IN_DEGREES, bins=10, ref_stat=s1)
g4 = ring_graph(directed=True)
s4 = create_stat(g4, StatType.IN_DEGREES, bins=10, ref_stat=s1)
g5 = random_graph_sparse(directed=True)
s5 = create_stat(g5, StatType.IN_DEGREES, bins=10, ref_stat=s1)
g6 = random_graph_sparse(directed=True)
s6 = create_stat(g6, StatType.IN_DEGREES, bins=10, ref_stat=s1)
self.assertEqual(s1.distance(s1, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s2.distance(s2, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s3.distance(s3, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s4.distance(s4, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s5.distance(s5, DistanceType.EARTH_MOVER), 0.)
self.assertEqual(s6.distance(s6, DistanceType.EARTH_MOVER), 0.)
self.assertAlmostEqual(
s1.distance(s2, DistanceType.EARTH_MOVER), 8820.9, places=2)
self.assertAlmostEqual(
s1.distance(s3, DistanceType.EARTH_MOVER), 8910., places=2)
self.assertAlmostEqual(
s1.distance(s4, DistanceType.EARTH_MOVER), 8910., places=2)
self.assertAlmostEqual(
s2.distance(s3, DistanceType.EARTH_MOVER), 89.1, places=2)
self.assertAlmostEqual(
s2.distance(s4, DistanceType.EARTH_MOVER), 89.1, places=2)
self.assertAlmostEqual(
s3.distance(s4, DistanceType.EARTH_MOVER), 0., places=2)
self.assertLess(s5.distance(s6, DistanceType.EARTH_MOVER), 1000.)
if __name__ == '__main__':
unittest.main()
| 43.360262 | 79 | 0.622337 | 2,734 | 19,859 | 4.361375 | 0.040966 | 0.048809 | 0.062898 | 0.071117 | 0.962177 | 0.951191 | 0.933579 | 0.929218 | 0.911355 | 0.902046 | 0 | 0.077757 | 0.242963 | 19,859 | 457 | 80 | 43.455142 | 0.715378 | 0 | 0 | 0.764075 | 0 | 0 | 0.000403 | 0 | 0 | 0 | 0 | 0 | 0.386059 | 1 | 0.050938 | false | 0 | 0.008043 | 0 | 0.061662 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
7f7888450e49004f9c5016175c7b1de2edab22bf | 4,055 | py | Python | backend/beedare/delete/views.py | gijs3ntius/BeeDare | 9ad5a93dad9b531b332aeb58f9b97e98585bc1ac | [
"Apache-2.0"
] | null | null | null | backend/beedare/delete/views.py | gijs3ntius/BeeDare | 9ad5a93dad9b531b332aeb58f9b97e98585bc1ac | [
"Apache-2.0"
] | 17 | 2020-06-05T18:27:11.000Z | 2022-03-11T23:24:50.000Z | backend/beedare/delete/views.py | gijsentius/BeeDare | 9ad5a93dad9b531b332aeb58f9b97e98585bc1ac | [
"Apache-2.0"
] | null | null | null | import sqlalchemy
from flask import jsonify, request
from beedare import db
from beedare.models import User, Dare, Hive, UserDares, Comment, Message
from . import *
@delete_blueprint.route('/hive', methods=["POST"])
def delete_hive():
content = request.get_json()
try:
result = db.session.query(Hive).filter_by(id=content['hive_id']).first()
except KeyError as e:
return jsonify({"error": str(e) + " not given or invalid"}), 401
if result is not None:
db.session.delete(result)
try:
db.session.commit()
except sqlalchemy.exc.IntegrityError:
return jsonify({"error": "commit failed"}), 401
return jsonify({
"success": True
}), 200
return jsonify({"error": "'hive' not given or invalid"}), 401
@delete_blueprint.route('/message', methods=["POST"])
def delete_message():
content = request.get_json()
try:
result = db.session.query(Message).filter_by(id=content['message_id']).first()
except KeyError as e:
return jsonify({"error": str(e) + " not given or invalid"}), 401
if result is not None:
db.session.delete(result)
try:
db.session.commit()
except sqlalchemy.exc.IntegrityError:
return jsonify({"error": "commit failed"}), 401
return jsonify({
"success": True
}), 200
return jsonify({"error": "'user' not given or invalid"}), 401
@delete_blueprint.route('/comment', methods=["POST"])
def delete_comment():
content = request.get_json()
try:
result = db.session.query(Comment).filter_by(id=content['comment_id']).first()
except KeyError as e:
return jsonify({"error": str(e) + " not given or invalid"}), 401
if result is not None:
db.session.delete(result)
try:
db.session.commit()
except sqlalchemy.exc.IntegrityError:
return jsonify({"error": "commit failed"}), 401
return jsonify({
"success": True
}), 200
return jsonify({"error": "'user' not given or invalid"}), 401
@delete_blueprint.route('/dare', methods=["POST"])
def delete_dare():
content = request.get_json()
try:
result = db.session.query(Dare).filter_by(content['dare_id']).first()
except KeyError as e:
return jsonify({"error": str(e) + " not given or invalid"}), 401
if result is not None:
db.session.delete(result)
try:
db.session.commit()
except sqlalchemy.exc.IntegrityError:
return jsonify({"error": "commit failed"}), 401
return jsonify({
"success": True
}), 200
return jsonify({"error": "'user' not given or invalid"}), 401
@delete_blueprint.route('/accepted_dare', methods=["POST"])
def delete_accepted_dare():
content = request.get_json()
try:
result = db.session.query(UserDares).filter_by(id=content['dare_id']).first()
except KeyError as e:
return jsonify({"error": str(e) + " not given or invalid"}), 401
if result is not None:
db.session.delete(result)
try:
db.session.commit()
except sqlalchemy.exc.IntegrityError:
return jsonify({"error": "commit failed"}), 401
return jsonify({
"success": True
}), 200
return jsonify({"error": "'user' not given or invalid"}), 401
@delete_blueprint.route('/profile', methods=["POST"])
def profile():
content = request.get_json()
try:
result = db.session.query(User).filter_by(id=content['user_id']).first()
except KeyError as e:
return jsonify({"error": str(e) + " not given or invalid"}), 401
if result is not None:
db.session.delete(result)
try:
db.session.commit()
except sqlalchemy.exc.IntegrityError:
return jsonify({"error": "commit failed"}), 401
return jsonify({
"success": True
}), 200
return jsonify({"error": "'user' not given or invalid"}), 401
| 33.512397 | 86 | 0.604192 | 485 | 4,055 | 4.987629 | 0.115464 | 0.128979 | 0.13394 | 0.084332 | 0.81852 | 0.798677 | 0.798677 | 0.798677 | 0.782141 | 0.709384 | 0 | 0.023825 | 0.254747 | 4,055 | 120 | 87 | 33.791667 | 0.776638 | 0 | 0 | 0.775701 | 0 | 0 | 0.152404 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.056075 | false | 0 | 0.046729 | 0 | 0.327103 | 0.056075 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
7f953a4d471f5316ed9175aa8e508defada87877 | 4,366 | py | Python | tests/test_longest_increasing_subsequence.py | mCodingLLC/longest_increasing_subsequence | 65ede89d4e76bc6086bbe1eb1440123df698d1ae | [
"MIT"
] | 7 | 2021-03-23T10:38:35.000Z | 2022-03-01T15:38:52.000Z | tests/test_longest_increasing_subsequence.py | mCodingLLC/longest_increasing_subsequence | 65ede89d4e76bc6086bbe1eb1440123df698d1ae | [
"MIT"
] | null | null | null | tests/test_longest_increasing_subsequence.py | mCodingLLC/longest_increasing_subsequence | 65ede89d4e76bc6086bbe1eb1440123df698d1ae | [
"MIT"
] | 3 | 2021-03-23T10:38:36.000Z | 2021-10-09T14:06:57.000Z | #!/usr/bin/env python
"""Tests for `longest_increasing_subsequence` package."""
import pytest
from longest_increasing_subsequence import longest_increasing_subsequence, longest_decreasing_subsequence
@pytest.mark.parametrize('test_input,expected', [
([], []),
("", []),
(tuple(), []),
([1, 2, 3], [1, 2, 3]),
([1, 2, 0, 3], [1, 2, 3]),
([10, 9, 2, 5, 3, 7, 101, 18], [2, 3, 7, 18]),
([0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15], [0, 2, 6, 9, 11, 15]),
((0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15), [0, 2, 6, 9, 11, 15]),
([5], [5]),
([5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5]),
([5, 5, 5, 5, 5, 5, 4, 3, 2, 1], [5, 5, 5, 5, 5, 5]),
('aababbbdccddd', ['a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'd', 'd', 'd']),
])
def test_longest_increasing_subsequence(test_input, expected):
assert longest_increasing_subsequence(test_input) == expected
@pytest.mark.parametrize('test_input,expected', [
([], []),
("", []),
(tuple(), []),
([1, 2, 3], [1, 2, 3]),
([1, 2, 0, 3], [1, 2, 3]),
([10, 9, 2, 5, 3, 7, 101, 18], [2, 3, 7, 18]),
([0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15], [0, 2, 6, 9, 11, 15]),
((0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15), [0, 2, 6, 9, 11, 15]),
([5], [5]),
([5, 5, 5, 5, 5, 5], [5]),
([5, 5, 5, 5, 5, 5, 4, 3, 2, 1], [1]),
('aababbbdccddd', ['a', 'b', 'c', 'd']),
([0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0], [0, 1]),
])
def test_longest_increasing_subsequence_strict(test_input, expected):
assert longest_increasing_subsequence(test_input, strict=True) == expected
@pytest.mark.parametrize('test_input,key,expected', [
([], lambda x: x, []),
("", lambda x: x, []),
(tuple(), lambda x: x, []),
([1, 2, 3], lambda x: x * x, [1, 2, 3]),
([1, 2, 0, 3], lambda x: x * x, [1, 2, 3]),
([10, 9, 2, 5, 3, 7, 101, 18], lambda x: x * x, [2, 3, 7, 18]),
([0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15], lambda x: x * x, [0, 2, 6, 9, 11, 15]),
((0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15), lambda x: x * x, [0, 2, 6, 9, 11, 15]),
([5], lambda x: x * x, [5]),
([5, 5, 5, 5, 5, 5], lambda x: x * x, [5, 5, 5, 5, 5, 5]),
([5, 5, 5, 5, 5, 5, 4, 3, 2, 1], lambda x: x * x, [5, 5, 5, 5, 5, 5]),
('aababbbdccddd', lambda x: x, ['a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'd', 'd', 'd']),
([0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0], lambda x: x, [0, 0, 0, 0, 0, 0, 1, 1]),
])
def test_longest_increasing_subsequence_with_key(test_input, key, expected):
assert longest_increasing_subsequence(test_input, key=key) == expected
@pytest.mark.parametrize('test_input,key,expected', [
([], lambda x: x, []),
("", lambda x: x, []),
(tuple(), lambda x: x, []),
([1, 2, 3], lambda x: x * x, [1, 2, 3]),
([1, 2, 0, 3], lambda x: -x * x, [2, 0]),
([10, 9, 2, 5, 3, 7, 101, 18], lambda x: x * x, [2, 3, 7, 18]),
([0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15], lambda x: x * x, [0, 2, 6, 9, 11, 15]),
((0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15), lambda x: x * x, [0, 2, 6, 9, 11, 15]),
([5], lambda x: x * x, [5]),
([5, 5, 5, 5, 5, 5], lambda x: x * x, [5]),
([5, 5, 5, 5, 5, 5, 4, 3, 2, 1], lambda x: x * x, [1]),
('aababbbdccddd', lambda x: x, ['a', 'b', 'c', 'd']),
([0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0], lambda x: -x, [1, 0]),
])
def test_longest_increasing_subsequences_strict_with_key(test_input, key, expected):
assert longest_increasing_subsequence(test_input, strict=True, key=key) == expected
@pytest.mark.parametrize('test_input,expected', [
([0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0]),
])
def test_longest_decreasing_subsequence(test_input, expected):
assert longest_decreasing_subsequence(test_input) == expected
@pytest.mark.parametrize('test_input,expected', [
([0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0], [1, 0]),
])
def test_longest_decreasing_subsequence_strict(test_input, expected):
assert longest_decreasing_subsequence(test_input, strict=True) == expected
@pytest.mark.parametrize('test_input,key,expected', [
([0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0], lambda x: -x, [0, 1]),
])
def test_longest_decreasing_subsequence_strict_with_key(test_input, key, expected):
assert longest_decreasing_subsequence(test_input, strict=True, key=key) == expected
| 41.580952 | 105 | 0.510536 | 799 | 4,366 | 2.697121 | 0.065081 | 0.066821 | 0.089095 | 0.103944 | 0.906265 | 0.880278 | 0.792575 | 0.759165 | 0.7471 | 0.625522 | 0 | 0.162322 | 0.226752 | 4,366 | 104 | 106 | 41.980769 | 0.476007 | 0.016491 | 0 | 0.571429 | 0 | 0 | 0.052938 | 0.016091 | 0 | 0 | 0 | 0 | 0.083333 | 1 | 0.083333 | false | 0 | 0.02381 | 0 | 0.107143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
7fbab61fbd5840e7ca3f1b2dea707992d581187e | 17,580 | py | Python | dirigible/fts/tests/test_2795_Rewrite_Formulae_during_Cut_and_Paste.py | EnoX1/dirigible-spreadsheet | 9a3289c67a93c40190565ad5a555710c50c5f958 | [
"MIT"
] | 168 | 2015-01-03T02:09:30.000Z | 2022-03-31T22:28:00.000Z | dirigible/fts/tests/test_2795_Rewrite_Formulae_during_Cut_and_Paste.py | EnoX1/dirigible-spreadsheet | 9a3289c67a93c40190565ad5a555710c50c5f958 | [
"MIT"
] | 4 | 2017-03-14T20:49:49.000Z | 2020-04-02T16:13:00.000Z | dirigible/fts/tests/test_2795_Rewrite_Formulae_during_Cut_and_Paste.py | EnoX1/dirigible-spreadsheet | 9a3289c67a93c40190565ad5a555710c50c5f958 | [
"MIT"
] | 46 | 2015-01-18T04:39:24.000Z | 2022-02-17T22:33:05.000Z | # Copyright (c) 2010 Resolver Systems Ltd.
# All Rights Reserved
#
from functionaltest import FunctionalTest
class Test_2795_Rewrite_Formulae_during_Cut_and_Paste(FunctionalTest):
def test_cut_cell_reference_to_cut_cell_is_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * He writes a formula in A1 that refers to cell A2
self.enter_cell_text(1, 1, '=A2')
self.wait_for_spinner_to_stop()
self.wait_for_cell_to_contain_formula(1, 1, '=A2')
# * He uses cut & paste to move the formula (and its depenency)
# from A1 to C2
self.cut_range((1, 1), (1, 2))
self.paste_range((3, 2))
self.wait_for_spinner_to_stop()
# * He is please to see the formula is sensibly rewritten
self.wait_for_cell_to_contain_formula(3, 2, '=C3')
def test_cut_cell_reference_to_uncut_cell_is_not_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * He writes a formula in A1 that refers to cell B3
self.enter_cell_text(1, 1, '=B3')
self.wait_for_spinner_to_stop()
self.wait_for_cell_to_contain_formula(1, 1, '=B3')
# * He uses cut & paste to move the formula from A1 to C2
self.cut_range((1, 1), (1, 1))
self.paste_range((3, 2))
self.wait_for_spinner_to_stop()
# * He is please to see the formula remains unchanged
self.wait_for_cell_to_contain_formula(3, 2, '=B3')
def test_copied_cell_reference_to_copied_cell_is_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * He writes a formula in A1 that refers to cell A2
self.enter_cell_text(1, 1, '=A2')
self.wait_for_spinner_to_stop()
self.wait_for_cell_to_contain_formula(1, 1, '=A2')
# * He uses copy & paste to move the formula (and its depenency)
# from A1 to C2
self.copy_range((1, 1), (1, 2))
self.paste_range((3, 2))
self.wait_for_spinner_to_stop()
# * He is please to see the formula is sensibly rewritten
self.wait_for_cell_to_contain_formula(3, 2, '=C3')
def test_copied_cell_reference_to_uncopied_cell_is_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * He writes a formula in A1 that refers to cell B3
self.enter_cell_text(1, 1, '=B3')
self.wait_for_spinner_to_stop()
self.wait_for_cell_to_contain_formula(1, 1, '=B3')
# * He uses copy & paste to move the formula from A1 to C2
self.copy_range((1, 1), (1, 1))
self.paste_range((3, 2))
self.wait_for_spinner_to_stop()
# * He is please to see the formula is sensibly rewritten
self.wait_for_cell_to_contain_formula(3, 2, '=D4')
def test_cut_cellrange_reference_to_completely_cut_cellrange_is_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A1, referencing A2:A3
self.enter_cell_text(1, 1, '=A2:A3')
self.wait_for_cell_to_contain_formula(1, 1, '=A2:A3')
# * He uses cut & paste to move the formula, but not its dependencies,
# 2 along and 1 down
self.cut_range((1, 1), (1, 3))
self.paste_range((3, 2))
self.wait_for_spinner_to_stop()
# * He is please to see the formula is sensibly rewritten
self.wait_for_cell_to_contain_formula(3, 2, '=C3:C4')
def test_cut_cellrange_reference_to_partially_cut_cellrange_is_not_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A1, referencing A2:A3
self.enter_cell_text(1, 1, '=A2:A3')
self.wait_for_cell_to_contain_formula(1, 1, '=A2:A3')
# * He uses cut & paste to move the formula, but not its dependencies,
# 2 along and 1 down
self.cut_range((1, 1), (1, 2))
self.paste_range((3, 2))
self.wait_for_spinner_to_stop()
# * He is please to see the formula is not rewritten
self.wait_for_cell_to_contain_formula(3, 2, '=A2:A3')
def test_cut_cellrange_reference_to_uncut_cellrange_is_not_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A1, referencing A2:A3
self.enter_cell_text(1, 1, '=A2:A3')
self.wait_for_cell_to_contain_formula(1, 1, '=A2:A3')
# * He uses cut & paste to move the formula, but not its dependencies,
# 2 along and 1 down
self.cut_range((1, 1), (1, 1))
self.paste_range((3, 2))
self.wait_for_spinner_to_stop()
# * He is please to see the formula is not rewritten
self.wait_for_cell_to_contain_formula(3, 2, '=A2:A3')
def test_copied_cellrange_reference_to_completely_copied_cellrange_is_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A1, referencing A2:A3
self.enter_cell_text(1, 1, '=A2:A3')
self.wait_for_cell_to_contain_formula(1, 1, '=A2:A3')
# * He uses copy & paste to move the formula, but not its dependencies,
# 2 along and 1 down
self.copy_range((1, 1), (1, 3))
self.paste_range((3, 2))
self.wait_for_spinner_to_stop()
# * He is please to see the formula is sensibly rewritten
self.wait_for_cell_to_contain_formula(3, 2, '=C3:C4')
def test_copied_cellrange_reference_to_partially_copied_cellrange_is_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A1, referencing A2:A3
self.enter_cell_text(1, 1, '=A2:A3')
self.wait_for_cell_to_contain_formula(1, 1, '=A2:A3')
# * He uses copy & paste to move the formula, but not its dependencies,
# 2 along and 1 down
self.copy_range((1, 1), (1, 2))
self.paste_range((3, 2))
self.wait_for_spinner_to_stop()
# * He is please to see the formula is sensibly rewritten
self.wait_for_cell_to_contain_formula(3, 2, '=C3:C4')
def test_copied_cellrange_reference_to_uncopied_cellrange_is_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A1, referencing A2:A3
self.enter_cell_text(1, 1, '=A2:A3')
self.wait_for_cell_to_contain_formula(1, 1, '=A2:A3')
# * He uses copy & paste to move the formula, but not its dependencies,
# 2 along and 1 down
self.copy_range((1, 1), (1, 1))
self.paste_range((3, 2))
self.wait_for_spinner_to_stop()
# * He is please to see the formula is sensibly rewritten
self.wait_for_cell_to_contain_formula(3, 2, '=C3:C4')
def test_outside_cell_references_to_range_cut_from_ARE_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A1, referencing B2
self.enter_cell_text(1, 1, '=B2')
self.wait_for_cell_to_contain_formula(1, 1, '=B2')
# * He uses cut & paste to move the cell B2,
# which A1 used to point to
# to position C3
self.cut_range((2, 2), (2, 2))
self.paste_range((3, 3))
self.wait_for_spinner_to_stop()
# * He is pleased to see the formula in A1
# now points to the new location
self.wait_for_cell_to_contain_formula(1, 1, '=C3')
def test_outside_cell_ranges_pointing_inside_range_cut_from_ARE_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A1, referencing B2:C3
self.enter_cell_text(1, 1, '=B2:C3')
self.wait_for_cell_to_contain_formula(1, 1, '=B2:C3')
# * He uses cut & paste to move the B2:B3
# which A1 used to point to
# 3 across and 4 down
self.cut_range((2, 2), (4, 4))
self.paste_range((5, 6))
self.wait_for_spinner_to_stop()
# * He is pleased to see the formula in A1
# now points to the new location
self.wait_for_cell_to_contain_formula(1, 1, '=E6:F7')
def test_absolute_references_in_copied_range_to_outside_are_not_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A2, referencing $A$1
self.enter_cell_text(1, 1, '1')
self.enter_cell_text(1, 2, '=$A$1+1')
self.wait_for_cell_to_contain_formula(1, 2, '=$A$1+1')
# * Copies and pastes A2 to B2
self.copy_range((1, 2), (1, 2))
self.paste_range((2, 2))
self.wait_for_spinner_to_stop()
# * He is pleased to see the formula in B2 is the same as the one
# in A2.
self.wait_for_cell_to_contain_formula(2, 2, '=$A$1+1')
def test_absolute_references_in_copied_range_to_inside_are_not_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A2, referencing $A$1
self.enter_cell_text(1, 1, '1')
self.enter_cell_text(1, 2, '=$A$1+1')
self.wait_for_cell_to_contain_formula(1, 2, '=$A$1+1')
# * Copies and pastes A1:A2 to B1:B2
self.copy_range((1, 1), (1, 2))
self.paste_range((2, 1))
self.wait_for_spinner_to_stop()
# * He is pleased to see the formula in B2 is the same as the one
# in A2.
self.wait_for_cell_to_contain_formula(2, 2, '=$A$1+1')
def test_absolute_references_outside_copied_range_to_inside_are_not_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A2, referencing $A$1
self.enter_cell_text(1, 1, '1')
self.enter_cell_text(1, 2, '=$A$1+1')
self.wait_for_cell_to_contain_formula(1, 2, '=$A$1+1')
# * Copies and pastes A1 to B1
self.copy_range((1, 1), (1, 1))
self.paste_range((2, 1))
self.wait_for_spinner_to_stop()
# * He is pleased to see the formula in A2 is unchanged
self.wait_for_cell_to_contain_formula(1, 2, '=$A$1+1')
def test_absolute_references_in_cut_range_to_outside_are_not_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A2, referencing $A$1
self.enter_cell_text(1, 1, '1')
self.enter_cell_text(1, 2, '=$A$1+1')
self.wait_for_cell_to_contain_formula(1, 2, '=$A$1+1')
# * Cut and pastes A2 to B2
self.cut_range((1, 2), (1, 2))
self.paste_range((2, 2))
self.wait_for_spinner_to_stop()
# * He is pleased to see the formula in B2 is the same as the one
# in A2.
self.wait_for_cell_to_contain_formula(2, 2, '=$A$1+1')
def test_absolute_references_in_cut_range_to_inside_are_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A2, referencing $A$1
self.enter_cell_text(1, 1, '1')
self.enter_cell_text(1, 2, '=$A$1+1')
self.wait_for_cell_to_contain_formula(1, 2, '=$A$1+1')
# * Cut and pastes A1:A2 to B1:B2
self.cut_range((1, 1), (1, 2))
self.paste_range((2, 1))
self.wait_for_spinner_to_stop()
# * He is pleased to see the formula in B2 is properly rewritten
self.wait_for_cell_to_contain_formula(2, 2, '=$B$1+1')
def test_absolute_references_outside_cut_range_to_inside_are_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A2, referencing $A$1
self.enter_cell_text(1, 1, '1')
self.enter_cell_text(1, 2, '=$A$1+1')
self.wait_for_cell_to_contain_formula(1, 2, '=$A$1+1')
# * Cut and pastes A1 to B1
self.cut_range((1, 1), (1, 1))
self.paste_range((2, 1))
self.wait_for_spinner_to_stop()
# * He is pleased to see the formula in B2 is rewritten
self.wait_for_cell_to_contain_formula(1, 2, '=$B$1+1')
def test_column_absolute_references_are_partially_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A2, referencing $A1
self.enter_cell_text(1, 1, '1')
self.enter_cell_text(1, 2, '=$A1+1')
self.wait_for_cell_to_contain_formula(1, 2, '=$A1+1')
# * Copies and pastes A2 to B3
self.copy_range((1, 2), (1, 2))
self.paste_range((2, 3))
self.wait_for_spinner_to_stop()
# * He is pleased to see the formula in B3 has been rewritten to
# refer to $A2
self.wait_for_cell_to_contain_formula(2, 3, '=$A2+1')
def test_row_absolute_references_are_partially_rewritten(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A2, referencing A$1
self.enter_cell_text(1, 1, '1')
self.enter_cell_text(1, 2, '=A$1+1')
self.wait_for_cell_to_contain_formula(1, 2, '=A$1+1')
# * Copies and pastes A2 to B3
self.copy_range((1, 2), (1, 2))
self.paste_range((2, 3))
self.wait_for_spinner_to_stop()
# * He is pleased to see the formula in B3 has been rewritten to
# refer to B$1.
self.wait_for_cell_to_contain_formula(2, 3, '=B$1+1')
def test_cell_rewrites_that_go_off_grid_are_handled(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A2, referencing A1
self.enter_cell_text(1, 1, '1')
self.enter_cell_text(1, 2, '=A1+1')
self.wait_for_cell_to_contain_formula(1, 2, '=A1+1')
# * Copies and pastes A2 to B1
self.copy_range((1, 2), (1, 2))
self.paste_range((2, 1))
self.wait_for_spinner_to_stop()
# * He is pleased to see the formula in B1
# has an error message
self.wait_for_cell_to_contain_formula(2, 1, '=#Invalid!+1')
def test_cellrange_rewrites_that_go_off_grid_are_handled(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A3, referencing A1:A2
self.enter_cell_text(1, 1, '1')
self.enter_cell_text(1, 2, '2')
self.enter_cell_text(1, 3, '=sum(A1:A2)')
self.wait_for_cell_to_contain_formula(1, 3, '=sum(A1:A2)')
# * Copies and pastes A3 to B2
self.copy_range((1, 3), (1, 3))
self.paste_range((2, 2))
self.wait_for_spinner_to_stop()
# * He is pleased to see the formula in B2
# has an error message
self.wait_for_cell_to_contain_formula(2, 2, '=sum(#Invalid!:B1)')
def test_cut_paste_paste_rewrites_formulae_for_2nd_paste(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A1
self.enter_cell_text(1, 1, '=B1')
# He pastes elsewhere, then pastes again
self.cut_range((1, 1), (1, 1))
self.paste_range((1, 2))
self.paste_range((1, 3))
self.wait_for_spinner_to_stop()
# * the first paste (from a cut) does not rewrite the formula
self.wait_for_cell_to_contain_formula(1, 2, '=B1')
# * the second paste should act like a copy from the first paste
self.wait_for_cell_to_contain_formula(1, 3, '=B2')
def test_copy_paste_paste_always_rewrites_formulae(self):
# * Harold logs in to dirigible, his favourite cloud computing tool
self.login_and_create_new_sheet()
# * Harold creates a formula in A1
self.enter_cell_text(1, 1, '=B1')
# He pastes elsewhere, then pastes again
self.copy_range((1, 1), (1, 1))
self.paste_range((1, 2))
self.paste_range((1, 3))
self.wait_for_spinner_to_stop()
# * the first paste (from a copy) does rewrite the formula
self.wait_for_cell_to_contain_formula(1, 2, '=B2')
# * the second paste should act like a copy from the first paste
self.wait_for_cell_to_contain_formula(1, 3, '=B3')
def test_buttons(self):
pass # *TODO we need cut, copy and paste buttons
| 38.13449 | 90 | 0.647838 | 2,767 | 17,580 | 3.833394 | 0.054572 | 0.020552 | 0.078816 | 0.06788 | 0.938908 | 0.930423 | 0.903554 | 0.891204 | 0.881588 | 0.862638 | 0 | 0.044092 | 0.254323 | 17,580 | 460 | 91 | 38.217391 | 0.765047 | 0.332082 | 0 | 0.704225 | 0 | 0 | 0.036498 | 0 | 0 | 0 | 0 | 0.002174 | 0 | 1 | 0.117371 | false | 0.004695 | 0.004695 | 0 | 0.126761 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
f68a0f487ec030ae09260be082246659ca60a455 | 287 | py | Python | keepercommander/importer/lastpass/session.py | Mkn-yskz/Commandy | e360306f41112534ae71102658f560fd974a1f45 | [
"MIT"
] | 159 | 2015-01-13T16:33:52.000Z | 2022-03-23T10:53:09.000Z | lastpass/session.py | cclauss/lastpass-pythonista | 480f60f41b22aca2a4b483e4a3be8214becc8ef9 | [
"MIT"
] | 145 | 2015-12-31T00:11:35.000Z | 2022-03-31T19:13:54.000Z | lastpass/session.py | cclauss/lastpass-pythonista | 480f60f41b22aca2a4b483e4a3be8214becc8ef9 | [
"MIT"
] | 73 | 2015-10-30T00:53:10.000Z | 2022-03-30T03:50:53.000Z | # coding: utf-8
class Session(object):
def __init__(self, id, key_iteration_count):
self.id = id
self.key_iteration_count = key_iteration_count
def __eq__(self, other):
return self.id == other.id and self.key_iteration_count == other.key_iteration_count
| 31.888889 | 92 | 0.700348 | 41 | 287 | 4.463415 | 0.414634 | 0.327869 | 0.464481 | 0.229508 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004386 | 0.205575 | 287 | 8 | 93 | 35.875 | 0.798246 | 0.045296 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.166667 | 0.666667 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.