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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
jinja2.tests
~~~~~~~~~~~~
Jinja test functions. Used with the "is" operator.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
from jinja2.runtime import Undefined
# nose, nothing here to test
__test__ = False
number_r... | geary/claslite | web/app/lib/dist/jinja2/tests.py | Python | unlicense | 3,313 |
"""
gstation-edit RackUnit definition
"""
# this file is part of gstation-edit
# Copyright (C) F LAIGNEL 2009-2017 <fengalin@free.fr>
#
# gstation-edit 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 v... | fengalin/gstation-edit | gstation_edit/rack/rack_unit.py | Python | lgpl-3.0 | 2,056 |
# Copyright 2013: Mirantis 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 b... | gluke77/rally | tests/unit/test_osclients.py | Python | apache-2.0 | 39,444 |
"""This platform allows several media players to be grouped into one media player."""
from __future__ import annotations
from typing import Any
import voluptuous as vol
from homeassistant.components.media_player import (
ATTR_MEDIA_CONTENT_ID,
ATTR_MEDIA_CONTENT_TYPE,
ATTR_MEDIA_SEEK_POSITION,
ATTR_M... | rohitranjan1991/home-assistant | homeassistant/components/group/media_player.py | Python | mit | 13,911 |
#!/usr/bin/python
# IMPORTS
import time
import datetime
from time import sleep
import Queue
import traceback
import sys
import os
import json
from threading import Thread, RLock, Lock, current_thread
from optparse import OptionParser
import requests
from requests.exceptions import *
import MySQLdb
import random
impor... | sgtnasty/python | destiny/drop.py | Python | gpl-3.0 | 18,659 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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
#... | rahushen/ansible | lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py | Python | gpl-3.0 | 26,568 |
#!/usr/bin/env python
#
#===- run-clang-tidy.py - Parallel clang-tidy runner ---------*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===---------... | yuanming-hu/taichi | scripts/run_clang_tidy.py | Python | mit | 12,923 |
__author__ = ["Nurendra Choudhary <nurendrachoudhary31@gmail.com>", "Anoop Kunchukuttan <anoop.kunchukuttan@gmail.com>"]
__license__ = "GPLv3"
""" Transliterate texts between unicode and standard transliteration schemes.
Transliterate texts between non-latin scripts and commonly-used latin
transliteration schemes. Use... | LBenzahia/cltk | cltk/corpus/sanskrit/itrans/itrans_transliterator.py | Python | mit | 31,726 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage PaloAltoNetworks Firewall
# (c) 2016, techbizdev <techbizdev@paloaltonetworks.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 publish... | thaim/ansible | lib/ansible/modules/network/panos/_panos_cert_gen_ssh.py | Python | mit | 6,369 |
# Copyright 2021 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, ... | google-research/vmoe | vmoe/partitioning_test.py | Python | apache-2.0 | 17,039 |
import os
from os.path import join
import numpy
from numpy.distutils.misc_util import Configuration
from sklearn._build_utils import get_blas_info
def configuration(parent_package="", top_path=None):
config = Configuration("manifold", parent_package, top_path)
libraries = []
if os.name == 'posix':
... | YinongLong/scikit-learn | sklearn/manifold/setup.py | Python | bsd-3-clause | 1,279 |
"""Echo reply message tests."""
from pyof.v0x01.symmetric.echo_reply import EchoReply
from tests.unit.test_struct import TestStruct
class TestEchoReply(TestStruct):
"""Echo reply message tests (also those in :class:`.TestDump`)."""
@classmethod
def setUpClass(cls):
"""Configure raw file and its o... | kytos/python-openflow | tests/unit/v0x01/test_symmetric/test_echo_reply.py | Python | mit | 538 |
"""momentsinfo_convroll4_doublescale_fs5"""
import numpy as np
import theano
import theano.tensor as T
import lasagne as nn
import data
import load
import nn_plankton
import dihedral
import tmp_dnn
import tta
batch_size = 128
chunk_size = 32768
num_chunks_train = 240
momentum = 0.9
learning_rate_schedule = {
... | yejingxin/kaggle-ndsb | configurations/featmomentsinfo_pl_blend4_convroll4_doublescale_fs5_nodrop.py | Python | mit | 2,793 |
# -*- 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):
# Deleting field 'Ad.thumb'
db.delete_column(u'ads_ad', 'thumb')
... | mrafieee/django-base | apps/ads/migrations/0002_auto__del_field_ad_thumb__del_field_ad_html.py | Python | gpl-3.0 | 1,571 |
# -*- coding: utf8 -*-
from drawBot import *
from vanilla import *
from mojo.events import addObserver, removeObserver
from mojo.roboFont import OpenWindow
from drawBot.ui.drawView import DrawView
from fontTools.pens.cocoaPen import CocoaPen
from defconAppKit.windows.baseWindow import BaseWindowController
import json
... | BlackFoundry/DesignRecorder | Black DesignRecorder.roboFontExt/lib/DesignRecorder.py | Python | gpl-3.0 | 8,116 |
from api.src.base import Base
from collections import defaultdict
class Mapper(Base):
#Global accumulator
output = defaultdict(int)
def handler(self, contents):
'''
Perform mapping operation over one file with contents
WRITE HERE YOUR OWN LOGIC
:param contents: unparsed ... | iwitaly/big-lambda-serverless | api/mapper.py | Python | mit | 539 |
# coding: utf-8
from django.conf.urls import include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth import views as auth_views
from bootcamp.core import views as core_views
from bootcamp.authentication import views as bootcamp_auth_views
from bootcamp.activit... | JeromeRisselin/PRJ-medtec_sigproc | echopen-leaderboard/bootcamp/hackIDE/urls.py | Python | mit | 2,497 |
# ==========================================================================
# This module performs unit tests for the GammaLib LAT module.
#
# Copyright (C) 2012-2018 Juergen Knoedlseder
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... | gammalib/gammalib | inst/lat/test/test_LAT.py | Python | gpl-3.0 | 5,738 |
# coding: utf-8
from itertools import groupby, combinations
from operator import itemgetter
__author__ = "Michał Ciołczyk"
_CLUSTER_SEPARATOR = '##########\n'
def _read_result(filename):
clusters = {}
with open(filename) as f:
clusters_read = f.read()
for i, section in enumerate(clusters_rea... | salceson/PJN | lab4/utils.py | Python | mit | 1,890 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-01 05:38
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('booker', '0025_event_wedding_options'),
]
operations = [
migrations.RemoveField(
... | luckiestlindy/osproject | booker/migrations/0026_remove_event_expected_guests.py | Python | gpl-3.0 | 403 |
# -*- coding=utf-8 -*-
from .. import db
from datetime import datetime
class EqBill(db.Model):
__tablename__ = 'eq_bill'
__table_args__ = {'extend_existing': True}
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
id_clerk = db.Column(db.Integer, db.ForeignKey('clerk.id'))
... | Pantynopants/DBMS_BANK | app/models/EqBill.py | Python | gpl-3.0 | 791 |
# Copyright 2017 Praxya (http://praxya.com/)
# Daniel Rodriguez Lijo <drl.9319@gmail.com>
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# <contact@eficent.com>
# Copyright 2019 Tecnativa - Carlos Dauden
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0
from... | factorlibre/l10n-spain | l10n_es_vat_book/models/l10n_es_vat_book_line_tax.py | Python | agpl-3.0 | 1,675 |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import bisect
from torch.utils.data.dataset import ConcatDataset as _ConcatDataset
class ConcatDataset(_ConcatDataset):
"""
Same as torch.utils.data.dataset.ConcatDataset, but exposes an extra
method for querying the sizes of the im... | mlperf/training_results_v0.5 | v0.5.0/nvidia/submission/code/object_detection/pytorch/maskrcnn_benchmark/utils/concat_dataset.py | Python | apache-2.0 | 767 |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | thiphariel/navitia | source/jormungandr/tests/traveler_profile_test.py | Python | agpl-3.0 | 3,180 |
# -*- coding: utf-8 -*-
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Stock Account Change Product Valuation",
"summary": "Adjusts valuation of the products and quants when the cost "
"method or type of ... | acsone/stock-logistics-warehouse | stock_account_change_product_valuation/__openerp__.py | Python | agpl-3.0 | 642 |
"""
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... | google/report2bq | auth-appengine/classes/cloud_storage.py | Python | apache-2.0 | 6,643 |
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modi... | darcyliu/storyboard | boto/rds/parametergroup.py | Python | mit | 7,126 |
from __future__ import division
from __future__ import print_function
import abc
import math
import re
import warnings
from builtins import object
from builtins import str
from builtins import zip
import pyproj
from future.utils import with_metaclass
from past.builtins import cmp
"""
Methods for representing geograp... | eelcovv/LatLon | LatLon3/LatLon.py | Python | mit | 30,745 |
import sys
import os
import json
import urllib
import urlparse
import xbmcaddon
import xbmcgui
import xbmcplugin
import load_channels
import hashlib
import re
import time
import server
import config
addon = xbmcaddon.Addon()
addonname = addon.getAddonInfo('name')
addondir = xbmc.translatePath( addon.getAd... | saidias/plugin.video.stalker.net | addon.py | Python | gpl-2.0 | 7,896 |
#!/usr/bin/python3
#
# Copyright (C) 2015-2021 Sustainable Energy Now Inc., Angus King
#
# viewresource.py - This file is part of SIREN.
#
# SIREN 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, ei... | ozsolarwind/siren | viewresource.py | Python | agpl-3.0 | 34,062 |
from sa_util import run_sql
sql = '''
BEGIN;
-- https://wiki.postgresql.org/wiki/Aggregate_Median
CREATE OR REPLACE FUNCTION _final_median(anyarray) RETURNS float8 AS $$
WITH q AS
(
SELECT val
FROM unnest($1) val
WHERE VAL IS NOT NULL
ORDER BY 1
),
cnt AS
(
SELECT COUNT(*) AS c FROM ... | tobes/munge | munge/postgres_functions.py | Python | agpl-3.0 | 2,709 |
from math import sqrt
def is_pentagonal(number):
pent_sum = (sqrt(1 + 24 * number) + 1) / 6
return pent_sum == int(pent_sum);
def P045():
i = 143
while True:
i += 1
hexa_sum = i * (2 * i - 1);
if is_pentagonal(hexa_sum):
return hexa_sum
print P045()
| brendanzhao/ProjectEuler | src/P045.py | Python | mit | 280 |
# Unix SMB/CIFS implementation.
# Copyright (C) Sean Dague <sdague@linux.vnet.ibm.com> 2011
#
# 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 optio... | wimberosa/samba | source4/scripting/python/samba/tests/samba_tool/base.py | Python | gpl-3.0 | 4,527 |
# -*- coding: utf-8 -*-
# Copyright 2008-2014 Jaap Karssenberg <jaap.karssenberg@gmail.com>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your optio... | fabricehong/zim-desktop | zim/__init__.py | Python | gpl-2.0 | 7,256 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
class RenameTool(D... | indictranstech/focal-erpnext | utilities/doctype/rename_tool/rename_tool.py | Python | agpl-3.0 | 1,668 |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2012-2013 IBM Corp.
# 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/li... | raildo/nova | nova/tests/unit/db/test_migrations.py | Python | apache-2.0 | 50,608 |
# -*- coding: utf-8 -*-
import datetime
import hashlib
from scrapy_proj.helpers import *
class SanatatePipelineExtraMeta(object):
def process_item(self, item, spider):
item['institution'] = spider.name
act_type = LegalHelper.get_type_from_title(item['title'])
if act_type == None:
... | mgax/czl-scrape | sanatate/scrapy_proj/pipelines/extrameta.py | Python | mpl-2.0 | 826 |
import asposecellscloud
from asposecellscloud.CellsApi import CellsApi
from asposecellscloud.CellsApi import ApiException
from asposecellscloud.models import WorkbookEncryptionRequest
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
apiKey = "XXXXX" #sepcify App Key
appSid = "XXXXX" #sep... | asposecells/Aspose_Cells_Cloud | Examples/Python/Examples/DecryptExcelWorkbooks.py | Python | mit | 1,649 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distr... | openstack/watcher | watcher/tests/api/v1/test_actions.py | Python | apache-2.0 | 23,438 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-01-24 04:36
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('product', '0006_auto_20170124_0349'),
]
operations ... | skylifewww/pangolin-fog | product/migrations/0007_auto_20170124_0436.py | Python | mit | 728 |
#############################################################################
## ipsec.py --- IPsec support for Scapy ##
## ##
## Copyright (C) 2014 6WIND ##
## ... | phaethon/scapy | kamene/layers/ipsec.py | Python | gpl-2.0 | 37,734 |
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.api.urlfetch import DownloadError
from library import loginelb
class LoadBalancer_Zone_Zuordnen(webapp.RequestHandler):
def post(self):
mobile = self.re... | nagyistoce/koalacloud | elb/LoadBalancer_Zone_Zuordnen.py | Python | apache-2.0 | 1,811 |
#!/usr/bin/env python
import sys
import pymongo
import json
print "import crawled json file into mongodb 'newspapers' database."
if len(sys.argv) < 3:
print "input as [collection] [json_file]"
exit(1)
connection = pymongo.Connection("localhost", 27017)
news_database = connection.newspapers
news_collection = ... | ShiZhan/newspapers | utils/import-to-mongodb.py | Python | bsd-3-clause | 637 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-11 13:26
from __future__ import unicode_literals
import buckets.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies... | Cadasta/cadasta-platform | cadasta/questionnaires/migrations/0001_initial.py | Python | agpl-3.0 | 10,603 |
import dns
from electrum_ltc import dnssec
from . import ElectrumTestCase
class TestDnsSec(ElectrumTestCase):
def test_python_validate_rrsig_ecdsa(self):
rrset = dns.rrset.from_text("getmonero.org.", 3599, 1, 48,
"257 3 13 mdsswUyr3DPW132mOi8V9xESWE8jTo0d xCjjnopKl+G... | vialectrum/vialectrum | electrum_ltc/tests/test_dnssec.py | Python | mit | 3,151 |
#! /usr/bin/python
#Guruprasad Ananda
import sys, os, zipfile, tempfile
QUAL_UPPER_BOUND = 41
QUAL_LOWER_BOUND = 1
def stop_err( msg ):
sys.stderr.write( "%s\n" % msg )
sys.exit()
def unzip( filename ):
zip_file = zipfile.ZipFile( filename, 'r' )
tmpfilename = tempfile.NamedTemporaryFile().name
... | volpino/Yeps-EURAC | tools/solid_tools/solid_qual_stats.py | Python | mit | 4,798 |
# -*- coding: utf-8 -*-
#
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | dhermes/google-cloud-python | dlp/setup.py | Python | apache-2.0 | 2,364 |
# Copyright (C) 2011-2014 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or any later version.
#
# This library is distributed in the h... | joehandzik/libstoragemgmt-1 | python_binding/lsm/_common.py | Python | lgpl-2.1 | 18,313 |
from flask import Blueprint, current_app, jsonify
from lever import (API, LeverException)
from pprint import pformat
from .models import (Block, Share, Transaction, Payout, OneMinuteShare, Status,
Blob)
from . import db
import six
import sys
api = Blueprint('api_bp', __name__)
@api.errorhandl... | raid5/simpledoge | simplecoin/api.py | Python | mit | 2,330 |
# -*- coding: utf-8 -*-
import httplib as http
import pkgutil
import mock
from nose import SkipTest
from nose.tools import * # flake8: noqa
from tests.base import ApiTestCase
from osf_tests import factories
from framework.auth.oauth_scopes import CoreScopes
from api.base.settings.defaults import API_BASE
from api... | caseyrollins/osf.io | api_tests/base/test_views.py | Python | apache-2.0 | 7,187 |
#!/usr/bin/env python
# Lint as: python3
"""Helper API-client-based functions for self-contained tests."""
import time
from typing import Tuple
import requests
from grr_api_client import api
from grr_response_core import config
from grr_response_core.lib import config_lib
class Error(Exception):
"""Module-specif... | google/grr | grr/test/grr_response_test/lib/api_helpers.py | Python | apache-2.0 | 3,469 |
# Gedit snippets plugin
# Copyright (C) 2005-2006 Jesse van den Kieboom <jesse@icecrew.nl>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
#... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/gedit/plugins/snippets/placeholder.py | Python | gpl-3.0 | 25,309 |
from mercurial import wireproto
class proto(object):
def __init__(self, args):
self.args = args
def getargs(self, spec):
args = self.args
args.setdefault('*', {})
names = spec.split()
return [args[n] for n in names]
class clientpeer(wireproto.wirepeer):
def __init__... | hekra01/mercurial | tests/test-wireproto.py | Python | gpl-2.0 | 1,195 |
# Copyright 2014-2015 Boxkite Inc.
# This file is part of the DataCats package and is released under
# the terms of the GNU Affero General Public License version 3.0.
# See LICENSE.txt or http://www.fsf.org/licensing/licenses/agpl-3.0.html
import sys
from os.path import abspath
from datacats.environment import Envir... | florianm/datacats | datacats/cli/create.py | Python | agpl-3.0 | 9,000 |
# 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 required by applica... | annarev/tensorflow | tensorflow/python/keras/utils/version_utils.py | Python | apache-2.0 | 5,247 |
from codecs import getdecoder
from email.headerregistry import Address
import locale
import os
from pathlib import Path
import sys
import traceback
from typing import Any, ContextManager, Optional, Tuple, Union
import attr
import click
import daemon
from daemon.daemon import DaemonError
from mailbits import ContentType... | jwodder/daemail | src/daemail/__main__.py | Python | mit | 8,271 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2019-01-07 19:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('organization', '0017_membership_admin'),
]
operations = [
migrations.CreateModel(... | MuckRock/muckrock | muckrock/organization/migrations/0018_auto_20190107_1422.py | Python | agpl-3.0 | 1,369 |
#!/usr/bin/env python
"""Ilwrath is a framwork for building web pen testing tools.
Ilwrath currently contains Sac. Sac is a base class that can be
extended to handle performing operations that have multiple
dependances. This was created to solve the problem of testing web
services with multiple dependances."""
from .... | jdukes/ilwrathi | ilwrathi/__init__.py | Python | gpl-3.0 | 395 |
#
# (c) 2018 Extreme Networks Inc.
#
# 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 later version.
#
# Ans... | alexlo03/ansible | lib/ansible/plugins/cliconf/voss.py | Python | gpl-3.0 | 9,543 |
import datetime
import math
from visbeer.services.service_helper import validate_rfid, ENABLE_BEER_CONSUMPTION
class BeerService:
def __init__(self, rfid, data_service):
validate_rfid(rfid)
self.rfid = rfid
self.data_service = data_service
self.person = data_service.find_person(rf... | VIS-ETH/vis-beer | visbeer/services/beer_service.py | Python | mit | 1,720 |
import glob
import sys
import os
import logging
import multiprocessing as mp
import xml.etree.ElementTree as ET
from extraction.runnables import *
import extraction.utils as utils
import extraction.log
class ExtractionRunner(object):
def __init__(self):
self.filters = []
self.extractors = []
self.... | SeerLabs/extractor-framework | extraction/core.py | Python | apache-2.0 | 12,331 |
# Copyright (c) 2015 Tintri. 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 app... | skylerberg/third-party-ci-tools | monitoring/ciwatch/ciwatch/config.py | Python | apache-2.0 | 943 |
# -*- coding: utf-8 -*-
# Author: Francesco Apruzzese
# Copyright 2015 Apulia Software srl
# Copyright 2016 Lorenzo Battistini - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
from odoo.exceptions import Warning as UserError
cla... | linkitspa/l10n-italy | l10n_it_ddt/tests/test_ddt.py | Python | agpl-3.0 | 19,775 |
from __future__ import absolute_import, division, print_function
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import greplin.scales
import greplin.scales.formats
import greplin.scales.util
def scales_stats(request):
parts = request.matchdict.get('prefix')
path = '/'... | wosc/pyramid_scales | src/pyramid_scales/__init__.py | Python | bsd-3-clause | 1,480 |
# challenge_26.py
#
# Copyright (C) 2014-2016 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# A chapter of the story
from linux_story.story.challenges.CompanionMisc import StepTemplateMkdir
from linux_story.common import get_story_file
from linux_story.step_helper_functions impor... | KanoComputing/terminal-quest | linux_story/story/challenges/challenge_26.py | Python | gpl-2.0 | 6,344 |
from __future__ import absolute_import
import functools
import itertools
import logging
import random
import time
from contextlib import contextmanager
from django.conf import settings
from rb import Cluster
from redis.client import Script
from redis.exceptions import (
ResponseError,
WatchError,
)
from sent... | imankulov/sentry | src/sentry/digests/backends/redis.py | Python | bsd-3-clause | 22,136 |
import sys
import pandas as pd
import numpy as np
from scipy import stats
def significant(array1,array2):
try:
arr1 = np.array(array1)
arr2 = np.array(array2)
print(stats.ttest_ind(arr1,arr2)[1])
return stats.ttest_ind(arr1,arr2)[1] < 0.1
except:
print('PROBLEM!')
... | kobauman/education_tools | mastery_grids/experiment/splitAndCheck.py | Python | apache-2.0 | 3,481 |
import sys
import re
num = 0
for line in sys.stdin:
num += 1
m = re.match("^([^ ]+) : ([^ ]+)$", line)
if m != None:
feat = m.group(1).strip()
label = m.group(2).strip()
feat = feat.replace("=1", "")
featList = re.split(",", feat)
# print label
print str(num)+"\t"+label+"\t"+" ".join(featLis... | modelblocks/modelblocks-release | resource-incrsem/scripts/getMalletInput.py | Python | gpl-3.0 | 325 |
import datetime
import logging
import os
import sys
import uuid
from django.db import models
from django.db.models import signals
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as... | pjdufour/tilejet-server | tilejetserver/proxy/models.py | Python | bsd-3-clause | 369 |
# -*- coding: utf-8 -*-
""" S3 Data Objects API
@copyright: 2009-2012 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
... | mrGeen/eden | modules/s3/s3resource.py | Python | mit | 214,431 |
import autosar.constant
import autosar.datatype
import collections
import sys
class ValueBuilder:
"""
Builds AUTOSAR 4 value specifications from python data
"""
def __init__(self):
self.value = None
def buildFromDataType(self, dataType, rawValue, name = None, ws = None, parent = None):
... | cogu/autosar | autosar/builder.py | Python | mit | 8,575 |
from app.logic.event import Event
class OutcomingFirstEvent(Event):
#[abstract method implementation]
def handle_self(self, Model):
Model.handle_outcoming_first_event(self.time)
| ordinary-developer/modelling_2 | app/logic/outcoming_first_event.py | Python | mit | 197 |
# Copyright (C) 2009 Canonical Ltd.
# Copyright (C) 2012 Yahoo! Inc.
#
# Author: Soren Hansen <soren@canonical.com>
# Author: Joshua Harlow <harlowja@yahoo-inc.com>
#
# This file is part of cloud-init. See LICENSE file for license information.
# Distutils magic for ec2-init
from glob import glob
import atexit
impor... | larsks/cloud-init | setup.py | Python | gpl-3.0 | 9,886 |
#!/usr/bin/python
# Copyright (C) International Business Machines Corp., 2006
# Author: Harry Butterworth <butterwo@uk.ibm.com>
# This test initialises a ram disk in dom0 with data from /dev/urandom and
# then imports the ram disk device as a physical device into a domU. The md5
# checksum of the data in the ramdisk ... | flexiant/xen | tools/xm-test/tests/block-integrity/01_block_device_read_verify.py | Python | gpl-2.0 | 1,704 |
# -*- coding: utf-8; -*-
# Copyright (C) 2015 - 2019 Lionel Ott
#
# 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.
#
# T... | WhiteMagic/JoystickGremlin | vjoy/vjoy_interface.py | Python | gpl-3.0 | 5,585 |
"Base Cache class."
from django.core.exceptions import ImproperlyConfigured
class InvalidCacheBackendError(ImproperlyConfigured):
pass
class BaseCache(object):
def __init__(self, params):
timeout = params.get('timeout', 300)
try:
timeout = int(timeout)
except (ValueError, ... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-0.96/django/core/cache/backends/base.py | Python | bsd-3-clause | 1,675 |
#!/usr/bin/env python
#
################################################################################
# Plutocracy - Copyright (C) 2008 - Michael Levin
#
# 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
# F... | risujin/plutocracy | tools/master.py | Python | gpl-2.0 | 4,338 |
# Copyright (c) 2011 Hesky Fisher
# See LICENSE.txt for details.
# Many thanks to a steno geek for help with the protocol.
# TODO: Come up with a mechanism to communicate back to the engine when there
# is a connection error.
# TODO: Address any generic exceptions still left.
"""Thread-based monitoring of a stenotype... | PaulBeaudet/plover | plover/machine/stentura.py | Python | gpl-2.0 | 22,608 |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo
class XFileSharingProFolder(XFSCrypter):
__name__ = "XFileSharingProFolder"
__type__ = "crypter"
__version__ = "0.14"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(?:\... | joberreiter/pyload | module/plugins/crypter/XFileSharingProFolder.py | Python | gpl-3.0 | 2,857 |
"""The basic dict based notebook format.
The Python representation of a notebook is a nested structure of
dictionary subclasses that support attribute access
(ipython_genutils.ipstruct.Struct). The functions in this module are merely
helpers to build the structs in the right form.
"""
# Copyright (c) IPython Developm... | sserrot/champion_relationships | venv/Lib/site-packages/nbformat/v3/nbbase.py | Python | mit | 6,494 |
from time import time
import logging
import json
from fluxghost import g
logger = logging.getLogger("API.DISCOVER")
def get_online_message(source, device):
st = None
doc = {
"uuid": device.uuid.hex,
"alive": True,
"source": source,
"serial": device.serial,
"version":... | flux3dp/fluxghost | fluxghost/api/discover.py | Python | agpl-3.0 | 4,822 |
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 30 11:31:44 2014
"""
#####################################################################################################
# Groupe d'Étude pour la Traduction/le Traitement Automatique des Langues et de la Parole (GETALP)
# Homepage: http://getalp.imag.fr
#
# Author: Tien... | besacier/WCE-LIG | wce_system/feature/numeric.py | Python | gpl-3.0 | 3,220 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2019 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... | dontnod/weblate | weblate/trans/validators.py | Python | gpl-3.0 | 1,529 |
# coding utf-8
from .failuregenerator import *
from .assertionchecker import *
from .applicationgraph import *
| ResilienceTesting/gremlinsdk-python | python/pygremlin/__init__.py | Python | apache-2.0 | 112 |
"""
Signal Manager
==============
A SignalManager instance handles the runtime signal propagation between
widgets in a scheme.
"""
import logging
import itertools
from collections import namedtuple, defaultdict, deque
from operator import attrgetter, add
from functools import partial
from PyQt4.QtCore import QOb... | jlegendary/orange | Orange/OrangeCanvas/scheme/signalmanager.py | Python | gpl-3.0 | 16,248 |
# Copyright 2015, Tresys Technology, LLC
#
# This file is part of SETools.
#
# SETools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
... | TresysTechnology/setools | tests/categoryquery.py | Python | lgpl-2.1 | 2,279 |
"""
Maintenance utility for tumblr blogs.
:copyright: (c) 2017 by Mahmoud Hashemi
:license: BSD, see LICENSE for more details.
"""
import sys
from setuptools import setup
__author__ = 'Mahmoud Hashemi'
__version__ = '0.0.6dev'
__contact__ = 'mahmoudrhashemi@gmail.com'
__url__ = 'https://github.com/mahmo... | mahmoud/grumblr | setup.py | Python | bsd-3-clause | 1,312 |
from insights.parsers.package_provides_java import PackageProvidesJava
from insights.tests import context_wrap
from ...parsers import ParseException, SkipException
import pytest
PACKAGE_COMMAND_MATCH = """
/usr/lib/jvm/jre/bin/java java-1.8.0-openjdk-headless-1.8.0.141-3.b16.el6_9.x86_64
"""
PACKAGE_COMMAND_ERROR = "... | RedHatInsights/insights-core | insights/parsers/tests/test_package_provides_java.py | Python | apache-2.0 | 1,183 |
from electrum_creditbit.plugins import BasePlugin, hook
from electrum_creditbit_gui.qt.util import WaitingDialog, EnterButton
from electrum_creditbit.util import print_msg, print_error
from electrum_creditbit.i18n import _
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import traceback
import zlib
import json
f... | creditbit/electrum-creditbit | plugins/audio_modem.py | Python | gpl-3.0 | 4,504 |
print ('Hello world') | jableckim/biomkl | main.py | Python | lgpl-3.0 | 21 |
'''Functions to diff a local subtree with its remote.'''
import click
import requests
def repo_commits_since(repo, since_ref, headers):
if since_ref:
compare_url = repo['compare_url'].format(base=since_ref, head='master')
compare_resp = requests.get(compare_url, headers=headers)
compare_... | john-kurkowski/git-subtree-update | git_subtree_remote/diff.py | Python | bsd-2-clause | 2,720 |
# Copyright 2014-2015 ARM Limited
#
# 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 w... | Sticklyman1936/workload-automation | wlauto/workloads/anomaly2/__init__.py | Python | apache-2.0 | 2,354 |
from .spam_assassin_rule import SpamAssassinRule
class SpamFilterResults(object):
"""SpamFilterResults.
:param spam_assassin:
:type spam_assassin: list[~mailosaur.models.SpamAssassinRule]
"""
def __init__(self, data=None):
if data is None:
data = {}
self.spam_assassin... | mailosaurapp/mailosaur-python | mailosaur/models/spam_filter_results.py | Python | mit | 385 |
import unittest
import sys
from spam.spamhaus import *
class MockSpamHausChecker(SpamHausChecker):
def set_spam(self, is_spam):
"""docstring for setSpam"""
self.is_spam = is_spam
def _resolve(self, domain):
"""docstring for __resolve"""
if self.is_spam:
return "2.3... | fmarani/spam | tests/spamhaus_tests.py | Python | lgpl-3.0 | 1,040 |
import posixpath
import random
import gevent.queue
def _walk_namespace_hierarchy(namespace):
assert namespace.startswith("/")
yield namespace
while namespace != "/":
namespace = posixpath.dirname(namespace)
yield namespace
class MessageDispatcher(object):
def __init__(self, stats):... | spladug/sutro | sutro/dispatcher.py | Python | bsd-3-clause | 1,617 |
from browser import window
from preprocess import transform
from reeborg_en import *
src = transform(window.library.getValue())
exec(src)
| code4futuredotorg/reeborg_tw | src/python/library.py | Python | agpl-3.0 | 138 |
# -*- coding: utf-8 -*-
from django.conf.urls import *
from xendor.views import PageView, HomeView, SiteMapView, CloseView
urlpatterns = patterns('',
#главная страничка
url(r'^$', HomeView.as_view(), name='xendor-home'),
#карта сайта
url(r'^sitemap/$', SiteMapView.as_view(), name="xendor-sitemap"),
... | sociogenetics/xendor | xendor/urls.py | Python | bsd-2-clause | 619 |
# 669171001
s = 1
for n in xrange(3, 1002, 2):
s += 4 * n * n - 6 * n + 6
print s
| higgsd/euler | py/28.py | Python | bsd-2-clause | 86 |
# -*- coding: utf-8 -*-
#
# test_all.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# ... | zifeo/nest-simulator | pynest/nest/tests/test_all.py | Python | gpl-2.0 | 2,829 |
# coding: utf8
from __future__ import unicode_literals
import pytest
@pytest.mark.models
def test_issue693(EN):
"""Test that doc.noun_chunks parses the complete sentence."""
text1 = "the TopTown International Airport Board and the Goodwill Space Exploration Partnership."
text2 = "the Goodwill Space Expl... | Gregory-Howard/spaCy | spacy/tests/regression/test_issue693.py | Python | mit | 664 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.