当前位置: 首页>>代码示例>>Python>>正文


Python element.Element类代码示例

本文整理汇总了Python中element.Element的典型用法代码示例。如果您正苦于以下问题:Python Element类的具体用法?Python Element怎么用?Python Element使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Element类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, model, xc=0, yc=0, R=1, N=0.001, layer=0, name="CircAreasink", label=None):
     Element.__init__(self, model, Nparam=1, Nunknowns=0, layers=layer, name=name, label=label)
     self.xc = float(xc)
     self.yc = float(yc)
     self.R = float(R)
     self.N = float(N)
     self.model.add_element(self)
开发者ID:mbakker7,项目名称:timml,代码行数:7,代码来源:circareasink.py

示例2: __init__

    def __init__(self,
            mark_x,
            mark_y,
            pcb_name):
        Element.__init__(self,mark_x = mark_x,mark_y = mark_y,
                         pcb_name = pcb_name)

        num_dots = 7
        dot_pitch_x = 10.16 * MM

        cathode_offset_x = 7 * MM
        cathode_offset_y = 3.2 * MM

        class Dot:
            def __init__(self,x,y,i):
                d = {'thickness':1.3 * MM,
                     'clearance':0.1 * MM,
                     'mask':0.1 * MM,
                     'drillhole':1 * MM} # FIXME: check this!

                self.anode = Pin(x = x,y = y,
                                 number = i * 2 + 1,
                                 **d)
                self.cathode = Pin(x = x + cathode_offset_x,
                                   y = y + cathode_offset_y,
                                   number = i * 2 + 2,
                                   **d)

        self.dot = []
        x = 0
        for i in range(0,7):
            self.dot.append(Dot(x,0,i))
            x += dot_pitch_x
            self.pins.append(self.dot[i].anode)
            self.pins.append(self.dot[i].cathode)
开发者ID:petertodd,项目名称:entropy-oscillator.elec,代码行数:35,代码来源:flipdot.py

示例3: CreateElement

 def CreateElement(self, x, y, x2 = 0, y2 = 0):
     ne = Element(x, y, x2, y2)
     ne.x = x
     ne.y = y
     ne.x2 = x2
     ne.y2 = y2
     return ne
开发者ID:greeenway,项目名称:circ,代码行数:7,代码来源:elementpattern.py

示例4: __init__

 def __init__(self, agent, element_name, trigger, root, max_freq):
     """Initialises the drive element.
     
     The log domain is set to [AgentName].DE.[element_name]
     
     @param agent: The element's agent.
     @type agent: L{SPOSH.Agent}
     @param element_name: The name of the drive element.
     @type element_name: string
     @param trigger: The trigger of the element.
     @type trigger: L{SPOSH.Trigger}
     @param root: The element's root element.
     @type root: L{SPOSH.Action}, L{SPOSH.Competence} or
         L{SPOSH.ActionPattern}
     @param max_freq: The maximum frequency at which is element is
         fired. The frequency is given in milliseconds between
         invocation. A negative number disables this feature.
     @type max_freq: long
     """
     Element.__init__(self, agent, "DE.%s" % element_name)
     self._name = element_name
     self._trigger = trigger
     self._root, self._element = root, root
     self._max_freq = max_freq
     # the timestamp when it was last fired
     self._last_fired = -100000l
     self.debug("Created")
开发者ID:clr,项目名称:cos570,代码行数:27,代码来源:drive.py

示例5: __init__

 def __init__(self, model, xc=0, yc=0, label=None):
     Element.__init__(self, model, Nparam=1, Nunknowns=1, layers=range(model.aq.Naq),\
                      name='ConstantInside', label=label)
     self.xc = np.atleast_1d(xc)
     self.yc = np.atleast_1d(yc)
     self.parameters = np.zeros((1,1))
     self.model.add_element(self)
开发者ID:astraiophos,项目名称:timml,代码行数:7,代码来源:constant.py

示例6: Initialize

def Initialize(credentials="persistent", opt_url=None):
    """Initialize the EE library.

  If this hasn't been called by the time any object constructor is used,
  it will be called then.  If this is called a second time with a different
  URL, this doesn't do an un-initialization of e.g.: the previously loaded
  Algorithms, but will overwrite them and let point at alternate servers.

  Args:
    credentials: OAuth2 credentials.  'persistent' (default) means use
        credentials already stored in the filesystem, or raise an explanatory
        exception guiding the user to create those credentials.
    opt_url: The base url for the EarthEngine REST API to connect to.
  """
    if credentials == "persistent":
        credentials = _GetPersistentCredentials()
    data.initialize(credentials, (opt_url + "/api" if opt_url else None), opt_url)
    # Initialize the dynamically loaded functions on the objects that want them.
    ApiFunction.initialize()
    Element.initialize()
    Image.initialize()
    Feature.initialize()
    Collection.initialize()
    ImageCollection.initialize()
    FeatureCollection.initialize()
    Filter.initialize()
    Geometry.initialize()
    List.initialize()
    Number.initialize()
    String.initialize()
    Date.initialize()
    Dictionary.initialize()
    Terrain.initialize()
    _InitializeGeneratedClasses()
    _InitializeUnboundMethods()
开发者ID:bevingtona,项目名称:earthengine-api,代码行数:35,代码来源:__init__.py

示例7: Initialize

def Initialize(credentials=None, opt_url=None):
  """Initialize the EE library.

  If this hasn't been called by the time any object constructor is used,
  it will be called then.  If this is called a second time with a different
  URL, this doesn't do an un-initialization of e.g.: the previously loaded
  Algorithms, but will overwrite them and let point at alternate servers.

  Args:
    credentials: OAuth2 credentials.
    opt_url: The base url for the EarthEngine REST API to connect to.
  """
  data.initialize(credentials, (opt_url + '/api' if opt_url else None), opt_url)
  # Initialize the dynamically loaded functions on the objects that want them.
  ApiFunction.initialize()
  Element.initialize()
  Image.initialize()
  Feature.initialize()
  Collection.initialize()
  ImageCollection.initialize()
  FeatureCollection.initialize()
  Filter.initialize()
  Geometry.initialize()
  List.initialize()
  Number.initialize()
  String.initialize()
  Date.initialize()
  Dictionary.initialize()
  _InitializeGeneratedClasses()
  _InitializeUnboundMethods()
开发者ID:Arable,项目名称:ee-python,代码行数:30,代码来源:__init__.py

示例8: __init__

 def __init__(self, agent, element_name, trigger, element, max_retries):
     """Initialises the competence element.
     
     The log domain is set to [AgentName].CE.[element_name].
     
     @param agent: The competence element's agent.
     @type agent: L{SPOSH.Agent}
     @param element_name: The name of the competence element.
     @type element_name: string
     @param trigger: The element's trigger
     @type trigger: L{SPOSH.Trigger}
     @param element: The element to fire.
     @type element: L{SPOSH.Action}, L{SPOSH.Competence}, or
         L{SPOSH.ActionPattern}
     @param max_retries: The maximum number of retires. If this is set
         to a negative number, it is ignored.
     @type max_retries: int
     """
     Element.__init__(self, agent, "CE.%s" % element_name)
     self._name = element_name
     self._trigger = trigger
     self._element = element
     self._max_retries = max_retries
     self._retries = 0
     self.debug("Created")
开发者ID:clr,项目名称:cos570,代码行数:25,代码来源:competence.py

示例9: __init__

class Hyperlink :
	
	_hyperlink = ''
	_rel_id = ''
	_url = ''

	def __init__(self, text, rel_id, url, anchor=None) :
		self._rel_id = rel_id
		self._url = url

		if anchor is None :
			self._hyperlink = Element().createElement('hyperlink', attr={'rel_id' : 'rId' + rel_id})
		else :
			self._hyperlink = Element().createElement('hyperlink', attr={'anchor' : anchor})
		
		run = Element().createElement('r')
		
		rPr = Element().createElement('rPr')
		style = Element().createElement('rStyle', attr={'val' : 'Hyperlink'})
		rPr.append(style)
		run.append(rPr)

		textEl = Element().createElement('t', text=text, attr={'space' : 'preserve'})
		run.append(textEl)

		self._hyperlink.append(run)

	def get(self) :
		return self._hyperlink

	def getRelation(self) :
		attr = {'TargetMode' : 'External', 'Type' : HYPERLINK_SCHEMA, 'Id' : 'rId' + self._rel_id, 'Target' : self._url}
		rel = Element().createElement('Relationship', prefix=None, attr=attr)
		return rel
开发者ID:runningwolf666,项目名称:python_docx,代码行数:34,代码来源:hyperlink.py

示例10: test_ud

    def test_ud(ilist):
        filter = UserDefinedFilter(ilist)

        from cStringIO import StringIO
        from element import Element
        from media import MediaFactory,GenericMedia,List
        fd = StringIO('''<TrackerList>
    <Tracker publisher="th-torrent">
        <Url name="login" url="http://forums.btthai.com/" method="post">
            <Param name="UserName" value="%(user)s"/>
            <Param name="PassWord" value="%(password)s"/>
            <Param name="act" value="Login"/>
            <Param name="CODE" value="01"/>
            <Param name="CookieDate" value="1"/>
        </Url>
        <Url name="catalog" url="http://forums.btthai.com/" method="get">
            <Param name="act" value="bt"/>
            <Param name="func" value="browse"/>
            <Filter name="main"><![CDATA[<tr>\s*<td class="[^"]+" align="center"><img src="style_images/[^/]+/cat_(?P<category>[^\.]+).[^<]+" border="0" alt="[^"]+" width="\d+" height="\d+"/></td>\s*<td class="[^"]+" align="left"><a href="(?P<link>[^"]+)">(?P<title>[^<]+)</a></td>\s*<td class="[^"]+" align="right">(?P<files>\d+)</td>\s*<td class="[^"]+" align="center">[^<]+</td>\s*<td class="[^"]+" align="center" nowrap>(?P<date>[^<]+(<br/>| )[^<]*)</td>\s*<td class="[^"]+" align="center">[^<]+</td>\s*<td class="[^"]+" align="center">\d+</td>\s*<td class="[^"]+" align="right">\d+</td>\s*<td class="[^"]+" align="right">\d+</td>\s*<td class="[^"]+" align="center"><a href="[^"]+">(?P<publisher>[^<]+)</a></td>\s*</tr>]]></Filter>
            <Filter name="detail"><![CDATA[<tr><td align="left" class='pformleft'>Name</td><td class='pformright'><a href="index.php\?showtopic=\d+">(?P<description>[^<]+)</a></td></tr>\s*<tr><td align="left" class='pformleft'>Info Hash</td><td class='pformright'>[^<]+</td></tr>\s*<tr><td align="left" class='pformleft'>Download</td><td class='pformright'><a href="(?P<download>[^\?]+\?act=bt&func=download&id=\d+)">[^<]+</a></td></tr>]]></Filter>
        </Url>
        <Url name="logout" url="http://th-torrent.mine.nu/"/>
    </Tracker>
</TrackerList>''' % {'user': user,
                     'password': passwd})
        element = Element()
        element.load(fd)
        factory = MediaFactory(GenericMedia,List)
        tlist = factory.from_element(element)
        fd.close()

        loader = TrackerLoader(tlist[0],filter)
        loader.fetch().to_element().save(sys.stdout)
开发者ID:BackupTheBerlios,项目名称:cbt-svn,代码行数:33,代码来源:loader.py

示例11: __init__

 def __init__(self, model, slope, angle,\
              name='Uflow', label=None):
     assert model.aq.ilap, 'TimML Error: Uflow can only be added to model with background confined aquifer'
     self.storeinput(inspect.currentframe())
     Element.__init__(self, model, Nparam=2, Nunknowns=0, layers=0,\
                      name=name, label=label)
     self.slope = slope
     self.angle = angle
     self.model.add_element(self)
开发者ID:mbakker7,项目名称:timml,代码行数:9,代码来源:uflow.py

示例12: insertComponentDescription

 def insertComponentDescription(self, div):
     # Description
     if self.description:
         description = Element('div', {
             'id':self.id+'-description',
             'class':self.descriptionClass
             })
         description.update(self.description)
         div.insert(description)
     return div
开发者ID:duanemalcolm,项目名称:jformer,代码行数:10,代码来源:component.py

示例13: test_insert_component_description

 def test_insert_component_description(self):
     from element import Element
     c = jformer._Component()
     setattr(c, 'id', 'magic')
     div = Element('div', {})
     div = c.insertComponentDescription(div)
     self.assertEqual(div.__str__(), '<div></div>')
     c.description = 'My description'
     div = c.insertComponentDescription(div)
     self.assertEqual(div.__str__(),
         '<div><div id="magic-description" class="jFormComponentDescription">My description</div></div>')
开发者ID:duanemalcolm,项目名称:jformer,代码行数:11,代码来源:test_jformer.py

示例14: insertComponentTip

 def insertComponentTip(self, div):
     # Create the tip div if not empty
     if self.tip:
         tipDiv = Element('div', {
             'id':self.id+'-tip',
             'style':'display: none',
             'class':self.tipClass,
             })
         tipDiv.update(self.tip)
         div.insert(tipDiv)
     return div
开发者ID:duanemalcolm,项目名称:jformer,代码行数:11,代码来源:component.py

示例15: __init__

 def __init__(self, model, xw=0, yw=0, Qw=100.0, rw=0.1, \
              res=0.0, layers=0, name='WellBase', label=None):
     Element.__init__(self, model, Nparam=1, Nunknowns=0, layers=layers,\
                      name=name, label=label)
     self.Nparam = len(self.pylayers) # Defined here and not in Element as other elements can have multiple parameters per layers
     self.xw = float(xw)
     self.yw = float(yw)
     self.Qw = np.atleast_1d(Qw)
     self.rw = float(rw)
     self.res = float(res)
     self.model.add_element(self)
开发者ID:astraiophos,项目名称:timml,代码行数:11,代码来源:well.py


注:本文中的element.Element类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。