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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import logging
from translate.filters impor... | unho/pootle | pootle/apps/pootle_checks/utils.py | Python | gpl-3.0 | 18,998 |
# 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... | manipopopo/tensorflow | tensorflow/contrib/eager/python/remote_test.py | Python | apache-2.0 | 6,079 |
from __future__ import absolute_import
from datetime import datetime, timedelta
from celery.utils import timeutils
from celery.tests.utils import Case
class test_timeutils(Case):
def test_delta_resolution(self):
D = timeutils.delta_resolution
dt = datetime(2010, 3, 30, 11, 50, 58, 41065)
... | mozilla/make.mozilla.org | vendor-local/lib/python/celery/tests/test_utils/test_utils_timeutils.py | Python | bsd-3-clause | 2,258 |
"""
A small finite grammar with bound variables that don't have any args.
"""
from LOTlib.Grammar import Grammar
import math
g = Grammar()
g.add_rule("START", "S", ["NP", "VP"], 1.0)
g.add_rule("NP", "NP", ["det", "N"], 1.0)
g.add_rule("VP", "VP", ["V", "NP"], 1.0)
g.add_rule("VP", "AGE", ["is", "AGE", "yea... | ebigelow/LOTlib | LOTlib/Testing/old/Grammars/FiniteWithoutBVArgs.py | Python | gpl-3.0 | 2,331 |
from flask import Blueprint, Response, request, session, current_app
from sdc.crypto.encrypter import encrypt
from sdc.crypto.decrypter import decrypt
from app.authentication.user import User
from app.globals import (get_answer_store, get_metadata, get_questionnaire_store,
get_completed_block... | ONSdigital/eq-survey-runner | app/views/flush.py | Python | mit | 2,659 |
#!/usr/bin/env python
"""
Unit tests for M2Crypto.BN.
Copyright (c) 2005 Open Source Applications Foundation. All rights reserved.
"""
import re
import warnings
from M2Crypto import BN, Rand
from tests import unittest
loops = 16
class BNTestCase(unittest.TestCase):
def test_rand(self):
# defaults
... | Edzvu/Edzvu.github.io | M2Crypto-0.35.2/tests/test_bn.py | Python | mit | 2,021 |
##
# Copyright (c) 2009-2015 Apple 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 l... | red-hood/calendarserver | twistedcaldav/client/__init__.py | Python | apache-2.0 | 1,066 |
"""A collection of tools, tips, and tricks.
2009-07-20 22:36 IJC: Created
2010-10-28 11:53 IJMC: Updated documentation for Sphinx.
2011-06-15 09:34 IJMC: More functions have been added; cleaned documentation.
"""
import pdb
import numpy as np
def getfigs():
"""Return a list of all open matplotlib figures.
... | iancrossfield/aries_reduce | tools.py | Python | mit | 148,551 |
from bs4 import BeautifulSoup
import requests
import datetime
url='http://www.dukwon.hs.kr/user/carte/list.do?menuCd=#meals_date'
r=requests.get(url)
soup=BeautifulSoup(r.text,"html.parser")
mr=soup.find_all(class_="meals_table_day01")
now = datetime.datetime.now()
year=now.strftime("%Y")
month=now.strftime("%m")
d... | LeeJaeWonLJW/Kakao-Plus-Friend-Meal-Bot | Weekly Support/parser.py | Python | mit | 1,617 |
from insults import Insults
# TODO: this takes a while to load, might want to handle this loading better
Insults.load_model()
class Antisociality():
def __init__(self):
self.comment_ratings = []
self.most_likely_insult = (0, "")
self.insults_threshold = 0.5
def percentage_comments_th... | thundergolfer/mAIcroft | maicroft/intelligence/anti_sociality/core.py | Python | mit | 1,095 |
#
# MLDB-2126-export-structured.py
# Mathieu Marquis Bolduc, 2017-01-25
# This file is part of MLDB. Copyright 2017 mldb.ai inc. All rights reserved.
#
import tempfile
import codecs
import os
from mldb import mldb, MldbUnitTest, ResponseException
tmp_dir = os.getenv('TMP')
class MLDB2126exportstructuredTest(MldbUni... | mldbai/mldb | testing/MLDB-2126-export-structured.py | Python | apache-2.0 | 1,480 |
# coding=utf8
from django.views.generic import ListView, DetailView, CreateView
from django.db.models import Q
from django.http import JsonResponse, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.shortcuts import render
from pure_pagination.mixins import PaginationMixin
from django.contri... | 1032231418/python | lesson10/apps/books/publish/__init__.py | Python | apache-2.0 | 3,345 |
#!/usr/bin/env python3
# Copyright 2016-2018 Jan Chren (rindeal) <dev.rindeal@gmail.com>
# Distributed under the terms of the GNU General Public License v2
import os
import portage
import portage.dbapi
import portage.dbapi.porttree
import portage.dbapi.vartree
class EbuildRepoToolbox:
@staticmethod
def locate_re... | rindeal/gentoo-overlay | _tools/ebuild_repo_toolbox.py | Python | gpl-2.0 | 1,181 |
"""
WSGI config for api project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` sett... | urfonline/api | config/wsgi.py | Python | mit | 1,914 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 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 BIP68 implementation."""
from test_framework.test_framework import BitcoinTestFramework
from test... | dashpay/dash | test/functional/feature_bip68_sequence.py | Python | mit | 17,835 |
from __future__ import print_function
from acq4.util import Qt
import os
from acq4.analysis.AnalysisModule import AnalysisModule
from collections import OrderedDict
import pyqtgraph as pg
from pyqtgraph.metaarray import MetaArray
import numpy as np
import scipy
import acq4.util.functions as fn
from acq4.util.HelpfulExc... | acq4/acq4 | acq4/analysis/modules/MapImager/MapImager.py | Python | mit | 8,749 |
# $HeadURL$
__RCSID__ = "$Id$"
import DIRAC
from DIRAC import gLogger, rootPath, gConfig
from DIRAC.FrameworkSystem.private.monitoring.RRDManager import RRDManager
from DIRAC.Core.Utilities.ReturnValues import S_OK, S_ERROR
from DIRAC.Core.Utilities import DEncode, List
class ServiceInterface:
__sourceToComponentId... | Sbalbp/DIRAC | FrameworkSystem/private/monitoring/ServiceInterface.py | Python | gpl-3.0 | 17,192 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Import unicode literals so that StringIO works on both Python 2 and 3
from __future__ import unicode_literals
from __future__ import print_function
import sys
import os
import re
import time
from optparse import OptionParser
try:
# Python 3
from io import Strin... | ajjl/ITK | Wrapping/Generators/SwigInterface/igenerator.py | Python | apache-2.0 | 31,194 |
import os
import xml.etree.ElementTree
class CoverageData():
"""
Represents a coverage data file.
"""
def __init__(self, coverage_file):
self.coverage_file = coverage_file
self.elements = None
self.files = {}
def is_loaded(self):
"""
Checks if the XML dat... | bradfeehan/SublimePHPCoverage | php_coverage/data.py | Python | mit | 3,887 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Article',
fields=[
('id', models.AutoField(seri... | azul-cloud/tbscraper | blog/migrations/0001_initial.py | Python | mit | 1,333 |
import re
import bleach
from markdown import markdown
from shark.base import Object, BaseParamConverter
from shark.common import LOREM_IPSUM
from shark.param_converters import RawParam
ALLOWED_TAGS = ['ul', 'ol', 'li', 'p', 'pre', 'code', 'blockquote', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'br', 'strong', 'em', '... | Bart-Jellema/shark | shark/extensions/markdown.py | Python | bsd-3-clause | 3,326 |
import logging
from .serializer import serializer
from .kvs import KVS
log = logging.getLogger(__name__)
class PerlSession(object):
"""
Read only session from a perl storable.
Use the "connect method" during the configuration to initialize it
"""
cookie_name = None
client = None
def __... | KillianKemps/pyramid_kvs | pyramid_kvs/perlsess.py | Python | gpl-2.0 | 2,022 |
test_block = None
def get_block_dev():
global test_block
if test_block is None:
test_block = raw_input("Please input a free block dev(filepath) for block test: ")
test_block = test_block.strip()
return test_block
extra_test_block = None
def get_extra_block_dev():
global extra_test... | OpenSight/StorLever | storlever/tests/mngr/block/utils.py | Python | agpl-3.0 | 683 |
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Andrei Antoukh <niwi@niwi.be>
# License: BSD-3
# Description: Gevent 0.13+ / Treaded background task processor.
# Version: 0.1
import socket as standardsocket
from gevent import socket as geventsocket
import gevent
import logging
import time
logger = logging.getLogger("... | niwinz/niwi-web | src/niwi/contrib/tasklet.py | Python | bsd-3-clause | 1,428 |
# Copyright 2017 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... | dongjoon-hyun/tensorflow | tensorflow/python/data/experimental/kernel_tests/group_by_reducer_test.py | Python | apache-2.0 | 7,568 |
# -*- coding: utf-8 -*-
PLUGIN_NAME = u'No release'
PLUGIN_AUTHOR = u'Johannes Weißl'
PLUGIN_DESCRIPTION = '''Do not store specific release information in releases of unknown origin.'''
PLUGIN_VERSION = '0.1'
PLUGIN_API_VERSIONS = ['0.15']
from PyQt4 import QtCore, QtGui
from picard.album import Album
from picard.me... | dufferzafar/picard-plugins-testing | plugins/no_release/no_release.py | Python | gpl-3.0 | 4,927 |
#Github pull reqest builder for Jenkins
import os
import sys
import traceback
if('branch' in os.environ):
branch = os.environ['branch']
else:
branch = 'v4-develop'
if('WORKSPACE' in os.environ):
workspace = os.environ['WORKSPACE']
else:
workspace = "."
if('NODE_NAME' in os.environ):
node_name = ... | dxmgame/dxm-cocos | src/oslibs/cocos/cocos-src/tools/jenkins-scripts/daily-build.py | Python | mit | 4,138 |
from majorkirby import CustomActionNode
from boto import route53 as r53
import boto
class PublicHostedZone(CustomActionNode):
"""Represents a Route53 public hosted zone"""
INPUTS = {
'Region': ['global:Region'],
'PublicHostedZoneName': ['global:PublicHostedZoneName'],
'BackwardCompatP... | project-icp/bee-pollinator-app | deployment/cfn/public_hosted_zone.py | Python | apache-2.0 | 3,444 |
#
# This file will download all of the objects in a bucket that are
# associated with a specific BibleId/FileId
#
import boto3
import io
import os
media = "text"
bibleId = "ENGKJV"
target = "/Users/garygriswold/ShortSands/DBL/FCBH"
search = media + "/" + bibleId + "/"
searchLen = len(search)
session = boto3.Session(p... | garygriswold/Bible.js | Versions/Release.2.x.x/pyTmp/DBPDownloadObjects.py | Python | mit | 867 |
"""Test for Compute Resource UI
:Requirement: ComputeResources GCE
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: ComputeResources-GCE
:Assignee: lvrtelov
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import pytest
from fauxfactory import gen_string
from nailgun import entitie... | jyejare/robottelo | tests/foreman/ui/test_computeresource_gce.py | Python | gpl-3.0 | 5,616 |
# Copyright 2021 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... | chromium/chromium | third_party/tflite_support/src/tensorflow_lite_support/python/task/processor/proto/embeddings_pb2.py | Python | bsd-3-clause | 846 |
#!/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... | rmfitzpatrick/ansible | lib/ansible/modules/cloud/amazon/iam_policy.py | Python | gpl-3.0 | 14,001 |
import typing
from mitmproxy import controller
from mitmproxy import flow
from mitmproxy import http
from mitmproxy import tcp
from mitmproxy import websocket
Events = frozenset([
"clientconnect",
"clientdisconnect",
"serverconnect",
"serverdisconnect",
# TCP
"tcp_start",
"tcp_message",
... | MatthewShao/mitmproxy | mitmproxy/eventsequence.py | Python | mit | 2,199 |
from django.db import DatabaseError, IntegrityError
from health_check.backends import BaseHealthCheckBackend
from health_check.exceptions import (
ServiceReturnedUnexpectedResult, ServiceUnavailable
)
from .models import TestModel
class DatabaseBackend(BaseHealthCheckBackend):
def check_status(self):
... | KristianOellegaard/django-health-check | health_check/db/backends.py | Python | mit | 652 |
"""
Purpose: Set of unit tests for nilsimsa package.
Test data consists of 20 randomly selected documents from a Diffeo corpus.
This software is released under an MIT/X11 open source license.
Copyright 2012-2014 Diffeo, Inc.
"""
import cPickle as pickle
import dircache
import os
import pytest
import random
from dep... | lschollmeyer/py-nilsimsa | nilsimsa/test.py | Python | mit | 1,847 |
#!/usr/bin/python3
"""Tests for scripts/protect.py."""
#
# (C) Pywikibot team, 2014-2022
#
# Distributed under the terms of the MIT license.
#
import unittest
from contextlib import suppress
import pywikibot
import pywikibot.page
from scripts import protect
from tests.aspects import ScriptMainTestCase
class TestProt... | wikimedia/pywikibot-core | tests/protectbot_tests.py | Python | mit | 2,292 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | HybridF5/nova | nova/volume/cinder.py | Python | apache-2.0 | 23,017 |
from distutils.core import setup
setup(
name = "django-kong",
version = "0.9",
packages = [
"kong",
"kong.management",
"kong.management.commands",
"kong.templatetags",
"kong.tests",
],
author = "Eric Holscher",
author_email = "eric@ericholscher.com",
... | ericholscher/django-kong | setup.py | Python | mit | 676 |
# Copyright (C) 2010 Canonical Ltd
#
# 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.
#
# This program is distributed in ... | stewartsmith/bzr | bzrlib/recordcounter.py | Python | gpl-2.0 | 3,727 |
import itertools
import logging
import os
import time
from collections import deque
from golem.network.transport.network import ProtocolFactory, SessionFactory
from golem.network.transport.tcpnetwork import TCPNetwork, TCPConnectInfo, SocketAddress, MidAndFilesProtocol
from golem.network.transport.tcpserver im... | Radagast-red/golem | golem/task/taskserver.py | Python | gpl-3.0 | 43,113 |
# Copyright (c) 2016 Universidade Federal Fluminense (UFF)
# Copyright (c) 2016 Polytechnic Institute of New York University.
# This file is part of noWorkflow.
# Please, consult the license terms in the LICENSE file.
"""'now vis' command"""
from __future__ import (absolute_import, print_function,
... | gems-uff/noworkflow | capture/noworkflow/now/cmd/cmd_vis.py | Python | mit | 1,890 |
"""
Test censusdata.censusgeo class for representing geographies.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import censusdata
class TestCensusgeo(unittest.TestCase)... | jtleider/censusdata | test/test_censusgeo.py | Python | mit | 4,417 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.db.models import F
# pylint: skip-file
def transfer_datetimes(apps, schema_editor):
"""Move the added/edited stamps to the new, universal fields."""
Course = apps.get_model("learningresources... | amir-qayyum-khan/lore | learningresources/migrations/0006_move_datestamp_data.py | Python | agpl-3.0 | 737 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import geoposition.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [... | brabsmit/home-control | homecontrol/app/migrations/0001_initial.py | Python | mit | 988 |
import json
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.exceptions import ImproperlyConfigured
from django.middleware.csrf import get_token
from django.template.loader import render_to_string
from django.template import RequestContext
from django.utils.html import mark... | sih4sing5hong5/django-allauth | allauth/socialaccount/providers/facebook/provider.py | Python | mit | 6,899 |
"""
The :mod:`pyeda.boolalg.bdd` module implements
Boolean functions represented as binary decision diagrams.
Interface Functions:
* :func:`bddvar` --- Return a unique BDD variable
* :func:`expr2bdd` --- Convert an expression into a binary decision diagram
* :func:`bdd2expr` --- Convert a binary decision diagram into... | cjdrake/pyeda | pyeda/boolalg/bdd.py | Python | bsd-2-clause | 17,004 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_04_01/_configuration.py | Python | mit | 3,270 |
from pybufrkit.dataquery import NodePath, PathComponent
def test_node_path_str():
np = NodePath('')
np.add_component(PathComponent('/', '001001', slice(None, None, None)))
assert str(np) == '/001001[::]'
np = NodePath('')
np.subset_slice = 0
np.add_component(PathComponent('/', '001001', 2))
... | ywangd/pybufrkit | tests/test_nodepath.py | Python | mit | 623 |
# Copyright 2010 Michael Murr
#
# This file is part of LibForensics.
#
# LibForensics is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | 306777HC/libforensics | unittests/tests/apps/msoffice/shared/objects.py | Python | lgpl-3.0 | 75,472 |
from liblevmar import *
| raphaelvalentin/qtlayout | syntax/optimize/levmar/__init__.py | Python | gpl-2.0 | 24 |
#!/usr/bin/python2
# Copyright (C) 2015 George Karakou (gkarakou)
#
# 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.
#
#... | gkarakou/systemd-mailify | setup.py | Python | gpl-3.0 | 1,956 |
# -*- coding: utf-8 -*-
# Copyright 2017 KMEE
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from __future__ import division, print_function, unicode_literals
from odoo import api, fields, models, _
class FinancialDocumentType(models.Model):
_inherit = 'financial.document.type'
account_mov... | odoo-brazil/l10n-brazil-wip | financial_account/models/inherited_financial_document_type.py | Python | agpl-3.0 | 1,675 |
# Copyright (C) 2017 Lucas Hoffmann
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
"""Test suite for alot.settings.manager module."""
from __future__ import absolute_import
import os
import tempfile
import textwrap
import unittest
from alot.sett... | geier/alot | tests/settings/manager_test.py | Python | gpl-3.0 | 5,963 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-22 20:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sqlshare_rest', '0001_initial'),
]
operations = [
migrations.AddField(
... | uw-it-aca/sqlshare-rest | sqlshare_rest/migrations/0002_query_backend_terminate_data.py | Python | apache-2.0 | 455 |
#!/usr/bin/env python
import sys
sys.path.append("../")
from laspy import file
inFile = open(sys.argv[1], "r")
inData = inFile.read()
outFile = open(sys.argv[2], "w")
outFile.write(inData)
outFile.close()
inFile.close()
file_ = file.File(sys.argv[2], mode = "rw")
| silyko/laspy | misc/test_shell.py | Python | bsd-2-clause | 265 |
'''
Let's get this straight.
There are n+1 (n->infinity) names for the OAuthy credential pairs:
api key, api secret, consumer key, app id, api secret, app key...
Different apps name them however they please and we should store
them exactly once.
See the next functions for proof.
The only real exception to this is `... | fubaz/djheroku | djheroku/auth.py | Python | mit | 2,782 |
from itertools import combinations
string, k = input().strip().split()
string = sorted(string)
k = int(k)
for length in range(1, k + 1):
for combination in combinations(string, length):
print("".join(combination))
| rootulp/hackerrank | python/itertools-combinations.py | Python | mit | 228 |
"""
General utilities.
Fenced Code Tabs Extension for Python Markdown
This extension generates Bootstrap HTML Tabs for consecutive fenced code blocks
See <https://github.com/yacir/markdown-fenced-code-tabs> for documentation.
Copyright (c) 2017-present [Yassir Barchi](https://github.com/yacir).
License: [MIT](https... | yacir/markdown-fenced-code-tabs | markdown_fenced_code_tabs/util.py | Python | mit | 1,692 |
data = (
'[?]', # 0x00
'[?]', # 0x01
'[?]', # 0x02
'[?]', # 0x03
'[?]', # 0x04
'[?]', # 0x05
'[?]', # 0x06
'[?]', # 0x07
'[?]', # 0x08
'[?]', # 0x09
'[?]', # 0x0a
'[?]', # 0x0b
'[?]', # 0x0c
'[?]', # 0x0d
'[?]', # 0x0e
'[?]', # 0x0f
'[?]', # 0x10
'[?]... | gquirozbogner/contentbox-master | third_party/unidecode/x005.py | Python | apache-2.0 | 4,269 |
with open('endpoints.txt') as endpoints:
lines = endpoints.read()
endpoints = [l[2:-5] for l in lines.split()]
no_indecies = map(
lambda e: e[:-len("/index")] if e.endswith("/index") else e,
endpoints
)
prefixed = ["https://www.ubuntu.com/" + str(e) for e in no_indecies]
print("\n".join(prefixed))
| pmahnke/www.ubuntu.com | templates/list_endpoints.py | Python | lgpl-3.0 | 315 |
import os
import tornado.httpserver
import tornado.ioloop
import tornado.web
from creds import *
from requests import Request
import requests
import json
import re
import tempfile
import redis
import uuid
from pydub import AudioSegment
def gettoken(uid):
red = redis.from_url(redis_url)
token = red.get(uid+"-access... | blackshroud/alexaweb | app.py | Python | mit | 5,569 |
input = """
{a,b} :- c.
c | d.
:- not a.
"""
output = """
{a, c}
{a, c, b}
"""
| Yarrick13/hwasp | tests/asp/gringo/choice.007.test.py | Python | apache-2.0 | 80 |
# -*- coding: UTF-8 -*-
from django.contrib.auth.forms import AuthenticationForm
from django import forms
from django.forms import Form, ModelForm, DateInput
from suit_ckeditor.widgets import CKEditorWidget
from suit.widgets import HTML5Input
from captcha.fields import CaptchaField
from .models import Permit, Frog, Ope... | QBI-Software/FrogDB | frogs/forms.py | Python | gpl-3.0 | 18,090 |
from ResonatorBase import ResonatorBase
from sparse_diff_matr_1d import second_difference_matrix,fourth_difference_matrix
from math import sqrt
from scipy.sparse import identity
class Resonator1D(ResonatorBase):
def __init__(self,gamma=200,kappa=1,b1=0,b2=0,boundaryCond='BothSimplySupported'):
ResonatorBas... | supercollider-quarks/downloaded-quarks | PMLib/python/Resonator1D.py | Python | gpl-2.0 | 2,246 |
#
# Unix SMB/CIFS implementation.
# backend code for provisioning a Samba4 server
#
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008
# Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008-2009
# Copyright (C) Oliver Liebel <oliver@itc.li> 2008-2009
#
# This program is free software; you can redistribute ... | kernevil/samba | python/samba/schema.py | Python | gpl-3.0 | 10,027 |
"""index_artifacts
Revision ID: 340d5cc7e806
Revises: af3f4bdc27d1
Create Date: 2019-08-09 12:37:50.706914
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "340d5cc7e806"
down_revision = "af3f4bdc27d1"
branch_labels = ()
depends_on = None
def upgrade():
# ... | getsentry/zeus | zeus/migrations/340d5cc7e806_index_artifacts.py | Python | apache-2.0 | 705 |
"""
Defines task classes that can compile, link etc..
Task can depend upon one another.
These task are wrappers around the functions provided in the buildfunctions
module
"""
from .tasks import Task, TaskError, register_task
from ..utils.reporting import HtmlReportGenerator, DummyReportGenerator
from .. import api
fr... | windelbouwman/ppci-mirror | ppci/build/buildtasks.py | Python | bsd-2-clause | 7,591 |
from __future__ import print_function
import sys
from setuptools import setup, find_packages
import subprocess
import platform
if sys.version_info < (3,5):
print("SMPDF requires Python 3.5 or later", file=sys.stderr)
sys.exit(1)
with open("README.md") as f:
long_desc = f.read()
setup (name = 'reportengi... | Zaharid/reportengine | setup.py | Python | gpl-2.0 | 1,156 |
"""
Experiment for TRI + NN3
Aim: To find the best max_epochs for TRI(k_min = 2, k_max = 4,5) + NN3(1024, 1024, 1024)
max_epochs: [22, 24, ... ,98, 100]
Averaging 20 models
Summary
epochs loss
k_min k_max
2 4 76 0.421093
5 86 0.420173
Time: 5:04:31 on... | duthchao/kaggle-Otto | exp_NN3_TRI_max_epochs.py | Python | mit | 5,997 |
#!/usr/bin/env python
# Copyright 2013 Guillaume Emont <guij@emont.org>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later ... | guijemont/jekyll-comments | comments.py | Python | agpl-3.0 | 6,852 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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.
#
# This program is distrib... | jimflim/blender-scripts | extend.py | Python | gpl-2.0 | 8,848 |
import base64
import datetime
import os
from django.contrib.auth.forms import (
AuthenticationForm, PasswordResetForm, SetPasswordForm
)
from django.contrib.auth.tokens import default_token_generator
from django.core import mail
from django.conf import settings
from django.core.urlresolvers import reverse
from dja... | hizardapp/Hizard | hyrodactil/tests/accounts/test_views.py | Python | mit | 18,144 |
#!/usr/bin/env python
"""
Query the github API for the git tags of a project, and return a list of
version tags for recent releases, or the default release.
The default release is the most recent non-RC version.
Recent is a list of unique major.minor versions, where each is the most
recent version in the series.
For... | jrabbit/compose | script/test/versions.py | Python | apache-2.0 | 4,504 |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
CLIENT_DEBUG = DEBUG
YUI_DEBUG = DEBUG # use expanded yui version (i.e. not -min)
YUI_DISTANT = False
DATABASES = {
'default': {
'ENGINE': 'django.db.backend.<engine>', # YOUR_SETTINGS # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '<db_name>',... | co-ment/comt | settings_local_sample.py | Python | agpl-3.0 | 2,535 |
"""Copyright 2008 Orbitz WorldWide
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... | cosm0s/graphite-web | webapp/graphite/app_settings.py | Python | apache-2.0 | 2,268 |
"""Classes and functions enabling automated unit testing of plugins."""
import inspect
from collections import namedtuple
import sys
import unittest
from p1tr.logwrap import info, warning
from p1tr.plugin import _add_annotation, discover_plugins, load_by_name
"""Container for dummy test data sets."""
DummyData = name... | howard/p1tr-tng | p1tr/test.py | Python | mit | 6,671 |
import unittest
import utils
class WordDictionary:
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = {}
def addWord(self, word: str) -> None:
curr = self.root
for ch in word:
child = curr.get(ch)
if not chil... | chrisxue815/leetcode_python | problems/test_0211.py | Python | unlicense | 1,179 |
from django.conf.urls import url
from .views import CreatePostView, ListPostView
urlpatterns = [
url(r'(?P<subreddit_scope>(.*))/create/?$', CreatePostView.as_view(), name='create'),
url(r'(?P<subreddit_scope>(.*))/list/?$', ListPostView.as_view(), name='list'),
]
| agile-course/news_feed | news_feed/post/urls.py | Python | unlicense | 276 |
# Copyright 2016-2017 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import logging
from botocore.exceptions import ClientError
import mock
from c7n.exceptions import PolicyValidationError
from c7n.executor import MainThreadExecutor
from c7n.resources.aws impo... | capitalone/cloud-custodian | tests/test_ebs.py | Python | apache-2.0 | 25,361 |
#!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.pardir)
from testing_harness import TestHarness
class SourcepointTestHarness(TestHarness):
def _test_output_created(self):
"""Make sure statepoint.* and source* have been created."""
TestHarness._test_output_created(self)
so... | kellyrowland/openmc | tests/test_sourcepoint_latest/test_sourcepoint_latest.py | Python | mit | 654 |
from typing import Dict
from ray.rllib.env import BaseEnv
from ray.rllib.policy import Policy
from ray.rllib.evaluation import MultiAgentEpisode, RolloutWorker
from ray.rllib.utils.framework import TensorType
from ray.rllib.utils.typing import AgentID, PolicyID
class ObservationFunction:
"""Interceptor function ... | richardliaw/ray | rllib/evaluation/observation_function.py | Python | apache-2.0 | 3,036 |
#!/usr/bin/python2.7
#
# Test cases for tournament.py
from tournament import *
def testDeleteMatches():
deleteMatches()
print "1. Old matches can be deleted."
def testDelete():
deleteMatches()
deletePlayers()
print "2. Player records can be deleted."
def testCount():
deleteMatches()
de... | sabertazimi/st-proj | db/tournament_test.py | Python | mit | 4,598 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('lists', '0002_auto_20150301_1937'),
]
operations = [
migrations.AlterModelOptions(
... | imxiaohui/django-todolist-1 | lists/migrations/0003_auto_20150308_2120.py | Python | mit | 1,229 |
# -*- coding: utf-8 -*-
# Copyright 2019 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp import api, models
class ResUsers(models.Model):
_inherit = 'res.users'
@api.multi
def unlink(self):
"""
Finds any views assigned specifi... | acsone/server-tools | base_view_inheritance_extension/models/res_users.py | Python | agpl-3.0 | 1,340 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | datacommonsorg/data | scripts/eurostat/regional_statistics_by_nuts/fertility_rate_mother_age/fertility_rate_preprocess_gen_tmcf.py | Python | apache-2.0 | 3,789 |
# coding=utf-8
# Copyright 2019 The Google Research Authors.
#
# 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 applicab... | googleinterns/lasertagger | predict_main.py | Python | apache-2.0 | 3,588 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2008-2009 Benoit Chesneau <benoitc@e-engura.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTW... | jeremi/couchdbkit | tests/test_schema.py | Python | isc | 36,789 |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# 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 applicabl... | MaximNevrov/neutron | neutron/tests/unit/services/metering/drivers/test_iptables.py | Python | apache-2.0 | 21,614 |
import pytest
from aiohttp import helpers
from aiohttp import MultiDict
def test_parse_mimetype_1():
assert helpers.parse_mimetype('') == ('', '', '', {})
def test_parse_mimetype_2():
assert helpers.parse_mimetype('*') == ('*', '*', '', {})
def test_parse_mimetype_3():
assert (helpers.parse_mimetype(... | Srogozins/aiohttp | tests/test_helpers.py | Python | apache-2.0 | 4,599 |
import nose
import angr
import subprocess
import sys
import logging
l = logging.getLogger('angr.tests.sscanf')
import os
test_location = str(os.path.dirname(os.path.realpath(__file__)))
def run_sscanf(threads):
if not sys.platform.startswith('linux'):
raise nose.SkipTest()
test_bin = os.path.join(t... | f-prettyland/angr | tests/test_sscanf.py | Python | bsd-2-clause | 1,651 |
""" ProxyManagementAPI has the functions to "talk" to the ProxyManagement service
"""
import os
import datetime
from DIRAC import S_OK, S_ERROR, gLogger
from DIRAC.Core.Utilities import ThreadSafe, DIRACSingleton
from DIRAC.Core.Utilities.DictCache import DictCache
from DIRAC.Core.Security import Locations, CS
from DI... | arrabito/DIRAC | FrameworkSystem/Client/ProxyManagerClient.py | Python | gpl-3.0 | 19,735 |
# -*- coding: utf-8 -*-
###############################################################################
#
# TopRecipients
# Returns the top recipients of money from a specified organization.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "Licen... | jordanemedlock/psychtruths | temboo/core/Library/InfluenceExplorer/TopRecipients.py | Python | apache-2.0 | 3,530 |
# proxy module
from pyface.ui.wx.workbench.view_set_structure_handler import *
| enthought/etsproxy | enthought/pyface/ui/wx/workbench/view_set_structure_handler.py | Python | bsd-3-clause | 79 |
"""Pylons application test package
When the test runner finds and executes tests within this directory,
this file will be loaded to setup the test environment.
It registers the root directory of the project in sys.path and
pkg_resources, in case the project hasn't been installed with
setuptools. It also initializes t... | JustinTulloss/harmonize.fm | masterapp/masterapp/tests/__init__.py | Python | mit | 5,712 |
# coding: utf-8
# In[ ]:
# OpenGym CartPole-v0 with A3C on GPU
# -----------------------------------
#
# A3C implementation with GPU optimizer threads.
#
# Made as part of blog series Let's make an A3C, available at
# https://jaromiru.com/2017/02/16/lets-make-an-a3c-theory/
#
# original author: Jaromir Janisch, 201... | Froskekongen/oslodatascience-rl | havakv_CartPole-A3C.py | Python | mit | 8,817 |
# 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... | cinderella/incubator-cloudstack | plugins/hypervisors/ovm/scripts/vm/hypervisor/ovm/OvmLoggerModule.py | Python | apache-2.0 | 1,886 |
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
class CatalogManager(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('CatalogManager')
neverDisable = 1
def __init__(self, cr):
DistributedObject.Distribut... | ToonTownInfiniteRepo/ToontownInfinite | toontown/catalog/CatalogManager.py | Python | mit | 1,064 |
# -*- coding: utf-8 -*-
import wx
from datetime import datetime
class TextPanel(wx.Panel):
def __init__(self, parent, id, avatar, pos, size, style):
wx.Panel.__init__(self, parent, id, pos, size, style)
self.pos = pos
self.parent = parent
bSizer3 = wx.BoxSizer(wx.HORIZONTAL)
self.avatar = wx.... | Fahreeve/nice_notice | TextPanel.py | Python | mit | 2,470 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
import re
import cgi
__all__ = ['highlight']
class Highlighter(object):
"""
Do syntax highl... | pouyana/teireader | webui/gluon/highlight.py | Python | mit | 13,303 |
# Copyright (C) 2019 Sudipta Pandit <realsdx@protonmail.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 3 of the License, or
# (at your option) any later version.
# This p... | johnnykv/heralding | heralding/libs/msrdp/pdu.py | Python | gpl-3.0 | 5,312 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.