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 |
|---|---|---|---|---|---|
# Copyright 2012 Nebula, 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 agree... | ankur-gupta91/horizon-net-ip | openstack_dashboard/test/test_data/swift_data.py | Python | apache-2.0 | 4,741 |
#!/usr/bin/env python
# Copyright 2016 The Kubernetes 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 applic... | mikedanese/test-infra | gubernator/testgrid.py | Python | apache-2.0 | 3,524 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jvrsantacruz/XlsxWriter | xlsxwriter/test/comparison/test_comment05.py | Python | bsd-2-clause | 1,623 |
from vtk import *
from numeric import *
import pylab
# Define script parameters
numbvert = 2000
edgeprob = 0.10
histbins = 100
rgsource = vtkRandomGraphSource()
# Set number of vertices and the probability of an edge existing between any two vertices
rgsource.SetNumberOfVertices(numbvert)
rgsource.SetUseEdgeProba... | b3c/VTK-5.8 | Examples/Infovis/Python/binomial.py | Python | bsd-3-clause | 1,513 |
# 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 os
import unittest
from telemetry.core import cros_interface
from telemetry.core import util
from telemetry.internal.browser import browser_finder
fr... | CapOM/ChromiumGStreamerBackend | tools/telemetry/telemetry/internal/backends/chrome/cros_test_case.py | Python | bsd-3-clause | 3,042 |
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
#
# 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... | ool2016-seclab/quarantineSystem | ryu/lib/snortlib.py | Python | mit | 3,765 |
# -*- coding: utf-8 -*-
from allauth.socialaccount.tests import OAuthTestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import BitbucketProvider
class BitbucketTests(OAuthTestsMixin, TestCase):
provider_id = BitbucketProvider.id
def get_mocked_response(self):
# FIXME: Repla... | Alexander-M-Waldman/local_currency_site | lib/python2.7/site-packages/allauth/socialaccount/providers/bitbucket/tests.py | Python | gpl-3.0 | 1,464 |
#!/usr/bin/env python
"""Retrieve all CSS stylesheets including embedded for a given URL.
Retrieve as StyleSheetList or save to disk - raw, parsed or minified version.
TODO:
- maybe use DOM 3 load/save?
- logger class which handles all cases when no log is given...
- saveto: why does urllib2 hang?
"""
__all__ = ['CSSC... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/cssutils/scripts/csscapture.py | Python | agpl-3.0 | 2,285 |
# Copyright 2015 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... | anilmuthineni/tensorflow | tensorflow/python/framework/test_util.py | Python | apache-2.0 | 22,405 |
#!/usr/bin/env python
# This creates a CSV file from the output of the debug output of subtarget:
# llvm-tblgen --gen-subtarget --debug-only=subtarget-emitter
# With thanks to Dave Estes for mentioning the idea at 2014 LLVM Developers' Meeting
import os;
import sys;
import re;
import operator;
table = {}
models = ... | google/llvm-propeller | llvm/utils/schedcover.py | Python | apache-2.0 | 2,763 |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | scheib/chromium | third_party/protobuf/python/google/protobuf/text_format.py | Python | bsd-3-clause | 61,138 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: automationservice.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection... | derekstavis/bluntly | vendor/github.com/youtube/vitess/py/vtproto/automationservice_pb2.py | Python | mit | 7,476 |
"""
Support for interfacing with Russound via RNET Protocol.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.russound_rnet/
"""
import logging
import voluptuous as vol
from homeassistant.components.media_player import (
SUPPORT_TURN_ON,... | miniconfig/home-assistant | homeassistant/components/media_player/russound_rnet.py | Python | mit | 5,062 |
from __future__ import unicode_literals
from django.db import models
from django.db.models.options import normalize_together
from django.db.migrations.state import ModelState
from django.db.migrations.operations.base import Operation
from django.utils import six
class CreateModel(Operation):
"""
Create a mod... | deandunbar/html2bwml | venv/lib/python2.7/site-packages/django/db/migrations/operations/models.py | Python | mit | 17,089 |
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt
class Table(QtGui.QDialog):
def __init__(self,parent = None):
QtGui.QDialog.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
# Rows
rowsLabel = QtGui.QLabel("Rows: ",self... | janusnic/21v-python | unit_15/staff3/ext/table.py | Python | mit | 2,437 |
# Natural Language Toolkit: Collocations and Association Measures
#
# Copyright (C) 2001-2012 NLTK Project
# Author: Joel Nothman <jnothman@student.usyd.edu.au>
# URL: <http://nltk.org>
# For license information, see LICENSE.TXT
#
"""
Tools to identify collocations --- words that often appear consecutively
--- within c... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/nltk/collocations.py | Python | mit | 10,160 |
##
# Copyright 2009-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | ULHPC/modules | easybuild/easybuild-easyblocks/easybuild/easyblocks/s/scalapack.py | Python | mit | 8,488 |
# Copyright (C) 2011, CloudCaptive
#
# 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 i... | diogenesjf/userinfuser | serverside/not_found.py | Python | gpl-3.0 | 1,079 |
#!/usr/bin/env python3
# Copyright (c) 2014-2020 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 the abandontransaction RPC.
The abandontransaction RPC marks a transaction and all its in-wallet... | Sjors/bitcoin | test/functional/wallet_abandonconflict.py | Python | mit | 8,784 |
#
# The Python Imaging Library.
# $Id$
#
# a Tk display interface
#
# History:
# 96-04-08 fl Created
# 96-09-06 fl Added getimage method
# 96-11-01 fl Rewritten, removed image attribute and crop method
# 97-05-09 fl Use PyImagingPaste method instead of image type
# 97-05-12 fl Minor tweaks to match the IFUNC9... | havard024/prego | venv/lib/python2.7/site-packages/PIL/ImageTk.py | Python | mit | 9,075 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
class Users(models.Model):
_inherit = 'res.users'
odoobot_state = fields.Selection(selection_add=[
('onboarding_canned', 'Onboarding canned'),
], ondelete={'onboardi... | ddico/odoo | addons/im_livechat_mail_bot/models/res_users.py | Python | agpl-3.0 | 391 |
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 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://w... | thomasem/nova | nova/virt/vmwareapi/io_util.py | Python | apache-2.0 | 6,322 |
"""
Miscellaneous Helpers for NetworkX.
These are not imported into the base networkx namespace but
can be accessed, for example, as
>>> import networkx
>>> networkx.utils.is_string_like('spam')
True
"""
# Copyright (C) 2004-2015 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pi... | jakevdp/networkx | networkx/utils/misc.py | Python | bsd-3-clause | 6,360 |
#!/bin/python
# Copyright (c) 2013, Arvid Norberg
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this l... | whatrye/twister-core | libtorrent/tools/run_tests.py | Python | mit | 8,847 |
#!/usr/bin/env python
import linuxcnc
import hal
import time
import sys
#
# connect to LinuxCNC
#
c = linuxcnc.command()
s = linuxcnc.stat()
e = linuxcnc.error_channel()
#
# Come out of E-stop, turn the machine on, home, and switch to Auto mode.
#
c.state(linuxcnc.STATE_ESTOP_RESET)
c.state(linuxcnc.STATE_ON)
c... | olsonse/linuxcnc | tests/motion-logger/mountaindew/test-ui.py | Python | gpl-2.0 | 504 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.db import models, migrations
logger = logging.getLogger(__name__)
tables = [
'taggit_tag',
'wiki_documenttag',
'wiki_localizationtag',
'wiki_reviewtag',
]
def alter_collation(cursor, collation):
for tabl... | biswajitsahu/kuma | kuma/wiki/migrations/0002_auto_20150430_0805.py | Python | mpl-2.0 | 1,055 |
"""Messaging library for Python"""
from __future__ import absolute_import
from collections import namedtuple
version_info_t = namedtuple(
'version_info_t', ('major', 'minor', 'micro', 'releaselevel', 'serial'),
)
VERSION = version_info_t(3, 0, 22, '', '')
__version__ = '{0.major}.{0.minor}.{0.micro}{0.releaselev... | nirmeshk/oh-mainline | vendor/packages/kombu/kombu/__init__.py | Python | agpl-3.0 | 3,835 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | rahulunair/nova | nova/db/sqlalchemy/migrate_repo/versions/314_add_resource_provider_tables.py | Python | apache-2.0 | 3,207 |
# Copyright 2019 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/kernel_tests/random/random_binomial_test.py | Python | apache-2.0 | 8,349 |
# 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... | xuleiboy1234/autoTitle | tensorflow/tensorflow/contrib/timeseries/python/timeseries/model.py | Python | mit | 32,888 |
from yowsup.layers import YowLayer, EventCallback
from yowsup.layers.network import YowNetworkLayer
class YowCryptLayer(YowLayer):
'''
send: bytearray -> bytearray
receive: bytearray -> bytearray
'''
EVENT_KEYS_READY = "org.openwhatsapp.yowsup.crypt.keys"
def __init__(self):
... | ongair/yowsup | yowsup/layers/auth/layer_crypt.py | Python | mit | 2,107 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
from odoo.tools import float_round
class report_product_pricelist(models.AbstractModel):
_name = 'report.product.report_pricelist'
@api.model
def render_html(self, docids, data... | chienlieu2017/it_management | odoo/addons/product/report/product_pricelist.py | Python | gpl-3.0 | 2,429 |
# ***************************************************************************
# * Copyright (c) 2009, 2010 Yorik van Havre <yorik@uncreated.net> *
# * Copyright (c) 2009, 2010 Ken Cline <cline@frii.com> *
# * Copyright (c) 2020 FreeCAD Developers *
# * ... | sanguinariojoe/FreeCAD | src/Mod/Draft/draftobjects/point.py | Python | lgpl-2.1 | 3,047 |
# Copyright (c) 2014 Dell Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | nikesh-mahalka/cinder | cinder/tests/unit/test_dellfc.py | Python | apache-2.0 | 31,453 |
"""Support for interface with an Harman/Kardon or JBL AVR."""
import hkavr
import voluptuous as vol
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
from homeassistant.components.media_player.const import (
SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF,
SUPPORT_TURN_ON,
SU... | aronsky/home-assistant | homeassistant/components/harman_kardon_avr/media_player.py | Python | apache-2.0 | 3,346 |
"""
=============================================================
Online Latent Dirichlet Allocation with variational inference
=============================================================
This implementation is modified from Matthew D. Hoffman's onlineldavb code
Link: http://matthewdhoffman.com/code/onlineldavb.tar... | meduz/scikit-learn | sklearn/decomposition/online_lda.py | Python | bsd-3-clause | 29,415 |
from mymod import myfunc
import mymod
print(myfunc())
print(mymod.myfunc()) | jwren/intellij-community | python/testData/inspections/PyUnresolvedReferencesInspection/ModuleWithGetAttr/a.py | Python | apache-2.0 | 76 |
"""
log.py: written by Scaevolus 2009
"""
import os
import codecs
import time
import re
from util import hook
log_fds = {} # '%(net)s %(chan)s' : (filename, fd)
timestamp_format = '%H:%M:%S'
formats = {'PRIVMSG': '<%(nick)s> %(msg)s',
'PART': '-!- %(nick)s [%(user)s@%(host)s] has left %(chan)s',
... | Jeebeevee/DouweBot_JJ15 | plugins_org/log.py | Python | unlicense | 3,047 |
#
# 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 us... | shaneknapp/spark | examples/src/main/python/sql/streaming/structured_sessionization.py | Python | apache-2.0 | 3,213 |
#!/usr/bin/env python
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | v3ss0n/rietveld | tests/test_models.py | Python | apache-2.0 | 2,158 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 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 Lic... | alxgu/ansible | lib/ansible/modules/network/fortios/fortios_log_fortianalyzer_override_setting.py | Python | gpl-3.0 | 14,178 |
#!/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',
... | pilou-/ansible | lib/ansible/modules/network/junos/junos_l2_interface.py | Python | gpl-3.0 | 8,852 |
# 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... | beobal/cassandra | pylib/cqlshlib/test/ansi_colors.py | Python | apache-2.0 | 6,175 |
#-*- coding: utf-8 -*-
from django.core.files import File as DjangoFile
from django.test.testcases import TestCase
from django.conf import settings
from filer.tests.helpers import create_image
from filer.utils.loader import load
from filer.utils.zip import unzip
from zipfile import ZipFile
import os
#=================... | aptivate/django-filer | filer/tests/utils.py | Python | bsd-3-clause | 2,414 |
#!/usr/bin/env python
# Copyright 2015 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that ar_host is set correctly when enabling cross-compile on windows.
"""
import TestGyp
import sys
import os
if sys.platform ==... | ibc/MediaSoup | worker/deps/gyp/test/win/gyptest-crosscompile-ar.py | Python | isc | 669 |
"""Plugin system for cloud providers and environments for use in integration tests."""
from __future__ import absolute_import, print_function
import abc
import atexit
import os
import platform
import random
import re
import tempfile
from lib.util import (
ApplicationError,
display,
is_shippable,
impor... | britcey/ansible | test/runner/lib/cloud/__init__.py | Python | gpl-3.0 | 9,899 |
# Copyright (c) 2013 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | paninetworks/neutron | neutron/tests/unit/plugins/brocade/test_brocade_vlan.py | Python | apache-2.0 | 2,002 |
#!/usr/bin/env python
#
# Mark functions in an arm assembly file. This is done by surrounding the
# function with "# -- Begin Name" and "# -- End Name"
# (This script is designed for arm ios assembly syntax)
import sys
import re
inp = open(sys.argv[1], "r").readlines()
# First pass
linenum = 0
INVALID=-100
last_align... | cd80/UtilizedLLVM | utils/abtest/mark_armfns.py | Python | unlicense | 1,415 |
#!/usr/bin/env python
#
# 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
# "... | kgiusti/qpid-proton | python/examples/db_send.py | Python | apache-2.0 | 3,869 |
# -*- coding: utf-8 -*-
import datetime
from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms import *
from django.http import QueryDict
from django.template import Template, Context
from django.test import TestCase
from django.utils.datastructures import MultiValueDict, MergeDict
from django... | LethusTI/supportcenter | vendor/django/tests/regressiontests/forms/tests/forms.py | Python | gpl-3.0 | 109,561 |
# The following has been generated automatically from src/core/qgsunittypes.h
QgsUnitTypes.SystemOfMeasurement.baseClass = QgsUnitTypes
QgsUnitTypes.DistanceUnit.baseClass = QgsUnitTypes
QgsUnitTypes.AreaUnit.baseClass = QgsUnitTypes
QgsUnitTypes.VolumeUnit.baseClass = QgsUnitTypes
QgsUnitTypes.AngleUnit.baseClass = Qg... | ghtmtt/QGIS | python/core/auto_additions/qgsunittypes.py | Python | gpl-2.0 | 480 |
a = list
from math import *
| Eddy0402/Environment | vim/ycmd/third_party/jedi/test/completion/import_tree/pkg/__init__.py | Python | gpl-3.0 | 29 |
from __future__ import unicode_literals
import datetime
import decimal
import hashlib
import logging
import re
from time import time
from django.conf import settings
from django.utils.encoding import force_bytes
from django.utils.timezone import utc
logger = logging.getLogger('django.db.backends')
class CursorWrap... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/django/db/backends/utils.py | Python | mit | 7,380 |
# Source:https://github.com/Show-Me-the-Code/show-me-the-code
# Author:renzongxian
# Date:2014-12-23
# Python 3.4
"""
第 0016 题: 纯文本文件 numbers.txt, 里面的内容(包括方括号)如下所示:
[
[1, 82, 65535],
[20, 90, 13],
[26, 809, 1024]
]
请将上述内容写到 numbers.xls 文件中.
"""
import xlwt3
import json
def write_txt_to_xls(txt_file):
... | luoxufeiyan/python | renzongxian/0016/0016.py | Python | mit | 851 |
# -*- coding: utf-8 -*-
"""
pygments.lexers._postgres_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Self-updating data files for PostgreSQL lexer.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
# Autogenerated: please edit them if you... | ramcn/demo3 | venv/lib/python3.4/site-packages/pygments/lexers/_postgres_builtins.py | Python | mit | 11,210 |
# -*- coding: utf-8 -*-
# Scrapy settings for documentation_crawler project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs... | vikas-parashar/zulip | tools/documentation_crawler/documentation_crawler/settings.py | Python | apache-2.0 | 3,373 |
from __future__ import absolute_import
# For backwards compatibility, provide imports that used to be here.
from .connection import is_connection_dropped
from .request import make_headers
from .response import is_fp_closed
from .ssl_ import (
SSLContext,
HAS_SNI,
IS_PYOPENSSL,
IS_SECURETRANSPORT,
a... | RalfBarkow/Zettelkasten | venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/__init__.py | Python | gpl-3.0 | 1,038 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
int_or_none,
js_to_json,
mimetype2ext,
ExtractorError,
)
class ImgurIE(InfoExtractor):
_VALID_URL = r'https?://(?:i\.)?imgur\.com/(?P<id>[a-zA-Z0-9]+)'
... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/youtube_dl/extractor/imgur.py | Python | unlicense | 3,627 |
def f(**a<caret>rgs):
"""
Args:
**args:
""" | asedunov/intellij-community | python/testData/refactoring/rename/googleDocStringKeywordVararg.py | Python | apache-2.0 | 61 |
from operator import attrgetter
from django.db import connections, transaction, IntegrityError
from django.db.models import signals, sql
from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE
from django.utils.datastructures import SortedDict
from django.utils.functional import wraps
def CASCADE(collecto... | tjsavage/sfcsdatabase | sfcs/django/db/models/deletion.py | Python | bsd-3-clause | 9,988 |
from django.db.backends.mysql.base import DatabaseOperations
from django.contrib.gis.db.backends.adapter import WKTAdapter
from django.contrib.gis.db.backends.base import BaseSpatialOperations
class MySQLOperations(DatabaseOperations, BaseSpatialOperations):
compiler_module = 'django.contrib.gis.db.backends.mys... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/contrib/gis/db/backends/mysql/operations.py | Python | gpl-2.0 | 2,319 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUME... | aperigault/ansible | lib/ansible/modules/cloud/ovirt/ovirt_mac_pool.py | Python | gpl-3.0 | 5,267 |
from __future__ import unicode_literals
import errno
import os
import socket
import time
import re
from .common import FileDownloader
from ..compat import (
compat_urllib_request,
compat_urllib_error,
)
from ..utils import (
ContentTooShortError,
encodeFilename,
sanitize_open,
)
class HttpFD(Fil... | miminus/youtube-dl | youtube_dl/downloader/http.py | Python | unlicense | 10,827 |
# highlight.py - highlight extension implementation file
#
# Copyright 2007-2009 Adam Hupp <adam@hupp.org> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
#
# The original module was split in an interface and an impleme... | iaddict/mercurial.rb | vendor/mercurial/hgext/highlight/highlight.py | Python | mit | 2,219 |
# -*- coding: utf-8 -*-
# from . import test_ogone
checks = [
# test_ogone,
]
| diogocs1/comps | web/addons/payment_ogone/tests/__init__.py | Python | apache-2.0 | 84 |
"""HTTP cookie handling for web clients.
This module originally developed from my port of Gisle Aas' Perl module
HTTP::Cookies, from the libwww-perl library.
Docstrings, comments and debug strings in this code refer to the
attributes of the HTTP cookie system as cookie-attributes, to distinguish
them clearly from Pyt... | Pathoschild/stewbot | stewbot/components/modules/mechanize/_clientcookie.py | Python | isc | 64,948 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import itertools
import pygame
from pygame.locals import *
# Initialize global libs. Must be done before importing other modules.
pygame.init()
pygame.font.init()
pygame.display.set_mode((800, 600))
# pygame.display.set_mode((2560, 1600), pygame.FULLSCREE... | cjb/curveship | lib/display.py | Python | isc | 5,672 |
#!/bin/env python
# vim: set et ts=4 sw=4 fileencoding=utf-8:
'''
Setup script for nail
'''
import os
from setuptools import Command, setup
# Ensure we are in nail source dir
setup_dirname = os.path.dirname(__file__)
if setup_dirname != '':
os.chdir(setup_dirname)
nail_version = os.path.join(os.path.abspath(os.p... | shadowfax-chc/nail | setup.py | Python | isc | 2,672 |
from django.shortcuts import render
from django.shortcuts import HttpResponse
from django.core import serializers
from django.http import JsonResponse
from allframe import models
from itertools import chain
from bokeh.plotting import figure
from bokeh.resources import CDN
from bokeh.embed import components
# Create ... | plain1994/DLRanking | allframe/views.py | Python | mit | 2,980 |
#!/usr/bin/env python
#
# Cmake
#
# Cmake packages and versions
#
# Author P G Jones - 2014-02-24 <p.g.jones@qmul.ac.uk> : New file.
####################################################################################################
import nusoft.package.local as local_package
import os
class Cmake(local_package.Loca... | pgjones/nusoft | packages/nusoft/cmake.py | Python | mit | 2,202 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
def env_or_default(name, d):
from os import environ
try:
a = environ[name]
if a:
return type(d)(a)
else:
return d
except Exception:
return d
def print_stats(steps, t_diff, dl):
from time import strf... | inconvergent/differential-line-mpi | modules/helpers.py | Python | mit | 521 |
ONE_HOT_SIZE = 5
HIDDEN_LAYER_SIZE = 5
NUM_HIDDEN_LAYERS = 3
SEQUENCE_LENGTH = 30
UNROLLED = False
g = PGM([9, 10], origin=[0, 0])
input_char = g.add_node(Node('input_char', '$x$', 1.25, 2))
input_one_hot = helpers.layer(
g,
[f'$xo_{i}$' for i in range(ONE_HOT_SIZE)],
2.25, 3.5, spacing=0.75)
helpers.ful... | DonaldWhyte/deep-learning-with-rnns | talk_creation_helpers/graph_generation/full_text_generation_architecture.py | Python | mit | 1,211 |
import serial
ser = serial.Serial('/dev/tty.usbmodem1411', 9600)
while True:
print ser.readline() | var-mar/workshop_topconf_introduction_arduino | code/python_to_arduino/serial_receive_sensor.py | Python | mit | 99 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""main.py: Main module."""
from kivy.base import runTouchApp
from kivy.uix.relativelayout import RelativeLayout
from dpad import Dpad
from buttonpad import ButtonPad
from gameobject import GameObject
__author__ = "Victor RENÉ"
__copyright__ = "Copyright 2014, Kivy wid... | victor-rene/kivy-gamelib | gamepad/main.py | Python | mit | 913 |
from django.conf.urls.defaults import patterns, include
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'', include('boundaries.urls')),
(r'^api/', include('billy.web.api.urls')),
(r'^admin/', include('billy.web.admin.urls')),
(r'^djadmin/', include(admin.site.urls))... | opengovernment/opengovernment-local | site/oglocal_site/urls.py | Python | mit | 370 |
from gensim.utils import unpickle
from clustering_system.corpus.LineCorpus import LineCorpus
class MetaLineCorpusWrapper:
"""Wrapper which loads Line corpus with metadata."""
def __init__(self, filename):
self.corpus = LineCorpus(filename)
self.metadata = unpickle(filename + ".metadata.cpick... | vanam/clustering | clustering_system/corpus/MetaLineCorpusWrapper.py | Python | mit | 436 |
from setuptools import setup, find_packages
from Cython.Build import cythonize
from distutils.extension import Extension
import versioneer
import sys
import os
include_dirs = [os.path.join(sys.prefix, "include")]
library_dirs = [os.path.join(sys.prefix, "lib")]
libraries = ["uv"]
kwargs = {
'include_dirs': include... | srossross/uvio | setup.py | Python | mit | 1,387 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "math_tournaments.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure ... | ant-Korn/math_tournaments | math_tournaments/manage.py | Python | mit | 814 |
import numpy as np
import pandas as pd
from datetime import datetime
from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
from sklearn.svm import LinearSVC
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import normalize
from test_feature_sets import ge... | tjkemp/image-tractor | false_classifications.py | Python | mit | 1,541 |
import os
import sys
import time
import re
import pprint
import random
import types
import unittest
import imp
import jsonpickle
class DevNull(object):
def __init__(self, *writers):
self.writers = writers
def write(self, text):
return
def f_noarg(self):
return
def f_varg(self, *args, **kwargs... | evandrix/Splat | code/demo/quixey/mine_tests/test_to_base.py | Python | mit | 6,903 |
#!/usr/local/bin/python3.3
var = 99
def local():
var = 0
def glob1():
global var
var += 1
return
def glob2():
import thismod
thismod.var += 1
def glob3():
import sys
glob = sys.modules['thismod']
glob.var += 1
def test():
print(var)
local(); glob1(); glob2(); glob3();
... | eroicaleo/LearningPython | ch17/thismod.py | Python | mit | 334 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'SomethingAwfulProfile.postcount'
db.add_column(u'profiles... | Ell/goonauth | profiles/migrations/0009_auto__add_field_somethingawfulprofile_postcount__add_field_somethingaw.py | Python | mit | 11,166 |
from .api import Api
from .exceptions import MissingParam
class Resolver:
def __init__(self):
self.url = ''
self.method = ''
self.api = Api()
def setup(self, api_map=None, **kwargs):
url = api_map['url']
method = api_map['method']
try:
url = url.fo... | Girbons/rls-sdk | rls/resolvers.py | Python | mit | 674 |
import json
import os
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from backend.api.serializers import (
ImageFileSerializer,
ImageSeriesSerializer,
NoduleSerializer,
)
from backend.images.models import (
... | vessemer/concept-to-clinic | interface/backend/api/tests.py | Python | mit | 5,304 |
__author__ = "Mauricio Collazos"
tasks = list()
def extraction(raw_text):
entities = {
"indexes": list(),
"tasks": list()
}
words = raw_text.split()
# Extract indexes:
for word in words:
try:
task_index = int(word)
entities["indexes"].append(task_i... | contraslash/chatbots-intro | basado_en_reglas/app.py | Python | mit | 2,088 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-30 22:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dcolumns', '0001_initial'),
]
operations = [
migrations.AlterField(
... | cnobile2012/dcolumn | dcolumn/dcolumns/migrations/0002_auto_20160130_1715.py | Python | mit | 542 |
# -*- encoding: utf-8 -*-
import asyncio
END = b'Bye-bye!\n'
@asyncio.coroutine
def echo_client():
reader, writer = yield from asyncio.open_connection('localhost', 8000)
writer.write(b'Hello, world\n')
writer.write(b'What a fine day it is.\n')
writer.write(END)
while True:
line = yield fr... | INP-Group/ProjectN-Control | src/client.py | Python | mit | 531 |
#!/usr/bin/env python
import os
import sys
from setuptools import setup
with open("./pushbullet/__version__.py") as version_file:
version = version_file.read().split("\"")[1]
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
install_reqs = [
"requests>=1.0.0",
"p... | kovacsbalu/pushbullet.py | setup.py | Python | mit | 1,538 |
import os
import sys
from database import Base, engine
from parse_cj import main
from zipcode.fetch_zipcode import download_zip_to_memory
from zipcode.fetch_zipcode import extract_zip
from zipcode import path
import asyncio
def init_db():
try:
os.remove('db.sqlite')
except OSError:
print('Erro... | demarlik01/szcal | manage.py | Python | mit | 796 |
"""Run tests over code examples in the documentation."""
import contextlib
import os
import runpy
import sys
import pytest
if sys.version_info >= (3, 4):
from pathlib import Path
else: # python2.7 compat
from _pytest.pathlib import Path
examples_dir = Path(__file__, '../../doc/source/examples').resolve()
... | mehcode/python-xmlsec | tests/test_doc_examples.py | Python | mit | 1,004 |
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt
import os
class Window(QtGui.QWidget):
def __init__(self):
self.ext_mon = ""
self.main_mon = ""
self.main_res = ""
self.ext_res = ""
self.main_present = 0
self.ext_present = 0
QtGui.QWidget.__init__(self)
self.b1_auto ... | ddash/utilities | dashmonitor.py | Python | mit | 3,539 |
# (C) 2018-2020 Ed Bueler
# See msh2petsc.py for usage.
# This script is based on the Gmsh ASCII format (version 4.1) documented at
# http://gmsh.info/doc/texinfo/gmsh.html#MSH-file-format
import numpy as np
import sys
#Gmsh format version 4.1:
#$Entities
# numPoints numCurves numSurfaces numVolumes # use:... | bueler/p4pdes | c/ch10/meshes/format41.py | Python | mit | 9,393 |
"""
Copyright (C) 2014 Maruf Maniruzzaman
Website: http://cosmosframework.com
Author: Maruf Maniruzzaman
License :: OSI Approved :: MIT License
"""
from __future__ import print_function
import os
import base64
def get_files(rootdir, excludes):
print ("Excludes: ", excludes)
file_list = []
for root, su... | kuasha/cosmos | cosmos/admin/publish.py | Python | mit | 4,336 |
import logging, datetime
from django.contrib import messages
from django.http import HttpResponseBadRequest
from django.shortcuts import render
from django_q.humanhash import humanize
from django_q.models import OrmQ
from django_q.tasks import async, Task
logger = logging.getLogger(__name__)
def reminder(duration... | forance/django-q | djangoq_demo/order_reminder/views.py | Python | mit | 3,035 |
#-*- coding:utf-8 -*-
import time
from datetime import datetime
from copy import deepcopy
import os
from Strategy import Strategy
from FinalLogger import logger
from DatabaseController import DatabaseController
from Constant import TICK_DIR, inst_thread
class TickController():
inst_current_tick = {}
def __in... | ewenqua/pqctp | TickController.py | Python | mit | 1,871 |
# encoding: 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):
# Removing M2M table for field sponsors_to_display on 'SpecificSponsorsPlugin'
db.delete_table('sponsors_s... | frinat/fribourg-natation.ch | frinat/sponsors/migrations/0002_auto.py | Python | mit | 4,785 |
# -*- encoding: utf-8 -*-
from datetime import datetime
from esipy import App
from esipy import EsiClient
from esipy import EsiSecurity
from esipy.exceptions import APIException
from flask import Flask
from flask import redirect
from flask import render_template
from flask import request
from flask import session
fro... | pcd1193182/hauler-tool | app.py | Python | mit | 8,820 |
#!/usr/bin/env python
from wanntb.akw import get_akw
import numpy as np
if __name__ == '__main__':
nkpt = 200
nfreq = 4001
nwann = 24
norbs = 24
mu =-4.21230616
hk = np.zeros((nkpt,nwann,nwann),dtype=np.complex128)
sgm = np.zeros((nfreq,norbs,norbs),dtype=np.complex128)
udc = np.ze... | shenmidelin/pylibwyl | wanntb/test_files/t_akw.py | Python | mit | 1,405 |
# -*- coding: utf-8 -*-
#
# Hybra documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 19 22:14:15 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | HIIT/hybra-core | docs/conf.py | Python | mit | 4,997 |
import os, sys
import cv2
import numpy as np
import shutil
from tqdm import tqdm
from argparse import ArgumentParser
def read_labeled_data(images_dir, labels_file):
images_data = []
labels_list = [int(x.strip())
for x in open(labels_file, 'r').readlines()]
images_list = sorted(os.listdir(images_dir))
fo... | btlk/siam | src/data.py | Python | mit | 3,056 |