code
stringlengths
1
199k
from test.support import findfile, TESTFN, unlink import unittest import array import io import pickle import sys def byteswap2(data): a = array.array('h', data) a.byteswap() return a.tobytes() def byteswap3(data): ba = bytearray(data) ba[::3] = data[2::3] ba[2::3] = data[::3] return bytes(b...
import os import re import sys def ReadFileAsLines(filename): """Reads a file, removing blank lines and lines that start with #""" file = open(filename, "r") raw_lines = file.readlines() file.close() lines = [] for line in raw_lines: line = line.strip() if len(line) > 0 and not l...
"""Wrapper around setuptools' pkg_resources with more Google-like names. This module is not very useful on its own, but many Google open-source projects are used to a different naming scheme, and this module makes the transition easier. """ __author__ = 'dborowitz@google.com (Dave Borowitz)' import atexit import pkg_re...
from __future__ import absolute_import from datetime import timedelta from flask import make_response, request, current_app from functools import update_wrapper, wraps from six import string_types def crossdomain(origin=None, methods=None, headers=None, max_age=21600, attach_to_all=True, ...
import datetime import time from openerp import api, fields, models from openerp import tools from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT from openerp.addons.bus.models.bus import TIMEOUT DISCONNECTION_TIMER = TIMEOUT + 5 AWAY_TIMER = 1800 # 30 minutes class BusPresence(models.Model): """ User Pr...
import lxml.etree import os import sys import traceback from fs.osfs import OSFS from path import path from django.core.management.base import BaseCommand from xmodule.modulestore.xml import XMLModuleStore def traverse_tree(course): '''Load every descriptor in course. Return bool success value.''' queue = [cou...
def main(request, response): import simplejson as json f = file('config.json') source = f.read() s = json.JSONDecoder().decode(source) url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1]) url2 = "http://" + s['host'] + ":" + str(s['ports']['http'][0]) _CSP = "media-src http://www....
""" This is an extremely primitive start at some debugging. At the moment, it is really just for recoco (maybe it belongs in there?). """ from pox.core import core log = core.getLogger() import time import traceback import pox.lib.recoco _frames = [] def _tf (frame, event, arg): if _frames is None: return _tf #prin...
from __future__ import print_function import collections import itertools import json import os import os.path import re import shutil import string import subprocess import sys import cgi class BuildDesc: def __init__(self, prepend_envs=None, variables=None, build_type=None, generator=None): self.prepend_e...
""" pip._vendor is for vendoring dependencies of pip to prevent needing pip to depend on something external. Files inside of pip._vendor should be considered immutable and should only be updated to versions from upstream. """ from __future__ import absolute_import import glob import os.path import sys WHEEL_DIR = os.pa...
from telemetry import story from telemetry.page import page as page_module from telemetry.page import shared_page_state class SkiaBuildbotDesktopPage(page_module.Page): def __init__(self, url, page_set): super(SkiaBuildbotDesktopPage, self).__init__( url=url, page_set=page_set, credentials...
import optparse import time from metrics import v8_object_stats from telemetry.page import page_test from telemetry.value import scalar _V8_BYTES_COMMITTED = [ 'V8.MemoryNewSpaceBytesCommitted', 'V8.MemoryOldPointerSpaceBytesCommitted', 'V8.MemoryOldDataSpaceBytesCommitted', 'V8.MemoryCodeSpaceBytesComm...
"""aetypes - Python objects representing various AE types.""" from warnings import warnpy3k warnpy3k("In 3.x, the aetypes module is removed.", stacklevel=2) from Carbon.AppleEvents import * import struct from types import * import string def pack(*args, **kwargs): from aepack import pack return pack( *args, **k...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import re import time import glob from ansible.plugins.action.junos import ActionModule as _ActionModule from ansible.module_utils._text import to_text from ansible.module_utils.six.moves.urllib.parse import urlsplit from ...
"""Format tensors (ndarrays) for screen display and navigation.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import copy import re import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin from tensorflow.python.debug.cli impo...
from __future__ import print_function from subprocess import Popen, PIPE import sys import getopt import glob import time import os import struct import binascii import traceback try: import magic have_magic = True except ImportError: have_magic = False try: from intelhex import IntelHex have_hex_su...
import unittest import check_orderfile import symbol_extractor class TestCheckOrderFile(unittest.TestCase): _SYMBOL_INFOS = [symbol_extractor.SymbolInfo('first', 0x1, 0, ''), symbol_extractor.SymbolInfo('second', 0x2, 0, ''), symbol_extractor.SymbolInfo('notProfiled', 0x4, 0, '')...
from __future__ import unicode_literals import keyword import re from collections import OrderedDict from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS, connections from django.utils.encoding import force_text class Command(BaseCommand): help = "Introspects the ...
""" Test utilities for mobile API tests: MobileAPITestCase - Common base class with helper methods and common functionality. No tests are implemented in this base class. Test Mixins to be included by concrete test classes and provide implementation of common test methods: MobileAuthTestMixin - tests for A...
import cPickle from webkitpy.layout_tests.models import test_failures class TestResult(object): """Data object containing the results of a single test.""" @staticmethod def loads(string): return cPickle.loads(string) def __init__(self, test_name, failures=None, test_run_time=None, has_stderr=Fal...
""" module to test interpolate_wrapper.py """ from __future__ import division, print_function, absolute_import import unittest from numpy import arange, allclose, ones, isnan import numpy as np from scipy.interpolate.interpolate_wrapper import (linear, logarithmic, block_average_above, nearest) class Test(unittest....
import re from style import Style, TextProperties, ListLevelProperties from text import ListStyle,ListLevelStyleNumber,ListLevelStyleBullet """ Create a <text:list-style> element from a string or array. List styles require a lot of code to create one level at a time. These routines take a string and delimiter, or a lis...
from math import exp import sys import ConfigParser as cfg import os import numpy as n import numpy.random as nr from math import ceil, floor from collections import OrderedDict from os import linesep as NL from python_util.options import OptionsParser import re class LayerParsingError(Exception): pass class Neuron...
if __name__ == "__main__": import sys name = sys.argv[0] args = ' '.join(sys.argv[1:]) print >> sys.stderr, "%s has been moved into django-admin.py" % name print >> sys.stderr, 'Please run "django-admin.py compilemessages %s" instead.'% args print >> sys.stderr sys.exit(1)
from django.contrib import admin from .models import Dialog, Message class DialogAdmin(admin.ModelAdmin): list_display = ('id', 'created', 'modified', 'owner', 'opponent') list_filter = ('created', 'modified', 'owner', 'opponent') admin.site.register(Dialog, DialogAdmin) class MessageAdmin(admin.ModelAdmin): ...
import pygame.sprite import pygame.rect def create(pos, kind, display, level=None): """Create and place a monster of specified kind.""" module = __import__("terrain.%s" % kind, globals(), {}, ["Terrain"]) return module.Terrain(pos, display, level) class Terrain(pygame.sprite.Sprite): def __init__(self, ...
""" Django settings for features project. Generated by 'django-admin startproject' using Django 1.11. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os BASE...
import sys, os, shlex import juliadoc import sphinx_rtd_theme extensions = [ 'sphinx.ext.mathjax', 'juliadoc.julia', 'juliadoc.jlhelp' ] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'Data Depth' copyright = u'2016, Robin Szekely' author = u'Robin Szekely' version = ...
__author__ = 'Garrett Pennington' __date__ = '02/07/14' from .core import MarvelObject, DataWrapper, DataContainer, Summary, List class SeriesDataWrapper(DataWrapper): @property def data(self): return SeriesDataContainer(self.marvel, self.dict['data']) class SeriesDataContainer(DataContainer): @prop...
import matplotlib.pyplot as plt import matplotlib.lines as mlines import numpy as np import os import sys from pprint import pprint from datetime import datetime from datetime import timedelta import pickle import copy from mpl_toolkits.basemap import Basemap import matplotlib.colors import shutil GBPS_lat_min = 48.0 G...
from interaction import * from optimization import * from sketch import * from visualization import * from connectorBehavior import * import regionToolset session.journalOptions.setValues(replayGeometry=COORDINATE,recoverGeometry=COORDINATE) beamLength=4.0 cLoad=10000 #only refers to scale myModel = mdb.Model(name='ssB...
""" (Limited) Import support for Wavefront obj files. Current implementation is based on specification at: http://www.martinreddy.net/gfx/3d/OBJ.spec Features of the specification that are not implemented: TODO Features of the specification that are not well tested: TODO """ from warnings import warn try: from cStr...
import cherrypy class HelloWorld(object): def index(self): return "Hello World!" index.exposed = True cherrypy.quickstart(HelloWorld())
from i3pystatus import Module from threading import Thread import i3ipc class WindowTitle(Module): """ Display the current window title with async update. Uses asynchronous update via i3 IPC events. Provides instant title update only when it required. fork from window_tile_async of py3status by Anon...
from dartcms import get_model from dartcms.utils.config import DartCMSConfig from .forms import OrderDatailForm app_name = 'order_details' Order = get_model('shop', 'OrderDetail') config = DartCMSConfig({ 'model': Order, 'parent_kwarg_name': 'order', 'parent_model_fk': 'order_id', 'grid': { 'gri...
""" Provides a sensor which gets its values from a TCP socket. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.tcp/ """ import logging import socket import select from homeassistant.const import CONF_NAME, CONF_HOST from homeassistant.helpers import...
from setuptools import setup from setuptools import find_packages readme, dependencies = "", [] with open("requirements.txt") as f: dependencies = f.read().splitlines() with open("readme.txt") as f: readme = f.read() setup( name = "fuze", version = "1.0", author = "Ron!", author_email = "rodenbe...
import time import math import re import RPi.GPIO as GPIO from i2c_core import i2c_core class PCA9685(object): # Define registers values from datasheet MODE1 = 0x00 MODE2 = 0x01 SUBADR1 = 0x02 SUBADR2 = 0x03 SUBADR3 = 0x04 ALLCALLADR = 0x05 LED0_ON_L = 0x06 LED0_ON_H = 0x07 LED0_OFF_L = 0x08 LED0_OFF_H = 0x0...
import os import shutil import dateparser from urllib import parse from typing import List, Tuple, Dict, Callable, Any, Union, Optional from CommonServerPython import * requests.packages.urllib3.disable_warnings() COMMAND_NOT_IMPLEMENTED_MSG = 'Command not implemented' TICKET_STATES = { 'incident': { '1': '...
""" djam.sqlalchemy ~~~~~~~~~~~~~~~ Provide utilities that eases using sqlalchemy in a django project :email: devel@amvtek.com """ from __future__ import unicode_literals, absolute_import import threading from sqlalchemy import engine_from_config from sqlalchemy.orm import scoped_session, sessionmaker f...
def foo(*args): print(args[0]) print(args[1]) print(args[2]) foo("bar",999,[1,2,3])
from django.conf.urls import url, include from rest_framework import routers import views router = routers.DefaultRouter() router.register(r'cars', views.CarViewSet) router.register(r'manufacturers', views.ManufacturerViewSet) urlpatterns = [ url(r'^', include(router.urls)), ]
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('coins', '0005_auto_20170606_0852'), ] operations = [ migrations.AddField( model_name='btc', name='close', field=model...
import logging from django.contrib import messages from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect, JsonResponse, HttpResponseBadRequest from django.shortcuts import render from django.views.generic import View from webui.exceptions import UnauthorizedException from webui.model...
from __future__ import unicode_literals __version__ = "6.15.4"
from __future__ import print_function import sys from acq4.util.clibrary import winDefs, CParser, CLibrary from six.moves import map sys.path.append('C:\\cygwin\\home\\Experimenters\\luke\\acq4\\lib\\util') import ctypes import os import time windowsDefs = winDefs(verbose=True) d = os.path.dirname(__file__) teleDefs = ...
""" pybitcoin ~~~~~ :copyright: (c) 2014 by Halfmoon Labs :license: MIT, see LICENSE for more details. """ from binascii import hexlify, unhexlify import struct from .utils import flip_endian, variable_length_int from ..constants import UINT_MAX def serialize_input(input, signature_script_hex=''): "...
import reputation.config as config from reputation.models import Reputation class ReputationMiddleware(object): """ middleware for attaching a reputation object to the current logged in user if the current user is authenticated (depends on using django.contrib.auth or an app that has a similar interface...
from __future__ import print_function, division from dask import array as da import xray import numpy as np def _append_to_name(array, append): try: return array.name + "_" + append except TypeError: return append class GCMDataset(object): """Representation of GCM (General Circulation Model)...
import sys import textwrap import unittest from brew.constants import GRAIN_TYPE_CEREAL from brew.constants import GRAIN_TYPE_DME from brew.constants import GRAIN_TYPE_LME from brew.constants import GRAIN_TYPE_SPECIALTY from brew.constants import IMPERIAL_UNITS from brew.constants import PPG_DME from brew.constants imp...
import json from uuid import uuid4 import sqlalchemy as sa from collections import defaultdict from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declared_attr from beard.models import Base, TimestampMixin chart_dash_association_table = sa.Table( 'association', Base.metadata, sa.Colu...
import os, sys, imp, types, ccroot import optparse import Utils, Configure, Options from Logs import debug c_compiler = { 'win32': ['msvc', 'gcc'], 'cygwin': ['gcc'], 'darwin': ['gcc'], 'aix': ['xlc', 'gcc'], 'linux': ['gcc', 'icc', 'suncc'], 'sunos': ['gcc', 'suncc'], 'irix': ['gcc'], 'hpux': ['gcc']...
import os from os import listdir from os.path import isfile, join import base64 import redis import json import construct_graph graph_management = construct_graph.Graph_Management("PI_1","main_remote","LaCima_DataStore") data_store_nodes = graph_management.find_data_stores() data_server_ip = data_store_nodes[0]["ip"]...
""" Module responsible for detecting when a frame and a feed are invalid. """
import unittest import os import sys from io import StringIO import subprocess import logging PYTHON_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) sys.path.append(PYTHON_PATH) from housinginsights.sources.wmata_distcalc import WmataApiConn class Te...
import numpy as np class Neurons(object): def __init__(self, in_put=np.array(), out_put=np.array(), weight=np.array(), bias=0): self.__input = in_put self.__output = out_put self.__weight = weight self.__bias = bias def get_input(self): return self.__input def get_out...
''' Created on Oct 12, 2013 @author: Eric ''' import psycopg2 class DataSource: def __init__(self, _user = 'ewinge', _password = 'riker692puppy'): self.user = _user self.password = _password self.connection = psycopg2.connect(user = self.user, database = self.user, password = self.password) ...
import sys import configparser from cells import Game config = configparser.RawConfigParser() def get_mind(name): full_name = 'minds.' + name __import__(full_name) mind = sys.modules[full_name] mind.name = name return mind bounds = None # HACK symmetric = None mind_list = None def main(): globa...
import pickle from nose.tools import eq_ from .. import tamil from .util import compare_extraction BAD = [ "பூல்", "பூலு", "கூதி", "தேவுடியாள்", "தேவடியாள்", "ஓத்த", "ஓத்தா", "சுன்னி", "சுண்ணி", "ஓல்", "ஓழ்", "ஓலு", "ஓழு", "ஓழி", "ஒம்மால", "சூத்து", "ம...
""" Inventory Management A module to record inventories of items at a locations (sites), including Warehouses, Offices, Shelters & Hospitals """ module = request.controller resourcename = request.function if not settings.has_module(module): raise HTTP(404, body="Module disabled: %s" % module) def index(...
""" `nop` command test module """ import pytest from tests.utils import ( ARCH, GefUnitTestGeneric, _target, findlines, gdb_run_cmd, gdb_start_silent_cmd, gdb_run_silent_cmd ) class NopCommand(GefUnitTestGeneric): """`nop` command test module""" cmd = "nop" def test_cmd_nop_inact...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0003_auto_20210228_1721'), ] operations = [ migrations.AddField( model_name='userprofile', name='notify_in_telegram', ...
__author__ = 'Ollie Bennett | http://olliebennett.co.uk/' import olliebennett.logger as Log import olliebennett.config.twitter as TwitterConfig from twython import Twython, TwythonError, TwythonAuthError, TwythonRateLimitError api = Twython(TwitterConfig.CONSUMER_KEY, TwitterConfig.CONSUMER_SECRET, ...
""" 分页器,获取也没列表 """ def get_page_num_list(page_count, page_current, length=7): """ 获取分页器的页面列表 :param page_count: 总共多少页 :param page_current: 当前page :param length: 也没列表取几个 :return: page_num_list """ if page_count <= length: # 如果总共的页数,小于或者等于要取的长度,那么就返回全部的页面列表 page_num_list = ...
import os,sys import time import re import requests from bs4 import BeautifulSoup as bs import django os.environ['DJANGO_SETTINGS_MODULE'] = 'kutime.settings' django.setup() from kutime.models import * URL_MAJOR = 'http://sugang.korea.ac.kr/lecture/LecMajorSub.jsp' URL_ETC = 'http://sugang.korea.ac.kr/lecture/LecEtcSub...
import time import numpy as np from lcc.entities.star import Star from lcc.stars_processing.deciders import LDADec, QDADec, GradBoostDec from lcc.stars_processing.descriptors import AbbeValueDescr from lcc.stars_processing.stars_filter import StarsFilter from lcc.stars_processing.systematic_search.stars_searcher import...
try: from unittest.mock import patch, Mock except ImportError: from mock import patch, Mock from model_bakery import baker from .constants import * SkipField = locate('rest_framework.fields.SkipField') class SerializerAssert: _obj = None _serializer = None _return_fields = [] _mock_fields = [] ...
import sys import argparse from question_generator import QuestionGenerator def add_arguments(): parser = argparse.ArgumentParser() parser.add_argument('-s', '--sentence', type=str, help="The sentence for which questions are to be generated.") parser.add_argument('-t', '--question_type', type=str, default=[...
""" Created by Anne Pajon on 26 Apr 2012 Copyright (c) 2012 Cancer Research UK - Cambridge Research Institute. This source file is licensed under the Academic Free License version 3.0 available at http://www.opensource.org/licenses/AFL-3.0. Permission is hereby granted to reproduce, translate, adapt, alter, transf...
""" Django settings for UdownService project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) SECRET_K...
from django.conf.urls import url, include from material.frontend import urls as frontend_urls from . import views, tinder, resume_upload, resume_retrieval, take_picture urlpatterns = [ url(r'^review/(?P<idx>[0-9]+)/', tinder.review_page, name='review_page'), url(r'^review', tinder.review_page, name='review_page...
from collections import namedtuple def __parse_version(v): # pragma: nocover ver, rel = v, "final" for c in ("a", "b", "c"): parsed = v.split(c) if len(parsed) == 2: ver, rel = (parsed[0], c + parsed[1]) v = tuple((int(v) for v in ver.split("...
import os import sys sys.path.append('..') from util.util import * from util.param import * import pickle class Perform(): """docstring for Perform""" def __init__(self): self.redis = RedisHelper() def getRecomList(self): fileRecomList = open(PATH_RECOM_LIST, 'r') recomlist = pickle....
""" """ def p_decorate(func): def func_wrapper(name): return "<p>{0}</p>".format(func(name)) return func_wrapper def strong_decorate(func): def func_wrapper(name): return "<strong>{0}</strong>".format(func(name)) return func_wrapper def div_decorate(func): def func_wrapper(name): ...
from typing import Any, Dict, Optional from cleo.styles import OutputStyle from sdoc.sdoc2 import in_scope, out_scope from sdoc.sdoc2.node.CaptionNode import CaptionNode from sdoc.sdoc2.node.LabelNode import LabelNode from sdoc.sdoc2.node.Node import Node from sdoc.sdoc2.NodeStore import NodeStore class FigureNode(Node...
import re from django import forms from formidable.forms.field_builder import FieldBuilder from formidable.serializers.fields import FieldSerializer, BASE_FIELDS from formidable.forms.fields import ParametrizedFieldMixin, CharField from formidable.forms.widgets import TextInput COLOR_RE = re.compile('^#(?:[0-9a-fA-F]{3...
import unittest from katas.kyu_7.is_valid_identifier import is_valid class IsValidIdentifierTestCase(unittest.TestCase): def test_true(self): self.assertTrue(is_valid("okay_ok1")) def test_true_2(self): self.assertTrue(is_valid("$ok")) def test_true_3(self): self.assertTrue(is_valid(...
import networkx as nx import community as c import matplotlib.pyplot as plt G = nx.read_graphml("test1.graphml") dendo = c.generate_dendrogram(G) for level in range(len(dendo) - 1): print("partition at level", level, "is", c.partition_at_level(dendo, level)) partition = c.best_partition(G) m = c.modularity(partitio...
import time from ktane.services.message_service import MessageService class DelayingMessage: def __init__(self, message, delay): self.message = message self.delay = delay class DelayingMessageService(MessageService): def __init__(self, connection): super().__init__(connection) se...
"""dsite URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based ...
from dp_tornado.engine.controller import Controller class ModuleController(Controller): pass
from __future__ import (absolute_import, division, print_function) import numpy as np import scipy.constants avogadro = scipy.constants.N_A cm3_to_angstroms3 = 1e24 avogadro_term = avogadro / 1e24 PRECISION = 5 def is_int(value): """Checks if `value` is an integer :param value: Input value to check if integer ...
import logging import logging.handlers import multiprocessing import pubres from pubres.pubres_logging import setup_logging from .base import * class MultiprocessingQueueStreamHandler(logging.handlers.BufferingHandler): """A logging handler that pushes the getMessage() of every LogRecord into a multiprocessing....
import _plotly_utils.basevalidators class OrientationValidator(_plotly_utils.basevalidators.EnumeratedValidator): def __init__( self, plotly_name="orientation", parent_name="scatter.marker.colorbar", **kwargs ): super(OrientationValidator, self).__init__( plotly_name=plotly_name, ...
from PIL import Image import re import glob import pytesseract from pytesseract import image_to_string pytesseract.pytesseract.tesseract_cmd = '' #PATH TO TESSERACT FOLDER def getCoords(text): #Search text for coordinates and ask for user input coords = [] strictcoords = [] permcoordpattern = '[EW]\d{1,9}....
from app.schema.answer import Answer from app.schema.exceptions import TypeCheckingException from app.schema.widgets.date_widget import DateWidget from app.validation.date_type_check import DateTypeCheck class DateAnswer(Answer): def __init__(self, answer_id=None): super().__init__(answer_id) self.t...
import mimetypes import os def file_count(directory): _, _, filles = next(os.walk(directory)) return len(filles) def encode_multipart_formdata(files): """ fields is a sequence of (name, value) elements for regular form fields. files is a sequence of (name, filename, value) elements for data to be ...
import sys import urllib2 import re from PIL import ImageFont from PIL import Image from PIL import ImageDraw import cStringIO i = 1 while(i < len(sys.argv)): #Build URL userid = sys.argv[i] url = "http://dotabuff.com/players/"+userid #Get the profile page from the URL buffer = urllib2.urlopen(url) html = buffer....
""" .. _l-example-event-profling-dict: Profiling of dictionary ======================= .. index:: event, profiling, dictionary Implementation Python dictionary is quite efficient. It is possible to replace it with a C++ implementation? The following code compares several implementation of a dictionary ``{ str, int: int...
import os import shutil import subprocess from django.conf import settings from git_manager.helpers.git_helper import GitHelper from git_manager.helpers.github_helper import GitHubHelper PACKAGES_DIR = os.path.join(settings.PROJECT_ROOT, 'packages') def internalpackage_publish_update(package): """Publishes an inter...
import sys import json from watson_developer_cloud import ToneAnalyzerV3 from app.credentials import watson_credentials, youtube_credentials import requests from operator import itemgetter def get_comments(video): print(video) url = 'https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&maxResults=100&vid...
from .utils import LoganHandler
""" Contains the exceptions used by the groundstation module. """ class GroundstationError(Exception): """ General exception used as an ABC by the groundstation. """ pass class ParseError(GroundstationError): """ Exception raised when an error during parsing occurs. """ pass class CRCVal...
import unittest import numpy import chainer from chainer import cuda from chainer import functions from chainer import gradient_check from chainer import links from chainer import testing from chainer.testing import attr import sys @testing.parameterize( {'in_size': 10, 'out_size': 10}, {'in_size': 10, 'out_siz...
from rpy2 import robjects as ro import numpy as np import os ro.r('library(survival)') import re BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) f=open(os.path.join(BASE_DIR,'tcga_data','SARC','clinical','nationwidechildrens.org_clinical_follow_up_v4.0_sarc.txt')...
VENDOR_GROUP = 1 CUSTOMER_GROUP = 2 RETAILER_GROUP = 3 SUPER_ADMIN = 4
from flask import request, jsonify from datetime import datetime from hashlib import md5 from app.api import api_requests from app import model @api_requests.route('/user', methods=['POST']) def add_user(): if len(request.json['username']) > 20: abort(413) if len(request.json['password']) > 20: ...
import subprocess import sys import datetime import math import logging class GlobalLogger(object): def __init__(self): self._logger = None self.formatter = logging.Formatter('%(asctime)s - %(lineno)s - %(levelname)s - %(message)s') def __call__(self, fname=None, flevel=None, plevel=None): ...
from setuptools import setup setup( name = 'cenum', packages = ['cenum'], )
from django.db import models from django.db.models.signals import pre_save from django.dispatch import receiver class SoftDeleteManager(models.Manager): ''' Use this manager to get objects that have a deleted field Set objects = SoftDeleteManager() in the model to override the default manager. This way 'h...