src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... |
# pylint: disable = C0103,E0611,C0111,W0104,R0201
import unittest
import sys
import os
from semigroups import FpSemigroup, FpMonoid
path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if path not in sys.path:
sys.path.insert(1, path)
del path
class TestFpSemigroup(unittest.TestCase):
def tes... |
######################################################################
##
## Copyright (C) 2008, Goedson Teixeira Paixao
##
## 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 Softwar... |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, PickleType
from ..base import Base
from ctypes import c_int8
from enum import Enum
import pickle
import logging
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(name='z80')
class CpuState(Base):
... |
# Import hook for end-of-line conversion,
# by David Goodger (dgoodger@bigfoot.com).
# Put in your sitecustomize.py, anywhere on sys.path, and you'll be able to
# import Python modules with any of Unix, Mac, or Windows line endings.
import ihooks, imp, py_compile
class MyHooks(ihooks.Hooks):
def load_source(sel... |
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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
#... |
"""Test Coordinates metadata
"""
from collections import OrderedDict
from pytest import mark, raises
from smif.metadata import Coordinates
class CustomMapping():
"""Custom mapping that doesn't inherit dict
"""
def __init__(self, key_values):
self._data = {}
for key, value in key_values:
... |
""" BlueSky plugin template. The text you put here will be visible
in BlueSky as the description of your plugin. """
from random import randint
import numpy as np
# Import the global bluesky objects. Uncomment the ones you need
from bluesky import core, stack, traf #, settings, navdb, sim, scr, tools
### Initiali... |
from tflearn import data_flow
class FeedDictFlowCp(data_flow.FeedDictFlow):
"""
Wrapper of TFLearn's FeedDictFlow for some types of augmentation.
"""
def __init__(self,
feed_dict,
coord,
batch_size=128,
num_threads=8,
... |
from topics_base.messages import TopicSpiderUpdateMessage
def test_topic_spider_update_email():
topic_name = 'Foo Bar Baz & <script></script>'
topic_url = 'https://topics.com/topic?ab=cd&ef=gh'
topic_spider_status = 'Abc def & <script></script>'
message = TopicSpiderUpdateMessage(
to='nowhere... |
"""
DragonPy - Base Periphery
=========================
:created: 2013 by Jens Diemer - www.jensdiemer.de
:copyleft: 2013-2014 by the DragonPy team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
import _thread
import logging
import queue
import sy... |
import os
import sys
import tensorflow as tf
import Input
import os, re
FLAGS = tf.app.flags.FLAGS
TOWER_NAME = 'tower'
tf.app.flags.DEFINE_integer('batch_size', 1, "hello")
def _activation_summary(x):
with tf.device('/cpu:0'):
tensor_name = re.sub('%s_[0-9]*/' % TOWER_NAME, '', x.op.name)
tf.s... |
import os
from flask import Flask, render_template
from alexandria.extensions import db, migrate, bcrypt, login_manager
from alexandria.models import users, documentlinks
def create_app(config_setting='dev'):
"""An application factory, as explained here:
http://flask.pocoo.org/docs/patterns/appfactories/... |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2015 Google, Inc
## Copyright (C) 2018 davidanger <davidanger@163.com>
## Copyright (C) 2018 Peter Hazenberg <sigrok@haas-en-berg.nl>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU Ge... |
try:
from importlib import import_module
except:
# python 2.6
from django.utils.importlib import import_module
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_protect
from django.http import HttpResponseNotFound, HttpRe... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is an exercise for practising socket programming. Learning the basic concept of
how a socket send and receive data from a client side. Below are functions that I have implementated in the
Ftp Server and Ftp Client script.
Ftp Client function:
~~~~~~~~~~~~~~~~~~~~... |
import py, pytest,os
from _pytest.helpconfig import collectattr
def test_version(testdir, pytestconfig):
result = testdir.runpytest("--version")
assert result.ret == 0
#p = py.path.local(py.__file__).dirpath()
result.stderr.fnmatch_lines([
'*py.test*%s*imported from*' % (pytest.__version__, )
... |
"""NDG Security WSGI utilities
MashMyData Project
"""
__author__ = "P J Kershaw"
__date__ = "21/08/11"
__copyright__ = "(C) 2011 Science and Technology Facilities Council"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__revision__ = "$Id$"
import logging
log = ... |
# 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 u... |
# -*- coding: utf-8 -*-
#
# Hooks module for py2exe.
# Inspired by cx_freeze's hooks.py, which is:
#
# Copyright © 2007-2013, Anthony Tuininga.
# Copyright © 2001-2006, Computronix (Canada) Ltd., Edmonton, Alberta, Canada.
# All rights reserved.
#
import os, sys
# Exclude modules that the standard library imp... |
#!/usr/bin/python2.4
## track_users.py - script reads from lmstat, stores users/computers in serialized file
## last revised: 2011-05-28 01:22:49
## Copyright (C) 2012 John Reiser, <reiser@rowan.edu>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Gener... |
from __future__ import absolute_import
from __future__ import print_function
from .ADFSVolume import ADFSVolume
from amitools.fs.blkdev.BlkDevFactory import BlkDevFactory
class Repacker:
def __init__(self, in_image_file, in_options=None):
self.in_image_file = in_image_file
self.in_options = in_options
s... |
## usersPage.py - show selinux mappings
## Copyright (C) 2006,2007,2008 Red Hat, Inc.
## 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) ... |
import numpy as np
import pandas as pd
from bokeh.plotting import figure
from bokeh.models import (Range1d, ColumnDataSource, LinearAxis,
LinearColorMapper, MultiLine,
FixedTicker, BasicTickFormatter, FuncTickFormatter)
from parallel_selection_tool import ParallelSe... |
# -*- coding: UTF-8 -*-
# © Copyright 2009 Wolodja Wentland. All Rights Reserved.
# This file is part of wp-import.
#
# wp-import 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 Licen... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2011, 2012, 2015 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 optio... |
"""
Title: Semantic Similarity with BERT
Author: [Mohamad Merchant](https://twitter.com/mohmadmerchant1)
Date created: 2020/08/15
Last modified: 2020/08/29
Description: Natural Language Inference by fine-tuning BERT model on SNLI Corpus.
"""
"""
## Introduction
Semantic Similarity is the task of determining how simila... |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa 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 License, or
# (at... |
from matplotlib import pyplot as plt
import numpy as np
import iterative
import pascal
import power
plt.style.use('ggplot')
qr = []
lu = []
for i in range(2, 13):
q = pascal.solve_qr_b(pascal.pascal_matrix(i), pascal.harmonic_vector(i))
l = pascal.solve_lu_b(pascal.pascal_matrix(i), pascal.harmonic_vector(i))
... |
import os
import urlparse
from .settings import * # NOQA
DEBUG = False
TEMPLATE_DEBUG = DEBUG
if 'GONDOR_DATABASE_URL' in os.environ:
urlparse.uses_netloc.append('postgres')
url = urlparse.urlparse(os.environ['GONDOR_DATABASE_URL'])
DATABASES = {
'default': {
'ENGINE': {
... |
from jnius import autoclass
from jnius import cast
from jnius import java_method
from jnius import PythonJavaClass
from plyer.platforms.android import activity
from plyer.facades import Proximity
ActivityInfo = autoclass('android.content.pm.ActivityInfo')
Context = autoclass('android.content.Context')
Sensor = autocl... |
# -*- coding: utf-8 -*-
import binascii
import re
import Crypto.Cipher.AES
from module.plugins.captcha.ReCaptcha import ReCaptcha
from module.plugins.internal.Crypter import Crypter
class NCryptIn(Crypter):
__name__ = "NCryptIn"
__type__ = "crypter"
__version__ = "1.41"
__status__ = "testing"
_... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'debugdock.ui'
#
# Created: Tue Apr 15 11:26:57 2014
# by: pyside-uic 0.2.15 running on PySide 1.2.1
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_debugdock(object):
def setupUi(... |
from __future__ import unicode_literals
import frappe, json, os
from frappe.utils import flt, cstr
from erpnext.controllers.taxes_and_totals import get_itemised_tax
from frappe import _
from frappe.core.doctype.file.file import remove_file
from six import string_types
from frappe.desk.form.load import get_attachments
... |
"""Module to handle importing native modules via ctypes.
"""
import ctypes
import os
import logging
log = logging.getLogger()
def load_dll(name):
"""Attempt to load a DLL from the lib directory under ardrone/native.
Appropriate platform suffices are attempted.
*name* is the filename (without platform extensi... |
import asyncio
default_app_config = 'aiohttp_json_rpc.django.apps.AiohttpJsonRpcConfig'
__already_patched = False
def local(original):
# we keep the original _connections in scope to keep the thread safety of
# Django for non-asyncio code.
class Storage(object):
pass
class TaskLocal(object)... |
def firstOccur(arr, N, x):
lastmid = lefti = mid = 0
righti = N-1
while lefti<righti:
mid = (lefti+righti)/2
if lastmid == mid:
mid += 1
if mid == righti:
return righti
if arr[mid] >= x:
righti = mid
else:
lefti = mid
... |
import sys, math, os
import matplotlib.pyplot as plt
def main():
# Check that there's at least one argument
if len(sys.argv) < 2:
print("Usage python {}".format(sys.argv[0]), end = " ")
print("<file1> [<file2> ...]")
return 1
# Automatically detect if decayed
if "decayed" i... |
from engine import Global;
from engine.Interface import Interface;
from engine.render.image import Image;
from engine.render.text import Text;
from engine.render.sprite import Sprite;
# --------------------------------------------------- *\
# [class] DialogInterface()
#
# * The dialog interface *
#
# --------------... |
# Copyright (C) 2016 Christopher M. Biwer
# 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 distribut... |
#!/usr/bin/env python
# -*- coding: utf-8; mode: python; tab-width: 4; indent-tabs-mode: nil; -*-
# Models for the datastore.
# Copyright (c) 2009 happychickoo.
#
# The MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the... |
#!/usr/bin/env python3
#
# Copyright (c) 2021 Project CHIP 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 a... |
#!/usr/bin/env python
from __future__ import print_function
import networkx as nx
from itertools import combinations
from collections import Counter
from graphenumerator import GraphEnumerator
from treebuilder import build_tree
import matplotlib.pyplot as plt
def find_all_periheral_cycles(G):
G_shortest_path_leng... |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module that will appear in module menus
'Name': 'Sherlock',
# list of one or more a... |
"""
Integers can be given in any of four bases:
- Base ten (decimal — what people are most used to): consists of a sequence of digits, not starting with 0
- Base two (binary): consists of 0b followed by 0's and 1's
- Base eight (octal): consists of a 0 followed by digits in the range 0 to 7
- Base sixteen (hexad... |
# -*- coding: utf-8 -*-
#
# Copyright 2016 dpa-infocom GmbH
#
# 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... |
"""Constants for Google Assistant."""
from homeassistant.components import (
alarm_control_panel,
binary_sensor,
camera,
climate,
cover,
fan,
group,
input_boolean,
light,
lock,
media_player,
scene,
script,
sensor,
switch,
vacuum,
)
DOMAIN = "google_assist... |
#!/usr/local/bin/python
# VER=2.0.0.2
# 09 FEB 2012
"""
fg UTILITIES
requires:
+ winscp for win32
+ pexpect 2.3 on linux
"""
import re, sys, time, os, getpass, string, traceback
from os import popen
from optparse import OptionParser
from subprocess import *
try:
import pexpect
except:
pass
class fg:
def __i... |
"""
WSGI config for DjangoWAWSLogging project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPL... |
#skip.runas import Image; im = Image.open("Scribus.gif"); image_list = list(im.getdata()); cols, rows = im.size; res = range(len(image_list)); sobelFilter(image_list, res, cols, rows)
#runas cols = 100; rows = 100 ;image_list=[x%10+y%20 for x in range(cols) for y in range(rows)]; sobelFilter(image_list, cols, rows)
#be... |
# Django settings for hackathon project.
import os
root_dir = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycop... |
import wx
#from ..logic import LogicThermoInput
class Frm_ThermoInput ( wx.Frame ):
#Note: Most of this frame is built by logic, because it needs to determine what is to be shown.
def __init__( self, parent ):
windowSize = self.setSize()
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString,... |
from django import template
from django.conf import settings
try:
from django.core.cache import caches
except:
from django.core.cache import get_cache as caches
if caches.__module__.startswith('debug_toolbar'):
from debug_toolbar.panels.cache import original_get_cache as caches
get_cache = lambda cache_na... |
"""
Integration-style tests of the full HaloModel class.
"""
from halomod import TracerHaloModel, DMHaloModel
import pytest
import numpy as np
from hmf.halos.mass_definitions import MassDefinition
from hmf.density_field.filters import Filter
from halomod.profiles import Profile
from halomod.bias import Bias
from halom... |
from cms.api import get_page_draft
from cms.toolbar_pool import toolbar_pool
from cms.toolbar_base import CMSToolbar
from cms.utils import get_cms_setting
from cms.utils.permissions import has_page_change_permission
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.translation import ugette... |
from django.contrib.contenttypes.generic import BaseGenericInlineFormSet
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.forms.formsets import ManagementForm
class BaseInitialGenericInlineFormSet(BaseGenericInlineFormSet):
"""
A formset... |
import os
import sys
import cv2
import numpy as np
from sklearn.cluster import MiniBatchKMeans
import math
from cPickle import dump, HIGHEST_PROTOCOL,load
from scipy.cluster.vq import vq,kmeans
import matplotlib.pyplot as plt
from BoW import getImmediateSubdirectories,getWordsInImages,dict2numpy,computeCentroids,comput... |
"""Monitor and influence the optimization procedure via callbacks.
Callbacks are callables which are invoked after each iteration of the optimizer
and are passed the results "so far". Callbacks can monitor progress, or stop
the optimization early by returning `True`.
"""
try:
from collections.abc import Callable
... |
__author__ = 'kmadac'
import unittest
import bitstamp.client
import os
class bitstamp_trading_TestCase(unittest.TestCase):
client = bitstamp.client.trading(os.environ['bs_user'], os.environ['bs_key'], os.environ['bs_secret'])
def test_account_ballance(self):
account_balance = self.client.account_bal... |
#
# MuPIF: Multi-Physics Integration Framework
# Copyright (C) 2010-2015 Borek Patzak
#
# Czech Technical University, Faculty of Civil Engineering,
# Department of Structural Mechanics, 166 29 Prague, Czech Republic
#
# This library is free software; you can redistribute it and/or
# modify i... |
# (c) 2015, Ovais Tariq <me@ovaistariq.net>
#
# This file is part of mha_helper
#
# 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... |
# getllambda.py
# ALS 2016/12/05
"""
Get wavelength of line in AA (in vacuum by default). The data is read from file linelist.txt.
"""
import numpy as np
import re
import astropy.table as at
from PyAstronomy import pyasl
from . import filtertools
def getllambda(ion='OIII', lid=0, vacuum=True):
"""
PURPOS... |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Quentin Gibert
# All rights reserved.
# Based on the work of:
# David Kennedy: http://www.secmaniac.com/june-2011/creating-a-13-line-backdoor-worry-free-of-av/
# Xavier Garcia: www.shellguardians.com
#Permission is hereby granted, free of charge, to... |
# 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 ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils.timezone import utc
import datetime
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_20150628_1254'),
]
operations = [
migrations.Remove... |
"""
This script evaluates a embedding model in a semantic similarity perspective.
It uses the dataset of ASSIN sentence similarity shared task and the method
of Hartmann which achieved the best results in the competition.
ASSIN shared-task website:
http://propor2016.di.fc.ul.pt/?page_id=381
Paper of Hartmann can be ... |
# encoding: UTF-8
'''
本文件包含了CTA引擎中的策略开发用模板。
添加了一些基本的策略属性,变量。不做下单逻辑
'''
from vnpy.app.cta_strategy.base import EngineType
from datetime import MINYEAR
import logging
import numpy as np
from datetime import datetime,time,date,timedelta
import json,time
class DateTimeEncoder(json.JSONEncoder):
def default(self, o):
... |
"""
Spreadsheet-style functions for NumPy ndarray with structured dtype or
recarray objects:
aggregate, aggregate_in, pivot, addrecords, addcols, deletecols, renamecol,
replace, colstack, rowstack, nullvalue
Note that these functions are also wrapped as methods of the tabular tabarray
object, which is a subclass of... |
################################################################################
#
# Copyright 2013 Kitware, 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... |
"""
SymPy core decorators.
The purpose of this module is to expose decorators without any other
dependencies, so that they can be easily imported anywhere in sympy/core.
"""
from __future__ import print_function, division
from functools import wraps
from .sympify import SympifyError, sympify
from sympy.core.compatib... |
"""Peewee migrations -- 002_add_table_member.py.
Some examples (model - class or model name)::
> Model = migrator.orm['model_name'] # Return model in current state by name
> migrator.sql(sql) # Run custom SQL
> migrator.python(func, *args, **kwargs) # Run pyt... |
# coding: utf-8
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.template.defaultfi... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... |
#!/usr/bin/python
import os
import sys
import datetime
# README
# reads the TIMIT dataset, copies the directory structure
# performs a mffc extraction on the audio files
# input:
# TIMITPath: path to the base of the dataset directory
# SMILExtractPath: path to SMILExtract executable
# ConfPath: path to the SMILExtract... |
## @file dispatch0.py
# @author weaves
# @brief Demonstrate extrinisc visitor pattern.
#
# The visitor pattern (or double dispatch) is well-known. In languages
# that support reflection you can use a single dispatch like this
# method.
#
# You can test this package on the command-line with
# <code>python dispatch0.py</... |
from dataformatter import DataFormatter
from pyQueryConstructor import QueryConstructor
import os
from dmonconnector import Connector
from adplogger import logger
from datetime import datetime
import time
if __name__ == '__main__':
dataDir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')
mode... |
#!/usr/bin/env python
"""
The MIT License (MIT)
Copyright (c) 2013 Andrew Wooster
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
u... |
from JumpScale import j
app = j.tools.cuisine._getBaseAppClass()
# TODO: *1 implement & test & document (test on packet.net)
# make sure you use the trick we used in jumpscale/jumpscale_core8/lib/JumpScale/tools/cuisine/systemservices/CuisineFW.py
# : setRuleset... here we use a python script to make sure we se... |
from wfuzz.externals.moduleman.plugin import moduleman_plugin
from wfuzz.dictionaries import BaseIterator
import itertools
from functools import reduce
from builtins import zip as builtinzip
@moduleman_plugin
class zip(BaseIterator):
name = "zip"
author = ("Xavi Mendez (@xmendez)",)
version = "0.1"
... |
#!/usr/bin/env python
'''
Appendix D compliance support for CF 1.6 and CF 1.7
The definitions given here allow an application to compute dimensional
coordinate values from the dimensionless ones and associated variables. The
formulas are expressed for a gridpoint (n,k,j,i) where i and j are the
horizontal indices, k i... |
'''
Created on Feb 12, 2016
@author: patrickstewart
'''
import os
import datetime
import SampleTest
import ReaderTest
def generateFileName(testName=None):
i = str(datetime.datetime.now())
# Convert '2016-02-08 11:16:04.123456 format to nicer filename
fileName = testName + '-' + i[0:10] + '-' + i[11:13... |
#!/usr/bin/env python
"""The in memory database methods for path handling."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from future.builtins import filter
from future.utils import iteritems
from future.utils import iterkeys
from typing import Dict
f... |
# Copyright 2015 Spotify AB. All rights reserved.
#
# The contents of this file are 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 requi... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import pymysql
global DB
try:
DB = pymysql.connect("localhost", "root", "toortoor", "EVE_coll")
except:
print("数据库连接失败,程序停止.")
exit(0)
def insert_now_data(id, now_time, players, typeof):
""" 插入数据 1 代表国服 """
cursor = DB.cursor()
# SQL 插入语句
if typ... |
from MakeGraph import MakeGraph
from Moving_pacman import PacMan
import pygame
class Ghost(MakeGraph):
index = 0
def __init__(self,class_graph,x,y):
Ghost.index = Ghost.index + 1
self.all_nodes = class_graph.get_nodes()
self.paths_to_all_nodes = class_graph.get_shortest_path()
self.path = []
self.hunt... |
import sublime, sublime_plugin
import os, shutil, traceback, json
from ...libs import util
from ...libs import window_view_manager
from ...libs import FlowCLI
from .refactor_preview import RefactorPreview
class JavascriptEnhancementsRefactorSafeMoveCommand(sublime_plugin.TextCommand):
def run(self, edit, **args):
... |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publis... |
import sys
import math
print("Welcome to the DDA's algorithm.")
print("\nLet's begin setting the size of the matrix.\n")
columns = int(input("How many columns does the matrix have?\n"))
lines = int(input("How many lines does the matrix have?\n"))
print("\nNow let's set the coordinates of two points, so we can draw ... |
#!/usr/bin/env python2.7
"""
Here is shorten.tv's main background task to re-load
and cache popular youtube videos so users have less
wait time when using the webapp.
"""
import requests
import string
import backend
import urllib
letters = list(string.lowercase) # a, b, c ... z
popular = ["Rihanna", "Usher", "Katy P... |
#!/usr/bin/python
# -*- coding: utf8 -*-
import os
import sys
import math
import xlrd
import data_objects as DO
import cast
""" Excel cell type decides which cast function to use. """
CAST_FUNC = {xlrd.XL_CELL_EMPTY: str,
xlrd.XL_CELL_TEXT: cast.cast_str,
xlrd.XL_CELL_NUMBER: float,
... |
#
# Copyright (c) 2008 Eric Anderton
#
# 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,
# ... |
__author__ = 'student'
# подключаем модуль разбора параметров командной строки
import argparse
# подключаем модуль sys
import sys
# создаём парсер и описываем все параметры командной строки, которые может
# принимать наша программа
parser = argparse.ArgumentParser(
# краткое описание программы
description='Кал... |
# coding: utf-8
# Copyright (C) 2017 Open Path View, Maison Du Libre
# 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.
# ... |
# -*- encoding: UTF-8 -*-
# Grammalecte - Compiled regular expressions
import re
#### Lemme
Lemma = re.compile("^>(\w[\w-]+)")
#### Analyses
Gender = re.compile(":[mfe]")
Number = re.compile(":[spi]")
#### Nom et adjectif
NA = re.compile(":[NA]")
## nombre
NAs = re.compile(":[NA].*:s")
NAp = re.compile(":[NA].*:p"... |
import os
import sys
import argparse
from collections import namedtuple
from monolith.compat import OrderedDict
from monolith.compat import unicode
from monolith.cli.exceptions import AlreadyRegistered
from monolith.cli.exceptions import CommandError
from monolith.utils.imports import get_class
Argument = namedtuple(... |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Anler Hernández <hello@anler.me>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alon... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# webcam_widget.py
#
# Copyright © 2013-2018 Antergos
#
# This file is part of Cnchi.
#
# Cnchi 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 ... |
#!/usr/bin/env python
import plot, numpy as np,auger,image,rtplan
from scipy.ndimage.filters import gaussian_filter
###########################################################################################################
smooth_param = 8.5 #20 mm FWHM
volume_offset=-141.59+7.96#spot sources
pg29 = image.image('d... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import codecs
from base64 import b64encode, b64decode
from cryptography.hazmat.primitives.asymmetric import utils
def _bytes_to_int(b):
if not b or not isinstance... |
from collections import namedtuple
from struct import unpack, unpack_from
Segment = namedtuple('Segment', 'offset length')
ViewportDimension = namedtuple('ViewportDimension', 'right left')
class MainExe(object):
def __init__(self, file_path):
data_segment = Segment(0x138a0, 0xf460)
with open(fil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.