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 |
|---|---|---|---|---|---|
#
# Copyright (c) 2010 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | DragonRoman/ovirt-engine-sdk | src/ovirtsdk/infrastructure/common.py | Python | apache-2.0 | 1,711 |
#!/usr/bin/python3
# coding:utf-8
from geopytool.ImportDependence import *
from geopytool.CustomClass import *
LocationOfMySelf=os.path.dirname(__file__)
#print(LocationOfMySelf,' init')
sign = '''
created on Sat Dec 17 22:28:24 2016
@author: cycleuser
# Create Date: 2015-07-13
# Modify Date: 2018-02-09
a tool s... | cycleuser/GeoPython | geopytool/__init__.py | Python | gpl-3.0 | 61,501 |
# -*- coding: utf-8 -*-
import time
from fluent import sender
class Event(object):
def __init__(self, label, data, **kwargs):
assert isinstance(data, dict), 'data must be a dict'
sender_ = kwargs.get('sender', sender.get_global_sender())
timestamp = kwargs.get('time', int(time.time()))
... | airtoxin/fluent-logger-sublimetext | libs/fluent/event.py | Python | mit | 374 |
from django.conf import settings
from django.core.mail import get_connection, mail_managers, send_mail
from django.core.mail.message import EmailMultiAlternatives
from django.template.loader import render_to_string
def send_mass_html_mail(datatuple, fail_silently=False, auth_user=None,
auth_pa... | izzyalonso/tndata_backend | tndata_backend/utils/email.py | Python | mit | 3,292 |
#!/usr/bin/env python
import xml.etree.ElementTree as ET
class brocade_sflow(object):
"""Auto generated class.
"""
def __init__(self, **kwargs):
self._callback = kwargs.pop('callback')
def sflow_enable(self, **kwargs):
"""Auto Generated Code
"""
config = E... | BRCDcomm/pynos | pynos/versions/ver_7/ver_7_1_0/yang/brocade_sflow.py | Python | apache-2.0 | 10,556 |
#
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | oVirt/ovirt-scheduler-proxy | src/ovirtscheduler/runner.py | Python | apache-2.0 | 2,775 |
from django.db import models
# Create your models here.
from utils_plus.abstracts import CheckDeletableModelMixin
from utils_plus.choices import ChoicesEnum
from utils_plus.models import QueryManager
from utils_plus.fields import ChoicesEnumField
class Title(ChoicesEnum):
mr = 'Mr.'
ms = 'Ms.'
mrs = 'Mrs... | jnoortheen/django-utils-plus | tests/test_app/models.py | Python | mit | 1,082 |
# coding=utf-8
# Copyright 2019 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 requ... | tombstone/models | official/nlp/xlnet/preprocess_utils.py | Python | apache-2.0 | 3,807 |
"""
coverage.py plugin for Hy.
"""
from .hy_coverage import HyCoveragePlugin
def coverage_init(reg, options):
"""An init callback that is called on initialisation to register the
classes provided by this plugin.
"""
reg.add_file_tracer(HyCoveragePlugin())
| timmartin/hy-coverage | hy_coverage_plugin/__init__.py | Python | mit | 275 |
#! -*- coding: utf-8 -*-
from __future__ import print_function
from model_handling import exodus as elib
import click
import numpy as np
from code_generation import code_generator
from model_handling import model
@click.group()
def cli():
"""
pysalvus
"""
pass
@cli.group()
def code_generation():
... | SalvusHub/salvus | src/py/pysalvus/pysalvus.py | Python | mit | 4,100 |
from botocore.exceptions import NoCredentialsError
from botocore.compat import OrderedDict
from botocore import xform_name
import botocore
from botocore.hooks import HierarchicalEmitter
from awscli.clidriver import ServiceCommand, CLIOperationCaller, \
CLIDriver, ServiceOperation
from awscli import EnvironmentVari... | garnaat/remora | remora.py | Python | apache-2.0 | 2,969 |
import csv
from app.analyzer.data.data_filepath import COUNTRIES_TRANSLATION_FILE
def parse_csv_countries_translation():
result = {}
with open(COUNTRIES_TRANSLATION_FILE, 'r') as f:
reader = csv.reader(f, delimiter=',', quotechar='"')
for row in reader:
result[row[4]] = row[5]
... | egenerat/gae-django | app/analyzer/countryname_translator.py | Python | mit | 589 |
#!/usr/bin/env python
"""Test get_all_children vs """
from __future__ import print_function
__copyright__ = "Copyright (C) 2010-2019, DV Klopfenstein, H Tang et al. All rights reserved."
import os
import sys
import timeit
from goatools.base import get_godag
from goatools.godag.go_tasks import get_id2children
from go... | tanghaibao/goatools | tests/test_get_children.py | Python | bsd-2-clause | 1,701 |
#! python
# Python Serial Port Extension for Win32, Linux, BSD, Jython
# see __init__.py
#
# (C) 2001-2009 Chris Liechti <cliechti@gmx.net>
# this is distributed under a free software license, see license.txt
# compatibility folder Python < 2.6
try:
bytes
bytearray
except (NameError, AttributeError):
# Py... | slandis/InkCutter | inkcutter/app/bin/serial/serialutil.py | Python | gpl-3.0 | 18,576 |
# -*- coding: utf-8 -*-
#----------------------------------------------------------
# OpenERP HTTP layer
#----------------------------------------------------------
import ast
import collections
import contextlib
import datetime
import errno
import functools
import getpass
import inspect
import logging
import mimetypes... | ncliam/serverpos | openerp/http.py | Python | agpl-3.0 | 61,262 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-07 14:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contact', '0005_contactpage_email_2'),
]
operations = [
migrations.AlterFie... | ilendl2/wagtail-cookiecutter-foundation | {{cookiecutter.project_slug}}/contact/migrations/0006_auto_20170907_1451.py | Python | mit | 1,340 |
# callirhoe - high quality calendar rendering
# Copyright (C) 2012 George M. Tzoumas
# 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 ... | geotz/callirhoe | geom/default.py | Python | gpl-3.0 | 1,243 |
# browsershots.org - Test your web design in different browsers
# Copyright (C) 2007 Johann C. Rocholl <johann@browsershots.org>
#
# Browsershots 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 ... | foligny/browsershots-psycopg2 | shotserver/shotserver04/common/templatetags/__init__.py | Python | gpl-3.0 | 937 |
#!/usr/bin/env python
from nose.tools import *
import networkx
class TestBipartite:
def test_project(self):
G=networkx.path_graph(4)
P=networkx.project(G,[1,3])
assert_equal(sorted(P.nodes()),[1,3])
assert_equal(sorted(P.edges()),[(1,3)])
def test_is_bipartite(self):
... | rainest/dance-partner-matching | networkx/algorithms/tests/test_bipartite.py | Python | bsd-2-clause | 732 |
import cv2
import cv
import colorsys
'''
STILL IN DEVELOPMENT
NOT YET A GENERAL PURPOSE SCRIPT!!!
NEEDS MORE WORK...
'''
import argparse
import sys
scale_font = 1
font = cv2.FONT_HERSHEY_COMPLEX_SMALL
font_colour = (255,255,255)
font_colour = (0,0,0)
def process_... | 34383c/pyNeuroML | pyneuroml/povray/MakeMovie.py | Python | lgpl-3.0 | 6,766 |
# -*- coding:utf-8 -*-
from flask import request, url_for
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from app import app, babel
from app.model import DB_BASE
from app.view.system_preferences import load_db
__author__ = 'windschord.com'
@babel.localeselector
def get... | windschord/airport_weather | app/run.py | Python | mit | 1,959 |
from typing import List
from backend.common.cache_clearing import get_affected_queries
from backend.common.manipulators.manipulator_base import ManipulatorBase
from backend.common.models.cached_model import TAffectedReferences
from backend.common.models.media import Media
class MediaManipulator(ManipulatorBase[Media... | the-blue-alliance/the-blue-alliance | src/backend/common/manipulators/media_manipulator.py | Python | mit | 805 |
# -*- coding: utf-8 -*-
"""Get credentials from file or environment variables"""
from functools import reduce
def dpath(dict_, path):
"""Dig into dictionary by string path. e.g.
dpath({'a': {'b': {'c': 'd'}}}, 'a.b') -> {'c': 'd'}
"""
from operator import getitem
paths = path.split('.')
retu... | leiforion/t1-python | terminalone/utils/credentials.py | Python | bsd-3-clause | 1,971 |
# -*- coding: utf-8 -*-
"""Module for running microtests on how well the extraction works -
this module is STANDALONE safe"""
import ConfigParser
import glob
import traceback
import codecs
import bibclassify_config as bconfig
import bibclassify_engine as engine
log = bconfig.get_logger("bibclassify.microtest")
de... | pombredanne/invenio-old | modules/bibclassify/lib/bibclassify_microtests.py | Python | gpl-2.0 | 7,289 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# =============================================================================
# Version: 2.9 (Feb 13, 2016)
# Author: Giuseppe Attardi (attardi@di.unipi.it), University of Pisa
# =============================================================================
# Copyright (... | zhouhoo/wiki_zh_vec | wikiextractor/extractPage.py | Python | apache-2.0 | 4,438 |
import commands
import os
import subprocess as sub
cont = 0
dev_list = []
def getIP():
return commands.getoutput("hostname -I")
def scan():
return sub.Popen(('sudo', 'nmap', '-sP', '192.168.1.0/24'), stdout=sub.PIPE)
def cleanString(x):
for i in x:
if i == "(":
print i
ip = getIP()
alive = sca... | Eduardogit/HackProjects | python/network/network-scanner.py | Python | mit | 757 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014, 2015 CERN.
#
# INSPIRE 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... | jalavik/inspire-next | inspire/dojson/jobs/fields/bd1xx.py | Python | gpl-2.0 | 4,856 |
# -*- coding: utf-8 -*-
# © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
import openerp.addons.connector.backend as backend
icops = backend.Backend('icops')
""" Generic ICOPS Backend """
icops7 = backend.Backend(parent=icops, version='7.0')
""" ICO... | Elico-Corp/openerp-7.0 | base_intercompany/backend.py | Python | agpl-3.0 | 350 |
__author__ = 'peter'
def populate(model,value,modified):
model.owner = {'value': value, 'modified': modified} | PeterDowdy/py-eu4-editor | province-editor/rules/owner.py | Python | mit | 114 |
from Screens.MessageBox import MessageBox
from boxbranding import getMachineBrand, getMachineName
class FactoryReset(MessageBox):
def __init__(self, session):
MessageBox.__init__(self, session, _("When you do a factory reset, you will lose ALL your configuration data\n"
"(including bouquets, services, satellite ... | popazerty/EG-2 | lib/python/Screens/FactoryReset.py | Python | gpl-2.0 | 597 |
# Copyright 2012 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 req... | CingHu/neutron-ustack | neutron/extensions/loadbalancer.py | Python | apache-2.0 | 19,800 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import ir
import common
import awip
frontend_path = "frontend/frontend.b"
_386_LINUX = 1
_LANG_C = 2
class FrontendTest(common.BFTestCase):
code = open(os.path.join(os.path.dirname(__file__),
'..', frontend_path)).read()
de... | praba230890/awib | test/frontend_test.py | Python | gpl-3.0 | 21,663 |
import numpy.linalg as la
import numpy as np
#not working yet
def closestPointToLine(direction, point, anchor=None):
if anchor is None:
anchor = np.zeros_like(direction)
direction = unit(direction)
return unit(((anchor - point) - ((anchor - point) * direction) * direction)+point)
def unit(array):
... | g-rauhoeft/scrap-cap | motioncapture/math/LinAlg.py | Python | mit | 868 |
from decimal import getcontext, Decimal
x = {}
def rlen(n):
for e in xrange(2, len(n)):
if n[:e] == n[e:e+e]:
return e
return 0
def ilen(i):
x = str(1. / i).split('.')[1]
r = rlen(x)
if r > 2:
return r
elif len(x) > 5:
getcontext().prec = 100
x = st... | lunixbochs/project-euler | 001-099/26/26.py | Python | mit | 683 |
#!/usr/bin/python
# coding=UTF-8
import curses
from curses import wrapper
import locale
locale.setlocale(locale.LC_ALL,"")
from session import AnnotationSession
from state_manager import StateManager
from trie_fsa import InvalidTransition
from app_fsa import AppFSA
from display import Display
from config import con... | xiaohan2012/curseq | app.py | Python | gpl-3.0 | 1,271 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Open PIM Daemon
(C) 2008 Soeren Apel <abraxa@dar-clan.de>
(C) 2008 Openmoko, Inc.
(C) 2009 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
(C) 2009 Sebastian Krzyszkowiak <seba.dos1@gmail.com>
(C) 2009 Tom "TAsn" Hacohen (tom@stosb.com)
GPLv2 or later
Generic Domain
... | freesmartphone/framework | framework/subsystems/opimd/pimd_generic.py | Python | gpl-2.0 | 11,732 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^$', 'webinterface.view.dashboard.main'),
url(r'^dashboard/$', 'webinterface.view.dashboard.main'),
url(r'^login/$', 'webinterface.view.login.main'),
url(r'^login/ajax/$', 'webinterface.view.login.ajax'),
url(r'^s... | cynja/coffeenator | webinterface/urls.py | Python | gpl-3.0 | 551 |
# -*- coding: utf-8 -*-
"""
Display currently playing song from Google Play Music Desktop Player.
Configuration parameters:
cache_timeout: how often we refresh this module in seconds (default 5)
format: specify the items and ordering of the data in the status bar.
These area 1:1 ma... | Spirotot/py3status | py3status/modules/gpmdp.py | Python | bsd-3-clause | 2,411 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('polls.views',
# Examples:
# url(r'^$', 'farmersale_website.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', 'index',name='index'),
url(r'^hello/$', 'hello',name='hello'),
url(r'^time/$', 'cu... | MarkTseng/django-farmersale | farmersale-env/farmersale_website/polls/urls.py | Python | mit | 633 |
# 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... | agrubb/tensorboard | tensorboard/plugins/text/text_plugin.py | Python | apache-2.0 | 9,227 |
class Advantage():
def __init__(self, ad = 0):
self.val = ad
self
name = "fuel"
val = 0
class Role():
role = "Developer"
def __init__(self, role = "Developer"):
self.role = role
self
class Employee():
adv = [Advantage(0),Advantage(... | jefersonm/sandbox | languages/python/basic/Company.py | Python | mit | 1,011 |
import logging
import time
import boto3
import dns.resolver
from retrying import retry
logger = logging.getLogger(__name__)
def get_cluster_id():
"""Determine EMR cluster ID via DNS"""
resolver = dns.resolver.Resolver()
cluster_id = resolver.query('dataproc.rasterfoundry.com', 'TXT')[0]
return clust... | aaronxsu/raster-foundry | app-tasks/rf/src/rf/utils/emr.py | Python | apache-2.0 | 1,771 |
import sys
import cv2
import math
from skimage import draw
import numpy as np
from typing import List
from pathlib import Path
import logging
import argparse
def alpha_blur(img, alpha_mask, kernel_size=10):
"""
Blur image proportional to the given mask
:param img:
:param alpha_mask:
:param kernel_... | 5agado/data-science-learning | graphics/learn_to_paint/image_utils.py | Python | apache-2.0 | 8,095 |
#!/usr/bin/env python
from provider import gandi
import yaml
def heading(title):
print('\n%s %s' % (title, '=' * (73 - len(title))))
def subheading(title):
print('[ %s ]%s' % (title, '-' * (70 - len(title))))
if __name__ == '__main__':
with open('config.yaml', 'r') as config_file:
config = yaml.l... | briancline/maior-domus | gandi.py | Python | mit | 1,914 |
"""
It contains the necessary functions to set up the surface to be solved.
"""
import numpy
from pygbe.util.read_data import read_fields, read_surface
from pygbe.classes import Field, Surface
def initialize_surface(field_array, filename, param):
"""
Initialize the surface of the molecule.
Arguments
... | barbagroup/pygbe | pygbe/class_initialization.py | Python | bsd-3-clause | 2,997 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Daniel Reis
#
# This program 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... | Antiun/department | project_task_department/project_task.py | Python | agpl-3.0 | 1,763 |
"""<name>GEO Data Sets</name>
<description>Access to Gene Expression Omnibus data sets.</description>
<priority>20</priority>
<contact>Ales Erjavec (ales.erjavec(@at@)fri.uni-lj.si)</contact>
<icon>icons/GEODataSets.svg</icon>
"""
from __future__ import absolute_import, with_statement
import sys
import os
import glob... | tomazc/orange-bio | orangecontrib/bio/widgets/OWGEODatasets.py | Python | gpl-3.0 | 24,559 |
# -*- encoding:utf-8 -*-
"""
gargoyle.conditions
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import six
import datetime
import itertools
from django.core.validators i... | YPlan/gargoyle | gargoyle/conditions.py | Python | apache-2.0 | 12,415 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file... | afrolov1/nova | nova/network/linux_net.py | Python | apache-2.0 | 72,321 |
import logging
from Tribler.community.market.core.message import TraderId
from Tribler.community.market.core.price import Price
from Tribler.community.market.core.quantity import Quantity
from Tribler.community.market.core.timeout import Timeout
from Tribler.community.market.core.timestamp import Timestamp
class Tic... | vandenheuvel/tribler | Tribler/community/market/core/order.py | Python | lgpl-3.0 | 13,403 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack, LLC
# 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... | tylertian/Openstack | openstack F/glance/glance/store/swift.py | Python | apache-2.0 | 29,016 |
import logging
import re
from autotest.client import utils
from autotest.client.shared import error
from virttest import virsh, utils_test
from virttest.libvirt_xml import vm_xml
from virttest.utils_test import libvirt
from virttest import utils_misc
def run(test, params, env):
"""
Test the command virsh vcp... | will-Do/tp-libvirt_v2v | libvirt/tests/src/virsh_cmd/domain/virsh_vcpupin.py | Python | gpl-2.0 | 9,496 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2016, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | cogmission/nupic.research | htmresearch/frameworks/nlp/classify_document_fingerprint.py | Python | agpl-3.0 | 6,870 |
# Copyright 2019 - Nokia
#
# 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, sof... | openstack/vitrage | vitrage/evaluator/template_functions/v2/__init__.py | Python | apache-2.0 | 1,691 |
"""
anviz_sync.anviz
~~~~~~~~~~~~~~~~
Anviz device abstraction, communication protocol and commands.
crc table & algorithm based on:
https://github.com/benperiton/anviz-protocol
:copyright: (c) 2014 by Augusto Roccasalva
:license: BSD, see LICENSE for more details.
"""
import socket
impo... | coyotevz/anviz-sync | anviz_sync/anviz.py | Python | bsd-3-clause | 11,516 |
import unittest
import textwrap
import antlr3
import antlr3.tree
import testbase
import sys
class T(testbase.ANTLRTest):
def setUp(self):
self.oldPath = sys.path[:]
sys.path.insert(0, self.baseDir)
def tearDown(self):
sys.path = self.oldPath
def parserClass(self, base):
... | ekcs/congress | thirdparty/antlr3-antlr-3.5/runtime/Python/tests/t052import.py | Python | apache-2.0 | 48,133 |
# -*- coding: utf-8 -*-
#
# Copyright © 2008 Ricky Zhou
# Copyright © 2008-2011 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hop... | tyll/fas | fas/controllers.py | Python | gpl-2.0 | 9,306 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'KindleSearchDialog.ui'
#
# Created: Thu Apr 3 16:24:23 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
ex... | Alexsays/Kindle-Sync | KindleSearchDialog.py | Python | gpl-3.0 | 3,422 |
"""A quick and dirty app to schedule content in django templates"""
__version__='0.0.1' | pgcd/scheduled_blocks | scheduled_blocks/__init__.py | Python | bsd-2-clause | 88 |
# pylint: disable=E1103
from pandas.types.common import is_list_like, is_scalar
from pandas import Series, DataFrame
from pandas.core.index import MultiIndex, Index
from pandas.core.groupby import Grouper
from pandas.tools.merge import concat
from pandas.tools.util import cartesian_product
from pandas.compat import r... | andyraib/data-storage | python_scripts/env/lib/python3.6/site-packages/pandas/tools/pivot.py | Python | apache-2.0 | 19,714 |
from a10sdk.common.A10BaseClass import A10BaseClass
class Database(A10BaseClass):
"""Class Description::
DATABASE type.
Class database supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param db_send: {"description": "Spec... | amwelch/a10sdk-python | a10sdk/core/health/health_monitor_method_database.py | Python | apache-2.0 | 3,895 |
# vim:set et ts=4 sw=4:
#
# Copyright (c) 2012 cozybit Inc.
#
import logging
import urllib
from google.appengine.ext import ndb
from google.appengine.api import namespace_manager
from google.appengine.api import users
from google.appengine.api import mail
from model import SongNode
action_messages = {
'vote' : ... | jcard0na/songrank | bandvotes/notifications.py | Python | gpl-2.0 | 1,185 |
import random, time, queue
from multiprocessing.managers import BaseManager
from multiprocessing import freeze_support
task_queue = queue.Queue()
result_queue = queue.Queue()
class QueueManager(BaseManager):
pass
def return_task_queue():
global task_queue
return task_queue
def return... | ianzhengnan/learnpy | task_master.py | Python | apache-2.0 | 1,106 |
# -*- coding: utf-8 -*-
import matplotlib as mpl
mpl.use("pgf")
pgf_with_pdflatex = {
"pgf.texsystem": "pdflatex",
"pgf.preamble": [
r"\usepackage[utf8x]{inputenc}",
r"\usepackage[T1]{fontenc}",
r"\usepackage{cmbright}",
]
}
mpl.rcParams.update(pgf_with_pdflatex)
import mat... | lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/doc/users/plotting/examples/pgf_texsystem.py | Python | mit | 658 |
from django.conf.urls import include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r"^admin/doc/", include("django.contrib.admindocs.urls")),
url(r"^admin/apps/tinymce/", include("tinymce.urls")),
url(r"^admin/", admin.site.urls),
# url(r'^forms/', include('form_design... | edoburu/django-fluent-contents | example/urls.py | Python | apache-2.0 | 481 |
from django.contrib import admin
# Register your models here.
from .models import General,PathsVPN
class PostAdmin(admin.ModelAdmin):
list_display = ['general_vpn_name','general_server_ip', 'general_server_port']
list_filter = ['general_vpn_name','general_server_ip']
search_fields = ['general_vpn_name','g... | Oleh-Hrebchuk/OpenVPN-TryFalse | vpn/admin.py | Python | gpl-3.0 | 450 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | wscullin/spack | lib/spack/spack/operating_systems/cnk.py | Python | lgpl-2.1 | 1,790 |
# Copyright (c) 2014 RainMachine, Green Electronics LLC
# All rights reserved.
# Authors: Nicu Pavel <npavel@mini-box.com>
# Codrin Juravle <codrin.juravle@mini-box.com>
import sqlite3, os
from RMDataFramework.rmParserUserData import *
from RMDataFramework.rmParserParams import RMParserParams_adaptToSQLite,... | sprinkler/rainmachine-developer-resources | sdk-parsers/RMDatabaseFramework/rmDatabase.py | Python | gpl-3.0 | 8,084 |
# Test configuration options for regression tests
config = {
'exe': 'openmc',
'mpi': False,
'mpiexec': 'mpiexec',
'mpi_np': '2',
'update': False,
'build_inputs': False
}
| johnnyliu27/openmc | tests/regression_tests/__init__.py | Python | mit | 194 |
import SSL1
class MyConnection(SSL1.Connection):
"""An SSL connection."""
def __init__(self, dummy):
print('MyConnection init')
if __name__ == '__main__':
myConnection = MyConnection(' ')
input('Press Enter to continue...')
| tlksio/tlksio | env/lib/python3.4/site-packages/logilab/astng/test/data/appl/myConnection.py | Python | mit | 251 |
import argparse
import pystalk
from . import util
def setup_parser(parser=None):
if parser is None:
parser = argparse.ArgumentParser()
parser.add_argument('-H', '--host', default='localhost', help='Host of beanstalk server (default %(default)s)')
parser.add_argument('-p', '--port', default=11300... | EasyPost/beancmd | beancmd/stats_tubes.py | Python | isc | 1,508 |
"""
Copyright (c) 2014-2015 F-Secure
See LICENSE for details
"""
class FrameworkError(Exception):
" Base class for all the errors that are raised by the framework "
class MultipleFound(FrameworkError):
" Raised when user tries to fetch link to one instance and the framework manages to find multiple entries ... | gurunars/resource-api | src/resource_api/errors.py | Python | apache-2.0 | 1,626 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 8.12 from Kane 1985."""
from __future__ import division
from sympy import solve, symbols
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import dot, dynamicsymbols
from util import msprint, subs, partial_velocities, genera... | Shekharrajak/pydy | examples/Kane1985/Chapter4/Ex8.12.py | Python | bsd-3-clause | 2,188 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import background
from flask import abort, redirect, request
from stacosys.db import dao
from stacosys.interface import app
logger = logging.getLogger(__name__)
@app.route("/newcomment", methods=["POST"])
def new_form_comment():
data = request.form
... | kianby/stacosys | stacosys/interface/form.py | Python | gpl-3.0 | 2,413 |
#!/usr/bin/env python
# coding=utf-8
from toughlib import btforms
from toughlib.btforms import rules
from toughlib.btforms.rules import button_style, input_style
opr_status_dict = {0: u'正常', 1: u"停用"}
def operator_add_form():
return btforms.Form(
btforms.Textbox("operator_name", rules.len_of(2, 32), descr... | talkincode/toughwlan | toughwlan/manage/system/operator_form.py | Python | agpl-3.0 | 1,716 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import csv
import os
import traceback
import datetime
from pygments.lexers.csound import newline
def readOneFile(filePath):
datas = []
with open(filePath, errors='ignore') as rf:
reader = csv.reader(rf)
for item in reader:
datas.append(... | tiandizhiguai/test | src/main/java/com/test/python/data_test13.py | Python | apache-2.0 | 3,850 |
"""tester URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | swarmer/tester | tester/urls.py | Python | mit | 763 |
from __future__ import division
import numpy as np
from scipy.stats.kde import gaussian_kde
from scipy.spatial.distance import cdist
from multi_flatten import multi_flatten
class VectorGaussianKernel(object):
def KDE_evaluation(self, distances, bandwidths, dim, num_pts, weights=None):
if weights is None:
... | george-montanez/LICORScabinet | VectorGaussianKernel.py | Python | gpl-2.0 | 1,447 |
#!/usr/bin/python
#
# Copyright (C) 2010 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of... | apyrgio/ganeti | test/py/ganeti.impexpd_unittest.py | Python | bsd-2-clause | 9,771 |
from galaxy.web import security
test_helper_1 = security.SecurityHelper( id_secret="sec1" )
test_helper_2 = security.SecurityHelper( id_secret="sec2" )
def test_encode_decode():
# Different ids are encoded differently
assert test_helper_1.encode_id( 1 ) != test_helper_1.encode_id( 2 )
# But decoding and... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/test/unit/test_security_helper.py | Python | gpl-3.0 | 2,917 |
#!/usr/bin/env python2
# Copyright (C) 2013-:
# Gabes Jean, naparuba@gmail.com
# Pasche Sebastien, sebastien.pasche@leshop.ch
#
# 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 withou... | naparuba/check-linux-by-ssh | check_disks_by_ssh.py | Python | mit | 7,141 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#################################################
### Extracted from platform version: 4.2.2
#################################################
AOSP_PERMISSIONS = {
'android.permission.REMOTE_AUDIO_PLAYBACK': {
'permissionGroup': 'android.permission-group.SYSTEM_TOO... | xtiankisutsa/MARA_Framework | tools/androguard/androguard/core/api_specific_resources/aosp_permissions/aosp_permissions_api17.py | Python | lgpl-3.0 | 81,994 |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
import specs.fizz as fizz
import specs.fmt as fmt
import specs.folly as folly
import specs.gmock as gmock
import specs.mvfst as mvfst
import specs.sodium as sodium
import specs.wangle as wangle
import specs.zstd as zstd
def fbcode_builder_spec(... | facebook/folly | build/fbcode_builder/specs/proxygen.py | Python | apache-2.0 | 890 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | sebgoa/client-python | kubernetes/test/test_v1beta1_ingress_status.py | Python | apache-2.0 | 899 |
from __future__ import unicode_literals
import re
from tempfile import NamedTemporaryFile
from django.contrib.gis import gdal
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import (
no_oracle, oracle, postgis, spatialite,
)
from django.core.management import call_command
from dja... | devops2014/djangosite | django/contrib/gis/tests/geoapp/tests.py | Python | bsd-3-clause | 41,661 |
# coding=utf-8
#
# Copyright 2011-2015 Splunk, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"): you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | jruaux/mongodb-monitoring | src/splunklib/searchcommands/eventing_command.py | Python | apache-2.0 | 5,116 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | ywcui1990/nupic | examples/opf/experiments/multistep/simple_3/description.py | Python | agpl-3.0 | 1,647 |
"""
Copyright 2016, 2017 UFPE - Universidade Federal de Pernambuco
Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como publicada pela ... | amadeusproject/amadeuslms | amadeus/templatetags/util_tags.py | Python | gpl-2.0 | 1,025 |
#!/usr/bin/python
# This Python file uses the following encoding: utf-8
import os
import sys
import getpass
import urllib
import requests
import html2text
from optparse import OptionParser
from Etherpad import Etherpad
sys.dont_write_bytecode = True
class Wcat:
def __init__(self, auth=None):
if auth is None an... | lampholder/wcat | wcat/Wcat.py | Python | gpl-2.0 | 2,935 |
from django.conf.urls import url
from flashcards.views import main, new_quiz
urlpatterns = [
url(r'^$', main),
url(r'^api/new_quiz$', new_quiz),
]
| domino14/Webolith | djAerolith/flashcards/urls.py | Python | gpl-3.0 | 157 |
import bpy
import mathutils
import math
import os
import json
import urllib.parse
from .MaterialBuilder import MaterialBuilder
from .JSONLoader import JSONLoader
class ConfigurationLoader:
# --------------------------------------------------------------------------
# Constructor
# ------------------------... | feureau/Small-Scripts | Blender/Blender config/2.91/scripts/addons/mecabricks advanced/loaders/parts/ConfigurationLoader.py | Python | gpl-3.0 | 5,730 |
import pytest
@pytest.fixture
def order():
return []
@pytest.fixture
def a(order):
order.append("a")
@pytest.fixture
def b(a, order):
order.append("b")
@pytest.fixture(autouse=True)
def c(b, order):
order.append("c")
@pytest.fixture
def d(b, order):
order.append("d")
@pytest.fixture
def ... | nicoddemus/pytest | doc/en/example/fixtures/test_fixtures_order_autouse.py | Python | mit | 562 |
# Copyright (c) 2015 by Ladislav Lhotka, CZ.NIC <lhotka@nic.cz>
#
# Pyang plugin generating a driver file for JSON->XML translation.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permissio... | mbj4668/pyang | pyang/plugins/jtox.py | Python | isc | 4,332 |
import asyncio
import logging
from aiodns import DNSResolver
from aiodns.error import DNSError
from nyuki.discovery import DiscoveryService
log = logging.getLogger(__name__)
class DnsDiscovery(DiscoveryService):
SCHEME = 'dns'
CONF_SCHEMA = {
"type": "object",
"properties": {
"... | gdraynz/nyuki | nyuki/discovery/dns.py | Python | apache-2.0 | 2,434 |
arr = ["hello", "my", "world"]
for i in arr:
print(i)
| boynedmaster/rbx.py | demos/for_loop.py | Python | gpl-3.0 | 59 |
#!/usr/bin/python
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for report stages."""
from __future__ import print_function
import os
import sys
sys.path.insert(0, os.path.abspath(... | mxOBS/deb-pkg_trusty_chromium-browser | third_party/chromite/cbuildbot/stages/report_stages_unittest.py | Python | bsd-3-clause | 9,685 |
import geneticlua
import unittest
class Tests(unittest.TestCase):
def test_getset_timeout(self):
geneticlua.set_timeout(99)
timeout = geneticlua.get_timeout()
self.assertEqual(timeout, 99)
def test_compile_success(self):
result = geneticlua.compile('x = 5')
self.assert... | grking/geneticpy | tests/geneticlua_test.py | Python | gpl-3.0 | 1,296 |
'''tzinfo timezone information for Pacific/Niue.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Niue(DstTzInfo):
'''Pacific/Niue timezone definition. See datetime.tzinfo for details'''
zone = 'Pacific/Niue'
_utc_tra... | newvem/pytz | pytz/zoneinfo/Pacific/Niue.py | Python | mit | 516 |
_base_ = '../mask_rcnn/mask_rcnn_r50_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
fp16 = dict(loss_scale=512.)
| open-mmlab/mmdetection | configs/dcn/mask_rcnn_r50_fpn_fp16_dconv_c3-c5_1x_coco.py | Python | apache-2.0 | 240 |
def string_splosion(str):
"""Given a non-empty string like "Code" return a string like "CCoCodCode"."""
result=""
for i in range(len(str)):
result = result + str[:i+1]
return result | m-debnath/bat-python | warmup-2/string_splosion.py | Python | gpl-3.0 | 205 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.