text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
from os import listdir
from os.path import isdir, isfile, join
import re
from platformio.commands.lib import cli
from platformio import util
def validate_libfolder():
libs_path = util.get_lib_dir()
installed_libs = listdir(libs_path)... | mseroczynski/platformio | tests/commands/test_lib.py | Python | mit | 2,036 | 0 |
# This file is part of the dionaea honeypot
#
# SPDX-FileCopyrightText: 2009 Markus Koetter
# SPDX-FileCopyrightText: 2016-2020 PhiBo (DinoTools)
#
# SPDX-License-Identifier: GPL-2.0-or-later
import glob
import logging
import pkgutil
import traceback
from threading import Event, Thread
from typing import Callable, Opt... | DinoTools/dionaea | modules/python/dionaea/__init__.py | Python | gpl-2.0 | 6,176 | 0.001457 |
# This file is part of Parti.
# Copyright (C) 2008 Nathaniel Smith <njs@pobox.com>
# Parti is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.
import gobject
import sys
import os
import socket
import time
from optparse import OptionParser
import log... | njsmith/partiwm | xpra/scripts/main.py | Python | gpl-2.0 | 12,235 | 0.002452 |
import sys
import json
import os
import re
import argparse
def get_file_locations():
parser = argparse.ArgumentParser()
parser.add_argument('input', help='Input AVPR filename(s)', nargs='+')
parser.add_argument('output', help='Output directory')
args = parser.parse_args()
return (args.input, args.output)
d... | pcingola/schemas | tools/sphinx/avpr2rest.py | Python | apache-2.0 | 5,874 | 0.016513 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='api_index'),
url(r'^time$', views.get_server_time, name='api_time'),
url(r'^rooms/available', views.find_available, name='api_available'),
] | Gazing/Frawt | django/frawt/api/urls.py | Python | mit | 253 | 0.003953 |
"""
Load appropriate Pulse Program and acquisition parameters
Arguments:
-1D: load nD experiment as a 1D
-2D: load nD experiment as a 2D (unless 1D experiment)
-3D: load nD experiment as a 3D (unless 1D, or 2D then highest)
-CC, hCC: load a 2D CC experiment (default to DARR)
More to come when it starts working
W.T... | TrentFranks/ssNMR-Topspin-Python | LoadExp.py | Python | mit | 1,871 | 0.02031 |
# -*- coding: utf-8 -*-
import tools
from osv import fields, osv
class reconcile_item(osv.osv_memory):
_name = "fg_account.reconcile.item"
_columns = {
'ref_doc':fields.reference('单据', selection=[('fg_sale.order','销售订单'),('fg_account.bill','收款单')],
size=128, readonly=True),
... | Johnzero/OE7 | openerp/addons-fg/fg_account/report/period_check.py | Python | agpl-3.0 | 6,202 | 0.030795 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
# Copyright (C) Zing contributors.
#
# This file is a part of the Zing project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship inf... | iafan/zing | pootle/runner.py | Python | gpl-3.0 | 11,729 | 0 |
import traceback
from sanic.log import log
HOST = '127.0.0.1'
PORT = 42101
class SanicTestClient:
def __init__(self, app):
self.app = app
async def _local_request(self, method, uri, cookies=None, *args, **kwargs):
import aiohttp
if uri.startswith(('http:', 'https:', 'ftp:', 'ftps://... | jrocketfingers/sanic | sanic/testing.py | Python | mit | 3,419 | 0.000585 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | guschmue/tensorflow | tensorflow/python/ops/control_flow_grad.py | Python | apache-2.0 | 9,075 | 0.009477 |
# coding: utf-8
from .default import Config
class ProductionConfig(Config):
# Site domain
SITE_DOMAIN = "http://www.twtf.com"
# Db config
SQLALCHEMY_DATABASE_URI = "mysql+pymysql://dbuser:dbpass@localhost/databasename"
# Sentry
SENTRY_DSN = ''
| SCUT16K/SmsSender | server/config/production_sample.py | Python | apache-2.0 | 272 | 0.003676 |
"""Assign Params to Attributes by Joel Hedlund <joel.hedlund at gmail.com>.
PyDev script for generating python code that assigns method parameter
values to attributes of self with the same name. Activates with 'a' by
default. Edit global constants ACTIVATION_STRING and WAIT_FOR_ENTER if this
does not suit your needs... | smkr/pyclipse | plugins/org.python.pydev.jython/jysrc/pyedit_assign_params_to_attributes.py | Python | epl-1.0 | 3,468 | 0.012111 |
#!/usr/bin/env python
import smtplib
from email.mime.text import MIMEText
me = "me@example.com"
you = "you@example.com"
msg = MIMEText("Hello world!")
msg['From'] = me
msg['To'] = you
msg['Subject'] = 'Greetings'
s = smtplib.SMTP('localhost', 2525)
s.login("guest", "guest")
s.sendmail(me, [you], msg.as_string())
s.... | gotthardp/rabbitmq-email | test/send.py | Python | mpl-2.0 | 327 | 0 |
###############################################################################
##
## Copyright (C) 2014-2015, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | hjanime/VisTrails | vistrails/db/versions/v0_3_1/persistence/__init__.py | Python | bsd-3-clause | 2,007 | 0.013453 |
import logging
LOG = logging.getLogger(__name__)
__author__ = 'Hardy.zheng'
class DiskPoller(object):
def __init__(self):
pass
def run(self):
LOG.info('DiskPoller start...')
| lloy/Project | cdsagent/cdsagent/vdisk/disk.py | Python | apache-2.0 | 205 | 0 |
from core.utils import *
commands = [
('/voicerss', ['language', 'text'])
]
description = 'Generates an audio file using Voice RSS API.'
shortcut = '/vr '
langs = [
'af', 'aq', 'ar', 'hy', 'ca', 'zh', 'zh-cn', 'zh-tw', 'zh-yue',
'hr', 'cs', 'da', 'nl', 'en-au', 'en-uk', 'en-us', 'eo',
'fi',... | zhantyzgz/polaris | plugins/voicerss.py | Python | gpl-2.0 | 2,555 | 0.00274 |
import turtle
turtle.clearscreen()
t = turtle.Turtle()
#turtle.tracer(0, 0)
t.fillcolor(0.9, 0.9, 0.6)
t.begin_fill()
for i in range(0, 5):
t.forward(100)
t.right(144)
t.end_fill()
t.up()
t.backward(200)
t.down()
t.fillcolor(0.7, 0.95, 0.7)
t.begin_fill()
for i in range(0, 5):
t.forward(100)
... | amosnier/python_for_kids | extra_code/03_loopy_turtle_01.py | Python | gpl-3.0 | 862 | 0.006961 |
import numpy as np
def donut(shape, radius, width, distribution='gaussian'):
'''Generate a 2D Gaussian window of the given shape. width specifies the
size of the Gaussian. radius specifies the distance to origo such that
the window becomes a ring.'''
if not distribution in ['gaussian', 'lognormal']:
... | andersbll/ipcv | ipcv/misc/donuts.py | Python | mit | 1,393 | 0.000718 |
from django.contrib import admin
from leagueofladders.apps.myleague.models import League, Membership
class MembershipInline(admin.TabularInline):
model = Membership
extra = 1
@admin.register(League)
class LeagueAdmin(admin.ModelAdmin):
fields = ('name', 'owner', 'is_public')
inlines = [MembershipIn... | dylanseago/LeagueOfLadders | leagueofladders/apps/myleague/admin.py | Python | apache-2.0 | 489 | 0.002045 |
from __future__ import print_function, unicode_literals
import unittest
from praw.decorators import restrict_access
class DecoratorTest(unittest.TestCase):
def test_require_access_failure(self):
self.assertRaises(TypeError, restrict_access, scope=None,
oauth_only=True)
| julianwachholz/praw | tests/test_decorators.py | Python | gpl-3.0 | 311 | 0 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'qt/pluginmanagerdialog.ui'
#
# Created: Wed Jan 28 16:54:28 2015
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_PluginManagerDialog(ob... | MusculoskeletalAtlasProject/mapclient-src | mapclient/tools/ui_pluginmanagerdialog.py | Python | gpl-3.0 | 5,669 | 0.003528 |
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['rqt_pose_view'],
package_dir={'': 'src'}
)
setup(**d)
| aslab/rct | higgs/branches/ros-groovy/higgs_gazebo_simulation/rqt_robot_plugins/rqt_pose_view/setup.py | Python | gpl-3.0 | 222 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | ncliam/serverpos | openerp/addons/mail/tests/test_mail_features.py | Python | agpl-3.0 | 59,265 | 0.006109 |
#!/usr/bin/env python
"""
Copyright 2012 Tadeas Moravec.
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 ... | vesellov/bitdust.devel | lib/fastjsonrpc/client.py | Python | agpl-3.0 | 12,736 | 0.000236 |
"""Tests for DataStream objects."""
import pytest
from iotile.core.exceptions import InternalError
from iotile.sg import DataStream, DataStreamSelector
def test_stream_type_parsing():
"""Make sure we can parse each type of stream."""
# Make sure parsing stream type works
stream = DataStream.FromString('... | iotile/coretools | iotilesensorgraph/test/test_datastream.py | Python | gpl-3.0 | 8,473 | 0.000354 |
#!/usr/bin/env python
# coding=utf-8
def now():
print '2015-9-10';
f = now;
print now.__name__;
print f.__name__;
| gwq5210/python_learn | decorator.py | Python | gpl-2.0 | 116 | 0.051724 |
# This handles all interactions needed for interpreting and controlling the charger
import time
import api_adc, config
import apigpio.api_gpio as api_gpio
# Charger Control
def init_control():
api_gpio.init_pin(27)
api_gpio.off_pin(27) # Set line to low
def deinit_control():
api_gpio.deinit_pin(27)
d... | lumened/battmonitor | api_charger.py | Python | gpl-2.0 | 2,610 | 0.02069 |
#!/usr/bin/env python
# -*- noplot -*-
"""
This example shows how to use the agg backend directly to create
images, which may be of use to web application developers who want
full control over their code without using the pyplot interface to
manage figures, figure closing etc.
.. note::
It is not necessary to avo... | cactusbin/nyt | matplotlib/examples/pylab_examples/webapp_demo.py | Python | unlicense | 1,713 | 0.001751 |
#!/usr/bin/python
#
# Copyright (C) Citrix Systems Inc.
#
# This program 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; version 2.1 only.
#
# This program is distributed in the hope that it will be use... | pritha-srivastava/sm | drivers/LVHDoFCoESR.py | Python | lgpl-2.1 | 3,290 | 0.001216 |
# Copyright 2020 Google LLC
#
# 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, ... | GoogleCloudPlatform/buildpacks | builders/testdata/python/functions/conflicting_dependencies/main.py | Python | apache-2.0 | 926 | 0.00324 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup file for youtube_podcaster.
This file was generated with PyScaffold 2.4.2, a tool that easily
puts up a scaffold for your new Python project. Learn more under:
http://pyscaffold.readthedocs.org/
"""
import sys
from setuptools import setup
def s... | tomvanderlee/youtube-podcaster | setup.py | Python | mit | 660 | 0 |
import _plotly_utils.basevalidators
class ArrowcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="arrowcolor", parent_name="layout.annotation", **kwargs
):
super(ArrowcolorValidator, self).__init__(
plotly_name=plotly_name,
par... | plotly/python-api | packages/python/plotly/plotly/validators/layout/annotation/_arrowcolor.py | Python | mit | 479 | 0.002088 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The experiment with 10 Hz/5Hz, wisp, attention, 70, cA 3, delta, theta, alpha low, alpha high, batch size = 1 and
balanced data set
@author: yaric
"""
import experiment as ex
import config
from time import time
experiment_name = 'cA_3_1_dt-th-a_l-a_h' # will be use... | yaricom/brainhash | src/experiment_cA3_1_dt_th_al_ah.py | Python | gpl-3.0 | 1,954 | 0.011771 |
from JumpScale import j
descr = """
Checks disks' status
"""
organization = "jumpscale"
name = 'check_disks'
author = "zains@codescalers.com"
license = "bsd"
version = "1.0"
category = "system.disks"
async = True
queue = 'process'
roles = []
enable = True
period=0
log=False
def action():
import JumpScale.lib.d... | Jumpscale/jumpscale6_core | apps/agentcontroller/jumpscripts/core/monitoring_infogathering/info_gather_disks.py | Python | bsd-2-clause | 566 | 0.008834 |
# Contains functionality for responses
import numpy as np
import astropy.io.fits as fits
__all__ = ["RMF", "ARF"]
class RMF(object):
def __init__(self, filename):
self._load_rmf(filename)
pass
def _load_rmf(self, filename):
"""
Load an RMF from a FITS file.
Paramet... | dhuppenkothen/clarsach | clarsach/respond.py | Python | gpl-3.0 | 10,929 | 0.001738 |
__author__ = 'saeedamen' # Saeed Amen
#
# Copyright 2016 Cuemacro
#
# 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 ... | cuemacro/chartpy | chartpy_examples/xkcd_example.py | Python | apache-2.0 | 2,081 | 0.004805 |
# -*- 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):
# Adding model 'Entry'
db.create_table(u'blog_entry', (
(u'id... | klebercode/klebercode | klebercode/blog/migrations/0001_initial.py | Python | gpl-2.0 | 6,850 | 0.007737 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-aiplatform | google/cloud/aiplatform_v1beta1/types/tensorboard_service.py | Python | apache-2.0 | 42,035 | 0.000619 |
from .._pickle_api import pickle_dumps, pickle_loads
def test_pickle_dumps():
data = {"hello": "world", "test": 123}
expected = [
b"\x80\x04\x95\x1e\x00\x00\x00\x00\x00\x00\x00}\x94(\x8c\x05hello\x94\x8c\x05world\x94\x8c\x04test\x94K{u.",
b"\x80\x04\x95\x1e\x00\x00\x00\x00\x00\x00\x00}\x94(\x8... | explosion/srsly | srsly/tests/test_pickle_api.py | Python | mit | 870 | 0.004598 |
#
# The Python Imaging Library
# $Id$
#
# simple postscript graphics interface
#
# History:
# 1996-04-20 fl Created
# 1999-01-10 fl Added gsave/grestore to image method
# 2005-05-04 fl Fixed floating point issue in image (from Eric Etheridge)
#
# Copyright (c) 1997-2005 by Secret Labs AB. All rights reserved.
# ... | sserrot/champion_relationships | venv/Lib/site-packages/PIL/PSDraw.py | Python | mit | 6,735 | 0.000148 |
# encoding: utf-8
# 为了 Python3 的兼容,如果你用的 Python2.7
from __future__ import print_function, division
import tensorflow as tf
print('Loaded TF version', tf.__version__, '\n\n')
# Tensor 在数学中是“张量”
# 标量,矢量/向量,张量
# 简单地理解
# 标量表示值
# 矢量表示位置(空间中的一个点)
# 张量表示整个空间
# 一维数组是矢量
# 多维数组是张量, 矩阵也是张量
# 4个重要的类型
# @Variable 计算图谱中的变量
# ... | karst87/ml | 01_openlibs/tensorflow/02_tfgirls/TensorFlow-and-DeepLearning-Tutorial-master/Season1/1-3/run.py | Python | mit | 3,407 | 0.026719 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import threading
class TestCollection(object):
"""A threadsafe collection of tests.
Args:
tests: List of tests to put in the collection.
"""
d... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/build/android/pylib/base/test_collection.py | Python | mit | 2,343 | 0.011524 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 OpenERP S.A. http://www.openerp.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GN... | addition-it-solutions/project-all | openerp/addons/base/tests/test_osv.py | Python | agpl-3.0 | 4,654 | 0.004297 |
from core import MechalatureError
import shelve
__all__ = [
'MechalatureEvent',
'get_info'
]
word_bank = shelve.open('bin/word_bank')
class MechalatureEvent:
def __init__(self, name: str):
self.name = name
self._tags = set()
def tag(self, terms: set):
self._tags += terms
... | Tankobot/mechalature | core/identify.py | Python | gpl-3.0 | 735 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-os-config | google/cloud/osconfig_v1/types/__init__.py | Python | apache-2.0 | 4,373 | 0 |
from olpc import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
email = db.Column(db.String(120), unique=True)
def __init__(self, name, email):
self.name = name
self.email = email
def __repr__(self):
return '<Name %r... | LeotisBuchanan/olpc-datavisualization- | models.py | Python | gpl-2.0 | 341 | 0.005865 |
# (c) Copyright 2014 Cisco 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
#
# Unl... | alex8866/cinder | cinder/tests/zonemanager/test_cisco_fc_zone_client_cli.py | Python | apache-2.0 | 9,495 | 0 |
def merge(a, b):
"""
inuput: two sorted lists
output: a merged sorted list
for example:
merge([2,3], [1,4])
--> [1,2,3,4]
"""
merged = []
while a or b:
if a and b:
if a[0] < b[0]:
merged.append(a.pop(0))
else:
merged.ap... | humw/algorithms_in_python | merge_sort/merge_sort.py | Python | gpl-2.0 | 667 | 0 |
# (C) British Crown Copyright 2020, Met Office
#
# This file is part of cartopy.
#
# cartopy 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 your option) any la... | ocefpaf/cartopy | lib/cartopy/tests/conftest.py | Python | lgpl-3.0 | 1,159 | 0 |
"""
Global views -- i.e., don't tied to any app/model.
"""
from core.shortcuts import render_to
@render_to ('index.html')
def index (request):
return {}
## /newsletter/
from utils.mailchimp import MailChimp
from django.conf import settings
#mailchimp = None
#if settings.MAILCHIMP_API_KEY:
# mailchimp = M... | normalnorway/normal.no | django/core/views.py | Python | gpl-3.0 | 733 | 0.0191 |
"""Defines the unit tests for the :mod:`colour.utilities.data_structures` module."""
import numpy as np
import operator
import pickle
import unittest
from colour.utilities import (
Structure,
Lookup,
CaseInsensitiveMapping,
LazyCaseInsensitiveMapping,
Node,
)
__author__ = "Colour Developers"
__co... | colour-science/colour | colour/utilities/tests/test_data_structures.py | Python | bsd-3-clause | 17,079 | 0.000586 |
from pyswagger import SwaggerApp, utils, primitives, errs
from ..utils import get_test_data_folder
from ...scanner import CycleDetector
from ...scan import Scanner
import unittest
import os
import six
class CircularRefTestCase(unittest.TestCase):
""" test for circular reference guard """
def test_path_item_... | joequant/pyswagger | pyswagger/tests/v2_0/test_circular.py | Python | mit | 3,163 | 0.002845 |
#
# Copyright (C) University College London, 2007-2012, all rights reserved.
#
# This file is part of HemeLB and is provided to you under the terms of
# the GNU LGPL. Please see LICENSE in the top level directory for full
# details.
#
"""Regarding indices, a few conventions:
1) Broadly there are two types of index... | jenshnielsen/hemelb | Tools/hemeTools/parsers/geometry/__init__.py | Python | lgpl-3.0 | 1,408 | 0.035511 |
# Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | ayoubg/gem5-graphics | gem5-gpu/tests/quick/se_gpu/20.bh/test.py | Python | bsd-3-clause | 1,653 | 0 |
from typing import Any, List, Tuple, Dict #cast
from sphinx.application import Sphinx
# from sphinx.ext.autodoc import Documenter
from sphinx.ext.autodoc import ModuleLevelDocumenter
from sphinx.pycode import ModuleAnalyzer, PycodeError
#from sphinx.domains.python import PythonDomain
from sphinx.locale import __
from ... | googlefonts/fontbakery | Lib/fontbakery/sphinx_extensions/profile.py | Python | apache-2.0 | 24,923 | 0.003491 |
"""
QUESTION:
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon
consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially positioned in the top-left room
and must fight his way through the dungeon to rescue the princess.
The knigh... | tktrungna/leetcode | Python/dungeon-game.py | Python | mit | 2,261 | 0.006192 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2017_10_01/aio/operations/_security_rules_operations.py | Python | mit | 22,275 | 0.004893 |
"""
Virtualization test utility functions.
:copyright: 2008-2009 Red Hat Inc.
"""
import time
import string
import random
import socket
import os
import signal
import re
import logging
import commands
import fcntl
import sys
import inspect
import tarfile
import shutil
import getpass
from autotest.client import utils,... | spcui/virt-test | virttest/utils_misc.py | Python | gpl-2.0 | 59,810 | 0.000686 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 th... | grengojbo/st2 | st2client/st2client/client.py | Python | apache-2.0 | 5,863 | 0.003752 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# kate: space-indent on; indent-width 4; mixedindent off; indent-mode python;
import argparse
import string
import ldap
import ldap.modlist as modlist
from action_base import *
class action_module(action_base):
def __init__(self, app, args):
action_base.__init__(... | aroth-arsoft/arsoft-python | python3/arsoft/ldap/slapd/action_module.py | Python | gpl-3.0 | 2,292 | 0.004799 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from django.conf.urls import patterns, url
from oneanddone.users import views
urlpatterns = patterns('',
url(r'^lo... | adini121/oneanddone | oneanddone/users/urls.py | Python | mpl-2.0 | 1,193 | 0.006706 |
#Задача №4 , Вариант 13
#Напишите программу, которая выводит имя, под которым скрывается Жан Батист Поклен. Дополнительно необходимо вывести область интересов указанной личности, место рождения, годы рождения и смерти (если человек умер), вычислить возраст на данный момент (или момент смерти).
#Костарев А. И.
#14.... | Mariaanisimova/pythonintask | BITs/2014/KOSTAREV_A_I/task_4_13.py | Python | apache-2.0 | 1,201 | 0.024691 |
from rest_framework import serializers
from ..models import Route
class RouteSerializer(serializers.ModelSerializer):
class Meta:
model = Route
fields = (
'pk',
'name',
'description',
'direction_main',
'direction_extra',
'zon... | sauli6692/ibc-server | rte/serializers/route.py | Python | mit | 337 | 0 |
from ctypes import *
# Ether types that we handle
# These are types that will be found in the frame header
ET_ARP = 0x0806
ET_REV_ARP = 0x8035
ET_IPv4 = 0x0800
ET_IPv6 = 0x86DD
# IP types that we handle
# These types are found in the ipv4 header
IPT_ICMP = 0x01
IPT_TCP = 0x06
IPT_UDP = 0x11
IPT_IPv6 = 0... | lattrelr7/cse881-pcap | ip_structs.py | Python | mit | 4,002 | 0.006497 |
# -*- coding: utf-8 -*-
from decimal import Decimal, ROUND_UP
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from django.conf import settings
from django.shortcuts... | codenginebd/django-paypal-driver | paypal/views.py | Python | gpl-2.0 | 7,535 | 0.01075 |
from __future__ import division, print_function, absolute_import
import amitgroup as ag
import pnet
import pnet.cifar
import numpy as np
ag.set_verbose(True)
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('parts',metavar='<parts file>',
type=argp... | amitgroup/parts-net | scripts/cifar/train_and_test_cifar.py | Python | bsd-3-clause | 1,777 | 0.006753 |
""" synrcat
gaussian mixture model
"""
import sys
import os
import numpy as np
import logging
from collections import OrderedDict
from astropy.table import Table
from pypeline import pype, add_param, depends_on
from syn import Syn
from syncat.errors import NoPoints
import syncat.misc as misc
import syncat.fileio a... | bengranett/syncat | syncat/methods/gmm.py | Python | mit | 6,003 | 0.002999 |
basis_set = \
{
"H": [
[
"S",
[
[
18.731137,
0.0334946
],
[
2.8253937,
0.23472695
],
[
0.6401217,
... | LT12/LTPsi | basis/b631Gs.py | Python | gpl-2.0 | 2,590 | 0.018533 |
#!/usr/bin/python
# The list are enclosed in brackets ([]) and their element
# and size can be changed, while tuples are enclosed in parenthese
# ( () ) and cannot be updated. The Tuples can be thought of as
# read-only of list
aTuple = ( 'abcd', 786, 2.23, 'John', 70.2)
bTuple = ( 123, 'Vien')
print aTuple ... | HuuHoangNguyen/Python_learning | Tuples.py | Python | mit | 3,657 | 0.004375 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | diogocs1/comps | web/addons/hw_scanner/__init__.py | Python | apache-2.0 | 1,075 | 0.002791 |
import json
from datetime import datetime
from django.test import TestCase, Client
from authentication.models import Account
from recipies.models import Recipe, RecipeSteps
from recipies.serializers import RecipeSerializer, RecipeStepsSerializer
class Utility(TestCase):
"""Utility class para testing"""
@s... | moonboy13/brew-journal | brew_journal/recipies/tests.py | Python | apache-2.0 | 21,233 | 0.003909 |
"""
Test how many times newly loaded binaries are notified;
they should be delivered in batches instead of one-by-one.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ModuleLoadedNotifysTest... | google/llvm-propeller | lldb/test/API/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py | Python | apache-2.0 | 4,739 | 0.004009 |
#
# The Python Imaging Library.
# $Id$
#
# TIFF tags
#
# This module provides clear-text names for various well-known
# TIFF tags. the TIFF codec works just fine without it.
#
# Copyright (c) Secret Labs AB 1999.
#
# See the README file for information on usage and redistribution.
#
##
# This module provides constant... | FreddieShoreditch/image_folder_organiser | venv/lib/python2.7/site-packages/PIL/TiffTags.py | Python | mit | 9,273 | 0.000324 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
for user in orm['auth.user'].objects.all():
notification = orm.Notification()
notification.user = user
... | fgaudin/aemanager | notification/migrations/0002_populate_users.py | Python | agpl-3.0 | 4,216 | 0.00759 |
# vim:tw=50
""""While" Loops
Recursion is powerful, but not always convenient
or efficient for processing sequences. That's why
Python has **loops**.
A _loop_ is just what it sounds like: you do
something, then you go round and do it again, like
a track: you run around, then you run around again.
Loops let you do ... | shiblon/pytour | 3/tutorials/while_loops.py | Python | apache-2.0 | 1,756 | 0.008542 |
from __future__ import division
import numpy as np
import argparse, itertools
from scipy.io import wavfile
from template_speech_rec import configParserWrapper
from TestSVMBernoulli import get_bernoulli_templates
from scipy.ndimage.filters import maximum_filter
from amitgroup.stats import bernoullimm
import matplotlib.p... | markstoehr/phoneclassification | local/CExtractPatches_from_spec.py | Python | gpl-3.0 | 8,937 | 0.013651 |
# Copyright 2018 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
'name': 'Stock Picking Whole Scrap',
'summary': 'Create whole scrap from a picking for move lines',
'version': '11.0.1.0.0',
'development_status': 'Beta',
'category': 'Warehouse',
'websi... | Domatix/stock-logistics-workflow | stock_picking_whole_scrap/__manifest__.py | Python | agpl-3.0 | 641 | 0 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ParameterVector.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***********************... | bstroebl/QGIS | python/plugins/sextante/parameters/ParameterVector.py | Python | gpl-2.0 | 4,042 | 0.003216 |
# Copyright 2013 OpenStack Foundation
# 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 requ... | hayderimran7/tempest | tempest/api/compute/servers/test_virtual_interfaces_negative.py | Python | apache-2.0 | 1,691 | 0 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | squirrelo/qiita | qiita_db/test/test_base.py | Python | bsd-3-clause | 5,463 | 0.000183 |
import re
import hashlib
FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string
PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data://
def getParentAndBase(path):
match = PREFIX.match(path)
if match is None:
if path.endswith('/'):
st... | algorithmiaio/algorithmia-python | Algorithmia/util.py | Python | mit | 1,473 | 0.002716 |
"""
Django settings for rha project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
# impo... | klebercode/rhape | rha/settings.py | Python | mit | 2,677 | 0 |
#!/usr/bin/env python
# -*- Mode: Python; tab-width: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# vim:set ft=python ts=4 sw=4 sts=4 autoindent:
'''
Functionality for invoking tagging services.
Author: Pontus Stenetorp
Version: 2011-04-22
'''
from __future__ import with_statement
from httplib import HTTPCon... | wolfe-pack/moro | public/javascripts/brat/server/src/tag.py | Python | bsd-2-clause | 6,002 | 0.001833 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Sctify: converts a CHARMM PSF/PDF pair to a SCT compatible PDB
"""
# Copyright 2014 University College London
# 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 o... | dww100/sct | python/bin/sctify.py | Python | apache-2.0 | 1,761 | 0.000568 |
# -*- 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):
# Adding field 'MakerScienceResource.level'
db.add_column(u'makerscience_... | atiberghien/makerscience-server | makerscience_catalog/migrations/0004_auto__add_field_makerscienceresource_level__add_field_makersciencereso.py | Python | agpl-3.0 | 5,685 | 0.00686 |
import _plotly_utils.basevalidators
class DtickValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(
self, plotly_name="dtick", parent_name="densitymapbox.colorbar", **kwargs
):
super(DtickValidator, self).__init__(
plotly_name=plotly_name,
parent_name=par... | plotly/plotly.py | packages/python/plotly/plotly/validators/densitymapbox/colorbar/_dtick.py | Python | mit | 500 | 0.002 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOW
def dependencies():
pass
def tamper(payload, **kwargs):
"""
Replaces space character (' ') with ... | glaudsonml/kurgan-ai | tools/sqlmap/tamper/space2comment.py | Python | apache-2.0 | 1,319 | 0.001516 |
# -*- coding: utf-8 -*-
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 unique constraint on 'Company', fields ['slug']
db.create_unique(u'ecg_balancing_company', ['slug']... | sinnwerkstatt/ecg-balancing | ecg_balancing/migrations/0012_auto__add_unique_company_slug.py | Python | mit | 10,698 | 0.007758 |
import pygame
import sys
from PIL import Image # Python Imaging Library
from vector_math import Vector2
pygame.init()
# load map with PIL
image_filename = "track_new_3.bmp"
#image_filename = "empty.bmp"
class Environment:
def __init__(self):
img = Image.open(image_filename)
self.track = img.loa... | bendaf/diff_drive_entropy | EntropicRobot/main_race.py | Python | gpl-2.0 | 4,131 | 0.002905 |
"""
Django settings for myproject project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
... | eamuntz/Django-Tut | myproject/myproject/settings.py | Python | mit | 2,048 | 0 |
import unittest
from distributed_queue import core, backends
class TestBackend(unittest.TestCase):
def test_list_backends(self):
backend_list = core.BACKEND_LIST
self.assertTrue('dummy' in backend_list)
self.assertTrue('redis' in backend_list)
def test_create_backend_fail(self):
... | ProstoKSI/distributed-queue | distributed_queue/tests/test_backends_init.py | Python | mit | 1,313 | 0.002285 |
#
# Copyright 2016 Dohop hf.
#
# 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, ... | dohop/supervisor-logstash-notifier | setup.py | Python | apache-2.0 | 1,635 | 0 |
from burp import ITab
from javax.swing import JPanel, GroupLayout, JLabel, JComboBox, JCheckBox
from java.awt import Dimension
from core.checks import plugins
class ConfigTab( ITab, JPanel ):
def __init__( self, callbacks ):
self._callbacks = callbacks
self._helpers = callbacks.getHelpers()
... | SecHackLabs/WebHackSHL | modules/tplmap/burp_extension/config_tab.py | Python | gpl-3.0 | 4,466 | 0.027765 |
# -*- coding: utf-8 -*-
'''The app module, containing the app factory function.'''
from flask import Flask, render_template
from cheapr.settings import ProdConfig
from cheapr.assets import assets
from cheapr.extensions import (
bcrypt,
cache,
db,
login_manager,
migrate,
debug_toolbar,
)
from ch... | antani/cheapr | cheapr/app.py | Python | bsd-3-clause | 1,780 | 0.002247 |
import re
from os.path import join
from setuptools import find_packages
def get():
pkgnames = find_packages()
if len(pkgnames) == 0:
return "unknown"
pkgname = pkgnames[0]
content = open(join(pkgname, "__init__.py")).read()
c = re.compile(r"__version__ *= *('[^']+'|\"[^\"]+\")")
m = c... | limix/glimix-core | version.py | Python | mit | 411 | 0 |
#-*- coding:utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import datetime
import time
from openerp.osv import osv
from openerp.report import report_sxw
class report_hr_salary_employee_bymonth(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(r... | vileopratama/vitech | src/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py | Python | mit | 4,552 | 0.004174 |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... | rvs/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/storage/pg_twophase/switch_ckpt_serial/trigger_sql/test_triggersqls.py | Python | apache-2.0 | 1,237 | 0.001617 |
phone = "315-555-2955"
print "Area Code: {0}".format(phone[0:3])
print "Local: {0}".format(phone[4:])
print "Different format: ({0}) {1}".format(phone[0:3], phone[4:])
| codelikeagirlcny/python-lessons-cny | code-exercises-etc/section_02_(strings)/z.ajm.str-format-phone-ex.20151024.py | Python | mit | 169 | 0 |
#!/usr/bin/env python
#
# Plugins.py
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; w... | max0d41/ThugBrowser | src/DOM/Plugins.py | Python | gpl-2.0 | 1,544 | 0.002591 |
# -*- coding: utf-8 -*-
from .render.console import ConsoleRender
def prompt(questions, render=None, answers=None):
render = render or ConsoleRender()
answers = answers or {}
try:
for question in questions:
answers[question.name] = render.render(question, answers)
return answ... | piton-package-manager/piton | piton/lib/inquirer/prompt.py | Python | mit | 425 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.