code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import sys
sys.path.insert(1,"../../../")
import h2o, tests
def anomaly(ip, port):
print "Deep Learning Anomaly Detection MNIST"
train = h2o.import_file(h2o.locate("bigdata/laptop/mnist/train.csv.gz"))
test = h2o.import_file(h2o.locate("bigdata/laptop/mnist/test.csv.gz"))
predictors = range(0,7... | bospetersen/h2o-3 | h2o-py/tests/testdir_algos/deeplearning/pyunit_anomaly_largeDeepLearning.py | Python | apache-2.0 | 1,573 |
#!/usr/bin/env python3
"""
NullSMTPD module that allows to run a mock email server that just logs all incoming emails to a file
instead of actually trying to send them. Helps for developing applications that utilize email,
without spamming customers' emails and not having overhead from some GUI program.
"""
import argp... | MasterOdin/nullsmtp | nullsmtpd/nullsmtpd.py | Python | unlicense | 5,599 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pwndbg.color.theme as theme
import pwndbg.config as config
from pwndbg.color import generateColorFunction
config_arrow_color = theme.ColoredParameter('chain-arrow-color', 'normal', 'color of chain formatting (arrow)')
config_contiguous_color = theme.ColoredPar... | anthraxx/pwndbg | pwndbg/color/chain.py | Python | mit | 590 |
import numpy as np
from .base import e, tau
def lu_decomposition(a):
"""Calculate matrices U and L from a given matrix A (:a).
This function will raise a ValueError if matrix A isn't LU decomposable.
:param a the matrix that should be decomposed into L and U.
:return
L: decomposed lower tri... | lucasdavid/numerical-analysis | projects/nnum/decomposition/decomposition.py | Python | mit | 2,322 |
import collections, itertools, functools
ddict = collections.defaultdict
from .. import graph_util
from . import graphproxy
from ..ssa import ssa_jumps, objtypes
from ..ssa.exceptionset import ExceptionSet
from .setree import SEBlockItem, SEScope, SEIf, SESwitch, SETry, SEWhile
# This module is responsible for trans... | alexkasko/krakatau-java | krakatau-lib/src/main/resources/Lib/Krakatau/java/structuring.py | Python | gpl-3.0 | 51,743 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 ve... | pombredanne/invenio | modules/bibexport/lib/bibexport_method_googlescholar.py | Python | gpl-2.0 | 11,931 |
"""Tests for blobstore.py."""
import cgi
import cStringIO
import datetime
import pickle
import unittest
from .google_imports import namespace_manager
from .google_imports import datastore_types
from . import blobstore
from . import model
from . import tasklets
from . import test_utils
class BlobstoreTests(test_uti... | bslatkin/8-bits | appengine-ndb/ndb/blobstore_test.py | Python | apache-2.0 | 10,271 |
#!/usr/bin/python
import datetime
import common
from autotest_lib.frontend import setup_django_environment
from autotest_lib.frontend.afe import frontend_test_utils
from autotest_lib.client.common_lib.test_utils import mock
from autotest_lib.client.common_lib.test_utils import unittest
from autotest_lib.database impor... | wuzhy/autotest | scheduler/scheduler_models_unittest.py | Python | gpl-2.0 | 15,442 |
# 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
# d... | vedujoshi/os_tempest | tempest/services/volume/xml/snapshots_client.py | Python | apache-2.0 | 8,933 |
# coding: utf-8
# Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
# This library 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... | savoirfairelinux/num2words | tests/test_dk.py | Python | lgpl-2.1 | 1,724 |
# -*- coding: utf-8 -*-
# Copyright(C) 2019-2020 Célande Adrien
#
# This file is part of weboob.
#
# weboob 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 3 of the License, or
# (at you... | laurentb/weboob | weboob/applications/boorpg/boorpg.py | Python | lgpl-3.0 | 3,961 |
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
"""
Open and modify Microsoft Word 2007 docx files (called 'OpenXML' and
'Office OpenXML' by Microsoft)
Part of Python's docx module - http://github.com/mikemaccana/python-docx
See LICENSE for licensing information.
"""
import logging
from lxml import etree
try:
fr... | adnelson/docx-text-replacement | build/lib/docx.py | Python | mit | 40,239 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
vivopump -- module of helper functions for the pump
"""
import sys
import csv
import string
import random
import logging
__author__ = "Michael Conlon"
__copyright__ = "Copyright (c) 2016 Michael Conlon"
__license__ = "New BSD license"
__version__ = "0.8.7"
logger = l... | dofeldsc/vivo_uos | my_pump/pump/vivopump.py | Python | gpl-3.0 | 47,667 |
import cffi
import sp_index_cmp.cmpdef as cmpdef
from sppy.spapi_cffi_codecs import ListU32
from random import randint
ffi = cffi.FFI()
ffi.cdef ( cmpdef.cdef )
lib = ffi.dlopen("./sp_index_cmp/cmp.so")
def pycmp( a,b ):
if a<b: return -1
elif a>b: return 1
else: return 0
cases = []
case_count = 100000
fo... | hardc0d3/sppy | sppy_test_cmp/test_random_u32l.py | Python | bsd-2-clause | 865 |
"""a util for convert protobuf to dict
"""
from google.protobuf.message import Message
from google.protobuf.descriptor import FieldDescriptor
__all__ = [
"protobuf_to_dict", "TYPE_CALLABLE_MAP", "dict_to_protobuf",
"REVERSE_TYPE_CALLABLE_MAP"
]
EXTENSION_CONTAINER = '___X'
TYPE_CALLABLE_MAP = {
FieldDes... | lcy-seso/models | fluid/image_classification/caffe2fluid/kaffe/protobuf_to_dict.py | Python | apache-2.0 | 6,572 |
#!/usr/bin/env python
import asyncio
import zlib
import sys
sys.path.append('..')
from ezmysql import ConnectionAsync
async def main():
host = 'localhost'
database = 'testdb'
user = 'root'
password = 'aidbadmin'
# to create database
db = ConnectionAsync(
host,
None,
u... | veelion/ezmysql | examples/async_example.py | Python | apache-2.0 | 2,841 |
import collections
from supriya.enums import CalculationRate
from supriya.ugens.PV_ChainUGen import PV_ChainUGen
class FFTTrigger(PV_ChainUGen):
"""
::
>>> ffttrigger = supriya.ugens.FFTTrigger.ar(
... buffer_id=buffer_id,
... hop=0.5,
... polar=0,
... ... | josiah-wolf-oberholtzer/supriya | dev/etc/pending_ugens/FFTTrigger.py | Python | mit | 3,025 |
#!/usr/bin/python3
import unittest
import bnstats
import os
class DataFile(unittest.TestCase):
def test_downloading(self):
if os.path.exists(bnstats.DATA_FILE):
os.remove(bnstats.DATA_FILE)
bnstats.download_data()
self.assertTrue(os.path.exists(bnstats.DATA_FILE))
def te... | codehill/bnstats | test.py | Python | mit | 868 |
# -*- coding: UTF-8 -*-
# 接口header部分
class Header(object):
def __init__(self, header_id, name, value, it_id, header_type, desc=None):
self.id = header_id
self.name = name
self.value = value
self.desc = desc
self.it_id = it_id
self.header_type = header_type
| longmazhanfeng/interface_web | interface_platform/model/header.py | Python | mit | 319 |
# -*- coding: utf-8 -*-
"Utility functions for docstring manipulations."
# Copyright (C) 2010 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN 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, eit... | FEniCS/dolfin | site-packages/dolfin_utils/documentation/docstringutils.py | Python | lgpl-3.0 | 1,608 |
import sys
import os
import glob
import hashlib
import re
import fnmatch
import base64
from executor import execute
from utils import CommandAgent
DFS_DIR = "/var/lib/HPCCSystems/hpcc-data"
DROPZONE_DIR = "/var/lib/HPCCSystems/mydropzone"
class HPCCTopology:
@staticmethod
def generate():
output = e... | vin0110/haas | scripts/checkpoint.py | Python | apache-2.0 | 17,741 |
"""Implements basics of Capa, including class CapaModule."""
import cgi
import copy
import datetime
import hashlib
import json
import logging
import os
import traceback
import struct
import sys
import re
# We don't want to force a dependency on datadog, so make the import conditional
try:
import dogstats_wrapper a... | shashank971/edx-platform | common/lib/xmodule/xmodule/capa_base.py | Python | agpl-3.0 | 62,013 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2014, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | chippey/gaffer | python/Gaffer/__init__.py | Python | bsd-3-clause | 2,591 |
# -*- coding: utf-8 -*-
"""
The settings module is just a simple dictionary. While the program
is running more settings will be added or modified. To edit the defaults
just change the entries below.
"""
from __future__ import unicode_literals
from eplist.constants import resource_path, AttributeDict
from sys import... | djt5019/episode_renamer | eplist/settings.py | Python | unlicense | 2,270 |
"""
Custom data readers including :class:`simkit.contrib.readers.ArgumentReader`,
:class:`simkit.contrib.readers.DjangoModelReader` and
:class:`simkit.contrib.readers.HDF5Reader`.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals)
import numpy as np
import h5py
from simkit.co... | SunPower/Carousel | simkit/contrib/readers.py | Python | bsd-3-clause | 6,137 |
import asyncio
import uuid
from workq.workq import WorkqClient
from workq.job import ForegroundJob
def main():
loop = asyncio.new_event_loop()
client = WorkqClient('127.0.0.1', 9922, loop)
jobid = uuid.uuid4()
job = ForegroundJob(jobid, "ping1", 5000, 60000, "hello fg job")
try:
loop.run_u... | hhatto/python-workq | examples/enqueue_fgjob.py | Python | mit | 585 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .common import *
# NAMESPACES = {'xmlns': 'http://www.w3.org/1999/xhtml'}
# https://blockly-demo.appspot.com/static/demos/code/index.html
class BlocklyXmlBuilderConstantTest(TestCase):
def _constant_test(self, statement, block_type, field_na... | vlfedotov/django-business-logic | tests/blockly/test_build.py | Python | mit | 21,112 |
# Copyright 2016 Jason Horne
#
# 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... | jdhorne/pycarwings2 | pycarwings2/responses.py | Python | apache-2.0 | 18,785 |
# This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | XeCycle/indico | indico/modules/users/models/users_test.py | Python | gpl-3.0 | 5,982 |
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ... | pyfa-org/Pyfa | gui/mainFrame.py | Python | gpl-3.0 | 42,250 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ggpo/gui/ui/savestatesdialog.ui'
#
# Created: Tue Aug 25 22:55:14 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.f... | poliva/pyqtggpo | ggpo/gui/ui/savestatesdialog_ui.py | Python | gpl-2.0 | 2,980 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 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 option) any later... | nharraud/invenio-jsonschemas | invenio_jsonschemas/errors.py | Python | gpl-2.0 | 2,330 |
try:
import Image
import ImageFilter
except ImportError:
from PIL import Image, ImageFilter
import random as rand
import constants
import util
def edge(pixels, args):
img = Image.open(args.image_input_path)
img = img.rotate(args.angle, expand=True)
edges = img.filter(ImageFilter.FIND_EDGES)
... | andreMonkey/adafruit-pi-cam | interval.py | Python | bsd-2-clause | 5,445 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Created in 2008 by Don Quijote
# Licence: wxWindows
#
# Updated 12/11/2008 Cody Precord
#-----------------------------------------------------------------------------#
import wx
from wx import stc
from collections import deque
try:
# python2.5+
from functools... | 163gal/Time-Line | libs/wx/tools/Editra/src/extern/vertedit.py | Python | gpl-3.0 | 11,221 |
import requests
import mtgreatest.utils
from mtgreatest.rdb import Cursor
from mtgreatest.rdb.table_cfg import table_definitions
from bs4 import BeautifulSoup
from update_events import clean_magic_link
from players import fix_name_and_country
RAW_TABLE_NAME = 'standings_raw_table'
def arse_standings_row(soup, event_... | oelarnes/mtgreatest | mtgreatest-py/mtgreatest/scrape/scrape_standings.py | Python | mit | 3,508 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import unittest
from haystack.outputters import text
from haystack.mappings import folder
from test.testfiles import zeus_1668_vmtoolsd_exe
log = logging.getLogger('testwinxpheap')
class TestWinXPHeapValidator(unittest.TestCase):
@classmethod
d... | trolldbois/python-haystack | test/haystack/allocators/win32/test_winxpheap.py | Python | gpl-3.0 | 13,155 |
import datetime
from django.core.cache import cache
from django.conf import settings
from crike_django.views import get_profile
class ActiveUserMiddleware:
'''
cache all user visit time.
when an user is online for 30 minutes, give 5 points
'''
hour = 60 * 60
def process_request(self, request):... | crike/crike | src/crike_django/crike_django/active_user_middleware.py | Python | apache-2.0 | 1,526 |
# -*- 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):
# Changing field 'User.special_instructions'
db.alter_column(u'account_u... | Cotidia/cotidia-account | migrations/0002_auto__chg_field_user_special_instructions.py | Python | mit | 4,541 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "wanghn"
# Ldap health check
import httplib
import urllib2
import socket
import time
import os
import ConfigParser
import urllib
import commands
import json
def driverstatus(driver_result):
ds_result = {}
for i in xrange( len( driver_result ) ):
... | python-20161108/temp | wanghn/python_js/ldap/ldap_health.py | Python | gpl-3.0 | 6,490 |
class BASIC_MOVE:
ID = 0
Name = 1
Type = 2
PW = 3
Duration = 4
NRG = 5
NRGPS = 6
DPS = 7
# Adapted from the GAME_MASTER_FILE Json Output at:
# https://github.com/pokemongo-dev-contrib/pokemongo-game-master/
# https://raw.githubusercontent.com/pokemongo-dev-contrib/pokemongo-game-master/... | darkshark007/PoGoCollection | Data/moves.py | Python | gpl-3.0 | 11,221 |
# Copyright 2017 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... | drpngx/tensorflow | tensorflow/python/ops/data_flow_ops.py | Python | apache-2.0 | 86,638 |
# -*- 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... | proyectos-analizo-info/pybossa-analizo-info | pybossa/auth/__init__.py | Python | agpl-3.0 | 1,618 |
# Copyright (c) 2001-2015, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | pbougue/navitia | source/eitri/ed_handler.py | Python | agpl-3.0 | 6,071 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def data_migration_up(apps, schema_editor):
"""
Update identification tool FIDO to 1.3.10, correcting a
character-spacing issue bug identified in PRONOM94
"""
idtool = apps.get_model('fpr', 'IDTool'... | artefactual/archivematica-fpr-admin | fpr/migrations/0024_update_fido.py | Python | agpl-3.0 | 1,946 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ClusterFailoverLevelAdmissionControlInfo(vim, *args, **kwargs):
'''The current admiss... | xuru/pyvisdk | pyvisdk/do/cluster_failover_level_admission_control_info.py | Python | mit | 1,132 |
#!/usr/bin/python3
import sys
import hashlib
import json
import os
import logging
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("urllib3").setLevel(logging.DEBUG)
logging.getLogger("requests").setLevel(logging.DEBUG)
# own modules
import webstorageClient.FileStorageClient
def main():
# read informati... | gunny26/webstorage | bin/fstor.py | Python | gpl-2.0 | 1,621 |
import _plotly_utils.basevalidators
class TickvalsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self,
plotly_name="tickvals",
parent_name="scatterternary.marker.colorbar",
**kwargs
):
super(TickvalsValidator, self).__init__(
plotl... | plotly/python-api | packages/python/plotly/plotly/validators/scatterternary/marker/colorbar/_tickvals.py | Python | mit | 513 |
def Testcase(testcase_id=None):
def test_case(function):
def wrapper(*args,**kwargs):
if testcase_id:
args[0].testcase_id = testcase_id
else:
args[0].testcase_id = args[0]._testMethodName
return function(*args,**kwargs)
return wrapp... | Mattwhooo/Hotdog | hotdog/Testcase.py | Python | mit | 343 |
# coding: utf-8
import numpy as np
from numba import jit
@jit
def t_side(time,s,h,ix,iz,ta,tb,tc):
tmp=(h*s[ix,iz])**2-0.25*(tb-tc)**2
if tmp<0.:
time[ix,iz]=ta+h*s[ix,iz]
else:
time[ix,iz]=ta+np.sqrt(tmp)
@jit
def t_bottom(time,s,h,ix,iz):
ta=time[ix,iz-1]
tb=time[ix-1,iz-... | pkgpl/IPythonProcessing | pkprocess/traveltime.py | Python | gpl-3.0 | 9,841 |
from datetime import date, datetime
import os
import paramiko
import pytest
from dateutil.relativedelta import relativedelta
from paramiko.ssh_exception import AuthenticationException, SSHException, BadHostKeyException
class TestIATIBackupServer:
@classmethod
def setup_class(self):
"""
Create... | IATI/IATI-Website-Tests | tests/test_backup_server.py | Python | mit | 6,424 |
# Copyright 2016 Infoblox Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | infobloxopen/heat-infoblox | heat_infoblox/tests/utils.py | Python | apache-2.0 | 947 |
"""
Assign astroid node
An assignment.
Attributes:
- targets (Optional[list[NodeNG]])
- A list of nodes being assigned to.
- type_annotation (Optional[NodeNG])
- If present, this will contain the type annotation passed by a type comment.
- value (Optional[Expr])
... | pyta-uoft/pyta | nodes/assign.py | Python | gpl-3.0 | 1,597 |
from bs4 import BeautifulSoup
import requests
import pafy
from prettytable import PrettyTable
from pytube import YouTube
from pprint import pprint
import os, sys
# Written by Daniel Koifman(A.K.A HeliosHype) and Alex Putilin
# You are allowed to freely use, edit, modify and distribute this script, just make sure to g... | eleweek/PyKo | PyKo.py | Python | mit | 2,710 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | ardekantur/pyglet | pyglet/event.py | Python | bsd-3-clause | 16,578 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# File encoder based on an own algorithm in Python3
# by Mario Nachbaur
'''
Usage: kripher (--encode | --decode) [--output --save] KEY FILE...
Encode or decode one or more files with a given numeric key.
Options:
-e --encode Encode the file
-d --decode ... | marionauta/kripher | src/kripher.py | Python | mit | 3,279 |
from auslib.util.cache import MaybeCacher
# auslib is a library that contains two different webapps. Both of them share
# a single database model, and some code (release blobs, for example), need
# to have access to the database to do their jobs. Because of this, it's
# convenient to have the database object accessibl... | testbhearsum/balrog | src/auslib/global_state.py | Python | mpl-2.0 | 1,529 |
#! /usr/bin/env python
# coding:utf-8
# 解析の対象とするチャンク
# かどうかを決める変数
stop_pos1s = {
"代名詞",
}
# 原形で比較される
stop_words = {
"する",
"いう",
"なる",
"ある",
"いる",
"こと", "事",
"もの", "物",
"ほう", "方",
"とき", "時",
"時点", "じてん",
# 時間に関するもの
"分",
"日", "今日", "明日", "明後日", "昨日", "一昨日",
"月"... | kenkov/depgen | depgen_config.py | Python | mit | 676 |
# -*- coding: utf-8 -*-
"""
nwdiag.sphinx_ext
~~~~~~~~~~~~~~~~~~~~
Allow nwdiag-formatted diagrams to be included in Sphinx-generated
documents inline.
:copyright: Copyright 2010 by Takeshi Komiya.
:license: BSDL.
"""
from __future__ import absolute_import
import os
import re
import tracebac... | bboalimoe/ndn-cache-policy | docs/sphinx-contrib/nwdiag/sphinxcontrib/nwdiag.py | Python | gpl-3.0 | 10,218 |
from dream.simulation.imports import Source, Queue, Machine, Exit
from dream.simulation.Globals import runSimulation
#define the objects of the model
S=Source('S1','Source',interArrivalTime={'Fixed':{'mean':0.5}}, entity='Dream.Part')
Q=Queue('Q1','Queue', capacity=1)
M=Machine('M1','Machine', processingTime={'Fixe... | bchiroma/DreamProject_2 | dream/simulation/Examples/SingleServer.py | Python | gpl-3.0 | 1,276 |
from lib.flask_mailplus import send_template_message
from snakeeyes.app import create_celery_app
from snakeeyes.blueprints.user.models import User
celery = create_celery_app()
@celery.task()
def deliver_password_reset_email(user_id, reset_token):
"""
Send a reset password e-mail to a user.
:param user_i... | capaximperii/LocaLoca | snakeeyes/blueprints/user/tasks.py | Python | gpl-3.0 | 810 |
'''
CLASS
Class classname:
'Optional class documentation string'
class_suite
'''
class Employee:
'Common base class for all employees'
empCount = 0
def __init__(self, name, salary):
self.name = name
self.salary = salary
Employee.empCount += 1
def displayCount(self):
pr... | hackerpals/Python-Tutorials | Python-Intro-Workshops/OOP/classExample.py | Python | gpl-3.0 | 466 |
"""
Filenames of the tests
"""
import os
from os.path import join as pjoin
from .. import LiF_g4
# This is a 2x2x2 q-point grid. The weights can be obtained from abinit.
nqpt = 3
wtq = [0.125, 0.5, 0.375]
# Indices of the q-points in the 4x4x4 grid.
iqpt_subset = [0, 2, 6]
dirname = os.path.dirname(__file__)
fna... | jmbeuken/abinit | scripts/post_processing/ElectronPhononCoupling/ElectronPhononCoupling/data/LiF_g2_2/__init__.py | Python | gpl-3.0 | 668 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Alexander Winkler <mail () winkler-alexander.de>
# based on svr4pkg by
# Boyd Adamson <boyd () boydadamson.com> (2012)
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division,... | hryamzik/ansible | lib/ansible/modules/packaging/os/pkgutil.py | Python | gpl-3.0 | 6,757 |
VERSION = (0, 1, 4)
# 1.3 is currently on pypi
def get_version():
if len(VERSION) > 3 and VERSION[3] != 'final':
return '%s.%s.%s %s' % (VERSION[0], VERSION[1], VERSION[2], VERSION[3])
else:
return '%s.%s.%s' % (VERSION[0], VERSION[1], VERSION[2])
__version__ = get_version()
def autodiscov... | adriaant/django-datatrans | datatrans/__init__.py | Python | bsd-3-clause | 1,240 |
# This file is a portion of the Red Hat Update Agent
# Copyright (c) 1999--2012 Red Hat, Inc. Distributed under GPL
#
# Authors:
# Cristian Gafton <gafton@redhat.com>
# Adrian Likins <alikins@redhat.com>
#
"""
This module includes the Config and Up2date Config classes use by the
up2date agent to hold con... | PaulWay/spacewalk | client/debian/packages-already-in-debian/rhn-client-tools/src/up2date_client/config.py | Python | gpl-2.0 | 11,075 |
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.io.pytables.common import ensure_clean_path
tables = pytest.importorskip("tables")
@pytest.fixture
def pytables_hdf5_file():
"""
Use PyTables to create a simple HDF5 file.
"""
table_schema = {
"c0": tables.Time6... | pandas-dev/pandas | pandas/tests/io/pytables/test_compat.py | Python | bsd-3-clause | 2,631 |
import gdefinelib
arguments = ["self", "info", "args"]
minlevel = 1
helpstring = "gdefine <phrase>"
def main(connection, info, args) :
"""Defines a word or phrase using google"""
definition = gdefinelib.gdefine(args[1])
message = definition[0] + ": " + definition[1]
connection.msg(info["channel"], "%s:... | sonicrules1234/sonicbot | oldplugins/gdefine.py | Python | bsd-3-clause | 354 |
from django.conf.urls import url
from .views import ActivityList, ActivityNewView, ActivityDetailView, \
ActivityResponseNewView
urlpatterns = [
# List of activities
url(
r'^$',
ActivityList.as_view(),
name='list'
),
# Add new activity
url(
r'^\/new$',
... | zurfyx/simple | simple/projects/activities/urls.py | Python | mit | 703 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, cint
from frappe import msgprint, _
import frappe.defaults
from frappe.model.mapper import get_mapped_doc
... | mahabuber/erpnext | erpnext/stock/doctype/delivery_note/delivery_note.py | Python | agpl-3.0 | 15,187 |
"""
Classes and functions to handle storage devices.
This exports:
- two functions for get image/blkdebug filename
- class for image operates and basic parameters
"""
import logging, os, shutil, re
from autotest.client import utils
try:
from autotest.client.shared import iscsi
except ImportError:
from virt... | imammedo/virt-test | virttest/storage.py | Python | gpl-2.0 | 14,909 |
"""
Data structure that stores faa entries
"""
import os,sys,site
import numpy
base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
for directory_name in os.listdir(base_path):
site.addsitedir(os.path.join(base_path, directory_name))
import fasta
import argparse
import hmmer
from Bio.Seq import ... | idoerg/BOA | src/format/faa.py | Python | gpl-3.0 | 1,499 |
class Node(object):
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def isTerminal(self):
value = self.value
return (value is not None and
value != "=" and
value != "+" and
value != "-" and
value != "*" and
... | chetan51/genesys | classes/node.py | Python | gpl-3.0 | 2,458 |
from time import time
from plugin import Plugin, PluginDocument
from database import TableBase, Column, Text, Integer, Boolean
from database import engine, session
from .dbupload.dbprofile import Gene
class PanoDocument(TableBase, PluginDocument):
__tablename__ = 'pano'
def __init__(self, owner, title='Un... | igemsoftware2016/USTC-Software-2016 | plugins/pano.py | Python | agpl-3.0 | 6,078 |
#!/usr/bin/env python
__author__ = 'scott hendrickson, nick isaacs'
import time
import urllib2
import httplib
import ssl
import base64
import zlib
import socket
import logging
import os
import traceback
from src.utils.Envirionment import Envirionment
from multiprocessing import Event, Process, Manager
from ctypes impo... | gnip/sample-python-connector | src/stream/GnipRawStreamClient.py | Python | mit | 7,758 |
# Copyright (C) 2010-2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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 v... | espressomd/espresso | testsuite/python/data/gen_coulomb_2d_ref_data.py | Python | gpl-3.0 | 1,741 |
"""
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 ... | zouzhberk/ambaridemo | demo-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/mapred_service_check.py | Python | apache-2.0 | 5,388 |
from __future__ import print_function
import os
import sys
import logging
from operator import itemgetter
from sklearn.preprocessing import LabelEncoder
from keras.utils import np_utils
import utils
import model
from tagger import Tagger
logging.basicConfig(
format='%(asctime)s : %(levelname)s : %(message)s', l... | mikekestemont/tag | tag/test.py | Python | mit | 964 |
USERNAME = "USERNAME"
PASSWORD = "PASSWORD"
VERIFY_SSL = False
HOST = "https://YOUR_ISILON_CLUSTER_OR_NODE_IP_ADDRESS:8080"
| Isilon/isilon_sdk | tests/test_constants.py | Python | mit | 124 |
# Copyright (c) 2008,2015,2016,2017,2018,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Test various METARs."""
from datetime import datetime
import numpy as np
from numpy.testing import assert_almost_equal
import pytest
from metpy.cbook im... | Unidata/MetPy | tests/io/test_metar.py | Python | bsd-3-clause | 21,711 |
"""
Django settings for SimpleChat 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/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... | jonathanendersby/SimpleChat | SimpleChat/SimpleChat/settings.py | Python | gpl-2.0 | 2,172 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('memoryoracle', '0005_auto_20150403_0100'),
]
operations = [
migrations.AddField(
model_name='program',
... | daniel-noland/MemoryOracle | memoryoracle/memoryoracle/migrations/0006_program_path.py | Python | lgpl-3.0 | 443 |
# Copyright 2022 The DDSP 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 wri... | magenta/ddsp | ddsp/training/train_util.py | Python | apache-2.0 | 12,295 |
# Copyright (C) 2010 Wil Mahan <wmahan+fatics@gmail.com>
#
# This file is part of FatICS.
#
# FatICS 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 your optio... | ecolitan/fatics | src/telnet.py | Python | agpl-3.0 | 8,663 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
"""Main module for chaining operation.
Idea is shamelessly stolen from:
http://derrickgilland.com/posts/lazy-method-chaining-in-python/
and
https://github.com/dgilland/pydash/pydash/chaining.py
"""
from __future__ import absolute_import
from cdochain import excep... | OnionNinja/cdochain | cdochain/chaining.py | Python | mit | 5,395 |
#!/usr/bin/python
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Wrapper for invoking the BFD loader
A simple script to invoke the bfd loader instead of gold.
This script is in a filename "ld... | endlessm/chromium-browser | native_client/src/trusted/service_runtime/linux/ld_bfd.py | Python | bsd-3-clause | 2,039 |
"""
.. module: background
:synopsis: Used to define the background on the UI.
"""
import pygame
import sys, os
"""
Controls the background on the UI that the player uses to interact
with the game.
"""
class Background(pygame.sprite.Sprite):
def __init__(self, image_file, location):
p... | wshand/hex-towns | src/map/background.py | Python | mit | 527 |
import datetime
import os
import shutil
import re
from django.conf import settings
from django.core.urlresolvers import reverse as urlreverse
from StringIO import StringIO
from pyquery import PyQuery
import debug # pyflakes:ignore
from ietf.utils.test_utils import login_testing_unauthoriz... | wpjesus/codematch | ietf/submit/tests.py | Python | bsd-3-clause | 37,428 |
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
请在Python3下运行此程序='Please run this program with Python3'
from envelopes import Envelope # Doc: http://tomekwojcik.github.io/envelopes/api/envelope.html
def sendEmail(subject, text_body=None, html_body=None, attachment=None):
FROM_ADDR = 'xxxxx@163.com'
PASSWD = 'xxxx... | runningwolf666/weather | SendEmail.py | Python | gpl-2.0 | 2,848 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('rsvp.views',
url(r'^event/(?P<slug>[A-Za-z0-9_-]+)/$', 'event_view', name='rsvp_event_view'),
url(r'^event/(?P<slug>[A-Za-z0-9_-]+)/thanks/(?P<guest_id>\d+)/$', 'event_thanks', name='rsvp_event_thanks'),
)
| toastdriven/django-rsvp | rsvp/urls.py | Python | mit | 292 |
# Copyright (c) 2014 Hitachi Data Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | hguemar/cinder | cinder/tests/test_hds_iscsi.py | Python | apache-2.0 | 14,452 |
# coding: utf-8
import unittest
from getsub.util import guess_subtitle, compute_subtitle_score
class TestGuessSubtitle(unittest.TestCase):
test_episode_info = {
"title": "the walking dead",
"season": 10,
"episode": 1,
"type": "episode",
}
test_episode_subs = (
("... | gyh1621/GetSubtitles | tests/unit/util/test_guess_subtitle.py | Python | mit | 3,332 |
#!/usr/bin/env python
"""
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");... | arenadata/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.0/services/AMBARI_METRICS/package/scripts/service_check.py | Python | apache-2.0 | 7,127 |
# This file is part of cloud-init. See LICENSE file for license information.
from cloudinit.config.cc_snappy import (
makeop, get_package_ops, render_snap_op)
from cloudinit.config.cc_snap_config import (
add_assertions, add_snap_user, ASSERTIONS_FILE)
from cloudinit import (distros, helpers, cloud, util)
from... | larsks/cloud-init | tests/unittests/test_handler/test_handler_snappy.py | Python | gpl-3.0 | 24,488 |
#!/usr/bin/env python3
# bank_account.py
#
# Simple Bank Account class example.
#
# AMJ
# 2017-04-01
from random import randint
class BankAccount:
def __init__ (self, account_holder, has_overdraft):
self.account_number = self.generate_account_number ()
self.account_holder = account_holder
... | TonyJenkins/cfs2160-python | 04classes/Bank/bank_account.py | Python | unlicense | 1,282 |
import pdb
#!python
# -*- coding: utf-8 -*-
"""File: visual.py
Description:
This module contains visualizing method for geo data
History:
0.1.0 The first version.
"""
__version__ = '0.1.0'
__author__ = 'SpaceLis'
import dataset
from anatool.dm.db import GEOTWEET
import text_util
from operator im... | spacelis/anatool | anatool/dm/visual.py | Python | mit | 6,377 |
import constants
from agent_no_model import *
from config import Config
# Read the constants file
constants_hyperparam = constants.constants
# Read the configuration file that connects agent and simulator
config = Config.parse("../BlockWorldSimulator/Assets/config.txt")
# Create the agent
agent = AgentModelLess(STOP... | clic-lab/blocks | BlockWorldRoboticAgent/experiments/test_stop.py | Python | gpl-3.0 | 782 |
"""
import docker images, containers and volumes from a filesystem directory.
"""
import sys
import os
import subprocess
def import_docker(graph, import_location):
"""
This is a wrapper function for importing docker images, containers
and volumes.
"""
if not os.path.isdir(import_location):
... | shishir-a412ed/Docker-Migrate | src/dockermigrate/docker_import.py | Python | gpl-2.0 | 3,085 |
import os
import sys
import time
import select
import pty
import tty
import errno
import signal
from contextlib import contextmanager
import ptyprocess
from ptyprocess.ptyprocess import use_native_pty_fork
from .exceptions import ExceptionPexpect, EOF, TIMEOUT
from .spawnbase import SpawnBase
from .utils import which... | quatanium/pexpect | pexpect/pty_spawn.py | Python | isc | 35,792 |
import asyncio
from .base import REDIS_LOCATION
JSON_CACHES = {
"default": {
"BACKEND": "django_asyncio_redis.cache.AsyncRedisCache",
"POOLSIZE": None,
"LOCATION": REDIS_LOCATION,
"LOOP": asyncio.get_event_loop(),
"SERIALIZER": "django_asyncio_redis.serializers.json.JSONSer... | mackeyja92/django-asyncio-redis | tests/settings/json.py | Python | mit | 337 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... | mlperf/training_results_v0.5 | v0.5.0/google/research_v3.32/gnmt-tpuv3-32/code/gnmt/model/t2t/tensor2tensor/models/research/transformer_vae_test.py | Python | apache-2.0 | 2,344 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.