text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from distutils.core import setup
import py2exe
opts = {
"py2exe": {
"compressed": 1,
"optimize": 2,
"ascii": 1,
"bundle_files": 1,
"packages": ["encodings"],
"dist_dir": "dist"
}
}
setup (name = "Gomoz",
fullname = "Gomoz web scanner",
version = "1.0.1",
descript... | eyecatchup/gomoz | win/winsetup.py | Python | gpl-3.0 | 689 | 0.063861 |
#!/usr/bin/env python
#
# Test a trip planner
import sys
import argparse
from importlib import import_module
import logging
from color_logging import ColoredFormatter
PROVIDER_CHOICES = ['otp', 'hpjp']
logger = logging.getLogger(__name__)
def setup_logging(options):
SUCCESS_LEVEL_NUM = 9
logging.addLevel... | plannerstack/testset | mmri/test_runner.py | Python | mit | 2,465 | 0.004462 |
#!/usr/bin/python
# Copyright: Ansible Project
# 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',
'status': ['preview'],
... | valentin-krasontovitsch/ansible | lib/ansible/modules/cloud/amazon/elb_classic_lb.py | Python | gpl-3.0 | 53,523 | 0.002111 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_theed_palace_chamberlain.iff"
result.attribute_templat... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_theed_palace_chamberlain.py | Python | mit | 457 | 0.045952 |
# -*- coding: utf-8 -*-
# Copyright © 2017 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, api
class ProductProduct(models.Model):
_inherit = 'product.product'
@api.multi
def _is_service_buy_make_to_order(self):
for prod... | Daniel-CA/odoomrp-wip-public | procurement_service/models/product_product.py | Python | agpl-3.0 | 903 | 0 |
# Copyright 2012 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 in... | reeshupatel/demo | keystone/identity/core.py | Python | apache-2.0 | 42,880 | 0.000023 |
# Copyright (C) 2001,2002 Python Software Foundation
# Author: barry@zope.com (Barry Warsaw)
"""Base class for MIME specializations.
"""
from email import Message
class MIMEBase(Message.Message):
"""Base class for MIME specializations."""
def __init__(self, _maintype, _subtype, **_params):
... | DarioGT/OMS-PluginXML | org.modelsphere.sms/lib/jython-2.2.1/Lib/email/MIMEBase.py | Python | gpl-3.0 | 780 | 0.001282 |
from distutils import log
from distutils.core import setup
from distutils.core import Command
from distutils.command.build_py import build_py
from distutils.command.install import install
import os
import zeroinstall
class adjust_scripts_for_home(Command):
"""setup.py install --home puts libraries in ~/lib/python, bu... | turtledb/0install | setup.py | Python | lgpl-2.1 | 3,194 | 0.020664 |
# coding: utf-8
from ckeditor_uploader.fields import RichTextUploadingField
from django.contrib.auth.models import User
from django.db import models
class Column(models.Model):
name = models.CharField(max_length=64, unique=True, verbose_name=u'栏目名称')
ename = models.CharField(max_length=64, unique=True, verbo... | chiaki-yu/PyYu | videos/models.py | Python | lgpl-3.0 | 3,730 | 0.00256 |
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html
"""Utilitie... | nuclear-wizard/moose | python/MooseDocs/common/read.py | Python | lgpl-2.1 | 1,466 | 0.00955 |
# -*- coding: utf-8 -*-
#
# {{project_name}} documentation build configuration file, created by
# sphinx-quickstart on Fri Sep 20 20:45:07 2013.
#
# 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... | nickpack/django-project-template | docs/source/conf.py | Python | mit | 9,716 | 0.005867 |
# -*- coding: utf-8 -*-
import re
import ipaddress
from unidecode import unidecode
class NetTest(object):
wildcards = [ipaddress.IPv4Interface(
unicode('0.0.0.0/{}'.format(x))).network.hostmask.exploded for x in range(0, 33)]
netmasks = [ipaddress.IPv4Interface(
unicode('255.255.255.255/{}'.... | heyglen/netobj | nettool/nettest.py | Python | mit | 14,175 | 0.001199 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Find components defining more than one contact with the same role.
In older versions of PDC, it was possible to have multiple contacts with the
same role. When limits for cardinality of this relationship were introduced, we
need to find all components that would not ... | release-engineering/product-definition-center | examples/find-duplicated-contacts.py | Python | mit | 1,148 | 0 |
"""Users tests."""
from django.contrib.auth import get_user_model, authenticate
from django.test import TestCase
from django.test import RequestFactory
from tests.utils import ModelTestCase
from users.factory import UserFactory
User = get_user_model()
class EmailAuthenticationTest(TestCase):
"""Tests to make s... | oser-cs/oser-website | tests/test_users/test_user.py | Python | gpl-3.0 | 2,826 | 0 |
# -*- coding:utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import django
import patchy
from django.db.models.deletion import get_candidate_relations_to_delete
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
from django.db.models.sql.... | moumoutte/django-perf-rec | django_perf_rec/orm.py | Python | mit | 3,345 | 0.000897 |
# encoding: utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from distutils.util import convert_path
import os... | klahnakoski/MoHg | setup.py | Python | mpl-2.0 | 2,261 | 0.008846 |
"""Endpoint to handle URL shorten request"""
from hashids import Hashids
from flask import Blueprint, request, jsonify, current_app
import models
from lib.url_validate import is_valid_url
from lib import error
api = Blueprint(__name__, "url")
@api.route("/url", methods=["POST"])
def shorten():
"""Shorten a pur... | tienhm-p4u/shorten_url | endpoint/__init__.py | Python | gpl-3.0 | 1,393 | 0 |
# Copyright (C) 2009 Ashley J. Wilson
# This software is licensed as described in the file COPYING in the root
# directory of this distribution.
from storenode import StoreNode
from bundlenode import BundleNode
from packagenode import PackageNode
class RootNode(StoreNode):
"""The virtual root of a Store repositor... | smashwilson/strac | strac/rootnode.py | Python | mit | 2,306 | 0.00477 |
#!/usr/bin/env python
"""Docstring."""
import re
from functools import reduce
from collections import Counter
from common import get_input
class SSLTester:
"""."""
def __init__(self, input_list=[]):
"""Initialize."""
self.input_list = input_list
def find_aba(self, seq):
"""Retu... | tlake/advent-of-code | 2016/day07_internet_protocol_version_7/python/src/part2.py | Python | mit | 2,010 | 0.000995 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright © 2016 Taylor C. Richberger <taywee@gmx.com>
# This code is released under the license described in the LICENSE file
from __future__ import absolute_import, division, print_function, unicode_literals
from .makerestapiclient import make_rest_api_client
| Taywee/makerestapiclient | makerestapiclient/__init__.py | Python | mit | 313 | 0.003205 |
import os
from urllib import urlretrieve
import pandas as pd
FREEMONT_URL = "https://data.seattle.gov/api/views/65db-xm6k/rows.csv?accessType=DOWNLOAD"
def get_freemont_data(filename="Freemont.csv", url=FREEMONT_URL,
force_download=False) :
"""Download and cache the Freemont data
Param... | betogulliver/JupyterWorkflow | jupyterworkflow/data.py | Python | mit | 1,112 | 0.009892 |
# -*- coding: utf-8 -*-
"Main module defining filesystem and file classes"
from __future__ import absolute_import
import ctypes
import logging
import os
import posixpath
import re
import warnings
import operator
import functools
from collections import deque
from .compatibility import FileNotFoundError, ConnectionErr... | blaze/hdfs3 | hdfs3/core.py | Python | bsd-3-clause | 34,058 | 0.000352 |
# Copyright (c) 2020 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import gzip
from UM.Mesh.MeshReader import MeshReader #The class we're extending/implementing.
from UM.MimeTypeDatabase import MimeTypeDatabase, MimeType #To add the .gcode.gz files to the MIME type database.
from UM.Plugi... | Ultimaker/Cura | plugins/GCodeGzReader/GCodeGzReader.py | Python | lgpl-3.0 | 1,298 | 0.010786 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Genaral packages
import os, sys
import pandas as pd
import numpy as np
sys.path.append(os.getcwd())
#os.chdir('/Users/IkkiTanaka/Documents/kaggle/Santander/')
#各種PATH
from stacking.base import FOLDER_NAME, PATH, INPUT_PATH, OUTPUT_PATH, ORIGINAL_TRAIN_FORMAT, SUBMIT_FOR... | ikki407/stacking | examples/Santander/scripts/ikki_NN_1.py | Python | mit | 44,881 | 0.016757 |
from __future__ import division, print_function
import os
import sys
import pickle
import copy
import warnings
from os.path import join
from numpy.distutils import log
from distutils.dep_util import newer
from distutils.sysconfig import get_config_var
from numpy._build_utils.apple_accelerate import (
uses_accelera... | jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/numpy/core/setup.py | Python | mit | 41,471 | 0.001495 |
from rest_framework import generics, permissions as drf_permissions
from rest_framework.exceptions import NotFound
from framework.auth.oauth_scopes import CoreScopes, public_scopes
from api.base.filters import ListFilterMixin
from api.base import permissions as base_permissions
from api.scopes.serializers import Scope... | icereval/osf.io | api/scopes/views.py | Python | apache-2.0 | 2,283 | 0.000876 |
# -------------------------------------------------------------
#
# 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 unde... | apache/incubator-systemml | src/main/python/systemds/operator/algorithm/builtin/xgboostPredictClassification.py | Python | apache-2.0 | 1,910 | 0.002618 |
#!/usr/bin/python
# (C) 2015-2106 - Muthiah Annamalai
# parse data files for Tamil proper nouns
from __future__ import print_function
import codecs
import json
import pprint
import re
import sys
import tamil
class WordList:
# data structure for a WordList containing only one category
def __init__(self, cat)... | Ezhil-Language-Foundation/open-tamil | solthiruthi/data_parser.py | Python | mit | 3,224 | 0.00062 |
import twe_lite
import json
import queue
import sys
import time
import traceback
import yaml
from threading import Thread
from datetime import datetime
from pytz import timezone
from iothub_client import IoTHubClient, IoTHubClientError, IoTHubTransportProvider, IoTHubClientResult, IoTHubClientStatus
from iot... | locatw/Autonek | TweLiteGateway/twe_lite_gateway/gateway.py | Python | mit | 4,912 | 0.003054 |
from django.contrib import admin
from .models import Article
# Register your models here.
class ArticleModelAdmin(admin.ModelAdmin):
class Meta:
model = Article
list_display = ['name', 'timestamp', 'updated_time','category']
list_display_links = ['name']
search_fields = ['name', 'article']
... | oluwex/Akede | Articles/admin.py | Python | gpl-3.0 | 424 | 0.007075 |
"""
Module for building and working with Poses.
"""
import thread, random, re, pprint, sets
import pickle
import maya.cmds as mc
import pymel.core as pm
from pymel.core import mel, Path
from pymel.core.uitypes import OptionMenu
#from pymelX import register_runtime
from impress import register
from config import RUN... | kinetifex/maya-kinetifex | scripts/kinetifex/poses.py | Python | gpl-2.0 | 28,451 | 0.024358 |
import os
from conans.model.manifest import FileTreeManifest
from conans.test.utils.test_files import temp_folder
from conans.util.files import load, md5, save
class TestManifest:
def test_tree_manifest(self):
tmp_dir = temp_folder()
files = {"one.ext": "aalakjshdlkjahsdlkjahsdljkhsadljkhasljkd... | conan-io/conan | conans/test/unittests/model/manifest_test.py | Python | mit | 2,125 | 0.002824 |
import os
import sys
import threading
import boto3
import requests
import json
import logging
from boto3.s3.transfer import TransferConfig, ProgressCallbackInvoker
from s3transfer.utils import OSUtils
from botocore.exceptions import ClientError
from boto3.exceptions import RetriesExceededError, S3UploadFailedError
fro... | huaili-cid/metagen_cli | metagen/api/upload.py | Python | mit | 4,807 | 0.001872 |
from datetime import datetime
from treeherder.log_parser.parsers import StepParser
def test_date_with_milliseconds():
"""Handle buildbot dates that have a decimal on the seconds."""
parser = StepParser()
dt = parser.parsetime('2015-01-20 16:42:33.352621')
assert dt == datetime(2015, 1, 20, 16, 42, 33... | adusca/treeherder | tests/log_parser/test_step_parser.py | Python | mpl-2.0 | 570 | 0 |
from dash.orgs.models import Org
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
class Command(BaseCommand):
help = "Pulls all contacts, groups and fields from the backend for the specified org"
def add_arguments(self, parser):
parser.add_argument("... | praekelt/casepro | casepro/contacts/management/commands/pullcontacts.py | Python | bsd-3-clause | 1,909 | 0.003667 |
import pytest
from playlog.lib.json import Encoder
def test_encoder():
encoder = Encoder()
with pytest.raises(TypeError):
encoder.default(object())
| rossnomann/playlog | tests/src/tests/common/test_json.py | Python | mit | 167 | 0 |
# -*- coding: utf-8 -*-
"""
Control screen rotation.
Configuration parameters:
cache_timeout: how often to refresh this module.
(default 10)
format: a string that formats the output, can include placeholders.
(default '{icon}')
hide_if_disconnected: a boolean flag to hide icon when `screen`... | Andrwe/py3status | py3status/modules/xrandr_rotate.py | Python | bsd-3-clause | 5,237 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2007-2022 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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 y... | jat255/hyperspy | hyperspy/tests/io/test_hdf5.py | Python | gpl-3.0 | 31,740 | 0.001323 |
#!/usr/bin/python
# NOTE!! This code is from the Adafruit Learning System articles on the Raspberry Pi (http://learn.adafruit.com/)
# The original version of the code can be found in the Adafruit Raspberry Pi Python Library on Github at https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code
import smbus
# ==... | tomstokes/redeem | software/Adafruit_I2C.py | Python | gpl-3.0 | 4,135 | 0.014994 |
import sys
import threading
import time
import unittest
from bank_account import BankAccount
class BankAccountTest(unittest.TestCase):
def test_newly_opened_account_has_zero_balance(self):
account = BankAccount()
account.open()
self.assertEqual(account.get_balance(), 0)
def test_can_... | N-Parsons/exercism-python | exercises/bank-account/bank_account_test.py | Python | mit | 4,295 | 0 |
from django.conf.urls import include, url
# Doorstep apps urls
urlpatterns = [
url(r'^', include('doorstep.catalog.urls')),
url(r'^accounts/', include('doorstep.accounts.urls')),
url(r'^sales/', include('doorstep.sales.urls')),
url(r'^payments/', include('doorstep.payments.urls')),
url(r'^pages/',... | mysteryjeans/doorsale-demo | doorstep/urls.py | Python | gpl-2.0 | 355 | 0 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuit_authorizations_operations.py | Python | mit | 18,188 | 0.003079 |
#!/usr/bin/python
import httplib
import json
# arguments
## make sure that url is s... | guangjian/openstack-api-client | test.py | Python | apache-2.0 | 2,512 | 0.01035 |
from .views import DepartmentDetailView, Stats, FireDepartmentListView, SimilarDepartmentsListView, DepartmentUpdateGovernmentUnits
from django.contrib.auth.decorators import permission_required
from django.views.generic import TemplateView
from django.conf.urls import patterns, url
from django.views.decorators.cache i... | garnertb/firecares | firecares/firestation/urls.py | Python | mit | 2,033 | 0.004919 |
import numpy as np
import pytest
from pandas import (
DataFrame,
MultiIndex,
)
import pandas._testing as tm
from pandas.core.groupby.base import (
reduction_kernels,
transformation_kernels,
)
@pytest.fixture(params=[True, False])
def as_index(request):
return request.param
@pytest.fixture
def m... | dsm054/pandas | pandas/tests/groupby/conftest.py | Python | bsd-3-clause | 3,673 | 0.000545 |
# Copyright 2017-2020 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Agreement Account",
"summary": "Agreement on invoices",
"version": "14.0.1.0.0",
"category": "Contract",... | OCA/contract | agreement_account/__manifest__.py | Python | agpl-3.0 | 776 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Carlos Cesar Caballero Diaz <ccesar@linuxmail.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ve... | cccaballero/services-manager | services-manager.py | Python | gpl-3.0 | 5,938 | 0.006231 |
#!/usr/bin/env python2
import os, sygnal, sys
import argparse
import math
| cuauv/software | cave/mainForCommandline.py | Python | bsd-3-clause | 75 | 0.013333 |
import ddt
from django.test.utils import override_settings
from mock import MagicMock, patch
from openedx.core.djangoapps.zendesk_proxy.utils import create_zendesk_ticket
from openedx.core.lib.api.test_utils import ApiTestCase
@ddt.ddt
@override_settings(
ZENDESK_URL="https://www.superrealurlsthataredefinitelyno... | ahmedaljazzar/edx-platform | openedx/core/djangoapps/zendesk_proxy/tests/test_utils.py | Python | agpl-3.0 | 2,179 | 0.000918 |
#!/usr/bin/python
'''
## Description
A script to get mail from info@example.com and re-write the 'From"' Header
as "From: John Doe via info at example.com <noreply@example.com>'"
## Installation Instuctions
* Place the script under */usr/local/sbin/rewrite_from.py*.
* Edit */etc/aliases*:
```
info: "|/usr/local/sb... | theodotos/arena | rewrite_from.py | Python | gpl-3.0 | 1,572 | 0.001908 |
import time
import os, fnmatch
import sys
#########################################################
#
# 1. execute ld to generate log
# 2. collect all undefined reference symbols
# 3. find out the files defining the symbols
# 4. sort all the files
# 5. let user decide whether copy the ... | bamos/parsec-benchmark | pkgs/libs/uptcpip/src/scripts/gen-wrap-funclist.py | Python | bsd-3-clause | 1,350 | 0.033333 |
# Copyright 2017 IoT-Lab Team
# Contributor(s) : see AUTHORS file
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions a... | pyaiot/pyaiot | pyaiot/gateway/mqtt/gateway.py | Python | bsd-3-clause | 7,515 | 0 |
#!/usr/bin/env python3.5
# -*- coding: utf-8 -*-
# Author: ChenLiang
# Python 叫模块,其他叫 类库
"""
模块,用一砣代码实现了某个功能的代码集合。
类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合。而对于一个复杂的功能来,可能需要多个函数才能完成(函数又可以在不同的.py文件中),n个 .py 文件组成的代码集合就称为模块。
如:os 是系统相关的模块;file是文件操作相关的模块
模块分为三种:
自定义模块
第三方模块
内置模块
"""
"""
# 自定义模块
文件
1. 新... | smartczm/python-learn | Old-day01-10/s13-day5/s3.py | Python | gpl-2.0 | 8,551 | 0.002026 |
"""
Copyright (c) 2015, 2019 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import json
import os
from osbs.exceptions import OsbsResponseException
from atomic_reactor.plugins.pre_reactor_config import get_open... | DBuildService/atomic-reactor | atomic_reactor/plugins/exit_store_metadata_in_osv3.py | Python | bsd-3-clause | 12,020 | 0.001581 |
# -*- coding: utf-8 -*-
#_____________________________________________________________________________
#
# This file is part of txrecaptcha, a Twisted reCAPTCHA client.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# Matthew Finkel 0x017DD169EA793BE2 <sysrqb@torproject.org>
# :copyri... | isislovecruft/txrecaptcha | test/test_resources.py | Python | bsd-3-clause | 9,079 | 0.000661 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | squirrelo/qiita | qiita_pet/handlers/api_proxy/tests/test_artifact.py | Python | bsd-3-clause | 19,979 | 0.00005 |
import shutil
import os
import codecs
import json
"""
Using the list of active pages generated by compile_active from the API,
deleter removes whatever isn't accounted for online.
Warning: anything in a category folder that isn't in the compile_active list will be deleted.
"""
MIRROR = 'archive'
class Deleter:
... | zamattiac/ROSIEBot | deleter.py | Python | mit | 2,875 | 0.002087 |
import requests
import logging
from django.core.cache import cache
from django.conf import settings
LOG = logging.getLogger(__name__)
def is_prerelease(version_str):
"""
Checks if the given version_str represents a prerelease version.
"""
return any([c.isalpha() for c in version_str])
def get_ver... | django-de/django-de-v3 | django_de/versions/utils.py | Python | bsd-3-clause | 1,906 | 0.002623 |
#!/usr/bin/env python
#
# Simple IRC Bot to announce messages
#
# Code originally based on example bot and irc-bot class from
# Joel Rosdahl <joel@rosdahl.net>, author of included python-irclib.
#
"""
An IRC bot stub, it will join a particular channel on a server. All
further functionality is implemented by additional... | adblockplus/abpbot | abpbot.py | Python | gpl-2.0 | 4,512 | 0.000887 |
if condition:
def func():
pass
else:
def func():
pass
fu<caret>nc() | siosio/intellij-community | python/testData/intentions/PyAnnotateTypesIntentionTest/resolveAmbiguity.py | Python | apache-2.0 | 94 | 0.031915 |
from buildpal_client import compile as buildpal_compile
import os
import subprocess
import asyncio
import sys
import struct
import threading
import pytest
from buildpal.common import MessageProtocol
class ProtocolTester(MessageProtocol):
@classmethod
def check_exit_code(cls, code):
if ... | pkesist/buildpal | Python/test/test_client.py | Python | gpl-3.0 | 4,561 | 0.004385 |
"""
paxo.core - the guts of it all
"""
import os
from clint.textui import colored, puts
from clint import resources
from paxo import __author__
from paxo.command import define_command, Collection
from paxo.util import args, show_error, ExitStatus, XDG_DATA_HOME
from paxo.storage import storage
class Paxo(object):
... | cwoebker/paxo | paxo/core.py | Python | bsd-3-clause | 3,371 | 0.000593 |
"""
mod_auth Models
===================
In this module, we are trying to maintain all database models used
for authentication.
List of models corresponding to mysql tables: ['User' => 'user']
"""
import string
from passlib.apps import custom_app_context as pwd_context
from sqlalchemy import Column, Integer, String, T... | satyammittal/sample-platform | mod_auth/models.py | Python | isc | 3,955 | 0.000506 |
# -*- coding: utf-8 -*-
import pytest
import sys
import os
import logging
import itertools
import glob
import subprocess
from flexmock import flexmock
try:
from cStringIO import StringIO
except:
try:
from StringIO import StringIO
except:
from io import StringIO
from devassistant.dapi import ... | hroncok/devassistant | test/dapi/test_dap.py | Python | gpl-2.0 | 21,493 | 0.00219 |
import torch
import torch.nn as nn
class AsymmetricLossMultiLabel(nn.Module):
def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-8, disable_torch_grad_focal_loss=False):
super(AsymmetricLossMultiLabel, self).__init__()
self.gamma_neg = gamma_neg
self.gamma_pos = gamma... | rwightman/pytorch-image-models | timm/loss/asymmetric_loss.py | Python | apache-2.0 | 3,322 | 0.001505 |
from django.conf.urls.defaults import *
urlpatterns = patterns('transaction.views',
(r'^create/(?P<pid>.*)$', 'create'),
(r'^edit/(?P<tid>.*)$', 'edit'),
)
| rimbalinux/LMD3 | transaction/urls.py | Python | bsd-3-clause | 171 | 0.005848 |
import os
from boxsdk import Client
from boxsdk.exception import BoxAPIException
from boxsdk.object.collaboration import CollaborationRole
from demo.auth import authenticate
def run_user_example(client):
# 'me' is a handy value to get info on the current authenticated user.
me = client.user(user_id='me').get(... | box/box-python-sdk | demo/example.py | Python | apache-2.0 | 9,973 | 0.002005 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Module for OpenERP
# Copyright (C) 2014 Akretion (http://www.akretion.com).
# @author Sébastien BEAU <sebastien.beau@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
... | lyynocs/magento-connector-v8 | sale_automatic_workflow_exception/__openerp__.py | Python | agpl-3.0 | 1,693 | 0 |
#!/usr/bin/env python3
"""Lalikan
=======
Backup scheduler for Disk ARchive (DAR)
Copyright (c) 2010-2019 Dr. Martin Zuther (http://www.mzuther.de/)
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 Sof... | mzuther/lalikan | src/Lalikan.py | Python | gpl-3.0 | 7,043 | 0 |
# 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... | MehdiSfr/tensor-flow | tensorflow/g3doc/how_tos/reading_data/fully_connected_preloaded.py | Python | apache-2.0 | 5,244 | 0.005721 |
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))
... | mcgee/ns-3 | src/click/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 362,122 | 0.015152 |
import math
import net
SIGMOID = 0
TANH = 1
class bp:
def __init__(self, net, learning_rate, momentum):
self.type = net.getType()
self.net = net
self.lr = learning_rate
self.m = momentum
self.layer = net.getLayer()
self.lc = [[[0]*max(self.layer)]*max(self.layer)]*len(self.layer)
def _dfu... | bongtrop/cilab-python | ann/bp.py | Python | bsd-3-clause | 1,933 | 0.017072 |
# -*- coding: utf-8 -*-
import re
import logging
import copy
from cm import Base, getLogger
logger = getLogger(__name__)
class Scoper(Base):
scopes = ['html','xhtml','php','blade','jinja','jinja2','vue.html.javascript.css','vue']
def sub_context(self,ctx,src):
lnum = ctx['lnum']
col = ctx['... | roxma/nvim-completion-manager | pythonx/cm_scopers/html_scoper.py | Python | mit | 4,724 | 0.012066 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
menus.py
---------------------
Date : February 2016
Copyright : (C) 2016 by Victor Olaya
Email : volayaf at gmail dot com
*******************************... | NaturalGIS/QGIS | python/plugins/processing/gui/menus.py | Python | gpl-2.0 | 13,513 | 0.001406 |
from django.db.models import *
from django.contrib.auth.models import User
from uuid import uuid4
class Device(Model):
user = ForeignKey(User, on_delete=CASCADE, related_name='devices')
api_token = CharField(max_length=512, default=uuid4)
name = CharField(max_length=512)
def len(self):
return ... | trousev/watchme | backend/models.py | Python | bsd-2-clause | 800 | 0.00625 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of ubuntufaq
# Copyright (C) 2011 Carlos Garcia Gomez neorazorx@gmail.com
#
# 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 Foun... | NeoRazorX/ubuntufaq | enlaces.py | Python | agpl-3.0 | 11,757 | 0.007487 |
# coding=utf-8
import codecs
import logging
import cherrypy
import tailer
from schema import And, Schema, SchemaError, Use
from ws4py.messaging import TextMessage
from ws4py.websocket import WebSocket
import autosubliminal
from autosubliminal import system
from autosubliminal.core.runner import Runner
from autosubli... | h3llrais3r/Auto-Subliminal | autosubliminal/core/websocket.py | Python | gpl-3.0 | 4,134 | 0.001935 |
from Heap import Heap
newHeap = Heap()
newHeap.insert(12)
newHeap.insert(-3)
newHeap.insert(23)
newHeap.insert(4)
newHeap.insert(100)
newHeap.displayHeap()
| pranavj1001/LearnLanguages | python/DataStructures/Heaps/App.py | Python | mit | 159 | 0 |
#!/usr/bin/env python3
from contextlib import contextmanager
import time
from main import has_subset_sum_zero
class Duration:
def __init__(self, elapsed=None):
self.elapsed = elapsed
@contextmanager
def timeit():
duration = Duration()
tic = time.time()
yield duration
elapsed = time.time... | vigojug/reto | 201705/peque/biggest_set.py | Python | bsd-3-clause | 1,385 | 0.000722 |
from .sender import SignalSender, connect_with
from .base import ValueModel, AttachAbility
from .base import ValueInterface, ChangedInterface
from .base import AbstractItem, Item, AbstractProperty
from .multi_types import StringValueModel, StringProperty, StringItemInterface, StringItem
from .multi_types import IntVa... | SF-Zhou/prett | prett/__init__.py | Python | mit | 1,611 | 0.004345 |
import datetime
import importlib
import os
from urlparse import urlparse
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.http import HttpResponse, Http404
from django.shortcuts import render
import jingo
import jinja2
import newrelic.agent
import waffle
f... | andymckay/zamboni | mkt/commonplace/views.py | Python | bsd-3-clause | 4,032 | 0.000744 |
# -*- coding: utf-8 -*-
import os
import subprocess
import uuid
from .. import icons, util
from . import _base
try:
from PIL import Image
except:
util.error("Failed to import Python Imaging Library; is it installed?")
REQUIRE = [
"iscc",
"windeployqt",
]
KEYS = ["banner"]
class Packager(_base.Pac... | lamestation/packthing | packthing/packagers/inno.py | Python | gpl-3.0 | 4,477 | 0.000893 |
from sqlalchemy import *
from sqlalchemy.exceptions import OperationalError
from sqlalchemy.schema import DDL
import migrate.changeset
from migrate.changeset.exceptions import NotSupportedError
from migrate import *
metadata = MetaData(migrate_engine)
users_table = Table('users', metadata,
Column('id', Int... | JustinTulloss/harmonize.fm | masterapp/masterapp/model/manage/versions/22/22.py | Python | mit | 650 | 0.015385 |
# Copyright 2016 Osvaldo Santana Neto
#
# 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 ... | osantana/correios | tests/vcr.py | Python | apache-2.0 | 1,315 | 0 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import sys
from contextlib import contextmanager
from case import patch, skip
from kombu.five import bytes_t, string_t, string
from kombu.utils.encoding import (
get_default_encoding_file, safe_str,
set_default_encoding_file, d... | urbn/kombu | t/unit/utils/test_encoding.py | Python | bsd-3-clause | 3,499 | 0 |
# 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 th... | bndl/bndl | bndl/compute/tests/test_many_nodes.py | Python | apache-2.0 | 745 | 0 |
import unittest
from rdflib import URIRef
from owlapy import model
from owlapy.util.hashcode import HashCode
from owlapy.vocab.owlfacet import OWLFacet
class TestHashCode(unittest.TestCase):
def test_hash_ontology(self):
ont_id = model.OWLOntologyID()
data_factory = model.OWLDataFactory()
... | patrickwestphal/owlapy | tests/util/hashcode_tests.py | Python | gpl-3.0 | 55,391 | 0.000036 |
# Base folder support
# Copyright (C) 2002 John Goerzen
# <jgoerzen@complete.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your opt... | avsm/perscon-imap | offlineimap/folder/UIDMaps.py | Python | gpl-2.0 | 8,119 | 0.002833 |
# -*- coding: utf-8 -*-
########################################################################
#
# License: BSD
# Created: September 4, 2002
# Author: Francesc Alted - faltet@pytables.com
#
# $Id$
#
########################################################################
"""Here is defined the Group class."""
impo... | dotsdl/PyTables | tables/group.py | Python | bsd-3-clause | 47,685 | 0.000713 |
# -*- coding: utf-8 -*-
'''
An interface for music21 using mod_wsgi
To use, first install mod_wsgi and include it in the HTTPD.conf file.
Add this file to the server, ideally not in the document root,
on mac this could be /Library/WebServer/wsgi-scripts/music21wsgiapp.py
Then edit the HTTPD.conf file to re... | arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/music21/alpha/webapps/server/urlqueryapp.py | Python | mit | 3,408 | 0.013791 |
"""
Tests for the logic in input type mako templates.
"""
from __future__ import absolute_import
import json
import unittest
from collections import OrderedDict
from lxml import etree
from mako import exceptions
from six.moves import range
from capa.inputtypes import Status
from capa.tests.helpers import capa_rende... | ESOedX/edx-platform | common/lib/capa/capa/tests/test_input_templates.py | Python | agpl-3.0 | 46,422 | 0.001896 |
def element_rect(session, element):
return session.execute_script("""
let {devicePixelRatio} = window;
let rect = arguments[0].getBoundingClientRect();
return {
x: Math.floor((rect.left + window.pageXOffset) * devicePixelRatio),
y: Math.floor((rect.top + window.pageY... | jimberlage/servo | tests/wpt/web-platform-tests/webdriver/tests/take_element_screenshot/__init__.py | Python | mpl-2.0 | 516 | 0 |
from Screen import Screen
from Components.ActionMap import ActionMap
from Components.Label import Label
from Components.Pixmap import Pixmap
from Components.Sources.StaticText import StaticText
from Components.MenuList import MenuList
from enigma import eTimer
class MessageBox(Screen):
TYPE_YESNO = 0
TYPE_INFO = 1
... | pli3/enigma2-git | lib/python/Screens/MessageBox.py | Python | gpl-2.0 | 3,710 | 0.040162 |
file = "../_ser/lininteg.py"
out = ["namespace mfem {"]
fid = open(file, 'r')
for line in fid.readlines():
if line.startswith("class"):
cname = (line.split(' ')[1]).split('(')[0]
if line.startswith(" def __init__"):
pp = ""
if line.find("*args") != -1:
pp = " ... | mfem/PyMFEM | mfem/common/generate_lininteg_ext.py | Python | bsd-3-clause | 1,212 | 0.00165 |
class Solution():
def sortColors(nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
store = [[],[],[]]
for i in nums:
store[i].append(i)
return store[0]+store[1]+store[2]
class Solution1():
... | euccas/CodingPuzzles-Python | leet/source/twopointers/sort_colors.py | Python | mit | 3,224 | 0.004963 |
"""
Module for check_snmp_ilo4
"""
# Copyright (C) 2016-2019 rsmuc <rsmuc@sec-dev.de>
# This file is part of "Health Monitoring Plugins".
# "Health Monitoring Plugins" is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... | rsmuc/health_monitoring_plugins | health_monitoring_plugins/ilo.py | Python | gpl-2.0 | 17,237 | 0.003017 |
#!/usr/bin/env python3
import unittest
import amulet
class TestDeploy(unittest.TestCase):
"""
Trivial deployment test for Apache Hadoop NameNode.
This charm cannot do anything useful by itself, so integration testing
is done in the bundle.
"""
def test_deploy(self):
self.d = amulet.... | c0s/juju-apache-bigtop-namenode | tests/01-basic-deployment.py | Python | apache-2.0 | 578 | 0 |
# -*- coding: utf-8 -*-
import os
import time
import util
import urllib, urllib2
import base64
from datetime import datetime
import env
from glob import glob
END_POINT = env.END_POINT
BASE_DIR = env.BASE_DIR
STORAGE_URL = env.STORAGE_URL
def get_latest_file(dirname):
dest = os.path.join(dirnam... | spin13/python_maclib | fsevent_dog.py | Python | mit | 1,485 | 0.005394 |
#
# Author: Pearu Peterson, March 2002
#
# w/ additions by Travis Oliphant, March 2002
# and Jake Vanderplas, August 2012
from __future__ import division, print_function, absolute_import
from warnings import warn
import numpy as np
from numpy import atleast_1d, atleast_2d
from .flinalg import get_flinalg... | Eric89GXL/scipy | scipy/linalg/basic.py | Python | bsd-3-clause | 55,293 | 0 |
import xmlrpclib
# version: 2.001
from jenkinsapi import api
jenkins = api.Jenkins('http://localhost:8080')
twister_job = jenkins.get_job('twister') # The Jenkins job is called `twister` !
twister_build = twister_job.get_last_build()
twister_status = twister_build.get_status()
print 'Status:', twister_status
if tw... | twister/twister.github.io | binaries/JenkinsPlugin/Jenkins/Jenkins_Post_Script.py | Python | apache-2.0 | 810 | 0.006173 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.