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 -*-
# Copyright(C) 2011 Noé Rubinstein
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opt... | blckshrk/Weboob | modules/mangareader/__init__.py | Python | agpl-3.0 | 806 | 0 |
#!/usr/bin/env python3
import cv2
import numpy as np
from vision import camera_message_framework
import itertools
import time
shape = (500, 500, 3)
size = 1
for dim in shape:
size *= dim
def image_of(axes):
im = np.zeros(shape, dtype=np.uint8)
im[:, :, axes] = 255
return im
black = image_of([]), 'bl... | cuauv/software | vision/utils/image_ordering_test.py | Python | bsd-3-clause | 877 | 0.003421 |
# coding:utf-8
def test_1():
'''
1,2,3,4组成无重复的三位数
'''
for a in range(1, 5):
for b in range(1, 5):
for c in range(1, 5):
if (a!=b) and (b!=c) and (a!=c):
print(a,b,c)
print('\n------------test_1 END---------------\n')
def test_2()... | xiejian1985/Test | 100_Python.py | Python | gpl-3.0 | 2,354 | 0.017819 |
"""Test class for Compute Profile UI
:Requirement: Computeprofile
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: ComputeResources
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from fauxfactory import gen_string
from nailgun import entities
from robottelo.decorators import tier... | ldjebran/robottelo | tests/foreman/ui/test_computeprofiles.py | Python | gpl-3.0 | 2,049 | 0.003416 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class ImgItem(scrapy.Item):
image_character = scrapy.Field()
image_titles = scrapy.Field()
image_urls = scrapy.Field()
image_paths = scr... | Justyer/KuaikanSpider | KuaikanSpider/KuaikanSpider/items.py | Python | mit | 537 | 0.003724 |
# -*- coding: utf-8 -*-
# This file is part of pygal
#
# A python svg graph plotting library
# Copyright © 2012-2014 Kozea
#
# This library 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... | makinacorpus/pygal | pygal/graph/bar.py | Python | lgpl-3.0 | 5,037 | 0 |
#!/usr/bin/env python
import sys
import os
import inspect
import unittest
import StringIO
import shutil
import tempfile
curPath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
if not curPath in sys.path:
sys.path.insert(0, curPath)
grapePath = os.path.join(curPath, "..")
if grapePath n... | robinson96/GRAPE | test/testGrape.py | Python | bsd-3-clause | 7,398 | 0.005812 |
#!/usr/bin/env python
# coding=utf-8
# aeneas is a Python/C library and a set of tools
# to automagically synchronize audio and text (aka forced alignment)
#
# Copyright (C) 2012-2013, Alberto Pettarin (www.albertopettarin.it)
# Copyright (C) 2013-2015, ReadBeyond Srl (www.readbeyond.it)
# Copyright (C) 2015-2017, A... | chrisvire/aeneas | aeneas/ttswrappers/basettswrapper.py | Python | agpl-3.0 | 34,887 | 0.00192 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from scrapyproject.models import (Cinema, Showing, ShowingBooking, Movie,
db_connect, drop_tab... | gas1121/JapanCinemaStatusSpider | scrapyproject/pipelines.py | Python | mit | 6,140 | 0.000489 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/sickle/package.py | Python | lgpl-2.1 | 1,879 | 0.000532 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2013-2014 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... | sephalon/python-ivi | ivi/agilent/agilent8590A.py | Python | mit | 1,520 | 0.001316 |
#! /usr/bin/python
import os, sys, glob, time, subprocess, signal
import popen2
subdirectories = ['first', 'second', 'third', 'fourth', 'fifth']
formats = {'first':'line', 'second':'line', 'third':'file', 'fourth':'file', 'fifth':'file'}# if a program has single liner input and output, we put all test cases in single... | frogeyedpeas/ChalupaCity | working_pa1/auto_grader.py | Python | mit | 7,382 | 0.013411 |
from enigma import iPlayableService, iRdsDecoder
from Screens.Screen import Screen
from Components.ActionMap import NumberActionMap
from Components.ServiceEventTracker import ServiceEventTracker
from Components.Pixmap import Pixmap
from Components.Label import Label
from Components.Sources.StaticText import Stati... | kingvuplus/boom | lib/python/Screens/RdsDisplay.py | Python | gpl-2.0 | 10,176 | 0.001671 |
# 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... | 4Quant/tensorflow | tensorflow/python/framework/importer.py | Python | apache-2.0 | 13,843 | 0.008596 |
import os
def get_template_path(path):
file_path = os.path.join(os.getcwd(), path)
if not os.path.isfile(file_path):
raise Exception("This is not a valid template path %s"%(file_path))
return file_path
def get_template(path):
file_path = get_template_path(path)
return open(file_path).read()
def render_context... | nirajkvinit/python3-study | 30days/day13/templates.py | Python | mit | 691 | 0.023155 |
# -*- coding: utf-8 -*-
"""
Display X selection.
Configuration parameters:
cache_timeout: refresh interval for this module (default 0.5)
command: the clipboard command to run (default 'xsel -o')
format: display format for this module (default '{selection}')
max_size: strip the selection to this value (... | docwalter/py3status | py3status/modules/xsel.py | Python | bsd-3-clause | 1,642 | 0.000609 |
# -*- coding: utf-8 -*-
from requests import post, get, put, delete
class Api:
def __init__(self, base_url, user_token, app_token):
self.base_url = base_url
self.app_token = app_token
self.user_token = user_token
def initSession(self):
target_url = 'initSession/'
sess... | marcelogomess/glpi_api | glpi_api/api.py | Python | bsd-2-clause | 6,202 | 0.004353 |
# =============================================================================
# COPYRIGHT 2013 Brain Corporation.
# License under MIT license (see LICENSE file)
# =============================================================================
import pytest
from robustus.detail import perform_standard_test
def test_b... | braincorp/robustus | robustus/tests/test_bullet.py | Python | mit | 775 | 0.00129 |
# -*- coding: utf-8 -*-
#
from .base import *
from .logging import *
from .libs import *
from .auth import *
from .custom import *
from ._xpack import *
| jumpserver/jumpserver | apps/jumpserver/settings/__init__.py | Python | gpl-3.0 | 153 | 0 |
#!/usr/bin/env python
# encoding: utf-8
#
# pmatic - Python API for Homematic. Easy to use.
# Copyright (C) 2016 Lars Michelsen <lm@larsmichelsen.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 Found... | LaMi-/pmatic | pmatic/api.py | Python | gpl-2.0 | 31,401 | 0.006019 |
#! /usr/bin/env python
#
# Copyright (C) 2004 Andreas Berger, berger@ftw.at
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later v... | 0xalen/opencaster_isdb-tb | libs/dvbobjects/dvbobjects/MPEG/DVBH_Descriptors.py | Python | gpl-2.0 | 10,359 | 0.029443 |
# coding=utf-8
from __future__ import unicode_literals
c_lang_config = {
"name": "c",
"compile": {
"group_memory": True,
"src_name": "main.c",
"exe_name": "main",
"max_cpu_time": 5.0,
"max_real_time": 10.0,
"max_memory": 512 * 1024, # 512M compile memory
... | joeyac/JudgeServer | client/languages.py | Python | mit | 2,209 | 0.002263 |
#!/usr/bin/env python
"""
Title : Java program file
Author : JG
Date : dec 2016
Objet : script to create Propertie File Program
in : get infos from yml
out : print infos in properties file
"""
import sys,os
import yaml
import util as u
from random import randint
# =====================================... | JeGoi/IPa2 | packages/java_properties.py | Python | mit | 6,870 | 0.006259 |
__author__ = 'russomi'
from google.appengine.ext import ndb
from ..employers.models import Employer
from ferris3 import Model
class JobPost(Model):
employer = ndb.KeyProperty(kind=Employer)
title = ndb.StringProperty(required=True)
description = ndb.TextProperty(required=True)
| russomi/ferris3-tutorial | app/jobposts/models.py | Python | apache-2.0 | 294 | 0 |
import pytest
pytestmark = pytest.mark.meta(from_pytest='yep')
@pytest.mark.meta(from_decorator='seems to be')
def test_metadoc(meta):
"""This test function has a docstring!
Metadata:
valid_yaml: True
"""
assert meta['from_docs']['valid_yaml']
assert meta['from_pytest'] == 'yep'
ass... | jteehan/cfme_tests | utils/tests/test_metadoc.py | Python | gpl-2.0 | 364 | 0 |
# -*- coding: utf-8 -*-
# ===========================================================================
# Popular encoding:
# utf-8
# ISO-8859-1
# ascii
# encode: string -> string of bytes
# decode: string of bytes -> string
# ===========================================================================
from __future__ ... | imito/odin | odin/preprocessing/text.py | Python | mit | 24,225 | 0.010485 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: booopooob@gmail.com
#
# Info:
#
#
#
import abc
from util import FixedDict
class PacketHeader(FixedDict, metaclass=abc.ABCMeta):
@abc.abstractmethod
def to_bytes(self):
pass
@abc.abstractmethod
def from_bytes(self, data):
pass
| FTwO-O/pyShadowsocks | pyshadowsocks/packet/packet_header.py | Python | mit | 320 | 0.003125 |
from django import template
from django.urls.base import reverse
from urllib.parse import urljoin, parse_qsl, urlencode, unquote
register = template.Library()
class Number:
def __init__(self, number=None, url=None, current=None):
self.number = number
self.url = url
self.active = 'active'... | botswana-harvard/edc-dashboard | edc_dashboard/templatetags/edc_dashboard_extras.py | Python | gpl-2.0 | 3,196 | 0.000626 |
from django.views.generic import TemplateView
#from apiclient.discovery import build
from googleapiclient.discovery import build
from .utils import SearchResults
from . import *
class SearchView(TemplateView):
template_name = "googlesearch/search_results.html"
def get_context_data(self, **kwargs):
c... | hzdg/django-google-search | googlesearch/views.py | Python | mit | 2,809 | 0.002848 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
# Reference:
- [pose_lcn](
https://github.com/rujiewu/pose_lcn)
- [3d-pose-baseline](
https://github.com/una-dinosauria/3d-pose-baseline)
"""
import tensorflow as tf
import numpy as np
import pickle
import matplotlib.pyplot as plt
import os
import matplotlib.gr... | zsdonghao/tensorlayer | tensorlayer/app/human_pose_estimation/common.py | Python | apache-2.0 | 16,077 | 0.001928 |
from faker.providers import BaseProvider
class ScreenProvider(BaseProvider):
formats = (
'{{screen_name}} {{screen_number}}',
'{{screen_name}} {{screen_number}} ({{screen_suffix}})',
)
screen_names = (
'Screen',
'Theatre',
'Auditorium',
)
screen_suffixes = (... | RangerOfFire/faker-cinema | faker_cinema/screen.py | Python | mit | 1,039 | 0 |
#!/usr/bin/env python
#
# GrovePi Python library
# v1.2.2
#
# This file provides the basic functions for using the GrovePi.
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question about this example? Ask on the fo... | minusetheartbot/minusetheartbot | lib/grove_pi_v1_2_6/grovepi.py | Python | apache-2.0 | 19,052 | 0.022412 |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test block processing."""
import copy
import struct
import time
from test_framework.blocktools import ... | Bushstar/UFO-Project | test/functional/feature_block.py | Python | mit | 60,904 | 0.003235 |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2012,2013,2014,2015,2016,2017,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... | quattor/aquilon | tests/broker/test_del_chassis.py | Python | apache-2.0 | 3,407 | 0.000587 |
import json
from unittest.mock import patch
from federation.hostmeta.parsers import (
parse_nodeinfo_document, parse_nodeinfo2_document, parse_statisticsjson_document, int_or_none,
parse_mastodon_document, parse_matrix_document)
from federation.tests.fixtures.hostmeta import (
NODEINFO2_10_DOC, NODEINFO_10... | jaywink/federation | federation/tests/hostmeta/test_parsers.py | Python | bsd-3-clause | 14,602 | 0.001233 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re, os
import unicodedata
import codecs
import HTMLParser
import nltk
import csv
from nltk.corpus import stopwords
from nltk.tokenize.punkt import PunktSentenceTokenizer
from nltk.stem.snowball import SnowballStemmer
from nltk.stem import WordNetLemmatizer
from nlt... | fmpr/texttk | texttk/texttk.py | Python | gpl-3.0 | 10,887 | 0.028067 |
#! /usr/bin/env python
# Copyright 2014 Uri Laserson
#
# 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 o... | churchlab/vdj | bin/imgt2fasta.py | Python | apache-2.0 | 1,206 | 0.004975 |
# coding=utf-8
# Copyright 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 or agreed ... | google/feedloader | appengine/initiator/main.py | Python | apache-2.0 | 8,653 | 0.006703 |
VERSION = "0.1"
from trello.api import *
| onnodb/CloudBackups | trello/__init__.py | Python | unlicense | 43 | 0.023256 |
import logging
import pandas as pd
import matplotlib.pyplot as plt
def running_total_comparison(df1, window=15):
fig_size = [12,12]
xlim = [0,365]
ylim = [0,max(df1.Pages)]
years = df1.Year.unique()[-window:].tolist()
y = years.pop(0)
_df = df1.loc[df1.Year == y]
ax = _df.plot("Day", "Page... | DrSkippy/php_books_database | tools/bookdbtool/visualizations.py | Python | bsd-2-clause | 1,064 | 0.007519 |
#!/usr/bin/python
#
# test/filemanagertest.py unit test suite for snap.filemanager
#
# (C) Copyright 2011 Mo Morsi (mo@morsi.org)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, Version 3,
# as published by the Free Software Foundation
#
#... | movitto/snap | test/filemanagertest.py | Python | gpl-3.0 | 4,521 | 0.002212 |
from __future__ import absolute_import
from collections import defaultdict as ddict
import os.path as op
def enum(**enums):
"""#enumeration
#backward compatible
:param enums:
"""
return type('Enum', (), enums)
IONISATION_MODE = enum(NEG=-1, POS=1)
class ExperimentalSettings(object):
"""
... | jerkos/mzOS | mzos/exp_design.py | Python | mit | 3,317 | 0.00211 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you ca... | OpusVL/odoo | addons/board/__openerp__.py | Python | agpl-3.0 | 1,697 | 0.002357 |
# 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 unittest
from mantid.py3compat import... | mganeva/mantid | scripts/test/Muon/utilities/thread_model_test.py | Python | gpl-3.0 | 5,303 | 0.001509 |
# coding=utf-8
"""
This file is used to make a crawl
"""
import __init__
import os
import re
import urllib
from utility import prgbar
def get_html(url):
"""Get the html """
page = urllib.urlopen(url)
html = page.read()
return html
def get_pdf(html):
""" xxx"""
reg = r'href="(.+?\.pdf)">pdf'... | JustJokerX/PaperCrawler | COLT/COLT2015.py | Python | gpl-3.0 | 1,083 | 0 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ProcessingConfig.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | Gaia3D/QGIS | python/plugins/processing/core/ProcessingConfig.py | Python | gpl-2.0 | 8,398 | 0.001072 |
import re
import string
def replaceIt(file):
out = ''
with open(file, 'r') as f:
for line in f:
repl = '[' + re.escape(''.join(string.punctuation)) + ']'
out += re.sub(repl, '', line)
return out
print (replaceIt('test.txt'))
# output
'''
cobaanu231339 91102
1212086mcmn... | agusmakmun/Some-Examples-of-Simple-Python-Script | regex/remove-all-characters.py | Python | agpl-3.0 | 413 | 0.007264 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .yadisk_test import *
| ivknv/yadisk | tests/__init__.py | Python | lgpl-3.0 | 74 | 0 |
#!/usr/bin/python
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
setup(
name='django-sizefield',
version='0.10.ceda',
author='Mathieu Leplatre',
author_email='contact@mathieu-leplatre.info',
url='https://github.com/leplatrem/django-sizefield... | cedadev/django-sizefield | setup.py | Python | lgpl-3.0 | 1,205 | 0.00249 |
"""Config flow to configure the IPP integration."""
import logging
from typing import Any, Dict, Optional
from pyipp import (
IPP,
IPPConnectionError,
IPPConnectionUpgradeRequired,
IPPError,
IPPParseError,
IPPResponseError,
IPPVersionNotSupportedError,
)
import voluptuous as vol
from homea... | partofthething/home-assistant | homeassistant/components/ipp/config_flow.py | Python | apache-2.0 | 7,235 | 0.001382 |
"""
Tests for priors.
"""
# pylint: disable=missing-docstring
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import numpy.testing as nt
import scipy.optimize as spop
import reggie.core.priors as priors
### BASE TEST CLASS ###########... | mwhoffman/reggie | tests/test_core_priors.py | Python | bsd-2-clause | 1,591 | 0.001257 |
import pymoresane.iuwt_convolution
import unittest
class TestIuwtConvolution(unittest.TestCase):
pass | ratt-ru/PyMORESANE | tests/test_iuwt_convolution.py | Python | gpl-2.0 | 107 | 0.009346 |
# coding=utf-8
#Se importa el módulo ServerProxy de xmlrpclib.
from xmlrpclib import ServerProxy
#Se conecta al equipo por el puerto 5005
s = ServerProxy('http://localhost:5005')
#Se llama a la función pasandole x y devuelve el doble de x
salir = False
while not salir:
num1 = input("Digite un numero: ")
num2 =... | andrescollazos/sistemas-distribuidos | Taller3/cliente.py | Python | gpl-3.0 | 739 | 0.004071 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from openturns import coupling_tools
import os
import time
import sys
wanted_lines = '# ooo\nE=@E\nE1=@E\nFE1=@F#oo\nZ=@Z@Z\n# ooo\n'
semi_parsed = '# ooo\nE=2\nE1=2\nFE1=@F#oo\nZ=@Z@Z\n# ooo\n'
parsed = '# ooo\nE=1.6\nE1=1.6\nFE1=5#oo\nZ=66\n# ooo\n'
# how many Mo for ... | dbarbier/privot | python/test/t_coupling_tools.py | Python | lgpl-3.0 | 21,167 | 0.005055 |
# -*- coding: utf-8 -*-
import os
from locust.main import load_locustfile
def create_settings(
from_environment=False,
locustfile=None,
classes=None,
host=None,
num_users=None,
spawn_rate=None,
reset_stats=False,
run_time="3m",
loglevel="INFO",
):
"""
Returns a settings o... | FutureSharks/invokust | invokust/settings.py | Python | mit | 3,137 | 0.000319 |
import _plotly_utils.basevalidators
class ColoraxisValidator(_plotly_utils.basevalidators.SubplotidValidator):
def __init__(
self,
plotly_name="coloraxis",
parent_name="scatterternary.marker.line",
**kwargs
):
super(ColoraxisValidator, self).__init__(
plotly... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatterternary/marker/line/_coloraxis.py | Python | mit | 581 | 0 |
from django.conf.urls import url
from . import views
from django.contrib.auth.views import PasswordResetConfirmView, PasswordResetView, PasswordResetDoneView, PasswordResetCompleteView
urlpatterns = [
url(r'^$', views.index,name="home"),
url(r'update_dataset$', views.update_dataset, name='update_dataset'),
... | texta-tk/texta | account/urls.py | Python | gpl-3.0 | 1,734 | 0.006344 |
"""
Dummy Salesforce driver that simulates some parts of DB API 2
https://www.python.org/dev/peps/pep-0249/
should be independent on Django.db
and if possible should be independent on django.conf.settings
Code at lower level than DB API should be also here.
"""
from collections import namedtuple
import requests
import... | chromakey/django-salesforce | salesforce/backend/driver.py | Python | mit | 6,090 | 0.001806 |
import unittest, string
from test import support
class ModuleTest(unittest.TestCase):
def test_attrs(self):
string.whitespace
string.ascii_lowercase
string.ascii_uppercase
string.ascii_letters
string.digits
string.hexdigits
string.octdigits
string.p... | invisiblek/python-for-android | python3-alpha/python3-src/Lib/test/test_string.py | Python | apache-2.0 | 5,578 | 0.00251 |
# Copyright 2010 WebDriver committers
# Copyright 2010 Google 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 ap... | softak/webfaction_demo | vendor-local/lib/python/selenium/webdriver/remote/errorhandler.py | Python | bsd-3-clause | 6,176 | 0.001619 |
from AppKit import NSScroller, NSColor, NSAttributedString, NSMenuItem, NSShadowAttributeName, NSShadow, \
NSForegroundColorAttributeName, NSFont, NSFontAttributeName, NSSmallControlSize, NSView
import vanilla
class OpenTypeControlsView(vanilla.ScrollView):
def __init__(self, posSize, callback):
self... | typesupply/defconAppKit | Lib/defconAppKit/controls/openTypeControlsView.py | Python | mit | 12,083 | 0.002731 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | paninetworks/neutron | neutron/tests/unit/plugins/ml2/test_extension_driver_api.py | Python | apache-2.0 | 10,552 | 0 |
#!/usr/bin/python
"""Print stats about stdin per-line timings."""
import signal
import sys
import time
start = time.time()
count = 0
try:
for line in sys.stdin:
count += 1
except KeyboardInterrupt:
print
pass
end = time.time()
et = end - start
lps = count / et
print "Elapsed time = %f, lines = %d,... | vivek8943/twitter-streamer | streamer/scripts/lps.py | Python | mit | 351 | 0 |
# Copyright 2014 Diamond Light Source 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 agreed t... | swtp1v07/Savu | savu/plugins/manchester_recon.py | Python | apache-2.0 | 7,508 | 0.000666 |
#!/usr/bin/env python
# Copyright (C) 2001 Colin Phipps <cphipps@doomworld.com>
# Copyright (C) 2008, 2013 Simon Howard
# Parts copyright (C) 1999 by id Software (http://www.idsoftware.com/)
#
# SPDX-License-Identifier: GPL-2.0+
#
# Takes PLAYPAL as input (filename is the only parameter)
# Produces a light graduated CO... | CWolfRU/freedoom | lumps/colormap/colormap.py | Python | bsd-3-clause | 6,534 | 0.02112 |
#!/usr/bin/env python3
import canmatrix.formats
import sys
import optparse
# command line options...
usage = """
%prog [options] matrix
matrixX can be any of *.dbc|*.dbf|*.kcd|*.arxml
"""
parser = optparse.OptionParser(usage=usage)
parser.add_option(
"-f", "--frames",
dest="frames",
help="encode list o... | altendky/canmatrix | examples/encodeFrame.py | Python | bsd-2-clause | 2,030 | 0.003941 |
from d51.django.auth.decorators import auth_required
from django.contrib.sites.models import Site
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.exceptions import ImproperlyConfigured
from .services import... | domain51/d51.django.apps.sharing | d51/django/apps/sharing/views.py | Python | gpl-3.0 | 1,793 | 0.007808 |
"""Implements Products UI"""
from robottelo.ui.base import Base
from robottelo.ui.locators import common_locators, locators, tab_locators
from robottelo.ui.navigator import Navigator
class Products(Base):
"""Manipulates Products from UI"""
is_katello = True
def navigate_to_entity(self):
"""Navig... | sthirugn/robottelo | robottelo/ui/products.py | Python | gpl-3.0 | 2,755 | 0 |
import os
import keras.backend as K
import numpy as np
from keras.layers import Dense, Activation, Flatten, Convolution2D, Permute
from keras.layers.convolutional import Conv2D
from keras.models import Sequential
from models import AbstractConfiguration, KickoffModes
from rl.memory import SequentialMemory
from rl.poli... | bewestphal/SeleniumAI | example/configuration.py | Python | mit | 6,202 | 0.003386 |
import json
import pytest
import subprocess
import sys
from os.path import join, dirname
from .utils import info, fail
def pytest_addoption(parser):
parser.addoption(
"--phantomjs", type=str, default="phantomjs", help="phantomjs executable"
)
def get_phantomjs_screenshot(url, screenshot_path, wait,... | pombredanne/bokeh | tests/plugins/phantomjs_screenshot.py | Python | bsd-3-clause | 889 | 0.004499 |
# BER encoder
from pyasn1.type import base, tag, univ, char, useful
from pyasn1.codec.ber import eoo
from pyasn1.compat.octets import int2oct, ints2octs, null, str2octs
from pyasn1 import error
class Error(Exception): pass
class AbstractItemEncoder:
supportIndefLenMode = 1
def encodeTag(self, t, isConstructed... | AdrianGaudebert/socorro-crashstats | vendor-local/lib/python/pyasn1/codec/ber/encoder.py | Python | mpl-2.0 | 12,392 | 0.004438 |
#!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvdb_api
#repository:http://github.com/dbr/tvdb_api
#license:Creative Commons GNU GPL v2
# (http://creativecommons.org/licenses/GPL/2.0/)
"""Simple-to-use Python interface to The TVDB's API (www.thetvdb.com)
Example usage:
>>> from tvdb_api import Tvdb
>... | GetSomeBlocks/Score_Soccer | resources/lib/tvdb_api/tvdb_api.py | Python | mit | 29,127 | 0.006111 |
#!usr/bin/env python
from pysnmp.entity.rfc3413.oneliner import cmdgen
import shlex
import subprocess
import re
import os
import sys
import smtplib
from devices.models import AP as AccessPoint
## This file is used to update the access point inventory data. Use the
## updateAccessPoints function to run the update. The ... | lindseypack/NIM | code/ap/apInv.py | Python | mit | 5,106 | 0.009009 |
from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
from django.views.generic import TemplateView
admin.autodiscover()
urlpatterns = patterns('',
(r'^accounts/', include('registration.urls')),
url(r'^admin_tools/', include('admin_tools.urls')),
(r'^ad... | lukaszb/django-richtemplates | example_project/urls.py | Python | bsd-3-clause | 705 | 0.002837 |
#!/usr/bin/python
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
Element Software Backup Manager
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | rosmo/ansible | lib/ansible/modules/storage/netapp/na_elementsw_backup.py | Python | gpl-3.0 | 9,175 | 0.003379 |
from django.db import models
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from sorl import thumbnail
class PerfilColumnista(models.Model):
user = models.OneToOneField(User, primary_key=True)
bio = models.TextField(blank=True, null=True)
image = thumbnail.Imag... | elhoyos/colombiatransparente | transparencia/models.py | Python | gpl-3.0 | 2,979 | 0.004028 |
# Copyright 2018 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... | hfp/tensorflow-xsmm | tensorflow/python/kernel_tests/list_ops_test.py | Python | apache-2.0 | 51,102 | 0.009236 |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
import onenote
import bitbucket
# sample repo_uuid = 3d316876-a913-4b20-b183-d57e919f96dc
BASE_URL = "https://afternoon-waters-2404.herokuapp.com"
# DEV_URL = "https://classnotes-varunagrawal.c9.io"
# Create your views h... | varunagrawal/ClassNotes | notes/views.py | Python | mit | 4,070 | 0.009337 |
# Copyright (c) 2012-2013 Paul Tagliamonte <paultag@debian.org>
# Copyright (c) 2013 Leo Cavaille <leo@cavaille.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, inc... | lucaskanashiro/debile | debile/slave/runners/pep8.py | Python | mit | 1,811 | 0 |
"""
A collection of Gradient Boosting type classifier models.
.. autoclass:: revscoring.scoring.models.GradientBoosting
:members:
:member-order:
"""
import logging
from sklearn.ensemble import GradientBoostingClassifier
from .sklearn import ProbabilityClassifier
logger = logging.getLogger(__name__)
class ... | wiki-ai/revscoring | revscoring/scoring/models/gradient_boosting.py | Python | mit | 462 | 0 |
from django.contrib import admin
from login.models import Category, Page
from login.models import UserProfile
class CategoryAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug':('name',)}
admin.site.register(Category, CategoryAdmin)
admin.site.register(Page)
admin.site.register(UserProfile)
# Register your mo... | jnayak1/cs3240-s16-team16 | login/admin.py | Python | mit | 331 | 0.003021 |
#
# Copyright (c) 2009-2015, Jack Poulson
# All rights reserved.
#
# This file is part of Elemental and is under the BSD 2-Clause License,
# which can be found in the LICENSE file in the root directory, or at
# http://opensource.org/licenses/BSD-2-Clause
#
from El.core import *
# Coherence
# =========
lib.ElCoh... | justusc/Elemental | python/optimization/util.py | Python | bsd-3-clause | 18,829 | 0.038239 |
from helper import unittest, PillowTestCase, hopper
class TestImageToBytes(PillowTestCase):
def test_sanity(self):
data = hopper().tobytes()
self.assertIsInstance(data, bytes)
if __name__ == '__main__':
unittest.main()
| davidwilson-85/easymap | graphic_output/Pillow-4.2.1/Tests/test_image_tobytes.py | Python | gpl-3.0 | 247 | 0.004049 |
# -*- coding: utf-8 -*-
import mimetypes
import os
from datetime import datetime, timedelta
from urlparse import urljoin
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils import encoding
import jingo
import test_utils
from mock import Mock, patch
from nos... | clouserw/olympia | apps/amo/tests/test_helpers.py | Python | bsd-3-clause | 15,825 | 0 |
import yaml
import os
from ..boids import Boids
from nose.tools import assert_equal
import random
import numpy as np
from unittest.mock import patch
import unittest.mock as mock
def test_Boids():
flock = Boids(boid_number=10,move_to_middle_strength=0.1,alert_distance=100,formation_flying_distance=900,formation_fly... | GarlandDA/bad-boids | bad_boids/test/test_boids.py | Python | mit | 5,230 | 0.039962 |
#!/usr/bin/env python
import sys
def ip2str(ip):
l = [
(ip >> (3*8)) & 0xFF,
(ip >> (2*8)) & 0xFF,
(ip >> (1*8)) & 0xFF,
(ip >> (0*8)) & 0xFF,
]
return '.'.join([str(i) for i in l])
def str2ip(line):
a, b, c, d = [int(s) for s in line.split('.')]
ip = 0
ip +... | owalch/oliver | linux/config/scripts/ipblock.py | Python | bsd-2-clause | 870 | 0.006897 |
# Import the tkinter library
from tkinter import *
# Making a window object
root = Tk()
# Need to have window onscreen until you need to get rid of it.
root.mainloop()
| washbz250/LearnPythonTheHardWay | Python3/Tkinter/main.py | Python | unlicense | 173 | 0.011561 |
'''Trains a simple convnet on the Fashion MNIST dataset.
Gets to % test accuracy after 12 epochs
(there is still a lot of margin for parameter tuning).
'''
from __future__ import print_function
import keras
from keras.datasets import fashion_mnist
from keras.models import Sequential
from keras.layers import Dense, Dr... | erramuzpe/seattle-perceptual-learning | perclearn/scripts/fashion_mnist_cnn.py | Python | apache-2.0 | 2,248 | 0 |
# Copyright (c) 2013 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 writ... | rnirmal/savanna | savanna/tests/integration/test_config/test_cluster_config.py | Python | apache-2.0 | 6,861 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def add_legacy_name(apps, schema_editor):
ContentType = apps.get_model('contenttypes', 'ContentType')
for ct in ContentType.objects.all():
try:
ct.name = apps.get_model(ct.app_label, c... | BitWriters/Zenith_project | zango/lib/python3.5/site-packages/django/contrib/contenttypes/migrations/0002_remove_content_type_name.py | Python | mit | 1,168 | 0.000856 |
import time, copy
import os, os.path
import sys
import numpy
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from scipy import optimize
from echem_plate_ui import *
from echem_plate_math import *
import pickle
p1='C:/Users/Gregoire/Documents/CaltechWork/echemdrop/2012-9_FeCoNiTi/results/echemplots/2012-9_FeCoNiT... | johnmgregoire/JCAPdatavis | echem_paperplots.py | Python | bsd-3-clause | 3,052 | 0.020315 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from csv import DictReader, DictWriter
from datetime import datetime
from os import environ
from sys import argv
from time import sleep
import requests
from requests_oauthlib import OAuth1
from urlparse import parse_qs
# (command, argument, input, output) = argv[1:]
# ... | geraldarthur/PrismJr | twitter.py | Python | mit | 5,815 | 0.003955 |
#!/usr/bin/env python
import itertools
import six
from csvkit import CSVKitReader
from csvkit.cli import CSVKitUtility
from csvkit.headers import make_default_headers
class CSVLook(CSVKitUtility):
description = 'Render a CSV file in the console as a fixed-width table.'
def add_arguments(self)... | haginara/csvkit | csvkit/utilities/csvlook.py | Python | mit | 2,305 | 0.004338 |
import requests
import yaml
class RequestsApi:
def __init__(self):
'init'
self.config = yaml.load(open("config/request_settings.yml", "r"))
def get_objects(self, sector):
'request to get objects'
objects_points = []
url = self.config['host'] + self.config['object_path'] % sector
response = requests.get... | veskopos/VMWare | api/requests_api.py | Python | gpl-2.0 | 1,010 | 0.036634 |
# coding: utf-8
def transform_form_error(form, verbose=True):
"""
transform form errors to list like
["field1: error1", "field2: error2"]
"""
errors = []
for field, err_msg in form.errors.items():
if field == '__all__': # general errors
errors.append(', '.join(err_m... | telminov/sw-django-utils | djutils/forms.py | Python | mit | 604 | 0 |
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public ... | 3dfxsoftware/cbss-addons | account_voucher_move_id/__openerp__.py | Python | gpl-2.0 | 1,448 | 0.002762 |
import random
import numpy
import isambard
def random_angles(n=1, min_val=0, max_val=180, radians=False):
angles = [(random.random() * random.choice(range(abs(max_val - min_val)))) + min_val for _ in range(n)]
if radians:
angles = [numpy.rad2deg(x) for x in angles]
return angles
def random_vect... | woolfson-group/isambard | unit_tests/random_isambard_objects.py | Python | mit | 2,186 | 0.005489 |
# Copyright (C) 2011-2018 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 version 3 of the License, or
# (at your opt... | snakeleon/YouCompleteMe-x64 | python/ycm/youcompleteme.py | Python | gpl-3.0 | 31,916 | 0.027259 |
# Copyright (C) 2019 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 to in wr... | openstack/doc8 | src/doc8/__main__.py | Python | apache-2.0 | 641 | 0 |
# Build out a means of storing this data into a DB and preserving it for archival and analysis
client_id = "crmdatagettest"
client_secret = "I88RXVb9y1Am0AXauUSdOr8Pux9zAwNHDRSLX0UKmI6SbtTI0u4inxGa8i6cwVqi"
username = "camjcollins@gmail.com"
password = "Padthai123*"
from pypodio2 import api
import pygsheets
impor... | CamFlawless/python_projects | crm/src/podio_2.py | Python | mit | 18,252 | 0.01808 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.