src
stringlengths
721
1.04M
from django import forms from django.apps import apps from django.contrib.auth import get_user_model, get_permission_codename from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from django.core.exceptions import Valid...
#! /usr/bin/env python """ This page is in the table of contents. This plugin limits the feed rate of the tool head, so that the stepper motors are not driven too fast and skip steps. The limit manual page is at: http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Limit The maximum z feed rate is defined in speed...
#!/usr/bin/python import datetime, argparse, sys, os import numpy as np from multiprocessing import Pool import pycuda.driver as drv import pycuda.tools import pycuda.autoinit import numpy.linalg as la from pycuda.compiler import SourceModule import pycuda.gpuarray as gpuarray ap = argparse.ArgumentParser() ap.add_arg...
#!/usr/bin/env python import re from setuptools import setup # load our version from our init file init_data = open('menu/__init__.py').read() matches = re.search(r"__version__ = '([^']+)'", init_data, re.M) if matches: version = matches.group(1) else: raise RuntimeError("Unable to load version") requiremen...
from django import forms from django.db.models.query import QuerySet import datetime from distribution.models import * class InventoryItemForm(forms.ModelForm): prod_id = forms.CharField(widget=forms.HiddenInput) freeform_lot_id = forms.CharField(required=False, widget=...
#!/usr/bin/env python # Name: btrecon.py # Purpose: Bluetooth Scanner # By: Jerry Gamblin # Date: 02.11.15 # Modified 02.11.15 # Rev Level 0.5 # ----------------------------------------------- import os import re import time import sys import subprocess import readline def color(text, color_code): ...
import copy import pickle import unittest class DictSetTest(unittest.TestCase): def test_constructors_not_callable(self): kt = type({}.keys()) self.assertRaises(TypeError, kt, {}) self.assertRaises(TypeError, kt) it = type({}.items()) self.assertRaises(TypeError, it, {}) ...
""" Specific overrides to the base prod settings to make development easier. """ from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import # Don't use S3 in devstack, fall back to filesystem del DEFAULT_FILE_STORAGE MEDIA_ROOT = "/edx/var/edxapp/uploads" DEBUG = True USE_I18N = True TEMPLATE_DEB...
#!/usr/bin/python2 #-------------------------------- #Takes in mbox, spits out csv with email info and basic geolocation, plus other header fields. #-------------------------------- #This product includes GeoLite2 data created by MaxMind, available from #<a href="http://www.maxmind.com">http://www.maxmind.com</a>. i...
# Encoding: UTF-8 # Run tests with "py.test" in the project root dir import os, sys import pytest import datetime sys.path.insert(0, os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"../"))) import sc2reader from sc2reader.exceptions import ParseError # Tests for build 17811 replays def tes...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 Red Hat, Inc. # # 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 # #...
from os import path from setuptools import setup from subprocess import check_call from distutils.command.build import build from setuptools.command.develop import develop def get_submodules(): if path.exists('.git'): check_call(['rm', '-rf', 'pagedown/static/pagedown']) check_call(['rm', '-rf', '...
# Copyright 2015 NEC Corporation. All rights reserved. # # 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 b...
""" This file is part of yacron. Copyright (C) 2016 Vadim Kuznetsov <vimusov@gmail.com> yacron is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your...
# https://docs.python.org/3.6/howto/logging.html#logging-basic-tutorial import logging import sys def get_logger(name): """ Log to stream only. Don't add a handler to log to a file. Let program user decide if they want to pipe stream output to a file e.g. python3 fibonacci.py >> ../fib.log ...
import os import json import math import random import sys import time import gflags import numpy as np from spinn.util import afs_safe_logger from spinn.util.data import SimpleProgressBar from spinn.util.blocks import to_gpu from spinn.util.misc import Accumulator, EvalReporter from spinn.util.logging import stats, ...
"""authentication backend that takes care of the multiple login methods supported by the authenticator application """ import datetime import logging from django.contrib.auth.models import User from django.core.exceptions import ImproperlyConfigured from django.conf import settings as django_settings from django.utils....
import types from hashlib import sha1 def flatten(data, sep='.'): out = {} for k, v in data.items(): ksep = k + sep if isinstance(v, dict): for ik, iv in flatten(v, sep).items(): out[ksep + ik] = iv else: out[k] = v return out def nestify(d...
import keras import numpy as np from keras.preprocessing import image from .IClassifier import IClassifier class ImageClassifier(IClassifier): """ классификатор изображений """ def __init__(self): self.__input_shape = None self.__aliases = None self.__model = None ...
# coding=utf-8 import logging import random import string import sys import unittest from time import time, sleep import apiritif log = logging.getLogger('apiritif.http') log.addHandler(logging.StreamHandler(sys.stdout)) log.setLevel(logging.DEBUG) class TestWithExtractors(unittest.TestCase): def setUp(self):...
# -*- coding: utf-8 -*- """ Test cases related to XSLT processing """ from __future__ import absolute_import import io import sys import copy import gzip import os.path import unittest import contextlib from textwrap import dedent from tempfile import NamedTemporaryFile, mkdtemp is_python3 = sys.version_info[0] >= ...
# 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 Li...
import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) import awssl def wait_state_example(): # Construct states final_state = awssl.Task( Name="FinalState", EndState=True, ResourceArn="arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME") wait_using_sec...
# -*- coding: utf-8 -*- # # Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com> # # This file is part of Weblate <https://weblate.org/> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, eith...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Created on Mon May 15 11:09:35 2017""" import numpy as np import tncontract as tn import scipy.io as sio from itertools import product from itertools import combinations def load_train_data(filename, n_train, n_train_each, bond_label, bond_data, current_class): im...
import unittest import numpy as np from numpy.testing import assert_array_equal from libact.base.dataset import Dataset from libact.models import LogisticRegression, SVM, Perceptron from libact.query_strategies import UncertaintySampling, QUIRE from libact.labelers import IdealLabeler def init_toyexample(X, y): ...
''' Created on 7 juin 2016 @author: saldenisov ''' from PyQt5.Qt import QMainWindow from PyQt5.QtGui import QCloseEvent from utility import MainObserver from utility import Meta from views import Ui_MainWindow from _functools import partial class MainView(QMainWindow, MainObserver, metaclass=Meta): """ """ ...
# -*- coding: utf-8 -*- from __builtin__ import super from django.contrib.auth import get_user_model from django import forms from localflavor.br.forms import BRCPFField from django.utils.translation import ugettext_lazy as _ from django.conf import settings from timtec.settings import ACCOUNT_REQUIRED_FIELDS as field...
#!/usr/bin/python # Usage: process.py <input file> <output file> [-language <Language>] [-pdf|-txt|-rtf|-docx|-xml] import argparse import base64 import getopt import MultipartPostHandler import os import re import sys import time import urllib2 import urllib import xml.dom.minidom class ProcessingSettings: Languag...
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
#Created by martin.king@uni.no, 9 Nov 2013. #Foreign file or missing meta data (meta data field too) would cause the script to crash #because I have not coded in checking (non)existence of variables. #Currently the set-ups below are to check CORDEX files. #This script also needs the cordex_variables_metadata.csv file. ...
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.8.2 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re ...
# Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file ex...
# Copyright 2014-2017 F5 Networks Inc. # # 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 ...
#!/usr/bin/env python3 class QuickFindUF(object): def __init__(self, N): self.__id__ = [i for i in range(N)] self.__count__ = N def union(self, p, q): # Check indices if (p > self.__count__ or q > self.__count__): print('Indices do not exist') elif (self.__id__[q] != self.__id__[p]): # Not connected ye...
import threading class KillableThread(threading.Thread): """A base class for threads that die on command. Subclasses' run() loops test if self.keep_alive is False. Instead of sleeping, they should call nap(). And any subclass method, meant to be called by other threads, that interrupts a nap() s...
#!/usr/bin/env python # -*- coding: utf-8 -*- # StartOS Device Manager(ydm). # Copyright (C) 2011 ivali, Inc. # hechao <hechao@ivali.com>, 2011. #__author__="hechao" #__date__ ="$2011-12-20 16:36:20$" import gtk import time import os import pango import re import gobject import gettext from syscall import * from glo...
# # Copyright (c) 2008-2015 Citrix Systems, Inc. # # 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 l...
from __future__ import print_function import datetime import operator import os import sys import traceback import warnings from itertools import compress import networkx as nx import numpy as np import pandas import pkg_resources import scipy.ndimage as ndimage import scipy.sparse as sparse try: import cPickle ...
# 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 t...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('master', '0019_periodo_tipoperiodo'), ('data', '0007_auto_20150216_0921'), ] operations = [ migrations.CreateModel( ...
""" A script to generate the file needed for the strategy documentation. Run: python strategies.py > strategies.rst """ import os import sys sys.path.insert(0, os.path.abspath("../")) from axelrod import basic_strategies from axelrod import ordinary_strategies from axelrod import cheating_strategies def print_...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
from openerp.osv import osv, fields class sale_order(osv.osv): _inherit = "sale.order" def _get_prod_acc(self, product_id, journal_obj, context=False): if product_id and product_id.property_account_income: return product_id.property_account_income.id elif product_id and product_id....
method_add = { "code": [ # func add(x,y): # return x + y # STORE_NAME 0 # STORE_NAME 1 # LOAD_NAME 0 # LOAD_NAME 1 # ADD_TWO_VALUES # RET ("STORE_NAME", 0), ("STORE_NAME", 1), ("LOAD_NAME", 0), ("LOAD_NAME", 1), ("ADD_TWO_VALUES", None), ...
# -*- coding: utf-8 -*- # # droplet # Copyright (C) 2014 Carlos Pérez-Aradros Herce <exekias@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the Lice...
"""Support for statistics for sensor values.""" from collections import deque import logging import statistics import voluptuous as vol from homeassistant.components.recorder.models import States from homeassistant.components.recorder.util import execute, session_scope from homeassistant.components.sensor import PLAT...
import logging from wellspring.models import VestSection, VestSubSection LOGGER = logging.getLogger(__name__) VEST_SECTIONS = { "EQUILIBRIUM" : ["SCHOOL", "SELF", "HOME", "WORK"], "SUPPORT" : ["PROFESSIONALS", "FAMILY", "FRIENDS", "COLLEAGUES"], "LIFESTYLE" ...
''' Created on May 22, 2017 @author: nyga ''' import re def ifnone(if_, else_, transform=None): '''Returns the condition ``if_`` iff it is not ``None``, or if a transformation is specified, ``transform(if_)``. Returns ``else_`` if the condition is ``None``. ``transform`` can be any callable, which will b...
#!/usr/bin/env python import pygtk pygtk.require('2.0') import gtk import gnomeapplet import gobject import wnck import sys import codecs import random # debugging # import os # new_stdout = open ("/tmp/debug.stdout", "w") # new_stderr = open ("/tmp/debug.stderr", "w") # os.dup2(new_stdout.fileno(), sys.stdout.filen...
import pytest from collections import namedtuple from wait_for import wait_for from cfme.utils import os from cfme.utils.log_validator import LogValidator from cfme.utils.log import logger from cfme.utils.conf import hidden import tempfile import lxml.etree import yaml TimedCommand = namedtuple('TimedCommand', ['comma...
#!/usr/bin/env python # # Copyright 2011 Splunk, Inc. # # 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 ...
"""This module contains classes for looking up rows, inserting rows and updating rows in dimensions and fact tables. Rows are represented as dictionaries mapping between attribute names and attribute values. Many of the class methods take an optional 'namemapping' argument which is explained here, but not ...
#!/usr/bin/env python3 # Copyright (c) 2017 Genome Research Ltd. # Author: Alistair Dunham # This program is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; either version 3 of the Licens...
#!/usr/bin/env python # coding: utf-8 '''Be happy with your clipboard. Usage: ./cliptopia.py [options] [copy|paste|daemon|focused] copy: Copy using Ctrl(+Shift)+c depending on window class. paset: Paste using Ctrl(+Shift)+v depending on window class. daemon: Start daemon to monitor clipboard changes. focused: Re...
from constants import * from class_lib import * import numpy as np #from collections import deque class Cluster: def __init__(self,unit,num,links,file_ext): self.nodes = [] self.edges = [] self.sites = [] self.bonds = [] if unit == "site": self.nodes.append( Site(links) ) self.site...
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # 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 appli...
# ============================================================================= # Copyright (C) 2010 Diego Duclos # # This file is part of pyfa. # # pyfa is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either ...
import unittest import numpy as np import tensorflow as tf import os from dama.utils.tf_functions import ssim, msssim from dama.processing import rgb2gray, merge_offset class TestMsssiM(unittest.TestCase): def setUp(self): base_file = os.path.dirname(os.path.abspath(__file__)) self.img1 = os.path...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
from __future__ import print_function, division, absolute_import import sys import functools from numba import config def allow_interpreter_mode(fn): """Temporarily re-enable intepreter mode """ @functools.wraps(fn) def _core(*args, **kws): config.COMPATIBILITY_MODE = True try: ...
## p7cat.py - parallel concatenation ## (c) 2017 by mobarski (at) gmail (dot) com ## licence: MIT ## version: x1 from __future__ import print_function import sys import os from multiprocessing import Process from time import time def write_part(path_in, path_out, offset, blocksize=4096): fi = open(path_in,'rb') fo ...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
# This file is part of blender_io_xbuf. blender_io_xbuf is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANT...
import twilio from twilio import TwilioException, TwilioRestException from twilio.rest.resources.imports import ( parse_qs, json, httplib2 ) from twilio.rest.resources.util import ( transform_params, format_name, parse_date, convert_boolean, convert_case, convert_keys, normalize_dates, UNSET_TIMEOUT ) fro...
# -*- coding: utf-8 -*- # Copyright 2014-2015 Red Hat, Inc. # # 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 applica...
from boxbranding import getImageVersion from sys import modules import socket, fcntl, struct def getVersionString(): return getImageVersion() def getEnigmaVersionString(): return getImageVersion() def getKernelVersionString(): try: f = open('/proc/version', 'r') kernelversion = f.read()...
# -*- coding: utf-8 -*- from django import forms from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from servo.models import Tag, Device, Customer from servo.forms import DatepickerInput, AutocompleteCharField product_lines = [(k, x['name']) for k, x in Device.PRODU...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
from __future__ import generators, print_function import numpy as np from copy import deepcopy from random import shuffle from scipy.io import loadmat class DataSet(object): def __init__(self, cfg): """Construct a DataSet. """ self.cfg = cfg self.all_walks, self.node_seq = self.get...
#!/usr/bin/env python3 #This program extracts NTFS artifacts ($MFT, $Logfile, $USRJRNL) (Overt, Deleted #Shadow Volumes) #Use to extract files when using Triforce ANJP NTFS Journal Parser | Triforce (David Cohen) #########################COPYRIGHT INFORMATION############################ #Copyright (C) 2013 dougkoster@...
#!/usr/bin/python import time import RPi.GPIO as GPIO # remember to change the GPIO values below to match your sensors # GPIO output = the pin that's connected to "Trig" on the sensor # GPIO input = the pin that's connected to "Echo" on the sensor def reading(sensor): # Disable any warning message such as GP...
from __future__ import absolute_import import uuid REPROCESSING_OPTION = "sentry:processing-rev" def get_reprocessing_revision(project, cached=True): """Returns the current revision of the projects reprocessing config set.""" from sentry.models import ProjectOption, Project if cached: return P...
############################################################################### # # # Copyright 2019. Triad National Security, LLC. All rights reserved. # # This program was produced under U.S. Government contract 89233218CNA000001 # ...
"""add columns to genomic_set_member Revision ID: 5a1b1f7b4761 Revises: f3fdb9d05ab3 Create Date: 2019-09-17 16:06:00.824574 """ from alembic import op import sqlalchemy as sa import rdr_service.model.utils from sqlalchemy.dialects import mysql from rdr_service.participant_enums import PhysicalMeasurementsStatus, Qu...
from struct import pack, unpack import hashlib import sys import traceback from electrum import bitcoin from electrum.bitcoin import TYPE_ADDRESS, int_to_hex, var_int from electrum.i18n import _ from electrum.plugins import BasePlugin from electrum.keystore import Hardware_KeyStore from electrum.transaction import Tra...
from nose.tools import eq_ from ..accuracy import accuracy def test_boolean(): test_statistic = accuracy() score_labels = [ ({'prediction': True}, {'prediction': True}, True), ({'prediction': False}, {'prediction': True}, False), ({'prediction': True}, {'prediction': True}, True), ...
#coding: utf-8 from __future__ import unicode_literals import csv from django.template.response import TemplateResponse from django.shortcuts import redirect, get_object_or_404 from django.contrib import messages from django.http import HttpResponse from django.contrib.auth.decorators import user_passes_test from con...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models def increase_sequence(dbName): highest_number = db.execute('select id from '+dbName+' order by id desc limit 1;')[0][0] db.execute('alter sequence...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # 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...
""" System commands """ import traceback import os import datetime import sys import django import twisted from time import time as timemeasure from django.conf import settings from evennia.server.sessionhandler import SESSIONS from evennia.scripts.models import ScriptDB from evennia.objects.models import ObjectDB ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import argparse import funannotate.library as lib def dict2gff3(input): from collections import OrderedDict ''' function to convert funannotate gene dictionary to gff3 output ''' def _sortDict(d): return (d[1]['contig'], d[1]['locat...
import webbrowser import os import re # Styles and scripting for the page main_page_head = ''' <head> <meta charset="utf-8"> <title>Fresh Tomatoes!</title> <!-- Bootstrap 3 --> <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css"> <link rel="styleshee...
#!/usr/bin/env python ######################################################################################### # # Module containing fitting functions # # --------------------------------------------------------------------------------------- # Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca> # Author...
''' A few common functions for cipher cracking Functionality: - Return a list of letter frequency from a given string - Sort a string with a given linear function into a list of inputs based on letter frequency - Shift a given string based on a linear function and inputs Sample Usage: >>> from cipher import core >>>...
# uncompyle6 version 2.9.10 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10) # [GCC 6.2.0 20161005] # Embedded file name: Mcl_Cmd_Activity_Tasking.py ACTIVITY_ACTION_LAST = 1 ACTIVITY_ACTION_MONITOR = 2 def TaskingMain(namespace): import mcl.imports import mcl.t...
from menpodetect.dlib import load_dlib_frontal_face_detector import menpo.io as mio takeo = mio.import_builtin_asset.takeo_ppm() def test_frontal_face_detector(): takeo_copy = takeo.copy() dlib_detector = load_dlib_frontal_face_detector() pcs = dlib_detector(takeo_copy) assert len(pcs) == 1 asser...
# coding: utf-8 import logging from flask import Flask from core.config import config from core.utils import JSONEncoder log = logging.getLogger(__name__) class Provider(Flask): def __init__(self, *args, **kwargs): from core.db import Database from core.sessions import Sessions from vmpo...
import demjson values = { 'uff000b': 'policy', 'sfe0009': 'skin', 's1': 'user', 's2': 'manualURL', 's11': 'arch', 's15': 'boardname', 's16': 'version', 's17': 'board', 's2c': 'displayname', 'M1': 'prefs', 'Uff0001': 'path', 'Uff0002': '', 'uff0007': 'cmd', 'ufe00...
# -*- coding: utf-8 -*- ''' Local settings - Run in Debug mode - Use console backend for emails - Add Django Debug Toolbar - Add django-extensions as app ''' from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ DEBUG = env.bool('DJANGO_DEBUG', default...
import collections import os import subprocess import numpy as np from mlperf_logging.mllog import constants as mlperf_constants from mlperf_logging import mllog class MPIWrapper(object): def __init__(self): self.comm = None self.MPI = None def get_comm(self): if self.comm is None: ...
# -*- coding: utf-8 -*- from .grammar import QueryGrammar class PostgresQueryGrammar(QueryGrammar): _operators = [ '=', '<', '>', '<=', '>=', '<>', '!=', 'like', 'not like', 'between', 'ilike', '&', '|', '#', '<<', '>>' ] marker = '%s' def _compile_lock(self, query, value):...
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015, 2016 CERN. # # Invenio is free software; you can redistribute it # and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any...
''' Compass ======= The :class:`Compass` provides access to public methods to use compass of your device. Simple Examples --------------- To enable compass:: >>> from crisscross import compass >>> compass.enable() To disable compass:: >>> compass.disable() To get the orientation:: >>> compass.or...
import unittest import time from server.views.test import BaseAppTest, TEST_USER_EMAIL class UserLoginTest(BaseAppTest): """ Make sure a user can login with the email and password, and can't if password is wrong """ def testWrongPassword(self): response = self.app.post( '/api/log...
import requests as req import json import csv import language import country import os import catagories # import sample as s def json2csv(data,country,deviceType): file_name = country+"_top_games_new.csv" gameCSV = None if(os.path.isfile(file_name)): gameCSV = csv.writer(open(file_nam...
# Copyright 2015 Google Inc. All Rights Reserved. # # 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 a...
#!/usr/bin/env python # code from http://effbot.org/zone/simple-top-down-parsing.htm # licence of original code was public domain # relicenced to AGPL v3 by Asyncode Ltd. and: # - specialized to work with ACR, # - added interpreter, # - optimized # !!!NOT THREAD SAFE!!! #TODO thread safety! import sys import re from ...
#! /usr/bin/python # -*- coding:utf-8 -*- from osv import fields,osv from tools.translate import _ import time from datetime import datetime class order_recive_wizard(osv.osv_memory): _name='order.recive.wizard' _columns={ 'name':fields.char(u'客户',readonly=False,size=16), } def creat...
from . import poloniex, btc_e, bittrex, bitfinex from ccas.models import database, coinmarketcap def get_balances(exchange, public_key, secret_key): if exchange == "poloniex": return poloniex.get_balances(public_key, secret_key) if exchange == "btc-e": return btc_e.get_balances(public_key, sec...