Пример #1
0
def rd_index():
    if request.method == 'POST':
        depth = int(request.form['depth'])
        bottom_time = int(request.form['bottom_time'])
        deco = calc_deco(depth=depth,
                         bottom_time=bottom_time,
                         nosaturation=True)
        return render_template('main.html', deco=deco)
    else:
        return render_template('main.html')
Пример #2
0
def rd_index():
    if request.method == 'POST':
        depth = int(request.form['depth'])
        bottom_time = int(request.form['bottom_time'])
        deco = calc_deco(depth=depth,
                         bottom_time=bottom_time,
                         nosaturation=True)
        return render_template('main.html',
                               deco=deco)
    else:
        return render_template('main.html')
Пример #3
0
def rd_rest():
    if request.method == 'POST':
        error = {"error": "invalid method"}
        data = json.dumps(request.json)
        if 'depth' and 'bottom_time' in data:
            data = json.loads(data)
            depth = int(data['depth'])
            bottom_time = int(data['bottom_time'])
            deco = calc_deco(depth=depth,
                             bottom_time=bottom_time,
                             nosaturation=True)
            return json.dumps(deco, indent=4)
        else:
            return json.dumps(error)
    else:
        return json.dumps(error)
Пример #4
0
def rd_rest():
  if request.method == 'POST':
      error = {"error": "invalid method"}
      data = json.dumps(request.json)
      if 'depth' and 'bottom_time' in data:
          data = json.loads(data)
          depth = int(data['depth'])
          bottom_time = int(data['bottom_time'])
          deco = calc_deco(depth=depth,
                     bottom_time=bottom_time,
                     nosaturation=True)
          return json.dumps(deco, indent=4)
      else:
          return json.dumps(error)
  else:
      return json.dumps(error)
Пример #5
0
        '-d',
        '--depth',
        help='Depth',
        required=True)
    parser.add_argument(
        '--nosaturation',
        help='Disable saturation of tissues',
        nargs='?',
        default=True)
    return vars(parser.parse_args())


if __name__ == '__main__':
    args = arguments()
    deco = calc_deco(depth=args['depth'],
                     bottom_time=args['bottom_time'],
                     nosaturation=args['nosaturation'])
    print('***************************')
    print('Dive Details:')
    print('Depth: {} feet'.format(deco['depth']))
    print('Bottom Time: {} minutes'.format(deco['bottom_time']))
    if 'total_deco' in deco:
        print('Total Deco: {} minutes'.format(deco['total_deco']))
    print('***************************')
    if 'out_of_range' in deco:
        print(deco['out_of_range'])
    if 'minimum_deco' in deco:
        for item in deco['minimum_deco']:
            print('Stop at {} for 1 minute'.format(item))
    else:
        if '20' in deco: