code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import time
from collections import defaultdict
from unittest import TextTestRunner, TextTestResult as _TextTestResult
from scrapy.commands import ScrapyCommand
from scrapy.contracts import ContractsManager
from scrapy.utils.misc import load_object, set_environ
from scrapy.utils.conf import build_component_list
clas... | eLRuLL/scrapy | scrapy/commands/check.py | Python | bsd-3-clause | 3,403 |
from .rule_base import RuleBase
class RuleChildren(RuleBase):
""" rule = rule_children( parser, rule, next_rule )
rule_children constructor. Pass in the parser object that the rule is for, the rule
that is being parsed, and the next rule in the parsing chain.
This class takes as input a list of parse... | cmancone/mygrations | mygrations/core/parse/rule_children.py | Python | mit | 3,841 |
# -*- coding: utf-8 -*-
from tests import HangulizeTestCase
from hangulize.langs.isl import Icelandic
class IcelandicTestCase(HangulizeTestCase):
lang = Icelandic()
def test_people(self):
self.assert_examples({
'Agnar Helgason': '아그나르 헬가손',
'Ágústa Eva Erlendsdóttir': '아우구스타 ... | Jinwithyoo/han | tests/isl.py | Python | bsd-3-clause | 12,082 |
from dock import client
def fmt(container):
image, name = ns(container)
return '[{image}/{name}]'.format(image=image, name=name)
def ns(container):
image_name = container.attrs['Image']
image = client.images.get(image_name)
if len(image.tags) > 0:
image_name = image.tags[0]... | regiontog/macvlan-ipvs-dr | src/container.py | Python | mit | 778 |
import json
import logging
import pymongo
from bson.objectid import ObjectId
from tornado import gen
from tornado.ioloop import IOLoop
from tornado.web import RequestHandler, authenticated
from tornado.websocket import WebSocketHandler
from .conf import config
from .exceptions import LogsterException
logger = log... | irvind/logster | logster/handlers.py | Python | mit | 5,948 |
"""
This module allows you to mock the config file as needed.
A default fixture that simply returns a safe-to-modify copy of
the default value is provided.
This can be overridden by parametrizing over the option you wish to
mock.
e.g.
>>> @pytest.mark.parametrize("extension_initial_dot", (True, False))
... def test_f... | INCF/pybids | bids/conftest.py | Python | mit | 1,063 |
"""pocimport 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-b... | wbar/poc-import | src/pocimport/pocimport/urls.py | Python | mit | 823 |
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/gazoo-device | examples/device_tests/mobly_example_test.py | Python | apache-2.0 | 3,325 |
"""Copyright 2009 Chris Davis
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
... | evernote/graphite-web | webapp/graphite/metrics/urls.py | Python | apache-2.0 | 941 |
#!/usr/bin/env python
'''
Copyright 2014 Nedim Srndic, University of Tuebingen
This file is part of Mimicus.
Mimicus 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 o... | srndic/mimicus | reproduction/FC.py | Python | gpl-3.0 | 1,320 |
import requests
def before_scenario(context, scenario):
"""equivalent of unittest setUp"""
ip = "localhost"
port = "1234"
context.base_url = "http://" + ip + ":" + port
requests.delete(context.base_url + '/books', timeout=5)
def after_scenario(context, scenario):
"""equivalent of unittest tea... | bpuderer/python_test | behave_demo/environment.py | Python | mit | 389 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>, and others
#
# 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 ... | dmitry-sobolev/ansible | lib/ansible/modules/windows/win_ping.py | Python | gpl-3.0 | 1,547 |
# -*- coding:utf-8 -*-
"""
Verion: 1.0
Author: zhangjian
Site: http://iliangqunru.com
File: __init__.py.py
Time: 2017/7/22 2:19
"""
| Xarrow/pySimulatedDNS | dnsCat/__init__.py | Python | apache-2.0 | 139 |
import unittest
# from gitbench.db import BenchmarkDB # FIXME: test is actually empty
class TestBenchmarkDB(unittest.TestCase):
test_path = '__test__.db'
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
if __name__ == '__main__':
import no... | cpcloud/vbench | vbench/tests/test_db.py | Python | mit | 430 |
# Copyright 2011 OpenStack LLC.
# Copyright 2011 Nebula, 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/LICENS... | ioram7/keystone-federado-pgid2013 | build/python-keystoneclient/keystoneclient/v3/groups.py | Python | apache-2.0 | 2,666 |
import argparse
import random
import editdistance
import os
import numpy as np
from data_generator import Tokenizer
from data_generator import get_data_generator
from model import get_model
def visualization(i, a, b, c, d, e, directory1):
with open(directory1 + '/' + str(i) + '.txt', 'w') as f:
a = a + [... | yli1/CGPS | main.py | Python | apache-2.0 | 9,613 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from services.application import ApplicationService
from services.application_access import ApplicationAccessService
import tornado.web
from tornado import gen
import tornado.escape
import json
from util.rabbitmq import send_message
from stormed import Message
import settin... | liuhong1happy/DockerConsoleApp | views/application.py | Python | apache-2.0 | 6,294 |
#!/usr/bin/python
#
# Copyright 2013 Google 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... | caioserra/apiAdwords | examples/adspygoogle/dfp/v201311/activity_service/create_activities.py | Python | apache-2.0 | 2,305 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import storages.backends.s3boto
class Migration(migrations.Migration):
dependencies = [
('categories', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name... | lincolnloop/django-categories | categories/migrations/0002_thumbnail_compat.py | Python | apache-2.0 | 550 |
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import settings
class MailClient(object):
def __init__(self):
'''
Creates a new client
'''
def smtp_login(self):
'''
Logs into the smtp server
Returns the sende... | TeachBoost/ansible | library/mailclient.py | Python | mit | 1,568 |
#!/usr/bin/env python
import copy
import json
import os
def get_collection_facts(iw, component_matcher, meta):
# Skip redirection of backports or <2.10 issues ...
is_backport = False
if isinstance(meta.get('is_backport'), bool):
is_backport = meta['is_backport']
else:
'''
if ... | jctanner/ansibullbot | ansibullbot/triagers/plugins/collection_facts.py | Python | gpl-3.0 | 4,249 |
from __future__ import unicode_literals
import sys
import logging
from modularodm import Q
from modularodm import exceptions
from website.app import init_app
from scripts import utils as script_utils
from framework.transactions.context import TokuTransaction
from framework.guid.model import Guid
from website.files ... | monikagrabowska/osf.io | scripts/migrate_file_guids.py | Python | apache-2.0 | 4,713 |
from model.account import Account, AccountAPIKey, AccountUser
from model.admin import Admin
from model.application import \
Application, \
ApplicationRoute, ApplicationTemplate, ApplicationStaticFile, \
ApplicationStaticContent
from model.general import Plan
| glennyonemitsu/MarkupHiveServer | src/model/__init__.py | Python | mit | 271 |
# Assignment Collector/Grader - a Django app for collecting and grading code
# Copyright (C) 2010,2011 Anthony Rossi <anro@acm.org>
#
# 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 Softw... | rossica/assignmentcollectorgrader | urls.py | Python | agpl-3.0 | 1,480 |
# Copyright (c) 2015 OpenStack Foundation.
#
# 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... | chenyujie/hybrid-murano | murano/engine/system/mistralclient.py | Python | apache-2.0 | 3,020 |
import re
def index(i,j,k):
'''
Fargo3d index calculator.
Input: Strings i,j,k, with the value of the desired index on each direction.
Output: The monodimentional fargo3d index.
'''
value = ''
print i,j,k
#Trivial option
if i == 'i' and j == 'j' and k == 'k':
value += 'l'
... | adamdempsey90/fargo3d | utils/python/indices.py | Python | gpl-3.0 | 1,131 |
import logging
import sys
import re
import time
import datetime
debug, error, warning, info, success = (None, None, None, None, None)
def dieOnError(err, msg):
if err:
error("%s", msg)
sys.exit(1)
class LogFormatter(logging.Formatter):
def __init__(self, fmtstr):
self.fmtstr = fmtstr
self.COLOR_R... | alisw/alibuild | alibuild_helpers/log.py | Python | gpl-3.0 | 3,652 |
import datetime
import time
import os, sys
import re
import urllib
from django.template import RequestContext
from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from django.db.models import Q
from django.c... | rossjones/ScraperWikiX | web/codewiki/models/code.py | Python | agpl-3.0 | 21,938 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
from frappe.utils import date_diff, flt
from erpnext.hr.ut... | manassolanki/erpnext | erpnext/hr/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py | Python | gpl-3.0 | 2,380 |
# -*- coding:utf-8 -*-
# This code is automatically transpiled by Saklient Translator
import six
from ...errors.httpbadrequestexception import HttpBadRequestException
import saklient
str = six.text_type
# module saklient.cloud.errors.invalidformatexception
class InvalidFormatException(HttpBadRequestException):
... | sakura-internet/saklient.python | saklient/cloud/errors/invalidformatexception.py | Python | mit | 817 |
"""
This module defines the base classes for Kolibri's class-based Permissions system.
"""
from django.db.models import F
####################################################################################################################
# This section contains base classes that can be inherited and extended to defi... | lyw07/kolibri | kolibri/core/auth/permissions/base.py | Python | mit | 12,304 |
import datetime
import logging
import re
from concurrent.futures import ThreadPoolExecutor
import botocore
import pytz
import autoscaler.aws_utils as aws_utils
import autoscaler.utils as utils
logger = logging.getLogger(__name__)
class AutoScalingGroups(object):
_BOTO_CLIENT_TYPE = 'autoscaling'
_CLUSTER_... | openai/kubernetes-ec2-autoscaler | autoscaler/autoscaling_groups.py | Python | mit | 24,754 |
import base64
import json
import os
import subprocess
import tempfile
import threading
import uuid
from mozprocess import ProcessHandler
from serve.serve import make_hosts_file
from .base import (ConnectionlessProtocol,
RefTestImplementation,
testharness_result_converter,
... | dati91/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorservo.py | Python | mpl-2.0 | 9,499 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE-SCHEMAS.
# Copyright (C) 2016, 2019 CERN.
#
# INSPIRE-SCHEMAS 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 ... | inspirehep/inspire-schemas | tests/unit/test_literature_builder.py | Python | gpl-2.0 | 19,286 |
"""
Module to help working with scheduler such as sun grid engine (SGE) or
Simple Linux Utility for Resource Management (SLURM).
Main functions covered are :
- get the list of names of all running jobs;
- generate easily a submission query for a job.
"""
# Authors: Arnaud Joly
#
# License: BSD 3 clause
impo... | lesteve/clusterlib | clusterlib/scheduler.py | Python | bsd-3-clause | 5,598 |
import logging
import pandasdmx
pandasdmx.logger.setLevel(logging.DEBUG)
| dr-leo/pandaSDMX | pandasdmx/tests/conftest.py | Python | apache-2.0 | 75 |
##
# Copyright 2015-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/ocamlpackage.py | Python | gpl-2.0 | 2,118 |
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "Test Base Time Window",
"summary": "Test Base model to handle time windows",
"version": "14.0.1.0.1",
"category": "Technical Settings",
"author": "ACSONE SA/NV, Camptocamp, Odoo Community Associ... | OCA/server-tools | test_base_time_window/__manifest__.py | Python | agpl-3.0 | 523 |
import unittest
import numpy
import chainer
from chainer import backend
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
import chainerx
@testing.parameterize(*testing.product_dict(
[
{'shape':... | okuta/chainer | tests/chainer_tests/functions_tests/array_tests/test_stack.py | Python | mit | 3,692 |
# -*- coding: utf-8 -*-
from django.contrib.postgres import fields
from django.contrib.auth.models import Group
from api.taxonomies.utils import optimize_subject_query
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from dirtyfields import DirtyFieldsMixi... | chennan47/osf.io | osf/models/preprint_provider.py | Python | apache-2.0 | 6,881 |
from uuid import uuid4
import os
import platform
import signal
import time
import traceback
import webbrowser
from couchpotato.api import addApiView
from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.helpers.variable import cleanHost, md5
from couchpotato.core.logger import CPLog
from couchpo... | Aristocles/CouchPotatoServer | couchpotato/core/_base/_core.py | Python | gpl-3.0 | 9,215 |
# 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 distributed in the hope that it will be useful,
# bu... | tum-camp/survival-support-vector-machine | survival/kernels/clinical.py | Python | gpl-3.0 | 10,110 |
#!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import os
import re
import sys
import urllib2
"""Logpuzzle exercise
Given an apache logfile,... | brebory/google-python-exercises | logpuzzle/logpuzzle.py | Python | apache-2.0 | 2,488 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your opt... | Panos512/invenio | modules/miscutil/lib/inveniocfg_dumperloader.py | Python | gpl-2.0 | 16,700 |
from awscfncli2.runner import Boto3Profile
class TestStackSelector(object):
def test_update(self):
s1 = Boto3Profile('foo','bar')
s2 = Boto3Profile('foo', 'baz')
assert s1.region_name == 'bar'
s1.update(s2)
| Kotaimen/awscfncli | tests/unit/runner/test_bobo3_profile.py | Python | mit | 246 |
from pycp2k.inputsection import InputSection
class _each397(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Just_energy = None
self.Powell_opt = None
self.Qs_scf = None
self.Xas_scf = None
self.Md = None
self.Pint = None
self.Meta... | SINGROUP/pycp2k | pycp2k/classes/_each397.py | Python | lgpl-3.0 | 1,114 |
# Copyright (c) 2014 VMware, 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... | rakeshmi/cinder | cinder/tests/unit/test_vmware_volumeops.py | Python | apache-2.0 | 73,767 |
from __future__ import (absolute_import, division, print_function)
from netCDF4 import Dataset
import numpy as np
import pysgrid
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
# from cartopy.io import shapereader
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
# rotation is s... | ayan-usgs/pysgrid | demos/inlet_heatmap.py | Python | bsd-3-clause | 2,094 |
# Copyright (c) 2009 Participatory Culture Foundation
# See LICENSE for details.
from django.http import HttpResponse
from channelguide.testframework import TestCase
class NotificationViewTestCase(TestCase):
def test_add_notification(self):
"""
Test that notifications are added when request.add_... | kmshi/miroguide | channelguide/notifications/tests.py | Python | agpl-3.0 | 2,468 |
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.uic import *
class MyOverlayDlg (QDialog) :
secondFlag = False
infile = ""
def __init__(self) :
QDialog.__init__(self)
self.ui = loadUi("uiPlotOverlayDlg.ui", self)
self.ui.overlayBrowse... | comptech/atrex | Software/MyOverlayDlg.py | Python | lgpl-3.0 | 880 |
'''
TelegramAPy
Copyright (C) 2015 Giove Andrea
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 option) any later version.
This program is distributed i... | aadeg/TelegramAPy | telegramapy/types/replaykeyboardhide.py | Python | gpl-2.0 | 1,208 |
#!/usr/bin/env python
"""
This script is a trick to setup a fake Django environment, since this reusable
app will be developed and tested outside any specifiv Django project.
Via ``settings.configure`` you will be able to set all necessary settings
for your app and run the tests as if you were calling ``./manage.py tes... | uhuramedia/django-portlet | portlet/tests/runtests.py | Python | bsd-3-clause | 2,032 |
# coding: utf-8
# pylint: disable = invalid-name, C0111, C0301
# pylint: disable = R0912, R0913, R0914, W0105, W0201, W0212
"""Wrapper c_api of LightGBM"""
from __future__ import absolute_import
import ctypes
import os
import warnings
from tempfile import NamedTemporaryFile
import numpy as np
import scipy.sparse
fro... | sightmachine/LightGBM | python-package/lightgbm/basic.py | Python | mit | 67,498 |
#! /usr/bin/env python
import os
import subprocess
import sys
from os.path import join
from pycog.utils import get_here, mkdir_p
#=========================================================================================
# Shared steps
#================================================================================... | frsong/pycog | paper/plos.py | Python | mit | 1,305 |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext as _
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms_shiny.models import ShinyAppPluginModel
class ShinyAppPlugin(CMSPluginBase):
model = ShinyAppPluginModel
module = "Lab Plugins"
name = _("... | mfcovington/djangocms-shiny-app | cms_shiny/cms_plugins.py | Python | bsd-3-clause | 554 |
# sqlalchemy/inspect.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""The inspection module provides the :func:`.inspect` function,
which delivers ... | michaelgugino/turbo-lister | sqlalchemy/inspection.py | Python | gpl-3.0 | 3,113 |
# Copyright (c) 2017 VMware, 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 w... | onesafe/multivimdriver-vmware-vio | vio/vio/pub/vim/vimapi/network/OperateSubnet.py | Python | apache-2.0 | 3,441 |
from lcapy import *
import unittest
class LcapyTester(unittest.TestCase):
"""Unit tests for lcapy
"""
def test_DFT(self):
self.assertEqual(nexpr('delta(n)').DFT(), 1, "delta(n)")
self.assertEqual(nexpr('2 * delta(n)').DFT(), 2, "2 * delta(n)")
self.assertEqual(nexpr('1').DFT()... | mph-/lcapy | lcapy/tests/test_dft.py | Python | lgpl-2.1 | 1,983 |
import json
import os
from datetime import datetime, timedelta
from unittest import mock
from django.conf import settings
from django.forms import ValidationError
from django.test.testcases import TransactionTestCase
from django.test.utils import override_settings
from django.urls import reverse
from django.utils impo... | wagnerand/addons-server | src/olympia/signing/tests/test_views.py | Python | bsd-3-clause | 58,360 |
# Copyright 2016 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... | nanditav/15712-TensorFlow | tensorflow/python/kernel_tests/svd_op_test.py | Python | apache-2.0 | 5,740 |
import bottle
import beaker.middleware
from bottle import route, redirect, post, run, request, hook
from instagram import client, subscriptions
bottle.debug(True)
session_opts = {
'session.type': 'file',
'session.data_dir': './session/',
'session.auto': True,
}
app = beaker.middleware.SessionMiddleware(b... | ironman5366/python-instagram | sample_app.py | Python | bsd-3-clause | 11,753 |
# 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/.
import subprocess
import time
import os
import re
class AccessDebugBridge(object):
def __init__(self, adbPath="adb"... | MozillaSecurity/peach | Peach/Utilities/ADB.py | Python | mpl-2.0 | 7,772 |
"""
DOCUMENTATION:
lookup: every
version_added: "QB-0.1.61"
short_description: Returns true for a key every X time delta (per host).
description:
- Returns `True` if more than a specified amount of time has passed
since it last returned `True` for that key for the current
... | nrser/qb | plugins/lookup/every_lookups.py | Python | mit | 5,413 |
"""
pyexcel.plugins.sources.sqlalchemy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Representation of sqlalchemy sources
:copyright: (c) 2015-2020 by Onni Software Ltd.
:license: New BSD License
"""
from pyexcel_io.constants import DB_SQL
from .db_sources import BookDbSource, SheetDbSource
class SheetSQLA... | chfw/pyexcel | pyexcel/plugins/sources/sqlalchemy.py | Python | bsd-3-clause | 1,279 |
import itertools
class mind:
"""
Třída řešící hru Mastermind ve třech úrovních obtížnosti.
Podporované módy:
1) Hádání 4 pozic se 6 barvami
2) Hádání 5 pozic s 7 barvami
3) Hádání 6 pozic s 8 barvami
O zadání, učování správného řešení a ohodnocování jednotlivých tahů
... | malja/cvut-python | cviceni10/mind.py | Python | mit | 6,473 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __ope... | ndtran/compassion-accounting | account_analytic_attribution/wizard/account_analytic_attribution_wizard.py | Python | agpl-3.0 | 3,945 |
#!/usr/bin/env python
"""
Copyright (c) 2015-2017 Alex Forencich
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, modify,... | alexforencich/verilog-i2c | tb/test_i2c_init.py | Python | mit | 7,603 |
import os.path
def thumbnails_path(name):
if name is None:
return os.path.join(os.path.dirname(__file__), 'thumbnails')
return os.path.join(os.path.dirname(__file__), 'thumbnails', name)
| relekang/thumbnails.lkng.me | helpers.py | Python | mit | 205 |
import logging
from pathlib import Path
import time
from dstools.pipeline.tasks import PythonCallable
from dstools.pipeline.products import File
from dstools.pipeline import DAG
logging.basicConfig(level=logging.INFO)
def wait(product):
time.sleep(1)
Path(str(product)).touch()
def wait2(product, upstream... | edublancas/python-ds-tools | profiling/pipeline.py | Python | mit | 833 |
import sklearn
import pandas as pd
import numpy as np
from time import gmtime, strftime
from feature_engineer import timer
nrs = np.random.RandomState(0)
def lcc_sample(labels, preds, input_data, C = 1):
"""
Param:
labels shape: (n_sample,)
preds shape: (n_sample,)
input_data shape: (n_sample, fea... | ifuding/Kaggle | TalkingDataFraudDetect/Code/lcc_sample.py | Python | apache-2.0 | 2,613 |
import numpy as np
from matplotlib.mlab import find
from data_transforms import create_weight
def apply_bound(pred, bounds=(0,1,0)):
"""
This ensures that all views and comments >= 0 and all votes >= 1
"""
pred = (pred >= bounds) * pred + bounds * (pred < bounds)
return pred
def apply_scales(pred... | beegieb/kaggle_see_click_fix | predict.py | Python | bsd-3-clause | 608 |
import sys, struct, hashlib, binascii, re, os
from Crypto.Cipher import DES3
from ConfigParser import RawConfigParser
import sqlite3, win32crypt
from config.constant import *
from config.write_output import print_output, print_debug
from config.header import Header
from config.moduleInfo import ModuleInfo
CIPHERED_FIL... | Relin/LaZagne | Windows/src/LaZagne/softwares/browsers/opera.py | Python | lgpl-3.0 | 5,849 |
import logging
import os
class Exporter(object):
def __init__(self, options=None):
self.options = options
self.logger = logging.getLogger(__name__)
self.setup()
def setup(self):
pass
exporters = {}
def register_exporter(klass):
exporters[klass.name] = klass
return ... | City-of-Helsinki/linkedevents | events/exporter/base.py | Python | mit | 742 |
# =============================================================================
# Copyright (C) 2014 Ryan Holmes
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either v... | pyfa-org/Pyfa | service/port/muta.py | Python | gpl-3.0 | 3,576 |
""" Multiply a signal with a window """
import warnings
import numpy
# These imports are all for loading the functions.yaml file for the abbreviations of functions for benchmarking.
# Kept here local for debugging and because the file is just used in this node.
# Maybe this will change.
try:
import os
import ... | pyspace/test | pySPACE/missions/nodes/preprocessing/window_func.py | Python | gpl-3.0 | 6,789 |
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk
from os import path, makedirs
import re
import traceback
from subprocess import Popen, PIPE, DEVNULL
from station import Station
from constants import RE_URL
from tools import get_metadata, get_next_url
from drag import drag
from db impo... | Llamatron2112/streams | mainwindow.py | Python | gpl-3.0 | 24,045 |
from flask import Flask
app = Flask(__name__)
from app import vizarvin
| arvinsahni/ml4 | flask/app/__init__.py | Python | mit | 73 |
# -*- coding: utf-8 -*-
import scrapy
from topsage.items import ComputerItem
class ComputerSpider(scrapy.Spider):
name = "computer"
allowed_domains = ["club.topsage.com"]
start_urls = (
'http://club.topsage.com/forum-49-1.html',
)
def parse(self, response):
for path in response.xp... | JayvicWen/Crawler | topsage/topsage/spiders/computer.py | Python | mit | 1,305 |
from datetime import datetime
from dateutil.relativedelta import relativedelta
class GithubDatePoints(object):
MAX_HEIGHT = 7
MAX_WIDTH = 51
def __init__(self, pixel_set):
self.__pixel_set = self.__normalize_pixel_set(pixel_set)
self.__datetime_start_point = self.get_datetime_start_point(... | ufocoder/py-GithubArt | github_art/datepoints.py | Python | mit | 1,247 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'FederalBudget.subvention_performance'
db.alter_column(u'mo_federalbudget', 'subvention_pe... | zionist/mon | mon/apps/mo/migrations/0009_auto__chg_field_federalbudget_subvention_performance__add_field_depart.py | Python | bsd-3-clause | 7,925 |
#Modifies the Stage_client_stats collection of Stage_database.
#Changes the client_ts field to ts.
from pymongo import MongoClient
client = MongoClient()
db = client.Stage_database
collection = db.Stage_client_stats
collection.update({}, { '$rename': {"client_ts": "ts"}}, multi=True)
collection = db.Stage_server_st... | joshzarrabi/e-mission-server | bin/historical/migrations/rename_client_ts_to_ts.py | Python | bsd-3-clause | 499 |
#!python3
"""
This script downloads the favicons
Usage:
python3 update_alexa path/to/data.csv
"""
import os
import requests
favicon_path = os.path.join(os.path.dirname(__file__), "..", "icons")
def download_favicons(links):
for link in links:
netloc = link['netloc']
url = 'http://' + netloc... | engineerapart/TheRemoteFreelancer | docs/scripts/download_favicons.py | Python | unlicense | 964 |
from builtins import object
import binascii
import mock
from rekall import testlib
from rekall.plugins.tools import dynamic_profiles
class MockAddressResolver(object):
def __init__(self, name_map):
self.name_map = name_map
def format_address(self, address):
if address == None:
ret... | google/rekall | rekall-core/rekall/plugins/tools/dynamic_profiles_test.py | Python | gpl-2.0 | 5,057 |
from xudd.lib.server import Server
from xudd.lib.http import HTTP
from xudd.lib.wsgi import WSGI
from xudd.hive import Hive
import logging
def wsgi_app(environ, start_response):
response = start_response(200, {'Content-Type': 'text/plain'}.items())
response('Hello World!')
def serve():
logging.basicConfi... | xudd/xudd | xudd/demos/lib-server.py | Python | apache-2.0 | 795 |
from models import Job
from interface import get_all_jobs
def running_jobs(request):
if request.user.is_authenticated():
# hack to get numbers to update
get_all_jobs(request.user.credentials.all())
temp = len(Job.get_running_jobs(user=request.user))
return {"running_jobs": temp}
... | crcollins/chemtools-webapp | cluster/context_processors.py | Python | mit | 366 |
from hotbit.parametrization import KSAllElectron
import numpy as np
from box import mix
from box.interpolation import Function
from hotbit.io.fortran import fortran_readline
integrals =['dds','ddp','ddd','pds','pdp','pps','ppp','sds','sps','sss']
def plot_table(parfile,screen=False,s1=None,s2=None,der=0):
""" Plo... | pekkosk/hotbit | hotbit/parametrization/util.py | Python | gpl-2.0 | 10,616 |
from Tools.Directories import fileExists
from Components.config import config, ConfigSubsection, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence, ConfigSubList
import DVDTitle
import xml.dom.minidom
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_FONTS
class ConfigCol... | openpli-arm/enigma2-arm | lib/python/Plugins/Extensions/DVDBurn/DVDProject.py | Python | gpl-2.0 | 10,154 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# 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.
... | GNS3/gns3-server | gns3server/schemas/vmware.py | Python | gpl-3.0 | 5,652 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: qui mar 3 18:02:04 2016
# by: The Resource Compiler for PyQt (Qt v4.8.6)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x02\xd5\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x4... | alexlopespereira/taskmanager | resources.py | Python | gpl-3.0 | 4,106 |
##! /usr/bin/env python
# _*_ coding: latin-1 _*_
# jtfilefilter
#
# Filefilter a jtdirlist és jtfilechooser osztályokhoz.
# Directorykhoz és normál filékhez külön filtert kell magadni.
#
# regexdir : 1 db reguláris kifejezés directorykra
# regexlist : reguláris kifejezések listája normál filékre
#
# regexlist az a... | mrev11/ccc3 | jt/jtpython/jtlib/jtfilefilter.py | Python | lgpl-2.1 | 1,423 |
#example taken from scipy documentation
from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
#disenar el filtro usando una ventana hamming
b = signal.firwin(9, 0.8, window='hamming', pass_zero=True)
#pasa bajas pass_zero=True
#pasa altas pass_zero=False
fs=1e3
t,T=np.linspace(1./fs,5,fs*5,rets... | miltonsarria/dsp-python | filters/FIR/filter_sine2.py | Python | mit | 1,015 |
from distutils.dir_util import copy_tree
from operator import itemgetter
import pandas as pd
import sys
from jinja2 import Environment, FileSystemLoader
import os
def generate_reports(folder):
hosts = []
# get all the paths of the root folder
files = [os.path.join(folder, fn) for fn in next(os.walk(folde... | shelan/collectl-monitoring | plotter.py | Python | apache-2.0 | 3,847 |
#!/usr/bin/python
from PyQt4 import QtGui
from PyQt4 import QtCore
from ui_board import Ui_Form
from itertools import product
from waitingdialog import WaitingDialog
from exitdialog import ExitDialog
from Msgs import *
from cPickle import dumps, loads
class Board(QtGui.QMainWindow, Ui_Form):
vline_xposes = [116.... | dirtybit/pyDnb | ui/board.py | Python | gpl-2.0 | 13,881 |
#!/usr/bin/env python2.7
# Copyright 2015 Cisco Systems, 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 applicabl... | tbarrongh/cosc-learning-labs | src/learning_lab/01_inventory_not_connected.py | Python | apache-2.0 | 1,219 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = "Karolina Alexiou"
__email__ = "karolina.alexiou@teralytics.ch"
import platform
import os
LINUX = "linux"
MACOS = "macos"
WINDOWS = "windows"
# TODO have people confirm the prefix path for Mac
# TODO Make it possible to test against a list of paths
# (Qt + unit... | anitagraser/TimeManager | utils/os_util.py | Python | gpl-2.0 | 1,389 |
import unittest
import atomic
import numpy as np
class TestRadiation(unittest.TestCase):
def setUp(self):
ad1 = atomic.element('carbon')
ad2 = atomic.element('li')
eq1 = atomic.CollRadEquilibrium(ad1)
eq2 = atomic.CollRadEquilibrium(ad2)
te = np.logspace(0, 3, 50)
n... | ezekial4/atomic_neu | atomic/tests/test_radiation.py | Python | mit | 2,367 |
# Copyright 2014 Google 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 applicable law or a... | nathanaelle/novm | novm/pci.py | Python | apache-2.0 | 1,210 |
#VERSION: 1.60
#AUTHORS: Diego de las Heras (ngosang@hotmail.es)
# Christophe Dumez (chris@qbittorrent.org)
# 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 ... | ngosang/qBittorrent-plugins | sumotorrent/sumotorrent.py | Python | gpl-2.0 | 6,341 |
from setuptools import setup, find_packages
XMODULES = [
"abtest = xmodule.abtest_module:ABTestDescriptor",
"book = xmodule.backcompat_module:TranslateCustomTagDescriptor",
"chapter = xmodule.seq_module:SequenceDescriptor",
"combinedopenended = xmodule.combined_open_ended_module:CombinedOpenEndedDescri... | pku9104038/edx-platform | common/lib/xmodule/setup.py | Python | agpl-3.0 | 3,169 |
import requests
from django.core.management.base import BaseCommand
from time import sleep
from busstops.models import Service
from .import_transxchange import get_open_data_operators
class Command(BaseCommand):
@staticmethod
def add_arguments(parser):
parser.add_argument('api_key', type=str)
def... | jclgoodwin/bustimes.org.uk | bustimes/management/commands/suggest_bod.py | Python | mpl-2.0 | 1,471 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.