style fixes per flake8
This commit is contained in:
		
							parent
							
								
									8cbb0e9864
								
							
						
					
					
						commit
						8afe1d1f26
					
				
							
								
								
									
										29
									
								
								.flake8
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								.flake8
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					[flake8]
 | 
				
			||||||
 | 
					ignore =
 | 
				
			||||||
 | 
					    # E501 line too long
 | 
				
			||||||
 | 
					    E501,
 | 
				
			||||||
 | 
					    # W391 newlines at EOF
 | 
				
			||||||
 | 
					    W391,
 | 
				
			||||||
 | 
					    # E241 multiple spaces after comma
 | 
				
			||||||
 | 
					    E241,
 | 
				
			||||||
 | 
					    # E302 expected 2 newlines
 | 
				
			||||||
 | 
					    E302,
 | 
				
			||||||
 | 
					    # W503 line break before binary operator (to be deprecated)
 | 
				
			||||||
 | 
					    W503,
 | 
				
			||||||
 | 
					    # E265 block comment should start with '# '
 | 
				
			||||||
 | 
					    E265,
 | 
				
			||||||
 | 
					    # E123 closing bracket does not match indentation of opening bracket's line
 | 
				
			||||||
 | 
					    E123,
 | 
				
			||||||
 | 
					    # E124 closing bracket does not match visual indentation
 | 
				
			||||||
 | 
					    E124,
 | 
				
			||||||
 | 
					    # E221 multiple spaces before operator
 | 
				
			||||||
 | 
					    E221,
 | 
				
			||||||
 | 
					    # E201 whitespace after '['
 | 
				
			||||||
 | 
					    E201,
 | 
				
			||||||
 | 
					    # E741 ambiguous variable name 'I'
 | 
				
			||||||
 | 
					    E741,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					per-file-ignores =
 | 
				
			||||||
 | 
					    # F401 import without use
 | 
				
			||||||
 | 
					    */__init__.py: F401,
 | 
				
			||||||
@ -85,7 +85,7 @@ class Simulation(object):
 | 
				
			|||||||
                 queue: pyopencl.CommandQueue = None,
 | 
					                 queue: pyopencl.CommandQueue = None,
 | 
				
			||||||
                 float_type: numpy.float32 or numpy.float64 = numpy.float32,
 | 
					                 float_type: numpy.float32 or numpy.float64 = numpy.float32,
 | 
				
			||||||
                 do_poynting: bool = True,
 | 
					                 do_poynting: bool = True,
 | 
				
			||||||
                 do_poynting_halves = False,
 | 
					                 do_poynting_halves: bool = False,
 | 
				
			||||||
                 do_fieldsrc: bool = False):
 | 
					                 do_fieldsrc: bool = False):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        Initialize the simulation.
 | 
					        Initialize the simulation.
 | 
				
			||||||
@ -179,7 +179,7 @@ class Simulation(object):
 | 
				
			|||||||
        base_fields[ptr('E')] = self.E
 | 
					        base_fields[ptr('E')] = self.E
 | 
				
			||||||
        base_fields[ptr('H')] = self.H
 | 
					        base_fields[ptr('H')] = self.H
 | 
				
			||||||
        base_fields[ctype + ' dt'] = self.dt
 | 
					        base_fields[ctype + ' dt'] = self.dt
 | 
				
			||||||
        if uniform_dx == False:
 | 
					        if uniform_dx is False:
 | 
				
			||||||
            inv_dx_names = ['inv_d' + eh + r for eh in 'eh' for r in 'xyz']
 | 
					            inv_dx_names = ['inv_d' + eh + r for eh in 'eh' for r in 'xyz']
 | 
				
			||||||
            for name, field in zip(inv_dx_names, self.inv_dxes):
 | 
					            for name, field in zip(inv_dx_names, self.inv_dxes):
 | 
				
			||||||
                base_fields[ptr(name)] = field
 | 
					                base_fields[ptr(name)] = field
 | 
				
			||||||
@ -227,7 +227,6 @@ class Simulation(object):
 | 
				
			|||||||
            self.sources['F'] = F_source
 | 
					            self.sources['F'] = F_source
 | 
				
			||||||
            self.sources['G'] = G_source
 | 
					            self.sources['G'] = G_source
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        S_fields = OrderedDict()
 | 
					        S_fields = OrderedDict()
 | 
				
			||||||
        if do_poynting:
 | 
					        if do_poynting:
 | 
				
			||||||
            self.S = pyopencl.array.zeros_like(self.E)
 | 
					            self.S = pyopencl.array.zeros_like(self.E)
 | 
				
			||||||
@ -238,7 +237,6 @@ class Simulation(object):
 | 
				
			|||||||
            S_fields[ptr('S0')] = self.S0
 | 
					            S_fields[ptr('S0')] = self.S0
 | 
				
			||||||
            S_fields[ptr('S1')] = self.S1
 | 
					            S_fields[ptr('S1')] = self.S1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        J_fields = OrderedDict()
 | 
					        J_fields = OrderedDict()
 | 
				
			||||||
        if do_fieldsrc:
 | 
					        if do_fieldsrc:
 | 
				
			||||||
            J_source = jinja_env.get_template('update_j.cl').render(**jinja_args)
 | 
					            J_source = jinja_env.get_template('update_j.cl').render(**jinja_args)
 | 
				
			||||||
@ -249,7 +247,6 @@ class Simulation(object):
 | 
				
			|||||||
            J_fields[ptr('Jr')] = self.Jr
 | 
					            J_fields[ptr('Jr')] = self.Jr
 | 
				
			||||||
            J_fields[ptr('Ji')] = self.Ji
 | 
					            J_fields[ptr('Ji')] = self.Ji
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        '''
 | 
					        '''
 | 
				
			||||||
        PML
 | 
					        PML
 | 
				
			||||||
        '''
 | 
					        '''
 | 
				
			||||||
@ -273,9 +270,9 @@ class Simulation(object):
 | 
				
			|||||||
                                       arguments=', '.join(list(args.keys()) + var_args))
 | 
					                                       arguments=', '.join(list(args.keys()) + var_args))
 | 
				
			||||||
            self.update_J = lambda e, *a: update(*args.values(), *a, wait_for=e)
 | 
					            self.update_J = lambda e, *a: update(*args.values(), *a, wait_for=e)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    def _create_pmls(self, pmls):
 | 
					    def _create_pmls(self, pmls):
 | 
				
			||||||
        ctype = type_to_C(self.arg_type)
 | 
					        ctype = type_to_C(self.arg_type)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        def ptr(arg: str) -> str:
 | 
					        def ptr(arg: str) -> str:
 | 
				
			||||||
            return ctype + ' *' + arg
 | 
					            return ctype + ' *' + arg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user