code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# coding: utf-8
from __future__ import unicode_literals
import itertools
import re
import random
from .common import InfoExtractor
from ..compat import (
compat_parse_qs,
compat_str,
compat_urllib_parse,
compat_urllib_parse_urlparse,
compat_urllib_request,
)
from ..utils import (
ExtractorErro... | vimagick/youtube-dl | youtube_dl/extractor/twitch.py | Python | unlicense | 14,731 |
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | QiJune/Paddle | python/paddle/v2/dataset/tests/common_test.py | Python | apache-2.0 | 3,112 |
from waterbutler.server.api.v0 import zip
from waterbutler.server.api.v0 import copy
from waterbutler.server.api.v0 import crud
from waterbutler.server.api.v0 import move
from waterbutler.server.api.v0 import metadata
from waterbutler.server.api.v0 import revisions
PREFIX = ''
HANDLERS = [
(r'/ops/copy', copy.Cop... | Johnetordoff/waterbutler | waterbutler/server/api/v0/__init__.py | Python | apache-2.0 | 526 |
# Copyright 2014 IBM Corp.
#
# 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, s... | promptworks/keystone | keystone/tests/unit/test_backend_endpoint_policy.py | Python | apache-2.0 | 12,175 |
# Copyright 2016 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... | karllessard/tensorflow | tensorflow/python/debug/__init__.py | Python | apache-2.0 | 2,950 |
import gc
import os
import weakref
from cStringIO import StringIO
try:
import signal
except ImportError:
signal = None
import unittest2
class TestBreak(unittest2.TestCase):
def setUp(self):
self._default_handler = signal.getsignal(signal.SIGINT)
def tearDown(self):
sig... | supercheetah/diceroller | pyinstaller/PyInstaller/lib/unittest2/test/test_break.py | Python | artistic-2.0 | 8,469 |
#!/usr/bin/env python3
#
# setup.py
# From the stagger project: http://code.google.com/p/stagger/
#
# Copyright (c) 2009-2011 Karoly Lorentey <karoly@lorentey.hu>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following con... | SpaWnAge/stagger | setup.py | Python | bsd-2-clause | 2,585 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | marratj/ansible | lib/ansible/modules/network/junos/junos_facts.py | Python | gpl-3.0 | 11,501 |
#!/usr/bin/env python
# WS client example with HTTP Basic Authentication
import asyncio
import websockets
async def hello():
uri = "ws://mary:p@ssw0rd@localhost:8765"
async with websockets.connect(uri) as websocket:
greeting = await websocket.recv()
print(greeting)
asyncio.get_event_loop().r... | CYBAI/servo | tests/wpt/web-platform-tests/tools/third_party/websockets/example/basic_auth_client.py | Python | mpl-2.0 | 347 |
# coding: utf-8
from __future__ import unicode_literals
import re
import itertools
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_parse_qs,
compat_urllib_parse_urlparse,
)
from ..utils import (
determine_ext,
bool_or_none,
int_or_none,
try_get,
unified_time... | oskar456/youtube-dl | youtube_dl/extractor/rutube.py | Python | unlicense | 10,151 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.words.protocols.jabber.sasl_mechanisms}.
"""
from __future__ import absolute_import, division
from twisted.trial import unittest
from twisted.python.compat import networkString
from twisted.words.protocols.jabber import ... | EricMuller/mynotes-backend | requirements/twisted/Twisted-17.1.0/src/twisted/words/test/test_jabbersaslmechanisms.py | Python | mit | 5,758 |
from __future__ import unicode_literals
from jinja2 import Template
from six.moves.urllib.parse import parse_qs, urlparse
from .models import route53_backend
import xmltodict
def list_or_create_hostzone_response(request, full_url, headers):
if request.method == "POST":
elements = xmltodict.parse(request.... | rouge8/moto | moto/route53/responses.py | Python | apache-2.0 | 8,044 |
# ==================================================================================================
# Copyright 2013 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | abel-von/commons | tests/python/twitter/common/java/test_perfdata.py | Python | apache-2.0 | 2,009 |
# Copyright 2015 Rackspace
#
# 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... | barnsnake351/neutron | neutron/db/migration/alembic_migrations/versions/liberty/expand/34af2b5c5a59_add_dns_name_to_port.py | Python | apache-2.0 | 1,095 |
import copy
import datetime
import re
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.utils import DatabaseError
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_create_column = "ALTER TABLE %(table)s ADD %(column)s %(definition)s"
sql_alter_column_type = "MODIFY ... | georgemarshall/django | django/db/backends/oracle/schema.py | Python | bsd-3-clause | 7,809 |
# -*- coding: utf-8 -*-
"""
Mixins for fields.
"""
from bok_choy.promise import EmptyPromise
from common.test.acceptance.tests.helpers import get_selected_option_text, select_option_by_text
class FieldsMixin(object):
"""
Methods for testing fields in pages.
"""
def field(self, field_id):
"""... | louyihua/edx-platform | common/test/acceptance/pages/lms/fields.py | Python | agpl-3.0 | 7,991 |
# 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... | ninotoshi/tensorflow | tensorflow/python/kernel_tests/unpack_op_test.py | Python | apache-2.0 | 2,525 |
import unittest
import numpy
import six
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
class TestCrossCovariance(unittest.TestCase):
def setUp(self):
... | masia02/chainer | tests/chainer_tests/functions_tests/test_cross_covariance.py | Python | mit | 3,030 |
#!/usr/bin/env python
#
# Copyright 2008,2010,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your ... | gnu-sandhi/sandhi | modules/gr36/gr-fft/python/qa_fft.py | Python | gpl-3.0 | 9,998 |
"""
This module defines the mpf, mpc classes, and standard functions for
operating with them.
"""
__docformat__ = 'plaintext'
import re
from .ctx_base import StandardBaseContext
from .libmp.backend import basestring, BACKEND
from . import libmp
from .libmp import (MPZ, MPZ_ZERO, MPZ_ONE, int_types, repr_dps,
r... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/mpmath/ctx_mp.py | Python | mit | 48,884 |
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The eos l3_interfaces fact class
It is in this file the configuration is collected from the device
for a given resource, parsed, and the facts tree is populated
based on th... | Dhivyap/ansible | lib/ansible/module_utils/network/eos/facts/l3_interfaces/l3_interfaces.py | Python | gpl-3.0 | 3,622 |
# -*- coding: utf-8 -*-
#
# 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
... | forevernull/incubator-airflow | airflow/contrib/hooks/__init__.py | Python | apache-2.0 | 1,660 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from openerp.osv import fields, osv
from openerp import api
class account_analytic_default(osv.osv):
_name = "account.analytic.default"
_description = "Analytic Distribution"
_rec_name = "analyt... | vileopratama/vitech | src/addons/account_analytic_default/account_analytic_default.py | Python | mit | 7,388 |
# Copyright Joel de Guzman 2004. Distributed under the Boost
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
'''
>>> import pointer_vector_ext
>>> d = pointer_vector_ext.DoesSomething()
>>> lst = d.returnList()
>>> lst[0].f();
'harru'
'''
de... | satya-das/common | third_party/boost_tp/libs/python/test/pointer_vector.py | Python | mit | 628 |
#!/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 distribut... | bcoca/ansible-modules-extras | network/asa/asa_config.py | Python | gpl-3.0 | 11,915 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | ChrisBeaumont/luigi | luigi/contrib/hdfs/clients.py | Python | apache-2.0 | 2,040 |
# Copyright (c) 2013 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.
import logging
import os
import sys
from telemetry.core import platform
from telemetry.core.platform import platform_backend
# Get build/android script... | SomethingExplosive/android_external_chromium_org | tools/telemetry/telemetry/core/platform/android_platform_backend.py | Python | bsd-3-clause | 4,335 |
from __future__ import unicode_literals
def account_delete_mark(deletion):
deletion.user.is_active = False
deletion.user.save()
def account_delete_expunge(deletion):
deletion.user.delete()
| Amechi101/concepteur-market-app | venv/lib/python2.7/site-packages/account/callbacks.py | Python | mit | 205 |
from functools import wraps
from django.core.exceptions import ObjectDoesNotExist # NOQA
from django.db.models import signals # NOQA
from django.db.models.aggregates import * # NOQA
from django.db.models.deletion import ( # NOQA
CASCADE, DO_NOTHING, PROTECT, SET, SET_DEFAULT, SET_NULL, ProtectedError,
)
from d... | DanteOnline/free-art | venv/lib/python3.4/site-packages/django/db/models/__init__.py | Python | gpl-3.0 | 1,679 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | JBonsink/GSOC-2013 | tools/ns-allinone-3.14.1/ns-3.14.1/src/tools/bindings/modulegen__gcc_LP64.py | Python | gpl-3.0 | 187,684 |
# Copyright 2015 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | paninetworks/neutron | neutron/db/migration/alembic_migrations/versions/f15b1fb526dd_cascade_floatingip.py | Python | apache-2.0 | 1,453 |
# 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... | frreiss/tensorflow-fred | tensorflow/python/tpu/ops/tpu_ordinal_selector_op.py | Python | apache-2.0 | 843 |
# Copyright 2013 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 branch_utility import BranchUtility, ChannelInfo
from test_data.canned_data import (CANNED_BRANCHES, CANNED_CHANNELS)
class TestBranchUtility(object):
... | espadrine/opera | chromium/src/chrome/common/extensions/docs/server2/test_branch_utility.py | Python | bsd-3-clause | 1,398 |
# Copyright 2016 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... | wangyum/tensorflow | tensorflow/contrib/keras/python/keras/models_test.py | Python | apache-2.0 | 6,256 |
# -*- coding: utf-8 -*-
# Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com>
#
# This file is part of subliminal.
#
# subliminal 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... | Branlala/docker-sickbeardfr | sickbeard/lib/subliminal/services/opensubtitles.py | Python | mit | 9,619 |
# -*- coding: utf-8 -*-
"""
Unit tests for preference APIs.
"""
import datetime
import ddt
import unittest
from mock import patch
from pytz import UTC
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.utils import override_settings
from dateu... | simbs/edx-platform | openedx/core/djangoapps/user_api/preferences/tests/test_api.py | Python | agpl-3.0 | 18,922 |
#!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_fra... | mainconceptx/DAS | qa/rpc-tests/decodescript.py | Python | mit | 13,647 |
# 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.
import logging
import posixpath
from custom_logger import CustomLogger
from extensions_paths import EXAMPLES
from file_system_util import CreateURLsFromPath... | js0701/chromium-crosswalk | chrome/common/extensions/docs/server2/render_refresher.py | Python | bsd-3-clause | 3,318 |
raise TypeError
| rodsol/opencog | tests/cython/agents/test_agent_w_load_exception.py | Python | agpl-3.0 | 16 |
#!/usr/bin/env python
# Copyright 2013 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.
"""
Replaces gyp files in tree with files from here that
make the build use system libraries.
"""
import optparse
import os.path
impo... | s20121035/rk3288_android5.1_repo | external/chromium_org/build/linux/unbundle/replace_gyp_files.py | Python | gpl-3.0 | 2,992 |
# Copyright 2018 Fortinet, Inc.
#
# 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 program is distributed in the... | kustodian/ansible | test/units/modules/network/fortimanager/test_fmgr_fwobj_ippool.py | Python | gpl-3.0 | 3,844 |
#!/usr/bin/python
# Copyright (c) 2016 IBM
#
# This module 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 software is distrib... | calamityman/ansible-modules-extras | cloud/openstack/os_user_role.py | Python | gpl-3.0 | 6,200 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | Daniex/horizon | openstack_dashboard/dashboards/project/data_processing/cluster_templates/workflows/copy.py | Python | apache-2.0 | 4,189 |
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
# ... | ARMmbed/yotta_osx_installer | workspace/lib/python2.7/site-packages/github/tests/Issue131.py | Python | apache-2.0 | 2,739 |
# 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... | Mega-DatA-Lab/mxnet | example/rcnn/rcnn/utils/save_model.py | Python | apache-2.0 | 1,548 |
#! /usr/bin/env python
# A Python program implementing rmt, an application for remotely
# controlling other Tk applications.
# Cf. Ousterhout, Tcl and the Tk Toolkit, Figs. 27.5-8, pp. 273-276.
# Note that because of forward references in the original, we
# sometimes delay bindings until after the corresponding proce... | teeple/pns_server | work/install/Python-2.7.4/Demo/tkinter/guido/rmt.py | Python | gpl-2.0 | 4,492 |
# $Id$
import inc_sip as sip
import inc_sdp as sdp
# Some non-SIP URI's in Contact header
#
complete_msg = \
"""SUBSCRIBE sip:localhost SIP/2.0
Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9
Max-Forwards: 70
From: <sip:192.168.0.14>;tag=08cd5bfc2d8a4fddb1f5e59c6961d298
To: <sip:localhost>
Call-ID: 3373d... | xiejianying/pjsip | tests/pjsua/scripts-sendto/364_non_sip_uri_subscribe.py | Python | gpl-2.0 | 809 |
from django.db import models
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.core.exceptions import ValidationError
from django.utils.html import strip_tags
import json
from xmodule_django.models import CourseKeyField
class Note(models.Model):
user = models.Fo... | solashirai/edx-platform | lms/djangoapps/notes/models.py | Python | agpl-3.0 | 3,201 |
# sybase/__init__.py
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from sqlalchemy.dialects.sybase import base, pysybase, pyodbc
# default dialect
... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/sqlalchemy/dialects/sybase/__init__.py | Python | mit | 894 |
#! /usr/bin/env python
# Copyright (c) 2011 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementatio... | tiagormk/gem5-hmp | util/o3-pipeview.py | Python | bsd-3-clause | 15,788 |
# Copyright 2010 Google Inc.
# All Rights Reserved.
#
# Author: Tim Haloun (thaloun@google.com)
# Daniel Petersson (dape@google.com)
#
import os
# Keep a global dictionary of library target params for lookups in
# ExtendComponent().
_all_lib_targets = {}
def _GenericLibrary(env, static, **kwargs):
"""Extend... | opensourcechipspark/platform_external_chromium | third_party/libjingle/source/talk/site_scons/talk.py | Python | bsd-3-clause | 15,628 |
from openid import message
from openid import oidutil
from openid.extensions import sreg
import urllib
import cgi
import unittest
def mkGetArgTest(ns, key, expected=None):
def test(self):
a_default = object()
self.failUnlessEqual(self.msg.getArg(ns, key), expected)
if expected is None:
... | mzdaniel/oh-mainline | vendor/packages/python-openid/openid/test/test_message.py | Python | agpl-3.0 | 37,611 |
def f(x):
print(x < 0, x <= 0, x > 0, x >= 0, x != 0)
print(x.foo)
print(f(<warning descr="Type 'bool' doesn't have expected attribute 'foo'">True</warning>))
print(f(<warning descr="Type 'int' doesn't have expected attribute 'foo'">0</warning>))
print(f(<warning descr="Type 'float' doesn't have expected attr... | Lekanich/intellij-community | python/testData/inspections/PyTypeCheckerInspection/ComparisonOperatorsForNumericTypes.py | Python | apache-2.0 | 350 |
"""
Tests for select_related()
``select_related()`` follows all relationships and pre-caches any foreign key
values so that complex trees can be fetched in a single query. However, this
isn't always a good idea, so the ``depth`` argument control how many "levels"
the select-related behavior will traverse.
"""
from dj... | pquentin/django | tests/select_related/models.py | Python | bsd-3-clause | 3,320 |
try:
from urllib.parse import urljoin
except ImportError: # Python 2
from urlparse import urljoin
from django import template
from django.template.base import Node
from django.utils.encoding import iri_to_uri
register = template.Library()
class PrefixNode(template.Node):
def __repr__(self):
... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/templatetags/static.py | Python | bsd-3-clause | 4,022 |
# -*- coding: utf-8 -*-
"""
Nearest Centroid Classification
"""
# Author: Robert Layton <robertlayton@gmail.com>
# Olivier Grisel <olivier.grisel@ensta.org>
#
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import sparse as sp
from ..base import BaseEstimator, ClassifierMixin
from ..met... | WangWenjun559/Weiss | summary/sumy/sklearn/neighbors/nearest_centroid.py | Python | apache-2.0 | 7,249 |
import sys
import os
sys.path.insert(0, os.path.abspath('./')) | aventurella/figurine | tests/context.py | Python | isc | 62 |
from __future__ import (print_function)
def foo():
return "foo2"
| Ryex/pyitect | tests/plugins/provide_pluginv2/provide.py | Python | isc | 70 |
from oscar.apps.basket import apps
class BasketConfig(apps.BasketConfig):
name = "basket"
| thelabnyc/django-oscar-wfrs | sandbox/basket/apps.py | Python | isc | 96 |
# -*- coding: utf-8 -*-
import yaml
class AnsibleHandler(object):
"""
Messier utility class for managing Ansible information.
All methods are accessible via the Messier object. Call them from Messier.
"""
def __init__(self):
pass
| conorsch/messier | messier/ansible_handler.py | Python | isc | 262 |
import re
from .base import Parser
class SshdLoginParser(Parser):
def parse(self, entry):
if entry.tag[0:4] == "sshd" and entry.content[0:8] == "Accepted":
ssh_re = re.compile(
r'^Accepted (?P<method>[\w\-/]+) for (?P<user>\w+) from '
r'(?P<ip>[0-9a-f:\.]+) port... | mutantmonkey/notilog | notilog/parsers/sshd.py | Python | isc | 574 |
#!/usr/bin/python
"""
This is mostly a Python wrapper for the shp2pgsql command line utility.
"""
import subprocess
import util
from importer_modes import *
def shape_to_pgsql(config, conn, shape_path, table, mode, srid=-1, log_file=None, batch_size=1000):
modeflags = {
str(IMPORT_MODE_CREATE... | kartena/gsd-osmify | Osmify/shp2pgsql.py | Python | isc | 2,064 |
def largest_sum(nums):
max_sum = 0
current_sum = 0
for num in nums:
new_sum = current_sum + num
if new_sum > num:
# continue with current sublist
current_sum = new_sum
else:
# ... | barracel/code_challenges | max_subset_sum/max_subset_sum.py | Python | isc | 1,151 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the voitools package
# Copyright 2015 Board of Regents of the University of Wisconsin System
# Licensed under the MIT license; see LICENSE at the root of the package.
# Authored by Nate Vack <njvack@wisc.edu> at the Waisman Laboratory for Brain
# Imaging and Beha... | njvack/voitools | voitools/scripts/voi2nii.py | Python | mit | 4,196 |
#!/usr/bin/env python2
__author__ = "Ryon Sherman"
__email__ = "ryon.sherman@gmail.com"
__copyright__ = "Copyright 2014, Ryon Sherman"
__license__ = "MIT"
import socket
import argparse
import asyncore
from nmb.log import logger
from nmb.parser import parser
from nmb.sockets import SocketDispatcher
class C... | ryonsherman/network-message-bus | redux/src/nmb/server.py | Python | mit | 4,217 |
"""
Copyright (C) 2014, Jill Huchital
"""
""" Clean _id out of objects returned from the DB, so that they'll JSONify nicely """
def clean_db_object(obj):
for key in ["_id"]:
obj.pop(key, None)
return obj
| jillh510/video_story_arcs | utils.py | Python | mit | 221 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_required
from tekton import router
from categoria import model
from categoria import validation
from... | iwilliam317/tekton | backend/appengine/routes/categorias/cadastro.py | Python | mit | 1,193 |
#!/usr/bin/env python
# visualize-examples.py
import concepts.visualize
ARGS = {'directory': 'visualize-output', 'out_format': 'pdf'}
concepts.visualize.render_all('examples/*.cxt', **ARGS)
concepts.visualize.render_all('examples/[r-v]*.csv', encoding='utf-8', **ARGS)
| pombredanne/concepts | visualize-examples.py | Python | mit | 272 |
# -*- coding: utf-8 -*-
import pandas as pd
import re
import jieba
import numpy as np
import copy
# ###################### initial the parameter ####################### #
short_text = 600
useless_word = list(pd.read_excel("useless_1.xls",header=None)[0])
useless_word += [',',':','‘','’','','。','—','——',
... | yaoqr15/Machine-Learning-Based-Rumors-Detection | Keras_main/pre_process.py | Python | mit | 1,911 |
import inspect
import os
import types
from contextlib import contextmanager
from . import discovery
from . import errors
from .plugin_interface import PluginInterface, TEST_FOLDER, CONTEXT, EXAMPLES, SETUP, ACTION, ASSERTION, TEARDOWN, NO_EXAMPLE
class TestRun(object):
def __init__(self, source, plugin_composite)... | benjamin-hodgson/Contexts | src/contexts/core.py | Python | mit | 11,664 |
# gdiplusflat.py created from gdiplusflat.h
# Copyright (c) 2012 Maxim Kolosov
GDIPVER = 0x0100
# enum Status
Status = 0
Ok = 0
GenericError = 1
InvalidParameter = 2
OutOfMemory = 3
ObjectBusy = 4
InsufficientBuffer = 5
NotImplemented = 6
Win32Error = 7
WrongState = 8
Aborted = 9
FileNotFound = 10
ValueOverflow = 11
... | Answeror/lit | pywingui/gdiplusflat.py | Python | mit | 24,068 |
from SublimeLinter.lint import Linter, util
class JSL(Linter):
cmd = 'jsl -stdin -nologo -nosummary'
regex = r'''(?xi)
# First line is (lineno): type: error message
^\((?P<line>\d+)\):.*?(?:(?P<warning>warning)|(?P<error>error)):\s*(?P<message>.+)$\r?\n
# Second line is the line of co... | SublimeLinter/SublimeLinter-jsl | linter.py | Python | mit | 589 |
"""
WSGI config for eatuxchallenge project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | ask5/eatuxchallenge | eatuxchallenge/wsgi.py | Python | mit | 405 |
from signals import post_save_renderer
| botify-labs/django-medusa | django_medusa/models.py | Python | mit | 39 |
# Python3
from solution1 import sumUpNumbers as f
qa = [
('2 apples, 12 oranges', 14),
('123450', 123450),
('Your payment method is invalid', 0),
('no digits at all', 0),
('there are some (12) digits 5566 in this 770 string 239', 6587)
]
for *q, a in qa:
for i, e in enumerate(q):
prin... | RevansChen/online-judge | Codefights/arcade/intro/level-12/54.sumUpNumbers/Python/test.py | Python | mit | 565 |
__author__ = 'jie'
import string
from operator import attrgetter
from strandrep.create_toehold_command import CreateToeholdCommand
from strandrep.remove_toehold_command import RemoveToeholdCommand
import cadnano.util as util
from cadnano.cnproxy import ProxyObject, ProxySignal
class Domain(ProxyObject):
def __in... | amylittleyang/OtraCAD | strandrep/domain.py | Python | mit | 15,203 |
from configparser import ConfigParser
from astropy.utils.console import color_print
import os
import numpy as np
params = ConfigParser()
if os.path.isfile('zparams_pm.py'):
params.read('zparams_pm.py')
else:
folder = os.path.dirname(os.path.realpath(__file__))
params.read('%s/zparams_pm.py' % folder)
... | astrofelipe/MP2015 | pm_funcs.py | Python | mit | 5,286 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/delete_property_batch_operation.py | Python | mit | 1,235 |
import cPickle as pickle
import h5py
import numpy as np
fName = "test.pickle"
with open(fName,"rb") as f:
d = pickle.load(f)
print d.keys()
h5f = h5py.File(fName.replace(".pickle",".h5f"),"w")
h5f.create_group("Info")
h5f.create_group("Original")
h5f.create_group("ZCA_byTrainData")
h5f.create_group("ZCA_byTestDa... | ysasaki6023/NeuralNetworkStudy | data_cifar100/convert_to_hdf5.py | Python | mit | 1,514 |
from rest_framework.exceptions import APIException
from rest_framework import status
class ConflictException(APIException):
status_code = status.HTTP_409_CONFLICT
default_detail = "Resource already exists."
| ministryofjustice/cla_backend | cla_backend/apps/core/drf/exceptions.py | Python | mit | 217 |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8... | pantheon-systems/linuxsecaudit | setup.py | Python | mit | 3,175 |
#!/usr/bin/env python3
# transpiled with BefunCompile v1.3.0 (c) 2017
import gzip, base64
_g = ("AR+LCAAAAAAABADtkM0KwjAQhF+l4i1LZLZV/EGCTxJ722tOOfXh3WCNSBtQ8LhzyWSHfJkkd38V1mQ0oxnNaEYzWpsWvmXlVhDaCSDsGSLFFC/0dCkHBhIzUtCWsj/3"
+ "jnTu3VQODWU7buO9EliTd5UEJhZwAryuuNYoalTGpOlHsOjGc5NlFKubNl03Uu8OJypPALe/56W1G287ubjj0C7... | Mikescher/Project-Euler_Befunge | compiled/Python3/Euler_Problem-015.py | Python | mit | 1,367 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File & Directory
# 2015-08-13 10:49:14
import os
print os.name
print os.uname()
print os.environ
print os.getenv('PATH')
print os.path.abspath('.')
# 在某个目录下创建一个新目录,
# 首先把新目录的完整路径表示出来:
os.path.join('/Users/luolong', 'testdir')
'/Users/luolong/testdir'
# 然后创建一个目录:
o... | longluo/LearnPython | io/file_and_dir.py | Python | mit | 492 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Send message to Slack from command line
"""
from slacker import Slacker
from slacker.utils import get_item_id_by_name
import argparse
import sys
import os
import warnings
warnings.filterwarnings('ignore', message=".*InsecurePlatformWarning.*")
def post_message(to... | beni55/slacker-cli | slacker_cli/__init__.py | Python | mit | 2,691 |
'''
Created on Feb 14, 2011
@author: al
'''
from bebop import *
from unittest import TestCase
class FooDB(object):
def __init__(self, **kw):
for attr, val in kw.iteritems():
setattr(self, attr, val)
class BarDB(object):
def __init__(self, **kw):
for attr, val in kw.iteritems():
... | jumoconnect/openjumo | jumodjango/lib/bebop/test/test_model.py | Python | mit | 1,205 |
import os
import subprocess
import json
import shlex
import math
path = '/usr/local/bin'
if path not in os.environ["PATH"]:
os.environ["PATH"] += os.pathsep + path
def probeFile(file):
cmd = "ffprobe -v quiet -print_format json -show_streams"
# find video duration
# ffprobe -v error -show_entries fo... | michaelb-01/pipe | scripts/python/genSprites_mlb_v001.py | Python | mit | 2,338 |
def primes():
n = 2
while True:
if all(n % div for div in range(2, n)):
yield n
n += 1
gen = primes()
for n in range(20):
print(next(gen))
| willmcgugan/asyncchat | prime.py | Python | mit | 181 |
# coding: utf-8
from __future__ import with_statement
from commands import Command
import time
import re
from socket import *
from socket import *
from struct import *
import datetime
import utility
import thread
import sys
import traceback
list_lock = thread.allocate_lock()
def tw_get_num_players(address, port):... | serpis/pynik | plugins/teewars.py | Python | mit | 3,719 |
#!/usr/bin/env python3
# Copyright (c) 2020-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import argparse
import io
import requests
import subprocess
import sys
DEFAULT_GLOBAL_FAUCET = 'https://... | GroestlCoin/bitcoin | contrib/signet/getcoins.py | Python | mit | 6,315 |
import argparse
def parseircdata(data):
"""
The parser for arguments to setup IRC channels.
Returns an argparse-namespace containing hostname,
port, nickname, realname, ident, and channel.
"""
parser = argparse.ArgumentParser(description='An IRC client')
parser.add_argument('--hs',
... | kultprok/circa | clientparser.py | Python | mit | 1,712 |
#!/usr/bin/env python
from setuptools import setup, find_packages
with open('README.rst') as file:
long_description = file.read()
setup(name='mygmm',
version='1.0',
description='GMM estimator for educational purposes',
long_description=long_description,
author='Stanislav Khrapov',
... | khrapovs/mygmm | setup.py | Python | mit | 957 |
# 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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py | Python | mit | 16,533 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-06 14:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Scholien', '0004_buechlein_admin_kaeufe'),
]
operations = [
migrations.Alte... | valuehack/scholarium.at | Scholien/migrations/0005_auto_20171106_1407.py | Python | mit | 474 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Osman Baskaya"
"""
Convert kmeans output into the Semeval system answer format.
"""
import sys
from collections import defaultdict as dd
import re
regex = re.compile("<((.*\.\w)\.\w+\.\d+)>\s+(\d+)\n")
d = dd(lambda: dd(lambda: dd(int)))
for line in sys.stdi... | ai-ku/uwsd | run/find-sense-XYb.py | Python | mit | 459 |
from RGT.XML.SVG.basicSvgNode import BasicSvgNode
from xml.dom.minidom import Node
class BaseScriptNode(BasicSvgNode):
def __init__(self, ownerDoc, tagName):
BasicSvgNode.__init__(self, ownerDoc, tagName)
self.allowAllSvgNodesAsChildNodes = True
def setData(self, data):
if... | danrg/RGT-tool | src/RGT/XML/SVG/baseScriptNode.py | Python | mit | 1,896 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys, re
import urllib, urllib2, json
import operator
from SPARQLWrapper import SPARQLWrapper, JSON
import nltk
from nltk.corpus import stopwords
import enchant # spell check
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.stem.lancaster import LancasterS... | helshowk/autocross | wordSource.py | Python | mit | 28,445 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
import nose2
except ImportError:
message = """nose2 package not installed, install test requirements with:
pip install -r requirements-test.txt
"""
raise ImportError(message)
if __name__ == "__main__":
nose2.discover()
| ninuxorg/netdiff | runtests.py | Python | mit | 297 |
# -*- coding: utf-8 -*-
import logging
import threading
import multiprocessing
import db
logging.basicConfig(level=logging.INFO)
class DataReader:
def __init__(self):
logging.info(u'create DataReader object')
self.queue_db_tasks = multiprocessing.Queue()
self.queue_db_results = multiproce... | gromoleg/pharmacy | libs/data/reader.py | Python | mit | 3,425 |
'''
Created on 7 Feb 2015
@author: robrant
'''
MONGO_DBNAME = 'dfkm'
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
TESTING = True
"""
lat = 50.722
lon = -1.866
50m
""" | robrant/dfkm | config.py | Python | mit | 172 |
from distutils.core import setup
setup(
name = "pyTAP",
version = "0.001",
py_modules = [ "TAP.Simple" ],
)
| rjbs/PyTAP | setup.py | Python | mit | 119 |