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 |
|---|---|---|---|---|---|---|
from vsg.vhdlFile.classify import range_constraint
def detect(iToken, lObjects):
'''
integer_type_definition ::=
range_constraint
'''
return range_constraint.detect(iToken, lObjects)
| jeremiah-c-leary/vhdl-style-guide | vsg/vhdlFile/classify/integer_type_definition.py | Python | gpl-3.0 | 211 | 0 |
from __future__ import absolute_import
from tracer.query import Query
from tracer.resources.package import Package
from tracer.resources.applications import Application
from tracer.resources.processes import Process
__all__ = [
Query,
Package,
Application,
Process,
] | sean797/tracer | tracer/__init__.py | Python | gpl-2.0 | 273 | 0.018315 |
try:
a = 1
exce<caret> | caot/intellij-community | python/testData/keywordCompletion/exceptNotIndented.py | Python | apache-2.0 | 26 | 0.115385 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2010, Nicolas Clairon
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the abov... | goanpeca/mongokit | mongokit/operators.py | Python | bsd-3-clause | 3,264 | 0.000306 |
from django.contrib.gis.db import models
class SatYear(models.Model):
year = models.IntegerField(primary_key=True)
def __unicode__(self):
return str(self.year)
class Meta:
verbose_name = 'Year'
db_table = u'sat_year'
class Satellite(models.Model):
# id = model... | qliu/globe_nocturne | globenocturne/globenocturneapp/models.py | Python | gpl-2.0 | 10,974 | 0.013851 |
from reader import *
from dist import *
from sys import *
from table import *
def project(z,data):
d = anyi(data[z])
if d == len(data[z]):
d-=1
x = [0]*len(data[z])
y = [0]*len(data[z])
east = furthest(d,data,z)
west = furthest(data[z].index(east),data,z)
inde = data[z].index(east)
... | nave91/teak-nbtree | src/project.py | Python | gpl-2.0 | 1,490 | 0.043624 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
'''
Developer Navdeep Ghai
Email navdeep@korecent.com
License Korecent Solution Pvt. Ltd.
'''
import frappe
from frappe import _, msgprint, throw
from bcommerce.utils.api import get_connection, is_exists
from erpnext.controllers.item_variant import cr... | navdeepghai/bcommerce | bcommerce/utils/products.py | Python | mit | 13,513 | 0.038111 |
# 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 agreed to in... | sebrandon1/tempest | tempest/api/volume/admin/test_qos.py | Python | apache-2.0 | 6,582 | 0 |
#!/usr/bin/env python
# Standard library modules
import ConfigParser
import argparse
import os
import textwrap
def create_config(configuration):
""" Function used to create the configuration file
if it does not exist in the program's path.
It returns a ConfigParser object
"""
configuration.add_s... | vickz84259/XKCD | scripts/argument.py | Python | mit | 2,906 | 0 |
#
# This file is part of Dragonfly.
# (c) Copyright 2007, 2008 by Christo Butcher
# Licensed under the LGPL.
#
# Dragonfly 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 ... | summermk/dragonfly | dragonfly/language/other/number_arabic.py | Python | lgpl-3.0 | 5,267 | 0.016999 |
# import the necessary packages
from .mxalexnet import MxAlexNet
from .mxvggnet import MxVGGNet
from .mxgooglenet import MxGoogLeNet
from .mxresnet import MxResNet
from .mxsqueezenet import MxSqueezeNet
from .mxagegendernet import MxAgeGenderNet | CyberLabs-BR/face_detect | pyimagesearch/nn/mxconv/__init__.py | Python | mit | 245 | 0.004082 |
#!/usr/bin/env python
from setuptools import setup
from gun import __version__
setup(
name = 'gun',
version = __version__,
description = 'Gentoo Updates Notifier',
author = 'Andriy Yurchuk',
author_email = 'ayurchuk@minuteware.net',
url = 'https://github.com/Ch00k/gun',
licen... | Ch00k/gun | setup.py | Python | mit | 728 | 0.034341 |
#!/usr/bin/env python
# --!-- coding: utf8 --!--
"""
The converters package provide functions to quickly convert on the fly from
one format to another. It is responsible to check what external library are
present, and do the job as best as possible with what we have in hand.
"""
from manuskript.converters.abstractCon... | gedakc/manuskript | manuskript/converters/__init__.py | Python | gpl-3.0 | 1,027 | 0.000974 |
#coding=utf-8
#author: sloop
'''
ÈÎÎñ
PythonµÄos.pathÄ£¿éÌṩÁË isdir() ºÍ isfile()º¯Êý£¬Çëµ¼Èë¸ÃÄ£¿é£¬²¢µ÷Óú¯ÊýÅжÏÖ¸¶¨µÄĿ¼ºÍÎļþÊÇ·ñ´æÔÚ¡£
×¢Òâ:
1. ÓÉÓÚÔËÐл·¾³ÊÇÆ½Ì¨·þÎñÆ÷£¬ËùÒÔ²âÊÔµÄÒ²ÊÇ·þÎñÆ÷ÖеÄÎļþ¼ÐºÍÎļþ£¬¸Ã·þÎñÆ÷ÉÏÓÐ/data/webroot/resource/pythonÎļþ¼ÐºÍ/data/webroot/resource/python/test.txtÎļþ£¬´ó¼Ò¿ÉÒÔ... | GcsSloop/PythonNote | PythonCode/Python进阶/模块/导入模块.py | Python | apache-2.0 | 2,071 | 0.005311 |
# for localized messages
from . import _
from enigma import *
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.Sources.List import List
from Tools.Directories import resolveFilename, SCOPE_CURRENT_PLUGIN
from Tools.LoadPixmap import LoadPixmap
from Components.Button import B... | sklnet/opendroid-enigma2 | lib/python/Plugins/SystemPlugins/DeviceManager/HddSetup.py | Python | gpl-2.0 | 8,530 | 0.030481 |
#!/usr/bin/python2
# Written by Antonio Galea - 2010/11/18
# Distributed under Gnu LGPL 3.0
# see http://www.gnu.org/licenses/lgpl-3.0.txt
import sys,struct,zlib,os
from optparse import OptionParser
from intelhex import IntelHex
DEFAULT_DEVICE="0x0483:0xdf11"
DEFAULT_REVISION="0.0"
def named(tuple,names):
return ... | Baldanos/hydrafw | src/build-scripts/dfu-convert.py | Python | apache-2.0 | 5,855 | 0.029889 |
"""VMware vCenter plugin for integration tests."""
from __future__ import absolute_import, print_function
import os
from lib.cloud import (
CloudProvider,
CloudEnvironment,
)
from lib.util import (
find_executable,
display,
)
from lib.docker_util import (
docker_run,
docker_rm,
docker_in... | trondhindenes/ansible | test/runner/lib/cloud/vcenter.py | Python | gpl-3.0 | 5,079 | 0.002363 |
# coding=utf-8
"""Provider code for Speed.cd."""
from __future__ import unicode_literals
import logging
from medusa import tv
from medusa.bs4_parser import BS4Parser
from medusa.helper.common import (
convert_size,
try_int,
)
from medusa.logger.adapters.style import BraceAdapter
from medusa.providers.torren... | fernandog/Medusa | medusa/providers/torrent/html/speedcd.py | Python | gpl-3.0 | 7,255 | 0.002205 |
from abc import abstractmethod
class VIFDriver(object):
@abstractmethod
def after_device_destroy(self, environ, domxml):
return domxml
@abstractmethod
def after_device_create(self, environ, domxml):
return domxml
@abstractmethod
def after_network_setup(self, environ, json_co... | mmirecki/ovirt-provider-mock | vifdriver/vif_driver.py | Python | gpl-2.0 | 1,986 | 0 |
# coding: utf-8
from __future__ import unicode_literals
from collections import OrderedDict
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.core.urlresolvers import (
NoReverseMatch, Resolver404, get_script_prefix, resolve
)
from django.db.models import Manager
from django.... | saukrIppl/seahub | thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/relations.py | Python | apache-2.0 | 18,087 | 0.000829 |
#!/usr/bin/env python
from .HTMLElement import HTMLElement
from .attr_property import attr_property
from .compatibility import thug_long
class HTMLImageElement(HTMLElement):
def __init__(self, doc, tag):
HTMLElement.__init__(self, doc, tag)
align = attr_property("align")
alt ... | qistoph/thug | src/DOM/W3C/HTML/HTMLImageElement.py | Python | gpl-2.0 | 984 | 0.014228 |
'''
AceProxy default configuration script
DO NOT EDIT THIS FILE!
Copy this file to aceconfig.py and change only needed options.
'''
import logging
import platform
from aceclient.acemessages import AceConst
class AceDefConfig(object):
acespawn = False
acecmd = "acestreamengine --client-console"
acekey = '... | cosynus/python | acedefconfig.py | Python | mit | 1,800 | 0.001111 |
"""
======================================================
Effect of the shrinkage factor in random over-sampling
======================================================
This example shows the effect of the shrinkage factor used to generate the
smoothed bootstrap using the
:class:`~imblearn.over_sampling.RandomOverSamp... | fmfn/UnbalancedDataset | examples/over-sampling/plot_shrinkage_effect.py | Python | mit | 3,955 | 0.002528 |
from django.conf.urls.defaults import *
from searchv1.views import (
search, find_grids_autocomplete, find_packages_autocomplete, search_by_function_autocomplete,
search_by_category_autocomplete)
urlpatterns = patterns("",
url(
regex = '^$',
view = search,
name = ... | pythonchelle/opencomparison | apps/searchv1/urls.py | Python | mit | 1,067 | 0.049672 |
# Copyright 2014-2018 The PySCF Developers. 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 appl... | gkc1000/pyscf | examples/local_orb/pmloc.py | Python | apache-2.0 | 8,521 | 0.064312 |
from gensim.models.doc2vec import Doc2Vec, LabeledSentence
from nltk.tokenize import sent_tokenize, word_tokenize
from sup.progress import Progress
def train_doc2vec(paths, out='data/model.d2v', tokenizer=word_tokenize, sentences=False, **kwargs):
"""
Train a doc2vec model on a list of files.
"""
kwar... | frnsys/broca | broca/knowledge/doc2vec.py | Python | mit | 1,614 | 0.001239 |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import super
from future import standard_library
standard_library.install_aliases()
from vcfx.field.nodes import Field
class Categories(Field):
KEY = "C... | Pholey/vcfx | vcfx/field/explanatory/nodes.py | Python | mit | 1,485 | 0.012795 |
from flask import Flask
from flask_socketio import SocketIO
# создаем экземпляр класса Flask
app = Flask(__name__)
# создаем экземпляр класса SocketIO
socketio = SocketIO(app)
from app.views import home
| fouk666/xoxo | XOXO/app/__init__.py | Python | mit | 258 | 0.004673 |
# -*- coding: utf-8 -*-
# auxilium
# --------
# Python project for an automated test and deploy toolkit.
#
# Author: sonntagsgesicht
# Version: 0.1.8, copyright Saturday, 02 October 2021
# Website: https://github.com/sonntagsgesicht/auxilium
# License: Apache License 2.0 (see LICENSE file)
from datetime import ... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/auxilium/tools/setup_tools.py | Python | apache-2.0 | 3,576 | 0 |
import sys
from injector import Injector
def main():
path_exe = str(sys.argv[1])
path_dll = str(sys.argv[2])
injector = Injector()
pid = injector.create_process(path_exe)
injector.load_from_pid(pid)
injector.inject_dll(path_dll)
injector.unload()
if __name__ == "__main__":
main()
| numaru/injector | injector_cli.py | Python | gpl-3.0 | 318 | 0.003145 |
#!/usr/bin/python
"""
Copyright 2014 The Trustees of Princeton University
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 ... | jcnelson/syndicate | python/syndicate/observer/storage/common.py | Python | apache-2.0 | 2,548 | 0.02394 |
# Copyright 2015 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... | Eric-Gaudiello/tensorflow_dev | tensorflow_home/tensorflow_venv/lib/python3.4/site-packages/tensorflow/python/platform/default/_status_bar.py | Python | gpl-3.0 | 914 | 0.001094 |
from elasticsearch import Elasticsearch
import argparse
import os
import json
import re
def ExportDashboards(es, regex, kibana_index, output_directory):
res = es.search(
index=kibana_index,
doc_type="dashboard",
size=1000)
try:
reg_exp = re.compile(regex, re.IGNORECASE)
ex... | roncohen/apm-server | _beats/dev-tools/cmd/dashboards/export_5x_dashboards.py | Python | apache-2.0 | 3,663 | 0.001365 |
# -*- coding: utf-8 -*-
from flask import Blueprint
from jotonce.api import route
from jotonce.passphrases.models import Passphrase
bp = Blueprint('passphrase', __name__, url_prefix='/passphrase')
@route(bp, '/')
def get():
p = Passphrase.get_random()
return {"results": p}
| nficano/jotonce.com | jotonce/api/passphrases.py | Python | mit | 285 | 0 |
#!/usr/bin/python
'''Launches cassandra-stress instances in Marathon.'''
import json
import logging
import pprint
import random
import string
import sys
import urllib
# non-stdlib libs:
try:
import click
import requests
from requests.exceptions import HTTPError
except ImportError:
print("Failed to lo... | adobe-mds/dcos-cassandra-service | cassandra-test-client/launcher.py | Python | apache-2.0 | 8,836 | 0.007583 |
import bottle
from config import app, Session
from models.show_follow import ShowFollow
@app.get("/rest/show-follow/<show_id>")
def get_show_follow(session, show_id):
user_id = session.get("user_id")
if user_id:
sa_session = Session()
show_follow = sa_session.query(ShowFollow) \
... | smtheard/ShowTracker | controllers/show_follow.py | Python | gpl-3.0 | 1,287 | 0.002331 |
#!/usr/bin/env python3
import json
import re
import sys
def _decode_pattern_list(data):
rv = []
contains_dict = False
for item in data:
if isinstance(item, list):
item = _decode_pattern_list(item)
elif isinstance(item, dict):
item = _decode_pattern_dict(item)
... | rueckstiess/mtools | mtools/util/pattern.py | Python | apache-2.0 | 7,303 | 0.011368 |
"""
WSGI config for pyday2016 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... | fproldan/pyday2016 | pyday2016/wsgi.py | Python | gpl-3.0 | 396 | 0 |
#!/usr/bin/python3
import serial
import time
serialRFID = serial.Serial("/dev/ttyAMA0", 9600)
while True:
print (serialRFID.read(12)[1:11])
serialRFID.flushInput()
time.sleep(0.2)
| rainerraul/pi-python | rfr101a.py | Python | mit | 191 | 0.036649 |
from django.conf import settings
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^', include('howtostoreiosdata.wizard.urls', namespace="wizard")),
)
if settings.DEBUG:
urlpatterns += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_r... | erikr/howtostoreiosdata | howtostoreiosdata/urls.py | Python | mit | 355 | 0.008451 |
#!/usr/bin/env python
"""
A linting tool to check if templates are safe
"""
from enum import Enum
import os
import re
import sys
_skip_dirs = (
'/node_modules',
'/vendor',
'/spec',
'/.pycharm_helpers',
'/test_root',
'/reports/diff_quality',
'/common/static/xmodule/modules',
)
_skip_mako_dir... | solashirai/edx-platform | scripts/safe_template_linter.py | Python | agpl-3.0 | 30,181 | 0.001325 |
import numpy as np
from rampwf.score_types.soft_accuracy import SoftAccuracy
score_matrix_1 = np.array([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1],
])
score_matrix_2 = np.array([
[1, 0.5, 0],
[0.3, 1, 0.3],
[0, 0.5, 1],
])
y_true_proba_1 = np.array([1, 0, 0])
y_true_proba_2 = np.array([0, 1, 0])
y_tr... | paris-saclay-cds/ramp-workflow | rampwf/score_types/tests/test_soft_accuracy.py | Python | bsd-3-clause | 3,379 | 0 |
# Copyright (c) 2010-2011 OpenStack, LLC.
# Copyright (c) 2008-2011 Gluster, 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 ... | mja054/swift_plugin | swift/obj/server.py | Python | apache-2.0 | 39,651 | 0.001841 |
# -*- coding: utf-8 -*-
"""Librería para parsear entradas y salidas de Karel en XML."""
import xml.etree.ElementTree as ET
import sys
def load():
"""Regresa (input, output, nombre de caso) para la ejecución actual"""
with open('data.in', 'r') as data_in:
return KarelInput(data_in.read()), KarelOutput(sys.stdin.re... | rendon/omegaup | stuff/libkarel.py | Python | bsd-3-clause | 5,548 | 0.026073 |
def extractForthemoneyTranslations(item):
"""
Forthemoney Translations
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
return False
| fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractForthemoneyTranslations.py | Python | bsd-3-clause | 249 | 0.028112 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | Konubinix/qutebrowser | tests/unit/javascript/position_caret/test_position_caret.py | Python | gpl-3.0 | 3,322 | 0 |
# coding=utf-8
from rutermextract import TermExtractor
term_extractor = TermExtractor()
text = u'Съешь ещё этих мягких французских булок да выпей же чаю.'
for term in term_extractor(text):
print term.normalized, term.count | igor-shevchenko/rutermextract | example.py | Python | mit | 274 | 0.004386 |
listofcricket=['kohli','mathews','morgan','southee','tamim','smith']
print('Enter a name to search')
name = input()
if name not in listofcricket:
print(name+' is not in the list of cricketers')
else:
print(name+' is in this list')
| zac11/AutomateThingsWithPython | Lists/presence_of_element.py | Python | mit | 241 | 0.024896 |
# Generated by Django 2.1.7 on 2019-04-26 17:55
from django.db import migrations, models
from scheduler.models import RepeatableJob
from django.utils import timezone
from django_rq import job
@job("short")
def install_generate_summaries_job(apps, schema_editor):
job, created = RepeatableJob.objects.get_or_create... | SalesforceFoundation/mrbelvedereci | metaci/testresults/migrations/0013_install_summary_job.py | Python | bsd-3-clause | 1,046 | 0 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | qiita-spots/qp-qiime2 | qp_qiime2/util.py | Python | bsd-3-clause | 1,804 | 0 |
# -*- coding: utf-8 -*-
"""Model unit tests."""
import datetime as dt
import pytest
from blogaggregator.user.models import User, Role
from .factories import UserFactory
@pytest.mark.usefixtures('db')
class TestUser:
def test_get_by_id(self):
user = User('foo', 'foo@bar.com')
user.save()
... | andre-geldenhuis/bloggregator | blogaggregator/tests/test_models.py | Python | gpl-2.0 | 1,687 | 0.001186 |
import unittest
from leafpy import Leaf
from leafpy.auth import login
import vcr
USERNAME = 'dummyuser'
PASSWORD = 'dummypass'
class LoginTests(unittest.TestCase):
@vcr.use_cassette('tests/unit/cassettes/test_login.yaml',
filter_post_data_parameters=['UserId','Password'])
def test_login(self):
... | nricklin/leafpy | tests/unit/test_login.py | Python | mit | 2,246 | 0.008459 |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import unicode_literals
from collections import namedtuple
import json
import logging
import time
from collections import namedtuple
from slackclient import SlackClient
class SlackBot(object):
def __init__(self, settingsFilePath='settings.j... | mightypenguin/qotd | slackbot.py | Python | mit | 4,015 | 0.003736 |
#
# Copyright 2016 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | enigmampc/catalyst | catalyst/finance/performance/position_tracker.py | Python | apache-2.0 | 13,092 | 0.000076 |
from typing import Tuple
import torch
import torchvision
from torch import Tensor
from torchvision.extension import _assert_has_ops
from ..utils import _log_api_usage_once
from ._box_convert import _box_cxcywh_to_xyxy, _box_xyxy_to_cxcywh, _box_xywh_to_xyxy, _box_xyxy_to_xywh
def nms(boxes: Tensor, scores: Tensor, ... | pytorch/vision | torchvision/ops/boxes.py | Python | bsd-3-clause | 12,872 | 0.002331 |
from models.basemodel import BaseModel
class Campus(BaseModel):
CAMPUS_CODES = ['BD', 'DN', 'CS']
LONG_NAMES = {
'BD': 'University of Colorado, Boulder',
'DN': 'University of Colorado, Denver',
'CS': 'University of Colorado, Colorado Springs'
}
def requiredFields(self):
... | SFII/cufcq-new | models/campus.py | Python | mit | 1,334 | 0.004498 |
'''OpenGL extension NV.texture_env_combine4
This module customises the behaviour of the
OpenGL.raw.GL.NV.texture_env_combine4 to provide a more
Python-friendly API
Overview (from the spec)
New texture environment function COMBINE4_NV allows programmable
texture combiner operations, including
ADD ... | D4wN/brickv | src/build_data/windows/OpenGL/GL/NV/texture_env_combine4.py | Python | gpl-2.0 | 1,343 | 0.026806 |
# Copyright (c) 2016 Cisco Systems
# 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 require... | noironetworks/aci-integration-module | aim/tests/unit/test_infra_manager.py | Python | apache-2.0 | 3,823 | 0 |
from dotenv import load_dotenv
load_dotenv('./.env') | mbernson/iscp-search-engine | retrouve/__init__.py | Python | gpl-3.0 | 53 | 0.018868 |
"""
Base classes for test cases
Tests will usually inherit from one of these classes to have the controller
and/or dataplane automatically set up.
"""
import os
import logging
import unittest
import ptf
from ptf.base_tests import BaseTest
from ptf import config
import ptf.dataplane as dataplane
###################... | lmingcsce/p4factory | targets/sai_p4/tests/ptf-tests/sai_thrift/sai_base_test.py | Python | apache-2.0 | 1,788 | 0.002796 |
rn = ['I', 'bII', 'II', 'bIII', 'III', 'IV', 'bV', 'V', 'bVI', 'VI', 'bVII', 'VII']
header = []
for n in rn:
for next_n in rn:
header.append(n + '-' + next_n)
print(header)
print(len(header))
| corpusmusic/bb-cluster | obsolete_scripts/rn_header.py | Python | gpl-3.0 | 204 | 0.004902 |
from flask import Flask
from flask import render_template
app = Flask(__name__)
def info():
user = {
'nickname': 'Praful',
'key': 'A154XWA256'
}
posts = {
'company': 'Ethereal Machines',
'link': 'http://www.etherealmachines.com/',
'firmware' : 'Marlin Firmware',
... | abinashk-inf/AstroBox | src/astroprint/about/__init__.py | Python | agpl-3.0 | 441 | 0.004535 |
from __future__ import unicode_literals
from os.path import abspath, basename, dirname, join, normpath
from sys import path
import markdown
"""Common settings and globals."""
# PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolut... | eliostvs/django-kb-example | example/settings/settings/base.py | Python | bsd-3-clause | 7,689 | 0.00065 |
# -*- coding: utf-8 -*-
"""
Django settings for puput_demo project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_... | APSL/puput-demo | config/settings/common.py | Python | mit | 7,805 | 0.001025 |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | fogelomer/cloudify-filebeat-plugin | setup.py | Python | apache-2.0 | 1,438 | 0 |
# Copyright (C) 2011-2012 Google Inc.
# 2016 YouCompleteMe contributors
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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 versi... | oblitum/YouCompleteMe | python/ycm/vimsupport.py | Python | gpl-3.0 | 40,365 | 0.0301 |
"""
Almost all test cases covers both tag calling and template using.
"""
from __future__ import print_function, unicode_literals
from django.conf import settings as django_settings
from django.contrib.contenttypes.models import ContentType
from django.http import HttpRequest
from django.utils.six import assertCountE... | cXhristian/django-wiki | tests/core/test_template_tags.py | Python | gpl-3.0 | 10,375 | 0.000193 |
# missileThermalDmgBonusHeavy
#
# Used by:
# Implants named like: Zainou 'Snapshot' Heavy Missiles HM (6 of 6)
type = "passive"
def handler(fit, container, context):
fit.modules.filteredChargeBoost(lambda mod: mod.charge.requiresSkill("Heavy Missiles"),
"thermalDamage", contain... | Ebag333/Pyfa | eos/effects/missilethermaldmgbonusheavy.py | Python | gpl-3.0 | 369 | 0.00542 |
##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2013-2014, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... | cedriclaunay/gaffer | python/GafferImageTest/ImageReaderTest.py | Python | bsd-3-clause | 10,516 | 0.048117 |
from django.db import connection
from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.graph import MigrationGraph
from django.test import modify_settings, override_settings, TestCase
from django.apps.registry import apps as global_apps
from .test_base import MigrationTestBase
@modify... | Sonicbids/django | tests/migrations/test_executor.py | Python | bsd-3-clause | 19,946 | 0.001604 |
import cv2
import numpy as np
template = np.zeros((500,500,3),np.uint8)
template[:,:,0] = 255
template[:,:,1] = 255
template[:,:,2] = 255
x = [50,250,250,50,50]
y = [50,50,250,250,50]
cnt = np.asarray(zip(x,y))
cv2.drawContours(template,[cnt],0,0,1)
x = [100,200,200,100,100]
y = [300,300,150,150,300]
cnt = np.asar... | zooniverse/aggregation | docs/source/images/rectangle_overlap.py | Python | apache-2.0 | 713 | 0.093969 |
# Copyright 2011 OpenStack Foundation
# 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 requ... | cloudbau/nova | nova/tests/api/openstack/compute/test_limits.py | Python | apache-2.0 | 35,992 | 0.00025 |
# Copyright 2011 OpenStack Foundation
# 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 requ... | redhat-openstack/trove | trove/db/sqlalchemy/migrate_repo/versions/006_dns_records.py | Python | apache-2.0 | 1,320 | 0 |
#!/usr/bin/env python
# Raspberry Pi Rotary Encoder Class
# $Id: rotary_class.py,v 1.7 2017/01/07 11:38:47 bob Exp $
#
# Copyright 2011 Ben Buxton. Licenced under the GNU GPL Version 3.
# Contact: bb@cactii.net
# Adapted by : Bob Rathbone and Lubos Ruckl (Czech republic)
# Site : http://www.bobrathbone.com
#
# This c... | bobrathbone/piradio | rotary_class.py | Python | gpl-3.0 | 6,950 | 0.004317 |
###########################################################################
# Copyright (c) 2011-2014 Unixmedia S.r.l. <info@unixmedia.it>
# Copyright (c) 2011-2014 Franco (nextime) Lanza <franco@unixmedia.it>
#
# Domotika System Controller Daemon "domotikad" [http://trac.unixmedia.it]
#
# This file is part of domotik... | nexlab/domotikad | domotika/mediasources/modules/OpenPLI/__init__.py | Python | gpl-3.0 | 1,420 | 0.002113 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2014, 2015 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 optio... | jirikuncar/invenio-formatter | invenio_formatter/registry.py | Python | gpl-2.0 | 3,187 | 0.000314 |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# T... | Donkyhotay/MoonPy | zope/app/publication/publicationtraverse.py | Python | gpl-3.0 | 3,091 | 0.001941 |
# -*- coding: UTF-8 -*-
#/*
# * Copyright (C) 2011 Ivo Brhel
# *
# *
# * 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, or (at your option)
# * any later version.
#... | kodi-czsk/plugin.video.hejbejse.tv | resources/lib/hejbejse.py | Python | gpl-2.0 | 2,611 | 0.03447 |
# Copyright 2015 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... | cg31/tensorflow | tensorflow/python/kernel_tests/shape_ops_test.py | Python | apache-2.0 | 19,895 | 0.010003 |
from .stop_words import STOP_WORDS
from .lex_attrs import LEX_ATTRS
from .punctuation import TOKENIZER_SUFFIXES
from ...language import Language, BaseDefaults
class UrduDefaults(BaseDefaults):
suffixes = TOKENIZER_SUFFIXES
lex_attr_getters = LEX_ATTRS
stop_words = STOP_WORDS
writing_system = {"directi... | honnibal/spaCy | spacy/lang/ur/__init__.py | Python | mit | 461 | 0.002169 |
import MDAnalysis
from MDAnalysis.tests.datafiles import GRO, XTC
universe = MDAnalysis.Universe(GRO, XTC)
#old selection
all_selection = universe.selectAtoms('all')
#additional old selectAtoms selection (this comment shouldn't be modified despite containing the method name)
all_selection.selectAtoms('bynum 1:10')
#... | alejob/mdanalysis | package/MDAnalysis/migration/test_dummy_old_MDA_code.py | Python | gpl-2.0 | 6,334 | 0.018945 |
#
# QAPI introspection generator
#
# Copyright (C) 2015-2016 Red Hat, Inc.
#
# Authors:
# Markus Armbruster <armbru@redhat.com>
#
# This work is licensed under the terms of the GNU GPL, version 2.
# See the COPYING file in the top-level directory.
from qapi import *
# Caveman's json.dumps() replacement (we're stuck... | gongleiarei/qemu | scripts/qapi-introspect.py | Python | gpl-2.0 | 7,230 | 0.000138 |
# Copyright 2018 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 agre... | openstack/diskimage-builder | diskimage_builder/elements/package-installs/tests/test_package_squash.py | Python | apache-2.0 | 7,323 | 0 |
"""Provides VM delete parser."""
# Copyright (c) 2018 - I.T. Dev Ltd
#
# This file is part of MCVirt.
#
# MCVirt 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 ... | ITDevLtd/MCVirt | source/mcvirt-daemon/usr/lib/python2.7/dist-packages/mcvirt/parser_modules/virtual_machine/delete_parser.py | Python | gpl-2.0 | 2,888 | 0.003809 |
from __future__ import unicode_literals
import logging
from oauthlib.common import generate_token, urldecode
from oauthlib.oauth2 import WebApplicationClient, InsecureTransportError
from oauthlib.oauth2 import TokenExpiredError, is_secure_transport
import requests
log = logging.getLogger(__name__)
log.setLevel(loggi... | lucidbard/requests-oauthlib | requests_oauthlib/oauth2_session.py | Python | isc | 14,834 | 0.00209 |
"""
This sample shows how to loop through the folders
and print their titles
Python 2/3
ArcREST version 3.5.x
"""
from __future__ import print_function
from arcrest.security import AGOLTokenSecurityHandler
import arcrest
if __name__ == "__main__":
username = ""#Username
password = ""#password
... | BrunoCaimar/ArcREST | samples/change_folder.py | Python | apache-2.0 | 883 | 0.006795 |
# -*- coding: utf-8 -*-
"""
sleepy.models.user
~~~~~~~~~~~~~~~~~~
User model.
"""
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
pass
| YouNeedToSleep/sleepy | src/sleepy/models/user.py | Python | bsd-3-clause | 184 | 0 |
#!/usr/bin/env python
#
# vim: tabstop=4 expandtab shiftwidth=4 noautoindent
import sys
import os
import time
import atexit
from signal import SIGTERM
class Daemon:
"""A generic daemon class.
Usage: subclass the Daemon class and override the run() method"""
def __init__(self, pidfile, stdin='/dev/null',
... | crooks/nymserv | nymserv/daemon.py | Python | gpl-3.0 | 3,773 | 0.00053 |
from concurrent import futures
import time
import grpc
import demo_pb2
import demo_pb2_grpc
_ONE_DAY_IN_SECOND = 60 * 60 * 24
class Greeter(demo_pb2_grpc.GreeterServicer):
def SayHello(self,request,context):
return demo_pb2.HelloReply(message='Hello, %s' % request.name)
def serve():
#grpc服务器
... | tencrance/cool-config | python3/grpc/greeter_server.py | Python | mit | 690 | 0.01462 |
# Imports operators dynamically while keeping the package API clean,
# abstracting the underlying modules
from airflow.utils import import_module_attrs as _import_module_attrs
# These need to be integrated first as other operators depend on them
_import_module_attrs(globals(), {
'check_operator': [
'CheckO... | opensignal/airflow | airflow/operators/__init__.py | Python | apache-2.0 | 2,447 | 0.000409 |
# Copyright 2019 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | deepmind/open_spiel | open_spiel/python/games/data.py | Python | apache-2.0 | 1,333 | 0.002251 |
import discord
import asyncio
import datetime
import time
import aiohttp
import threading
import glob
import re
import json
import os
import urllib.request
from discord.ext import commands
from random import randint
from random import choice as randchoice
from random import choice as rndchoice
from random import shuffl... | IODisrupt/OmegaBot | cogs/runescapecompare.py | Python | gpl-3.0 | 2,978 | 0.01041 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# shablona documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 14 10:29:06 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... | neurohackweek/avalanche | doc/conf.py | Python | apache-2.0 | 9,704 | 0.004637 |
import sys
import os.path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'py'))
| kyungkoo/gae-ota-plist-maker | appengine_config.py | Python | mit | 160 | 0 |
# 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... | DavidNorman/tensorflow | tensorflow/python/ops/linalg/sparse/sparse.py | Python | apache-2.0 | 1,085 | 0 |
#!/usr/bin/env python
################################################################################
#
# print_dependencies.py
#
#
# Copyright (c) 10/9/2009 Leo Goodstadt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the... | jigneshvasoya/ruffus | ruffus/print_dependencies.py | Python | mit | 26,918 | 0.013485 |
import tensorgraph as tg
import numpy as np
import time
def test_SimpleBlocks():
X = np.random.rand(100, 200)
with open('X.npy', 'wb') as f:
np.save(f, X)
db = tg.SimpleBlocks(['X.npy']*10, batchsize=32, allow_preload=True)
t1 = time.time()
count = 1
for blk in db:
print(count... | hycis/TensorGraph | test/data_iterator_test.py | Python | apache-2.0 | 1,793 | 0.001673 |
import logging
import struct
from copy import deepcopy
from pymoku._oscilloscope import _CoreOscilloscope
from pymoku._instrument import to_reg_signed
from pymoku._instrument import from_reg_signed
from pymoku._instrument import to_reg_unsigned
from pymoku._instrument import from_reg_unsigned
from pymoku._instrument i... | liquidinstruments/pymoku | pymoku/_iirfilterbox.py | Python | mit | 32,876 | 0 |
#!/usr/bin/python
#
# mallocstacks Trace malloc() calls in a process and print the full
# stack trace for all callsites.
# For Linux, uses BCC, eBPF. Embedded C.
#
# This script is a basic example of the new Linux 4.6+ BPF_STACK_TRACE
# table API.
#
# Copyright 2016 GitHub, Inc.
# Licensed ... | tuxology/bcc | examples/tracing/mallocstacks.py | Python | apache-2.0 | 1,942 | 0.000515 |
#!/usr/bin/env python
#
# @copyright Ipdea Land, S.L.
#
# LGPL v3 - GNU LESSER GENERAL PUBLIC LICENSE
#
# This program 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.
#... | teenvio/SOAP-API | examples/example_soap.py | Python | lgpl-3.0 | 1,984 | 0.015121 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.