code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
from telemetry import story
class ToughPinchZoomCasesPage(page_m... | Chilledheart/chromium | tools/perf/page_sets/tough_pinch_zoom_cases.py | Python | bsd-3-clause | 8,624 |
# Copyright (c) 2017 Ansible Tower by Red Hat
# All Rights Reserved.
from awx.main.utils.insights import filter_insights_api_response
from awx.main.tests.data.insights import TEST_INSIGHTS_HOSTS, TEST_INSIGHTS_PLANS, TEST_INSIGHTS_REMEDIATIONS
def test_filter_insights_api_response():
actual = filter_insights_ap... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/main/tests/unit/utils/test_insights.py | Python | apache-2.0 | 1,335 |
#
# $Id: sphinxapi.py 1775 2009-04-06 22:15:58Z shodan $
#
# Python version of Sphinx searchd client (Python API)
#
# Copyright (c) 2006-2008, Andrew Aksyonoff
# Copyright (c) 2006, Mike Osadnik
# All rights reserved
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GN... | zeha/pkg-sphinxsearch | api/sphinxapi.py | Python | gpl-2.0 | 25,959 |
import unittest
from unittest.mock import Mock
from unittest.mock import MagicMock
from unittest.mock import patch
#from server import ProxyServer
from tornado.testing import AsyncHTTPTestCase
from tornado.testing import AsyncTestCase
import tornado.web
from tornado.concurrent import Future
from tornado.testing import ... | dbpedia/dbpedia-widgets | proxy/tests/server_test.py | Python | gpl-2.0 | 2,890 |
"""
/***************************************************************************
Name : ProfileTenureView
Description : A widget for rendering a profile's social tenure
relationship.
Date : 9/October/2016
copyright : John Kahiu
email ... | gkahiu/Profile-Tenure-View | profile_tenure_view.py | Python | gpl-3.0 | 58,407 |
# Copyright (c) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | keedio/sahara | sahara/plugins/cdh/resources/cdh_config.py | Python | apache-2.0 | 2,426 |
import operator
from functools import reduce
import django_filters
from django.db.models import Q
import dateutil.parser
from core.services import delimit_filtervalue
from .models import YaraRule
class YaraRuleFilter(django_filters.rest_framework.FilterSet):
identifier = django_filters.CharFilter(method='fi... | PUNCH-Cyber/YaraGuardian | rules/REST_filters.py | Python | apache-2.0 | 9,135 |
#!/usr/bin/env python
import os
import click
from app.management import prepare_database
@click.group()
def main():
pass
@main.command(help='Run web app')
@click.option('--debug', help='Turn on debug toolbar')
def runserver(debug):
opts = []
if debug:
opts.append(['--debug-toolbar'])
os.... | maxzheng/part-of-family | manage.py | Python | mit | 530 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
r"""
Coordinate importing script.
Usage:
python pwb.py coordinate_import -lang:en -family:wikipedia \
-cat:Category:Coordinates_not_on_Wikidata
This will work on all pages in the category "coordinates not on Wikidata" and
will import the coordinates on these page... | darthbhyrava/pywikibot-local | scripts/coordinate_import.py | Python | mit | 4,102 |
import unittest
import os
from s3authbasic import main
from s3authbasic.testing import S3ConnectionMockup
from pyramid.exceptions import ConfigurationError
class SettingsFile(unittest.TestCase):
def test_correct_settings(self):
settings = {
'user_admin': '8c6976e5b5410415bde908bd4dee15dfb16'
... | ant30/s3authbasic | s3authbasic/tests/test_settings.py | Python | mit | 2,490 |
# -*- coding: utf-8 -*-
"""This is a custom local plugin to ad extra functionality to the pycon site."""
# Third party imports
from setuptools import setup
setup(
name='lektor-pycon-plugin',
author='Gonzalo Peña-Castellanos',
author_email='goanpeca@gmail.com',
url='https://github.com/pyconcolombia/we... | PyConColombia/website-2018 | packages/lektor_pycon_plugin/setup.py | Python | unlicense | 613 |
import unittest
from mach_o.headers.mach_header import MachHeader, CpuType, CpuSubType, MachHeader64
class TestMachHeader(unittest.TestCase):
def setUp(self):
with open('./binaries/executable.i386', 'rb') as f1:
self.executable_i386 = f1.read()
with open('./binaries/object.o.i386', 'rb... | hkkwok/MachOTool | tests/test_mach_header.py | Python | apache-2.0 | 3,335 |
#!/usr/bin/env python
###############################################################################
# vim: tabstop=4:shiftwidth=4:expandtab:
# Copyright (c) 2017-2018 SIOS Technology Corp. All rights reserved.
##############################################################################
import logging
__log__ = logg... | siostechcorp/Signal_iQ | python/SignaliQ/model/CloudVM.py | Python | mit | 1,125 |
from PIL import Image, ImageFilter, ImageDraw
from constants import *
import cv2
import colorsys
import numpy
from helpers import *
class CoinCategorize:
def __init__(self, image, coins):
self.image = image
self.width = self.image.size[0]
self.height = self.image.size[1]
self.rgb_pi... | jeffninghan/coins | coin_categorize.py | Python | mit | 3,013 |
"""Contains mock HTTPConnection objects that imitate the behavior of
HTTPConnection from httplib. Cassette works by monkeypatching HTTPConnection
to check if a certain request has been cached already.
Note that although requests, urllib3 and urllib2 all use httplib, urllib3
uses its own, subclassed, version of HTTPCon... | uber/cassette | cassette/http_connection.py | Python | bsd-3-clause | 5,035 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-10 21:47
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('courses', '0018_course_default_ordering'),
]
operations = [
migrations.AlterModelOp... | mitodl/micromasters | courses/migrations/0019_courserun_default_ordering.py | Python | bsd-3-clause | 425 |
"""
$url raiplay.it
$type live
$region Italy
"""
import logging
import re
from urllib.parse import urlparse, urlunparse
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
log = logging.getLogger(__name__)
class RaiPlayHLSStream... | chhe/streamlink | src/streamlink/plugins/raiplay.py | Python | bsd-2-clause | 1,786 |
"""
Grading tests
"""
import unittest
from datetime import datetime, timedelta
import ddt
from pytz import UTC
import six
from six import text_type
from xmodule import graders
from xmodule.graders import AggregatedScore, ProblemScore, ShowCorrectness, aggregate_scores
class GradesheetTest(unittest.TestCase):
"... | edx-solutions/edx-platform | common/lib/xmodule/xmodule/tests/test_graders.py | Python | agpl-3.0 | 17,574 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-data-qna | samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_create_question_sync.py | Python | apache-2.0 | 1,661 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyCfgv(PythonPackage):
"""Validate configuration and produce human readable error messages... | rspavel/spack | var/spack/repos/builtin/packages/py-cfgv/package.py | Python | lgpl-2.1 | 711 |
"""
Forward modeling of the gravitational effects of half a spherical shell.
Can only calculate the effects in a point located at the pole at different
heights.
Components, gx, gy, gxy, gxz, and gyz are all equal to zero (0).
**Functions:**
* :func:`~fatiando.gravmag.half_sph_shell.potential`: the gravitational
p... | seancug/python-example | fatiando-0.2/fatiando/gravmag/half_sph_shell.py | Python | gpl-2.0 | 2,252 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" Test Profile """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import ... | aldebaran/qibuild | python/qibuild/test/test_profile.py | Python | bsd-3-clause | 3,324 |
from django import template
register = template.Library()
@register.simple_tag
def get_user_primary_email(user):
return user.emailaddress_set.get_primary(user=user)
@register.simple_tag
def get_user_other_emails(user):
return user.emailaddress_set.filter(primary=False)
| Benoss/django-cookiecutter | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/apps/myauth/templatetags/myauth_tags.py | Python | apache-2.0 | 283 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015 Smile (<http://www.smile.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Aff... | tiexinliu/odoo_addons | smile_holidays/tests/test_holidays.py | Python | agpl-3.0 | 3,563 |
import numpy as np
from scipy.optimize import minimize
class F:
def __init__(self, bias):
self.bias = bias
def __call__(self, x):
return sum([(xi - bi)**2 / 2. for (bi, xi) in zip(self.bias, x)])
class GradF(F):
def __call__(self, x):
return np.array([(xi - bi) for (bi, xi) in zip(... | horoshenkih/rgg | junk/scipy_optimize_test.py | Python | mit | 444 |
from __future__ import absolute_import
from __future__ import division
from six import text_type
from typing import Any, Dict, List, Tuple, Optional, Sequence, Callable, Union
from django.db import connection
from django.db.models.query import QuerySet
from django.template import RequestContext, loader
from django.cor... | paxapy/zulip | analytics/views.py | Python | apache-2.0 | 28,073 |
from datetime import datetime
__version__ = '0.0.6'
now = datetime.now
from pyriodic.interface import start_web_interface
from pyriodic.scheduler import Scheduler
from pyriodic.jobs import DurationJob
from pyriodic.jobs import DatetimeJob
from pyriodic.jobs import DatetimesJob
| Ayehavgunne/pyriodic | pyriodic/__init__.py | Python | bsd-2-clause | 280 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import traceback
from couchpotato.core.helpers.variable import tryInt, getIdentifier
from couchpotato.core.logger import CPLog
from couchpotato.core.media._base.providers.torrent.base import TorrentProvider
from couchpotato.core.media.movie.providers.base import M... | terbolous/couchpotato.provider.norbits | main.py | Python | gpl-2.0 | 4,188 |
#!/usr/bin/env python
__applicationName__ = "doxypy"
__blurb__ = """
doxypy is an input filter for Doxygen. It preprocesses python
files so that docstrings of classes and functions are reformatted
into Doxygen-conform documentation blocks.
"""
__doc__ = __blurb__ + \
"""
In order to make Doxygen preprocess files thro... | stosdev/nawia2014 | utils/doxypy.py | Python | gpl-3.0 | 14,005 |
#!/bin/python3
from physdata.xray import * # pip install physdata
import numpy as np
for element in fetch_elements():
if element.z not in [85, 87]: # Skip those with arbitrary density
a=np.asarray(element.get_coefficients(use_density=True))
np.savetxt(str(element.z)+".csv",np.transpose(a[:,0:2]*[1000,1]), fmt=... | Dih5/xpecgen | xpecgen/data/mu/get_mu.py | Python | gpl-3.0 | 342 |
from handlers import handlers
from handlers import handler
from db.database import PinDB
from notification.event_notification import MITMNotification
from handlers.base import BaseHandler
from conf import config, debug_logger
import logging
logger = logging.getLogger(__name__)
@handler(handlers, isHandler=config.V... | alvarofe/cassle | handlers/keycontinuity.py | Python | gpl-3.0 | 1,993 |
from os import path
from setuptools import setup, find_packages
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='ETLT',
version='0.9.4',
description='Extract Transform Load - but not in that strict... | SetBased/py-etlt | setup.py | Python | mit | 1,092 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is very different to AboutModules in Ruby Koans
# Our AboutMultipleInheritance class is a little more comparable
#
from runner.koan import *
#
# Package hierarchy of Python Koans project:
#
# contemplate_koans.py
# koans/
# __init__.py
# about_asserts.py... | tokyo-jesus/university | src/python/koans/python2/koans/about_packages.py | Python | unlicense | 2,142 |
#coding:utf-8
import sys,os
import copy
import re
import itertools
import net
"""basic from web.py: makes web apps (http://webpy.org)"""
__version__ = "0.37"
__author__ = [
"Aaron Swartz <me@aaronsw.com>",
"Anand Chitipothu <anandology@gmail.com>"
]
__license__ = "public domain"
__contributors__ = "see https:... | davislidaqing/Mcoderadius | toughradius/console/libs/pyforms/__init__.py | Python | agpl-3.0 | 12,706 |
#!/usr/bin/python
"""Preferences Editor for Terminator.
Load a UIBuilder config file, display it,
populate it with our current config, then optionally read that back out and
write it to a config file
"""
import os
import gtk
from util import dbg, err
import config
from keybindings import Keybindings, KeymapError
f... | FreedomBen/terminator | terminatorlib/prefseditor.py | Python | gpl-2.0 | 57,238 |
# coding: utf-8
#
# Copyright 2018 The Oppia 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 requi... | kevinlee12/oppia | scripts/linters/pylint_extensions_test.py | Python | apache-2.0 | 129,932 |
# -*- coding: utf-8 -*-
from django.forms import TextInput, Media, TextInput, CharField, Form, MultiWidget
from django.template import Template, Context
from django.test import TestCase
from django.test.utils import override_settings
@override_settings(
STATIC_URL=None,
MEDIA_URL='http://media.example.com/med... | openhatch/new-mini-tasks | vendor/packages/Django/tests/regressiontests/forms/tests/media.py | Python | apache-2.0 | 45,513 |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from numpy import vstack,array
from numpy.random import rand
from scipy.cluster.vq import kmeans,vq
import sys, getopt
import os,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe... | lmarent/network_agents_ver2_python | agents/figures/offers_evolution_adj.py | Python | mit | 5,200 |
#!/usr/bin/env python2.6
#Copyright (C) 2009-2010 :
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
#This file is part of Shinken.
#
#Shinken 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 Fr... | baloo/shinken | test/test_service_withhost_exclude.py | Python | agpl-3.0 | 1,735 |
# -*- coding: UTF-8 -*-
import gettext
import locale
import os
from Tools.Directories import SCOPE_LANGUAGE, resolveFilename
class Language:
def __init__(self):
gettext.install('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), unicode=0, codeset="utf-8")
gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANG... | IanSav/enigma2 | lib/python/Components/Language.py | Python | gpl-2.0 | 5,363 |
# -*- coding: utf-8 -*-
"""Query the worldcat.org xID service for metadata."""
import logging
from .dev import stdmeta
from .dev._bouth23 import u
from .dev._exceptions import (DataWrongShapeError, ISBNNotConsistentError,
NoDataForSelectorError, RecordMappingError)
from .dev.webquery imp... | jonasjberg/autonameow | autonameow/vendor/isbnlib/_wcat.py | Python | gpl-2.0 | 2,488 |
#!/usr/bin/env python
"""Base class for api services."""
import contextlib
import datetime
import logging
import pprint
from protorpc import message_types
from protorpc import messages
import six
from six.moves import http_client
from six.moves import urllib
from apitools.base.py import credentials_lib
from apitoo... | craigcitro/original-apitools | apitools/base/py/base_api.py | Python | apache-2.0 | 22,375 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Francois Boulogne
# License:
import logging
from bibtexparser.bibdatabase import BibDatabase
logger = logging.getLogger(__name__)
__all__ = ['BibTexWriter']
def to_bibtex(parsed):
"""
Convenience function for backwards compatibility.
"""
retur... | RTSYork/bibtex | bibtexparser/bwriter.py | Python | mit | 3,933 |
"""
Depends on filter_weather_data.filters.preparation.average_husconet_temperature
"""
import logging
import os
import pandas
from matplotlib import pyplot
from matplotlib import ticker as mticker
import seaborn
from gather_weather_data.husconet import HUSCONET_STATIONS
from gather_weather_data.husconet import OFFIC... | 1kastner/analyse_weather_data | plot_weather_data/show_husconet_properties.py | Python | agpl-3.0 | 1,406 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | dhuang/incubator-airflow | airflow/timetables/interval.py | Python | apache-2.0 | 3,585 |
import discord
import time
import logging
# Set up the logging module to output diagnostic to the console.
logging.basicConfig()
client = discord.Client()
client.login('email', 'password')
if not client.is_logged_in:
print('Logging in to Discord failed')
exit(1)
@client.event
def on_ready():
print('Conn... | megamit/discord.py | examples/edits.py | Python | mit | 792 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import division, print_function
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
def pyunit_apply():
fr = h2o.import_file(pyunit_utils.locate("smalldata/logreg/prostate.csv"))
fr.apply(lambda x: x["PSA"], axis=1).... | mathemage/h2o-3 | h2o-py/tests/testdir_misc/pyunit_apply.py | Python | apache-2.0 | 1,195 |
""" Test suite for the code in msilib """
import unittest
from test_support import TESTFN, import_module, run_unittest, unlink
msilib = import_module('msilib')
import msilib.schema
def init_database():
path = TESTFN + '.msi'
db = msilib.init_database(
path,
msilib.schema,
'Python Tests... | IronLanguages/ironpython2 | Src/StdLib/Lib/test/test_msilib.py | Python | apache-2.0 | 3,075 |
#this is my main server code
#COPYRIGHTED. DO NOT COPY.
#YOU WILL BE FINED $999,999,999,999,999 INSTANTLY
import cgi
import re
import pymongo
import bottle
from bson.objectid import ObjectId
from bottle import route,post,default_app,run,static_file,request
from bottle import mako_template as template
from datetime imp... | vrweb/server | mall.py | Python | gpl-3.0 | 4,565 |
#!/usr/bin/env python3
def hello_world():
print("hello world")
if __name__ == '__main__':
""" Entry point of the program when this file is run as the main script.
"""
hello_world() | Shawn1874/CodeSamplesCpp | CodeSamplesPython/PythonSamples/PythonHelloWorld/PythonHelloWorld.py | Python | mit | 200 |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import sys
from nose.plugins.skip import SkipTest... | alexlo03/ansible | test/units/modules/network/f5/test_bigiq_application_https_waf.py | Python | gpl-3.0 | 6,196 |
from __future__ import absolute_import, division, print_function
import pytest
h5py = pytest.importorskip('h5py')
import sys
from distutils.version import LooseVersion
import numpy as np
from datashape import discover
from blaze import compute
from blaze.expr import symbol
from blaze.utils import tmpfile
from bla... | ChinaQuants/blaze | blaze/compute/tests/test_h5py.py | Python | bsd-3-clause | 5,494 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsLayoutExporter
.. note:: 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 version.
"""
... | tudorbarascu/QGIS | tests/src/python/test_qgslayoutexporter.py | Python | gpl-2.0 | 47,818 |
# Copyright (C) 2013 Aniket Panse <contact@aniketpanse.in>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This pro... | johnnykv/heralding | heralding/capabilities/http.py | Python | gpl-3.0 | 3,366 |
"""
WSGI config for GiftCircle 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/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SE... | jstitch/gift_circle | GiftCircle/GiftCircle/wsgi.py | Python | gpl-3.0 | 397 |
from baselines.common.console_util import *
from baselines.common.dataset import Dataset
from baselines.common.math_util import *
from baselines.common.misc_util import *
| peheje/baselines | baselines/common/__init__.py | Python | mit | 171 |
#!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/
... | SciViews/sciviewsk | components/koRLinter.py | Python | lgpl-2.1 | 6,386 |
import pytest
import s
def test_logic_immutalizes():
@s.fn.logic
def fn(x):
x[1] = 2
with pytest.raises(ValueError):
fn({})
def test_stack():
start = s.fn._stack()
@s.fn.logic
def fn1():
assert s.fn._stack() == ('logic:{}:fn1'.format(__name__),)
return fn2()
... | lowks/shared | test_s/fast/fn.py | Python | mit | 2,329 |
import datetime
import os
import sys
import re
import numpy as np
from visnav.algo import tools
from visnav.plots.mergelogs import read_logfile
from settings import LOG_DIR
from visnav.testloop import TestLoop
def main():
try:
mission = sys.argv[1]
postfix = sys.argv[2]
... | oknuutti/visnav-py | visnav/plots/make-result-tables-v2.py | Python | mit | 6,887 |
import sys, socket, string, re
class irc(object):
def __init__(self, host, port, name):
self.host = host
self.port = port
self.name = name
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def send_data(self, data):
self._sock.send(data + "\n")
def connect(self):
self._sock.connect(... | sepol/pybot | irc.py | Python | mit | 1,354 |
# -*- coding: utf-8 -*-
# parent class for scripts, calls RulesetCommon as own parent class
from rulesets.ruleset import RulesetCommon
from format.namespace import LEXINFO, ONTOLEX
from rdflib import URIRef
class ScriptCommon(RulesetCommon):
def __init__(self,config,language,dont_ask=False):
RulesetCommon.__init__... | wimmuskee/ontolex-db | rulesets/scripts/script.py | Python | mit | 2,050 |
#!/usr/bin/python
#============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distribu... | Hearen/OnceServer | pool_management/bn-xend-core/xend/XendGpfsStorageRepo.py | Python | mit | 21,201 |
import numpy as np
from dataset._shared import Dataset, index_to_indicator
def copy(items, T=9, classes=10):
X = np.zeros((items, T), dtype='int32')
X[:, 0:(T - 1)] = np.random.randint(1, classes, size=(items, T - 1))
t = np.zeros((items, T), dtype='int32')
t[:, 0:(T - 1)] = X[:, 0:(T - 1)]
ret... | AndreasMadsen/bachelor-code | dataset/network.py | Python | mit | 1,209 |
# Copyright 2015 Isotoma 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 agreed to in writing... | mitchellrj/touchdown | touchdown/core/map.py | Python | apache-2.0 | 4,870 |
import os
from gettext import gettext as _
from logging import getLogger
from gnupg import GPG
from mongoengine import NotUniqueError
from pulp.common.plugins import importer_constants
from pulp.plugins.util.publish_step import PluginStep, SaveUnitsStep
from pulp.server.content.storage import SharedStorage
from pul... | rbarlow/pulp_ostree | plugins/pulp_ostree/plugins/importers/steps.py | Python | gpl-2.0 | 12,376 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://genshi.edgewall.org/wiki/License.
#
# This software consist... | Lyleo/OmniMarkupPreviewer | OmniMarkupLib/Renderers/libs/python3/genshi/builder.py | Python | mit | 11,729 |
## The Perfect Meal
## Author: Christopher Olsen
## Copyright: 2013
## License: GNU GPL v3
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## ... | CJOlsen/perfect-meal | perfectmeal.py | Python | gpl-3.0 | 23,642 |
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
from cms.plugins.vzaar import settings
from cms.plugins.vzaar.models import Vzaar
from cms.plugins.vzaar.forms import VzaarForm
class VzaarPlugin(CMSPluginBase):
model = Vzaar
... | newmanbrad/djangocms-vzaar-widget | vzaar/cms_plugins.py | Python | bsd-3-clause | 897 |
# Copyright (c) 2013 Nicolas Dandrimont <nicolas.dandrimont@crans.org>
#
# 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 rights to use,... | mtmiller/hy | hy/lex/parser.py | Python | mit | 8,249 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... | pmghalvorsen/gramps_branch | gramps/gen/filters/rules/family/_motherhasidof.py | Python | gpl-2.0 | 1,877 |
# GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or with... | airelil/pywinauto | pywinauto/handleprops.py | Python | bsd-3-clause | 14,685 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016, OVH SAS
#
# This file is part of ip-reputation-monitoring.
#
# ip-reputation-monitoring 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 L... | ovh/ip-reputation-monitoring | reputation/api/services/spamhaus.py | Python | gpl-3.0 | 1,449 |
#!/usr/bin/python
# coding: utf-8
# import web_pdb
import xbmc
import logging
from resources.lib.monitor import MyMonitor
from resources.lib.player import MyPlayer
from resources.lib.serviceapi import ServiceApi
from resources.lib import globals
from resources.lib.kodiUtilities import (
getSettingAsBool,
getSe... | kugan49/xbmc-betaseries | service.betaseries.com/resources/lib/service.py | Python | gpl-2.0 | 1,798 |
# -*- coding: utf-8 -*-
"""Tests for psychopy.compatibility"""
from builtins import object
import os
from psychopy import constants, compatibility
import pytest
pytestmark = pytest.mark.skipif(
constants.PY3,
reason='Python3 cannot import the old-style pickle files')
thisPath = os.path.split(__file__)[0]
fixt... | hoechenberger/psychopy | psychopy/tests/test_compatibility/test_compatibility.py | Python | gpl-3.0 | 1,242 |
#!/usr/bin/python
import datetime
from random import randint
from time import sleep
import sys
import os
# pass in the name of the file
outputpath = os.path.normpath(sys.argv[1])
# default sleep time
if (sys.argv[2]):
sleep_time = sys.argv[2]
else:
sleep_time = 5
#run forever
while (True):
# get start s... | kyanyoga/perfmon | bin/genStats.py | Python | mit | 871 |
import random
def autoBackdropCustom():
# Copyright (c) 2009 The Foundry Visionmongers Ltd. All Rights Reserved.
'''
Automatically puts a backdrop behind the selected nodes.
The backdrop will be just big enough to fit all the select nodes in, with room
at the top for some text in a large font.
'''
sel... | Ahuge/Nuke | Ahuge Tools/Tools/Backdrop Node/1.1/Backdrop.py | Python | gpl-3.0 | 1,803 |
from django.apps import AppConfig
class CrontabConfig(AppConfig):
name = 'crontab'
| hyperwd/hwcram | crontab/apps.py | Python | mit | 89 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | sxjscience/tvm | python/tvm/relay/op/_transform.py | Python | apache-2.0 | 26,343 |
# -*- coding: utf-8 -*-
"""
TODO: Rename to ibeis/init/commands.py
The AID configuration selection is getting a mjor update right now
"""
from __future__ import absolute_import, division, print_function
import utool as ut
import numpy as np # NOQA
import six
from ibeis import params
(print, rrr, profile) = ut.inject2... | SU-ECE-17-7/ibeis | ibeis/init/old_main_helpers.py | Python | apache-2.0 | 22,040 |
from numpy.random import uniform, seed
from collections import OrderedDict
from matplotlib.mlab import griddata
from matplotlib import ticker
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np
import re,os
import random
import csv
from optparse import OptionParser
from collections ... | mfitzp/graphit | longitudinal.py | Python | gpl-3.0 | 14,172 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
r_li_padrange.py
----------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
**************************... | gioman/QGIS | python/plugins/processing/algs/grass7/ext/r_li_padrange.py | Python | gpl-2.0 | 1,330 |
# mypy: ignore-errors
from __future__ import annotations
import functools
from ._dtypes import _floating_dtypes, _numeric_dtypes
from ._array_object import Array
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._typing import Literal, Optional, Sequence, Tuple, Union
from typing import NamedTuple
impo... | cupy/cupy | cupy/array_api/linalg.py | Python | mit | 16,068 |
#!/usr/bin/env python3
# coding: utf-8
import io
from setuptools import setup, find_packages
# http://blog.ionelmc.ro/2014/05/25/python-packaging/
setup(
name="tfgraph",
version="0.2",
description="Python's Tensorflow Graph Library",
author="garciparedes",
author_email="sergio@garciparedes.me",
url="http... | tfgraph/tfgraph | setup.py | Python | apache-2.0 | 1,296 |
# $Id: presence.py 369517 2012-07-01 17:28:57Z file $
#
# Presence and instant messaging
#
# Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
#
# 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... | fluentstream/asterisk-p2p | res/pjproject/pjsip-apps/src/python/samples/presence.py | Python | gpl-2.0 | 5,374 |
from __future__ import unicode_literals
import threading
from django.test import TestCase, override_settings
from django.template import Template, RequestContext
from mock import MagicMock, Mock, patch, call
from amp_tools import get_amp_detect
from amp_tools.middleware import AMPDetectionMiddleware
from amp_tools... | shtalinberg/django-amp-tools | tests/test_base.py | Python | mit | 4,306 |
from .dev import *
COMPRESS_ENABLED = False
ALLOWED_HOSTS = ['web']
# Needed for template coverage report
TEMPLATES[0]['OPTIONS']['debug'] = True
# disable cache during tests
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
| harvard-lil/nuremberg | nuremberg/settings/test.py | Python | mit | 281 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Rating.user'
db.add_column('generic_rating', 'user',
self.gf('django.d... | wrwrwr/mezzanine | mezzanine/generic/migrations/0014_auto__add_field_rating_user.py | Python | bsd-2-clause | 8,561 |
# Copyright 2014 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 ... | catapult-project/catapult | third_party/gsutil/gslib/vendored/oauth2client/tests/contrib/test_keyring_storage.py | Python | bsd-3-clause | 6,950 |
"""Support for the Forecast.Solar sensor service."""
from __future__ import annotations
from datetime import datetime
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN, SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.h... | rohitranjan1991/home-assistant | homeassistant/components/forecast_solar/sensor.py | Python | mit | 2,651 |
import threading
import socket
import json
import time
import os
import signal
TICK_TIMEOUT = 0.1
global_lock = threading.Lock()
global_new_state_condition = threading.Condition()
def main(game, bindto):
"""
Main server function
game - game object instance
bindto - (host, port) tuple
"""
sig... | sygi/multitetris | multitetris/backend/main.py | Python | gpl-2.0 | 2,645 |
from django.db import models
class PageContent(models.Model):
id = models.AutoField(primary_key=True)
class Meta:
verbose_name='Page Content'
verbose_name_plural='Page Content'
def __unicode__(self):
return u'PageContent'
| MarconiMediaGroup/JobTrak | web/code/mmg/jobtrak/public/models.py | Python | apache-2.0 | 267 |
import pytest
from pireal.interpreter import lexer
from pireal.interpreter import parser
from pireal.interpreter import rast as ast
from pireal.interpreter.tokens import TokenTypes
# def test_visit_Assignment():
# tkn = lexer.Token(lexer.ID, 'q1')
# node_variable = ast.Variable(tkn)
# node_attr1 = ast.... | centaurialpha/pireal | tests/unit/test_interpreter.py | Python | gpl-3.0 | 2,149 |
from __future__ import absolute_import
import django
if django.VERSION < (1, 6):
# New style autodiscovery of tests doesn't work for Django < 1.6,
# and we don't want to duplicate tests for Django >= 1.6
from .test_basic import *
from .test_managers import *
from .test_models import *
from .tes... | SoftwareExperiment4/SungkyunWiki | wiki/tests/__init__.py | Python | gpl-3.0 | 445 |
# -*- coding: utf-8 -*-
#
import sys, os
import codecs
import json
import random
from argparse import ArgumentParser
sys.path.insert(1, os.path.join(os.path.join(sys.path[0], os.path.pardir), os.path.pardir))
from json_utils import load_json_file, load_json_stream
def main():
parser = ArgumentParser()
parser... | murawaki/comp-typology | scripts/mv/cv/make_cvmap.py | Python | bsd-3-clause | 1,892 |
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
js = [5, 20, 100]
d = 1
def storage(d, w):
return d * w
def bandwidth(j, d, w):
return j * f * storage(d, w) * 8
accepted = [0.5, 0.75, 0.99]
def supported(p, f):
return f * (1 - p)
# lines = []
#
# for j in js:
# x = []
# s = ... | Tethik/whistleblower | plots/reply.py | Python | mit | 1,088 |
# Generated by Django 3.0.5 on 2020-05-15 07:29
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("trans", "0077_auto_20200513_1512"),
]
operations = [
migrations.RemoveField(model_name="unit", name="has_comment"),
migrations.RemoveField(m... | nijel/weblate | weblate/trans/migrations/0078_auto_20200515_0729.py | Python | gpl-3.0 | 445 |
n = int(input())
arr = []
for i in range(n):
arr.append(input())
q = int(input())
for i in range(q):
query = input()
count = 0
for j in range(len(arr)):
if arr[j] == query:
count +=1
print(count)
| vipmunot/HackerRank | Data Structures/Arrays/Sparse Arrays.py | Python | mit | 249 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
from autoslug import AutoSlugField
# Create your models here.
class Course(models.Model):
course = mod... | pkom/gestionies | gestionies/courses/models.py | Python | bsd-3-clause | 3,328 |
#!/usr/bin/env python
import os
from jinja2 import Template
def main():
home = os.environ["HOME"]
logdir_launchpad = raw_input("Launchpad logging directory (e.g. %s): " % os.path.join(home, "fw", "logs", "launchpad"))
db_host = raw_input("Database host (e.g., x.mongolab.com): ")
db_name = raw_input(... | braysia/covertrack | initialize_fireworks.py | Python | mit | 2,053 |
#!/usr/bin/env python
command += testshade("-g 256 256 --center -od uint8 -o Cout out.tif test")
outputs = [ "out.txt", "out.tif" ]
| svenstaro/OpenShadingLanguage | testsuite/texture-withderivs/run.py | Python | bsd-3-clause | 133 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.