"lines-code">
-    
314
+
300 315
     @property
301 316
     def userdata(self):
302
-         return {
317
+        return {
303 318
             'macid': self.macid,
304 319
             'sn': self.sn,
305 320
             'temperature': self.temperature,
306 321
             'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M'),
307
-        }       
322
+        }
308 323
 
309 324
 
310 325
 class AepThermometerMeasureLogInfo(BaseModelMixin):
@@ -352,3 +367,33 @@ class AepThermometerMeasureLogInfo(BaseModelMixin):
352 367
 
353 368
     def __unicode__(self):
354 369
         return self.pk
370
+
371
+
372
+class AntigenMeasureLogInfo(BaseModelMixin):
373
+
374
+    NEGATIVE = 0
375
+    POSITIVE = 1
376
+    UNKNOWN = 2
377
+
378
+    ANTIGEN_RESULT_TYPE = (
379
+        (NEGATIVE, '阴性'),
380
+        (POSITIVE, '阳性'),
381
+        (UNKNOWN, '未知'),
382
+    )
383
+
384
+    point_id = models.CharField(_('point_id'), max_length=32, blank=True, null=True, help_text='隔离点唯一标识', db_index=True)
385
+
386
+    user_id = models.CharField(_('user_id'), max_length=32, blank=True, null=True, help_text='用户唯一标识')
387
+
388
+    macid = models.CharField(_('macid'), max_length=32, blank=True, null=True, help_text='设备号')
389
+    phone = models.CharField(_('phone'), max_length=11, blank=True, null=True, help_text='用户手机号')
390
+    user_name = models.CharField(_('user_name'), max_length=255, blank=True, null=True, help_text='用户姓名')
391
+    result = models.IntegerField(_('result'), choices=ANTIGEN_RESULT_TYPE, default=UNKNOWN, help_text='抗原检测结果')
392
+    detect_at = models.DateTimeField(_('detect_at'), blank=True, null=True, help_text='检测时间')
393
+
394
+    class Meta:
395
+        verbose_name = _('抗原检测记录信息')
396
+        verbose_name_plural = _('抗原检测记录信息')
397
+
398
+    def __unicode__(self):
399
+        return self.pk

adminSystem - Gogs: Go Git Service

Nenhuma Descrição

FFIB: 11e3a9652a first 8 anos atrás
..
node_modules 11e3a9652a first 8 anos atrás
LICENSE 11e3a9652a first 8 anos atrás
README.md 11e3a9652a first 8 anos atrás
index.js 11e3a9652a first 8 anos atrás
inject.js 11e3a9652a first 8 anos atrás
package.json 11e3a9652a first 8 anos atrás
xhtml.js 11e3a9652a first 8 anos atrás

README.md

Acorn-JSX

Build Status NPM version

This is plugin for Acorn - a tiny, fast JavaScript parser, written completely in JavaScript.

It was created as an experimental alternative, faster React.js JSX parser.

According to benchmarks, Acorn-JSX is 2x faster than official Esprima-based parser when location tracking is turned on in both (call it "source maps enabled mode"). At the same time, it consumes all the ES6+JSX syntax that can be consumed by Esprima-FB (this is proved by official tests).

UPDATE [14-Apr-2015]: Facebook implementation started deprecation process in favor of Acorn + Acorn-JSX + Babel for parsing and transpiling JSX syntax.

Transpiler

Please note that this tool only parses source code to JSX AST, which is useful for various language tools and services. If you want to transpile your code to regular ES5-compliant JavaScript with source map, check out the babel transpiler which uses acorn-jsx under the hood.

Usage

You can use module directly in order to get Acorn instance with plugin installed:

var acorn = require('acorn-jsx');

Or you can use inject.js for injecting plugin into your own version of Acorn like following:

var acorn = require('acorn-jsx/inject')(require('./custom-acorn'));

Then, use plugins option whenever you need to support JSX while parsing:

var ast = acorn.parse(code, {
  plugins: { jsx: true }
});

Note that official spec doesn't support mix of XML namespaces and object-style access in tag names (#27) like in <namespace:Object.Property />, so it was deprecated in acorn-jsx@3.0. If you still want to opt-in to support of such constructions, you can pass the following option:

var ast = acorn.parse(code, {
  plugins: {
    jsx: { allowNamespacedObjects: true }
  }
});

Also, since most apps use pure React transformer, a new option was introduced that allows to prohibit namespaces completely:

var ast = acorn.parse(code, {
  plugins: {
    jsx: { allowNamespaces: false }
  }
});

Note that by default allowNamespaces is enabled for spec compliancy.

License

This plugin is issued under the MIT license.