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 |
|---|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, Brian Coca <bcoca@ansible.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1... | hkariti/ansible | lib/ansible/modules/system/systemd.py | Python | gpl-3.0 | 18,087 | 0.002764 |
from bedrock.redirects.util import redirect
redirectpatterns = (
# bug 926629
redirect(r'^newsletter/about_mobile(?:/(?:index\.html)?)?$', 'newsletter.subscribe'),
redirect(r'^newsletter/about_mozilla(?:/(?:index\.html)?)?$', 'mozorg.contribute.index'),
redirect(r'^newsletter/new(?:/(?:index\.html)?)?... | sgarrity/bedrock | bedrock/newsletter/redirects.py | Python | mpl-2.0 | 432 | 0.009259 |
#!/usr/bin/python
import sys, argparse, StringIO, re, gzip
from multiprocessing import Pool, cpu_count, Queue
from Bio.Format.BGZF import is_bgzf, reader as BGZF_reader, get_block_bounds
from Bio.Format.Fastq import FastqEntry
# Create an index for bgzf zipped fastq files.
# Pre: A fastq file that has been compress... | jason-weirather/py-seq-tools | seqtools/cli/legacy/fastq_bgzf_index.py | Python | apache-2.0 | 6,010 | 0.030283 |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfbase/_fontdata.py
#$Header $
__version__=''' $Id: _fontdata.py 3052 2007-03-07 14:04:49Z rgbecker $ '''
__doc__="""
database of font related thi... | alexissmirnov/donomo | donomo_archive/lib/reportlab/pdfbase/_fontdata.py | Python | bsd-3-clause | 61,719 | 0.04992 |
"""Th tests for the Rfxtrx component."""
# pylint: disable=too-many-public-methods,protected-access
import unittest
import time
from homeassistant.bootstrap import _setup_component
from homeassistant.components import rfxtrx as rfxtrx
from tests.common import get_test_home_assistant
class TestRFXTRX(unittest.TestCas... | Zyell/home-assistant | tests/components/test_rfxtrx.py | Python | mit | 4,095 | 0 |
# -*- coding: utf-8 -*-
import click
from ..models import Post
@click.command()
@click.option('--title', default=None, help='Title of the Post')
def cli(title):
"Prints a list of posts"
posts = Post.objects
if title:
posts = posts(title=title)
for post in posts:
click.echo(post)
| seraphln/wheel | wheel/modules/posts/commands/listposts.py | Python | gpl-3.0 | 316 | 0 |
# -*- coding: utf-8 -*-
'''Custom exceptions for the framework.'''
import copy
import httplib as http
from flask import request
class FrameworkError(Exception):
"""Base class from which framework-related errors inherit."""
pass
class HTTPError(FrameworkError):
error_msgs = {
http.BAD_REQUEST: {
... | AndrewSallans/osf.io | framework/exceptions/__init__.py | Python | apache-2.0 | 2,900 | 0.007241 |
from __future__ import print_function, absolute_import
from pymatgen.io.adf import AdfKey, AdfTask, AdfOutput, AdfInput
from pymatgen.core.structure import Molecule
import unittest
import os
from os.path import join
__author__ = 'Xin Chen, chenxin13@mails.tsinghua.edu.cn'
test_dir = os.path.join(os.path.dirname(__f... | matk86/pymatgen | pymatgen/io/tests/test_adf.py | Python | mit | 10,190 | 0.000196 |
# -*- coding: utf-8 -*-
# Copyright 2007-2021 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | erh3cq/hyperspy | hyperspy/tests/component/test_exponential.py | Python | gpl-3.0 | 3,100 | 0.000323 |
import pytest
from webdriver.error import NoSuchElementException, StaleElementReferenceException
from tests.support.asserts import assert_error, assert_success
def refresh(session):
return session.transport.send(
"POST", "session/{session_id}/refresh".format(**vars(session)))
def test_null_response_va... | scheib/chromium | third_party/blink/web_tests/external/wpt/webdriver/tests/refresh/refresh.py | Python | bsd-3-clause | 3,290 | 0.000608 |
#!/usr/bin/python
import os
import re
from lxml import etree as et
import pcbmode.config as config
from . import messages as msg
# pcbmode modules
from . import utils
from .point import Point
def makeExcellon(manufacturer='default'):
"""
"""
ns = {'pcbmode':config.cfg['ns']['pcbmode'],
'svg... | ddm/pcbmode | pcbmode/utils/excellon.py | Python | mit | 4,661 | 0.00708 |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015-2020 Daniel Rodriguez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | mementum/backtrader | backtrader/feeds/rollover.py | Python | gpl-3.0 | 6,892 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-23 08:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0003_auto_20171221_0336'),
]
operations = [
migrations.AlterField... | jeffshek/betterself | events/migrations/0004_auto_20171223_0859.py | Python | mit | 1,984 | 0.00252 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | shelag/piggybank | saving/migrations/0001_initial.py | Python | mit | 1,468 | 0.004087 |
###############################################################################
# Name: ed_cmdbar.py #
# Purpose: Creates a small slit panel that holds small controls for searching #
# and other actions. #
... | beiko-lab/gengis | bin/Lib/site-packages/wx-2.8-msw-unicode/wx/tools/Editra/src/ed_cmdbar.py | Python | gpl-3.0 | 43,285 | 0.000924 |
__author__ = 'marcprengemann'
| winterDroid/android-drawable-importer-intellij-plugin | json_generator/__init__.py | Python | apache-2.0 | 30 | 0 |
#!/usr/bin/env python3
# Copyright (c) 2016-2019 The Starwels developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test Hierarchical Deterministic wallet function."""
from test_framework.test_framework import StarwelsTest... | starwels/starwels | test/functional/wallet_hd.py | Python | mit | 5,199 | 0.003847 |
# -*- coding: utf-8 -*-
"""
This Example will show you how to use CallbackData
"""
from telebot.callback_data import CallbackData, CallbackDataFilter
from telebot import types
from telebot.async_telebot import AsyncTeleBot
from telebot.asyncio_filters import AdvancedCustomFilter
API_TOKEN = 'TOKEN'
PRODUCTS = [
{... | eternnoir/pyTelegramBotAPI | examples/asynchronous_telebot/callback_data_examples/simple_products_example.py | Python | gpl-2.0 | 2,831 | 0.003535 |
from warpnet_framework.warpnet_client import *
from warpnet_framework.warpnet_common_params import *
from warpnet_experiment_structs import *
from twisted.internet import reactor
from datetime import *
from numpy import log10, linspace
import time
import sys
mods = [[2,2,2100,78-1]]
pktLens = [1412]; #range(1412, 91,... | shailcoolboy/Warp-Trinity | ResearchApps/Measurement/warpnet_coprocessors/phy_logger/examples/twoNode_cfoLogging.py | Python | bsd-2-clause | 6,164 | 0.034069 |
import os
from cement.core import backend, handler, output
from cement.utils import test, shell
from scilifelab.pm import PmApp
from data import setup_data_files
from empty_files import setup_empty_files
## Set default configuration
filedir = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
config_defaults... | SciLifeLab/scilifelab | tests/pm/test_default.py | Python | mit | 2,421 | 0.008674 |
# Copyright The PyTorch Lightning team.
#
# 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 i... | williamFalcon/pytorch-lightning | tests/loggers/test_wandb.py | Python | apache-2.0 | 9,157 | 0.001747 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2017 OSGeo
#
# 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 ... | cga-harvard/worldmap | worldmap/management/commands/fix_migrated_layers.py | Python | gpl-3.0 | 4,316 | 0.001854 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Gilbert88/mesos | src/python/cli_new/lib/cli/util.py | Python | apache-2.0 | 13,337 | 0 |
from collections import OrderedDict
from purl import URL as PURL
def URL(base, path, segments=None, defaults=None):
"""
URL segment handler capable of getting and setting segments by name. The
URL is constructed by joining base, path and segments.
For each segment a property capable of getting and se... | dr4ke616/LazyTorrent | application/lib/the_pirate_bay/utils.py | Python | gpl-3.0 | 2,327 | 0 |
#!/usr/bin/python2.7
# -*- encoding: UTF-8 -*-
# gps_test created on 15/8/22 上午12:44
# Copyright 2014 offbye@gmail.com
"""
"""
__author__ = ['"Xitao":<offbye@gmail.com>']
import gps3
gps_connection = gps3.GPSDSocket()
gps_fix = gps3.Fix()
try:
for new_data in gps_connection:
if new_data:
... | offbye/PiBoat | pyboat/gps_test.py | Python | apache-2.0 | 604 | 0.003333 |
from .models import EmailUser
class EmailOrPhoneModelBackend:
def authenticate(self, username=None, password=None):
if '@' in username:
kwargs = {'email__iexact': username}
else:
kwargs = {'phone': username}
try:
user = EmailUser.objects.get(**kwargs)
... | pannkotsky/groupmate | backend/apps/users/login_backend.py | Python | mit | 618 | 0 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "DjangoServer.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that... | AcroManiac/AcroLink | Server/DjangoServer/manage.py | Python | gpl-3.0 | 810 | 0 |
import unittest
from tests.test_basic import BaseTestCase
from datetime import timedelta, datetime, tzinfo
class UTC(tzinfo):
"""UTC"""
def utcoffset(self, dt):
return timedelta(0)
def tzname(self, dt):
return "UTC"
def dst(self, dt):
return timedelta(0)
class UtilTestCase(... | EricSchles/python-route53 | tests/test_util.py | Python | mit | 916 | 0.009825 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import os
def get_test_requirements_from_tox_ini(path):
result = []
between_begin... | suutari/shoop | shuup_setup_utils/parsing.py | Python | agpl-3.0 | 928 | 0 |
# 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
# d... | jianghuaw/nova | nova/api/openstack/placement/handler.py | Python | apache-2.0 | 9,268 | 0 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Utilities for console input and output.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import codecs
import locale
import re
import math
import multiprocessing
i... | joergdietrich/astropy | astropy/utils/console.py | Python | bsd-3-clause | 33,248 | 0.000211 |
#
# Copyright 2013 eNovance <licensing@enovance.com>
#
# Authors: Mehdi Abaakouk <mehdi.abaakouk@enovance.com>
#
# 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/l... | yanheven/ceilometer | ceilometer/alarm/evaluator/combination.py | Python | apache-2.0 | 4,511 | 0 |
class Solution(object):
def findMaxConsecutiveOnes(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
# sliding window
max_len = 0
li = 0
ri = 0
l = 0
inserted = False
for ri, rval in enumerate(nums):
if rval =... | daicang/Leetcode-solutions | 487-max-consecutive-ones-ii.py | Python | mit | 773 | 0.006468 |
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E08000032'
addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017.tsvJune2017.tsv'
stations_name = 'parl.2017-06-08/Version 1/Democracy_Club__0... | chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_bradford.py | Python | bsd-3-clause | 408 | 0.009804 |
# -*- coding: utf-8 -*-
##############################################################################
##############################################################################
{
'name': 'Account Banking Netixis Direct Debit',
'summary': 'Create Natixis files for Direct Debit',
'version': '7.0.0.2.0',... | noemis-fr/custom | account_banking_natixis_direct_debit/__openerp__.py | Python | gpl-3.0 | 1,248 | 0 |
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Joel Nothman <joel.nothman@gmail.com>
# Hamzeh Alsalhi <ha258@cornell.edu>
# Licens... | 0x0all/scikit-learn | sklearn/preprocessing/label.py | Python | bsd-3-clause | 28,286 | 0 |
import httplib
import json
import urlparse
import error
class Response(object):
"""Describes an HTTP response received from a remote en"Describes an HTTP
response received from a remote end whose body has been read and parsed as
appropriate."""
def __init__(self, status, body):
self.status = s... | mhaessig/servo | tests/wpt/web-platform-tests/tools/webdriver/webdriver/transport.py | Python | mpl-2.0 | 3,140 | 0.001274 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-tasks | samples/generated_samples/cloudtasks_v2beta2_generated_cloud_tasks_get_task_async.py | Python | apache-2.0 | 1,437 | 0.000696 |
# Copyright 2020 Red Hat, 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... | openstack/cinder | cinder/tests/unit/policies/test_default_volume_types.py | Python | apache-2.0 | 12,078 | 0.000662 |
from syncloud_platform.snap.models import App, AppVersions
from syncloud_platform.snap.snap import join_apps
def test_join_apps():
installed_app1 = App()
installed_app1.id = 'id1'
installed_app_version1 = AppVersions()
installed_app_version1.installed_version = 'v1'
installed_app_version1.current... | syncloud/platform | src/test/snap/test_snap.py | Python | gpl-3.0 | 1,740 | 0.000575 |
# Copyright 2018 Intel Corporation
#
# 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 writi... | plaidml/plaidml | plaidbench/plaidbench/cli.py | Python | apache-2.0 | 3,879 | 0.002578 |
import sublime
if int(sublime.version()) < 3000:
import ghci
import ghcmod
import haskell_docs
import hdevtools
import sublime_haskell_common as common
import symbols
else:
import SublimeHaskell.ghci as ghci
import SublimeHaskell.ghcmod as ghcmod
import SublimeHaskell.haskell_docs a... | hcarvalhoalves/SublimeHaskell | util.py | Python | mit | 2,159 | 0.012043 |
# import the basic python packages we need
import os
import sys
import tempfile
import pprint
import traceback
# disable python from generating a .pyc file
sys.dont_write_bytecode = True
# change me to the path of pytan if this script is not running from EXAMPLES/PYTAN_API
pytan_loc = "~/gh/pytan"
pytan_static_path =... | tanium/pytan | BUILD/doc/source/examples/export_resultset_csv_sensor_false_code.py | Python | mit | 3,040 | 0.002303 |
# vim: fileencoding=utf-8
"""
AppHtml settings
@author Toshiya NISHIO(http://www.toshiya240.com)
"""
defaultTemplate = {
'1) 小さいボタン': '${badgeS}',
'2) 大きいボタン': '${badgeL}',
'3) テキストのみ': '${textonly}',
"4) アイコン付き(小)": u"""<span class="appIcon"><img class="appIconImg" height="60" src="${icon60url}" style... | connect1ngdots/AppHtmlME | AppHtmlME.workflow/Scripts/apphtml_settings.py | Python | mit | 1,540 | 0.00411 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/cblas/package.py | Python | lgpl-2.1 | 2,365 | 0 |
# -*- coding: UTF-8 -*-
from django.core.cache import cache
from django.db.models.signals import post_delete, post_save
import functools
import hashlib
WEEK = 7 * 24 * 60 * 60 # 1 week
def cache_me(key=None, ikey=None, signals=(), models=(), timeout=WEEK):
def hashme(k):
if isinstance(k, unicode):
... | matrixise/epcon | microblog/dataaccess.py | Python | bsd-2-clause | 5,734 | 0.007499 |
from static import tools
class DrawAble(object):
def __init__(self,image,position,zIndex=0,activated=True):
self.image=image
self.position=position
self._zIndex=zIndex
self.__activated=None
self.activated=activated
def __del__(self):
self.activated=False
#zindex
def __getZIndex(self):
return... | gitlitz/pygame-with-interpreter | drawable.py | Python | gpl-3.0 | 750 | 0.064 |
#-*- coding:utf-8 -*-
'''
Created on 18/2/2015
@author: PC06
'''
from flaskext.mysql import MySQL
from flask import Flask
class DBcon():
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
pass
def conexion(self):
mysql = MySQL()
app =... | Elvirita/reposelvira | elviraae/ec/edu/itsae/conn/DBcon.py | Python | gpl-2.0 | 604 | 0.006623 |
from charmhelpers.cli import cmdline
from charmhelpers.core import hookenv
from charmhelpers.core import unitdata
from charms.reactive.bus import FlagWatch
from charms.reactive.trace import tracer
__all__ = [
'set_flag',
'clear_flag',
'toggle_flag',
'register_trigger',
'is_flag_set',
'all_fla... | juju-solutions/charms.reactive | charms/reactive/flags.py | Python | apache-2.0 | 9,936 | 0.000805 |
import time
import zipfile
from io import BytesIO
from django.utils.image import Image as D_Image
from django.core.files.base import ContentFile
from celery import task
from .models import Image
@task
def upload_zip(to_upload):
print("In the zip!")
zip = zipfile.ZipFile(to_upload.zip_file)
bad_file = zi... | dsimandl/teamsurmandl | gallery/tasks.py | Python | mit | 1,465 | 0.001365 |
# 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... | tensorflow/kfac | kfac/python/kernel_tests/periodic_inv_cov_update_kfac_opt_test.py | Python | apache-2.0 | 3,178 | 0.003776 |
from django.contrib import messages
from django.http import Http404, HttpResponse
from django.shortcuts import render
from corehq.apps.app_manager.dbaccessors import get_app
from corehq.apps.app_manager.decorators import require_deploy_apps, \
require_can_edit_apps
from corehq.apps.app_manager.xform import XForm
fr... | qedsoftware/commcare-hq | corehq/apps/app_manager/views/multimedia.py | Python | bsd-3-clause | 2,218 | 0.000451 |
# -*- 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... | mrshelly/openerp71313 | openerp/addons/hr_attendance/wizard/hr_attendance_error.py | Python | agpl-3.0 | 2,918 | 0.002742 |
#!/bin/env python3
"""
Copyright (C) 2014 by Yichao Zhou <broken.zhou AT gmail DOT com>
License: http://www.gnu.org/licenses/gpl.html GPL version 3 or higher
Any comments are welcome through email and github!
"""
import codecs
import re
import random
import os
import pexpect
import sys
import string
import time
from ... | zhou13/qtunneler | qtunneler.py | Python | gpl-3.0 | 16,827 | 0.002853 |
# -*- coding: utf-8 -*-
"""
Copyright © Val Neekman ([Neekware Inc.](http://neekware.com))
[ info@neekware.com, [@vneekman](https://twitter.com/vneekman) ]
All rights reserved.
Redistribution and use in source and binary forms,
with or without modification,
are permitted provided that the following condition... | TheOstrichIO/tomato-cmd | slugify.py | Python | apache-2.0 | 4,674 | 0.001498 |
# Copyright 2020 Tensorforce Team. 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 la... | reinforceio/tensorforce | tensorforce/environments/cartpole.py | Python | apache-2.0 | 8,953 | 0.002457 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('latest_tweets', '0010_photo_unique'),
]
operations = [
migrations.AddField(
model_name='photo',
name... | blancltd/django-latest-tweets | latest_tweets/migrations/0011_photo_image_file.py | Python | bsd-3-clause | 434 | 0.002304 |
from edc_constants.constants import YES, NEG
from .base_test_case import BaseTestCase
from .factories import MaternalConsentFactory, MaternalEligibilityFactory, PostnatalEnrollmentFactory
class TestMaternalLocator(BaseTestCase):
def setUp(self):
super(TestMaternalLocator, self).setUp()
self.mate... | botswana-harvard/microbiome | microbiome/apps/mb_maternal/tests/test_maternal_locator.py | Python | gpl-2.0 | 847 | 0.002361 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
# Copyright (C) Zing contributors.
#
# This file is a part of the Zing project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import json... | iafan/zing | pootle/core/views/api.py | Python | gpl-3.0 | 10,141 | 0.000197 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
from datetime import timedelta
from django.utils import timezone
from sentry.models import GroupResolution
from sentry.testutils import TestCase
class GroupResolutionTest(TestCase):
def setUp(self):
super(GroupResolutionTest... | ifduyue/sentry | tests/sentry/models/test_groupresolution.py | Python | bsd-3-clause | 2,921 | 0 |
# -*- coding: utf-8 -*-
'''A module to represent the text content of a playing card at a high level.'''
# This file is part of CBG.
#
# CBG 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 ... | veikman/cbg | cbg/content/card.py | Python | gpl-3.0 | 4,586 | 0.000436 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import time
try:
from f5.bigip import ManagementRoot
from icontrol... | mheap/ansible | lib/ansible/module_utils/network/f5/bigip.py | Python | gpl-3.0 | 3,738 | 0.001338 |
from textx.exceptions import TextXSemanticError
def query_processor(query):
if not query.condition is None:
query.condition.conditionName = adapter_for_query(query)
for query in query.parent.queries:
if (not hasattr(query, 'property')) and (query.sortBy not in query.parent.properties):
... | theshammy/GenAn | src/concepts/query.py | Python | mit | 1,811 | 0.009939 |
# -*- encoding:utf8 -*-
import cStringIO
import qrcode
class QRCodeCreator():
def __init__(self):
pass
def create(self, message):
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
... | supistar/Botnyan | model/qrcreator.py | Python | mit | 520 | 0 |
#! /user/bin/env python
__version__ = '0.8.53'
| jalanb/dotjab | src/python/__init__.py | Python | mit | 48 | 0 |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... | stdgregwar/elve | personaltypes.py | Python | lgpl-3.0 | 2,750 | 0.000727 |
from __future__ import unicode_literals
import django
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase, Client
from django.test.client import RequestFactory
from django.test.utils import override... | quamilek/django-custard | custard/tests/test.py | Python | mit | 13,067 | 0.004362 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import budgetdatapackage
import datapackage
import datetime
from nose.tools import raises
from datapackage import compat
class TestBudgetResourc... | trickvi/budgetdatapackage | tests/test_resource.py | Python | gpl-3.0 | 3,567 | 0 |
import asynchat
import socket
import errno
class vischat (asynchat.async_chat):
def __init__ (self, host, port):
self.host = host
self.port = port
self.outstanding = []
self.lines = []
self.buffer = ""
asynchat.async_chat.__init__ (self)
def handle_connect (self... | sit/dht | tools/vischat.py | Python | mit | 1,908 | 0.021488 |
# encoding: utf-8
# FastCGI-to-WSGI bridge for files/pipes transport (not socket)
#
# Copyright (c) 2002, 2003, 2005, 2006 Allan Saddi <allan@saddi.com>
# Copyright (c) 2011 - 2013 Ruslan Keba <ruslan@helicontech.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modif... | alexsilva/helicon-zoofcgi | zoofcgi.py | Python | mit | 34,047 | 0.001351 |
# -*- coding: utf-8 -*-
# Pluggable PayPal NVP (Name Value Pair) API implementation for Django.
# This file includes the PayPal driver class that maps NVP API methods to such
# simple functions.
# Feel free to distribute, modify or use any open or closed project without
# any permission.
# Author: Ozgur Vatansever
#... | leepa/django-paypal-driver | paypal/driver.py | Python | gpl-2.0 | 14,675 | 0.000409 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import json
from odoo import api, fields, models, exceptions, _
from odoo.addons.iap import jsonrpc
from requests.exceptions import ConnectionError, HTTPError
from odoo.addons.iap.models.iap import Insuffi... | t3dev/odoo | addons/partner_autocomplete/models/res_partner.py | Python | gpl-3.0 | 7,237 | 0.001935 |
# -*- coding: utf-8 -*-
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from django.contrib.gis.db import models
class AOIManager(models.GeoManager):
def ... | stephenrjones/geoq | geoq/core/managers.py | Python | mit | 1,155 | 0.001732 |
"""Learner that implements a greedy learning algorithm"""
import time
from pebl import network, result, evaluator
from pebl.util import *
from pebl.learner.base import *
class GreedyLearnerStatistics:
def __init__(self):
self.restarts = -1
self.iterations = 0
self.unimproved_iterations = ... | arnaudsj/pebl | src/pebl/learner/greedy.py | Python | mit | 4,765 | 0.003568 |
# Copyright 2009 Douglas Mayle
# This file is part of YAMLTrak.
# YAMLTrak is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
# ... | dmayle/YAMLTrak | yamltrak/commands.py | Python | gpl-3.0 | 11,746 | 0.004001 |
from openflow.optin_manager.sfa.util.method import Method
from openflow.optin_manager.sfa.trust.credential import Credential
from openflow.optin_manager.sfa.util.parameter import Parameter
class Update(Method):
"""
Update an object in the registry. Currently, this only updates the
PLC information associa... | dana-i2cat/felix | optin_manager/src/python/openflow/optin_manager/sfa/methods/Update.py | Python | apache-2.0 | 1,376 | 0.009448 |
import click
from images_of import command, settings, Reddit
from images_of.discord_announcer import DiscordBot, DiscordBotSettings
@command
@click.option('-G', '--no-github', is_flag=True, help='Do not process github events')
@click.option('-M', '--no-modlog', is_flag=True, help='Do not process network modlog events... | scowcron/ImagesOfNetwork | images_of/entrypoints/discord_announce_bot.py | Python | mit | 1,599 | 0.005629 |
# -*- coding: utf-8 -*-
__author__ = 'Juho Vepsäläinen'
__version__ = '0.7.5-dev'
| bebraw/speccer | speccer/__init__.py | Python | mit | 86 | 0.011905 |
import numpy as np
import scipy.optimize as opt
import unittest
def allocate(a, c, initial_guess):
def sum_positives(x):
return sum(i for i in x if i > 0)
def sum_negatives(x):
return -sum(i for i in x if i < 0)
pareto_ref = min(sum_positives(a), sum_negatives(a))
def sqr_sum(o,c):... | hugombarreto/credibility_allocation | allocators/optimization_allocation.py | Python | mit | 3,025 | 0.000661 |
import falcon
import msgpack
import json
from btree import BinaryTree
import ZODB, ZODB.FileStorage
import transaction
from persistent import Persistent
import uuid
import urllib
import btree
from pprint import pprint
class Collection (object):
def on_post(self, req, resp):
# req.stream corresponds to the WSGI wsgi.... | AgusRumayor/pypriorapi | order.py | Python | gpl-3.0 | 6,154 | 0.039812 |
import csv
import sys
import codecs
from pattern.en import sentiment
input_, output_ = str(sys.argv[1]), str(sys.argv[2])
with codecs.open('/output.txt', 'w') as fout:
writer = csv.writer(fout, delimiter='\t')
with codecs.open('/input.txt', 'r') as fin:
for l_i, line in enumerate(fin):
... | oaraque/sentiment-analysis | pattern/run.py | Python | mit | 639 | 0.001565 |
# expression.py
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Michael Bayer mike_mp@zzzcomputing.com
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Defines the base components of SQL expression trees.
All components are derived... | dbbhattacharya/kitsune | vendor/packages/sqlalchemy/lib/sqlalchemy/sql/expression.py | Python | bsd-3-clause | 152,008 | 0.003592 |
"""
reviewview.py
Contains administrative views for working with reviews.
"""
from admin_helpers import *
from flask import flash
from flask.ext.admin.actions import action
from flask.ext.admin.contrib.sqla import ModelView
from wtforms import IntegerField, validators
import remedy.rad.reviewservice
from remedy.rad.... | AllieDeford/radremedy | remedy/admin_views/reviewview.py | Python | bsd-3-clause | 4,932 | 0.00588 |
# -*- coding: utf-8 -*-
#
# django-timegraph - monitoring graphs for django
# Copyright (c) 2011-2012, Wifirst
# Copyright (c) 2013, Jeremy Lainé
# All rights reserved.
#
# See AUTHORS file for a full list of contributors.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permit... | jlaine/django-timegraph | timegraph/tests/test_timegraph.py | Python | bsd-2-clause | 13,243 | 0.003248 |
from __future__ import unicode_literals, division, absolute_import
import logging
import sys
import os
from flexget import plugin
from flexget.event import event
log = logging.getLogger('change')
found_deprecated = False
class ChangeWarn(object):
"""
Gives warning if user has deprecated / changed config... | voriux/Flexget | flexget/plugins/plugin_change_warn.py | Python | mit | 3,389 | 0.002951 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | dbbhattacharya/kitsune | vendor/packages/logilab-common/db.py | Python | bsd-3-clause | 2,037 | 0.003436 |
from concurrent.futures import ThreadPoolExecutor
import grpc
import pytest
from crawler.services import Library
import crawler_pb2_grpc
@pytest.fixture(name='grpc_client', scope='session', autouse=True)
def setup_grpc_client():
server = grpc.server(ThreadPoolExecutor(max_workers=4))
crawler_pb2_grpc.add_L... | xavierdutreilh/robots.midgar.fr | services/crawler/tests/conftest.py | Python | mit | 564 | 0.001773 |
__author__ = "Josh Perry"
import os
import shutil
import urllib2
import zipfile
import rarfile
from bs4 import BeautifulSoup
dumping_directory = "W:\Plugin repo\dump"
def save_file(url, filename):
filename = "out/" + filename
# Check if we already have it
if os.path.isfile(filename + ".zip") or os.pat... | josh-perry/NDSHomebrewDownloader | main.py | Python | mit | 3,662 | 0.001638 |
__author__ = 'Conscience'
from django.conf.urls import url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^$', views.post_list, name='post_list'),
url(r'^post/(?P<pk>[0-9]+)/$', views.post_detail, name='post_detail'),
url(r'^post/$', views.post_list, name='post_list'),
url(r... | Rivares/MyBlog | blog/urls.py | Python | apache-2.0 | 446 | 0.002242 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2017-08-24
git sha ... | lcoandrade/DsgTools | gui/CustomWidgets/BasicInterfaceWidgets/buttonPropWidget.py | Python | gpl-2.0 | 27,350 | 0.00106 |
"""Init file for the paci helpers"""
| tradebyte/paci | paci/helpers/__init__.py | Python | mit | 37 | 0 |
import logging
from json import JSONEncoder, dumps
from flask import current_app, make_response, request
__all__ = (
"serialize",
"jsonify",
)
log = logging.getLogger(__name__)
def serialize(rv):
log.debug("Serializing output")
if rv is None or (isinstance(rv, str) and not len(rv)):
log.in... | pegasus-isi/pegasus | packages/pegasus-python/src/Pegasus/service/_serialize.py | Python | apache-2.0 | 1,770 | 0.00113 |
#
# Copyright (c) 2009 Mason Green & Tom Novelli
#
# This file is part of OpenMelee.
#
# OpenMelee 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
# any later version.
#
# O... | zzzzrrr/openmelee | ai/ai.py | Python | gpl-3.0 | 2,647 | 0.005667 |
# -*- coding: utf-8 -*-
ESQUEMA_ATUAL = u'pl_005f'
#
# Envelopes SOAP
#
from .soap_100 import SOAPEnvio as SOAPEnvio_110
from .soap_100 import SOAPRetorno as SOAPRetorno_110
#
# Emissão de NF-e
#
from .nfe_110 import NFe as NFe_110
from .nfe_110 import NFRef as NFRef_110
from .nfe_110 import Det as Det_110
from .nf... | thiagopena/PySIGNFe | pysignfe/nfe/manual_300/__init__.py | Python | lgpl-2.1 | 1,984 | 0.017713 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import asyncio
import os
from azure.identity.aio import DefaultAzureCredential
from azure.keyvault.certificates import CertificateContentType, CertificatePolicy, WellKno... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-certificates/samples/import_certificate_async.py | Python | mit | 3,725 | 0.005101 |
import pybedtools
import os
testdir = os.path.dirname(__file__)
test_tempdir = os.path.join(os.path.abspath(testdir), 'tmp')
unwriteable = os.path.join(os.path.abspath(testdir), 'unwriteable')
def setup():
if not os.path.exists(test_tempdir):
os.system('mkdir -p %s' % test_tempdir)
pybedtools.set_temp... | jos4uke/getSeqFlankBlatHit | lib/python2.7/site-packages/pybedtools/test/tfuncs.py | Python | gpl-2.0 | 462 | 0.004329 |
from django import template
register = template.Library()
# Used to create the generated link url for the templates
@register.filter
def get_link_filter(obj, arg):
base = obj.get_link(arg)
return base
# Used to create the base url of the generated link for the templates
@register.filter
def get_base_link_fil... | djorda9/Simulated-Conversations | vagrant/simcon/templatetags/generatelink_extras.py | Python | mit | 376 | 0.007979 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | rcbops/glance-buildpackage | glance/registry/db/migration.py | Python | apache-2.0 | 3,992 | 0 |
# -*- coding: utf-8 -*-
# Author: <Your name>
# License see LICENSE
from PyKDE4.kdecore import i18n
from PyKDE4.kdeui import KAction, KIcon
from PyQt4.QtCore import QObject
from PyQt4.QtGui import QMenu
from libkatepate.errors import showOk, showError
import kate
class MyPlugin(QObject):
def __init__(self):
... | LarsBV/kate_plugin_template | my_plugin.py | Python | bsd-2-clause | 1,396 | 0.012894 |
"""
Utilities for managing Debian preseed
.. versionadded:: 2015.8.0
"""
import shlex
import salt.utils.files
import salt.utils.stringutils
import salt.utils.yaml
def mksls(src, dst=None):
"""
Convert a preseed file to an SLS file
"""
ps_opts = {}
with salt.utils.files.fopen(src, "r") as fh_:
... | saltstack/salt | salt/utils/preseed.py | Python | apache-2.0 | 2,707 | 0.002586 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.