at_coder_friends-generator-python_ref 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 20d49d792a5c8a47146f38f023779e10d4fb6ce6
4
- data.tar.gz: 4b81ddb8beef4ce5c066f8a5b7102dd6a9762eab
2
+ SHA256:
3
+ metadata.gz: 2a804a55d43573bd91ea0b11c9d4df5a170109874d24a7107e72c948b839343e
4
+ data.tar.gz: 3ad6eeac429650c1e7770a14181009fd39acfdc1be6cc4ee47a99f2733a608dc
5
5
  SHA512:
6
- metadata.gz: 7889a1f7fe9df21cf69b5f3840cafcf9106f3351ef3be59476d0091d4f9db2b88e5e52adcb4c8b49b42c6eba5ada4b206d7ddc4fa49f7a624af63fba7d5c9fa5
7
- data.tar.gz: 0dc73dd6c6bd4b018f76b2ab78d74755c9025268c2f118ff9aa78f12487f8eb14a5ede44777ab8b0de526f50a91e93e8614852c3e853106101067f0b2cd6790d
6
+ metadata.gz: 7245a02695fe12bcecdd52507c40e34a8152fb8bc63eed16fe586180166b44df3a6d2a6ac7ca05d8b914cdd893995d58b2223828e20769b94e8f43453f5f6285
7
+ data.tar.gz: 9dffdfff8fa54abcb58f9e58d91c7e55d90b7da1893098cd7051f3bea8d09e67b8aa58f7d08ac990061dcc8694cb48c374dfaf08f126d4263b686f68adc44049
@@ -0,0 +1,32 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.7', '3.0', '3.2']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby-version }}
30
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
31
+ - name: Run tests
32
+ run: bundle exec rspec
data/.gitignore CHANGED
@@ -12,3 +12,6 @@
12
12
 
13
13
  # rvm
14
14
  .ruby-version
15
+
16
+ # Visual Studio Code local settings
17
+ .vscode/
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.4
4
+ TargetRubyVersion: 2.7
5
5
  NewCops: enable
6
6
 
7
7
  Metrics/BlockLength:
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.4.0 (2023/05/12)
6
+ ### Added
7
+ - add Ruby3.2 to target version.
8
+ ### Changed
9
+ - externalize code fragments to YAML
10
+ ### Deleted
11
+ - drop Ruby2.5 from target version.
12
+
13
+ ## 0.3.2 (2021/12/25)
14
+ ### Deleted
15
+ - drop Ruby2.4 from target version.
16
+
5
17
  ## 0.3.1 (2020/12/20)
6
18
  ### Added
7
19
  - python 3.8.2 support - use underscore separator in number literal
data/Gemfile.lock CHANGED
@@ -1,74 +1,81 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- at_coder_friends-generator-python_ref (0.3.1)
5
- at_coder_friends (~> 0.6.6)
4
+ at_coder_friends-generator-python_ref (0.4.0)
5
+ at_coder_friends (~> 0.7.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- addressable (2.7.0)
11
- public_suffix (>= 2.0.2, < 5.0)
12
- at_coder_friends (0.6.7)
10
+ addressable (2.8.4)
11
+ public_suffix (>= 2.0.2, < 6.0)
12
+ at_coder_friends (0.7.0)
13
13
  colorize (~> 0.8.1)
14
14
  launchy (>= 2.4.3)
15
15
  mechanize (~> 2.0)
16
16
  colorize (0.8.1)
17
- connection_pool (2.2.3)
18
- diff-lcs (1.4.4)
19
- docile (1.3.3)
17
+ connection_pool (2.4.0)
18
+ diff-lcs (1.5.0)
19
+ docile (1.4.0)
20
20
  domain_name (0.5.20190701)
21
21
  unf (>= 0.0.5, < 1.0.0)
22
- http-cookie (1.0.3)
22
+ http-cookie (1.0.5)
23
23
  domain_name (~> 0.5)
24
- launchy (2.5.0)
25
- addressable (~> 2.7)
26
- mechanize (2.7.6)
27
- domain_name (~> 0.5, >= 0.5.1)
28
- http-cookie (~> 1.0)
29
- mime-types (>= 1.17.2)
30
- net-http-digest_auth (~> 1.1, >= 1.1.1)
31
- net-http-persistent (>= 2.5.2)
32
- nokogiri (~> 1.6)
33
- ntlm-http (~> 0.1, >= 0.1.1)
34
- webrobots (>= 0.0.9, < 0.2)
35
- mime-types (3.3.1)
24
+ launchy (2.5.2)
25
+ addressable (~> 2.8)
26
+ mechanize (2.9.1)
27
+ addressable (~> 2.8)
28
+ domain_name (~> 0.5, >= 0.5.20190701)
29
+ http-cookie (~> 1.0, >= 1.0.3)
30
+ mime-types (~> 3.0)
31
+ net-http-digest_auth (~> 1.4, >= 1.4.1)
32
+ net-http-persistent (>= 2.5.2, < 5.0.dev)
33
+ nokogiri (~> 1.11, >= 1.11.2)
34
+ rubyntlm (~> 0.6, >= 0.6.3)
35
+ webrick (~> 1.7)
36
+ webrobots (~> 0.1.2)
37
+ mime-types (3.4.1)
36
38
  mime-types-data (~> 3.2015)
37
- mime-types-data (3.2020.1104)
38
- mini_portile2 (2.4.0)
39
+ mime-types-data (3.2023.0218.1)
39
40
  net-http-digest_auth (1.4.1)
40
- net-http-persistent (4.0.0)
41
+ net-http-persistent (4.0.2)
41
42
  connection_pool (~> 2.2)
42
- nokogiri (1.10.10)
43
- mini_portile2 (~> 2.4.0)
44
- ntlm-http (0.1.1)
45
- public_suffix (4.0.6)
46
- rake (13.0.2)
47
- rspec (3.10.0)
48
- rspec-core (~> 3.10.0)
49
- rspec-expectations (~> 3.10.0)
50
- rspec-mocks (~> 3.10.0)
51
- rspec-core (3.10.0)
52
- rspec-support (~> 3.10.0)
53
- rspec-expectations (3.10.0)
43
+ nokogiri (1.14.3-arm64-darwin)
44
+ racc (~> 1.4)
45
+ nokogiri (1.14.3-x86_64-linux)
46
+ racc (~> 1.4)
47
+ public_suffix (5.0.1)
48
+ racc (1.6.2)
49
+ rake (13.0.6)
50
+ rspec (3.12.0)
51
+ rspec-core (~> 3.12.0)
52
+ rspec-expectations (~> 3.12.0)
53
+ rspec-mocks (~> 3.12.0)
54
+ rspec-core (3.12.2)
55
+ rspec-support (~> 3.12.0)
56
+ rspec-expectations (3.12.3)
54
57
  diff-lcs (>= 1.2.0, < 2.0)
55
- rspec-support (~> 3.10.0)
56
- rspec-mocks (3.10.0)
58
+ rspec-support (~> 3.12.0)
59
+ rspec-mocks (3.12.5)
57
60
  diff-lcs (>= 1.2.0, < 2.0)
58
- rspec-support (~> 3.10.0)
59
- rspec-support (3.10.0)
60
- simplecov (0.18.5)
61
+ rspec-support (~> 3.12.0)
62
+ rspec-support (3.12.0)
63
+ rubyntlm (0.6.3)
64
+ simplecov (0.22.0)
61
65
  docile (~> 1.1)
62
66
  simplecov-html (~> 0.11)
67
+ simplecov_json_formatter (~> 0.1)
63
68
  simplecov-html (0.12.3)
69
+ simplecov_json_formatter (0.1.4)
64
70
  unf (0.1.4)
65
71
  unf_ext
66
- unf_ext (0.0.7.7)
72
+ unf_ext (0.0.8.2)
73
+ webrick (1.8.1)
67
74
  webrobots (0.1.2)
68
75
 
69
76
  PLATFORMS
70
- ruby
71
- x64-mingw32
77
+ arm64-darwin-20
78
+ x86_64-linux
72
79
 
73
80
  DEPENDENCIES
74
81
  at_coder_friends-generator-python_ref!
@@ -78,4 +85,4 @@ DEPENDENCIES
78
85
  simplecov (~> 0.10)
79
86
 
80
87
  BUNDLED WITH
81
- 2.1.4
88
+ 2.4.12
data/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ [![Gem Version](https://badge.fury.io/rb/at_coder_friends-generator-python_ref.svg)](https://badge.fury.io/rb/at_coder_friends-generator-python_ref)
2
+ ![Gem](https://img.shields.io/gem/dt/at_coder_friends-generator-python_ref)
3
+ [![Ruby](https://github.com/nejiko96/at_coder_friends-generator-python_ref/actions/workflows/ruby.yml/badge.svg)](https://github.com/nejiko96/at_coder_friends-generator-python_ref/actions/workflows/ruby.yml)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/0775ef9da0798b73beb4/maintainability)](https://codeclimate.com/github/nejiko96/at_coder_friends-generator-python_ref/maintainability)
5
+ ![GitHub](https://img.shields.io/github/license/nejiko96/at_coder_friends-generator-python_ref)
6
+
1
7
  # AtCoderFriends::Generator::PythonRef
2
8
 
3
9
  Python source generator for [AtCoderFriends](https://github.com/nejiko96/at_coder_friends).
@@ -21,24 +27,26 @@ Or install it yourself as:
21
27
 
22
28
  ## Configuration
23
29
 
24
- Add ```PythonRef``` to ```generators``` setting in ```.at_coder_friends.yml```
30
+ Add `PythonRef` to `generators` setting in `.at_coder_friends.yml`
25
31
 
26
32
  ## Generator Options
27
33
 
28
34
  Following options are available
29
- in ```generator_settings/PythonRef``` section of ```.at_coder_friends.yml```:
35
+ in `generator_settings/PythonRef` section of `.at_coder_friends.yml`:
30
36
 
31
- | Option | Description | Default |
32
- |---------|-------------|---------|
33
- |default_template|Source template file path|[/templates/python_ref.py.erb](/templates/python_ref.py.erb)|
37
+ | Option | Description | Default |
38
+ | -------- | -------------- | ------- |
39
+ | file_ext | File extension | py |
40
+ | template<br>(formerly default_template) | Code template file path | [python_ref.py.erb](/templates/python_ref.py.erb) |
41
+ | fragments | Code fragments file path | [python_ref_fragments.yml](/templates/python_ref_fragments.yml) |
34
42
 
35
- ## ```.at_coder_friends.yml``` example for Python
43
+ ## `.at_coder_friends.yml` example for Python
36
44
  ```YAML
37
45
  generators:
38
46
  - PythonRef
39
47
  generator_settings:
40
48
  PythonRef:
41
- default_template: /path/to/template
49
+ template: /path/to/template
42
50
  ext_settings:
43
51
  'py':
44
52
  test_cmd:
@@ -28,15 +28,16 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ['lib']
30
30
 
31
- spec.required_ruby_version = '>= 2.4.0'
31
+ spec.required_ruby_version = '>= 2.7.0'
32
32
 
33
33
  spec.metadata = {
34
34
  'homepage_uri' => spec.homepage,
35
35
  'source_code_uri' => spec.homepage,
36
- 'changelog_uri' => spec.homepage + '/blob/master/CHANGELOG.md'
36
+ 'changelog_uri' => "#{spec.homepage}/blob/master/CHANGELOG.md",
37
+ 'rubygems_mfa_required' => 'true'
37
38
  }
38
39
 
39
- spec.add_dependency 'at_coder_friends', '~> 0.6.6'
40
+ spec.add_dependency 'at_coder_friends', '~> 0.7.0'
40
41
 
41
42
  spec.add_development_dependency 'bundler', '~> 2.0'
42
43
  spec.add_development_dependency 'rake', '~> 13.0'
@@ -3,7 +3,7 @@
3
3
  module AtCoderFriends
4
4
  module Generator
5
5
  module PythonRefConstants
6
- VERSION = '0.3.1'
6
+ VERSION = '0.4.0'
7
7
  end
8
8
  end
9
9
  end
@@ -5,184 +5,34 @@ require 'at_coder_friends/generator/python_ref/version'
5
5
 
6
6
  module AtCoderFriends
7
7
  module Generator
8
+ # Python variable declaration generator
9
+
8
10
  # generates Python source from problem description
9
11
  class PythonRef < Base
10
12
  include PythonRefConstants
13
+ include ConstFragmentMixin
14
+ include DeclFragmentMixin
11
15
 
12
16
  ACF_HOME = File.realpath(File.join(__dir__, '..', '..', '..'))
13
17
  TMPL_DIR = File.join(ACF_HOME, 'templates')
14
- DEFAULT_TMPL = File.join(TMPL_DIR, 'python_ref.py.erb')
15
- ATTRS = Attributes.new(:py, DEFAULT_TMPL)
18
+ TEMPLATE = File.join(TMPL_DIR, 'python_ref.py.erb')
19
+ FRAGMENTS = File.realpath(File.join(TMPL_DIR, 'python_ref_fragments.yml'))
20
+ ATTRS = Attributes.new(:py, TEMPLATE, FRAGMENTS)
16
21
 
17
22
  def attrs
18
23
  ATTRS
19
24
  end
20
25
 
21
- def render(src)
22
- src = embed_lines(src, '### CONSTS ###', gen_consts)
23
- src = embed_lines(src, '### DCLS ###', gen_decls)
24
- src
25
- end
26
-
27
- def gen_consts(constants = pbm.constants)
28
- constants
26
+ def gen_consts
27
+ pbm.constants
29
28
  .select { |c| c.type == :mod }
30
- .map { |c| gen_mod(c) }
31
- end
32
-
33
- def gen_mod(c)
34
- v = c.value.gsub('^', '**').gsub(',', '_')
35
- "MOD = #{v}"
36
- end
37
-
38
- def gen_decls(inpdefs = pbm.formats)
39
- inpdefs.map { |inpdef| gen_decl(inpdef) }.flatten
29
+ .map { |c| gen_const(c) }
40
30
  end
41
31
 
42
- def gen_decl(inpdef)
43
- case inpdef.container
44
- when :single
45
- gen_single_decl(inpdef)
46
- when :harray
47
- gen_harray_decl(inpdef)
48
- when :varray
49
- gen_varray_decl(inpdef)
50
- when :matrix
51
- gen_matrix_decl(inpdef)
52
- when :varray_matrix, :matrix_varray
53
- gen_cmb_decl(inpdef)
54
- when :vmatrix
55
- gen_vmatrix_decl(inpdef)
56
- when :hmatrix
57
- gen_hmatrix_decl(inpdef)
58
- end
59
- end
60
-
61
- def gen_single_decl(inpdef)
62
- names = inpdef.names
63
- dcl = names.join(', ')
64
- expr = gen_expr(inpdef, names.size > 1)
65
- "#{dcl} = #{expr}"
66
- end
67
-
68
- def gen_harray_decl(inpdef)
69
- v = inpdef.names[0]
70
- dcl = "#{v}s"
71
- expr = gen_expr(inpdef, true)
72
- "#{dcl} = #{expr}"
73
- end
74
-
75
- def gen_varray_decl(inpdef)
76
- if inpdef.names.size == 1
77
- gen_varray_1_decl(inpdef)
78
- else
79
- gen_varray_n_decl(inpdef)
80
- end
81
- end
82
-
83
- def gen_varray_1_decl(inpdef)
84
- v = inpdef.names[0]
85
- sz = inpdef.size[0]
86
- dcl = "#{v}s"
87
- expr = gen_expr(inpdef, false)
88
- "#{dcl} = [#{expr} for _ in range(#{sz})]"
89
- end
90
-
91
- def gen_varray_n_decl(inpdef)
92
- names = inpdef.names
93
- sz = inpdef.size[0]
94
- dcl = names.map { |v| "#{v}s[i]" }.join(', ')
95
- expr = gen_expr(inpdef, true)
96
- ret = []
97
- ret += names.map { |v| "#{v}s = [None for _ in range(#{sz})]" }
98
- ret << "for i in range(#{sz}):"
99
- ret << " #{dcl} = #{expr}"
100
- ret
101
- end
102
-
103
- def gen_matrix_decl(inpdef)
104
- v = inpdef.names[0]
105
- sz = inpdef.size[0]
106
- decl = "#{v}ss"
107
- expr = gen_expr(inpdef, true)
108
- "#{decl} = [#{expr} for _ in range(#{sz})]"
109
- end
110
-
111
- def gen_cmb_decl(inpdef)
112
- mx = inpdef.container == :varray_matrix ? -1 : 0
113
- vs = inpdef.names.map { |v| "#{v}s" }
114
- vs[mx] += 's'
115
- sz = inpdef.size[0]
116
- dcls = vs.map { |v| "#{v}[i]" }
117
- dcls[mx] = '*' + dcls[mx] unless inpdef.item == :char
118
- dcl = dcls.join(', ')
119
- expr = gen_cmb_expr(inpdef)
120
- ret = []
121
- ret += vs.map { |v| "#{v} = [None for _ in range(#{sz})]" }
122
- ret << "for i in range(#{sz}):"
123
- ret << " #{dcl} = #{expr}"
124
- ret
125
- end
126
-
127
- def gen_vmatrix_decl(inpdef)
128
- names = inpdef.names
129
- sz1, sz2 = inpdef.size
130
- dcl = names.map { |v| "#{v}ss[i][j]" }.join(', ')
131
- expr = gen_expr(inpdef, true)
132
- ret = []
133
- ret += names.map do |v|
134
- "#{v}ss = [[None for _ in range(#{sz2})] for _ in range(#{sz1})]"
135
- end
136
- ret << "for i in range(#{sz1}):"
137
- ret << " for j in range(#{sz2}):"
138
- ret << " #{dcl} = #{expr}"
139
- ret
140
- end
141
-
142
- def gen_hmatrix_decl(inpdef)
143
- names = inpdef.names
144
- sz = inpdef.size[0]
145
- dcls = names.map { |v| "#{v}ss[i]" }
146
- expr = gen_expr(inpdef, true)
147
- ret = []
148
- ret += names.map { |v| "#{v}ss = [None for _ in range(#{sz})]" }
149
- ret << "for i in range(#{sz}):"
150
- ret << " line = #{expr}"
151
- ret += dcls.map.with_index do |dcl, i|
152
- " #{dcl} = line[#{i}::#{dcls.size}]"
153
- end
154
- ret
155
- end
156
-
157
- def gen_expr(inpdef, split)
158
- read = gen_read(inpdef.delim)
159
- case inpdef.item
160
- when :number
161
- split ? "list(map(int, #{read}.split()))" : "int(#{read})"
162
- when :decimal
163
- split ? "list(map(float, #{read}.split()))" : "float(#{read})"
164
- when :string
165
- split ? "#{read}.split()" : read
166
- when :char
167
- read
168
- end
169
- end
170
-
171
- def gen_cmb_expr(inpdef)
172
- read = gen_read(inpdef.delim)
173
- case inpdef.item
174
- when :number
175
- "list(map(int, #{read}.split()))"
176
- when :decimal
177
- "list(map(float, #{read}.split()))"
178
- when :string, :char
179
- "#{read}.split()"
180
- end
181
- end
182
-
183
- def gen_read(delim)
184
- sub = delim.chars.map { |d| ".replace('#{d}', ' ')" }.join
185
- "input()#{sub}"
32
+ # deprecated, use ERB syntax
33
+ def render(src)
34
+ src = embed_lines(src, '### CONSTS ###', gen_consts)
35
+ embed_lines(src, '### DCLS ###', gen_decls)
186
36
  end
187
37
  end
188
38
  end
@@ -0,0 +1,90 @@
1
+ constant:
2
+ value_print: <%= value.gsub('^', '**').gsub(',', '_') %>
3
+ mod: MOD = <%= value_print %>
4
+ declaration:
5
+ read: input()<% delims.each do |d| %>.replace('<%= d %>', ' ')<% end %>
6
+ multiplicity: |
7
+ <%
8
+ case container
9
+ when :single, :varray
10
+ if vs.size > 1 && item != :char
11
+ %>multi<%
12
+ else
13
+ %>single<%
14
+ end
15
+ when :harray, :matrix
16
+ if item != :char
17
+ %>multi<%
18
+ else
19
+ %>single<%
20
+ end
21
+ else
22
+ %>multi<%
23
+ end
24
+ -%>
25
+ input:
26
+ __key: [item, multiplicity]
27
+ number:
28
+ single: int(<%= read %>)
29
+ multi: list(map(int, <%= read %>.split()))
30
+ decimal:
31
+ single: float(<%= read %>)
32
+ multi: list(map(float, <%= read %>.split()))
33
+ string:
34
+ single: <%= read %>
35
+ multi: <%= read %>.split()
36
+ char:
37
+ single: <%= read %>
38
+ multi: <%= read %>.split()
39
+ decl_type: |
40
+ <%
41
+ case container
42
+ when :varray
43
+ if vs.size > 1 %>varray_n<% else %>varray_1<% end
44
+ else
45
+ %><%= container.to_s %><%
46
+ end
47
+ -%>
48
+ splat: <% unless item == :char %>*<% end %>
49
+ main:
50
+ __key: [decl_type]
51
+ single: <%= vs.join(', ') %> = <%= input %>
52
+ harray: <%= v %>s = <%= input %>
53
+ varray_1: <%= v %>s = [<%= input %> for _ in range(<%= sz %>)]
54
+ varray_n: |
55
+ <% vs.each do |v| -%>
56
+ <%= v %>s = [None for _ in range(<%= sz %>)]
57
+ <% end -%>
58
+ for i in range(<%= sz %>):
59
+ <%= vs.map { |v| "#{v}s[i]" }.join(', ') %> = <%= input %>
60
+ matrix: <%= v %>ss = [<%= input %> for _ in range(<%= sz %>)]
61
+ varray_matrix: |
62
+ <% vs[0..-2].each do |v| -%>
63
+ <%= v %>s = [None for _ in range(<%= sz %>)]
64
+ <% end -%>
65
+ <%= vs[-1] %>ss = [None for _ in range(<%= sz %>)]
66
+ for i in range(<%= sz %>):
67
+ <%= vs[0..-2].map { |v| "#{v}s[i]" }.join(', ') %>, <%= splat %><%= vs[-1] %>ss[i] = <%= input %>
68
+ matrix_varray: |
69
+ <%= vs[0] %>ss = [None for _ in range(<%= sz %>)]
70
+ <% vs[1..].each do |v| -%>
71
+ <%= v %>s = [None for _ in range(<%= sz %>)]
72
+ <% end -%>
73
+ for i in range(<%= sz %>):
74
+ <%= splat %><%= vs[0] %>ss[i], <%= vs[1..].map { |v| "#{v}s[i]" }.join(', ') %> = <%= input %>
75
+ vmatrix: |
76
+ <% vs.each do |v| -%>
77
+ <%= v %>ss = [[None for _ in range(<%= sz2 %>)] for _ in range(<%= sz1 %>)]
78
+ <% end -%>
79
+ for i in range(<%= sz1 %>):
80
+ for j in range(<%= sz2 %>):
81
+ <%= vs.map { |v| "#{v}ss[i][j]" }.join(', ') %> = <%= input %>
82
+ hmatrix: |
83
+ <% vs.each do |v| -%>
84
+ <%= v %>ss = [None for _ in range(<%= sz %>)]
85
+ <% end -%>
86
+ for i in range(<%= sz %>):
87
+ line = <%= input %>
88
+ <% vs.each_with_index do |v, k| -%>
89
+ <%= v %>ss[i] = line[<%= k %>::<%= vs.size %>]
90
+ <% end -%>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: at_coder_friends-generator-python_ref
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nejiko96
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-19 00:00:00.000000000 Z
11
+ date: 2023-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: at_coder_friends
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.6.6
19
+ version: 0.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.6.6
26
+ version: 0.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -89,11 +89,11 @@ executables: []
89
89
  extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
+ - ".github/workflows/ruby.yml"
92
93
  - ".gitignore"
93
94
  - ".rspec"
94
95
  - ".rubocop.yml"
95
96
  - ".rubocop_todo.yml"
96
- - ".travis.yml"
97
97
  - CHANGELOG.md
98
98
  - CODE_OF_CONDUCT.md
99
99
  - Gemfile
@@ -107,6 +107,7 @@ files:
107
107
  - lib/at_coder_friends/generator/python_ref.rb
108
108
  - lib/at_coder_friends/generator/python_ref/version.rb
109
109
  - templates/python_ref.py.erb
110
+ - templates/python_ref_fragments.yml
110
111
  homepage: https://github.com/nejiko96/at_coder_friends-generator-python_ref
111
112
  licenses:
112
113
  - MIT
@@ -114,6 +115,7 @@ metadata:
114
115
  homepage_uri: https://github.com/nejiko96/at_coder_friends-generator-python_ref
115
116
  source_code_uri: https://github.com/nejiko96/at_coder_friends-generator-python_ref
116
117
  changelog_uri: https://github.com/nejiko96/at_coder_friends-generator-python_ref/blob/master/CHANGELOG.md
118
+ rubygems_mfa_required: 'true'
117
119
  post_install_message:
118
120
  rdoc_options: []
119
121
  require_paths:
@@ -122,15 +124,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
124
  requirements:
123
125
  - - ">="
124
126
  - !ruby/object:Gem::Version
125
- version: 2.4.0
127
+ version: 2.7.0
126
128
  required_rubygems_version: !ruby/object:Gem::Requirement
127
129
  requirements:
128
130
  - - ">="
129
131
  - !ruby/object:Gem::Version
130
132
  version: '0'
131
133
  requirements: []
132
- rubyforge_project:
133
- rubygems_version: 2.6.14.4
134
+ rubygems_version: 3.4.12
134
135
  signing_key:
135
136
  specification_version: 4
136
137
  summary: Python generator for AtCoderFriends
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.4
7
- before_install: gem install bundler -v 2.0.2