Module: RuboCop::Cop::HelperFunctions Private
- Includes:
- RangeHelp
- Included in:
- Cask::HomepageUrlTrailingSlash, DescHelper, FormulaCop, RuboCop::Cop::Homebrew::ExecShellMetacharacters, RuboCop::Cop::Homebrew::ShellCommands, OnSystemConditionalsHelper
- Defined in:
- rubocops/shared/helper_functions.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Helper functions for cops.
Instance Method Summary collapse
-
#block_method_called_in_block?(node, method_name) ⇒ Boolean
private
Check if a block method is called inside a block.
-
#block_size(block) ⇒ Object
private
Returns the block length of the block node.
-
#check_precedence(first_nodes, next_nodes) ⇒ Object
private
Checks for precedence; returns the first pair of precedence-violating nodes.
-
#class_name(node) ⇒ Object
private
Returns the class node’s name, or nil if not a class node.
-
#component_precedes?(first_node, next_node) ⇒ Boolean
private
If first node does not precede next_node, sets appropriate instance variables for reporting.
-
#end_column(node) ⇒ Object
private
Returns the ending position of the node in source code.
-
#expression_negated?(node) ⇒ Boolean
private
Check if negation is present in the given node.
-
#find_all_blocks(node, block_name) ⇒ Object
private
Returns an array of block nodes of any depth below node in AST.
-
#find_block(node, block_name) ⇒ Object
private
Returns a block named block_name inside node.
-
#find_blocks(node, block_name) ⇒ Object
private
Returns an array of block nodes named block_name inside node.
-
#find_const(node, const_name) ⇒ Object
private
Find CONSTANTs in the source.
-
#find_every_func_call_by_name(node, func_name = nil) ⇒ Object
private
Returns array of function call nodes matching func_name in every descendant of node.
-
#find_every_method_call_by_name(node, method_name = nil) ⇒ Object
private
Returns an array of method call nodes matching method_name in every descendant of node.
-
#find_instance_call(node, name) ⇒ Object
private
Matches receiver part of method.
-
#find_instance_method_call(node, instance, method_name) ⇒ Object
private
Matches a method with a receiver.
-
#find_method_calls_by_name(node, method_name) ⇒ Object
private
Returns an array of method call nodes matching method_name inside node with depth first order (child nodes).
-
#find_method_def(node, method_name = nil) ⇒ Object
private
Returns a method definition node with method_name.
-
#find_method_with_args(node, method_name, *args) ⇒ Object
private
Given a method_name and arguments, yields to a block with matching method passed as a parameter to the block.
-
#find_node_method_by_name(node, method_name) ⇒ Object
private
Returns method_node matching method_name.
-
#find_strings(node) ⇒ Object
private
Returns all string nodes among the descendants of given node.
-
#format_component(component_node) ⇒ Object
private
Returns printable component name.
-
#line_number(node) ⇒ Integer
private
Returns the line number of the node.
-
#line_start_column(node) ⇒ Object
private
Returns the begin position of the node’s line in source code.
-
#method_called?(node, method_name) ⇒ Boolean
private
Check if method_name is called among the direct children nodes in the given node.
-
#method_called_ever?(node, method_name) ⇒ Boolean
private
Check if method_name is called among every descendant node of given node.
-
#method_name(node) ⇒ Object
private
Returns the method name for a def node.
-
#node_equals?(node, var) ⇒ Boolean
private
To compare node with appropriate Ruby variable.
-
#offending_node(node = nil) ⇒ Object
private
Gets/sets the given node as the offending node when required in custom cops.
-
#parameters(method_node) ⇒ Object
private
Returns the array of arguments of the method_node.
-
#parameters_passed?(method_node, params) ⇒ Boolean
private
Returns true if the given parameters are present in method call and sets the method call as the offending node.
-
#problem(msg, &block) ⇒ Object
private
-
#regex_match_group(node, pattern) ⇒ Object
private
Checks for regex match of pattern in the node and sets the appropriate instance variables to report the match.
-
#size(node) ⇒ Object
private
Returns the node size in the source code.
-
#source_buffer(node) ⇒ Object
private
Source buffer is required as an argument to report style violations.
-
#start_column(node) ⇒ Object
private
Returns the begin position of the node in source code.
-
#string_content(node, strip_dynamic: false) ⇒ Object
private
Returns the string representation if node is of type str(plain) or dstr(interpolated) or const.
Instance Method Details
#block_method_called_in_block?(node, method_name) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Check if a block method is called inside a block.
290 291 292 293 294 295 296 297 298 299 |
# File 'rubocops/shared/helper_functions.rb', line 290 def block_method_called_in_block?(node, method_name) node.body.each_child_node do |call_node| next if !call_node.block_type? && !call_node.send_type? next if call_node.method_name != method_name @offensive_node = call_node return true end false end |
#block_size(block) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns the block length of the block node.
398 399 400 |
# File 'rubocops/shared/helper_functions.rb', line 398 def block_size(block) block.loc.end.line - block.loc.begin.line end |
#check_precedence(first_nodes, next_nodes) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Checks for precedence; returns the first pair of precedence-violating nodes.
329 330 331 332 333 334 335 336 |
# File 'rubocops/shared/helper_functions.rb', line 329 def check_precedence(first_nodes, next_nodes) next_nodes.each do |each_next_node| first_nodes.each do |each_first_node| return [each_first_node, each_next_node] if component_precedes?(each_first_node, each_next_node) end end nil end |
#class_name(node) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns the class node’s name, or nil if not a class node.
382 383 384 385 |
# File 'rubocops/shared/helper_functions.rb', line 382 def class_name(node) @offensive_node = node node.const_name end |
#component_precedes?(first_node, next_node) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
If first node does not precede next_node, sets appropriate instance variables for reporting.
339 340 341 342 343 344 |
# File 'rubocops/shared/helper_functions.rb', line 339 def component_precedes?(first_node, next_node) return false if line_number(first_node) < line_number(next_node) @offensive_node = first_node true end |
#end_column(node) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns the ending position of the node in source code.
377 378 379 |
# File 'rubocops/shared/helper_functions.rb', line 377 def end_column(node) node.source_range.end_pos end |
#expression_negated?(node) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Check if negation is present in the given node.
347 348 349 350 351 352 |
# File 'rubocops/shared/helper_functions.rb', line 347 def expression_negated?(node) return false unless node.parent&.send_type? return false unless node.parent.method_name.equal?(:!) offending_node(node.parent) end |
#find_all_blocks(node, block_name) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns an array of block nodes of any depth below node in AST. If a block is given then yields matching block node to the block!
258 259 260 261 262 263 264 265 266 267 268 |
# File 'rubocops/shared/helper_functions.rb', line 258 def find_all_blocks(node, block_name) return if node.nil? blocks = node.each_descendant(:block).select { |block_node| block_name == block_node.method_name } return blocks unless block_given? blocks.each do |block_node| offending_node(block_node) yield block_node end end |
#find_block(node, block_name) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns a block named block_name inside node.
235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'rubocops/shared/helper_functions.rb', line 235 def find_block(node, block_name) return if node.nil? node.each_child_node(:block) do |block_node| next if block_node.method_name != block_name @offensive_node = block_node return block_node end # If not found then, parent node becomes the offensive node @offensive_node = node.parent nil end |
#find_blocks(node, block_name) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns an array of block nodes named block_name inside node.
250 251 252 253 254 |
# File 'rubocops/shared/helper_functions.rb', line 250 def find_blocks(node, block_name) return if node.nil? node.each_child_node(:block).select { |block_node| block_name == block_node.method_name } end |
#find_const(node, const_name) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Find CONSTANTs in the source. If block given, yield matching nodes.
216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'rubocops/shared/helper_functions.rb', line 216 def find_const(node, const_name) return if node.nil? node.each_descendant(:const) do |const_node| next if const_node.const_name != const_name @offensive_node = const_node yield const_node if block_given? return true end nil end |
#find_every_func_call_by_name(node, func_name = nil) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns array of function call nodes matching func_name in every descendant of node.
- matches function call:
foo(*args, **kwargs)
- does not match method calls:
foo.bar(*args, **kwargs)
- returns every function call if no func_name is passed
157 158 159 160 161 162 163 |
# File 'rubocops/shared/helper_functions.rb', line 157 def find_every_func_call_by_name(node, func_name = nil) return if node.nil? node.each_descendant(:send).select do |func_node| func_node.receiver.nil? && (func_name.nil? || func_name == func_node.method_name) end end |
#find_every_method_call_by_name(node, method_name = nil) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns an array of method call nodes matching method_name in every descendant of node. Returns every method call if no method_name is passed.
143 144 145 146 147 148 149 150 |
# File 'rubocops/shared/helper_functions.rb', line 143 def find_every_method_call_by_name(node, method_name = nil) return if node.nil? node.each_descendant(:send).select do |method_node| method_name.nil? || method_name == method_node.method_name end end |
#find_instance_call(node, name) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Matches receiver part of method. Yields to a block with parent node of receiver.
201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'rubocops/shared/helper_functions.rb', line 201 def find_instance_call(node, name) node.each_descendant(:send) do |method_node| next if method_node.receiver.nil? next if method_node.receiver.const_name != name && !(method_node.receiver.send_type? && method_node.receiver.method_name == name) @offensive_node = method_node.receiver return true unless block_given? yield method_node end end |
#find_instance_method_call(node, instance, method_name) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Matches a method with a receiver. Yields to a block with matching method node.
183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'rubocops/shared/helper_functions.rb', line 183 def find_instance_method_call(node, instance, method_name) methods = find_every_method_call_by_name(node, method_name) methods.each do |method| next if method.receiver.nil? next if method.receiver.const_name != instance && !(method.receiver.send_type? && method.receiver.method_name == instance) @offensive_node = method return true unless block_given? yield method end end |
#find_method_calls_by_name(node, method_name) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns an array of method call nodes matching method_name inside node with depth first order (child nodes).
130 131 132 133 134 135 136 137 138 139 |
# File 'rubocops/shared/helper_functions.rb', line 130 def find_method_calls_by_name(node, method_name) return if node.nil? nodes = node.each_child_node(:send).select { |method_node| method_name == method_node.method_name } # The top level node can be a method nodes << node if node.send_type? && node.method_name == method_name nodes end |
#find_method_def(node, method_name = nil) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns a method definition node with method_name. Returns first method def if method_name is nil.
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'rubocops/shared/helper_functions.rb', line 272 def find_method_def(node, method_name = nil) return if node.nil? node.each_child_node(:def) do |def_node| def_method_name = method_name(def_node) next if method_name != def_method_name && method_name.present? @offensive_node = def_node return def_node end return if node.parent.nil? # If not found then, parent node becomes the offensive node @offensive_node = node.parent nil end |
#find_method_with_args(node, method_name, *args) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Given a method_name and arguments, yields to a block with matching method passed as a parameter to the block.
167 168 169 170 171 172 173 174 175 |
# File 'rubocops/shared/helper_functions.rb', line 167 def find_method_with_args(node, method_name, *args) methods = find_every_method_call_by_name(node, method_name) methods.each do |method| next unless parameters_passed?(method, args) return true unless block_given? yield method end end |
#find_node_method_by_name(node, method_name) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns method_node matching method_name.
108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'rubocops/shared/helper_functions.rb', line 108 def find_node_method_by_name(node, method_name) return if node.nil? node.each_child_node(:send) do |method_node| next if method_node.method_name != method_name @offensive_node = method_node return method_node end # If not found then, parent node becomes the offensive node @offensive_node = node.parent nil end |
#find_strings(node) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns all string nodes among the descendants of given node.
100 101 102 103 104 105 |
# File 'rubocops/shared/helper_functions.rb', line 100 def find_strings(node) return [] if node.nil? return [node] if node.str_type? node.each_descendant(:str) end |
#format_component(component_node) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns printable component name.
403 404 405 406 407 |
# File 'rubocops/shared/helper_functions.rb', line 403 def format_component(component_node) return component_node.method_name if component_node.send_type? || component_node.block_type? method_name(component_node) if component_node.def_type? end |
#line_number(node) ⇒ Integer
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns the line number of the node.
53 54 55 |
# File 'rubocops/shared/helper_functions.rb', line 53 def line_number(node) node.loc.line end |
#line_start_column(node) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns the begin position of the node’s line in source code.
42 43 44 |
# File 'rubocops/shared/helper_functions.rb', line 42 def line_start_column(node) node.source_range.source_buffer.line_range(node.loc.line).begin_pos end |
#method_called?(node, method_name) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Check if method_name is called among the direct children nodes in the given node. Check if the node itself is the method.
303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'rubocops/shared/helper_functions.rb', line 303 def method_called?(node, method_name) if node.send_type? && node.method_name == method_name offending_node(node) return true end node.each_child_node(:send) do |call_node| next if call_node.method_name != method_name offending_node(call_node) return true end false end |
#method_called_ever?(node, method_name) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Check if method_name is called among every descendant node of given node.
318 319 320 321 322 323 324 325 326 |
# File 'rubocops/shared/helper_functions.rb', line 318 def method_called_ever?(node, method_name) node.each_descendant(:send) do |call_node| next if call_node.method_name != method_name @offensive_node = call_node return true end false end |
#method_name(node) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns the method name for a def node.
388 389 390 |
# File 'rubocops/shared/helper_functions.rb', line 388 def method_name(node) node.children[0] if node.def_type? end |
#node_equals?(node, var) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
To compare node with appropriate Ruby variable.
230 231 232 |
# File 'rubocops/shared/helper_functions.rb', line 230 def node_equals?(node, var) node == Parser::CurrentRuby.parse(var.inspect) end |
#offending_node(node = nil) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Gets/sets the given node as the offending node when required in custom cops.
123 124 125 126 127 |
# File 'rubocops/shared/helper_functions.rb', line 123 def offending_node(node = nil) return @offensive_node if node.nil? @offensive_node = node end |
#parameters(method_node) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns the array of arguments of the method_node.
355 356 357 |
# File 'rubocops/shared/helper_functions.rb', line 355 def parameters(method_node) method_node.arguments if method_node.send_type? || method_node.block_type? end |
#parameters_passed?(method_node, params) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns true if the given parameters are present in method call and sets the method call as the offending node. Params can be string, symbol, array, hash, matching regex.
362 363 364 365 366 367 368 369 370 371 372 373 374 |
# File 'rubocops/shared/helper_functions.rb', line 362 def parameters_passed?(method_node, params) method_params = parameters(method_node) @offensive_node = method_node params.all? do |given_param| method_params.any? do |method_param| if given_param.instance_of?(Regexp) regex_match_group(method_param, given_param) else node_equals?(method_param, given_param) end end end end |
#problem(msg, &block) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
95 96 97 |
# File 'rubocops/shared/helper_functions.rb', line 95 def problem(msg, &block) add_offense(@offensive_node, message: msg, &block) end |
#regex_match_group(node, pattern) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Checks for regex match of pattern in the node and sets the appropriate instance variables to report the match.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'rubocops/shared/helper_functions.rb', line 21 def regex_match_group(node, pattern) string_repr = string_content(node).encode("UTF-8", invalid: :replace) match_object = string_repr.match(pattern) return unless match_object node_begin_pos = start_column(node) line_begin_pos = line_start_column(node) @column = if node_begin_pos == line_begin_pos node_begin_pos + match_object.begin(0) - line_begin_pos else node_begin_pos + match_object.begin(0) - line_begin_pos + 1 end @length = match_object.to_s.length @line_no = line_number(node) @source_buf = source_buffer(node) @offensive_node = node @offensive_source_range = source_range(@source_buf, @line_no, @column, @length) match_object end |
#size(node) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns the node size in the source code.
393 394 395 |
# File 'rubocops/shared/helper_functions.rb', line 393 def size(node) node.source_range.size end |
#source_buffer(node) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Source buffer is required as an argument to report style violations.
58 59 60 |
# File 'rubocops/shared/helper_functions.rb', line 58 def source_buffer(node) node.source_range.source_buffer end |
#start_column(node) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns the begin position of the node in source code.
47 48 49 |
# File 'rubocops/shared/helper_functions.rb', line 47 def start_column(node) node.source_range.begin_pos end |
#string_content(node, strip_dynamic: false) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns the string representation if node is of type str(plain) or dstr(interpolated) or const.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'rubocops/shared/helper_functions.rb', line 63 def string_content(node, strip_dynamic: false) case node.type when :str node.str_content when :dstr content = "" node.each_child_node(:str, :begin) do |child| content += if child.begin_type? strip_dynamic ? "" : child.source else child.str_content end end content when :send if node.method?(:+) && (node.receiver.str_type? || node.receiver.dstr_type?) content = string_content(node.receiver) arg = node.arguments.first content += string_content(arg) if arg content else "" end when :const node.const_name when :sym node.children.first.to_s else "" end end |


{% for department in department_list %}
-
-
Chairman : {{department.chairman}}
Total teachers in {{department.name}} : {{department.teachers.count}}
Total students in {{department.name}} : {{department.students.count}}
-
Established at: {{department.established_date}}
{% endfor %}
{% endif %}


What a great day to start recording some grades!


Immigrant Entrepreneur
Andy moved to the United States from Milan, Italy as a student athlete at UC Santa Cruz. Shortly after college he began
his career at Panda Express Restaurant in Palo Alto, CA. Passionate about food and fitness he had his first
entrepreneurship stint in 2015 as a food truck owner in Silicon Valley. Soon after, his company evolved into an online
fitness food delivery service for athletes, MealPro. Today andy is the venture backed CEO of MealPro, he holds a
B.A. in Economics from UC Santa Cruz and is an advocate for entrepreneurship in everyday life. In his free time Andy
enjoys speaking at schools to educate about entreprneurship and enjoys mentoring student lead startups in B2C
eCommerce food or fitness space in his startup mentoring program.
Read Full Entrepreneurship Story


---
layout: post
title: Rancid - Time bomb
date: '2010-01-28T11:12:00.003+02:00'
author: Vlad Dumitru
tags:
- Vlad Dumitru
- punk
modified_time: '2010-05-06T03:11:31.494+03:00'
blogger_id: tag:blogger.com,1999:blog-551549162106413340.post-2215598070865983354
blogger_orig_url: http://pentrumuzica.blogspot.com/2010/01/rancid-time-bomb.html
---
niste ska-punk cu Rancid:


BREAKAWAY TRAVEL AGENCY
Dedicated to discovering our Planet's Treasures"
Can't Decide where to go on vacation this time?
Use our quick and easy vacation finder tool to help out.
Do you prefer to view the wonders of nature or the marvels of mankind?
Nature
Mankind
Do you prefer a warmer climate or does the discovery of wonders outweigh this decision?
Warm
Discovery
Do you prefer activity that is hands on or passing by with a camera?
HandsOn
Camera
hile on vacation do you prefer a heavy activity list or a more laid back relaxing schedule?
Action
Relaxing
Are you planning a special occassion celebration for yourself and significant other or are you planning a family vacation?
Special
Family


{% extends 'contact_detail.html' %} {% block content %}
Are you sure you want to delete this contact? If this contact is associated with any hackathon leads, that data will also be deleted!
THIS WILL DELETE {{ leads|length }} LEADS FOR {{ sponsorships|length }} AFFILIATED HACKATHON SPONSORSHIPS! Please ensure that there are no related items below before deleting.


Text 8.1
niwu=riba:-',
he sharpened itc
niwu=riba:-',
he sharpened itc
Gecko. (At) that place, Aminyjama. Gecko was sharpening his axe. A 'devil' (ghost) went along, from the stringybark scrub.
Note: warwar is a kind of thick scrub formed by closely packed, stunted stringybark trees (Eucalyptus tetradonta), characteristic of the inland estate of the Numamudidi clan.  It would probably have been better to use the term badangu instead of waragu for 'axe' since waragu tends to refer to modern metal axes instead of old-fashioned stone axes (which of course are involved in this myth), but the two terms are often interchanged.
Text 8.2
It (the devil) heard him (Gecko) making a loud sound (sharpening the axe). It heard him making a loud sound sharpening the axe. Fly ran along (and buzzed around Gecko). He (Gecko) smashed him. Gecko, that is his name.
* /ninggu-aG -lhud=yanga-ng/
** /na-niG-muwaj-yung/ with MSgder prefix -niG
Text 8.3
ni=mindhi-ny,
he flashedp
After that, the devil came close (attracted by the stench of the smashed insect). He (Gecko) did this, he looked back over his shoulder. It (devil) was going along not far away. It was coming very close. Then that Gecko flashed (lightning) and killed it.
Text 8.4
wu=lalagi-'-ny,
it got upp
It (devil) died, then got up again. Then he, Gecko, rushed that way, to the place Alil. There he sat (stopped), and waited for it, the devil.
Text 8.5
niwu=wurdha-ngi,
he buried itc
niwu=wurdha-ngi
he buried itc
It was coming very close. He (Gecko) killed it again. After that he killed the devil and it died. He ran along again, to that country (name forgotten). He covered up a pandanus basket in the sand.
Text 8.6
niwa:-'ru-ny,
he abandoned itp
an-uba-ni:-'la
after that
He went away from it (pandanus basket). He killed it (devil) there, where he had buried the pandanus basket. Again after that he ran along, (to) whatchamacallit, the place Aminyjama. There he went walking through the water, it was shallow, that river.
Text 8.7
ni-ngalba=walga-ny,
he jumped into waterp
ni=rararbi-ny,
he went down to waterp
He rushed along, (to) the place Aminyjama. Oops, I mean Niw angala. (Or rather) Arba:ri. He went down to the water and plunged in. There he sits now (as a dreaming), Gecko's body.


Anger over Las Vegas ban on sleeping in streets
LOS ANGELES: Faced with a growing number of homeless people, Las Vegas has passed a controversial law that bans sleeping on the street and imposes punishments of a US$1,000 fine and six months in prison.
The ordinance - the latest in a series of measures by US cities to grapple with rising vagrancy - comes into force Sunday (Nov 10), but its criminal provisions will not be applied until February.
Sleeping on the streets of the gambling hub will only be illegal in downtown Las Vegas and residential areas - not the famous casino "Strip", which comes under a different jurisdiction.
It will not apply when homeless shelters are full.
Opponents of the law focused their anger on Las Vegas Mayor Carolyn Goodman before and during the vote late Wednesday.
Demonstrators outside City Hall chanted "Housing, not handcuffs" and held signs proclaiming "Poverty is not a crime", local media reported.
Goodman said the law is necessary for a city that is highly dependent on tourism revenues and to protect "the health and safety of the entire community".
The law is not intended to punish the homeless but to help with their reintegration into society, she said, according to NPR radio.
It has been backed by Las Vegas's Chamber of Commerce.
According to the latest census, 5,500 people sleep on the streets of southern Nevada each night. Only 2,000 beds are available through municipal services and charities.
The measure has drawn criticism from beyond Las Vegas, including from several Democratic presidential candidates.
The explosion in the number of homeless people in the United States - especially in California and New York, where housing prices have soared in recent years - could become an issue in the 2020 election.
Las Vegas has tried to tackle the issue before. The city council has banned public food handouts, briefly closed public parks, and even banned sleeping within 150m of feces.
Former mayor Oscar Goodman, the husband of the current mayor, once even proposed shipping homeless people to an abandoned prison 30 miles outside the city, the USA Today newspaper said.


MX MASTER 2S
The new possibility machine
Logitech’s flagship mouse is designed for power users and masters of their craft who want to get more done, more efficiently.
The new possibility machine
Logitech’s flagship mouse is designed for power users and masters of their craft who want to get more done, more efficiently.


clickhouse_ecto v0.2.4 ClickhouseEcto.Query View Source
Link to this section Summary
Functions
Receives a query and must return a SELECT query
Clickhouse doesn’t support delete
Clickhouse doesn’t support delete
Returns an INSERT for the given rows
in table
returning
the given returning
Clickhouse doesn’t support update
Receives a query and values to update and must return an UPDATE query
Link to this section Functions
Receives a query and must return a SELECT query.
Clickhouse doesn’t support delete
Link to this function
delete_all(query)
View Source
delete_all(query :: Ecto.Query.t()) :: String.t()
Clickhouse doesn’t support delete
Returns an INSERT for the given rows
in table
returning
the given returning
.
Clickhouse doesn’t support update
Receives a query and values to update and must return an UPDATE query.


{% extends 'articles/base.html' %} {% block title %}Logged Out{% endblock %} {% block content %} {% load static %}
Here are some useful links for you, log back in or go back to home page.


| Package | com.whirled.contrib.avrg.oneroom |
| Class | public class OneRoomGameServer |
| Inheritance | OneRoomGameServer com.whirled.ServerObject |
import com.whirled.contrib.avrg.oneroom.OneRoomGameServer;
public class Server extends OneRoomGameServer { roomType = MyRoomType; }
MyRoomType
in the example must be a subclass of OneRoomGameRoom
.
Instances of this type will be created as needed and those instances will effectively handle
all game activity.
See also
| Property | Defined by | ||
|---|---|---|---|
| gameCtrl : AVRServerGameControl [read-only]
Accesses the game control for this server agent.
| OneRoomGameServer | ||
| log : Log [static] The log sink associated with this agent.
| OneRoomGameServer | ||
| roomType : Class [static] The type of room objects to create.
| OneRoomGameServer |
| Property | Defined by | ||
|---|---|---|---|
| _gameCtrl : AVRServerGameControl The game control for this server agent.
| OneRoomGameServer | ||
| _rooms : Dictionary Mapping of room ids to OneRoomGameRoom instances.
| OneRoomGameServer |
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new server agent for a game that takes place in exactly one room.
| OneRoomGameServer |
| Method | Defined by | ||
|---|---|---|---|
|
createRoom(roomId:int):OneRoomGameRoom
Creates a new room.
| OneRoomGameServer | ||
|
enteredRoom(evt:AVRGamePlayerEvent):void
Tells the agent that a player has entered a room.
| OneRoomGameServer | ||
|
leftRoom(evt:AVRGamePlayerEvent):void
Tells the agent that a player has left a room.
| OneRoomGameServer | ||
|
playerJoinedGame(evt:AVRGameControlEvent):void
Tells the agent that a player has joined the game.
| OneRoomGameServer | ||
|
playerQuitGame(evt:AVRGameControlEvent):void
Tells the agent that a player has quit the game.
| OneRoomGameServer |
| _gameCtrl | property |
protected var _gameCtrl:AVRServerGameControl
The game control for this server agent.
| gameCtrl | property |
gameCtrl:AVRServerGameControl
[read-only]Accesses the game control for this server agent.
Implementation public function get gameCtrl():AVRServerGameControl
| log | property |
public static var log:Log
The log sink associated with this agent.
| _rooms | property |
protected var _rooms:Dictionary
Mapping of room ids to OneRoomGameRoom instances.
| roomType | property |
public static var roomType:Class
The type of room objects to create. The caller must set this type when the server agent is
instantiated. The set value must be a subclass of OneRoomGameRoom
.
See also
| OneRoomGameServer | () | constructor |
public function OneRoomGameServer()
Creates a new server agent for a game that takes place in exactly one room.
| createRoom | () | method |
protected function createRoom(roomId:int):OneRoomGameRoom
Creates a new room. Subclasses should not normally need to override this.
ParametersroomId:int |
OneRoomGameRoom |
| enteredRoom | () | method |
protected function enteredRoom(evt:AVRGamePlayerEvent):void
Tells the agent that a player has entered a room. Takes care of creating a new room object if one does not already exist. This is called by whirled and subclasses should not normally need to override it.
Parametersevt:AVRGamePlayerEvent |
See also
| leftRoom | () | method |
protected function leftRoom(evt:AVRGamePlayerEvent):void
Tells the agent that a player has left a room. If this is the last player in the room, then
calls OneRoomGameRoom.shutdown
. This is called by whirled and subclasses should
not normally need to override it.
evt:AVRGamePlayerEvent |
See also
| playerJoinedGame | () | method |
protected function playerJoinedGame(evt:AVRGameControlEvent):void
Tells the agent that a player has joined the game. This is called by whirled and subclasses should not normally need to override it.
Parametersevt:AVRGameControlEvent |
| playerQuitGame | () | method |
protected function playerQuitGame(evt:AVRGameControlEvent):void
Tells the agent that a player has quit the game. This is called by whirled and subclasses should not normally need to override it.
Parametersevt:AVRGameControlEvent |


Source code for sparknlp.annotator.embeddings.longformer_embeddings
# Copyright 2017-2022 John Snow Labs
#
# 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.
"""Contains classes for LongformerEmbeddings."""
from sparknlp.common import *
[docs]class LongformerEmbeddings(AnnotatorModel,
HasEmbeddingsProperties,
HasCaseSensitiveProperties,
HasStorageRef,
HasBatchedAnnotate,
HasEngine,
HasLongMaxSentenceLengthLimit):
"""Longformer is a transformer model for long documents. The Longformer
model was presented in `Longformer: The Long-Document Transformer` by Iz
Beltagy, Matthew E. Peters, Arman Cohan. longformer-base-4096 is a BERT-like
model started from the RoBERTa checkpoint and pretrained for MLM on long
documents. It supports sequences of length up to 4,096.
Pretrained models can be loaded with :meth:`.pretrained` of the companion
object:
>>> embeddings = LongformerEmbeddings.pretrained() \\
... .setInputCols(["document", "token"]) \\
... .setOutputCol("embeddings")
The default model is ``"longformer_base_4096"``, if no name is provided. For
available pretrained models please see the `Models Hub
<https://sparknlp.org/models?task=Embeddings>`__.
To see which models are compatible and how to import them see
`Import Transformers into Spark NLP 🚀
<https://github.com/JohnSnowLabs/spark-nlp/discussions/5669>`_.
====================== ======================
Input Annotation types Output Annotation type
====================== ======================
``DOCUMENT, TOKEN`` ``WORD_EMBEDDINGS``
====================== ======================
Parameters
----------
batchSize
Size of every batch, by default 8
dimension
Number of embedding dimensions, by default 768
caseSensitive
Whether to ignore case in tokens for embeddings matching, by default
True
maxSentenceLength
Max sentence length to process, by default 1024
configProtoBytes
ConfigProto from tensorflow, serialized into byte array.
References
----------
`Longformer: The Long-Document Transformer
<https://arxiv.org/pdf/2004.05150.pdf>`__
**Paper Abstract:**
*Transformer-based models are unable to process long sequences due to their
self-attention operation, which scales quadratically with the sequence
length. To address this limitation, we introduce the Longformer with an
attention mechanism that scales linearly with sequence length, making it
easy to process documents of thousands of tokens or longer. Longformer's
attention mechanism is a drop-in replacement for the standard self-attention
and combines a local windowed attention with a task motivated global
attention. Following prior work on long-sequence transformers, we evaluate
Longformer on character-level language modeling and achieve state-of-the-art
results on text8 and enwik8. In contrast to most prior work, we also
pretrain Longformer and finetune it on a variety of downstream tasks. Our
pretrained Longformer consistently outperforms RoBERTa on long document
tasks and sets new state-of-the-art results on WikiHop and TriviaQA. We
finally introduce the Longformer-Encoder-Decoder (LED), a Longformer variant
for supporting long document generative sequence-to-sequence tasks, and
demonstrate its effectiveness on the arXiv summarization dataset.*
The original code can be found at `Longformer: The Long-Document Transformer
<https://github.com/allenai/longformer>`__.
Examples
--------
>>> import sparknlp
>>> from sparknlp.base import *
>>> from sparknlp.annotator import *
>>> from pyspark.ml import Pipeline
>>> documentAssembler = DocumentAssembler() \\
... .setInputCol("text") \\
... .setOutputCol("document")
>>> tokenizer = Tokenizer() \\
... .setInputCols(["document"]) \\
... .setOutputCol("token")
>>> embeddings = LongformerEmbeddings.pretrained() \\
... .setInputCols(["document", "token"]) \\
... .setOutputCol("embeddings") \\
... .setCaseSensitive(True)
>>> embeddingsFinisher = EmbeddingsFinisher() \\
>>> .setInputCols(["embeddings"]) \\
... .setOutputCols("finished_embeddings") \\
... .setOutputAsVector(True) \\
... .setCleanAnnotations(False)
>>> pipeline = Pipeline() \\
... .setStages([
... documentAssembler,
... tokenizer,
... embeddings,
... embeddingsFinisher
... ])
>>> data = spark.createDataFrame([["This is a sentence."]]).toDF("text")
>>> result = pipeline.fit(data).transform(data)
>>> result.selectExpr("explode(finished_embeddings) as result").show(5, 80)
+--------------------------------------------------------------------------------+
| result|
+--------------------------------------------------------------------------------+
|[0.18792399764060974,-0.14591649174690247,0.20547787845134735,0.1468472778797...|
|[0.22845706343650818,0.18073144555091858,0.09725798666477203,-0.0417917296290...|
|[0.07037967443466187,-0.14801117777824402,-0.03603338822722435,-0.17893412709...|
|[-0.08734266459941864,0.2486150562763214,-0.009067727252840996,-0.24408400058...|
|[0.22409197688102722,-0.4312366545200348,0.1401449590921402,0.356410235166549...|
+--------------------------------------------------------------------------------+
"""
name = "LongformerEmbeddings"
inputAnnotatorTypes = [AnnotatorType.DOCUMENT, AnnotatorType.TOKEN]
outputAnnotatorType = AnnotatorType.WORD_EMBEDDINGS
configProtoBytes = Param(Params._dummy(),
"configProtoBytes",
"ConfigProto from tensorflow, serialized into byte array. Get with config_proto.SerializeToString()",
TypeConverters.toListInt)
[docs] def setConfigProtoBytes(self, b):
"""Sets configProto from tensorflow, serialized into byte array.
Parameters
----------
b : List[int]
ConfigProto from tensorflow, serialized into byte array
"""
return self._set(configProtoBytes=b)
@keyword_only
def __init__(self, classname="com.johnsnowlabs.nlp.embeddings.LongformerEmbeddings", java_model=None):
super(LongformerEmbeddings, self).__init__(
classname=classname,
java_model=java_model
)
self._setDefault(
dimension=768,
batchSize=8,
maxSentenceLength=1024,
caseSensitive=True
)
@staticmethod
[docs] def loadSavedModel(folder, spark_session):
"""Loads a locally saved model.
Parameters
----------
folder : str
Folder of the saved model
spark_session : pyspark.sql.SparkSession
The current SparkSession
Returns
-------
LongformerEmbeddings
The restored model
"""
from sparknlp.internal import _LongformerLoader
jModel = _LongformerLoader(folder, spark_session._jsparkSession)._java_obj
return LongformerEmbeddings(java_model=jModel)
@staticmethod
[docs] def pretrained(name="longformer_base_4096", lang="en", remote_loc=None):
"""Downloads and loads a pretrained model.
Parameters
----------
name : str, optional
Name of the pretrained model, by default "longformer_base_4096"
lang : str, optional
Language of the pretrained model, by default "en"
remote_loc : str, optional
Optional remote address of the resource, by default None. Will use
Spark NLPs repositories otherwise.
Returns
-------
LongformerEmbeddings
The restored model
"""
from sparknlp.pretrained import ResourceDownloader
return ResourceDownloader.downloadModel(LongformerEmbeddings, name, lang, remote_loc)


THE COOK, THE THIEF, HIS WIFE & HER LOVER A film review by James Pellman Copyright 1990 James Pellman
SUMMARY: Not an entertainment, but an art film which does not compromise (even for the sake of "decency") its pure visions of beauty, cuisine, evil, greed, lust, and revenge. At times repulsive, it nonetheless is a beautifully crafted, unique, and thought-provoking film. * * * *
Rather than accept the X rating, the film's distributor has released it without a rating, but no one under 18 is admitted. Even with all these warnings, more than a few people in the audience walked out at various points.
You have been warned.
I enjoy seeing a movie which makes me think about it for several days after seeing it. When this one ended, I wasn't sure if I liked it or not. Having now thought about it for a few days, and realizing that there are certain images from it that I will never forget, I want to go see it again. I think the first viewing left me numb because it was so unlike anything I had seen before.
The Thief is Albert, a London gangster, who is sadistic, greedy, insensitive, and grotesque. Michael Gambon (who starred in PBS' "The Singing Detective") gives a bravura performance. Albert decides to use gourmet dining as a way to gain society's acceptance, and show off his wealth. He acquires an interest in London's finest French restaurant, and holds court there every night with his fellow gangsters and entourage of hoodlums.
The restaurant is run with perfection by the Cook, and its menu and decor are the ultimate in taste and refinement, with service beyond reproach. The depiction of the various areas of the restaurant, in which most of the action takes place, is one of the striking aspects of the film. The impossibly elegant dining room is dominated by a huge 17th Century Dutch painting, and at various times Albert and his gang seem to imitate poses from the painting. The perfectly coiffed and dressed diners (except for Albert and his crowd) and the fabulous food presentations form beautifully composed still lifes. The dining room is surrealistically juxtaposed with the cavernous dungeon-like kitchen, where hygiene is of little concern, and dozens of workers endlessly prepare mountains of food.
A different color is used in each area of the restaurant--red for the dining room, white for the bathrooms, green for the kitchen, and blue for the back alley behind the restaurant. The color of the costumes change as the characters move from one area to another, so that they are always perfectly coordinated. And the camera always moves with the characters from area to area.
In this setting, Albert yells at the restaurant staff, abuses and attacks the other diners, and makes fun of the food. As his wife walks towards the bathroom, he yells after her to be sure to wipe her bottom. His henchman casually vomits down his shirtfront. When the girlfriend of one of his henchmen challenges Albert, he disfigures her with the silverware.  Since Albert now owns the restaurant, the Cook can only stand by and watch.
The passing of time is indicated by shots of the changing daily menu, and in the seven days during which the action takes place, Albert's long-suffering wife Georgina, makes eye contact with a solitary diner, and quickly starts a passionate affair with him. They meet and make love in the restrooms, closets, and prep rooms of the kitchen at every possible opportunity, with the aid of the Cook.
Being naturally distrustful and suspicious, it is only a matter of time before Albert discovers the affair, and the tension of the various near escapes is almost unbearable. When Albert does find out, his revenge on the Lover is horrific. But Georgina also gets her revenge, and it is just as satisfying for us in the audience.
The actress who plays Georgina (Helen Mirren) calls the film a Jacobean drama (a form of theater from the days of James I that emphasized tragedy through violent action, spectacle, and revenge). The director (Peter Greenaway) refuses to discuss its meaning.
Being so graphic, it is not easy to sit through. But as Mirren points out, this film is no more graphic than the typical teenage slasher movies, which routinely get R ratings. What makes this more difficult to watch? In an article in the San Francisco Chronicle, Mirren said, "This is a film that pushes people's buttons. It gets to areas we're most prudish and prurient and embarrassed about. It gets under our skin. If you don't find it a bit much, you're a bit much yourself."
The San Francisco Chronicle review summed it up nicely: "What's more important [than the graphic nature of the film] is that it is a bracingly intelligent and often beautiful work--a chilling black comedy that tells its heartless story in a virtuoso style marked by visual elegance and dark, ironic wit. Anyone able to stomach its graphic imagery will find it an unsettling but unforgettable movie."
-- Jim Pellmann Internet<EMAIL_ADDRESS>.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


@JvmField protected val prefixSet: MutableSet<String>
The set of all prefixes registered in the command bank, for all commands.


Route
<Route handler={Component}>
<Route handler="{App}">
<Route path="thing-one" handler={ThingOne} />
<Route path="thing-two" handler={ThingTwo} />
</Route>
DefaultRoute
<DefaultRoute handler={Default} />
RouteHandler
is always renderedNotFoundRoute
<NotFoundRoute handler={RouteNotFound} />
Redirect
<Redirect from="old" to="new" />
Router.run()
Routes
, as previously definedRouter.HashLocation
Root
component and state
objectHashLocation
(default)HistoryLocation
uses the HTML5 browser history APIRefreshLocation
initiates full page reload on transitionRoot
RouteHandler
<RouteHandler />
where you would normally put the component for that routeRouteHandler
Link
<Link to="routeName" />


|
|
__kindof id< LPDScrollViewModelProtocol > | scrollViewModel |
| |
|
id< UITableViewDelegate > | delegate |
| |
|
id< UITableViewDataSource > | dataSource |
| |
|
LPDTableViewFactory * | tableViewFactory |
| |
|
RACSubject * | reloadDataSubject |
| |
|
RACSubject * | insertSectionsSubject |
| |
|
RACSubject * | deleteSectionsSubject |
| |
|
RACSubject * | replaceSectionsSubject |
| |
|
RACSubject * | reloadSectionsSubject |
| |
|
RACSubject * | insertRowsAtIndexPathsSubject |
| |
|
RACSubject * | deleteRowsAtIndexPathsSubject |
| |
|
RACSubject * | replaceRowsAtIndexPathsSubject |
| |
|
RACSubject * | reloadRowsAtIndexPathsSubject |
| |
|
RACSubject * | willDisplayCellSubject |
| |
|
RACSubject * | willDisplayHeaderViewSubject |
| |
|
RACSubject * | willDisplayFooterViewSubject |
| |
|
RACSubject * | didEndDisplayingCellSubject |
| |
|
RACSubject * | didEndDisplayingHeaderViewSubject |
| |
|
RACSubject * | didEndDisplayingFooterViewSubject |
| |
|
RACSubject * | didHighlightRowAtIndexPathSubject |
| |
|
RACSubject * | didUnhighlightRowAtIndexPathSubject |
| |
|
RACSubject * | didSelectRowAtIndexPathSubject |
| |
|
RACSubject * | didDeselectRowAtIndexPathSubject |
| |
|
RACSubject * | willBeginEditingRowAtIndexPathSubject |
| |
|
RACSubject * | didEndEditingRowAtIndexPathSubject |
| |
The documentation for this category was generated from the following file:
- LPDMvvmKit/Classes/Mvvm/ViewModels/LPDTableViewModel.m


{{< layout-referee}} {{$pageTitle}}About the person making this application{{/pageTitle}} {{$header}}
This is a passport application on behalf of Patrick Michael Smith.
These details were provided by the person making the application. Answer to the best of your knowledge.
Suzanne Angela Smith
Mother
Yes
A person responsible for the applicant has to maintain and protect them. Most parents are responsible for their children, unless for example a court order has said otherwise.


---
layout: game-page
redirect_from: /game/starbound-upgrade
title: Starbound Upgrade
year: 2007
semester: Fall
description: "Unique twist on a 2D space-shooter.
Starbound Upgrade, a revamp of the original Starbound, is a unique twist on the standard top-down space shooter. It features a game concept of evading enemies rather than directly attacking them. The primary goal of the player is to manipulate the enemies to try to force them to attack each other. It features an arcade mode where you can play for score or a story mode where you follow the tale of a guy out to save the galaxy."
tags: Windows Singleplayer
# tag options: "Windows", "Mac", "Linux",
# "Singleplayer", "Multiplayer",
# "Controller-Compatible", "VR",
# "Game-Jam"
project_members: {
Adam Greene: "Game Design, GUI Design",
Adam Lederer: Sound Effect Artist,
Eric Butler: "Project Lead, Programming, Music Composition",
Geoff Cameron: "Project Lead, Programming",
Linda Cai: "Background Art, Enemy Art",
Travis Mandel: Game Writing
}
stage_game_path: starbound-upgrade/
builds: {
Windows: starbound-upgrade.win32.zip
}
screenshots: [
screenshot1.jpg
]
# Optional
top-img-fit: cover
# top-img-fit options:
# "cover" - Cover the entire top area with the image, without squashing/stretching
# "fill" - Fit the FULL image into the top area, squashing/stretching as necessary
---


Poems, Puzzles, and Stories of Lewis Carroll
by Lewis Carroll
“The Walrus and the Carpenter”
Additional Information
- Year Published: 0
- Language: English
- Country of Origin: England
- Source: Walter Barnes, ed., Types of Children’s Literature: A Collection of the World’s Best Literature for Children, For Use in Colleges, Normal Schools and Library Schools
-
Readability:
- Flesch–Kincaid Level: 1.5
- Word Count: 812
- Genre: Poetry
- Keywords: folk story, trickery
- ✎ Cite This
Downloads
The sun was shining on the sea,
Shining with all his might;
He did his very best to make
The billows smooth and bright—
And this was odd, because it was
The middle of the night.
The moon was shining sulkily,
Because she thought the sun
Had got no business to be there
After the day was done—
“It’s very rude of him,” she said,
“To come and spoil the fun!”
The sea was wet as wet could be,
The sands were dry as dry.
You could not see a cloud, because
No cloud was in the sky;
No birds were flying overhead—
There were no birds to fly.
The Walrus and the Carpenter
Were walking close at hand;
They wept like anything to see
Such quantities of sand—
“If this were only cleared away,”
They said, “it would be grand!”
“If seven maids with seven mops
Swept it for half a year,
Do you suppose,” the Walrus said,
“That they could get it clear?”
“I doubt it,” said the Carpenter,
And shed a bitter tear.
“O Oysters, come and walk with us!”
The Walrus did beseech.
“A pleasant walk, a pleasant talk,
Along the briny beach;
We cannot do with more than four,
To give a hand to each.”
The eldest Oyster looked at him,
But never a word he said;
The eldest Oyster winked his eye,
And shook his heavy head—
Meaning to say he did not choose
To leave the Oyster bed.
But four young Oysters hurried up,
All eager for the treat;
Their coats were brushed, their faces washed,
Their shoes were clean and neat—
And this was odd, because, you know,
They hadn’t any feet.
Four other Oysters followed them,
And yet another four;
And thick and fast they came at last,
And more, and more, and more—
All hopping through the frothy waves,
And scrambling to the shore.
The Walrus and the Carpenter
Walked on a mile or so,
And then they rested on a rock
Conveniently low—
And all the little Oysters stood
And waited in a row.
“The time has come,” the Walrus said,
“To talk of many things:
Of shoes—and ships—and sealing wax—
Of cabbages—and kings—
And why the sea is boiling hot—
And whether pigs have wings.”
“But wait a bit,” the Oysters cried,
“Before we have our chat;
For some of us are out of breath,
And all of us are fat!”
“No hurry!” said the Carpenter.
They thanked him much for that.
“A loaf of bread,” the Walrus said,
“Is what we chiefly need;
Pepper and vinegar besides
Are very good indeed—
Now if you’re ready, Oysters dear,
We can begin to feed.”
“But not on us!” the Oysters cried,
Turning a little blue.
“After such kindness, that would be
A dismal thing to do!”
“The night is fine!” the Walrus said.
“Do you admire the view?
“It was so kind of you to come!
And you are very nice!”
The Carpenter said nothing but,
“Cut us another slice.
I wish you were not quite so deaf—
I’ve had to ask you twice!”
“It seems a shame,” the Walrus said.

The Carpenter said nothing but,
“The butter’s spread too thick!”
“I weep for you,” the Walrus said;
“I deeply sympathize.”
With sobs and tears he sorted out
Those of the largest size,
Holding his pocket handkerchief
Before his streaming eyes.
“O Oysters”, said the Carpenter,
“You’ve had a pleasant run!
Shall we be trotting home again?”
But answer came there none—
And this was scarcely odd, because
They’d eaten every one.


| 1 | package fr.sii.ogham.core.retry; | |
| 2 | ||
| 3 | import java.time.Instant; | |
| 4 | import java.util.List; | |
| 5 | ||
| 6 | /** | |
| 7 | * Retry several times with a fixed delay to wait after the last execution | |
| 8 | * failure until the maximum attempts is reached. A specific delay is used | |
| 9 | * between each execution. If there are more attempts than the configured | |
| 10 | * delays, the last delay is used for remaining attempts. | |
| 11 | * | |
| 12 | * If maximum attempts are set to 5 and delays are configured like this: | |
| 13 | *
 | |
| 14 | *
500ms
 | |
| 15 | *
750ms
 | |
| 16 | *
1800ms
 | |
| 17 | *
 | |
| 18 | * | |
| 19 | * If the action (named "connect" for the example) takes 100ms to execute before | |
| 20 | * failing, here is what happens: | |
| 21 | * | |
| 22 | *
 | |
| 23 | *
0: connect
 | |
| 24 | *
100: timeout
 | |
| 25 | *
600: connect
 | |
| 26 | *
700: timeout
 | |
| 27 | *
1450: connect
 | |
| 28 | *
1550: timeout
 | |
| 29 | *
3350: connect
 | |
| 30 | *
3450: timeout
 | |
| 31 | *
5250: connect
 | |
| 32 | *
5350: timeout
 | |
| 33 | *
7150: connect
 | |
| 34 | *
7250: timeout
 | |
| 35 | *
fail
 | |
| 36 | *
 | |
| 37 | * | |
| 38 | * | |
| 39 | * @author Aurélien Baudet | |
| 40 | * | |
| 41 | */ | |
| 42 | public class PerExecutionDelayRetry implements RetryStrategy { | |
| 43 | private final int maxRetries; | |
| 44 | private final List<Long> delays; | |
| 45 | private int retries; | |
| 46 | private int delayIdx; | |
| 47 | ||
| 48 | /** | |
| 49 | * Initializes with the maximum attempts and the delays to wait after a | |
| 50 | * failure. | |
| 51 | * | |
| 52 | * @param maxRetries | |
| 53 | * the maximum attempts | |
| 54 | * @param delays | |
| 55 | * the delays to wait after failure to do another attempt | |
| 56 | */ | |
| 57 | public PerExecutionDelayRetry(int maxRetries, List<Long> delays) { | |
| 58 | super(); | |
| 59 | this.maxRetries = maxRetries; | |
| 60 | this.delays = delays; | |
| 61 | retries = maxRetries; | |
| 62 | } | |
| 63 | ||
| 64 | @Override | |
| 65 | public boolean terminated() { | |
| 66 |
3
1. terminated : changed conditional boundary → RUN_ERROR 2. terminated : negated conditional → RUN_ERROR 3. terminated : replaced boolean return with true for fr/sii/ogham/core/retry/PerExecutionDelayRetry::terminated → RUN_ERROR |
return retries <= 0; |
| 67 | } | |
| 68 | ||
| 69 | @Override | |
| 70 | public Instant nextDate(Instant executionStartTime, Instant executionFailureTime) { | |
| 71 |
1
1. nextDate : Replaced integer subtraction with addition → RUN_ERROR |
retries--; |
| 72 |
1
1. nextDate : replaced return value with null for fr/sii/ogham/core/retry/PerExecutionDelayRetry::nextDate → RUN_ERROR |
return executionFailureTime.plusMillis(getNextDelay()); |
| 73 | } | |
| 74 | ||
| 75 | public int getRemainingRetries() { | |
| 76 |
1
1. getRemainingRetries : replaced int return with 0 for fr/sii/ogham/core/retry/PerExecutionDelayRetry::getRemainingRetries → RUN_ERROR |
return retries; |
| 77 | } | |
| 78 | ||
| 79 | public int getMaxRetries() { | |
| 80 |
1
1. getMaxRetries : replaced int return with 0 for fr/sii/ogham/core/retry/PerExecutionDelayRetry::getMaxRetries → NO_COVERAGE |
return maxRetries; |
| 81 | } | |
| 82 | ||
| 83 | public List<Long> getDelays() { | |
| 84 |
1
1. getDelays : replaced return value with Collections.emptyList for fr/sii/ogham/core/retry/PerExecutionDelayRetry::getDelays → NO_COVERAGE |
return delays; |
| 85 | } | |
| 86 | ||
| 87 | private long getNextDelay() { | |
| 88 |
2
1. getNextDelay : changed conditional boundary → RUN_ERROR 2. getNextDelay : negated conditional → RUN_ERROR |
if (delayIdx >= delays.size()) { |
| 89 |
2
1. getNextDelay : Replaced integer subtraction with addition → RUN_ERROR 2. getNextDelay : replaced long return with 0 for fr/sii/ogham/core/retry/PerExecutionDelayRetry::getNextDelay → RUN_ERROR |
return delays.get(delays.size() - 1); |
| 90 | } | |
| 91 | long delay = delays.get(delayIdx); | |
| 92 |
1
1. getNextDelay : Replaced integer addition with subtraction → RUN_ERROR |
delayIdx++; |
| 93 |
1
1. getNextDelay : replaced long return with 0 for fr/sii/ogham/core/retry/PerExecutionDelayRetry::getNextDelay → RUN_ERROR |
return delay; |
| 94 | } | |
| 95 | } | |
Mutations | ||
| 66 |
1.1 2.2 3.3 |
|
| 71 |
1.1 |
|
| 72 |
1.1 |
|
| 76 |
1.1 |
|
| 80 |
1.1 |
|
| 84 |
1.1 |
|
| 88 |
1.1 2.2 |
|
| 89 |
1.1 2.2 |
|
| 92 |
1.1 |
|
| 93 |
1.1 |


Overview¶
This page provides new users of the pymatgen code base with a quick overview of the pymatgen code base. It should also be pointed out that there is an examples page with many ipython notebook examples with actual code demonstrating the use of the code. Learning from those examples is the fastest way to get started.
Pymatgen is structured in a highly object-oriented manner. Almost everything (Element, Site, Structure, etc.) is an object. Currently, the code is heavily biased towards the representation and manipulation of crystals with periodic boundary conditions, though flexibility has been built in for molecules.
The core modules are in the (yes, you guess it) pymatgen.core package. Given the importance of this package for the overall functioning of the code, we have provided a quick summary of the various modules here:
pymatgen.core.periodic_table
: Everything begins here, where the Element and Specie (Element with an oxidation state) objects are defined. Unlike typical implementations, pymatgen’s Element object is rich, which means that each Element contains many useful properties associated with it, including atomic numbers, atomic masses, melting points, boiling points, just to name a few.pymatgen.core.lattice
: This module defines a Lattice object, which essentially defines the lattice vectors in three dimensions. The Lattice object provides convenience methods for performing fractional to cartesian coordinates and vice versa, lattice parameter and angles computations, etc.pymatgen.core.sites
: Defines the Site and PeriodicSite objects. A Site is essentially a coordinate point containing an Element or Specie. A PeriodicSite contains a Lattice as well.pymatgen.core.structure
: Defines the Structure and Molecule objects. A Structure and Molecule are simply a list of PeriodicSites and Site respectively.pymatgen.core.composition
: A Composition is simply a mapping of Element/Specie to amounts.
All units in pymatgen are typically assumed to be in atomic units, i.e., angstroms for lengths, eV for energies, etc. However, most objects do not assume any units per se and it should be perfectly fine for the most part no matter what units are being used, as long as they are used consistently.
Side-note : as_dict / from_dict¶
As you explore the code, you may notice that many of the objects have an as_dict method and a from_dict static method implemented. For most of the non-basic objects, we have designed pymatgen such that it is easy to save objects for subsequent use. While python does provide pickling functionality, pickle tends to be extremely fragile with respect to code changes. Pymatgen’s as_dict provide a means to save your work in a more robust manner, which also has the added benefit of being more readable. The dict representation is also particularly useful for entering such objects into certain databases, such as MongoDb. This as_dict specification is provided in the monty library, which is a general python supplementary library arising from pymatgen.
The output from an as_dict method is always json/yaml serializable. So if you want to save a structure, you may do the following:
with open('structure.json','w') as f:
json.dump(structure.as_dict(), f)
Similarly, to get the structure back from a json, you can do the following to restore the structure (or any object with a as_dict method) from the json as follows:
with open('structure.json', 'r') as f:
d = json.load(f)
structure = Structure.from_dict(d)
You may replace any of the above json commands with yaml in the PyYAML package to create a yaml file instead. There are certain tradeoffs between the two choices. JSON is much more efficient as a format, with extremely fast read/write speed, but is much less readable. YAML is an order of magnitude or more slower in terms of parsing, but is more human readable.
MontyEncoder/Decoder¶
Extensions of the standard Python JSONEncoder and JSONDecoder has been implemented to support pymatgen objects. The MontyEncoder uses the as_dict API of pymatgen to generate the necessary dict for converting into json. To use the MontyEncoder, simply add it as the cls kwarg when using json. For example,:
json.dumps(object, cls=MontyEncoder)
The MontyDecoder depends on finding a “@module” and “@class” key in the dict to decode the necessary python object. In general, the MontyEncoder will add these keys if they are not present, but for better long term stability (e.g., there may be situations where to_dict is called directly rather than through the encoder), the easiest way is to add the following to any to_dict property:
d["@module"] = self.__class__.__module__
d["@class"] = self.__class__.__name__
To use the MontyDecoder, simply specify it as the cls kwarg when using json load, e.g.:
json.loads(json_string, cls=MontyDecoder)
The decoder is written in such a way that it supports nested list and dict of pymatgen objects. When going through the nesting hirerachy, the decoder will look for the highest level module/class names specified and convert those to pymatgen objects.
The MontyEncoder/Decoder also supports datetime and numpy arrays out of box.
Structures and Molecules¶
For most applications, you will be creating and manipulating Structure/Molecule objects. There are several ways to create these objects:
Creating a Structure manually¶
This is generally the most painful method. Though sometimes necessary, it is seldom the method you would use. An example of creating the basic silicon crystal is provided below:
from pymatgen import Lattice, Structure, Molecule
coords = [[0, 0, 0], [0.75,0.5,0.75]]
lattice = Lattice.from_parameters(a=3.84, b=3.84, c=3.84, alpha=120,
beta=90, gamma=60)
struct = Structure(lattice, ["Si", "Si"], coords)
coords = [[0.000000, 0.000000, 0.000000],
[0.000000, 0.000000, 1.089000],
[1.026719, 0.000000, -0.363000],
[-0.513360, -0.889165, -0.363000],
[-0.513360, 0.889165, -0.363000]]
methane = Molecule(["C", "H", "H", "H", "H"], coords)
Note that both elements and species (elements with oxidation states) are supported. So both “Fe” and “Fe2+” are valid specifications.
Reading and writing Structures/Molecules¶
More often, you would already have the Structure/Molecule in one of many typical formats used (e.g., the Cystallographic Information Format (CIF), electronic structure code input / output, xyz, mol, etc.).
Pymatgen provides a convenient way to read structures and molecules via the from_file and to methods:
# Read a POSCAR and write to a CIF.
structure = Structure.from_file("POSCAR")
structure.to(filename="CsCl.cif")
# Read an xyz file and write to a Gaussian Input file.
methane = Molecule.from_file("methane.xyz")
methane.to(filename="methane.gjf")
The format is automatically guessed from the filename.
For more fine-grained control over which parsed to use, you can specify specific io packages. For example, to create a Structure from a cif:
from pymatgen.io.cif import CifParser
parser = CifParser("mycif.cif")
structure = parser.get_structures()[0]
Another example, creating a Structure from a VASP POSCAR/CONTCAR file:
from pymatgen.io.vasp import Poscar
poscar = Poscar.from_file("POSCAR")
structure = poscar.structure
Many of these io packages also provide the means to write a Structure to
various output formats, e.g. the CifWriter in pymatgen.io.cif
. In
particular, the pymatgen.io.vasp.sets
provides a powerful way to
generate complete sets of VASP input files from a Structure. In general,
most file format conversions can be done with a few quick lines of code. For
example, to read a POSCAR and write a cif:
from pymatgen.io.vasp import Poscar
from pymatgen.io.cif import CifWriter
p = Poscar.from_file('POSCAR')
w = CifWriter(p.struct)
w.write_file('mystructure.cif')
For molecules, pymatgen has in-built support for XYZ and Gaussian input and
output files via the pymatgen.io.xyz
and
pymatgen.io.gaussian
respectively:
from pymatgen.io.xyz import XYZ
from pymatgen.io.gaussian import GaussianInput
xyz = XYZ.from_file('methane.xyz')
gau = GaussianInput(xyz.molecule,
route_parameters={'SP': "", "SCF": "Tight"})
gau.write_file('methane.inp')
There is also support for more than 100 file types via the OpenBabel interface. But that requires you to install openbabel with Python bindings. Please see the installation guide.
Things you can do with Structures¶
This section is a work in progress. But just to give an overview of the kind of analysis you can do:
- Modify Structures directly or even better, using the
pymatgen .transformations
andpymatgen.alchemy
packages. - Analyse Structures. E.g., compute the Ewald sum using the
pymatgen.analysis.ewald
package, compare two structures for similarity usingpymatgen.analysis.structure_matcher
.
It should be noted that Structure and Molecule are designed to be mutable. In fact, they are the most basic mutable units (everything below in the class hierarchy such as Element, Specie, Site, PeriodicSite, Lattice are immutable). If you need guarantees of immutability for Structure/Molecule, you should use the IStructure and IMolecule classes instead.
Modifying Structures or Molecules¶
Pymatgen supports a highly Pythonic interface for modifying Structures and Molecules. For example, you can change any site simply with:
# Change the specie at site position 1 to a fluorine atom.
structure[1] = "F"
molecule[1] = "F"
# Change species and coordinates (fractional assumed for Structures,
# cartesian for Molecules)
structure[1] = "Cl", [0.51, 0.51, 0.51]
molecule[1] = "F", [1.34, 2, 3]
# Structure/Molecule also supports typical list-like operators,
# such as reverse, extend, pop, index, count.
structure.reverse()
molecule.reverse()
structure.append("F", [0.9, 0.9, 0.9])
molecule.append("F", [2.1, 3,.2 4.3])
There are also many typical transforms you can do on Structures. Here are some examples:
# Make a supercell
structure.make_supercell([2, 2, 2])
#Find a primitive version of the Structure
structure.find_primitive_structure()
# Interpolate between two structures to get 10 structures (typically for
# NEB calculations.
structure.interpolate(another_structure, nimages=10)
The above is just some examples of typical use cases. A lot more is possible and you may explore the actual API doc for the structure and molecule classes.
Entries - Basic analysis unit¶
Beyond the core Element, Site and Structure objects, most analyses within in
pymatgen (e.g., creating a PhaseDiagram) are performed using Entry objects. An
Entry in its most basic form contains a calculated energy and a composition,
and may optionally contain other input or calculated data. In most instances,
you will use the ComputedEntry or ComputedStructureEntry objects defined in
pymatgen.entries.computed_entries
. ComputedEntry objects can be created
by either manually parsing calculated data calculations, or by using the
pymatgen.apps.borg
package.
Compatibility - Mixing GGA and GGA+U runs¶
The Ceder group has developed a scheme where by GGA and GGA+U calculations can be “mixed” such that analyses may be performed using the type of calculation most appropriate for each entry. For instance, to generate a Fe-P-O phase diagram, metallic phases such as Fe and FexPy are most appropriately modelled using standard GGA, while a hubbard U should be applied for the oxides such as FexOy and FexPyOz.
In the pymatgen.io.vasp.sets
module, pre-defined parameter sets have
been coded to allow users to generate VASP input files that are consistent
with input parameters that are compatible with the Materials Project data.
Users who wish to perform analysis using runs calculated using these
parameters should post-process entries generated from these runs using the
appropriate compatibility. For example, if a user wants to generate a phase
diagram from a list of entries generated from Fe-P-O vasp runs,
he should use the following procedure:
from pymatgen.entries.compatibility import MaterialsProjectCompatibility
from pymatgen.analysis.phase_diagram import PhaseDiagram, PDPlotter
# Get unprocessed_entries using pymatgen.borg or other means.
# Process the entries for compatibility
compat = MaterialsProjectCompatibility()
processed_entries = compat.process_entries(unprocessed_entries)
# These few lines generates the phase diagram using the ComputedEntries.
pd = PhaseDiagram(processed_entries)
plotter = PDPlotter(pd)
plotter.show()
pymatgen.borg - High-throughput data assimilation¶
The borg package is still a work in progress, but a lot can already be done with it. The basic concept is to provide a convenient means to assimilate large quantities of data in a directory structure. For now, the main application is the assimilation of entire directory structures of VASP calculations into usable pymatgen entries, which can then be used for phase diagram and other analyses. The outline of how it works is as follows:
- Drones are defined in the
pymatgen.apps.borg.hive
module. A Drone is essentially an object which defines how a directory is parsed into a pymatgen object. For example, the VaspToComputedEntryDrone defines how a directory containing a vasp run (with a vasprun.xml file) is converted into ComputedEntry. - The BorgQueen object in
pymatgen.apps.borg.queen
module uses Drones to assimilate an entire subdirectory structure. Parallel processing is used where possible to speed up the process.
Simple example - Making a phase diagram¶
Let’s say you want to make the Li-O phase diagram. You have calculated all Li, O, and Li-O compounds you are interested in and the runs are in the directory “Li-O_runs”. You can then generate the phase diagram using the following few lines of code:
from pymatgen.borg.hive import VaspToComputedEntryDrone
from pymatgen.borg.queen import BorgQueen
from pymatgen.analysis.phase_diagram import PhaseDiagram, PDPlotter
# These three lines assimilate the data into ComputedEntries.
drone = VaspToComputedEntryDrone()
queen = BorgQueen(drone, "Li-O_runs", 2)
entries = queen.get_data()
# It's a good idea to perform a save_data, especially if you just assimilated
# a large quantity of data which took some time. This allows you to reload
# the data using a BorgQueen initialized with only the drone argument and
# calling queen.load_data("Li-O_entries.json")
queen.save_data("Li-O_entries.json")
# These few lines generates the phase diagram using the ComputedEntries.
pd = PhaseDiagram(entries)
plotter = PDPlotter(pd)
plotter.show()
In this example, neither Li nor O requires a Hubbard U. However, if you are making a phase diagram from a mix of GGA and GGA+U entries, you may need to post-process the assimilated entries with a Compatibility object before running the phase diagram code. See earlier section on entries and compatibility.
Another example - Calculating reaction energies¶
Another example of a cool thing you can do with the loaded entries is to calculate reaction energies. For example, reusing the Li-O data we have saved in the above step:
from pymatgen.apps.borg.hive import VaspToComputedEntryDrone
from pymatgen.apps.borg.queen import BorgQueen
from pymatgen.analysis.reaction_calculator import ComputedReaction
# These three lines assimilate the data into ComputedEntries.
drone = VaspToComputedEntryDrone()
queen = BorgQueen(drone)
queen.load_data("Li-O_entries.json")
entries = queen.get_data()
#Extract the correct entries and compute the reaction.
rcts = filter(lambda e: e.composition.reduced_formula in ["Li", "O2"], entries)
prods = filter(lambda e: e.composition.reduced_formula == "Li2O", entries)
rxn = ComputedReaction(rcts, prods)
print rxn
print rxn.calculated_reaction_energy
pymatgen.transformations¶
The pymatgen.transformations
package is the standard package for
performing transformations on structures. Many transformations are already
supported today, from simple transformations such as adding and removing
sites, and replacing species in a structure to more advanced one-to-many
transformations such as partially removing a fraction of a certain species
from a structure using an electrostatic energy criterion. The Transformation
classes follow a strict API. A typical usage is as follows:
from pymatgen.io.cif import CifParser
from pymatgen.transformations.standard_transformations import RemoveSpecieTransformations
# Read in a LiFePO4 structure from a cif.
parser = CifParser('LiFePO4.cif')
struct = parser.get_structures()[0]
t = RemoveSpeciesTransformation(["Li"])
modified_structure = t.apply_transformation(struct)
pymatgen.alchemy - High-throughput transformations¶
The pymatgen.alchemy
package is a framework for performing
high-throughput (HT) structure transformations. For example, it allows a user
to define a series of transformations to be applied to a set of structures,
generating new structures in the process. The framework is also designed to
provide proper logging of all changes performed on structures,
with infinite undo. The main classes are:
pymatgen.alchemy.materials.TransformedStructure
- Standard object representing a TransformedStructure. Takes in an input structure and a list of transformations as an input. Can also be generated from cifs and POSCARs.pymatgen.alchemy.transmuters.StandardTransmuter
- An example of a Transmuter class, which takes a list of structures, and apply a sequence of transformations on all of them.
Usage example - replace Fe with Mn and remove all Li in all structures:
from pymatgen.alchemy.transmuters import CifTransmuter
from pymatgen.transformations.standard_transformations import SubstitutionTransformation, RemoveSpeciesTransformation
trans = []
trans.append(SubstitutionTransformation({"Fe":"Mn"}))
trans.append(RemoveSpecieTransformation(["Lu"]))
transmuter = CifTransmuter.from_filenames(["MultiStructure.cif"], trans)
structures = transmuter.transformed_structures
pymatgen.matproj.rest - Integration with the Materials Project REST API¶
In version 2.0.0 of pymatgen, we introduced one of the most powerful and useful tools yet - an adaptor to the Materials Project REST API. The Materials Project REST API (simply Materials API) was introduced to provide a means for users to programmatically query for materials data. This allows users to efficiently perform structure manipulation and analyses without going through the web interface.
In parallel, we have coded in the pymatgen.ext.matproj
module a
MPRester, a user-friendly high-level interface to the Materials API to obtain
useful pymatgen objects for further analyses. To use the Materials API,
your need to first register with the Materials Project and generate your API
key in your dashboard at https://www.materialsproject.org/dashboard. In the
examples below, the user’s Materials API key is designated as “USER_API_KEY”.
The MPRester provides many convenience methods, but we will just highlight a few key methods here.
To obtain information on a material with Materials Project Id “mp-1234”, one can use the following:
with MPRester("USER_API_KEY") as m:
# Structure for material id
structure = m.get_structure_by_material_id("mp-1234")
# Dos for material id
dos = m.get_dos_by_material_id("mp-1234")
# Bandstructure for material id
bandstructure = m.get_bandstructure_by_material_id("mp-1234")
The Materials API also allows for query of data by formulas:
# To get a list of data for all entries having formula Fe2O3
data = m.get_data("Fe2O3")
# To get the energies of all entries having formula Fe2O3
energies = m.get_data("Fe2O3", "energy")
Finally, the MPRester provides methods to obtain all entries in a chemical system. Combined with the borg framework, this provides a particularly powerful way to combine one’s own calculations with Materials Project data for analysis. The code below demonstrates the phase stability of a new calculated material can be determined:
from pymatgen.ext.matproj import MPRester
from pymatgen.apps.borg.hive import VaspToComputedEntryDrone
from pymatgen.apps.borg.queen import BorgQueen
from pymatgen.entries.compatibility import MaterialsProjectCompatibility
from pymatgen.analysis.phase_diagram import PhaseDiagram, PDPlotter
# Assimilate VASP calculations into ComputedEntry object. Let's assume that
# the calculations are for a series of new LixFeyOz phases that we want to
# know the phase stability.
drone = VaspToComputedEntryDrone()
queen = BorgQueen(drone, rootpath=".")
entries = queen.get_data()
# Obtain all existing Li-Fe-O phases using the Materials Project REST API
with MPRester("USER_API_KEY") as m:
mp_entries = m.get_entries_in_chemsys(["Li", "Fe", "O"])
# Combined entry from calculated run with Materials Project entries
entries.extend(mp_entries)
# Process entries using the MaterialsProjectCompatibility
compat = MaterialsProjectCompatibility()
entries = compat.process_entries(entries)
# Generate and plot Li-Fe-O phase diagram
pd = PhaseDiagram(entries)
plotter = PDPlotter(pd)
plotter.show()
The query method¶
For the most flexibility, you can also use the query method of the MPRester. This method allows any kind of mongo query to be performed on the Materials Project database. It also supports a simple string syntax with wild cards. Examples are given below:
from pymatgen.ext.matproj import MPRester
with MPRester("USER_API_KEY") as m:
# Get all energies of materials with formula "*2O".
results = m.query("*2O", ['energy'])
# Get the formulas and energies of materials with materials_id mp-1234
# or with formula FeO.
results = m.query("FeO mp-1234", ['pretty_formula', 'energy'])
# Get all compounds of the form ABO3
results = m.query("**O3", ['pretty_formula', 'energy'])
It is highly recommended that you consult the Materials API documentation at http://bit.ly/materialsapi, which provides a comprehensive explanation of the document schema used in the Materials Project and how best to query for the relevant information you need.
Setting the PMG_MAPI_KEY in the config file¶
MPRester can also read the API key via the pymatgen config file. Simply run:
pmg config --add PMG_MAPI_KEY <USER_API_KEY>
to add this to the .pmgrc.yaml, and you can now call MPRester without any arguments. This makes it much easier for heavy users of the Materials API to use MPRester without having to constantly insert their API key in the scripts.


BRAND NEW SHOES
Let's be honest, it won't FIX a broken shoe, but it will REMOVE scuffs, marks, dirt and more to make your shoes look brand new.
LAST SHOE CLEANER YOU'LL EVER BUY
Cleans up to 85+ shoes. To ensure that your shoes are spotless, we developed a specific formula of powerful ingredients that only requires a small amount to get the job done.
TAKES CARE OF MOST FABRICS
Apart from suede, which we know can be ruined if it gets wet. Our water based solution can clean most other fabrics. Leather, canvas, vinyl, knit, mesh, cotton, plastic, nylon, rubber and more.
First featurette heading. It’ll blow your mind.
Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.
Oh yeah, it’s that good. See for yourself.
Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.
And lastly, this one. Checkmate.
Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.


Some quick example text to build on the card title and make up the bulk of the card's content.
Add to CartSome quick example text to build on the card title and make up the bulk of the card's content.
Add to CartSome quick example text to build on the card title and make up the bulk of the card's content.
Add to CartSome quick example text to build on the card title and make up the bulk of the card's content.
Add to Cart


--- page: 'reference-detail' title: 'ons-splitter-side' name: 'ons-splitter-side' collection: 'components' reference: true docCategory: 'js' componentCategory: control ---
The "ons-splitter-side" element is used as a child element of "ons-splitter".
<ons-splitter>
<ons-splitter-content>
...
</ons-splitter-content>
<ons-splitter-side side="left" width="80%" collapse>
...
</ons-splitter-side>
</ons-splitter>
| Name | Type Default Value |
Description |
|---|---|---|
| animation | String | Specify the animation. Use one of "overlay", and "default". Optional Works only during initialization |
| animation-options | Expression |
Specify the animation's duration, timing and delay with an object literal. E.g. {duration: 0.2, delay: 1, timing: 'ease-in'}
Optional
|
| threhold-ratio-should-open | Number | Optional |
| ons-destroy | Expression | Allows you to specify custom behavior when the "destroy" event is fired. Optional Works only during initialization |
| ons-preopen | Expression | Allows you to specify custom behavior when the "preopen" event is fired. Optional Works only during initialization |
| ons-preclose | Expression | Allows you to specify custom behavior when the "preclose" event is fired. Optional Works only during initialization |
| ons-postopen | Expression | Allows you to specify custom behavior when the "postopen" event is fired. Optional Works only during initialization |
| ons-postclose | Expression | Allows you to specify custom behavior when the "postclose" event is fired. Optional Works only during initialization |
| collapse | String | Specify the collapse behavior. Valid values are "portrait", "landscape" or a media query. "portrait" or "landscape" means the view will collapse when device is in landscape or portrait orientation. If the value is a media query, the view will collapse when the media query is true. If the value is not defined, the view always be in "collapse" mode. Optional |
| swipe-target-width | String | The width of swipeable area calculated from the edge (in pixels). Use this to enable swipe only when the finger touch on the screen edge. Optional |
| width | String | Can be specified in either pixels or as a percentage, e.g. "90%" or "200px". Optional |
| side | String | Specify which side of the screen the ons-splitter-side element is located on. Possible values are "left" and "right". Optional |
| mode | String | Current mode. Possible values are "collapse" or "split". This attribute is read only. Optional |
| page | String | The url of the menu page. Optional Works only during initialization |
| swipeable | Boolean | Whether to enable swipe interaction on collapse mode. Optional |
| Signature | Description |
|---|---|
| load(page) | Show the page specified in pageUrl in the right section |
| open([options]) | Open menu in collapse mode. |
| close([options]) | Close menu in collapse mode. |
| getCurrentMode() |
| Name | Description |
|---|---|
| modechange | Fired just after the component's mode changes. |
| preopen | Fired just before the sliding menu is opened. |
| postopen | Fired just after the sliding menu is opened. |
| preclose | Fired just before the sliding menu is closed. |
| postclose | Fired just after the sliding menu is closed. |
Show the page specified in pageUrl in the right section
| Name | Type | Description |
|---|---|---|
| page | String | Page URL. Can be either an HTML document or an |
Open menu in collapse mode.
| Name | Type | Description |
|---|---|---|
| options | Object | Parameter object. |
| options.callback | Function | This function will be called after the menu has been opened. |
Close menu in collapse mode.
| Name | Type | Description |
|---|---|---|
| options | Object | Parameter object. |
| options.callback | Function | This function will be called after the menu has been closed. |
Returns: Get current mode. Possible values are "collapse" or "split".
Fired just after the component's mode changes.
| Name | Type | Description |
|---|---|---|
| event | Object | Event object. |
| event.side | Object | Component object. |
| event.mode | String | Returns the current mode. Can be either "collapse" or "split". |
Fired just before the sliding menu is opened.
| Name | Type | Description |
|---|---|---|
| event | Object | Event object. |
| event.cancel | Function | Call to cancel opening sliding menu. |
| event.side | Object | Component object. |
Fired just after the sliding menu is opened.
| Name | Type | Description |
|---|---|---|
| event | Object | Event object. |
| event.side | Object | Component object. |
Fired just before the sliding menu is closed.
| Name | Type | Description |
|---|---|---|
| event | Object | Event object. |
| event.side | Object | Component object. |
| event.cancel | Function | Call to cancel opening sliding-menu. |
Fired just after the sliding menu is closed.
| Name | Type | Description |
|---|---|---|
| event | Object | Event object. |
| event.side | Object | Component object. |


For visualization 1, this dataset recorded the average hours a day that college students spent doing different activities. I chose this dataset because it seemed interesting to me as a current student, and I wanted to compare my own standpoint of the data. I got the dataset from https://www.bls.gov/tus/charts/chart8.txt. For this dataset, I chose to create a grouped bar chart because each type of activity was divided into whether or not the college student was also employed or not, so we could group the information based on activities with groups of different employment types. For visualization 2, this dataset recorded the percentage of college students who spent time doing educational activities. The data is organized based on hours per day and divided into full-time and part-time students. I chose this data because I was curious to see the frequency of students doing educational activities, being a student who does so myself. I got this dataset from https://www.bls.gov/tus/charts/chart7.txt. For this visualization, I think a scatter plot is most appropriate for this data because the frequency of students spending time doing educational activities can be plotted to discover a possible trend in the timings. Also, we can use this to find a correlation between spending time on educational activities and if students do work part-time.
Use

tags to enclose a paragraph in html.
Use

to enclose a heading.
Use

to force a line break.
There are two premade div
in this document that will hold your visualizations. The first one has id vis1
, the second one has vis2
. Write your explanation and analysis close to each of your visualizations.
Your first visualization goes here:
Your second visualization goes here:
List here where any code, packages/libraries, text, images, designs, etc. that you leverage come from.