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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2013 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 t... | Dziolas/invenio | modules/miscutil/lib/htmlutils.py | Python | gpl-2.0 | 37,499 | 0.004293 |
import math, os
import pygame
import thorpy
has_surfarray = False
try:
from PyWorld2D.rendering.tilers.beachtiler import BeachTiler
from PyWorld2D.rendering.tilers.basetiler import BaseTiler
from PyWorld2D.rendering.tilers.roundtiler import RoundTiler
from PyWorld2D.rendering.tilers.loadtiler import Lo... | YannThorimbert/PyWorld2D | rendering/tilers/tilemanager.py | Python | mit | 11,093 | 0.009015 |
# coding: utf-8
#
# Copyright © 2012-2014 Ejwa Software. All rights reserved.
#
# This file is part of gitinspector.
#
# gitinspector 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 Lic... | vpol/gitinspector | gitinspector/filtering.py | Python | gpl-3.0 | 5,218 | 0.003642 |
# -*- coding: utf-8 -*-
import os
from mock import Mock, patch
from maidchan.translate import get_trans_language_prediction, get_translation
SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
def _get_response(name):
path = os.path.join(SCRIPT_PATH, 'data', name)
with open(path) as f:
return ... | freedomofkeima/messenger-maid-chan | tests/test_translate.py | Python | mit | 1,946 | 0 |
#from PySide import QtGui, QtCore
#from cube_list import CubeItem, RootItem
#
#class TreeModel(QtGui.QStandardItemModel):
# def __init__(self, rows, columns, contCubes, indCubes, parent = None):
# super(TreeModel, self).__init__(rows, columns, parent)
# self.contCubes = contCubes
# self.i... | Snegovikufa/HPGL-GUI | gui_widgets/treemodel.py | Python | gpl-2.0 | 12,137 | 0.004696 |
# -*- coding: utf-8 -*-
import random
import pytest
from holviapi.utils import (
ISO_REFERENCE_VALID,
fin_reference_isvalid,
int2fin_reference,
iso_reference_isvalid,
str2iso_reference
)
def test_fin_reference_isvalid_valid_results():
"""Test handpicked, known-good inputs"""
assert fin_re... | rambo/python-holviapi | holviapi/tests/test_refnos.py | Python | mit | 2,888 | 0 |
#!/usr/bin/env python3.4
# -*- coding: utf-8 -*-
| welblade/pyrom | test/__init__.py | Python | mit | 49 | 0 |
import pytest
from awsshell.fuzzy import fuzzy_search
@pytest.mark.parametrize("search,corpus,expected", [
('foo', ['foobar', 'foobaz'], ['foobar', 'foobaz']),
('f', ['foo', 'foobar', 'bar'], ['foo', 'foobar']),
('fbb', ['foo-bar-baz', 'fo-ba-baz', 'bar'], ['foo-bar-baz', 'fo-ba-baz']),
('fff', ['fi-f... | awslabs/aws-shell | tests/unit/test_fuzzy.py | Python | apache-2.0 | 629 | 0 |
from akara.dist import setup
setup(name="basic",
version="1.0",
akara_extensions=["blah.py"]
)
| uogbuji/akara | test/setup_scripts/setup_basic.py | Python | apache-2.0 | 108 | 0.009259 |
import os
import re
import sys
import copy
import pickle
from urllib.request import urlopen
from urllib.error import HTTPError
from urllib.parse import urlencode
try:
import pylast
has_pylast = True
except ImportError:
has_pylast = False
import pafy
from . import g, c, paths, util
mswin = os.name == "n... | np1/mps-youtube | mps_youtube/config.py | Python | gpl-3.0 | 13,150 | 0.001217 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2, re, json, time, xbmc, traceback
from _header import *
BASE_URL = 'http://cinemaonline.kg/'
BASE_NAME = 'Cinema Online'
BASE_LABEL = 'oc'
GA_CODE = 'UA-34889597-1'
NK_CODE = '1744'
def default_oc_noty():
plugin.notify('Сервер недоступен', BASE_NAME, image=... | delletenebre/xbmc-addon-kilogramme | plugin.video.kilogramme/resources/lib/site_ockg.py | Python | gpl-3.0 | 20,423 | 0.0036 |
#!/usr/bin/python
NWID=1
NR_NODES=20
#Controllers=[{"ip":'127.0.0.1', "port":6633}, {"ip":'10.0.1.28', "port":6633}]
Controllers=[{"ip":'10.0.1.28', "port":6633}]
"""
Start up a Simple topology
"""
from mininet.net import Mininet
from mininet.node import Controller, RemoteController
from mininet.log import setLogLeve... | opennetworkinglab/spring-open | old-scripts/test-network/mininet/net.sprint5-templete.py | Python | apache-2.0 | 4,452 | 0.02628 |
#!python
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (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.mozilla.org/MPL/
#... | anisku11/sublimeku | Packages/CodeComplice/libs/codeintel2/udl.py | Python | mit | 23,772 | 0.000463 |
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# Copyright 2018 ACSONE SA/NV.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
import json
import logging
import os
from openerp import api, exceptions, models, tools
from openerp.modules.module import get_module_path
from ..addon_hash import addo... | ddico/server-tools | module_auto_update/models/module.py | Python | agpl-3.0 | 6,204 | 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
# distributed under t... | midonet/kuryr | kuryr/schemata/endpoint_delete.py | Python | apache-2.0 | 1,400 | 0 |
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
# imports - standard imports
import gzip
import importlib
import json
import os
import shlex
import shutil
import subprocess
import unittest
from contextlib import contextmanager
from functools import wraps
from glob impor... | frappe/frappe | frappe/tests/test_commands.py | Python | mit | 22,402 | 0.025266 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
DOCUMENTATION = """
---
module: kube
short_description: Manage Kubernetes Cluster
description:
- Create, replace, remove, and stop resources within a Kubernetes Cluster
version_added: "2.0"
options:
name:
required: false
default: null
description:
- The n... | insequent/kargo | library/kube.py | Python | apache-2.0 | 8,694 | 0.00161 |
'''
Created on 26/09/2014
@author: javgar119
'''
cluster_list =([Cluster(set([]), 0, 0, 1, 0),
Cluster(set([]), 1, 0, 1, 0)])
cluster_list2 = ([Cluster(set([]), 0, 0, 1, 0),
Cluster(set([]), 1, 0, 1, 0),
Cluster(set([]), 2, 0, 1, 0... | JavierGarciaD/Algorithmic_Thinking | src/project_3_test_data.py | Python | gpl-3.0 | 2,503 | 0.003196 |
from rpitc.io import IO
class TestOut:
def test_init_on(self, gpio):
from rpitc.io.out import Out
out = Out(7, status=IO.ON)
assert out.status == IO.ON
out.off()
def test_set_pin(self, out):
assert out.set_pin(IO.ON) == IO.ON
def test_on(self, out):
out.on... | stefan-walluhn/RPi.TC | tests/test_out.py | Python | gpl-3.0 | 607 | 0 |
import pytest
import watchmaker
@pytest.fixture
def setup_object():
pass
def test_main():
"""Placeholder for tests"""
# Placeholder
assert watchmaker.__version__ == watchmaker.__version__
| MarionTheBull/watchmaker | tests/test_watchmaker.py | Python | apache-2.0 | 209 | 0 |
import os
import threading
import time
from django.conf import settings
from django.db import connections
from django.dispatch import receiver
from django.test.signals import setting_changed
from django.utils import timezone
from django.utils.functional import empty
# Most setting_changed receivers are supposed to be... | dsanders11/django-future-staticfiles | tests/staticfiles_tests/signals.py | Python | bsd-3-clause | 3,301 | 0 |
# coding:utf-8
"""
Django settings for turbo project.
Generated by 'django-admin startproject' using Django 1.11.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"... | giliam/turbo-songwriter | backend/turbosettings/settings.py | Python | mit | 4,924 | 0.001422 |
import tensorflow as tf
from tensorflow.python.keras.layers import Conv2D, Conv2DTranspose, Conv3D, Dense, Reshape
tfgan = tf.contrib.gan
def basic_generator(noise):
"""Simple generator to produce MNIST images.
Args:
noise: A single Tensor representing noise.
Returns:
A generated image... | bgroveben/python3_machine_learning_projects | learn_kaggle/deep_learning/packages/learntools/gans/generators.py | Python | mit | 2,657 | 0.007151 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: Robin Wen
# Date: 2014-11-18
# Desc: Connect to MySQL using MySQLdb package, and insert test data.
import MySQLdb as mdb
con = mdb.connect(host='10.10.3.121', user='robin', passwd='robin89@DBA', db='testdb', unix_socket='/tmp/mysql5173.sock', port=5173)
with con:
... | dbarobin/pytools | py-practice/insert_data.py | Python | gpl-2.0 | 868 | 0.002304 |
#import factorial
#import square
x = int(raw_input("What is 'x'?\n"))
y = int(raw_input("What is y?\n"))
# question0 = str(raw_input("Define a y value? (y/n)\n"))
# if (question0 == "y","Y","yes","Yes"):
# y = int(raw_input("What will 'y' be?\n"))
# elif (y == "n","N","no","No"):
# question2 = str(raw_input("I... | chrisortman/CIS-121 | k0459866/Lessons/ex12.py | Python | mit | 2,216 | 0.009928 |
import pygame
import sys
from psistatsrd.app import App
def create_queue_row(data, config):
mem_graph = create_mem_graph(config)
cpu_graph = create_cpu_graph(config)
scroll_text = []
title = []
if type(data['ipaddr']).__name__ == "list":
scroll_text = scroll_text + data['ipaddr']
el... | alex-dow/psistatsrd | psistatsrd/utils/drawable.py | Python | mit | 2,757 | 0.009068 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# pipeline.py
# AstroObject
#
# Created by Alexander Rudy on 2012-04-25.
# Copyright 2012 Alexander Rudy. All rights reserved.
#
u"""
Basic CCD Reduction Pipeline written with AstroObject
"""
# Python Imports
import shutil
import os
import collections
# Numpy I... | alexrudy/AstroObject | Examples/pipeline.py | Python | gpl-3.0 | 7,924 | 0.016406 |
"""
Django settings for todo project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Bu... | jacoboamn87/todolist | todo/settings.py | Python | gpl-3.0 | 3,308 | 0.001209 |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | openstack/glance | glance/api/v2/metadef_namespaces.py | Python | apache-2.0 | 38,490 | 0 |
# [1] https://doi.org/10.1002/jcc.26495
# Habershon, 2021
"""
prp a901cdfacc579eb63b193cbc9043212e8b57746f
pysis 340ab6105ac4156f0613b4d0e8f080d9f195530c
do_trans accidentally disabled in transtorque
"""
from functools import reduce
import itertools as it
import numpy as np
from pysisyphus.calculators import (
... | eljost/pysisyphus | pysisyphus/drivers/precon_pos_rot.py | Python | gpl-3.0 | 19,597 | 0.000714 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('broadcasts', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='broadcast',
name='... | bryanveloso/avalonstar-tv | apps/broadcasts/migrations/0002_auto_20140927_0415.py | Python | apache-2.0 | 627 | 0.001595 |
"""
WSGI config for tiendalibros 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_... | secnot/tutorial-tienda-django-paypal-1 | tiendalibros/tiendalibros/wsgi.py | Python | gpl-3.0 | 401 | 0 |
# Inviwo Python script
import inviwo
import math
import time
start = time.clock()
scale = 1;
d = 15
steps = 120
for i in range(0, steps):
r = (2 * 3.14 * i) / steps
x = d*math.sin(r)
z = -d*math.cos(r)
inviwo.setPropertyValue("EntryExitPoints.camera",((x*scale,3*scale,z*scale),(0,0,0),(0,... | sarbi127/inviwo | data/scripts/camerarotation.py | Python | bsd-2-clause | 687 | 0.040757 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/spectral-density | tf/experiment_utils_test.py | Python | apache-2.0 | 3,931 | 0.005342 |
#!/usr/bin/python
'''
This script is used to generate a set of random-ish events to
simulate log data from a Juniper Netscreen FW. It was built
around using netcat to feed data into Flume for ingestion
into a Hadoop cluster.
Once you have Flume configured you would use the following
command to populate data:
./g... | jpacerqueira/jpac-flume-logs | generator/gen_events.py | Python | apache-2.0 | 1,662 | 0.015042 |
import struct, socket, time, logging
from gosh.config import STUN_SERVER, STUN_PORT, logger
from gosh import JsonSocket
#=============================================================================
# STUN Client
# ============================================================================
class StunClient(object):... | nthiep/global-ssh | gosh/stun.py | Python | agpl-3.0 | 4,914 | 0.037241 |
from django.conf.urls.defaults import *
from models import Entry, Tag
from django.views.generic.dates import ArchiveIndexView, DateDetailView
from django.views.generic import TemplateView
urlpatterns = patterns('',
url(r'^/?$', ArchiveIndexView.as_view(model=Entry, date_field="published_on"), name="news-main"),
... | underbluewaters/marinemap | lingcod/news/urls.py | Python | bsd-3-clause | 788 | 0.006345 |
from collections import OrderedDict
n = int(input())
occurrences = OrderedDict()
for _ in range(0, n):
word = input().strip()
occurrences[word] = occurrences.get(word, 0) + 1
print(len(occurrences))
print(sep=' ', *[count for _, count in occurrences.items()])
| alexander-matsievsky/HackerRank | All_Domains/Python/Collections/word-order.py | Python | mit | 269 | 0 |
from nbdiff.adapter import git_adapter as g
from pretend import stub
def test_get_modified_notebooks_empty():
g.subprocess = stub(check_output=lambda cmd: 'true\n'
if '--is-inside-work-tree' in cmd
else '')
adapter = g.GitAdapter()
result = adapter.get_modif... | tarmstrong/nbdiff | tests/test_git_adapter.py | Python | mit | 3,720 | 0 |
#!/usr/bin/env python
# flake8: noqa E501
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Publ... | rogerscristo/BotFWD | env/lib/python3.6/site-packages/telegram/ext/jobqueue.py | Python | mit | 20,684 | 0.004448 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: Text Trees
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Peter Ljunglöf <peter.ljunglof@gu.se>
# Nathan Bodenstab <bodenstab@cslu.ogi.edu> (tree transforms)
# URL: <h... | nelango/ViralityAnalysis | model/lib/nltk/tree.py | Python | mit | 64,375 | 0.003216 |
# Copyright 2019 Google LLC.
"""Pipeline to decode and reencode a video using OpenCV."""
from absl import app
from absl import flags
from video_processing import processor_runner
from video_processing.processors import opencv_video_decoder
from video_processing.processors import opencv_video_encoder
flags.DEFINE_stri... | learningequality/video-vectorization | video_processing/pipelines/simple_encode_decode.py | Python | mit | 902 | 0.003326 |
import boto
import sure # noqa
from moto import mock_ec2
@mock_ec2
def test_placement_groups():
pass
| andresriancho/moto | tests/test_ec2/test_placement_groups.py | Python | apache-2.0 | 109 | 0 |
# encoding: utf-8
"""
The :mod:`ast` module contains the classes comprising the Python abstract syntax tree.
All attributes ending with ``loc`` contain instances of :class:`.source.Range`
or None. All attributes ending with ``_locs`` contain lists of instances of
:class:`.source.Range` or [].
The attribute ``loc``, ... | google/grumpy | third_party/pythonparser/ast.py | Python | apache-2.0 | 26,727 | 0.005131 |
#! /usr/bin/env python
# @brief Script to run apropriate tests.
import os
import distutils.core
from shutil import rmtree, copyfile
"""Avaiable tests dictionary in the format no_of_test : name_of_test"""
tests = {0:"default Generator.dat with lot of comments and explanations",
1:"RHIC pt_pi, eta_pi; tecm = 200... | rkycia/GenEx | test.py | Python | gpl-3.0 | 4,308 | 0.036444 |
#!/usr/bin/python
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
# The unittest framwork doesn't play nice with pylint:
# pylint: disable-msg=C0103
from __future__ import absolute_import
import unittest
from svtplay_dl.service.oppetarkiv import OppetArkiv
from svtplay_dl.se... | olof/svtplay-dl | lib/svtplay_dl/service/tests/oppetarkiv.py | Python | mit | 591 | 0.001692 |
#!/usr/bin/env python
# Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008
#
# 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 Lice... | wimberosa/samba | source4/scripting/python/samba/tests/core.py | Python | gpl-3.0 | 2,175 | 0.004598 |
#coding: utf-8
# Copyright 2005-2010 Wesabe, 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 a... | henriquebastos/fixofx | fixofx/ofx/document.py | Python | apache-2.0 | 3,289 | 0.001216 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import cPickle
import WebIDL
from Configuration import *
from Codegen import CGBindingRoot, replaceFileIfChang... | sergecodd/FireFox-OS | B2G/gecko/dom/bindings/BindingGen.py | Python | apache-2.0 | 2,361 | 0.003388 |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import datetime
import decimal
import httplib
import json
import threading
import re
from decimal import Decimal
from electrum.plugins import BasePlugin
from electrum.i18n import _
from electrum_gui.qt.util import *
EXCHANGES = ["BitcoinAverage",
"Bit... | marlengit/electrum198 | plugins/exchange_rate.py | Python | gpl-3.0 | 18,608 | 0.00489 |
import cherrypy
from cherrypy.test import helper
class ETagTest(helper.CPWebCase):
def setup_server():
class Root:
def resource(self):
return "Oh wah ta goo Siam."
resource.exposed = True
def fail(self, code):
code = int(cod... | evilhero/mylar | lib/cherrypy/test/test_etags.py | Python | gpl-3.0 | 3,071 | 0.003256 |
# 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 t... | briancurtin/python-openstacksdk | examples/cluster/profile.py | Python | apache-2.0 | 2,100 | 0 |
# coding: utf-8
from django.db import models
class Band(models.Model):
name = models.CharField(max_length=100)
bio = models.TextField()
rank = models.IntegerField()
class Meta:
ordering = ('name',)
| adviti/melange | thirdparty/google_appengine/lib/django_1_2/tests/regressiontests/admin_ordering/models.py | Python | apache-2.0 | 224 | 0.004464 |
#!/usr/bin/env python3
import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '..'))
from SetupTools.SetupConfig import SetupConfig
from Interface.Interface import Interface
import importlib
import logging
class Previewer:
def __init__(self):
logging.basicConfig(filename='ArchSetup.preview.log',... | mame98/ArchSetup | scripts/debug-preview.py | Python | gpl-3.0 | 1,383 | 0.005061 |
#!/usr/bin/env python3
# Copyright 2010-2021 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | google/or-tools | ortools/constraint_solver/samples/vrp_tokens.py | Python | apache-2.0 | 6,133 | 0.000326 |
# -*- coding: utf-8 -*-
# This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
from viper.common.out import print_info
from viper.common.out import print_error
from viper.common.out import print_output
from viper.core.plugins import __modules__
from vip... | kevthehermit/viper | viper/common/autorun.py | Python | bsd-3-clause | 1,981 | 0.002019 |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | alxgu/ansible | lib/ansible/modules/cloud/amazon/lambda_facts.py | Python | gpl-3.0 | 13,097 | 0.003054 |
from circularbuffer import CircularBuffer
from pytest import raises
def test_index():
buf = CircularBuffer(32)
buf.write(b'asdf\r\njkl;\r\n1234\r\n')
assert buf.index(b'\r\n') == 4
assert buf.index(b'\r\n', 5) == 10
with raises(ValueError):
buf.index(b'x')
buf.clear()
buf.write(b'a... | dozymoe/PyCircularBuffer | tests/test_index.py | Python | mit | 527 | 0.001898 |
import rpw
from pyrevit.script import get_logger
logger = get_logger()
selection = rpw.ui.Selection()
# TODO check in only one loop
number_of_unused_connectors = sum([element.ConnectorManager.UnusedConnectors.Size for element in selection])
logger.debug(number_of_unused_connectors)
if number_of_unused_connectors > 2:... | CyrilWaechter/pyRevitMEP | pyRevitMEP.tab/Lab.panel/Lab.pulldown/ConvertToFlexPipe.pushbutton/script.py | Python | gpl-3.0 | 451 | 0.004435 |
from elan import *
#Set System description
#Finished
Viewer.Start()
Viewer.CloseAndClean()
Configurator.Start()
Configurator.basicinformation.Click()
Configurator.systemname.Wait()
sleep(1)
Configurator.Edit.SetText(2,"Changed")
Configurator.apply.Wait()
Configurator.apply.Click()
Configurator.RestartHard()
Configur... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/elan/Pools/Quick_Tests/7____Set_System_Description_Restart_Check___.py | Python | gpl-3.0 | 639 | 0.007825 |
#!/usr/bin/env python3
import inspect
from classes.rgams_SRS import rgams_SRS
from classes.selectorvalve_VICI import selectorvalve_VICI
from classes.selectorvalve_compositeVICI import selectorvalve_compositeVICI
from classes.pressuresensor_WIKA import pressuresensor_WIKA
from classes.pressuresensor_... | brennmat/ruediPy | documentation/ruediPy/list_python_API.py | Python | gpl-3.0 | 1,842 | 0.050489 |
import scipy.cluster.hierarchy as hcl
from scipy.spatial.distance import squareform
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from scipy.cluster.hierarchy import dendrogram
import scipy
import json
#data = pd.read_json(path_or_buf= 'C:\Users\davtalab\Desktop\outJSON.json')
parsed_jso... | skashyap7/polar.usc.edu | html/team25ev/similarity_clustering/read_json.py | Python | apache-2.0 | 416 | 0.012019 |
# 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... | vmthunder/nova | nova/tests/api/openstack/compute/test_server_actions.py | Python | apache-2.0 | 60,337 | 0.000447 |
from rest_framework import serializers
from models import SurveyDraft
from taggit.models import Tag
class WritableJSONField(serializers.Field):
""" Serializer for JSONField -- required to make field writable"""
""" ALSO REQUIRED because the default JSONField serialization includes the
`u` prefix on string... | onaio/dkobo | dkobo/koboform/serializers.py | Python | agpl-3.0 | 2,038 | 0.002944 |
from .util.deb import deb
from .util.nrange import nrange
from .cell import Cell
#F,e,Cursor
from .grid import spoint
CURSOR_POS=None
def gcp(): #get cursor position
global CURSOR_POS
deb('gcp',CURSOR_POS)
return CURSOR_POS
def scp(x,y):
deb('scp',gcp(),x,y)
cxc=0 #todo, normalize in cursor...
global CURSOR_P... | e7dal/hexy | hexy/cursor.py | Python | gpl-3.0 | 1,100 | 0.128182 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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 versio... | frippe12573/geonode | geonode/maps/urls.py | Python | gpl-3.0 | 2,230 | 0.001794 |
# Copyright 2019-2020 Camptocamp SA
# Copyright 2015 Mathias Neef copadoMEDIA UG
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Switzerland Country States",
"category": "Localisation",
"summary": "",
"version": "14.0.1.0.0",
"author": "copado MEDIA UG," "Odoo Community As... | OCA/l10n-switzerland | l10n_ch_states/__manifest__.py | Python | agpl-3.0 | 493 | 0 |
"""
Courseware page.
"""
from bok_choy.page_object import PageObject, unguarded
from bok_choy.promise import EmptyPromise
import re
from selenium.webdriver.common.action_chains import ActionChains
from common.test.acceptance.pages.lms.bookmarks import BookmarksPage
from common.test.acceptance.pages.lms.course_page im... | romain-li/edx-platform | common/test/acceptance/pages/lms/courseware.py | Python | agpl-3.0 | 23,445 | 0.003156 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/bank-of-anthos | src/userservice/db.py | Python | apache-2.0 | 4,158 | 0.000962 |
# Copyright 2021 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | ChameleonCloud/blazar | blazar/db/migration/alembic_migrations/versions/42c7fd6e792e_add_device_reservation.py | Python | apache-2.0 | 5,436 | 0.000552 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from api import views
admin.autodiscover()
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'headings', views.HeadingViewSet)
router.register(r'users', views.UserViewSet)
urlpatterns = patte... | timokoola/okrest | okrest/okrest/urls.py | Python | apache-2.0 | 449 | 0.008909 |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
============================
JSONRPC Library (jsonrpclib)
============================
This library is a JSON-RPC v.2 (proposed) implementation which
follows the xmlrpclib API for portability between clients. It
uses the same Server / ServerProxy, loads, dumps, etc... | pymedusa/Medusa | ext/jsonrpclib/jsonrpc.py | Python | gpl-3.0 | 43,868 | 0.000046 |
# ####################################################################
# gofed - set of tools to automize packaging of golang devel codes
# Copyright (C) 2014 Jan Chaloupka, jchaloup@redhat.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Licen... | ingvagabund/gofed | modules/RemoteSpecParser.py | Python | gpl-2.0 | 2,663 | 0.015396 |
#!/usr/bin/env python
#-*-coding:utf-8-*-
#
# @author Meng G.
# 2016-03-28 restructed
from sqip.config import *
from sqip.libs import *
dashboard = Blueprint('dashboard', __name__, template_folder='templates')
@base.route('/admin/login' , methods=['GET'])
@union_bug
def admin_login():
template = env.get_templat... | gaomeng1900/SQIP-py | sqip/dashboard/dashboard.py | Python | cc0-1.0 | 548 | 0.018248 |
#coding=utf-8
class Quantity:
__counter = 0
def __init__(self):
cls = self.__class__
prefix = cls.__name__
index = cls.__counter
self.storage_name = '_{}#{}'.format(prefix, index)
cls.__counter += 1
def __set__(self, isinstance, value):
if value > 0:
... | wuqize/FluentPython | chapter20/bulkfood/bulkfood_v3.py | Python | lgpl-3.0 | 720 | 0.005556 |
# coding: utf-8
import datetime
from sqlalchemy import bindparam
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import Table
from sqlalchemy import testing
from sqlalchemy.dialects import mysql
fr... | graingert/sqlalchemy | test/dialect/mysql/test_dialect.py | Python | mit | 14,932 | 0 |
# @source http://rosettacode.org/wiki/Bitwise_IO#Python
# @license http://www.gnu.org/licenses/fdl-1.2.html
import logging
logger = logging.getLogger('naabal.util.bitio')
class BitIO(object):
BITS_IN_BYTE = 8
DEFAULT_MASK = 1 << (BITS_IN_BYTE - 1) # 0x80
def __init__(self, handle):
self._d... | aheadley/python-naabal | naabal/util/bitio.py | Python | mit | 2,763 | 0.002533 |
# Copyright (c) 2003-2008 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# 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, o... | dbbhattacharya/kitsune | vendor/packages/pylint/test/test_func.py | Python | bsd-3-clause | 7,955 | 0.007291 |
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
from django.urls import path
from confla import views
app_name = "confla"
urlpatterns = [
path('admin/', admin.site.urls),
url(r'^$', views.IndexView... | rh-lab-q/conflab | wsgi/openshift/confla/urls.py | Python | gpl-3.0 | 6,136 | 0.008638 |
from pprint import pprint
from django.shortcuts import render
def index(request):
return render(request, 'itat/index.html')
| anselmobd/fo2 | src/itat/views/views.py | Python | mit | 131 | 0 |
# -*- coding: utf-8 -*-
import ConfigParser, sys, os, urllib2, json, time, shutil, filecmp
import Levenshtein
config = ConfigParser.ConfigParser()
config.read("config.ini")
def clean(chaine):
#print chaine
return chaine.lower().strip()
def decode(chaine):
chaine = chaine.replace(u"\u2018", "'").replace(u"... | pdevetto/misc | lastfm/playlist.py | Python | gpl-3.0 | 7,352 | 0.010473 |
##
# Copyright 2012-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | hpcugent/easybuild-framework | easybuild/toolchains/gomkl.py | Python | gpl-2.0 | 1,727 | 0.001737 |
import json
from rhino import Mapper, get
# Our internal representation
report = {
'title': 'foo',
'author': 'Fred',
'date': '2015-01-09',
'tags': ['a', 'b', 'c'],
}
# Base class for our representations
class report_repr(object):
@classmethod
def serialize(cls, report):
obj = dict([(k... | trendels/rhino | examples/content_type_versioning.py | Python | mit | 1,165 | 0.004292 |
# Copyright 2013 Kylin, 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... | NeCTAR-RC/horizon | openstack_dashboard/dashboards/admin/defaults/tests.py | Python | apache-2.0 | 6,926 | 0 |
# Copyright (C) 2010-2013 Claudio Guarnieri.
# Copyright (C) 2014-2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""Added failed statuses to tasks (from Cuckoo 1.1 to 1.2)
Revision ID: 495d5a6edef3
Revises: 18eee46c6f8... | cuckoobox/cuckoo | cuckoo/private/db_migration/versions/from_1_1_to_1_2-added_states.py | Python | mit | 7,228 | 0.004289 |
# (c) Copyright 2018 ZTE 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 requ... | openstack/freezer-api | freezer_api/tests/unit/sqlalchemy/v2/test_action.py | Python | apache-2.0 | 19,604 | 0 |
import attr
from widgetastic.widget import View, Text
from widgetastic_patternfly import Tab, Input, BootstrapSwitch, Button
from wrapanapi.rhevm import RHEVMSystem
from cfme.common.candu_views import VMUtilizationView
from cfme.common.provider import CANDUEndpoint, DefaultEndpoint, DefaultEndpointForm
from cfme.comm... | lkhomenk/integration_tests | cfme/infrastructure/provider/rhevm.py | Python | gpl-2.0 | 6,107 | 0.003111 |
#!/usr/bin/env python3
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['lg_keyboard'],
package_dir={'': 'src'},
scripts=[],
requires=[]
)
setup(**d)
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
| EndPointCorp/lg_ros_nodes | lg_keyboard/setup.py | Python | apache-2.0 | 309 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# clamm documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 2 20:47:20 2017.
#
# 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
# auto... | p5a0u9l/clamm | doc/conf.py | Python | mit | 4,816 | 0.000208 |
#############################################################################
##
## Copyright (C) 2015 The Qt Company Ltd.
## Contact: http://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 wit... | kuba1/qtcreator | tests/system/suite_general/tst_build_speedcrunch/test.py | Python | lgpl-2.1 | 3,768 | 0.008493 |
import shipane_sdk
# 初始化函数,设定要操作的股票、基准等等
def initialize(context):
# 定义一个全局变量, 保存要操作的股票
# 000001(股票:平安银行)
g.security = '000001.XSHE'
# 设定沪深300作为基准
set_benchmark('000300.XSHG')
def process_initialize(context):
# 创建 StrategyManager 对象
# 参数为配置文件中的 manager id
g.__manager = shipane_sdk.Joi... | Pyangs/ShiPanE-Python-SDK | examples/joinquant/simple_strategy.py | Python | mit | 911 | 0.001473 |
# Copyright (c) 2015 Mellanox Technologies, Ltd
#
# 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... | javaos74/neutron | neutron/tests/unit/api/rpc/handlers/test_resources_rpc.py | Python | apache-2.0 | 8,869 | 0.000338 |
#!/usr/bin/env python
traindat = '../data/fm_train_real.dat'
testdat = '../data/fm_test_real.dat'
parameter_list = [[traindat,testdat,2,10], [traindat,testdat,5,10]]
def kernel_anova_modular (train_fname=traindat,test_fname=testdat,cardinality=2, size_cache=10):
from modshogun import ANOVAKernel,RealFeatures,CSVFile
... | c4goldsw/shogun | examples/undocumented/python_modular/kernel_anova_modular.py | Python | gpl-3.0 | 717 | 0.041841 |
from math import sqrt
def main():
n = int(input("Enter n : "))
boolArr = [True for i in range(n + 1)]
boolArr[0] = boolArr[1] = False
for i in range(2, int(sqrt(n) + 1)):
if boolArr[i] is True:
for j in range(i * i, n + 1, i):
# print(boolArr)
boolA... | vansjyo/Hacktoberfest-2k17 | DhvanilP/sieve_of_erastothenes.py | Python | mit | 457 | 0 |
# Copyright (c) 2018 PaddlePaddle 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 app... | baidu/Paddle | python/paddle/fluid/tests/unittests/test_fake_quantize_op.py | Python | apache-2.0 | 5,508 | 0.000182 |
# vkapi.py
#
# Copyright 2016 Igor Unixoid Kolonchenko <enepunixoid@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) ... | enep/vkbot | vkbot/vkapi.py | Python | gpl-3.0 | 1,581 | 0.033333 |
from webapp2_extras.appengine.auth.models import User
from google.appengine.ext import ndb
class User(User):
"""
Universal user model. Can be used with App Engine's default users API,
own auth or third party authentication methods (OpenID, OAuth etc).
based on https://gist.github.com/kylefinley
""... | mats116/ElasticBigQuery | boilerplate/models.py | Python | lgpl-3.0 | 5,145 | 0.003304 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | sysadminmatmoz/odoo-clearcorp | TODO-8.0/cash_flow_report/__init__.py | Python | agpl-3.0 | 1,165 | 0.000858 |
import datetime
import math
class MethodAttribute:
"""
A method attribute is an attribute with the method and
its corresponding arity attached as parameters. It simply acts
as a tuple for easy access
"""
def __init__(self, method, arity):
self.method = method
self.arity = arit... | Emigna/05AB1E | lib/constants.py | Python | mit | 146,313 | 0.000055 |
#!/usr/bin/env python
'''
OWASP ZSC
https://www.owasp.org/index.php/OWASP_ZSC_Tool_Project
https://github.com/zscproject/OWASP-ZSC
http://api.z3r0d4y.com/
https://groups.google.com/d/forum/owasp-zsc [ owasp-zsc[at]googlegroups[dot]com ]
'''
from core import stack
def create_file(create_command):
return '''
xor ... | Ali-Razmjoo/OWASP-ZSC | lib/generator/windows_x86/create_file.py | Python | gpl-3.0 | 1,892 | 0.000529 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.