src stringlengths 721 1.04M |
|---|
import wx
from logbook import Logger
from eos.saveddata.module import Module
import gui.builtinMarketBrowser.pfSearchBox as SBox
from gui.builtinMarketBrowser.events import ItemSelected, MAX_RECENTLY_USED_MODULES, RECENTLY_USED_MODULES
from gui.contextMenu import ContextMenu
from gui.display import Display
from gui.ut... |
#Made by Emperorc
import sys
from com.l2scoria import Config
from com.l2scoria.gameserver.datatables.sql import SpawnTable
from com.l2scoria.gameserver.model.quest import State
from com.l2scoria.gameserver.model.quest import QuestState
from com.l2scoria.gameserver.model.quest.jython import QuestJython as JQuest
from co... |
# -*- coding: utf-8 -*-
"""Model to record combatants' acceptance of the privacy policy."""
# standard library imports
# pylint complains about the uuid import but it is used for Required(uuid.UUID)
# pylint: disable=unused-import
import uuid
from datetime import datetime
# third-party imports
from flask import url_f... |
# Copyright 2017, OpenCensus Authors
#
# 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 w... |
#!/usr/bin/env python3
'''
--- Day 5: A Maze of Twisty Trampolines, All Alike ---
'''
def load_input(filename):
'''
Parse input file, returning an array of maze offsets.
'''
maze = list()
with open(filename, 'r') as file_input:
for line in file_input.readlines():
maze.append(i... |
#!/usr/bin/env py.test
# -*- coding: utf-8 -*-
from pytest import raises
from ufl import *
from ufl.algorithms.apply_function_pullbacks import apply_function_pullbacks, apply_single_function_pullbacks
from ufl.algorithms.renumbering import renumber_indices
from ufl.classes import Jacobian, JacobianInverse, JacobianDet... |
import asyncio
import logging
import struct
from enum import Enum
__all__ = ["TTLProbe", "TTLOverride", "CommMonInj"]
logger = logging.getLogger(__name__)
class TTLProbe(Enum):
level = 0
oe = 1
class TTLOverride(Enum):
en = 0
level = 1
oe = 2
class CommMonInj:
def __init__(self, monito... |
# -*- coding: utf-8 -*-
############################ Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... |
#!/usr/bin/python
# coding: utf8
'''
Created on Mar 24, 2011
Update on 2017-05-18
Ch 11 code
Author: Peter/片刻
GitHub: https://github.com/apachecn/AiLearning'''
print(__doc__)
from numpy import *
# 加载数据集
def loadDataSet():
return [[1, 3, 4], [2, 3, 5], [1, 2, 3, 5], [2, 5]]
# 创建集合 C1。即对 dataSet 进... |
import math
import collections
import random
import numpy as np
import tensorflow as tf
import itertools
import time
def sum_rows(x):
"""Returns a vector summing up each row of the matrix x."""
cols = tf.shape(x)[1]
ones_shape = tf.stack([cols, 1])
ones = tf.ones(ones_shape, x.dtype)
return tf.res... |
import urllib, urllib2
import os
from bs4 import BeautifulSoup as soup
import psycopg2
import time
from random import random
from math import ceil
TOP_URL = 'https://a866-bcportal.nyc.gov/BCPortals/LicenseCheckResults.aspx?'
spanid = 'ctl00_Content_lblTotalTop'
conn = psycopg2.connect(dbname='nyc')
cur = conn.cursor... |
# -*- coding:Utf8 -*-
# Examen de programmation Python - 6TSIb - Juin 2004
from tkinter import *
class FaceDom(object):
def __init__(self, can, val, pos, taille =70):
self.can =can
# ***
x, y, c = pos[0], pos[1], taille/2
can.create_rectangle(x -c, y-c, x+c, y+c, fill ='ivory', wi... |
from datetime import date
from django import template
from django.conf import settings
from demo.models import *
register = template.Library()
# settings value
@register.assignment_tag
def get_googe_maps_key():
return getattr(settings, 'GOOGLE_MAPS_KEY', "")
@register.assignment_tag(takes_context=True)
def ge... |
import sys, time, re, urllib2, json, psycopg2
import logging
from base64 import b64decode
import helpers.errors
import inspect
logger = logging.getLogger(__name__)
def lineno():
"""Returns the current line number in our program."""
return inspect.currentframe().f_back.f_lineno
class Ha:
def __init__(s... |
"""Longest repeated substring (or LCP = longest common prefix in a suffix array).
Problem: find the longest repeated substring inside a string.
Steps:
1. Create suffixes. This should be linear in time and space, but it isn't.
Slicing strings in Python (with slice or [a:b]) is a linear operation
wit... |
from __future__ import (absolute_import, division, print_function)
import sys
import warnings
try:
from setuptools import setup
except ImportError:
try:
from setuptools.core import setup
except ImportError:
from distutils.core import setup
from distutils.core import setup, Extension
impor... |
# Copyright (c) 2014-2016 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# Copyright (C) 2011 kedals0@gmail.com
# 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... |
from bitarray import bitarray
def MissingNumbers(array):
bArray = bitarray(100)
missingNums = []
tempPair = []
strList = []
itr = iter(range(100))
strRange = ""
for num in array:
bArray[num] = 1
for i in itr:
print(i)
if bArray[i] == 0:
tempPair.a... |
#
# The Qubes OS Project, https://www.qubes-os.org/
#
# Copyright (C) 2010-2015 Joanna Rutkowska <joanna@invisiblethingslab.com>
# Copyright (C) 2011-2015 Marek Marczykowski-Górecki
# <marmarek@invisiblethingslab.com>
# Copyright (C) 2014-2015 Wojtek Porczyk <woju@invisiblethingslab.com>... |
"""The main views for our expense_tracker app."""
from pyramid.view import view_config, forbidden_view_config
from expense_tracker.models import Expense
from pyramid.httpexceptions import HTTPFound
from pyramid.response import Response
import datetime
from expense_tracker.security import check_credentials
from pyramid... |
# 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
# distribu... |
#!/usr/bin/python
#
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... |
from __future__ import absolute_import
from __future__ import unicode_literals
from webfriend.scripting.commands.base import CommandProxy
from webfriend import exceptions
class CookiesProxy(CommandProxy):
def all(self, urls=None):
"""
Return a list of all cookies, optionally restricted to just a s... |
#!/usr/bin/env python
import sys
import os
import numpy
from pyx import canvas, text, path, graph, color, trafo, unit, attr, deco, style, bitmap
import h5py
import hifive
unit.set(defaultunit="cm")
text.set(mode="latex")
text.preamble(r"\usepackage{times}")
text.preamble(r"\usepackage{sansmath}")
text.preamble(r"\... |
"""
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
"License"); you may not use this ... |
# Copyright 2018 adtac <weechat@adtac.in>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish... |
# coding=utf-8
import logging
from optparse import make_option
from pprint import pprint
import re
import numpy
import math
from django.conf import settings
from django.core.management import BaseCommand
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from bilanci.utils.comuni import FL... |
#!/usr/bin/env python
# submit logs to DShield 404 project
import os
import sys
import sqlite3
from DShield import DshieldSubmit
from datetime import datetime
import json
# We need to collect the local IP to scrub it from any logs being submitted for anonymity, and to reduce noise/dirty data.
# To do: turn below into... |
from ..do.line import integrate_numbers_rect
from ....util.do.iterators import WidthIterator, StepIterator
def integrate_steps(f, rnge, steps):
"""
Approximate the integral of ``f``
in the range ``rnge`` using a decomposition
with ``steps`` subintervalls.
``f`` must return ``float`` or ``int``.
``rnge`` must... |
import logging
import uuid
import struct
import os
import time
import re
import types
import base64
import random
import tempfile
logger = logging.getLogger('radiator')
def start_server(reactor,
dir=None,
fsync_millis=0,
rewrite_interval_secs=300):
broker = Brok... |
# -*- coding: utf-8 -*-
from scribeui_pyramid.modules.app.sqla import Base, BaseMixin
import sqlalchemy as sa
#from . import (
# DBSession,
# Base,
# BaseMixin
#)
class Job(Base, BaseMixin):
__tablename__ = 'jobs'
id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
title = sa.Colu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# utils.py
#
# Copyright 2016 Bruno S <bruno@oac.unc.edu.ar>
#
# 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 2 of the Licens... |
#!/usr/bin/env python
"""A module with utilities for dealing with context managers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from typing import ContextManager
from typing import Generic
from typing import Sequence
from typing import TypeVar
_T ... |
#!c:\\python\\python.exe
import threading
import getopt
import time
import sys
import os
from sulley import pedrpc
import pcapy
import impacket
import impacket.ImpactDecoder
PORT = 26001
IFS = []
ERR = lambda msg: sys.stderr.write("ERR> " + msg + "\n") or sys.exit(1)
USAGE = "USAGE: network_monitor.py" ... |
# coding: utf-8
from time import sleep
from .actuator import Actuator
from .._global import OptionalModule
try:
import serial
except (ModuleNotFoundError, ImportError):
serial = OptionalModule("pyserial")
ACCEL = b'.1' # Acceleration and deceleration times
class Oriental(Actuator):
"""To drive an axis with ... |
from __future__ import with_statement
import Live
import time
import math
import sys
from _Framework.ButtonElement import ButtonElement # Class representing a button a the controller
from _Framework.ButtonMatrixElement import ButtonMatrixElement # Class representing a 2-dimensional set of buttons
from _Framework.Chann... |
# coding: utf-8
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import telestream_cloud_qc
from telestream_cl... |
# Interactive preview module, run with python -i
import cv2
import numpy as np
import picamera
import picamera.array
import sys
import multiprocessing as mp
RESOLUTION = (640,480)
FRAMERATE = 5
OFFSET = 10
M = np.load('M.npy')
width, height = np.load('res.npy')
def compute_map(M_inv, x, y, width, height):
coords ... |
# -*- coding: UTF-8 -*-
# Copyright 2011-2018 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
# This is a masterpiece of untransparent code, difficult to understand
# and maintain. But I didn't find a better solution. Maybe an XSLT
# expert might help us to rewrite this from scratch. The purpose is ver... |
from django import template
from datetime import timedelta, datetime
register = template.Library()
def days_between(d1, d2):
return abs((d2 - d1).days)
@register.simple_tag
def bilirubin_rating(data):
test_value = data.data_value
if test_value < 34:
return_value = 0
elif test_value >= 34 a... |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
import numpy as np
import random
def frame_reducers():
data = [[random.uniform(-10000,10000) for r in range(10)] for c in range(10)]
h2o_data = h2o.H2OFrame(zip(*data))
np_data = np.array(data)
h2o_val = h2o_data... |
import os
from netCDF4 import Dataset as NCDataset
from dateutil import parser as dateparser
from datetime import datetime
from birdfeeder.utils import humanize_filesize
import logging
logger = logging.getLogger(__name__)
SPATIAL_VARIABLES = [
'longitude', 'lon',
'latitude', 'lat',
'altitude', 'alt', 'l... |
__author__ = 'Allen Goodman'
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
try:
from setuptools.command.test import test
except ImportError:
command = {}
else:
class PyTest(test):
def __init__(self, dist, **kw):
super().__init__(dist, **... |
from __future__ import absolute_import
from __future__ import print_function
import atexit
import os.path
import codecs
import sys
from diary import logdb
from diary import levels
from diary import formats
from diary import events
_PY2 = sys.version_info[0] == 2
class Diary(object):
"""Diary is a low-dependency... |
class Solution(object):
def fourSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[List[int]]
"""
if not nums:
return []
numsSorted = sorted(nums)
result = []
if numsSorted[0] * 4 > t... |
from django.contrib import admin
from django.contrib.auth.admin import GroupAdmin as BaseGroupAdmin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import Group as StockGroup
from django.utils.translation import gettext_lazy as _
from cuser.forms import UserChangeForm, ... |
import inspect
import os
import pkgutil
import sys
from configuration_py.parsers.base_parser import BaseConfigParser
PARSERS_DIR_NAME = 'parsers'
def get_supported_extensions():
available_parsers = _lookup_for_available_parsers()
for parser_class in available_parsers:
for extension in parser_class.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07.
# 2019, SMART Health IT.
import os
import io
import unittest
import json
from . import account
from .fhirdate import FHIRDate
class AccountTests(unittest.TestCase):
def instantiate_from(self, filename):
... |
from IPython.parallel.error import CompositeError
import os
from nose.tools import assert_raises
from .utils import assert_eventually_equal
from .test_pipeline import PipelineTest
class TestLogging(PipelineTest):
def test_logging(self):
"""Test that logging information is propagated and stored
... |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2019-10-27 14:30
import logging
from typing import Union, Any, List, Tuple, Iterable
import tensorflow as tf
from hanlp.common.keras_component import KerasComponent
from hanlp.components.taggers.ngram_conv.ngram_conv_tagger import NgramTransform, NgramConvTaggerTF
from ... |
#!/usr/bin/python
########################################################################
# 9 Jan 2015
# Patrick Lombard, Centre for Stem Stem Research
# Core Bioinformatics Group
# University of Cambridge
# All right reserved.
########################################################################
import argparse
... |
# coding=utf-8
from django.core.urlresolvers import reverse
from django.http import HttpResponseBadRequest
from django.shortcuts import render
from .models import Cas, CasLoginError
def login(request):
if request.method == 'POST':
if 'username' not in request.POST or 'password' not in request.POST:
... |
from flask import Blueprint, redirect, render_template
import json
import docker
import security
admin = Blueprint('admin', __name__)
@admin.route('/admin')
@security.logged_in
@security.admin
def admin_home():
images = sorted(docker.images(), key=lambda i: i['repository'])
processes = sorted(docker.ps(), ke... |
#!/usr/bin/env python
#HTML template for Mode S map display
#Nick Foster, 2013
def html_template(my_apikey, my_position, json_file):
if my_position is None:
my_position = [37, -122]
return """
<html>
<head>
<title>ADS-B Aircraft Map</title>
<meta name="viewport" content="initial-sc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# django_url_bits documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in th... |
__all__ = [
'styles', 'Style', 'CSSNode',
'evaluate'
]
# importing basic names to publish them
from .style import styles, Style
from .node import CSSNode
# importing extensions
import border, borderimage, background, font
import rendering
def evaluate(window, element = None):
if element is None:
element = w... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2019 Bitergia
#
# 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 License, or
# (at your option) any later version.
#
# This ... |
'''
Copyright Nate Carson 2012
'''
from PyQt4 import QtCore, QtGui, QtSvg
import db
import data
def setAttackSum(self, forces):
for force in forces:
self._squares[force.tid].setAttackSum(force.c_white, force.c_black)
def setAttackSum(self, c_white, c_black):
c_white, c_black = c_white or 0, c_black o... |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Kyu
#
# Created: 01/11/2012
# Copyright: (c) Kyu 2012
# Licence: <your licence>
#-------------------------------------------------------------------------------
# Combi Try!
imp... |
#!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
import string
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PKG_NAME = os.path.basename(SCRIPT_DIR)
PARAMETERS = None
#XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=... |
# -*- coding: utf-8 -*-
import os
import pytest
import zipfile
from thefuck.rules.dirty_unzip import match, get_new_command, side_effect
from tests.utils import Command
from unicodedata import normalize
@pytest.fixture
def zip_error(tmpdir):
def zip_error_inner(filename):
path = os.path.join(str(tmpdir),... |
# -*- coding: utf-8 -*-
"This module defines the UFL finite element classes."
# Copyright (C) 2008-2016 Martin Sandve Alnæs
#
# This file is part of UFL (https://www.fenicsproject.org)
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# Modified by Kristian B. Oelgaard
# Modified by Marie E. Rognes 2010, 2012
# Modi... |
import pandas as pd
import patools.trial as tr
import os
import numpy as np
from collections import OrderedDict
class Dataset:
def __init__(self, directory=os.getcwd(), nbs=False):
self.trials = self.loadDataset(directory, nbs=nbs)
self.df = pd.DataFrame(index=self.trials.keys())
self._get... |
# Copyright (C) 2003-2009 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (a... |
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import setSecurityManager
from euphorie.client import publish
from euphorie.content.upload import SurveyImporter
from euphorie.content.user import UserPro... |
# Copyright 2016 Twitter. 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 agree... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# __init__.py
# Copyright (C) 2014 Davide Depau <me@davideddu.org>
#
# NamedBoxes 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,... |
import pygame
from pygame.rect import Rect
try:
import pygame_sdl2
pygame_sdl2.import_as_pygame()
except ImportError:
pass
from DebugInfo import DebugInfo
from engine import Point, Scene, GameObject
from engine.Animation import Animation
from engine.TileMap import TileMap
from engine import Physics
from ra... |
# Copyright 2015 DataStax, 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 writing, s... |
from typing import Any, Dict, List, Optional, Union
import great_expectations.exceptions as ge_exceptions
from great_expectations import DataContext
from great_expectations.core.batch import BatchRequest
from great_expectations.execution_engine.execution_engine import MetricDomainTypes
from great_expectations.profile.... |
# coding: utf-8
#
# xiaoyu <xiaokong1937@gmail.com>
#
# 2014/10/14
#
"""
Models for xlink.
"""
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from model_utils import TimeStampedModel
SENSOR_CHOICES = (
('switch', _('Switch')),
... |
from django.conf import settings
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.simple import direct_to_template
from registration.views import activate
from registration.views import register
from accounts.forms import RegistrationForm
urlpatterns = patterns('',
url(... |
from isign_base_test import IsignBaseTest
import os
from os.path import exists
from isign import isign
import logging
log = logging.getLogger(__name__)
class TestPublicInterface(IsignBaseTest):
def _test_signable(self, filename, output_path):
self.resign(filename, output_path=output_path)
assert... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from people.models import User
from django.utils.translation import ugettext as _
from .forms import CustomUserCreationForm, CustomUserChangeForm
class CustomUserAdmin(UserAdmin):
# Set the add/modify forms
add_form = CustomUser... |
#!/usr/bin/env python
import argparse
## This script parses a sam file from BWA-MEM and outputs a log of alignment counts and percentages.
# Parse command line arguments
parser = argparse.ArgumentParser(description='Parse sam file to get alignment counts.')
parser.add_argument('-sam','--sam_file',dest='sam', action='... |
from sitetree.settings import ALIAS_TRUNK
def test_stress(template_render_tag, template_context, template_strip_tags, build_tree, common_tree):
build_tree(
{'alias': 'othertree'},
[{'title': 'Root', 'url': '/', 'children': [
{'title': 'Other title', 'url': '/contacts/russia/web/privat... |
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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... |
import sqlite3
from functools import wraps
from flask import Flask, flash, redirect, render_template, request, session, url_for
# config
app = Flask(__name__)
app.config.from_object('_config')
# helper functions
def connect_db():
return sqlite3.connect(app.config['DATABASE_PATH'])
def login_required(test):
... |
#!/usr/bin/python -Wall
# -*- coding: utf-8 -*-
"""
<div id="content">
<div style="text-align:center;" class="print"><img src="images/print_page_logo.png" alt="projecteuler.net" style="border:none;" /></div>
<h2>Coded triangle numbers</h2><div id="problem_info" class="info"><h3>Problem 42</h3><span>Published on Friday,... |
<<<<<<< HEAD
<<<<<<< HEAD
def count(sequence, item):
number = 0
for i in sequence:
if i is item:
number += 1
return number
def purify(x):
l=[]
for c in x:
if c%2==0:
l.append(c)
return l
def product(x):
res = 1
for i in x:
res *= i
return... |
from includes import *
from parameters import Settings
class Tree:
def __init__(self, root):
self.settings = Settings()
self.orientation = self.settings.dvData.treeAlignment
self.maxDepth = 100
self.siblingSeperation = 5
self.subtreeSeperation = 5
self.levelSeperation = 40
self.maxLevelHeight = []
sel... |
from enum import Enum
from collections import namedtuple
from nltk.tag import SennaTagger
Word = namedtuple('Word', ['token', 'POS'])
class PartOfSpeach(Enum):
"""A word's part of speech in a sentence."""
ADJECTIVE = 1
ADVERB = 2
NOUN = 3
VERB = 4
OTHER = 5
class Tagger:
"""Tag words... |
# coding=utf-8
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import json
import logging
from time import sleep
from datetime import datetime, timedelta
from sqlalchemy import Column, Unicode, Integer, DateTime
from sqlalch... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import io
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from setuptools import find_packages
fro... |
# -*- coding: utf-8 -*-
#
# copyright by its authors
#
# This file is part of the didactic code used at the UNAS
#
# UNAS didactic code 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 L... |
import io
import struct
little_endian_types = {
'int8': 'b',
'uint8': 'B',
'int16': 'h',
'uint16': 'H',
'int32': 'i',
'uint32': 'I',
'int64': 'q',
'uint64': 'Q',
'float': 'f',
'float32': 'f',
'double': 'd',
'char': 'c',
'bool': '?',
'pad': 'x',
'void*': 'P',
}
big_endian_types = { k:">"+v for k,v in li... |
# -*- 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
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'HttpCheckLog'
db.delete_table(u'siteup_api_httpchecklog... |
import base64
from functools import wraps
from django.conf import settings
from django.contrib.auth import authenticate
from vendor.xapi.lrs.exceptions import Unauthorized, OauthUnauthorized, BadRequest
from vendor.xapi.lrs.models import Token, Agent
from vendor.xapi.oauth_provider.utils import send_oauth_error
... |
from __future__ import unicode_literals
from __future__ import absolute_import
import os.path
from django.conf import settings as django_settings
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translat... |
# -*- coding: utf-8 -*-
class Manager(object):
# should be re-defined in a subclass
state_name = None
object_type = None
def __init__(self, api):
self.api = api
# shortcuts
@property
def state(self):
return self.api.state
@property
def queue(self):
return ... |
# coding: utf-8
# Copyright (C) 2017 Open Path View
# 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 License, or
# (at your option) any later version.
# This program is d... |
import sys
import lit.ProgressBar
def create_display(opts, tests, total_tests, workers):
if opts.quiet:
return NopProgressDisplay()
of_total = (' of %d' % total_tests) if (tests != total_tests) else ''
header = '-- Testing: %d%s tests, %d workers --' % (tests, of_total, workers)
progress_bar... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
#!/usr/bin/env python
class LRUCache:
class Node:
def __init__(self, key, val):
self.val, self.key = val, key
self.prev = None
self.next = None
def __init__(self, capacity):
"""
:type capacity: int
"""
self.capacity = capacity
... |
from pymongo import MongoClient
class DBClient(object):
""" This provides a wrapper around the MongoClient package, and also
allows for some default values to be added.
test = DBClient('172.21.66.37', 'amwayio').main()
print test.discovery_todo.find().count()
"""
def __init__(self... |
import datetime, os, subprocess, sys
from time import time, sleep
import cv2
import numpy as np
cwd = os.getcwd()
try:
import motmot.cam_iface.cam_iface_ctypes as cam_iface
if not cam_iface.get_num_cameras():
print 'No IEEE1394 camera found'
cam_iface = None
except ImportError:
cam_iface =... |
# Copyright 2015 The TensorFlow 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 applica... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Oros
# Contributors :
# purwowd
# puyoulu
# 1kali2kali
# petterreinholdtsen
# nicoeg
# dspinellis
# fdl <Frederic.Lehobey@proxience.com>
# 2020-08-15
# License : CC0 1.0 Universal
"""
This program shows you IMSI numbers of cellphones around you.
/! This... |
import datetime
import random
import os
import yaml
import pytz
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.template.defaultfilters import slugify
class BaseTimetracking(models.Model):
name = models.CharField(max_length=200)
slug = mo... |
#!/usr/bin/python2
#
#~~monsters.py~~
from time import sleep
#from random import randint
import actions
class CreateMonster(object):
def __init__(self, health, damage_dealt, name):
self.health = health
self.damage_dealt = damage_dealt
self.name = name
def __str__(self):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.