code stringlengths 1 199k |
|---|
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('layout_page', '0007_auto_20170509_1148'),
]
operations = [
migrations.AddField(
model_name='layoutpage',
name='admin_notes',
... |
__title__ = 'pywebtask'
__version__ = '0.1.8'
__build__ = 0x000108
__author__ = 'Sebastián José Seba'
__license__ = 'MIT'
__copyright__ = 'Copyright 2016 Sebastián José Seba'
from .webtasks import run, run_file
import logging
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHand... |
import traceback
import BigWorld
from gui.Scaleform.daapi.view.lobby.messengerBar.NotificationListButton import NotificationListButton
from xfw import *
import xvm_main.python.config as config
from xvm_main.python.logger import *
@overrideMethod(NotificationListButton, 'as_setStateS')
def _NotificationListButton_as_se... |
English = {
'consonants': ['B', 'CH', 'D', 'DH', 'F', 'G', 'HH', 'JH', 'K', 'L', 'M', 'N',
'NG', 'P', 'R', 'S', 'SH', 'T', 'TH', 'V', 'W', 'Y', 'Z', 'ZH'],
'vowels': [ 'AA', 'AE', 'AH', 'AO', 'AW', 'AY', 'EH', 'ER', 'EY', 'IH', 'IY', 'OW', 'OY', 'UH', 'UW'],
'onsets': ['P', 'T', 'K', 'B', 'D', 'G', 'F', 'V', 'TH', ... |
import re
from copy import copy
from random import randint
class Server(object):
def __init__(self, ip, port, hostname):
self.ip = ip
self.port = port
self.hostname = hostname
self.weight = 500
self.maxconn = None
def __cmp__(self, other):
if not isinstance(other,... |
__author__ = "Christian Kongsgaard"
__license__ = 'MIT'
from delphin_6_automation.database_interactions.db_templates import delphin_entry
from delphin_6_automation.database_interactions.db_templates import sample_entry
from delphin_6_automation.database_interactions import mongo_setup
from delphin_6_automation.database... |
def pe0001(upto):
total = 0
for i in range(upto):
if i % 3 == 0 or i % 5 == 0:
total += i
return total
print(pe0001(1000)) |
from setuptools import setup, find_packages
setup(name='MODEL1201230000',
version=20140916,
description='MODEL1201230000 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/MODEL1201230000',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages()... |
import os
def replace_temp(inputfile_folder):
os.chdir(inputfile_folder)
home_dir = os.getcwd()
for i in os.listdir(os.getcwd()):
if os.path.isdir(i):
os.chdir(i)
print("In folder: {}".format(os.getcwd()))
for z in os.listdir(os.getcwd()):
if '.txt... |
"""
Invenio utilities to run SQL queries.
The main API functions are:
- run_sql()
- run_sql_many()
- run_sql_with_limit()
but see the others as well.
"""
__revision__ = "$Id$"
from MySQLdb import Warning, Error, InterfaceError, DataError, \
DatabaseError, OperationalError, IntegrityError... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Subscription.paid'
db.add_column(u'subscriptions_subscription', 'paid',
self.gf('django.db.models... |
import re
from stgit.compat import environ_get
from stgit.config import config
from .base import Immutable
from .date import Date
class Person(Immutable):
"""Represents an author or committer in a Git commit object.
Contains :attr:`name`, :attr:`email` and :attr:`timestamp`.
"""
def __init__(self, name,... |
"""Called from datakortet\dkcoverage.bat to record regression test
coverage data in dashboard.
"""
import re
import os
import glob
from coverage import coverage, misc
from coverage.files import find_python_files
from coverage.parser import CodeParser
from coverage.config import CoverageConfig
from . import dkenv
def... |
from GSettingsWidgets import *
from ChooserButtonWidgets import TweenChooserButton, EffectChooserButton
EFFECT_SETS = {
"cinnamon": ("traditional", "traditional", "traditional", "none", "none", "none"),
"scale": ("scale", "scale", "scale", "scale", "scale", "scale"),
"fade": ("fad... |
import os
import sys
import MySQLdb
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "academicControl.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
import crypt
from twisted.cred import portal
from twisted.internet import defer, reactor
from twisted.python import log as tlog
from twisted.spread import pb as tpb
from twisted.trial import unittest
from zope.interface import implements
from flumotion.common import testsuite
from flumotion.common import keycards, log,... |
import numpy as np
import re
import os
def GetBlocks(filename):
'''
prende il filename e ritorna la lista [[[pt1.x,pt1.y],...],[blocco2],...]
'''
f=open(filename)
block=False
lastlist=[]
listone=[]
for i in f:
print(i)
if(re.match(r"[\d\.]+e[\+\-][\d]+\t[\d\.]+e[\+\-][\d]... |
import sys
MAXLINELEN = 80
TABLEN = 8
FIRSTLINELEN = MAXLINELEN - TABLEN - 3
OTHERLINELEN = FIRSTLINELEN - 2 * TABLEN
FIRSTLINEBYTES = FIRSTLINELEN // 2
OTHERLINEBYTES = OTHERLINELEN // 2
def fix_line(line):
return "".join("\\x{}".format(line[i:i + 2].decode()) for i in range(0, len(line), 2))
def main():
with open(s... |
import rubber.dvip_tool
import rubber.module_interface
class Module (rubber.module_interface.Module):
def __init__ (self, document, opt):
self.dep = rubber.dvip_tool.Dvip_Tool_Dep_Node (document, 'dvips') |
import pygame
import logging
logger = logging.getLogger("gui")
CURSOR_UP = pygame.USEREVENT + 1
CURSOR_DOWN = pygame.USEREVENT + 2
CURSOR_LEFT = pygame.USEREVENT + 3
CURSOR_RIGHT = pygame.USEREVENT + 4
CURSOR_ACCEPT = pygame.USEREVENT + 5
CURSOR_CANCEL = pygame.USEREVENT + 6
LOWER_CAMERA = pygame.USEREVENT + 7
RAISE_CA... |
t = 1 # triangle number order, e.g. t=7 is 7th triangle number or 1+2+3+4+5+6+7=28
divisors = []
while len(divisors) <= 500:
n = sum(range(1,t+1)) # Generate triangle number
step = 2 if n%2 else 1
divisors = reduce(list.__add__, ([i, n//i] for i in range(1, int((n**0.5))+1, step) if n % i == 0))
t += 1
... |
"""
.. module:: measurematrix.py
.. moduleauthor:: Jozsef Attila Janko, Bence Takacs, Zoltan Siki (code optimalization)
Sample application of Ulyxes PyAPI to measure within a rectangular area
:param argv[1] (int): number of horizontal intervals (between measurements), default 1 (perimeter only)
:param argv[2] (in... |
import os
import sys
def main():
if len(sys.argv) <= 2:
print("This script generates the .expected file from your PS3's debug logs.")
print("")
print("Usage: convert-ps3-output.py <input> <output>")
print("Example: convert-ps3-output.py hello_world.log hello_world.expected")
... |
__author__ = 'Matteo'
__doc__='''This could be made into a handy mutagenesis library if I had time.'''
from Bio.Seq import Seq,MutableSeq
from Bio import SeqIO
from Bio.Alphabet import IUPAC
from difflib import Differ
def Gthg01471():
ori=Seq("ATGAGCATAAGTTTATCGGTTCCAAAATGGTTATTAACAGTTTTATCAATTTTATCTTTAGTCGTAGCATTT... |
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from django.contrib.auth.decorators import login_required, user_passes_test
urlpatterns = patterns('',
url(r'^$', 'website.views.index', name='website_index'),
url(r'^termos/$',TemplateView.as_view(template_name='website/te... |
"""Models for database connection"""
import settings |
__doc__="""cpqScsiPhyDrv
cpqScsiPhyDrv is an abstraction of a HP SCSI Hard Disk.
$Id: cpqScsiPhyDrv.py,v 1.2 2011/01/04 23:27:26 egor Exp $"""
__version__ = "$Revision: 1.2 $"[11:-2]
from HPHardDisk import HPHardDisk
from HPComponent import *
class cpqScsiPhyDrv(HPHardDisk):
"""cpqScsiPhyDrv object
"""
stat... |
reactorchoices = ["epollreactor", "kqreactor", "cfreactor", "pollreactor", "selectreactor", "posixbase", "default"]
for choice in reactorchoices:
try:
exec("from twisted.internet import %s as bestreactor" % choice)
break
except:
pass
bestreactor.install()
from twisted.internet import reactor
from twisted.protoc... |
import curses
import curses.textpad
import os
class term():
"""
Screen layout:
+--- staFrame -----------------++--- msgFrame -----------------+
|stawin ||msgwin |
| || |
| || ... |
from Probabilidades import Probabilidad
from validador import *
a = Probabilidad()
a.cargarDatos("1","2","3","4","5","6")
uno = [" ------- ","| |","| # |","| |"," ------- "]
dos = [" ------- ","| # |","| |","| # |"," ------- "]
tres = [" ------- ","| # |","| # |","| # |... |
from django.shortcuts import redirect
from portfolio.models.comments import PhotoComment
from portfolio.models.photos import Photo
from portfolio.views.base import AuthenticatedView
class CommentPhotoView(AuthenticatedView):
""" View that handles commenting on a photo """
def post(self, request):
commen... |
import os
import logging
import socket
import urllib
import kaa
import kaa.beacon
from ... import core as freevo
log = logging.getLogger('freevo')
import utils
import eventserver
import videolibrary as VideoLibrary
import player as Player
import playlist as Playlist
class PluginInterface( freevo.Plugin ):
"""
J... |
import os
import sys
import shutil
import tarfile
if sys.argv[1] == 'check':
# Called from run_command() during setup or configuration.
# Check which archive format can be used.
# In order from most wanted to least wanted: .tar.xz, .tar.gz, .tar
available_archive_formats = []
for af in shutil.get_archive_form... |
class Solution(object):
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
nums = [0 for _ in xrange(n + 1)]
for i in xrange(1, n + 1):
if i == 1:
nums[1] = 1
elif i == 2:
nums[2] = 2
else:
... |
"This program will parse matrix files to convert them into objects usable by JS files"
import json
import os
import re
EDNAFULL=open("EDNA/EDNAFULL.txt")
EDNAMAT=open("EDNA/EDNAMAT.txt")
EDNASIMPLE=open("EDNA/EDNASIMPLE.txt")
mat=open ("matrixEDNA.json","w")
mat.write("matrixEDNA=")
mat.write("{")
test=os.listdir("./ED... |
"""Module to read/write ascii catalog files (CSV and DS9)"""
"""
The following functions are meant to help in reading and writing text CSV catalogs
as well as DS9 region files. Main structure used is dictionaries do deal with catalog
data in a proper way.
"""
import sys
import logging
import csv
import re
import string... |
from random import *
import ctypes
import sys
import os
import fileinput
import marshal # buffered marshal is bloody fast. wish i'd found this before :)
import struct
import time
import zipfile
import re
import threading
timers_started = False
def to_sec(s):
seconds_per_unit = {"s": 1, "m": 60, "h": 3600, "d": 86400, ... |
from datetime import date
class YearInfo(object):
def __init__(self, year, months_ok, months_na):
self.year = year
self.months = set(range(1, 13))
self.months_ok = set(months_ok)
self.months_na = set(months_na)
self.months_er = self.months - (self.months_ok | self.months_na)
... |
"""Used to read hardware info from kudzu, /proc, etc"""
from socket import gethostname, getaddrinfo, AF_INET, AF_INET6
import socket
import re
import os
import sys
from up2date_client import config
from up2date_client import rhnserver
from rhn.i18n import ustr
try:
long
except NameError: # long is not defined in py... |
from logger import log
import os
import gconf
import urllib
class Configuration(object):
def __init__(self):
self._config = {}
self._file_path = os.path.join(os.path.dirname(__file__), 'config',
'config.ini')
# Read Files
self._read_file()
def get_value(self, key):
... |
from landscape.client.tests.helpers import LandscapeTest
from landscape.client.patch import UpgradeManager
from landscape.client.upgraders import monitor
class TestMonitorUpgraders(LandscapeTest):
def test_monitor_upgrade_manager(self):
self.assertEqual(type(monitor.upgrade_manager), UpgradeManager) |
from SecuML.core.DimensionReduction.Algorithms.Projection.Sdml import Sdml
from SecuML.core.DimensionReduction.Configuration import DimensionReductionConfFactory
from .SemiSupervisedProjectionConfiguration import SemiSupervisedProjectionConfiguration
class SdmlConfiguration(SemiSupervisedProjectionConfiguration):
d... |
"""
Импорт ФИАС (http://fias.nalog.ru) в PostgreSQL.
Необходимы:
* *python3.2+* с пакетами [requests](http://docs.python-requests.org/en/latest/), [lxml](http://lxml.de)
* *unrar*
* [*pgdbf*](https://github.com/kstrauser/pgdbf), обязательно с [патчем](https://github.com/kstrauser/pgdbf/commit/baa1d9579274a979aaf2f2d880... |
from gi.repository import Gtk
import dbus
import os
import signal
import sys
import logging
from sugar3 import session
from sugar3 import env
_session_manager = None
def have_systemd():
return os.access("/run/systemd/seats", 0) >= 0
class SessionManager(session.SessionManager):
MODE_LOGOUT = 0
MODE_SHUTDOWN... |
from picamera.exc import PiCameraError
from picamera.camera import PiCamera |
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
from .int import int
class KColorChooserMode(int):
# no doc
def __init__(self, *args, **kwargs): # real signature unknown
pass
__dict__ = None # (!)... |
"""
OpenStreetMap boundary generator.
Author: Andrzej Talarczyk <andrzej@talarczyk.com>
Based on work of Michał Rogalski (Rogal).
License: GPLv3.
"""
import os
import platform
import shutil
def clean(src_dir):
"""Remove target files.
Args:
src_dir (string): path to the directory from which target files ... |
from filetypes.basefile import BaseFile
from filetypes.plainfile import PlainFile
from filetypes.plainfile import ReviewTest
import filetypes
class JFLAPReviewTest(ReviewTest):
def __init__(self, dict_, file_type):
super().__init__(dict_, file_type)
def run(self, path):
"""A JFLAP review test ca... |
import os
import json
import time
import pytest
from kano_profile.paths import tracker_events_file
import kano_profile.tracker.tracking_events as tracking_events
from kano_profile.tracker.tracker_token import TOKEN
@pytest.mark.parametrize('event_name, event_type, event_data', [
('low-battery', 'battery', '{"status... |
from Tools.HardwareInfo import HardwareInfo
from Tools.BoundFunction import boundFunction
from config import config, ConfigSubsection, ConfigSelection, ConfigFloat, \
ConfigSatlist, ConfigYesNo, ConfigInteger, ConfigSubList, ConfigNothing, \
ConfigSubDict, ConfigOnOff, ConfigDateTime
from enigma import eDVBSatelliteE... |
""" lsa DCE/RPC """
import dcerpc as __dcerpc
import talloc as __talloc
class ForestTrustInformation(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs): # real signature unknown
pass
def __ndr_pack__(self, *args, **kwargs): # real signature unknown
"""
S.ndr_pack(object) ... |
import logging
log = logging.getLogger("Thug")
def SetUninstallName(self, arg):
if len(arg) > 900:
log.ThugLogging.log_exploit_event(self._window.url,
"Kingsoft AntiVirus ActiveX",
"SetUninstallName Heap Overflow") |
version=0.2
visitedVersion=0.2
enableNotification=True
isFirstStart=True
countClickUp=0
langList=['English','Russian']
searchEngines=['Google','Bing','Yahoo','Yandex']
defaultSearchEngine=0
defaultLangFrom='Auto'
defaultLangTo='Russian'
useControl=True
useDblControl=True
useNothing=False
useGoogle=True
useBing=False
us... |
"""
"""
from exception import *
class base_storage:
def __init__(self, usr=None, usr_key=None):
self.usr_key = None
self.usr = None
self.records = []
if usr is None:
return
self.load_info_from_file()
if self.usr != usr:
raise UsrError
if self.usr_key != usr_key:
raise PasswdError
def new_user(s... |
"""
EasyBuild support for DB, implemented as an easyblock
@author: Kenneth Hoste (Ghent University)
"""
import os
import shutil
from easybuild.easyblocks.generic.configuremake import ConfigureMake
from easybuild.tools.build_log import EasyBuildError
class EB_DB(ConfigureMake):
"""Support for building and installing... |
def trace(source):
for item in source:
print item
yield item
if __name__ == '__main__':
from apachelog import *
lines = open("access-log")
log = trace(apache_log(lines))
r404 = (r for r in log if r['status'] == 404)
for r in r404:
pass |
"""SCons.Tool.aixc++
Tool-specific initialization for IBM xlC / Visual Age C++ compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
__revision__ = "src/engine/SCons/Tool/aixc++.py rel_2.3.5:3329:275e75118ad... |
import connman
import bluetooth
import systemd
import sys
import pexpect
import json
RUNNING_IN_KODI = True
try:
import xbmc
import xbmcgui
import xbmcaddon
except:
RUNNING_IN_KODI = False
DEVICE_PATH = 'org.bluez.Device1'
PAIRING_AGENT = 'osmc_bluetooth_agent.py'
BLUETOOTH_SERVICE = 'bluetooth.service'... |
import operator
from X import LineDoubleDash
from Sketch.const import JoinMiter, JoinBevel, JoinRound,\
CapButt, CapProjecting, CapRound
from Sketch.Lib import util
from Sketch import _, Trafo, SimpleGC, SolidPattern, EmptyPattern, \
StandardDashes, StandardArrows, StandardColors
from Tkinter import Frame, La... |
from openerp import models,fields
class OeMedicalMedicamentCategory(models.Model):
_name = 'oemedical.medicament.category'
childs = fields.One2many('oemedical.medicament.category',
'parent_id', string='Children', )
name = fields.Char(size=256, string='Name', required=True)
... |
""" This script will take filenames from the stdin and copy/move them to a
directory destination preserving the directory tree and atributes.
Most of the functionality is taken from shutil module.
"""
import os
import sys
import stat
import errno
import getopt
import argparse
from shutil import *
import time
def copydi... |
from typing import Any, Dict, Optional
from flask import g, render_template, url_for
from flask_babel import format_number, lazy_gettext as _
from flask_wtf import FlaskForm
from wtforms import (
BooleanField, IntegerField, SelectMultipleField, StringField, SubmitField,
widgets)
from wtforms.validators import I... |
import sys
import subprocess
import cgi
import cgitb; cgitb.enable()
import hpsdnclient as hp
import sqlite3
import requests
from requests.auth import HTTPDigestAuth
import xml.etree.ElementTree as xml
form = cgi.FieldStorage()
server = form.getvalue('server')
user = form.getvalue('user')
passw = form.getvalue('passw')... |
from rest_framework import permissions
from django.contrib import messages
from copy import deepcopy
from rest_framework.permissions import *
def own_object_permission(field_name):
class P(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
print hasattr(obj, field_... |
"""
TLS handshake fields & logic.
This module covers the handshake TLS subprotocol, except for the key exchange
mechanisms which are addressed with keyexchange.py.
"""
from __future__ import absolute_import
import math
import struct
from scapy.error import log_runtime, warning
from scapy.fields import ByteEnumField, By... |
import mox
import time
import unittest
from zoom.agent.predicate.health import PredicateHealth
from zoom.common.types import PlatformType
class PredicateHealthTest(unittest.TestCase):
def setUp(self):
self.mox = mox.Mox()
self.interval = 0.1
def tearDown(self):
self.mox.UnsetStubs()
... |
""" Care about audio fileformat
"""
try:
from mutagen.flac import FLAC
from mutagen.oggvorbis import OggVorbis
except ImportError:
pass
import parser
import mutagenstripper
class MpegAudioStripper(parser.GenericParser):
""" Represent mpeg audio file (mp3, ...)
"""
def _should_remove(self, field)... |
"""Knowledge database models."""
import os
from invenio_base.globals import cfg
from invenio.ext.sqlalchemy import db
from invenio.ext.sqlalchemy.utils import session_manager
from invenio_collections.models import Collection
from invenio.utils.text import slugify
from sqlalchemy.dialects import mysql
from sqlalchemy.ev... |
from classes import *
sign = Object('sign', 'To the left is a sign.', 'The sign says: Den of Evil')
opening = Room('opening', 'You are standing in front of a cave.', {}, {'sign' : sign})
opening_w = Room('opening_w', 'You are standing in front of an impassable jungle. There is nothing here you can do.')
opening_w.add_r... |
import GemRB
from GUIDefines import *
from ie_stats import *
from ie_spells import LS_MEMO
import GUICommon
import Spellbook
import CommonTables
import LUSkillsSelection
CharGenWindow = 0
CharGenState = 0
TextArea = 0
PortraitButton = 0
AcceptButton = 0
GenderButton = 0
GenderWindow = 0
GenderTextArea = 0
GenderDoneBut... |
"""B2Share migration command line interface.
These commands were designed only for the migration of data from
the instance hosted by CSC on https://b2share.eudat.eu .
WARNING - Operating these commands on local instances may severely impact data
integrity and/or lead to dysfunctional behaviour."""
import logging
import... |
import numpy as np
import networkx as nx
G = nx.karate_club_graph()
L = nx.laplacian_matrix(G)
L
d = np.array([v for k,v in nx.degree(G).items()])
d
L.dot(d)
e = np.array([v for k,v in nx.betweenness_centrality(G).items()])
L.dot(e) |
from pida.core.events import EventsConfig
import unittest
class MockCallback(object):
def __init__(self):
self.calls = []
def __call__(self, **kw):
self.calls.append(kw)
class MockService(object):
"""used instead of None cause weakref proxy cant handle None"""
class EventTestCase(unittest.Te... |
"""
"""
import os, sys, commands, time
sys.path.insert(1, os.path.dirname( os.path.abspath(__file__) ) + '/../../')
from pxStats.lib.StatsPaths import StatsPaths
from pxStats.lib.CpickleWrapper import CpickleWrapper
class LogFileAccessManager(object):
def __init__( self, accessDictionary = None, accessFile = "" ):... |
from Components.ActionMap import ActionMap
from Components.Sources.List import List
from Components.Sources.StaticText import StaticText
from Components.ConfigList import ConfigList
from Components.config import *
from Components.Console import Console
from skin import loadSkin
from Components.Label import Label
from S... |
import numpy as np
def bi_level_img_threshold( hist ):
hist = hist.flatten()
print('len hist ', len(hist))
#start and end index of the histogram
I_s = 0
I_e = len(hist)-1
print('I_e ', I_e, 'I_m ', (I_s+I_e)/2)
print('hist [Ie]', hist[I_e])
# starting point: get right and left weights of histogram and
# det... |
from modules.viewer.hexedit.hexItem import *
from modules.viewer.hexedit.offsetItem import *
from modules.viewer.hexedit.asciiItem import *
from modules.viewer.hexedit.scrollbar import hexScrollBar
from PyQt4.QtCore import Qt, QLineF
from PyQt4.QtGui import QGraphicsView, QKeySequence, QHBoxLayout, QWidget, QFont, QGra... |
import os
from runpy import run_path
from .parametres import modules_par_defaut
_skip_dir = ('OLD', '__pycache__')
_modules_dir = os.path.normpath(os.path.join(__file__, '..', '..', 'modules'))
def _detecter_modules():
modules = []
descriptions = {}
def err(nom, msg):
print("Warning: %s n'est pas un... |
from papyon.msnp2p.constants import ApplicationID, EufGuid
from papyon.msnp2p.errors import FTParseError
from papyon.msnp2p.session import P2PSession
import gobject
import struct
__all__ = ['FileTransferSession']
class FileTransferSession(P2PSession):
def __init__(self, session_manager, peer, guid, message=None):
... |
"""
Handels everthing related to the main Window
"""
from __future__ import unicode_literals
import sys
from urllib.parse import urlparse, urlunparse
from PyQt5.QtWidgets import QMainWindow, QFileDialog, QMessageBox, QMessageBox
from PyQt5.QtCore import (QAbstractListModel, Qt, QModelIndex, QThread,
... |
import time
import json
import requests
from datetime import datetime
import paho.mqtt.client as mqtt
from sense_hat import SenseHat
BROKER_URL = '192.168.24.25'
CYCLE_TIME = 10
sense = SenseHat()
sense.low_light = True
def get_location():
"""Ermittelt die Stadt zur eigenen IP-Adresse."""
IP_LOCKUP_URL = "https... |
__author__ = 'Bright Pan'
import types
import urllib.request
try:
import simplejson as json
except Exception:
import json
import pymysql
import datetime
import sys
print(sys.getdefaultencoding())
def f(x):
if isinstance(x, str):
return x.encode("gbk", "ignore").decode("gbk")
return x
class DB(o... |
from __future__ import unicode_literals
from django.db import migrations, models
def port_models(apps, schema_editor):
Proposal = apps.get_model('core', 'Proposal')
Notice = apps.get_model('core', 'Notice')
n = Notice()
n.title = "Edital"
n.description = "Edital info"
n.save()
for p in Propo... |
import logging
import pickle
import re
from cacheops import invalidate_model
from django import http
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.shortcuts import redirect, render
from ..attendance import generate_roster_pdf
from ...fo... |
"""
@summary: This script will generate a surface using cones and ellipsoids
@author: CJ Grady
"""
from math import sqrt
import numpy as np
from random import randint
class SurfaceGenerator(object):
"""
@summary: This class is used to generate a surface to be used for testing
"""
# ............................ |
import MalmoPython
import os
import random
import sys
import time
import json
import random
import errno
def GetMissionXML():
return '''<?xml version="1.0" encoding="UTF-8" ?>
<Mission xmlns="http://ProjectMalmo.microsoft.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<About>
<S... |
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 field 'Person.slug'
db.delete_column(u'aldryn_people_person', 'slug')
# Deleting ... |
"""
file: gitissuetracker.py
author: Christoffer Rosen <cbr4830@rit.edu>
date: December, 2013
description: Represents a Github Issue tracker object used
for getting the dates issues were opened.
12/12/13: Doesn't currently support private repos
"""
import requests, json, dateutil.parser, time
from caslogging import log... |
"""
***************************************************************************
DensifyGeometriesInterval.py by Anita Graser, Dec 2012
based on DensifyGeometries.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Victor Olaya
Email : vo... |
"""
Use reentrant functions. Do not use not reentrant functions.(ctime, strtok, toupper)
== Violation ==
void A() {
k = ctime(); <== Violation. ctime() is not the reenterant function.
j = strok(blar blar); <== Violation. strok() is not the reenterant function.
}
== Good ==
void A() {
k = t.cti... |
"""
This module defines all the plotting functions for the
:class:`fretbursts.burstlib.Data` object.
The main plot function is `dplot()` that takes, as parameters, a `Data()`
object and a 1-ch-plot-function and creates a subplot for each channel.
The 1-ch plot functions are usually called through `dplot` but can also b... |
from lib.flowchart.nodes.generalNode import NodeWithCtrlWidget
class myNode(NodeWithCtrlWidget):
'''This is test docstring'''
nodeName = 'myTestNode'
uiTemplate = [{'name': 'HNO3', 'type': 'list', 'value': 'Closest Time'},
{'name': 'C2H5OH', 'type': 'bool', 'value': 0},
... |
""" gui -- The main wicd GUI module.
Module containing the code for the main wicd GUI.
"""
import os
import sys
import time
import gobject
import pango
import gtk
from itertools import chain
from dbus import DBusException
from wicd import misc
from wicd import wpath
from wicd import dbusmanager
from wicd.misc import no... |
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
from ..views.treemodels.placemodel import PlaceListModel
from .baseselector import BaseSelector
class SelectPlace(BaseSelector):
def _local_init(self):
"""
Perform local initialisation for this class
... |
from __future__ import division,print_function,unicode_literals
import sys
import time
import math
from operator import itemgetter
from bleualign.gale_church import align_texts
import bleualign.score as bleu
from bleualign.utils import evaluate, finalevaluation
import io
import platform
if sys.version_info >= (2,6) and... |
import datetime
import random
class Date(object):
"""
Descriptor for a date datum
"""
def __init__(self, variance, **kwargs):
"""
@param variance is the maximum variance of time
allowed for the generation of random data.
"""
self.variance = vari... |
import math
print "This program is for printing the best possible circular bushings"
print "Printer config values are hardcoded for ease of use (for me)"
xpath = [] #These are initialized and default values
ypath = []
zpath = []
step = []
epath = []
xstart = 10.0
ystart = 10.0
zstart = 0.5
height = 0.0
LayerHeight = 0... |
from __future__ import absolute_import
import errno
import glob
import hashlib
import os
import re
import socket
import subprocess
import time
import traceback
import weakref
from . import (
encoding,
error,
match as matchmod,
pathutil,
phases,
pycompat,
revsetlang,
similar,
smartset... |
"""
Test unit for the miscutil/mailutils module.
"""
from invenio_ext.registry import DictModuleAutoDiscoverySubRegistry
from invenio.testsuite import InvenioTestCase, make_test_suite, run_test_suite
from flask_registry import ImportPathRegistry, RegistryError
class TestDictModuleAutoDiscoverySubRegistry(InvenioTestCas... |
"""
The MIT License
Copyright (c) 2007 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
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
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.