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 |
|---|---|---|---|---|---|---|
# __init__.py is a special Python file that allows a directory to become
# a Python package so it can be accessed using the 'import' statement.
| xke/nash | app/__init__.py | Python | bsd-2-clause | 145 | 0.006897 |
"""Shared pytest fixtures and test data."""
import copy
import uuid
import pytest
from django.contrib.auth import get_user_model
from onfido.models import Applicant, Check, Event, Report
APPLICANT_ID = str(uuid.uuid4())
CHECK_ID = str(uuid.uuid4())
IDENTITY_REPORT_ID = str(uuid.uuid4())
DOCUMENT_REPORT_ID = str(uuid... | yunojuno/django-onfido | tests/conftest.py | Python | mit | 8,575 | 0.0007 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2016/11/23 16:15
# @Author : xycfree
# @Link : http://example.org
# @Version : $
import os | xycfree/py_spider | baidu/__init__.py | Python | gpl-3.0 | 154 | 0.006494 |
from base import report_content_to_test_docs
_TEST_ALLERGIES_INVALID = [
# an allergy with the wrong schema, should trigger a validation error
"""
<Models xmlns='http://indivo.org/vocab/xml/documents#'>
<Model name="Allergy">
<Field name="allergic_reaction_title">Anaphylaxis</Field>
<Field name="alle... | sayan801/indivo_server | indivo/tests/data/reports/allergy.py | Python | gpl-3.0 | 2,324 | 0.003442 |
from typing import Any
from graphql import graphql_sync
from .star_wars_schema import star_wars_schema
def query_star_wars(source: str) -> Any:
result = graphql_sync(star_wars_schema, source)
assert result.errors is None
return result.data
def describe_star_wars_introspection_tests():
def describe... | graphql-python/graphql-core | tests/test_star_wars_introspection.py | Python | mit | 11,566 | 0.000865 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-10-22 00:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("PartyListV2", "0011_auto_20181021_2203"),
]
operations = [
migrations.RenameField(
... | sigmapi-gammaiota/sigmapi-web | sigmapiweb/apps/PartyListV2/migrations/0012_auto_20181022_0058.py | Python | mit | 444 | 0 |
# -*- coding: utf-8 -*-
'''
Created on 2015/04/17
@author: 2015 AIST
'''
import time
from django.conf import settings
from zbxsend import Metric, send_to_zabbix
import logging
import json
from vt_manager_kvm.communication.geni.v3.configurators.handlerconfigurator import HandlerConfigurator
class ZabbixHelper():
logg... | ict-felix/stack | vt_manager_kvm/src/python/vt_manager_kvm/communication/utils/ZabbixHelper.py | Python | apache-2.0 | 2,427 | 0.030902 |
#-*-coding:utf-8-*-
"""
@package bsemantic.tests.test_generators
@brief tests for bsemantic.generators
@author Sebastian Thiel
@copyright [GNU Lesser General Public License](https://www.gnu.org/licenses/lgpl.html)
"""
from __future__ import unicode_literals
from butility.future import str
__all__ = []
# W0614 unused ... | Byron/bcore | src/python/bsemantic/tests/test_generators.py | Python | lgpl-3.0 | 4,860 | 0.004527 |
BASE_PATH = '/sys/bus/w1/devices/'
TAIL_PATH = "w1_slave"
| banebg/embedded | webdimovanjeitemp/blog/django_thermometer/settings.py | Python | gpl-3.0 | 58 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Ryan'
import ex25
def break_words(stuff):
"""This function will break up words for us."""
words = stuff.split(' ')
return words
def sort_words(words):
"""Sorts the words."""
return sorted(words)
def print_first_word(words):
"""Print... | auspbro/CodeSnippets | Python/LPTHW/ex26.py | Python | gpl-3.0 | 2,393 | 0.004597 |
#!/usr/bin/python -Wall
# ================================================================
# Given a list, returns a list of pairs of elements and repetition counts.
# Example (with commas elided for legibility):
#
# Input: [ 1 1 1 2 2 3 3 3 3 5 5 1 1 ]
# Output: [ [3 1] [2 2] [4 3] [2 5] [2 1] ]
#
# I.e. there i... | johnkerl/sack | uniqc_m.py | Python | bsd-2-clause | 1,891 | 0.002644 |
# (c) 2014, Chris Church <chris@ninemoreminutes.com>
#
# This file is part of Ansible.
#
# Ansible 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 lat... | gentledevil/ansible | lib/ansible/plugins/shell/sh.py | Python | gpl-3.0 | 6,399 | 0.002813 |
import launch
from launch import LaunchDescription
import launch_ros.actions
def generate_launch_description():
return LaunchDescription(
[
launch_ros.actions.Node(
package="rj_robocup",
executable="config_server",
output="screen",
... | RoboJackets/robocup-software | launch/config_server.launch.py | Python | apache-2.0 | 388 | 0 |
#!/usr/bin/env python
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
from datetime import datetime
import ... | befeltingu/UdacityFinalProject4 | conference.py | Python | apache-2.0 | 33,399 | 0.006467 |
from types import NoneType
from ert.cwrap import BaseCClass, CWrapper
from ert.enkf import ENKF_LIB
from ert.util import Matrix
class ObsData(BaseCClass):
def __init__(self):
c_pointer = ObsData.cNamespace().alloc()
super(ObsData, self).__init__(c_pointer)
def __len__(self):
""" @rty... | iLoop2/ResInsight | ThirdParty/Ert/devel/python/python/ert/enkf/obs_data.py | Python | gpl-3.0 | 2,908 | 0.016162 |
from django import forms
from example.models import OneUrlModel, ManyUrlsModel
def test_one_url(db):
class F(forms.ModelForm):
class Meta:
model = OneUrlModel
fields = '__all__'
form = F({'url': 'ya.RU'})
instance = form.save()
assert instance.url == 'http://ya.ru'
... | shantilabs/django-smarturlfield | tests/test_modelfield.py | Python | mit | 1,155 | 0.001732 |
# -*- coding: utf-8 -*-
""" The module provides functions for conversion of a message body/body lines
into classifiers features space.
The body and the message sender string are converted into unicode before
applying features to them.
"""
from talon.signature.constants import SIGNATURE_MAX_LINES
from talon.signature... | saleswise/talon | talon/signature/learning/featurespace.py | Python | apache-2.0 | 2,878 | 0 |
"""
Helper and server modules
"""
| freevo/freevo1 | src/helpers/__init__.py | Python | gpl-2.0 | 34 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016-2018 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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... | unioslo/cerebrum | Cerebrum/rest/api/__init__.py | Python | gpl-2.0 | 2,970 | 0 |
#!/usr/bin/python
# MinerLite - A client side miner controller.
# This will launch cgminer with a few delay seconds and
# retrieve the local data and post it into somewhere!
#
# Author: Yanxiang Wu
# Release Under GPL 3
# Used code from cgminer python API example
import socket
import json
import sys
import subproc... | cecilulysess/MinerLite | main.py | Python | gpl-3.0 | 1,792 | 0.016183 |
import cv2
import numpy as np
import sys
from time import sleep
class Hue:
h = 0
s = 0
v = 0
class HueAverage:
def __init__(self, wname, wwidth, wheight, avgSize):
self.avgSize = avgSize
self.x = self.y = 0
self.at = Hue();
self.avg = Hue();
self.clicked = False... | philkroos/tinkervision | src/test/colormatch/pick_color.py | Python | gpl-2.0 | 2,616 | 0.003058 |
import webapp2
import re
import weakref
from webapp2 import cached_property
from webapp2_extras import sessions
from google.appengine.api import users
from ferris.core.ndb import encode_key, decode_key
from ferris.core.uri import Uri
from ferris.core import inflector, auth, events, views, request_parsers, response_hand... | yowmamasita/social-listener-exam | ferris/core/controller.py | Python | mit | 13,807 | 0.002825 |
import itertools as it
from operator import attrgetter
from flask import Markup, render_template, Blueprint, redirect, url_for, flash, abort, request
from sqlalchemy import desc
from .. import Execution, Stage, Task, TaskStatus
from ..job.JobManager import JobManager
from . import filters
from ..graph.draw import dra... | yassineS/COSMOS-2.0 | cosmos/web/views.py | Python | gpl-3.0 | 8,041 | 0.00398 |
#!/usr/bin/env python
"""Process that loads the datastore"""
__author__ = 'Michael Meisinger, Thomas Lennan'
"""
Possible Features
- load objects into different datastores
- load from a directory of YML files in ion-definitions
- load from a ZIP of YMLs
- load an additional directory (not under GIT control)
- change... | scionrep/scioncc | src/ion/process/bootstrap/datastore_loader.py | Python | bsd-2-clause | 2,396 | 0.004591 |
from ..remote import RemoteModel
from infoblox_netmri.utils.utils import check_api_availability
class IfVlanRemote(RemoteModel):
"""
VLANs that an interface is in along with the STP state of the interface. Also includes SVIs (VlanInterfaceInd = 1) and peer interfaces attached to access ports (VlanExtensionIn... | infobloxopen/infoblox-netmri | infoblox_netmri/api/remote/models/if_vlan_remote.py | Python | apache-2.0 | 4,719 | 0.003179 |
#!bin/evn python
# encoding:utf-8
from __future__ import print_function
import os
import sys
from nude import Nude
# from tests.python.nude import Nude
import time
import cv2
import cv2.cv as cv
from PIL import Image
ROOT = os.path.dirname(os.path.abspath(__file__))
# IMAGE_DIR = "/Users/fengxuting/Downloads/photo/p... | fffy2366/image-processing | nudetest.py | Python | mit | 7,025 | 0.005275 |
from distutils.core import setup
setup(
name = 'nicknester',
version = '1.3.0',
py_modules = ['nester'],
author = 'htýthon',
author_email = 'hfpython@headfirstlabs.com',
url = 'http://www.headfirstlabs.com',
description = 'A simple printer of nes... | leobarros/use_cabeca_python | nester/setup.py | Python | apache-2.0 | 341 | 0.061765 |
"""a readline console module (unix only).
maxime.tournier@brain.riken.jp
the module starts a subprocess for the readline console and
communicates through pipes (prompt/cmd).
the console is polled through a timer, which depends on PySide.
"""
from select import select
import os
import sys
import signal
if __name_... | FabienPean/sofa | applications/plugins/SofaPython/python/SofaPython/console.py | Python | lgpl-2.1 | 5,349 | 0.014208 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | ptopk_patch_selection/ntsnet.py | Python | apache-2.0 | 20,236 | 0.008747 |
import urllib
import ast
import xchat
__module_name__ = "Define"
__module_author__ = "TingPing"
__module_version__ = "2"
__module_description__ = "Show word definitions"
# based on google dictionary script by Sridarshan Shetty - http://sridarshan.co.cc
def define(word, word_eol, userdata):
if len(word) >= 2:
_wor... | TingPing/plugins | XChat/define.py | Python | mit | 1,320 | 0.039394 |
# Copyright 2013 Nicira, 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 a... | luzheqi1987/nova-annotation | nova/network/security_group/neutron_driver.py | Python | apache-2.0 | 23,777 | 0 |
import RPi.GPIO as gpio
from datetime import datetime
import time
import controller
gpio.setmode(gpio.BOARD)
# switch_pins = [10, 40, 38]
switch = 10
gpio.setup(switch, gpio.OUT, initial=False)
# gpio.setup(switch_pins, gpio.OUT, initial=False)
def switch_on():
gpio.output(switch, True)
print "Oven switched ON a... | emgreen33/easy_bake | oven.py | Python | mit | 583 | 0.013722 |
#!/usr/bin/env python
# This file is autogenerated by Autocmake
# Copyright (c) 2015 by Radovan Bast and Jonas Juselius
# See https://github.com/scisoft/autocmake/
import os
import sys
sys.path.append('cmake/lib')
from config import configure
import docopt
options = """
Usage:
./setup.py [options] [<builddir>]
... | robertodr/kleisli | setup.py | Python | lgpl-2.1 | 2,121 | 0.002357 |
import copy
import math
from pymio.material.material_list import MaterialList
from pymio.material.phong_material import PhongMaterial
from pymio.material.textured_phong_material import TexturedPhongMaterial
from pymio.material.by_polygon_material_mapping import ByPolygonMaterialMapping
from pymio.geometry.ind... | esetomo/mio | script/pymio/mmd/pmd/pmd_model.py | Python | gpl-3.0 | 28,845 | 0.009256 |
#!/usr/bin/env python2.7
# Copyright 2015, 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this lis... | y-zeng/grpc | tools/run_tests/run_tests.py | Python | bsd-3-clause | 49,895 | 0.009941 |
"""A configuration management class built on top of etcd
See: http://python-etcd.readthedocs.org/
It provides a read-only access and just exposes a nested dict
"""
import functools
import time
import etcd3
from conman.conman_base import ConManBase
def thrice(delay=0.5):
"""This decorator tries failed operation... | the-gigi/conman | conman/conman_etcd.py | Python | mit | 3,240 | 0 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | dayatz/taiga-back | taiga/projects/userstories/api.py | Python | agpl-3.0 | 18,791 | 0.002289 |
import random
from string import digits, ascii_letters, punctuation
def password_generator(length):
while True:
values = list(digits + ascii_letters + punctuation)
yield ''.join([random.choice(values) for i in range(length)])
| id2669099/turbo-waffle | task_07_02.py | Python | mit | 249 | 0 |
# coding=utf8
# Copyright © 2015-2017 Cask Data, 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 a... | cdapio/cdap-ambari-service | src/main/resources/common-services/CDAP/6.0.0/package/scripts/master.py | Python | apache-2.0 | 4,572 | 0.00175 |
from bs4 import BeautifulSoup as Soup
import json
import re
import requests
from common import *
from nltk.corpus import words
entries = []
WEBSITE = 'http://www.mechon-mamre.org/jewfaq/glossary.htm'
SITE_TITLE = "Mechon Mamre"
source_object = {"site":WEBSITE, "title":SITE_TITLE}
def main():
parseMechonMamre()
... | JudaismBot/JudaismBot | scrapers/mechonMamre.py | Python | mit | 2,147 | 0.014905 |
import contextlib
import re
import socket
import urllib
import uuid
from django.conf import settings
from django.contrib.auth.middleware import AuthenticationMiddleware
from django.contrib.auth.models import AnonymousUser
from django.contrib.sessions.middleware import SessionMiddleware
from django.db import transactio... | atiqueahmedziad/addons-server | src/olympia/amo/middleware.py | Python | bsd-3-clause | 12,302 | 0 |
from django.contrib.admin import SimpleListFilter
from django.contrib.contenttypes.models import ContentType
from django.db.models import Value
from django.db.models.functions import Concat
from auditlog.registry import auditlog
class ResourceTypeFilter(SimpleListFilter):
title = 'Resource Type'
parameter_na... | kbussell/django-auditlog | src/auditlog/filters.py | Python | mit | 1,023 | 0.000978 |
from wptserve.utils import isomorphic_decode, isomorphic_encode
def handle_headers(frame, request, response):
status = 302
if b'redirect_status' in request.GET:
status = int(request.GET[b'redirect_status'])
response.status = status
if b'location' in request.GET:
url = isomorphic_decode(r... | scheib/chromium | third_party/blink/web_tests/external/wpt/fetch/api/resources/redirect.h2.py | Python | bsd-3-clause | 505 | 0.005941 |
import config_constants as configCONST
from shotgun_api3 import Shotgun
base_url = configCONST.SHOTGUN_URL
script_name = configCONST.SHOTGUN_TOOLKIT_NAME
api_key = configCONST.SHOTGUN_TOOLKIT_API_KEY
SHOTGUN_SERVER = Shotgun(base_url=base_url,
script_name=script_name,
... | jamesbdunlop/defaultShotgunLibrary | server/tk_sgsrv.py | Python | apache-2.0 | 420 | 0.002381 |
from django.db import migrations, models
VLAN_STATUS_CHOICES = (
(1, 'active'),
(2, 'reserved'),
(3, 'deprecated'),
)
def vlan_status_to_slug(apps, schema_editor):
VLAN = apps.get_model('ipam', 'VLAN')
for id, slug in VLAN_STATUS_CHOICES:
VLAN.objects.filter(status=str(id)).update(status... | digitalocean/netbox | netbox/ipam/migrations/0030_3569_vlan_fields.py | Python | apache-2.0 | 760 | 0 |
from django.conf.urls import patterns, include, url
from django.views.generic.base import RedirectView
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'core.views.home', name='home'),
url(r'^morsel/create/$', 'core... | tsaylor/remember-forever | remember_forever/urls.py | Python | mit | 1,038 | 0.003854 |
from hubsan import *
import logging
import math
logging.basicConfig(level = logging.INFO)
hubsan = Hubsan()
hubsan.init()
hubsan.bind()
hubsan.safety()
print "bind complete"
session_id = hubsan.session_id
channel = hubsan.channel
print "channel: %d" % channel
print "session_id: %s" % format_packet(session_id)
pri... | chpatrick/hubsan | test.py | Python | gpl-3.0 | 530 | 0.013208 |
# Natural Language Toolkit: Word Finder
#
# Copyright (C) 2001-2012 NLTK Project
# Author: Steven Bird <sb@csse.unimelb.edu.au>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
# Simplified from PHP version by Robert Klein <brathna@gmail.com>
# http://fswordfinder.sourceforge.net/
from __futur... | abad623/verbalucce | verbalucce/nltk/misc/wordfinder.py | Python | apache-2.0 | 4,113 | 0.013372 |
# encoding: utf-8
#
#
# 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/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
# THIS THREADING MODULE IS PERMEATED BY THE p... | klahnakoski/ActiveData | vendor/mo_threads/queues.py | Python | mpl-2.0 | 18,763 | 0.001705 |
# Authors:
# Pavel Zuna <pzuna@redhat.com>
#
# Copyright (C) 2009 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 versio... | hatchetation/freeipa | ipalib/plugins/baseldap.py | Python | gpl-3.0 | 76,643 | 0.002623 |
import unittest
import string
from pprint import pprint
import XGram, XGram.Parser, XGram.Exceptions
from XGram.Generator.Prebuilt import Codons
from XGram.Model import Annotation
import Bio.Data.CodonTable
class GeneratorCodonsTest(unittest.TestCase):
"""
A test class for testing a grammar
"""
def s... | ihh/dart | python/XGram/Tests/GeneratorCodonsTest.py | Python | gpl-2.0 | 6,123 | 0.019108 |
# Copyright 2014 Diamond Light Source Ltd.
#
# 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... | mjn19172/Savu | savu/test/test_utils.py | Python | apache-2.0 | 4,791 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from qcspgen_exception import QCSPGenException
import functools
def _verify_type(func):
"""
decorator to verify item type supplied for the wrapped function
:param func: decorated function
:return: wrapper
"""
@functools.wraps(func)
def wrapper(s... | CHEN-JIANGHANG/qcspgen | qcspgen/aggregator.py | Python | mit | 2,819 | 0.001064 |
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use("TkAgg") # important to call this right after
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib import style
i... | Auquan/auquan-toolbox-python | auquanToolbox/resultviewer.py | Python | mit | 13,093 | 0.003208 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Serendi documentation build configuration file, created by
# sphinx-quickstart on Sun Jun 14 10:26:42 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... | serendi-app/serendi-server | docs/conf.py | Python | agpl-3.0 | 9,191 | 0.006093 |
# -*- 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 GNU... | highco-groupe/odoo | addons/share/wizard/share_wizard.py | Python | agpl-3.0 | 50,906 | 0.006149 |
from jgsnippets.elasticsearch.crud import Crud | jgontrum/jgsnippets | jgsnippets/elasticsearch/__init__.py | Python | mit | 46 | 0.021739 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Queue:
def __init__(self):
self.queue = []
def enqueue(self, item):
self.queue.append(item)
def dequeue(self, item):
return self.queue.pop(0) | goldsborough/algs4 | stacks-queues/python/queue.py | Python | mit | 205 | 0.034146 |
# coding: utf-8
from __future__ import unicode_literals
import os.path
from datetime import timedelta
from django import forms
from django.conf import settings
from django.contrib.auth import get_user_model
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from djangobb_foru... | aldenjenkins/foobargamingwebsite | djangobb_forum/forms.py | Python | bsd-3-clause | 22,552 | 0.004257 |
from a10sdk.common.A10BaseClass import A10BaseClass
class Alg(A10BaseClass):
"""Class Description::
Change NAT ALG Settings.
Class alg supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param DeviceProxy: The device proxy ... | amwelch/a10sdk-python | a10sdk/core/ip/ip_nat_alg.py | Python | apache-2.0 | 802 | 0.011222 |
"""Account service tests."""
from unittest import TestCase
from . import PyiCloudServiceMock
from .const import AUTHENTICATED_USER, VALID_PASSWORD
class AccountServiceTest(TestCase):
"""Account service tests."""
service = None
def setUp(self):
"""Set up tests."""
self.service = PyiCloud... | picklepete/pyicloud | tests/test_account.py | Python | mit | 4,486 | 0.002006 |
import os
import numpy as np
from matplotlib import pyplot as plt
from numpy import genfromtxt
from matplotlib import cm
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
def axisEqual3D(ax):
extents = np.array([getattr(ax, 'get_{}lim'.format... | agarciamontoro/TFG | Software/Stuff/test_ray.py | Python | gpl-2.0 | 3,739 | 0.000802 |
from cStringIO import StringIO
from struct import pack, unpack, error as StructError
from .log import log
from .structures import fields
class DBFile(object):
"""
Base class for WDB and DBC files
"""
@classmethod
def open(cls, file, build, structure, environment):
if isinstance(file, basestring):
file = op... | jleclanche/pywow | wdbc/main.py | Python | cc0-1.0 | 10,011 | 0.032864 |
#!/usr/bin/env python
#coding: iso-8859-15
#
# Copyright (C) 2015
# ASTRON (Netherlands Institute for Radio Astronomy)
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This file is part of the LOFAR software suite.
# The LOFAR software suite is free software: you can redistribute it and/or
# modify it under the term... | jjdmol/LOFAR | SAS/OTDB_Services/getParset.py | Python | gpl-3.0 | 2,018 | 0.002973 |
#
# Copyright 2015 Quantopian, 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 wr... | magne-max/zipline-ja | tests/data/test_us_equity_pricing.py | Python | apache-2.0 | 12,525 | 0 |
import unittest, random, sys, time
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_browse as h2b, h2o_exec as h2e, h2o_import as h2i
initList = [
('crunk', "crunk=function(x){x+98};"),
('r.hex', 'r.hex=i.hex'),
]
# maybe can't have unused functions
phrases = [
"crunk=function(x){x+98};",
# "c... | rowhit/h2o-2 | py/testdir_single_jvm/notest_exec2_poppush2_fail.py | Python | apache-2.0 | 2,065 | 0.008717 |
# -*- coding: utf-8 -*-
__author__ = 'josip@lazic.info'
from django.core.management.base import BaseCommand, CommandError
from sms.models import Message, StatusLog
from datetime import datetime, timedelta
from django.core.mail import mail_admins
from django.conf import settings
from sms.tasks import queue_message
cl... | jlazic/GlogSMS | sms/management/commands/check_failed_messages.py | Python | mit | 1,774 | 0.003946 |
"""
.. module:: pipeline
:platform: Unix, OSX
:synopsis: A wrapper module for executing commands and logging their output.
.. moduleauthor:: Daniel Gaston <daniel.gaston@dal.ca>
"""
import sys
import subprocess as sub
def run_and_log_command(command, logfile):
"""This function uses the python subprocess... | dgaston/ddbio-ngsflow | ddb_ngsflow/pipeline.py | Python | mit | 1,788 | 0.002237 |
# A script to migrate old keen analytics to a new collection, generate in-between points for choppy
# data, or a little of both
import os
import csv
import copy
import pytz
import logging
import argparse
import datetime
from dateutil.parser import parse
from keen.client import KeenClient
from website.settings import ... | pattisdr/osf.io | scripts/analytics/migrate_analytics.py | Python | apache-2.0 | 20,106 | 0.004377 |
from sklearn import svm
from sklearn.multiclass import OneVsRestClassifier, OneVsOneClassifier
import pickle
import sys
import numpy as np
def load_data(path):
data = pickle.load(open(path, 'rb'))
keys = sorted(list(data.keys()))
X = []
y = []
for k in keys:
for x in data[k]:
X... | hrantzsch/signature-verification | tools/svm.py | Python | gpl-3.0 | 1,068 | 0.000936 |
# -*- 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 GNU... | gvb/odoo | addons/sale/sale.py | Python | agpl-3.0 | 71,046 | 0.005588 |
import sys
import os
import re
if sys.version_info[0] < 3:
from io import open
host = 'https://api.clarify.io'
def load_body(filename):
text = None
with open(os.path.join('.', 'tests', 'data', filename), encoding="utf-8") as f:
text = f.read()
return text if text else '{}'
def register_ur... | Clarify/clarify_python | tests/__init__.py | Python | mit | 2,307 | 0.008236 |
#!/usr/bin/env python
from queue import Queue
import threading
class DuplicateDataItemError(Exception):
"""
Class raised when adding the same item in the Data object.
"""
def __init__(self, message):
self.message = message
class Data(object):
"""
Class to define user dataset colle... | ganga-devs/ganga | ganga/GangaCore/Core/GangaThread/MTRunner/Data.py | Python | gpl-3.0 | 1,817 | 0.001101 |
import openmc
import openmc.capi
from openmc.stats import Box
from openmc.material import Materials
import pytest
from tests.testing_harness import PyAPITestHarness
pytestmark = pytest.mark.skipif(
not openmc.capi._dagmc_enabled(),
reason="DAGMC CAD geometry is not enabled.")
class UWUWTest(PyAPITestHarness)... | wbinventor/openmc | tests/regression_tests/uwuw/test.py | Python | mit | 1,025 | 0.002927 |
# Copyright 2014 Rackspace, 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 writin... | ramineni/myironic | ironic/tests/drivers/test_agent_client.py | Python | apache-2.0 | 4,574 | 0.001312 |
import redis
import logging
import simplejson as json
import sys
from msgpack import Unpacker
from flask import Flask, request, render_template
from daemon import runner
from os.path import dirname, abspath
# add the shared settings file to namespace
sys.path.insert(0, dirname(dirname(abspath(__file__))))
import setti... | MyNameIsMeerkat/skyline | src/webapp/webapp.py | Python | mit | 2,673 | 0.001871 |
"""
Wrappers to make file-like objects cooperative.
.. class:: FileObject
The main entry point to the file-like gevent-compatible behaviour. It will be defined
to be the best available implementation.
There are two main implementations of ``FileObject``. On all systems,
there is :class:`FileObjectThread` which... | burzillibus/RobHome | venv/lib/python2.7/site-packages/gevent/fileobject.py | Python | mit | 7,896 | 0.003293 |
'''
This module is to create model of Course
'''
from openerp import api, fields, models, _
class Course(models.Model):
'''
This class create model of Course
'''
_name = 'openacademy.course' # Model odoo name
name = fields.Char(string='Title', required=True) # Field reserved
description =... | glizek/openacademy-project | openacademy/model/openacademy_course.py | Python | apache-2.0 | 1,587 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2017 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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, eith... | lem9/weblate | weblate/trans/data.py | Python | gpl-3.0 | 1,577 | 0 |
##
# Copyright 2009-2020 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | pescobar/easybuild-easyblocks | easybuild/easyblocks/generic/conda.py | Python | gpl-2.0 | 4,661 | 0.003218 |
# Copyright (C) 2020 OpenMotics BV
#
# 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 Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribu... | openmotics/gateway | testing/unittests/api_tests/serializers/sensor_test.py | Python | agpl-3.0 | 4,097 | 0.000488 |
import sys,os
## basic files
#sys.path.append(os.path.realpath(__file__))
#print(os.path.realpath(__file__))
#print(os.path.pardir(os.path.realpath(__file__)))
#print(os.path.split(os.path.abspath(__file__))[:-1])
from .version import __version__
from .basedir import __basedir__
## database functions and classes
fro... | ajrichards/htsint | htsint/__init__.py | Python | bsd-3-clause | 693 | 0.012987 |
#!/usr/bin/python
#
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.com>
#
# This file is part of Ansible
#
# Ansible 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 Soft... | bjolivot/ansible | lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py | Python | gpl-3.0 | 60,368 | 0.004092 |
# Copyright (c) 2010, Ryan Bourgeois <bluedragonx@gmail.com>
# All rights reserved.
#
# This software is licensed under a modified BSD license as defined in the
# provided license file at the root of this project. You may modify and/or
# distribute in accordance with those terms.
#
# This software is provided "as is" ... | BlueDragonX/whatcouch | whatcouch/test/testplugins/testauthenticatorplugin.py | Python | bsd-3-clause | 1,977 | 0.002023 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Sfcgal(CMakePackage):
"""
SFCGAL is a C++ wrapper library around CGAL with the aim of ... | iulian787/spack | var/spack/repos/builtin/packages/sfcgal/package.py | Python | lgpl-2.1 | 1,183 | 0.001691 |
# coding=utf-8
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from django.core import mail
class IndexViewTestCase(TestCase):
def setUp(self):
self.client = Client()
self.url = reverse('index')
def tearDown(self):
pass
def test_status_code... | marcionreis/djangoecommerce | core/tests/test_views.py | Python | cc0-1.0 | 1,619 | 0.00248 |
# -*- coding: utf-8 -*-
from datetime import timedelta
from unittest import mock
from uuid import UUID
from django.test import TestCase
from sesam import SesamStudent, StudentNotFound
from .. import factories
from ..models import Student
def sesam_response_factory(student):
# Factory function useful together wi... | karservice/kobra | kobra/tests/test_sesam.py | Python | mit | 4,475 | 0.000447 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import ast
import co... | jessrosenfield/pants | src/python/pants/backend/python/tasks/checkstyle/common.py | Python | apache-2.0 | 9,330 | 0.010289 |
import django
from django.http import Http404
from django.views.generic import DetailView
from repanier.const import DECIMAL_ZERO
from repanier.models.bankaccount import BankAccount
from repanier.models.invoice import ProducerInvoice
from repanier.models.offeritem import OfferItemReadOnly
from repanier.models.producer... | pcolmant/repanier | repanier/views/producer_invoice_class.py | Python | gpl-3.0 | 4,583 | 0.000873 |
# coding=utf-8
# Copyright 2022 The Trax 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 a... | google/trax | trax/tf_numpy/examples/mnist/train_test.py | Python | apache-2.0 | 1,761 | 0.004543 |
names = {
1: 'Read Error Rate',
2: 'Throughput Performance',
3: 'Spin-Up Time',
4: 'Start/Stop Count',
5: 'Reallocated Sectors Count',
6: 'Read Channel Margin',
7: 'Seek Error Rate',
8: 'Seek Time Performance',
9: 'Power-On Hours',
10: 'Spin Retry Count',
11: 'Recalibration R... | rain87/pc-health | smart_attributes.py | Python | mit | 3,144 | 0.000636 |
from __future__ import absolute_import
import six
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://etetoolkit.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of th... | Unode/ete | ete3/tools/ete_build_lib/ordereddict.py | Python | gpl-3.0 | 10,439 | 0.001437 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-11 08:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('multiexplorer', '0006_pullhistory'),
]
operations = [
... | priestc/MultiExplorer | multiexplorer/multiexplorer/migrations/0007_auto_20170211_0802.py | Python | mit | 967 | 0.002068 |
# Copyright (C) 2017 The YaCo Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is ... | DGA-MI-SSI/YaCo | tests/tests/test_enums.py | Python | gpl-3.0 | 9,673 | 0.001654 |
from django.db import models
from django.core.urlresolvers import reverse
class Software(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
def get_absolute_url(self):
return reverse('software_edit', kwargs={'pk': self.pk})
| htlcnn/pyrevitscripts | HTL.tab/Test.panel/Test.pushbutton/keyman/keyman/keys/models.py | Python | mit | 300 | 0.006667 |
import unittest
from card_validation import (
numberToMatrix,
getOddDigits,
getEvenDigits,
sumOfDoubleOddPlace,
sumOfEvenPlace,
getDigit,
isValid
)
class CardValidationTest(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(CardValidationTest, self).__init__(*args, ... | dennyb87/pycity | week5/card_validation_test.py | Python | gpl-3.0 | 1,101 | 0.002725 |
from __future__ import unicode_literals
from django.contrib.gis.db.models import F, Collect, Count, Extent, Union
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.geos import GEOSGeometry, MultiPoint, Point
from django.db import connection
from django.test import TestCase, skipUnlessDBF... | WillGuan105/django | tests/gis_tests/relatedapp/tests.py | Python | bsd-3-clause | 15,582 | 0.002246 |
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
... | fnp/wolnelektury | src/infopages/migrations/0001_initial.py | Python | agpl-3.0 | 4,109 | 0.008033 |
# -*- coding: utf-8 -*-
from module.plugins.internal.XFSAccount import XFSAccount
class OpenloadCo(XFSAccount):
__name__ = "OpenloadCo"
__type__ = "account"
__version__ = "0.02"
__status__ = "testing"
__description__ = """Openload.co account plugin"""
__license__ = "GPLv3"
__a... | Guidobelix/pyload | module/plugins/accounts/OpenloadCo.py | Python | gpl-3.0 | 413 | 0.014528 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2021 GEM Foundation
#
# OpenQuake 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, o... | gem/oq-engine | openquake/hazardlib/gsim/morikawa_fujiwara_2013.py | Python | agpl-3.0 | 14,534 | 0.003509 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.