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 |
|---|---|---|---|---|---|---|
# (c) 2014, Maciej Delmanowski <drybjed@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ... | t794104/ansible | lib/ansible/plugins/filter/ipaddr.py | Python | gpl-3.0 | 32,458 | 0.000924 |
#!/usr/bin/env python
# Copyright (C) 2011 Aaron Lindsay <aaron@aclindsay.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 op... | aclindsa/asink-python | src/shared/daemon.py | Python | gpl-2.0 | 3,138 | 0.007648 |
import os
import codecs
try:
from setuptools import (setup, find_packages)
except ImportError:
from distutils.core import (setup, find_packages)
VERSION = (0, 2, 0)
__version__ = '.'.join(map(str, VERSION[:3])) + "".join(VERSION[3:])
__package_name__ = 'pelican-readtime'
__description__ = 'Plugin for Pelica... | JenkinsDev/pelican-readtime | setup.py | Python | mit | 2,230 | 0.000897 |
# -*- coding: utf-8 -*-
from django.core.exceptions import ValidationError
from django.forms.util import flatatt, ErrorDict, ErrorList
from django.test import TestCase
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy
class FormsUtilTestCase(TestCase):
# Tests fo... | LethusTI/supportcenter | vendor/django/tests/regressiontests/forms/tests/util.py | Python | gpl-3.0 | 3,154 | 0.008566 |
from django.contrib.auth import logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.signals import user_logged_out
from django.dispatch import receiver
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.views.decorators.cache import never_cache... | pcolmant/repanier | repanier/views/logout_view.py | Python | gpl-3.0 | 1,016 | 0.000984 |
#!/usr/bin/env python
#------------------------------------------------------------
# Script which demonstrates how to find the best-fit
# parameters of a Voigt line-shape model
#
# Vog, 26 Mar 2012
#------------------------------------------------------------
import numpy
from matplotlib.pyplot import figure, show, r... | kapteyn-astro/kapteyn | doc/source/EXAMPLES/kmpfit_voigt.py | Python | bsd-3-clause | 4,841 | 0.021483 |
from django.core import cache
from django.core.exceptions import MiddlewareNotUsed
from versionedcache.debug import CacheClass
class CacheDebugMiddleware(object):
def __init__(self):
if not isinstance(cache.cache, CacheClass):
raise MiddlewareNotUsed()
def process_request(self, request):
... | ella/django-versionedcache | versionedcache/middleware.py | Python | bsd-3-clause | 647 | 0.004637 |
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | zhaochao/fuel-web | fuel_agent/fuel_agent/objects/partition.py | Python | apache-2.0 | 11,745 | 0.000085 |
# -*- coding: utf-8 -*-
from sqlalchemy.ext.declarative import declarative_base
from zope.sqlalchemy import ZopeTransactionExtension
from sqlalchemy.orm import scoped_session, sessionmaker
DeclarativeBase = declarative_base()
maker = sessionmaker(autoflush=True, autocommit=False,
extension=Zo... | tongpa/tgext.pylogservice | tgext/pylogservice/models/__init__.py | Python | mit | 623 | 0.008026 |
# Copyright (C) 2010-2014 GRNET S.A.
#
# 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 i... | olgabrani/synnefo | snf-tools/synnefo_tools/burnin/cyclades_common.py | Python | gpl-3.0 | 30,688 | 0 |
# Copyright (C) 2008-2011 Dejan Muhamedagic <dmuhamedagic@suse.de>
# Copyright (C) 2013 Kristoffer Gronlund <kgronlund@suse.com>
# See COPYING for license information.
import os
import sys
import time
import re
import bz2
from . import config
from . import command
from . import completers as compl
from . import utils
... | ingted/crmsh | modules/ui_history.py | Python | gpl-2.0 | 23,658 | 0.001395 |
"""
Utilities to facilitate experimentation
"""
from __future__ import absolute_import
import logging
from decimal import Decimal
import six
from django.utils.timezone import now
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from course_modes.models import format_course_price, g... | ESOedX/edx-platform | lms/djangoapps/experiments/utils.py | Python | agpl-3.0 | 17,007 | 0.003763 |
#-*- coding: utf-8 -*-
import urllib2
import json
import CommonFunctions
common = CommonFunctions
from xml.dom import minidom
from resources.lib import utils
from resources.lib import globalvar
title=['ARTE']
img=['arte']
readyForUse=True
def fix_text(text):
return text.replace('&','&').encode('utf-... | julfla/plugin.video.freplay | resources/lib/channels/arte.py | Python | gpl-2.0 | 5,259 | 0.034417 |
"""Test cases for the switcher_kis component."""
from datetime import timedelta
from typing import TYPE_CHECKING, Any, Generator
from pytest import raises
from homeassistant.components.switcher_kis import (
CONF_AUTO_OFF,
DATA_DEVICE,
DOMAIN,
SERVICE_SET_AUTO_OFF_NAME,
SERVICE_SET_AUTO_OFF_SCHEMA... | tchellomello/home-assistant | tests/components/switcher_kis/test_init.py | Python | apache-2.0 | 5,602 | 0.000893 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='bloom',
version='0.4.4',
packages=find_packages(exclude=['test']),
package_data={
'bloom.generators.debian': [
'bloom/generators/debian/templates/*',
'bloom/generators/debian/templates/source... | 130s/bloom | setup.py | Python | bsd-3-clause | 2,778 | 0.00036 |
#!/usr/bin/env python
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# TODO: remove this script when GYP has for loops
from __future__ import print_function
import sys
import optparse
def main(argv... | endlessm/chromium-browser | build/apply_locales.py | Python | bsd-3-clause | 1,497 | 0.011356 |
###############################################################################
#
# Copyright 2010 Locomatix, 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.or... | locomatix/locomatix-python | locomatix/cli/__init__.py | Python | apache-2.0 | 3,074 | 0.006181 |
from cStringIO import StringIO
import os
import tarfile
import unittest
import tempfile
import shutil
import errno
import mock
from pulp.devel.unit.util import touch
from pulp.plugins.conduits.repo_publish import RepoPublishConduit
from pulp.plugins.config import PluginCallConfiguration
from pulp.plugins.model import ... | ipanova/pulp_puppet | pulp_puppet_plugins/test/unit/test_install_distributor.py | Python | gpl-2.0 | 24,167 | 0.002814 |
"""Redo the `...` (representation) but with limits on most sizes."""
__all__ = ["Repr","repr"]
class Repr:
def __init__(self):
self.maxlevel = 6
self.maxtuple = 6
self.maxlist = 6
self.maxdict = 4
self.maxstring = 30
self.maxlong = 40
self.maxother = 20
... | remybaranx/qtaste | tools/jython/lib/Lib/repr.py | Python | gpl-3.0 | 3,151 | 0.009838 |
import urllib,urllib2,re,cookielib,string,os,sys
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
from resources.libs import main
#Mash Up - by Mash2k3 2012.
from t0mm0.common.addon import Addon
from resources.universal import playbackengine, watchhistory
addon_id = 'plugin.video.movie25'
selfAddon = xbmcaddon.Addon(id=ad... | marduk191/plugin.video.movie25 | resources/libs/sports/skysports.py | Python | gpl-3.0 | 35,627 | 0.028012 |
#
# 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 us... | aokolnychyi/spark | python/pyspark/sql/context.py | Python | apache-2.0 | 24,880 | 0.002854 |
# Copyright 2011 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 agr... | ryantierney513/capirca | lib/speedway.py | Python | apache-2.0 | 1,410 | 0.00922 |
# Copyright 2013 NEC Corporation.
# 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... | queria/my-tempest | tempest/services/compute/xml/aggregates_client.py | Python | apache-2.0 | 5,059 | 0 |
"""luigi target for writing data into an HP Vertica database"""
import logging
import luigi
logger = logging.getLogger('luigi-interface') # pylint: disable-msg=C0103
try:
import vertica_python
except ImportError:
logger.warning("Attempted to load Vertica interface tools without the vertica_python package; w... | sssllliang/edx-analytics-pipeline | edx/analytics/tasks/util/vertica_target.py | Python | agpl-3.0 | 5,187 | 0.003085 |
from django import forms
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
from crispy_forms.bootstrap import FormActions, AppendedText, StrictButton, InlineField
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit, Button, Field, Hidden, HTML, Div
clas... | blacksph3re/alastair | alastair_cookie/forms.py | Python | gpl-2.0 | 1,349 | 0.029652 |
"""
WSGI config for PythonAnywhere test project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_AP... | hjwp/cookiecutter-example-project | config/wsgi.py | Python | mit | 1,632 | 0 |
#!/usr/bin/python
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
DOCUMENTATION = r'''
---
module: nxos_hsrp
extends_documentation_frag... | rosmo/ansible | lib/ansible/modules/network/nxos/nxos_hsrp.py | Python | gpl-3.0 | 15,408 | 0.001493 |
from elasticsearch import helpers
from c2corg_api.scripts.migration.batch import Batch
from elasticsearch.helpers import BulkIndexError
import logging
log = logging.getLogger(__name__)
class ElasticBatch(Batch):
"""A batch implementation to do bulk inserts for ElasticSearch.
Example usage:
batch =... | c2corg/v6_api | c2corg_api/scripts/es/es_batch.py | Python | agpl-3.0 | 1,426 | 0 |
from importlib import import_module
from django.apps import AppConfig as BaseAppConfig
class AppConfig(BaseAppConfig):
name = "gestioneide"
def ready(self):
import_module("gestioneide.receivers")
| Etxea/gestioneide | gestioneide/apps.py | Python | gpl-3.0 | 217 | 0 |
from timeit import timeit
import pytest
from cfme import test_requirements
from cfme.base.ui import navigate_to
from cfme.services.myservice import MyService
from cfme.tests.test_db_migrate import download_and_migrate_db
from cfme.utils.conf import cfme_data
@pytest.fixture
def appliance_with_performance_db(temp_ap... | nachandr/cfme_tests | cfme/tests/services/test_service_performance.py | Python | gpl-2.0 | 1,275 | 0.001569 |
import pandas as pd
class Status:
Instance = None
@classmethod
def add(cls, message, red = False, verbosity = 1):
cls.get().add_message(message, red, verbosity)
@classmethod
def initialize_status(cls, status_method, verbosity = 1):
# Note: verbosity must be pa... | clembou/PCWG | pcwg/core/status.py | Python | mit | 1,242 | 0.017713 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis_louvain | assessments/signals/subscribers.py | Python | agpl-3.0 | 2,029 | 0.001479 |
from server import app
app.run()
| billyoverton/demerit-manager | run_server.py | Python | gpl-2.0 | 33 | 0 |
"""An event loop.
This event loop should handle both asynchronous App Engine RPC objects
(specifically urlfetch, memcache and datastore RPC objects) and arbitrary
callback functions with an optional time delay.
Normally, event loops are singleton objects, though there is no
enforcement of this requirement.
The API h... | adviti/melange | thirdparty/google_appengine/google/appengine/ext/ndb/eventloop.py | Python | apache-2.0 | 7,479 | 0.009226 |
# See http://www.python.org/dev/peps/pep-0386/ for version numbering, especially NormalizedVersion
from distutils import version
version = version.LooseVersion('0.7.1-dev')
| foundit/Piped | contrib/zmq/piped_zmq/__init__.py | Python | mit | 173 | 0.00578 |
from stage import *
import os
use_gpu = os.environ.get('GNUMPY_USE_GPU', 'yes') == 'yes'
if use_gpu:
import gnumpy as gpu
import gnumpy as gnp
class Map(Stage):
def __init__(self,
outputDim,
activeFn,
inputNames=None,
initRange... | renmengye/imageqa-public | src/nn/map.py | Python | mit | 4,455 | 0.004265 |
# -*- coding: utf-8 -*-
"""
Runs functions in pipeline to get query reuslts and does some caching.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import utool as ut
import six # NOQA
from os.path import exists
#from ibeis.algo.hots import query_request
#from ibeis.algo.hots impo... | SU-ECE-17-7/ibeis | ibeis/algo/hots/match_chips4.py | Python | apache-2.0 | 15,985 | 0.001564 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-05-12 11:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ossuo', '0021_merge'),
('ossuo', '0022_signupformpage_signupformpagebullet_signupformpagelogo... | spketoundi/CamODI | waespk/core/migrations/0023_merge.py | Python | mit | 399 | 0.002506 |
# Copyright (c) 2012 NetApp, Inc. All rights reserved.
# Copyright (c) 2014 Ben Swartzlander. All rights reserved.
# Copyright (c) 2014 Navneet Singh. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
# Copyright (c) 2014 Alex Meade. All rights reserved.
# Copyright (c) 2014 Andrew Ker... | julianwang/cinder | cinder/volume/drivers/netapp/dataontap/block_base.py | Python | apache-2.0 | 37,442 | 0 |
from datetime import datetime
# pokemon lottery
global_lotto_last_run = datetime(1969, 12, 31, 23, 59, 59, 999999)
lotto_new_run = None
print_speed_base = 0.03 # delay between printed characters
""" Graphics Notes:
The screen is 15x11 squares in dimension. Each square is 16x16 pixels. Total
screen is 240x176. Sinc... | itsthejoker/Pokemon-Homage | lemonyellow/core/__init__.py | Python | mit | 1,110 | 0 |
"""Support for ESPHome binary sensors."""
import logging
from typing import TYPE_CHECKING, Optional
from homeassistant.components.binary_sensor import BinarySensorDevice
from . import EsphomeEntity, platform_async_setup_entry
if TYPE_CHECKING:
# pylint: disable=unused-import
from aioesphomeapi import BinaryS... | jamespcole/home-assistant | homeassistant/components/esphome/binary_sensor.py | Python | apache-2.0 | 2,003 | 0 |
# -*- coding: utf-8 -*-
import json
import pytest
from keyard_client import KeyardClient, testutils
@pytest.mark.skipif(not testutils.keyard_is_available(), reason="keyard is missing")
class TestKeyardClient(object):
def setup_method(self, method):
self.client = KeyardClient('http://127.0.0.1:8000')
... | rzanluchi/keyard-client | tests/test_client_integration.py | Python | mit | 890 | 0.001124 |
# -*- mode: python; fill-column: 100; comment-column: 100; -*-
import unittest
import sys
import os
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
import base_test
class ForwardTest(base_test.WebDriverBaseTest):
# Get a static page that must be the same upon refr... | qiuzhong/crosswalk-test-suite | misc/webdriver-w3c-tests/navigation/forward.py | Python | bsd-3-clause | 962 | 0.002079 |
import os
from cpenv import api, paths
from cpenv.cli import core
from cpenv.module import parse_module_path
class Create(core.CLI):
'''Create a new Module.'''
def setup_parser(self, parser):
parser.add_argument(
'where',
help='Path to new module',
)
def run(self... | cpenv/cpenv | cpenv/cli/create.py | Python | mit | 1,854 | 0 |
from typing import List, Optional, Sequence, Union
from decksite.data import achievements, deck, preaggregation, query
from decksite.data.models.person import Person
from decksite.database import db
from shared import dtutil, guarantee, logger
from shared.container import Container
from shared.database import sqlescap... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | decksite/data/person.py | Python | gpl-3.0 | 17,080 | 0.004859 |
#!/usr/bin/python
# (c) 2018 Jim Hawkins. MIT licensed, see https://opensource.org/licenses/MIT
# Part of Blender Driver, see https://github.com/sjjhsjjh/blender-driver
"""Python module for Blender Driver demonstration application.
Abstract base class for demonstration applications.
This module can only be used from ... | sjjhsjjh/blender-driver | applications/demonstration.py | Python | mit | 2,992 | 0.003676 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | MrSenko/Nitrate | tcms/core/contrib/auth/migrations/0001_initial.py | Python | gpl-2.0 | 867 | 0.002307 |
# Orbotor - arcade with orbit mechanics
# Copyright (C) 2014 mr555ru
#
# 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) an... | mr555ru/orbotor | orbotor/gameprofile.py | Python | gpl-3.0 | 8,679 | 0.004378 |
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | openstack/tripleo-common | tripleo_common/image/exception.py | Python | apache-2.0 | 991 | 0 |
"""Terminal management for exposing terminals to a web interface using Tornado.
"""
# Copyright (c) Jupyter Development Team
# Copyright (c) 2014, Ramalingam Saravanan <sarava@sarava.net>
# Distributed under the terms of the Simplified BSD License.
from __future__ import absolute_import, print_function
import asyncio... | takluyver/terminado | terminado/management.py | Python | bsd-2-clause | 12,822 | 0.000468 |
from django.utils.encoding import smart_unicode
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7,
... | rebost/django | django/contrib/localflavor/it/util.py | Python | bsd-3-clause | 1,800 | 0.001667 |
print "You enter a dark room with two doors. Do you go through door #1 or door #2?"
door = raw_input("> ")
if door == "1":
print "There`s a giant bear here eating a chees cake. What do you do?"
print "1. Take the cake."
print "2. Scream at the bear."
bear = raw_input("> ")
if bear == "1":
print "The bear e... | aleksl05/IS-206 | ex31.py | Python | gpl-3.0 | 982 | 0.037678 |
# Copyright 2013 Virantha Ekanayake 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... | virantha/pypdfocr | pypdfocr/pypdfocr_pdffiler.py | Python | apache-2.0 | 2,902 | 0.004824 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Ericsson AB
#
# 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 ... | EricssonResearch/calvin-base | calvinextras/calvinsys/data/buffer/PersistentBuffer.py | Python | apache-2.0 | 7,704 | 0.005582 |
"""Treadmill app configurator daemon, subscribes to eventmgr events.
"""
import click
from .. import appcfgmgr
def init():
"""Top level command handler."""
@click.command()
@click.option('--approot', type=click.Path(exists=True),
envvar='TREADMILL_APPROOT', required=True)
def top(... | keithhendry/treadmill | treadmill/sproc/appcfgmgr.py | Python | apache-2.0 | 452 | 0 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_02_01/aio/operations/_express_route_circuit_peerings_operations.py | Python | mit | 21,960 | 0.005237 |
#!/usr/bin/env python
import time
import json
import random
import re
from bottle import route, hook, response, run, static_file
@route('/')
def index():
return static_file('index.html', root = '.')
@route('/maptweets.js')
def index_css():
return static_file('maptweets.js', root = '.')
@route('/cross.jpg')
d... | relh/cathhacks | app.py | Python | mit | 626 | 0.038339 |
from __future__ import print_function, division
from sympy.core.numbers import nan
from .function import Function
class Mod(Function):
"""Represents a modulo operation on symbolic expressions.
Receives two arguments, dividend p and divisor q.
The convention used is the same as Python's: the remainder a... | Shaswat27/sympy | sympy/core/mod.py | Python | bsd-3-clause | 4,488 | 0.000223 |
#!/usr/bin/env python
#
# Copyright 2013, Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
"""Re-runs initial_sharding.py with a varbinary keyspace_id."""
from vtdb import keyrange_constants
import base_sharding
import initial_shar... | theskyinflames/bpulse-go-client | vendor/github.com/youtube/vitess/test/initial_sharding_bytes.py | Python | apache-2.0 | 553 | 0.003617 |
# 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
# distributed under th... | bytedance/fedlearner | web_console_v2/api/fedlearner_webconsole/workflow/cronjob.py | Python | apache-2.0 | 3,936 | 0.000254 |
"""Helper stuff for things"""
import gc
gc.disable()
print 'Disabled GC'
def timeit(func, iter = 1000, *args, **kwargs):
"""timeit(func, iter = 1000 *args, **kwargs) -> elapsed time
calls func iter times with args and kwargs, returns time elapsed
"""
import time
r = range(iter)
t = time... | hortonworks/hortonworks-sandbox | desktop/core/ext-py/Twisted/doc/core/benchmarks/timer.py | Python | apache-2.0 | 401 | 0.009975 |
class Excel(object):
def __init__(self, H, W):
"""
:type H: int
:type W: str
"""
self.table = [[{'v': 0, 'sum': None} for _ in range(ord(W) - 64)] for __ in range(H)]
def set(self, r, c, v):
"""
:type r: int
:type c: str
:type v: int
... | Mlieou/oj_solutions | leetcode/python/ex_631.py | Python | mit | 1,437 | 0.004175 |
# -*- coding: utf-8 -*-
# Authors: Y. Jia <ytjia.zju@gmail.com>
"""
Given a collection of intervals, merge all overlapping intervals.
https://leetcode.com/problems/merge-intervals/description/
"""
# Definition for an interval.
class Interval(object):
def __init__(self, s=0, e=0):
self.start = s
... | ytjia/coding-practice | algorithms/python/leetcode/MergeIntervals.py | Python | mit | 1,167 | 0 |
#AUTOGENERATED!!! Date: 2020-06-19 19:44:10.693270
from opcua.ua.uaerrors import UaStatusCodeError
class StatusCodes:
Good = 0
Uncertain = 0x40000000
Bad = 0x80000000
BadUnexpectedError = 0x80010000
BadInternalError = 0x80020000
BadOutOfMemory = 0x80030000
BadResourceUnavailable = 0x800400... | FreeOpcUa/python-opcua | opcua/ua/status_codes.py | Python | lgpl-3.0 | 38,535 | 0.005969 |
# Copyright Kevin Deldycke <kevin@deldycke.com> and contributors.
# All Rights Reserved.
#
# 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) ... | kdeldycke/meta-package-manager | meta_package_manager/tests/test_cli_install.py | Python | gpl-2.0 | 2,682 | 0.001864 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | colinbrislawn/scikit-bio | skbio/sequence/_sequence.py | Python | bsd-3-clause | 83,555 | 0.000108 |
from JumpScale import j
import JumpScale.baselib.redis
import JumpScale.grid.jumpscripts
class CmdRouter(object):
def __init__(self, path=None):
j.core.jumpscripts.load(path)
def route(self,organization,actor,name,**args):
pass
| Jumpscale/jumpscale6_core | lib/JumpScale/baselib/cmdrouter/CmdRouter.py | Python | bsd-2-clause | 264 | 0.018939 |
import pandas as pd
adv = pd.read_csv('Advertising.csv')
tv_budget_x = adv.TV.tolist()
print(tv_budget_x)
| akanuragkumar/tensorflow-basics | ex1.py | Python | gpl-3.0 | 110 | 0.009091 |
from .actions import *
from .actions_re import *
from .expectations import *
| spyoungtech/behave-webdriver | behave_webdriver/steps/__init__.py | Python | mit | 77 | 0 |
"""
Support for an interface to work with a remote instance of Home Assistant.
If a connection error occurs while communicating with the API a
HomeAssistantError will be raised.
For more details about the Python API, please refer to the documentation at
https://home-assistant.io/developers/python_api/
"""
from dateti... | mikaelboman/home-assistant | homeassistant/remote.py | Python | mit | 15,888 | 0 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from miasm2.expression.expression import ExprId
from miasm2.core.cpu import gen_reg, gen_regs
gen_reg('PC', globals())
gen_reg('PC_FETCH', globals())
gen_reg('R_LO', globals())
gen_reg('R_HI', globals())
exception_flags = ExprId('exception_flags', 32)
PC_init = ExprId("... | rom1sqr/miasm | miasm2/arch/mips32/regs.py | Python | gpl-2.0 | 1,927 | 0.00467 |
from __future__ import absolute_import
from __future__ import division
from builtins import next
from builtins import zip
from builtins import range
from past.utils import old_div
from builtins import object
import itertools as it
import abc
import numpy as np
import sima
from . import _motion as mc
from future.utils... | pkaifosh/sima | sima/motion/motion.py | Python | gpl-2.0 | 10,210 | 0 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
import sys
from Muon.GUI.Common.muon_load_dat... | mganeva/mantid | scripts/test/Muon/frequency_domain_context_test.py | Python | gpl-3.0 | 2,194 | 0.002735 |
from distutils.core import setup
setup(name='robotframework-wiremock',
packages=['WireMockLibrary'],
package_dir={'': 'src'},
version='development',
description='Robot framework library for WireMock',
author='Timo Yrjola',
author_email='timo.yrjola@gmail.com',
classifiers=[])
| tyrjola/robotframework-wiremock | resources/scripts/setup.py | Python | mit | 320 | 0 |
"""Generated message classes for bigtableadmin version v2.
"""
# NOTE: This file is autogenerated and should not be edited by hand.
from apitools.base.protorpclite import messages as _messages
from apitools.base.py import encoding
from apitools.base.py import extra_types
package = 'bigtableadmin'
class Bigtablead... | Sorsly/subtle | google-cloud-sdk/lib/googlecloudsdk/third_party/apis/bigtableadmin/v2/bigtableadmin_v2_messages.py | Python | mit | 40,478 | 0.004595 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'MODEL1006230013.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/MODEL1006230013 | MODEL1006230013/model.py | Python | cc0-1.0 | 427 | 0.009368 |
from django.apps import AppConfig
class TagsConfig(AppConfig):
name = "hav.apps.tags"
| whav/hav | src/hav/apps/tags/apps.py | Python | gpl-3.0 | 92 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# MODIFIED FROM ORIGINAL VERSION
#
# This file is not the same as in pypi. It includes a pull request to fix py3
# incompabilities that never ended up getting merged.
###########################... | psistats/linux-client | psistats/libsensors/lib/sensors.py | Python | mit | 8,525 | 0.002346 |
from __future__ import absolute_import, print_function, division
from pony.py23compat import PY2, basestring, unicode, buffer, int_types
import os, re, json
from decimal import Decimal, InvalidOperation
from datetime import datetime, date, time, timedelta
from uuid import uuid4, UUID
import pony
from pony.ut... | Ahmad31/Web_Flask_Cassandra | flask/lib/python2.7/site-packages/pony/orm/dbapiprovider.py | Python | apache-2.0 | 33,878 | 0.009947 |
#!/usr/bin/python3
# Copyright (C) 2015 Bitquant Research Laboratories (Asia) Limited
# Released under the Simplified BSD License
import my_path
import time
import zmq.green as zmq
import pprint
import algobroker
import msgpack
class Dispatcher(algobroker.Broker):
def __init__(self):
algobroker.Broker._... | joequant/algobroker | algobroker/dispatcher.py | Python | bsd-2-clause | 1,618 | 0.000618 |
# -*- coding: utf-8 -*-
import re
import json
import traceback
import sys
import time
import datetime
import random
# 这段代码是用于解决中文报错的问题
reload(sys)
sys.setdefaultencoding("utf8")
from datetime import date
from scrapy.selector import Selector
from dateutil.relativedelta import relativedelta
if __name__ == '__main__':
... | Svolcano/python_exercise | dianhua/worker/crawler/china_telecom/neimenggu/main.py | Python | mit | 17,659 | 0.003293 |
# -*- coding: utf-8 -*-
import sys
import os
from os.path import dirname
# Set the directory for using the modules in the same project such as eshop.
PROJECT_PATH = dirname(os.path.abspath(os.path.dirname(__file__)))
ESHOP_PATH = os.path.join(PROJECT_PATH, 'eshop/')
sys.path.append(PROJECT_PATH)
| mikuyves/fashion-finder | flickr/settings.py | Python | gpl-3.0 | 298 | 0 |
# -*- coding: utf-8 -*-
import re
from channels import renumbertools
from channelselector import get_thumb
from core import httptools
from core import scrapertools
from core import servertools
from core import tmdb
from core.item import Item
from platformcode import config, logger
from channels import autoplay
IDIO... | pitunti/alfaPitunti | plugin.video.alfa/channels/anitoonstv.py | Python | gpl-3.0 | 6,699 | 0.005526 |
from django.core.exceptions import ValidationError
from django.db import IntegrityError, models, transaction
from django.test import SimpleTestCase, TestCase
from .models import BooleanModel, FksToBooleans, NullBooleanModel
class BooleanFieldTests(TestCase):
def _test_get_prep_value(self, f):
self.assert... | tbeadle/django | tests/model_fields/test_booleanfield.py | Python | bsd-3-clause | 4,416 | 0.000226 |
# -*- coding: utf-8 -*-
"""Defines mixing class.
You can use it for inherit from Class Base Views, it was
developed by Timothée Peignier https://gist.github.com/cyberdelia/1231560
"""
from django.contrib.auth.decorators import login_required
from django.utils.cache import patch_response_headers
from django.utils.deco... | dairdr/voteapp | voteapp/apps/vote/mixing.py | Python | mit | 1,724 | 0.020894 |
# Copyright (c) 2014 RainMachine, Green Electronics LLC
# All rights reserved.
# Authors: Nicu Pavel <npavel@mini-box.com>
# Codrin Juravle <codrin.juravle@mini-box.com>
from datetime import datetime, timedelta, tzinfo
from math import sin, cos, asin, acos, sqrt
import time, calendar
import ctypes,os, fcntl,... | sprinkler/rainmachine-developer-resources | sdk-parsers/RMUtilsFramework/rmTimeUtils.py | Python | gpl-3.0 | 12,413 | 0.01007 |
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# 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 ... | Micronaet/micronaet-production | working_bom/__openerp__.py | Python | agpl-3.0 | 1,492 | 0.00067 |
"""
WSGI config for opendai_lleida_web project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APP... | open-dai/bcn-lleida-opendai-pilots | web-geo-server/admin_web/wsgi.py | Python | lgpl-3.0 | 1,160 | 0.001724 |
from .data_asset import DataAsset
from .file_data_asset import FileDataAsset
| great-expectations/great_expectations | great_expectations/data_asset/__init__.py | Python | apache-2.0 | 77 | 0 |
import connect_tests
import string_utils_tests
| doubleO8/versionone-sdk-spoon | versio9/tests/__init__.py | Python | bsd-3-clause | 49 | 0 |
#!/usr/bin/env python
# encoding:utf-8
"""
@software: PyCharm
@file: video_db.py
@time: 2016/8/4 16:56
"""
import sqlite3
class Create_DB():
def __init__(self):
self.conn = sqlite3.connect('video.db')
self.cn = self.conn.cursor()
def create_table(self, table):
# 创建表格 table == 创建表命令
... | bjweiqm/Sele | school/pachong/video_db.py | Python | gpl-2.0 | 534 | 0.002 |
"""Tests for 'site'.
Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.
"""
import unittest
from test.test_support import run_unittest, TESTFN, EnvironmentVarGuard
from test.test_support import captured_output
import __builtin__
import os
import sys
... | j5shi/Thruster | pylibs/test/test_site.py | Python | gpl-2.0 | 15,991 | 0.001688 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/OSIS-Louvain | education_group/tests/ddd/factories/domain/campus.py | Python | agpl-3.0 | 1,589 | 0.00063 |
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
## test with python setup.py develop
setup(
name='ipyreload',
packages=['ipyreload'],
version= 1.2,
description='ipython productivity tools',
long_description=readme(),
url="https:/... | wolfiex/ipython-dev-reload | setup.py | Python | mit | 529 | 0.009452 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# url_read.py file is part of slpkg.
# Copyright 2014-2021 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redis... | dslackw/slpkg | slpkg/url_read.py | Python | gpl-3.0 | 1,692 | 0.000591 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This script is based on chromium/chromium/master/tools/clang/scripts/update.py.
It is used on Windows platforms to copy the co... | chinmaygarde/flutter_engine | tools/dia_dll.py | Python | bsd-3-clause | 2,094 | 0.011939 |
"""
Views to support exchange of authentication credentials.
The following are currently implemented:
1. AccessTokenExchangeView:
3rd party (social-auth) OAuth 2.0 access token -> 1st party (open-edx) OAuth 2.0 access token
2. LoginWithAccessTokenView:
1st party (open-edx) OAuth 2.0 access token -... | fintech-circle/edx-platform | openedx/core/djangoapps/auth_exchange/views.py | Python | agpl-3.0 | 7,236 | 0.002349 |
import android
class SMSPoolMember:
def __init__(self, query):
self.droid = android.Android()
self.query = str(query).lstrip().rstrip()
def wifiConnected(self):
none = "<unknown ssid>"
return not self.droid.wifiGetConnectionInfo().result["ssid"] == none
def dataConnected... | wallarelvo/eneza-server | smsserver/poolmember.py | Python | apache-2.0 | 584 | 0.001712 |
import caffe
import numpy as np
import pdb
class MyLossLayer(caffe.Layer):
"""Layer of Efficient Siamese loss function."""
def setup(self, bottom, top):
self.margin = 10
print '*********************** SETTING UP'
pass
def forward(self, bottom, top):
"""The parameters here ... | xialeiliu/RankIQA | src/MyLossLayer/netloss_tid2013.py | Python | mit | 1,910 | 0.013613 |
#!/usr/bin/env python3
import sys
if len(sys.argv) != 2:
raise SystemExit('Incorrect usage. Use: ' + sys.argv[0] + ' <image.img>')
image_filename = sys.argv[1]
content = ''
with open(image_filename, 'rb') as f:
content = bytearray(f.read())
bytes_to_append = 512 - len(content) % 512
for i in range(b... | qwercik/brainfuckOS | utils/align-to-full-sector.py | Python | mit | 467 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.